text
stringlengths
2
100k
meta
dict
// SPDX-License-Identifier: GPL-2.0+ /* * This file's test data is derived from UEFI SCT. * The original copyright is attached below. */ /* * Copyright 2006 - 2016 Unified EFI, Inc.<BR> * Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR> * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD * License which accompanies this distribution. The full text of the license * may be found at * http://opensource.org/licenses/bsd-license.php * * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. */ #include <efi.h> #ifdef NOT_USED /* * TODO: These macro's are not used as they appear only in * "#ifdef NOT_USED" clauses. In the future, define them elsewhere. */ /* HII form */ #define EFI_IFR_AND_OP 0x15 #define EFI_IFR_END_OP 0x29 #define EFI_IFR_BITWISE_AND_OP 0x35 /* HII image */ #define EFI_HII_IIBT_END 0x00 #define EFI_HII_IIBT_IMAGE_1BIT 0x10 #endif /* HII keyboard layout */ #define EFI_NULL_MODIFIER 0x0000 u8 packagelist1[] = { // EFI_HII_PACKAGE_LIST_HEADER, length = 20 // SimpleFont, Font, GUID, Form, String, Image, DevicePath, // (74) (110) 20 (8) 78 (67) (8) // KeyboardLayout, End // 192 4 0x89, 0xcd, 0xab, 0x03, 0xf4, 0x03, 0x44, 0x70, 0x81, 0xde, 0x99, 0xb1, 0x81, 0x20, 0xf7, 0x68, //16: guid 0x3a, 0x01, 0x00, 0x00, // 4: total 314(0x13a) #ifdef NOT_USED /* TODO: simple font package not implemented yet */ // // Simple Font Package 1, length = 74 // 0x4A, 0x00, 0x00, EFI_HII_PACKAGE_SIMPLE_FONTS, 1, 0, 1, 0, 0x55, 0x0, 0x1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0x77, 0x0, 0x2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, // // Font Package 1, length = 110 // 0x6e, 0x00, 0x00, // 3 EFI_HII_PACKAGE_FONTS, // 1 0x5c, 0x00, 0x00, 0x00, // 4: size of header 0x5c, 0x00, 0x00, 0x00, // 4: offset 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00, 0xf5, 0x00, 0xec, 0xec, //10+2(pads) 0xff, 0x33, 0xff, 0x44, // 4: font style 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, //64 // // Glyph block 1, length = 18 // EFI_HII_GIBT_GLYPH_DEFAULT, // 1 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x99, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, //16: BitMapData EFI_HII_GIBT_END, // 1 #endif // // Guid Package 1, length = 20 // 0x14, 0x00, 0x00, // 3 EFI_HII_PACKAGE_TYPE_GUID, // 1 0x5a, 0xc9, 0x87, 0x03, 0x3, 0xd7, 0x46, 0x23, 0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8, //16: guid #ifdef NOT_USED /* TODO: form package not implemented yet */ // // EFI_HII_PACKAGE_FORMS, length = 8 // 0x08, 0x00, 0x00, // 3 EFI_HII_PACKAGE_FORMS, // 1 // // Opcode 1, length = 4 // EFI_IFR_AND_OP, 0x82, EFI_IFR_END_OP, 0x02, // #endif // EFI_HII_PACKAGE_STRINGS, length = 78 // 0x4e, 0x00, 0x00, // 3: length(header) EFI_HII_PACKAGE_STRINGS, // 1: type(header) 0x3c, 0x00, 0x00, 0x00, // 4: header_size 0x3c, 0x00, 0x00, 0x00, // 4: string_offset 0x00, 0x00, 0x11, 0x22, 0x44, 0x55, 0x77, 0x89, //32: language_window 0x11, 0x00, 0x11, 0x22, 0x44, 0x55, 0x87, 0x89, 0x22, 0x00, 0x11, 0x22, 0x44, 0x55, 0x77, 0x89, 0x33, 0x00, 0x11, 0x22, 0x44, 0x55, 0x77, 0x89, 0x01, 0x00, // 2: language name 0x65, 0x6e, 0x2d, 0x55, 0x53, 0x3b, 0x7a, 0x68, //14: language 0x2d, 0x48, 0x61, 0x6e, 0x74, 0x00, // "en-US;zh-Hant" EFI_HII_SIBT_STRING_UCS2, // 1 0x45, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x6C, 0x00, 0x69, 0x00, 0x73, 0x00, 0x68, 0x00, 0x00, 0x00, //16: "English" EFI_HII_SIBT_END, // 1 #ifdef NOT_USED /* TODO: image package not implemented yet */ // // EFI_HII_PACKAGE_IMAGES, length = 67 // 0x43, 0x00, 0x00, // 3 EFI_HII_PACKAGE_IMAGES, // 1 0x0c, 0x00, 0x00, 0x00, // 4: image info offset 0x39, 0x00, 0x00, 0x00, // 4: palette info offset EFI_HII_IIBT_IMAGE_1BIT, // 1 0x01, 0x0b, 0x00, 0x13, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf8, 0x00, 0xfc, 0x00, 0xfe, 0x00, 0xff, 0x00, 0xff, 0x80, 0xff, 0xc0, 0xff, 0xe0, 0xfe, 0x00, 0xef, 0x00, 0xcf, 0x00, 0x87, 0x80, 0x07, 0x80, 0x03, 0xc0, 0x03, 0xc0, 0x01, 0x80, //43 EFI_HII_IIBT_END, // 1 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, //10 // // EFI_HII_PACKAGE_DEVICE_PATH, length = 8 // 0x08, 0x00, 0x00, // 3 EFI_HII_PACKAGE_DEVICE_PATH, // 1 0x01, 0x23, 0x45, 0x66, // 4: dummy device path protocol // instance address #endif // // Keyboard layout package 1, length = 192 0xc0, 0x00, 0x00, // 3: length(header) EFI_HII_PACKAGE_KEYBOARD_LAYOUT, // 1: type(header) 0x02, 0x00, // 2: LayoutCount // // Layout 1, length = 93 // 0x5d, 0x00, // 2: layout_length 0x95, 0xe4, 0x40, 0x8d, 0xaa, 0xe2, 0x6f, 0x4c, 0x89, 0x70, 0x68, 0x85, 0x09, 0xee, 0xc7, 0xd2, //16: guid 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor_ // string_offset 0x02, // 1: descriptor_count // // Descriptor 1, length = 16 // 49, 0x00, 0x00, 0x00, // 4: key (EfiKeyD1) 'q', 0x00, // 2: unicode 'Q', 0x00, // 2: shifted_unicode 0x00, 0x00, // 2: alt_gr_unicode 0x00, 0x00, // 2: shifted_alt_gr_unicode EFI_NULL_MODIFIER, 0x00, // 2: modifier 0x03, 0x00, // 2: affected_attribute // // Descriptor 2, length = 16 // 50, 0x00, 0x00, 0x00, // 4: key (EfiKeyD2) 'w', 0x00, // 2: unicode 'W', 0x00, // 2: shifted_unicode 0x00, 0x00, // 2: alt_gr_unicode 0x00, 0x00, // 2: shifted_alt_gr_unicode EFI_NULL_MODIFIER, 0x00, // 2: modifier 0x3, 0x0, // 2: affected_attribute // // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38 // 0x01, 0x00, // 2: DescriptionCount 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0, //10: RFC3066 language code ' ', 0x0, // 2: Space 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0, '1', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0, //24: DescriptionString // // Layout 2, length = 93 // 0x5d, 0x00, // 2: layout_length 0x3e, 0x0b, 0xe6, 0x2a, 0xd6, 0xb9, 0xd8, 0x49, 0x9a, 0x16, 0xc2, 0x48, 0xf1, 0xeb, 0xa8, 0xdb, //16: guid 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor_ // string_offset 0x02, // 1 Descriptor count // // Descriptor 1, length = 16 // 51, 0x0, 0x0, 0x0, // 4: key (EfiKeyD3) 'e', 0x00, // 2: unicode 'E', 0x00, // 2: shifted_unicode 0x00, 0x00, // 2: alt_gr_unicode 0x00, 0x00, // 2: shifted_alt_gr_unicode EFI_NULL_MODIFIER, 0x0, // 2: modifier 0x3, 0x0, // 2: affected_attribute // // Descriptor 2, length = 16 // 52, 0x0, 0x0, 0x0, // 4: key (EfiKeyD4) 'r', 0x00, // 2: unicode 'R', 0x00, // 2: shifted_unicode 0x00, 0x00, // 2: alt_gr_unicode 0x00, 0x00, // 2: shifted_alt_gr_unicode EFI_NULL_MODIFIER, 0x0, // 2: modifier 0x3, 0x0, // 2: affected_attribute // // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38 // 0x01, 0x00, // 2: DescriptionCount 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0, //10: RFC3066 language code ' ', 0x0, // 2: Space 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0, '2', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0, //24: DescriptionString // // End of package list, length = 4 // 0x4, 0x00, 0x00, EFI_HII_PACKAGE_END }; u8 packagelist2[] = { // EFI_HII_PACKAGE_LIST_HEADER, length = 20 // SimpleFont, Font, GUID, KeyboardLayout, Form, End // (74) (122) 20 192 (8) 4 0xd3, 0xde, 0x85, 0x86, 0xce, 0x1b, 0xf3, 0x43, 0xa2, 0x0c, 0xa3, 0x06, 0xec, 0x69, 0x72, 0xdd, //16 0xec, 0x00, 0x00, 0x00, // 4: total 236(0xec) #ifdef NOT_USED /* TODO: simple font package not implemented yet */ // // Simple Font Package 2, length = 74 // 0x4A, 0x00, 0x00, // 3 EFI_HII_PACKAGE_SIMPLE_FONTS, // 1 1, 0, // 2 1, 0, // 2 0x33, 0x0, 0, 1, 2, 3, 4, 5, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, //22 0x44, 0x0, 0x2, 2, 3, 4, 5, 6, 0, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, //22 3, 4, 5, 6, 7, 8, 9, 10, 11, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, //22 // // Font Package 2, length = 122 // 0x7A, 0x00, 0x00, // 3 EFI_HII_PACKAGE_FONTS, // 1 0x5C, 0x00, 0x00, 0x00, // 4: size of header 0x5C, 0x00, 0x00, 0x00, // 4: dummy offset 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00, 0xf5, 0x00, 0xec, 0xec, //10+2(pads) 0xff, 0x11, 0xff, 0x22, // 4: font style 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, //64 // // Glyph block 1, length = 30 // EFI_HII_GIBT_GLYPH, // 1 0xf1, 0x00, 0xf2, 0x00, 0xf3, 0x00, 0xf4, 0x00, 0xf5, 0x00, //10 0xff, 0x01, // 2 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, //16: BitMapData EFI_HII_GIBT_END, // 1 #endif // // Guid Package 1, length = 20 // 0x14, 0x00, 0x00, // 3 EFI_HII_PACKAGE_TYPE_GUID, // 1 0x5a, 0xc9, 0x87, 0x03, 0x3, 0xd7, 0x46, 0x23, 0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8, //16: guid // // Keyboard layout package 2, length = 192 0xc0, 0x00, 0x00, // 3 EFI_HII_PACKAGE_KEYBOARD_LAYOUT, // 1 0x02, 0x00, //0xec, 0xec, // 2: LayoutCount // // Layout 1, length = 93 // 0x5d, 0x00, // 2: layout_length 0x1f, 0x6a, 0xf5, 0xe0, 0x6b, 0xdf, 0x7e, 0x4a, 0xa3, 0x9a, 0xe7, 0xa5, 0x19, 0x15, 0x45, 0xd6,//16: guid 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor // string offset 0x02, // 1: descriptor_count // // Descriptor 1, length = 16 // 32, 0x00, 0x00, 0x00, // 4: key (EfiKeyC1) 'a', 0x00, // 2: unicode 'A', 0x00, // 2: shifted_unicode 0x00, 0x00, // 2: alt_gr_unicode 0x00, 0x00, // 2: shifted_alt_gr_unic EFI_NULL_MODIFIER, 0x00, // 2: modifier 0x03, 0x00, // 2: affected_attribute // // Descriptor 2, length = 16 // 33 /*EfiKeyC2*/, 0x00, 0x00, 0x00, 's', 0x00, 'S', 0x00, 0x00, 0x00, 0x00, 0x00, EFI_NULL_MODIFIER, 0x00, 0x3, 0x0, // // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38 // 0x01, 0x00, // 2: DescriptionCount 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0, //10: RFC3066 language code ' ', 0x0, // 2: Space 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0, '3', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0, //24: DescriptionString // // Layout 2, length = 93 // 0x5d, 0x00, // 2: layout_length 0xc9, 0x6a, 0xbe, 0x47, 0xcc, 0x54, 0xf9, 0x46, 0xa2, 0x62, 0xd5, 0x3b, 0x25, 0x6a, 0xc, 0x34, //16: guid 0x37, 0x00, 0x00, 0x00, // 4: layout_descriptor // string_offset 0x02, // 1: descriptor_count // // Descriptor 1, length = 16 // 34 /*EfiKeyC3*/, 0x0, 0x0, 0x0, 'd', 0x00, 'D', 0x00, 0x00, 0x00, 0x00, 0x00, EFI_NULL_MODIFIER, 0x0, 0x3, 0x0, // // Descriptor 2, length = 16 // 35 /*EfiKeyC4*/, 0x0, 0x0, 0x0, 'e', 0x00, 'E', 0x00, 0x00, 0x00, 0x00, 0x00, EFI_NULL_MODIFIER, 0x0, 0x3, 0x0, // // EFI_DESCRIPTOR_STRING_BUNDLE, length = 38 // 0x01, 0x00, // 2: DescriptionCount 'e', 0x0, 'n', 0x0, '-', 0x0, 'U', 0x0, 'S', 0x0, //10: RFC3066 language code ' ', 0x0, // 2: Space 'S', 0x0, 'i', 0x0, 'm', 0x0, 'p', 0x0, 'l', 0x0, 'e', 0x0, '4', 0x0, 'o', 0x0, 'n', 0x0, 'l', 0x0, 'y', 0x0, '\0', 0x0, //24: DescriptionString #ifdef NOT_USED /* TODO: form package not implemented yet */ // // EFI_HII_PACKAGE_FORMS, length = 8 // 0x08, 0x00, 0x00, // 3 EFI_HII_PACKAGE_FORMS, // 1 // // Opcode 1 // EFI_IFR_BITWISE_AND_OP, // 1 0x02, // 1 EFI_IFR_END_OP, // 1 0x02, // 1 #endif // // End of package list, length = 4 // 0x4, 0x00, 0x00, // 3 EFI_HII_PACKAGE_END // 1 }; efi_guid_t packagelist_guid1 = EFI_GUID(0x03abcd89, 0x03f4, 0x7044, 0x81, 0xde, 0x99, 0xb1, 0x81, 0x20, 0xf7, 0x68); efi_guid_t packagelist_guid2 = EFI_GUID(0x8685ded3, 0x1bce, 0x43f3, 0xa2, 0x0c, 0xa3, 0x06, 0xec, 0x69, 0x72, 0xdd); efi_guid_t kb_layout_guid11 = EFI_GUID(0x8d40e495, 0xe2aa, 0x4c6f, 0x89, 0x70, 0x68, 0x85, 0x09, 0xee, 0xc7, 0xd2); efi_guid_t kb_layout_guid12 = EFI_GUID(0x2ae60b3e, 0xb9d6, 0x49d8, 0x9a, 0x16, 0xc2, 0x48, 0xf1, 0xeb, 0xa8, 0xdb); efi_guid_t kb_layout_guid21 = EFI_GUID(0xe0f56a1f, 0xdf6b, 0x4a7e, 0xa3, 0x9a, 0xe7, 0xa5, 0x19, 0x15, 0x45, 0xd6); efi_guid_t kb_layout_guid22 = EFI_GUID(0x47be6ac9, 0x54cc, 0x46f9, 0xa2, 0x62, 0xd5, 0x3b, 0x25, 0x6a, 0x0c, 0x34); efi_guid_t package_guid = EFI_GUID(0x0387c95a, 0xd703, 0x2346, 0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8);
{ "pile_set_name": "Github" }
+++ Talk_date = "" Talk_start_time = "" Talk_end_time = "" Title = "Immersion ! La sécurité applicative au coeur du DevOps" Type = "talk" Speakers = ["raphael-hiet", "gerald-compoint"] +++ Immersion ! La sécurité applicative au cœur du DevOps Partout où des décisions critiques doivent être prises, Thales est présent. Sur les marchés que nous servons (aéronautique, espace, transport terrestre, sécurité, défense), nos équipements et systèmes aident nos clients à choisir la meilleure option et à agir en conséquence. Pour accompagner l’accélération d’un monde en constante mutation, à la fois imprévisible et riche d’opportunités, Thales a mis en œuvre une démarche active de transformation, adoptant notamment les méthodologies Agiles/Lean et la culture DevOps. Une grande partie de notre activité portant sur des processus métiers critiques et des données sensibles, nous avons rapidement constaté que la confiance est un impératif à cette transformation, et qu’elle passe en particulier par la cybersécurité. C’est pourquoi, entre choc culturel et nécessité d’évolution permanente, nous avons construit une culture DevOps, en y intégrant notre savoir-faire informatique et notre expertise en cybersécurité, pour une démarche DevSecOps de bout-en-bout. Comment déployer du DevSecOps pour des environnements projet multi-sites, multi-clients, ou bien encore dans des contextes contraints où le déploiement de solutions en opération se révèle être une étape critique du projet? L’objectif de cette session est de partager avec vous ces retours d’expérience et les enseignements de la culture DevOps/DevSecOps.
{ "pile_set_name": "Github" }
<odoo> <data noupdate="1"> <record id="menu_website_ipushp" model="website.menu"> <field name="name">iPushp</field> <field name="url">/page/iPushp</field> <field name="parent_id" ref="website.main_menu" /> <field name="sequence" type="int">58</field> </record> <record id="menu_about" model="website.menu"> <field name="name">About iPushp</field> <field name="url">/page/iPushp</field> <field name="parent_id" ref="ipushp.menu_website_ipushp"/> <field name="sequence" type="int">11</field> </record> <record id="menu_registration" model="website.menu"> <field name="name">Registration</field> <field name="url">/page/iPushp#registration_section</field> <field name="parent_id" ref="ipushp.menu_website_ipushp"/> <field name="sequence" type="int">12</field> </record> <record id="menu_search" model="website.menu"> <field name="name">Find a fit</field> <field name="url">/page/search</field> <field name="parent_id" ref="ipushp.menu_website_ipushp"/> <field name="sequence" type="int">13</field> </record> </data> </odoo>
{ "pile_set_name": "Github" }
/* * * Copyright 2017 gRPC 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. * */ #include <grpc/support/port_platform.h> #include "src/core/lib/iomgr/port.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/iomgr_custom.h" #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/timer_custom.h" static grpc_custom_timer_vtable* custom_timer_impl; void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* error) { GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD(); grpc_core::ExecCtx exec_ctx; grpc_timer* timer = t->original; GPR_ASSERT(timer->pending); timer->pending = 0; GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE); custom_timer_impl->stop(t); gpr_free(t); } static void timer_init(grpc_timer* timer, grpc_millis deadline, grpc_closure* closure) { uint64_t timeout; GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD(); grpc_millis now = grpc_core::ExecCtx::Get()->Now(); if (deadline <= grpc_core::ExecCtx::Get()->Now()) { GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_NONE); timer->pending = false; return; } else { timeout = deadline - now; } timer->pending = true; timer->closure = closure; grpc_custom_timer* timer_wrapper = (grpc_custom_timer*)gpr_malloc(sizeof(grpc_custom_timer)); timer_wrapper->timeout_ms = timeout; timer->custom_timer = (void*)timer_wrapper; timer_wrapper->original = timer; custom_timer_impl->start(timer_wrapper); } static void timer_cancel(grpc_timer* timer) { GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD(); grpc_custom_timer* tw = (grpc_custom_timer*)timer->custom_timer; if (timer->pending) { timer->pending = 0; GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_CANCELLED); custom_timer_impl->stop(tw); gpr_free(tw); } } static grpc_timer_check_result timer_check(grpc_millis* next) { return GRPC_TIMERS_NOT_CHECKED; } static void timer_list_init() {} static void timer_list_shutdown() {} static void timer_consume_kick(void) {} static grpc_timer_vtable custom_timer_vtable = { timer_init, timer_cancel, timer_check, timer_list_init, timer_list_shutdown, timer_consume_kick}; void grpc_custom_timer_init(grpc_custom_timer_vtable* impl) { custom_timer_impl = impl; grpc_set_timer_impl(&custom_timer_vtable); }
{ "pile_set_name": "Github" }
<?php return true;
{ "pile_set_name": "Github" }
DEAL::Add and dot should be (1334.7905,349.71042), is (1334.7905,349.71042) DEAL::Add and dot should be (91530.094,22094.703), is (91530.094,22094.703) DEAL::Add and dot should be (181725.41,43834.062), is (181725.41,43834.062) DEAL::Add and dot should be (271920.72,65573.367), is (271920.72,65573.367) DEAL::Add and dot should be (362116.00,87312.664), is (362116.00,87312.664) DEAL::Vector add reference: (0.025536000,1.8415145) (0.033113600,14.442955) (0.040691200,27.044395) (0.048268800,39.645835) (0.055846400,52.247275) (0.063424000,64.848715) (0.071001600,77.450155) (0.078579200,90.051595) (0.086156800,102.65303) (0.093734400,115.25447) (0.10131200,127.85591) (0.10888960,140.45735) (0.11646720,153.05879) (0.12404480,165.66023) (0.13162240,178.26167) (0.13920000,190.86311) (0.14677760,203.46455) DEAL::Vector check reference: (0.025536000,1.8415145) (0.033113600,14.442955) (0.040691200,27.044395) (0.048268800,39.645835) (0.055846400,52.247275) (0.063424000,64.848715) (0.071001600,77.450155) (0.078579200,90.051595) (0.086156800,102.65303) (0.093734400,115.25447) (0.10131200,127.85591) (0.10888960,140.45735) (0.11646720,153.05879) (0.12404480,165.66023) (0.13162240,178.26167) (0.13920000,190.86311) (0.14677760,203.46455) DEAL::Add and dot should be (1334.7906,349.71041), is (1334.7906,349.71041) DEAL::Add and dot should be (91530.091,22094.701), is (91530.091,22094.701) DEAL::Add and dot should be (181725.40,43834.063), is (181725.40,43834.063) DEAL::Add and dot should be (271920.71,65573.368), is (271920.71,65573.368) DEAL::Add and dot should be (362116.02,87312.657), is (362116.02,87312.657) DEAL::OK
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> <key>IBDocumentLocation</key> <string>29 42 356 240 0 0 1280 1002 </string> <key>IBEditorPositions</key> <dict> <key>29</key> <string>10 455 318 44 0 0 1280 1002 </string> </dict> <key>IBFramework Version</key> <string>248.0</string> <key>IBOpenObjects</key> <array> <integer>29</integer> <integer>21</integer> </array> <key>IBSystem Version</key> <string>5S66</string> </dict> </plist>
{ "pile_set_name": "Github" }
{ "compilerOptions": { "allowJs": true, "strict": true, "isolatedModules": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "strictPropertyInitialization": false, "noEmit": true, "module": "esnext", "moduleResolution": "node", "sourceMap": true, "declaration": true, "skipLibCheck": true, "esModuleInterop": true, "noImplicitAny": true, "noEmitOnError": true, "noUnusedLocals": true, "strictNullChecks": true, "resolveJsonModule": true, "experimentalDecorators": true, "jsx": "react", "target": "es5", "lib": [ "dom", "es2015" ] }, "include": [ "src" ] }
{ "pile_set_name": "Github" }
PASS Test LongLong: result is 0 as expected! PASS Test LongLong: result is 1 as expected! PASS Test LongLong: result is -1 as expected! PASS Test LongLong: result is -9223372036854776000 as expected! PASS Test LongLong: result is -9223372036854776000 as expected! PASS Test UnsignedLongLong: result is 0 as expected! PASS Test UnsignedLongLong: result is 1 as expected! PASS Test UnsignedLongLong: result is 18446744073709552000 as expected! PASS Test UnsignedLongLong: result is 9223372036854776000 as expected! PASS Test UnsignedLongLong: result is 9223372036854776000 as expected!
{ "pile_set_name": "Github" }
{ "!name": "a/b.js", "iHaveASpan": { "!type": "fn()", "!span": "40[3:2]-60[3:22]" } }
{ "pile_set_name": "Github" }
# Copyright (C) 2018 Heron Systems, 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/>. import os from time import time import datetime import numpy as np import ray from ray.util.sgd.utils import find_free_port import torch import torch.distributed as dist from torch.utils.tensorboard import SummaryWriter from adept.container.base import Container, NCCLOptimizer from adept.container.local import LocalUpdater from adept.network import ModularNetwork from adept.registry import REGISTRY from adept.container.actorlearner.rollout_queuer import RolloutQueuerAsync from adept.utils import dtensor_to_dev, listd_to_dlist from adept.utils.logging import SimpleModelSaver class ActorLearnerHost(Container): @classmethod def as_remote( cls, num_cpus=None, num_gpus=None, memory=None, object_store_memory=None, resources=None, ): return ray.remote( num_cpus=num_cpus, num_gpus=num_gpus, memory=memory, object_store_memory=object_store_memory, resources=resources, )(cls) def __init__( self, args, log_id_dir, initial_step_count, rank=0, ): # ARGS TO STATE VARS self._args = args self.nb_learners = args.nb_learners self.nb_workers = args.nb_workers self.rank = rank self.nb_step = args.nb_step self.nb_env = args.nb_env self.initial_step_count = initial_step_count self.epoch_len = args.epoch_len self.summary_freq = args.summary_freq self.nb_learn_batch = args.nb_learn_batch self.rollout_queue_size = args.rollout_queue_size # can be none if rank != 0 self.log_id_dir = log_id_dir # load saved registry classes REGISTRY.load_extern_classes(log_id_dir) # ENV (temporary) env_cls = REGISTRY.lookup_env(args.env) env = env_cls.from_args(args, 0) env_action_space, env_observation_space, env_gpu_preprocessor = ( env.action_space, env.observation_space, env.gpu_preprocessor, ) env.close() # NETWORK torch.manual_seed(args.seed) device = torch.device("cuda") # ray handles gpus torch.backends.cudnn.benchmark = True output_space = REGISTRY.lookup_output_space( args.actor_worker, env_action_space ) if args.custom_network: net_cls = REGISTRY.lookup_network(args.custom_network) else: net_cls = ModularNetwork net = net_cls.from_args( args, env_observation_space, output_space, env_gpu_preprocessor, REGISTRY, ) self.network = net.to(device) # TODO: this is a hack, remove once queuer puts rollouts on the correct device self.network.device = device self.device = device self.network.train() # OPTIMIZER def optim_fn(x): return torch.optim.RMSprop(x, lr=args.lr, eps=1e-5, alpha=0.99) if args.nb_learners > 1: self.optimizer = NCCLOptimizer( optim_fn, self.network, self.nb_learners ) else: self.optimizer = optim_fn(self.network.parameters()) # LEARNER / EXP rwd_norm = REGISTRY.lookup_reward_normalizer(args.rwd_norm).from_args( args ) actor_cls = REGISTRY.lookup_actor(args.actor_host) builder = actor_cls.exp_spec_builder( env.observation_space, env.action_space, net.internal_space(), args.nb_env * args.nb_learn_batch, ) actor = actor_cls.from_args(args, env.action_space) learner = REGISTRY.lookup_learner(args.learner).from_args( args, rwd_norm ) exp_cls = REGISTRY.lookup_exp(args.exp).from_args(args, builder) self.actor = actor self.learner = learner self.exp = exp_cls.from_args(args, builder).to(device) self.updater = LocalUpdater( self.optimizer, self.network, args.grad_norm_clip ) # Rank 0 setup, load network/optimizer and create SummaryWriter/Saver if rank == 0: if args.load_network: self.network = self.load_network( self.network, args.load_network ) print("Reloaded network from {}".format(args.load_network)) if args.load_optim: self.optimizer = self.load_optim( self.optimizer, args.load_optim ) print("Reloaded optimizer from {}".format(args.load_optim)) print("Network parameters: " + str(self.count_parameters(net))) self.summary_writer = SummaryWriter(log_id_dir) self.saver = SimpleModelSaver(log_id_dir) def run(self, workers, profile=False): if profile: try: from pyinstrument import Profiler except: raise ImportError( "You must install pyinstrument to use profiling." ) profiler = Profiler() profiler.start() # setup queuer rollout_queuer = RolloutQueuerAsync( workers, self.nb_learn_batch, self.rollout_queue_size ) rollout_queuer.start() # initial setup global_step_count = self.initial_step_count next_save = self.init_next_save(self.initial_step_count, self.epoch_len) prev_step_t = time() ep_rewards = torch.zeros(self.nb_env) start_time = time() # loop until total number steps print("{} starting training".format(self.rank)) while not self.done(global_step_count): self.exp.clear() # Get batch from queue rollouts, terminal_rewards, terminal_infos = rollout_queuer.get() # Iterate forward on batch self.exp.write_exps(rollouts) # keep a copy of terminals on the cpu it's faster rollout_terminals = torch.stack(self.exp["terminals"]).numpy() self.exp.to(self.device) r = self.exp.read() internals = {k: ts[0].unbind(0) for k, ts in r.internals.items()} for obs, rewards, terminals in zip( r.observations, r.rewards, rollout_terminals ): _, h_exp, internals = self.actor.act( self.network, obs, internals ) self.exp.write_actor(h_exp, no_env=True) # where returns a single element tuple with the indexes terminal_inds = np.where(terminals)[0] for i in terminal_inds: for k, v in self.network.new_internals(self.device).items(): internals[k][i] = v # compute loss loss_dict, metric_dict = self.learner.learn_step( self.updater, self.network, self.exp.read(), r.next_observation, internals, ) total_loss = torch.sum( torch.stack(tuple(loss for loss in loss_dict.values())) ) # Perform state updates global_step_count += ( self.nb_env * self.nb_learn_batch * len(r.terminals) * self.nb_learners ) # if rank 0 write summaries and save # and send parameters to workers async if self.rank == 0: # TODO: this could be parallelized, chunk by nb learners self.synchronize_worker_parameters(workers, global_step_count) # possible save if global_step_count >= next_save: self.saver.save_state_dicts( self.network, global_step_count, self.optimizer ) next_save += self.epoch_len # write reward summaries if any(terminal_rewards): terminal_rewards = list( filter(lambda x: x is not None, terminal_rewards) ) self.summary_writer.add_scalar( "reward", np.mean(terminal_rewards), global_step_count ) # write infos if any(terminal_infos): terminal_infos = list( filter(lambda x: x is not None, terminal_infos) ) float_keys = [ k for k, v in terminal_infos[0].items() if type(v) == float ] terminal_infos_dlist = listd_to_dlist(terminal_infos) for k in float_keys: self.summary_writer.add_scalar( f"info/{k}", np.mean(terminal_infos_dlist[k]), global_step_count, ) # write summaries cur_step_t = time() if cur_step_t - prev_step_t > self.summary_freq: print( "Rank {} Metrics:".format(self.rank), rollout_queuer.metrics(), ) if self.rank == 0: self.write_summaries( self.summary_writer, global_step_count, total_loss, loss_dict, metric_dict, self.network.named_parameters(), ) prev_step_t = cur_step_t rollout_queuer.close() print("{} stopped training".format(self.rank)) if profile: profiler.stop() print(profiler.output_text(unicode=True, color=True)) def done(self, global_step_count): return global_step_count >= self.nb_step def close(self): pass def get_parameters(self): params = [p.cpu() for p in self.network.parameters()] return params def synchronize_worker_parameters( self, workers, global_step_count=0, blocking=False ): parameters = self.get_parameters() futures = [w.set_weights.remote(parameters) for w in workers] if global_step_count != 0: futures.extend( [w.set_global_step.remote(global_step_count) for w in workers] ) if blocking: ray.get(futures) def _rank0_nccl_port_init(self): ip = ray.services.get_node_ip_address() port = find_free_port() nccl_addr = "tcp://{ip}:{port}".format(ip=ip, port=port) return nccl_addr, ip, port def _nccl_init(self, nccl_addr, nccl_ip, nccl_port): self.nccl_ip, self.nccl_addr, self.nccl_port = ( nccl_ip, nccl_addr, nccl_port, ) print( "Rank {} calling init_process_group. Addr: {}".format( self.rank, nccl_addr ) ) # from https://github.com/pytorch/pytorch/blob/master/test/simulate_nccl_errors.py store = dist.TCPStore( self.nccl_ip, self.nccl_port, self.nb_learners, self.rank == 0 ) process_group = dist.ProcessGroupNCCL( store, self.rank, self.nb_learners ) print("Rank {} initialized process group.".format(self.rank)) process_group.barrier() print("Rank {} process group barrier finished.".format(self.rank)) self.process_group = process_group # set optimizer process_group self.optimizer.set_process_group(self.process_group) def _sync_peer_parameters(self): print("Rank {} syncing parameters.".format(self.rank)) self.process_group.barrier() for p in self.network.parameters(): self.process_group.allreduce(p.data) p.data = p.data / self.nb_learners print("Rank {} parameters synced.".format(self.rank))
{ "pile_set_name": "Github" }
use ks; flush logs; create table stu ( id int(11) NOT NULL, name varchar(40) NOT NULL, age int(11) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 1 begin; insert into stu(id,name,age) values(10,"hello1",101); insert into stu(id,name,age) values(12,"hello2",102); update stu set age=1101 where id =10; delete from stu where id=12; commit; -- 2 begin; insert into stu(id,name,age) values(20,"hello1",101); insert into stu(id,name,age) values(22,"hello2",102); update stu set age=1101 where id =20; delete from stu where id=22; commit; -- 3 begin; insert into stu(id,name,age) values(30,"hello1",101); insert into stu(id,name,age) values(32,"hello2",102); update stu set age=1101 where id =30; delete from stu where id=32; commit; --4 begin; insert into stu(id,name,age) values(40,"hello1",101); insert into stu(id,name,age) values(42,"hello2",102); update stu set age=1101 where id =40; delete from stu where id=42; commit; --5 begin; insert into stu(id,name,age) values(50,"hello1",101); insert into stu(id,name,age) values(52,"hello2",102); update stu set age=1101 where id =50; delete from stu where id=52; commit; --6 begin; insert into stu(id,name,age) values(60,"hello1",101); insert into stu(id,name,age) values(62,"hello2",102); update stu set age=1101 where id =60; delete from stu where id=62; commit; --7 begin; insert into stu(id,name,age) values(70,"hello1",101); insert into stu(id,name,age) values(72,"hello2",102); update stu set age=1101 where id =70; delete from stu where id=72; commit; --8 begin; insert into stu(id,name,age) values(80,"hello1",101); insert into stu(id,name,age) values(82,"hello2",102); update stu set age=1101 where id =80; delete from stu where id=82; commit; --9 begin; insert into stu(id,name,age) values(90,"hello1",101); insert into stu(id,name,age) values(92,"hello2",102); update stu set age=1101 where id =90; delete from stu where id=92; commit; --10 begin; insert into stu(id,name,age) values(100,"hello1",101); insert into stu(id,name,age) values(102,"hello2",102); update stu set age=1101 where id =100; delete from stu where id=102; commit; flush logs; -- 11 begin; insert into stu(id,name,age) values(110,"hello1",101); insert into stu(id,name,age) values(112,"hello2",102); update stu set age=1101 where id =110; delete from stu where id=112; commit; -- 12 begin; insert into stu(id,name,age) values(120,"hello1",101); insert into stu(id,name,age) values(122,"hello2",102); update stu set age=1101 where id =120; delete from stu where id=122; commit; -- 13 begin; insert into stu(id,name,age) values(130,"hello1",101); insert into stu(id,name,age) values(132,"hello2",102); update stu set age=1101 where id =130; delete from stu where id=132; commit; --14 begin; insert into stu(id,name,age) values(140,"hello1",101); insert into stu(id,name,age) values(142,"hello2",102); update stu set age=1101 where id =140; delete from stu where id=142; commit; --15 begin; insert into stu(id,name,age) values(150,"hello1",101); insert into stu(id,name,age) values(152,"hello2",102); update stu set age=1101 where id =150; delete from stu where id=152; commit; --16 begin; insert into stu(id,name,age) values(160,"hello1",101); insert into stu(id,name,age) values(162,"hello2",102); update stu set age=1101 where id =160; delete from stu where id=162; commit; --17 begin; insert into stu(id,name,age) values(170,"hello1",101); insert into stu(id,name,age) values(172,"hello2",102); update stu set age=1101 where id =170; delete from stu where id=172; commit; --18 begin; insert into stu(id,name,age) values(180,"hello1",101); insert into stu(id,name,age) values(182,"hello2",102); update stu set age=1101 where id =180; delete from stu where id=182; commit; --19 begin; insert into stu(id,name,age) values(190,"hello1",101); insert into stu(id,name,age) values(192,"hello2",102); update stu set age=1101 where id =190; delete from stu where id=192; commit; --20 begin; insert into stu(id,name,age) values(200,"hello1",101); insert into stu(id,name,age) values(202,"hello2",102); update stu set age=1101 where id =200; delete from stu where id=202; commit; flush logs; -- 21 begin; insert into stu(id,name,age) values(210,"hello1",101); insert into stu(id,name,age) values(212,"hello2",102); update stu set age=1101 where id =210; delete from stu where id=212; commit; -- 22 begin; insert into stu(id,name,age) values(220,"hello1",101); insert into stu(id,name,age) values(222,"hello2",102); update stu set age=1101 where id =220; delete from stu where id=222; commit; -- 23 begin; insert into stu(id,name,age) values(230,"hello1",101); insert into stu(id,name,age) values(232,"hello2",102); update stu set age=1101 where id =230; delete from stu where id=232; commit; --24 begin; insert into stu(id,name,age) values(240,"hello1",101); insert into stu(id,name,age) values(242,"hello2",102); update stu set age=1101 where id =240; delete from stu where id=242; commit; --25 begin; insert into stu(id,name,age) values(250,"hello1",101); insert into stu(id,name,age) values(252,"hello2",102); update stu set age=1101 where id =250; delete from stu where id=252; commit; --26 begin; insert into stu(id,name,age) values(260,"hello1",101); insert into stu(id,name,age) values(262,"hello2",102); update stu set age=1101 where id =260; delete from stu where id=262; commit; --27 begin; insert into stu(id,name,age) values(270,"hello1",101); insert into stu(id,name,age) values(272,"hello2",102); update stu set age=1101 where id =270; delete from stu where id=272; commit; --28 begin; insert into stu(id,name,age) values(280,"hello1",101); insert into stu(id,name,age) values(282,"hello2",102); update stu set age=1101 where id =280; delete from stu where id=282; commit; --29 begin; insert into stu(id,name,age) values(290,"hello1",101); insert into stu(id,name,age) values(292,"hello2",102); update stu set age=1101 where id =290; delete from stu where id=292; commit; --30 begin; insert into stu(id,name,age) values(300,"hello1",101); insert into stu(id,name,age) values(302,"hello2",102); update stu set age=1101 where id =300; delete from stu where id=302; commit;
{ "pile_set_name": "Github" }
Author of sh4 specifics ----------------------- Fredrik Ehnbom - original version in May, 2004 Fredrik Ehnbom - updated version for 2.0.0wip2 in Jan, 2005 Howto use ----------------------- This assumes a working kallistios installation. It was developed with kallistios 1.3.x subversion revision 183 and sh-elf-gcc 3.4.3. Though, it does not really rely on anything kallistios specific, so it should be possible to get it up and running on other sh4-based architectures. AngelScript uses memory.h which does not seem to be provided with kos. Don't worry though, the makefile creates one for you ;) To build the library, just go to angelscript/source and type make -f ../projects/dreamcast/Makefile or wherever you put the makefile shipped with this textdocument. The library will be in $KOS_BASE/addons/lib/dreamcast/ together with all the other kos addon libraries.
{ "pile_set_name": "Github" }
// TODO (sergeyk): effect should not be dependent on phase. wasted memcpy. #include <vector> #include "caffe/layers/dropout_layer.hpp" #include "caffe/util/math_functions.hpp" namespace caffe { template <typename Dtype> void DropoutLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { NeuronLayer<Dtype>::LayerSetUp(bottom, top); threshold_ = this->layer_param_.dropout_param().dropout_ratio(); DCHECK(threshold_ > 0.); DCHECK(threshold_ < 1.); scale_ = 1. / (1. - threshold_); uint_thres_ = static_cast<unsigned int>(UINT_MAX * threshold_); } template <typename Dtype> void DropoutLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { NeuronLayer<Dtype>::Reshape(bottom, top); // Set up the cache for random number generation // ReshapeLike does not work because rand_vec_ is of Dtype uint rand_vec_.Reshape(bottom[0]->shape()); } template <typename Dtype> void DropoutLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { const Dtype* bottom_data = bottom[0]->cpu_data(); Dtype* top_data = top[0]->mutable_cpu_data(); unsigned int* mask = rand_vec_.mutable_cpu_data(); const int count = bottom[0]->count(); if (this->phase_ == TRAIN) { // Create random numbers caffe_rng_bernoulli(count, 1. - threshold_, mask); for (int i = 0; i < count; ++i) { top_data[i] = bottom_data[i] * mask[i] * scale_; } } else { caffe_copy(bottom[0]->count(), bottom_data, top_data); } } template <typename Dtype> void DropoutLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { if (propagate_down[0]) { const Dtype* top_diff = top[0]->cpu_diff(); Dtype* bottom_diff = bottom[0]->mutable_cpu_diff(); if (this->phase_ == TRAIN) { const unsigned int* mask = rand_vec_.cpu_data(); const int count = bottom[0]->count(); for (int i = 0; i < count; ++i) { bottom_diff[i] = top_diff[i] * mask[i] * scale_; } } else { caffe_copy(top[0]->count(), top_diff, bottom_diff); } } } #ifdef CPU_ONLY STUB_GPU(DropoutLayer); #endif INSTANTIATE_CLASS(DropoutLayer); REGISTER_LAYER_CLASS(Dropout); } // namespace caffe
{ "pile_set_name": "Github" }
/* * Copyright (C) 2017 Apple Inc. 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. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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 "config.h" #include "PromiseRejectionEvent.h" #include "DOMWrapperWorld.h" #include "JSDOMPromise.h" #include <JavaScriptCore/HeapInlines.h> #include <JavaScriptCore/StrongInlines.h> namespace WebCore { using namespace JSC; PromiseRejectionEvent::PromiseRejectionEvent(const AtomString& type, const Init& initializer, IsTrusted isTrusted) : Event(type, initializer, isTrusted) , m_promise(*(initializer.promise)) , m_reason(initializer.reason) { } PromiseRejectionEvent::~PromiseRejectionEvent() = default; } // namespace WebCore
{ "pile_set_name": "Github" }
2009-12-25 Christmas Day 2009-04-22 Earth Day 2009-10-31 Halloween 2009-07-04 Independence Day 2009-09-07 Labor Day 2009-01-19 Martin Luther King Day 2009-05-25 Memorial Day 2009-01-01 New Year's Day 2009-12-31 New Year's Eve 2009-03-14 PI Day 2009-02-16 President's Day 2009-03-17 St. Patrick's Day 2009-02-14 St. Valentine's Day 2009-11-26 Thanksgiving 2009-01-01 New Year's Day 2009-01-19 Martin Luther King Day 2009-02-14 St. Valentine's Day 2009-02-16 President's Day 2009-03-14 PI Day 2009-03-17 St. Patrick's Day 2009-04-22 Earth Day 2009-05-25 Memorial Day 2009-07-04 Independence Day 2009-09-07 Labor Day 2009-10-31 Halloween 2009-11-26 Thanksgiving 2009-12-25 Christmas Day 2009-12-31 New Year's Eve
{ "pile_set_name": "Github" }
p(1). p(a). p(b). p(s(f)). gather(1). enumerate(0,1). enumerate(1,a). enumerate(2,b). enumerate(3,s(f)).
{ "pile_set_name": "Github" }
<domain type='qemu'> <name>QEMUGuest1</name> <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> <memory unit='KiB'>219136</memory> <currentMemory unit='KiB'>219136</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='i686' machine='pc'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-i386</emulator> <controller type='usb' index='0' model='ich9-ehci1'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/> </controller> <controller type='usb' index='0' model='ich9-uhci1'> <master startport='0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/> </controller> <controller type='usb' index='0' model='ich9-uhci2'> <master startport='2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/> </controller> <controller type='usb' index='0' model='ich9-uhci3'> <master startport='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/> </controller> <controller type='pci' index='0' model='pci-root'/> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='4'/> </redirdev> <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='5'/> </redirdev> <redirfilter> <usbdev class='0x08' vendor='0x15E1' product='0x2007' version='1.10' allow='yes'/> <usbdev allow='no'/> </redirfilter> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </memballoon> </devices> </domain>
{ "pile_set_name": "Github" }
#! /bin/sh ## Transform $1 into $3 using XSL $2 java -cp xalan-2.6.0.jar org.apache.xalan.xslt.Process -in $1 -xsl $2 -out $3
{ "pile_set_name": "Github" }
'use strict'; exports.__esModule = true; exports.default = tokenize; var _input = require('./input'); var _input2 = _interopRequireDefault(_input); var _tokenizeString2 = require('./tokenize-string'); var _tokenizeString3 = _interopRequireDefault(_tokenizeString2); var _tokenizeComment2 = require('./tokenize-comment'); var _tokenizeComment3 = _interopRequireDefault(_tokenizeComment2); var _tokenizeInterpolant2 = require('./tokenize-interpolant'); var _tokenizeInterpolant3 = _interopRequireDefault(_tokenizeInterpolant2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var singleQuote = "'".charCodeAt(0), doubleQuote = '"'.charCodeAt(0), dollar = '$'.charCodeAt(0), hash = '#'.charCodeAt(0), backslash = '\\'.charCodeAt(0), slash = '/'.charCodeAt(0), newline = '\n'.charCodeAt(0), space = ' '.charCodeAt(0), feed = '\f'.charCodeAt(0), tab = '\t'.charCodeAt(0), cr = '\r'.charCodeAt(0), openBracket = '('.charCodeAt(0), closeBracket = ')'.charCodeAt(0), openCurly = '{'.charCodeAt(0), closeCurly = '}'.charCodeAt(0), semicolon = ';'.charCodeAt(0), asterisk = '*'.charCodeAt(0), colon = ':'.charCodeAt(0), at = '@'.charCodeAt(0), comma = ','.charCodeAt(0), plus = '+'.charCodeAt(0), minus = '-'.charCodeAt(0), decComb = '>'.charCodeAt(0), adjComb = '~'.charCodeAt(0), number = /[+-]?(\d+(\.\d+)?|\.\d+)|(e[+-]\d+)/gi, sQuoteEnd = /(.*?)[^\\](?=((#{)|'))/gm, dQuoteEnd = /(.*?)[^\\](?=((#{)|"))/gm, wordEnd = /[ \n\t\r\(\)\{\},:;@!'"\\]|\/(?=\*)|#(?={)/g, ident = /-?([a-z_]|\\[^\\])([a-z-_0-9]|\\[^\\])*/gi; function tokenize(input, l, p) { var tokens = []; var css = input.css.valueOf(); var code = void 0, next = void 0, quote = void 0, lines = void 0, last = void 0, content = void 0, escape = void 0, nextLine = void 0, nextOffset = void 0, escaped = void 0, escapePos = void 0, inInterpolant = void 0, inComment = void 0, inString = void 0; var length = css.length; var offset = -1; var line = l || 1; var pos = p || 0; while (pos < length) { code = css.charCodeAt(pos); if (code === newline) { offset = pos; line += 1; } switch (code) { case space: case tab: case cr: case feed: next = pos; do { next += 1; code = css.charCodeAt(next); if (code === newline) { offset = next; line += 1; } } while (code === space || code === tab || code === cr || code === feed); tokens.push(['space', css.slice(pos, next)]); pos = next - 1; break; case newline: tokens.push(['newline', '\n', line, pos - offset]); break; case plus: tokens.push(['+', '+', line, pos - offset]); break; case minus: tokens.push(['-', '-', line, pos - offset]); break; case decComb: tokens.push(['>', '>', line, pos - offset]); break; case adjComb: tokens.push(['~', '~', line, pos - offset]); break; case openCurly: tokens.push(['{', '{', line, pos - offset]); break; case closeCurly: if (inInterpolant) { inInterpolant = false; tokens.push(['endInterpolant', '}', line, pos - offset]); } else { tokens.push(['}', '}', line, pos - offset]); } break; case comma: tokens.push([',', ',', line, pos - offset]); break; case dollar: tokens.push(['$', '$', line, pos - offset]); break; case colon: tokens.push([':', ':', line, pos - offset]); break; case semicolon: tokens.push([';', ';', line, pos - offset]); break; case openBracket: tokens.push(['(', '(', line, pos - offset]); break; case closeBracket: tokens.push([')', ')', line, pos - offset]); break; case singleQuote: case doubleQuote: quote = code === singleQuote ? "'" : '"'; tokens.push([quote, quote, line, pos - offset]); next = pos + 1; var _tokenizeString = (0, _tokenizeString3.default)(input, line, next, quote), t = _tokenizeString.tokens, _p = _tokenizeString.pos; tokens = tokens.concat(t); next = _p; pos = next; break; case at: tokens.push(['@', '@', line, pos - offset]); break; case backslash: next = pos; escape = true; while (css.charCodeAt(next + 1) === backslash) { next += 1; escape = !escape; } code = css.charCodeAt(next + 1); if (escape && code !== space && code !== newline && code !== tab && code !== cr && code !== feed) { next += 1; } tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]); pos = next; break; default: ident.lastIndex = pos; number.lastIndex = pos; wordEnd.lastIndex = pos; if (code === slash && css.charCodeAt(pos + 1) === asterisk) { inComment = true; tokens.push(['startComment', '/*', line, pos + 1 - offset]); next = pos + 1; var _tokenizeComment = (0, _tokenizeComment3.default)(input, line, next + 1), _t = _tokenizeComment.tokens, _l = _tokenizeComment.line, _p2 = _tokenizeComment.pos, o = _tokenizeComment.offset; tokens = tokens.concat(_t); next = _p2; line = _l; offset = o; pos = next; break; } if (code === asterisk && css.charCodeAt(pos + 1) !== slash) { tokens.push(['*', '*', line, pos - offset]); break; } if (inComment && code === asterisk && css.charCodeAt(pos + 1) === slash) { inComment = false; tokens.push(['endComment', '*/', line, pos + 1 - offset]); pos += 2; break; } if (code === slash && css.charCodeAt(pos + 1) !== slash) { tokens.push(['/', '/', line, pos - offset]); break; } if (code === hash && css.charCodeAt(pos + 1) === openCurly) { inInterpolant = true; tokens.push(['startInterpolant', '#{', line, pos + 1 - offset]); next = pos + 1; var _tokenizeInterpolant = (0, _tokenizeInterpolant3.default)(input, line, next + 1), _t2 = _tokenizeInterpolant.tokens, _p3 = _tokenizeInterpolant.pos; tokens = tokens.concat(_t2); next = _p3; pos = next; break; } if (code === slash && css.charCodeAt(pos + 1) === slash) { next = css.indexOf('\n', pos + 2); next = (next > 0 ? next : css.length) - 1; tokens.push(['scssComment', css.slice(pos, next + 1), line, pos - offset, line, next - offset]); pos = next; break; } if (ident.test(css) && (ident.lastIndex = pos || 1) && ident.exec(css).index === pos) { next = ident.lastIndex - 1; tokens.push(['ident', css.slice(pos, next + 1), line, pos - offset, line, next - offset]); pos = next; break; } if (number.test(css) && (number.lastIndex = pos || 1) && number.exec(css).index === pos) { next = number.lastIndex - 1; tokens.push(['number', css.slice(pos, next + 1), line, pos - offset, line, next - offset]); pos = next; break; } wordEnd.lastIndex = pos + 1; wordEnd.test(css); if (wordEnd.lastIndex === 0) { next = css.length - 1; } else { next = wordEnd.lastIndex - 2; } tokens.push(['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset]); pos = next; break; } pos++; } return tokens; }
{ "pile_set_name": "Github" }
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79 " Vimwiki syntax file " Author: Stuart Andrews <[email protected]> " Home: http://code.google.com/p/vimwiki/ " LINKS: assume this is common to all syntaxes "{{{ " }}} " ------------------------------------------------------------------------- " Load concrete Wiki syntax: sets regexes and templates for headers and links " ------------------------------------------------------------------------- " LINKS: setup of larger regexes {{{ " LINKS: setup wikilink0 regexps {{{ " 0. [[URL]], or [[URL|DESCRIPTION]] " 0a) match [[URL|DESCRIPTION]] let g:vimwiki_rxWikiLink0 = g:vimwiki_rxWikiLink " 0b) match URL within [[URL|DESCRIPTION]] let g:vimwiki_rxWikiLink0MatchUrl = g:vimwiki_rxWikiLinkMatchUrl " 0c) match DESCRIPTION within [[URL|DESCRIPTION]] let g:vimwiki_rxWikiLink0MatchDescr = g:vimwiki_rxWikiLinkMatchDescr " }}} " LINKS: setup wikilink1 regexps {{{ " 1. [URL][], or [DESCRIPTION][URL] let g:vimwiki_rxWikiLink1Prefix = '[' let g:vimwiki_rxWikiLink1Suffix = ']' let g:vimwiki_rxWikiLink1Separator = '][' " [URL][] let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'. \ g:vimwiki_rxWikiLink1Separator. g:vimwiki_rxWikiLink1Suffix " [DESCRIPTION][URL] let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescription__'. \ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'. \ g:vimwiki_rxWikiLink1Suffix " let magic_chars = '.*[]\^$' let valid_chars = '[^\\\[\]]' let g:vimwiki_rxWikiLink1Prefix = escape(g:vimwiki_rxWikiLink1Prefix, magic_chars) let g:vimwiki_rxWikiLink1Suffix = escape(g:vimwiki_rxWikiLink1Suffix, magic_chars) let g:vimwiki_rxWikiLink1Separator = escape(g:vimwiki_rxWikiLink1Separator, magic_chars) let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}' let g:vimwiki_rxWikiLink1Descr = valid_chars.'\{-}' let g:vimwiki_rxWikiLink1InvalidPrefix = '[\]\[]\@<!' let g:vimwiki_rxWikiLink1InvalidSuffix = '[\]\[]\@!' let g:vimwiki_rxWikiLink1Prefix = g:vimwiki_rxWikiLink1InvalidPrefix. \ g:vimwiki_rxWikiLink1Prefix let g:vimwiki_rxWikiLink1Suffix = g:vimwiki_rxWikiLink1Suffix. \ g:vimwiki_rxWikiLink1InvalidSuffix " " 1. [URL][], [DESCRIPTION][URL] " 1a) match [URL][], [DESCRIPTION][URL] let g:vimwiki_rxWikiLink1 = g:vimwiki_rxWikiLink1Prefix. \ g:vimwiki_rxWikiLink1Url. g:vimwiki_rxWikiLink1Separator. \ g:vimwiki_rxWikiLink1Suffix. \ '\|'. g:vimwiki_rxWikiLink1Prefix. \ g:vimwiki_rxWikiLink1Descr.g:vimwiki_rxWikiLink1Separator. \ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix " 1b) match URL within [URL][], [DESCRIPTION][URL] let g:vimwiki_rxWikiLink1MatchUrl = g:vimwiki_rxWikiLink1Prefix. \ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. g:vimwiki_rxWikiLink1Separator. \ g:vimwiki_rxWikiLink1Suffix. \ '\|'. g:vimwiki_rxWikiLink1Prefix. \ g:vimwiki_rxWikiLink1Descr. g:vimwiki_rxWikiLink1Separator. \ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. g:vimwiki_rxWikiLink1Suffix " 1c) match DESCRIPTION within [DESCRIPTION][URL] let g:vimwiki_rxWikiLink1MatchDescr = g:vimwiki_rxWikiLink1Prefix. \ '\zs'. g:vimwiki_rxWikiLink1Descr.'\ze'. g:vimwiki_rxWikiLink1Separator. \ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix " }}} " LINKS: Syntax helper {{{ let g:vimwiki_rxWikiLink1Prefix1 = g:vimwiki_rxWikiLink1Prefix let g:vimwiki_rxWikiLink1Suffix1 = g:vimwiki_rxWikiLink1Separator. \ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix " }}} " *. ANY wikilink {{{ " *a) match ANY wikilink let g:vimwiki_rxWikiLink = ''. \ g:vimwiki_rxWikiLink0.'\|'. \ g:vimwiki_rxWikiLink1 " *b) match URL within ANY wikilink let g:vimwiki_rxWikiLinkMatchUrl = ''. \ g:vimwiki_rxWikiLink0MatchUrl.'\|'. \ g:vimwiki_rxWikiLink1MatchUrl " *c) match DESCRIPTION within ANY wikilink let g:vimwiki_rxWikiLinkMatchDescr = ''. \ g:vimwiki_rxWikiLink0MatchDescr.'\|'. \ g:vimwiki_rxWikiLink1MatchDescr " }}} " LINKS: setup of wikiincl regexps {{{ " }}} " LINKS: Syntax helper {{{ " }}} " LINKS: Setup weblink0 regexps {{{ " 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L)) let g:vimwiki_rxWeblink0 = g:vimwiki_rxWeblink " 0a) match URL within URL let g:vimwiki_rxWeblinkMatchUrl0 = g:vimwiki_rxWeblinkMatchUrl " 0b) match DESCRIPTION within URL let g:vimwiki_rxWeblinkMatchDescr0 = g:vimwiki_rxWeblinkMatchDescr " }}} " LINKS: Setup weblink1 regexps {{{ let g:vimwiki_rxWeblink1Prefix = '[' let g:vimwiki_rxWeblink1Suffix = ')' let g:vimwiki_rxWeblink1Separator = '](' " [DESCRIPTION](URL) let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription__'. \ g:vimwiki_rxWeblink1Separator. '__LinkUrl__'. \ g:vimwiki_rxWeblink1Suffix let magic_chars = '.*[]\^$' let valid_chars = '[^\\]' let g:vimwiki_rxWeblink1Prefix = escape(g:vimwiki_rxWeblink1Prefix, magic_chars) let g:vimwiki_rxWeblink1Suffix = escape(g:vimwiki_rxWeblink1Suffix, magic_chars) let g:vimwiki_rxWeblink1Separator = escape(g:vimwiki_rxWeblink1Separator, magic_chars) let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}' let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}' " " " 2012-02-04 TODO not starting with [[ or ][ ? ... prefix = '[\[\]]\@<!\[' " 1. [DESCRIPTION](URL) " 1a) match [DESCRIPTION](URL) let g:vimwiki_rxWeblink1 = g:vimwiki_rxWeblink1Prefix. \ g:vimwiki_rxWeblink1Url.g:vimwiki_rxWeblink1Separator. \ g:vimwiki_rxWeblink1Descr.g:vimwiki_rxWeblink1Suffix " 1b) match URL within [DESCRIPTION](URL) let g:vimwiki_rxWeblink1MatchUrl = g:vimwiki_rxWeblink1Prefix. \ g:vimwiki_rxWeblink1Descr. g:vimwiki_rxWeblink1Separator. \ '\zs'.g:vimwiki_rxWeblink1Url.'\ze'. g:vimwiki_rxWeblink1Suffix " 1c) match DESCRIPTION within [DESCRIPTION](URL) let g:vimwiki_rxWeblink1MatchDescr = g:vimwiki_rxWeblink1Prefix. \ '\zs'.g:vimwiki_rxWeblink1Descr.'\ze'. g:vimwiki_rxWeblink1Separator. \ g:vimwiki_rxWeblink1Url. g:vimwiki_rxWeblink1Suffix " }}} " Syntax helper {{{ " TODO: image links too !! " let g:vimwiki_rxWeblink1Prefix1 = '!\?'. g:vimwiki_rxWeblink1Prefix let g:vimwiki_rxWeblink1Prefix1 = g:vimwiki_rxWeblink1Prefix let g:vimwiki_rxWeblink1Suffix1 = g:vimwiki_rxWeblink1Separator. \ g:vimwiki_rxWeblink1Url.g:vimwiki_rxWeblink1Suffix " }}} " *. ANY weblink {{{ " *a) match ANY weblink let g:vimwiki_rxWeblink = ''. \ g:vimwiki_rxWeblink1.'\|'. \ g:vimwiki_rxWeblink0 " *b) match URL within ANY weblink let g:vimwiki_rxWeblinkMatchUrl = ''. \ g:vimwiki_rxWeblink1MatchUrl.'\|'. \ g:vimwiki_rxWeblinkMatchUrl0 " *c) match DESCRIPTION within ANY weblink let g:vimwiki_rxWeblinkMatchDescr = ''. \ g:vimwiki_rxWeblink1MatchDescr.'\|'. \ g:vimwiki_rxWeblinkMatchDescr0 " }}} " LINKS: Setup anylink regexps {{{ let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'. \ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink " }}} " LINKS: setup wikilink1 reference link definitions {{{ let g:vimwiki_rxMkdRef = '\['.g:vimwiki_rxWikiLinkDescr.']:\%(\s\+\|\n\)'. \ g:vimwiki_rxWeblink0 let g:vimwiki_rxMkdRefMatchDescr = '\[\zs'.g:vimwiki_rxWikiLinkDescr.'\ze]:\%(\s\+\|\n\)'. \ g:vimwiki_rxWeblink0 let g:vimwiki_rxMkdRefMatchUrl = '\['.g:vimwiki_rxWikiLinkDescr.']:\%(\s\+\|\n\)\zs'. \ g:vimwiki_rxWeblink0.'\ze' " }}} " }}} end of Links " LINKS: highlighting is complicated due to "nonexistent" links feature {{{ function! s:add_target_syntax_ON(target, type) " {{{ if g:vimwiki_debug > 1 echom '[vimwiki_debug] syntax target > '.a:target endif let prefix0 = 'syntax match '.a:type.' `' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let prefix1 = 'syntax match '.a:type.'T `' let suffix1 = '` display contained' execute prefix0. a:target. suffix0 execute prefix1. a:target. suffix1 endfunction "}}} function! s:add_target_syntax_OFF(target, type) " {{{ if g:vimwiki_debug > 1 echom '[vimwiki_debug] syntax target > '.a:target endif let prefix0 = 'syntax match VimwikiNoExistsLink `' let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char' let prefix1 = 'syntax match VimwikiNoExistsLinkT `' let suffix1 = '` display contained' execute prefix0. a:target. suffix0 execute prefix1. a:target. suffix1 endfunction "}}} function! s:wrap_wikilink1_rx(target) "{{{ return g:vimwiki_rxWikiLink1InvalidPrefix.a:target. \ g:vimwiki_rxWikiLink1InvalidSuffix endfunction "}}} function! s:existing_mkd_refs() "{{{ call vimwiki#markdown_base#reset_mkd_refs() return "\n".join(keys(vimwiki#markdown_base#get_reflinks()), "\n")."\n" endfunction "}}} function! s:highlight_existing_links() "{{{ " Wikilink1 " Conditional highlighting that depends on the existence of a wiki file or " directory is only available for *schemeless* wiki links " Links are set up upon BufEnter (see plugin/...) let safe_links = vimwiki#base#file_pattern(b:existing_wikifiles) " Wikilink1 Dirs set up upon BufEnter (see plugin/...) let safe_dirs = vimwiki#base#file_pattern(b:existing_wikidirs) " Ref links are cached let safe_reflinks = vimwiki#base#file_pattern(s:existing_mkd_refs()) " match [URL][] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1, \ safe_links, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " match [DESCRIPTION][URL] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2, \ safe_links, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " match [DIRURL][] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1, \ safe_dirs, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " match [DESCRIPTION][DIRURL] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2, \ safe_dirs, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " match [MKDREF][] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1, \ safe_reflinks, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " match [DESCRIPTION][MKDREF] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2, \ safe_reflinks, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') endfunction "}}} " use max highlighting - could be quite slow if there are too many wikifiles if VimwikiGet('maxhi') " WikiLink call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1') " Subsequently, links verified on vimwiki's path are highlighted as existing let time01 = vimwiki#u#time(starttime) "XXX call s:highlight_existing_links() let time02 = vimwiki#u#time(starttime) "XXX else let time01 = vimwiki#u#time(starttime) "XXX " Wikilink call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1') let time02 = vimwiki#u#time(starttime) "XXX endif " Weblink call s:add_target_syntax_ON(g:vimwiki_rxWeblink1, 'VimwikiWeblink1') " WikiLink " All remaining schemes are highlighted automatically let rxSchemes = '\%('. \ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'. \ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|'). \ '\):' " a) match [nonwiki-scheme-URL] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1, \ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " b) match [DESCRIPTION][nonwiki-scheme-URL] let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2, \ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '') call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1') " }}} " generic headers "{{{ " Header levels, 1-6 for i in range(1,6) execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell' endfor " }}} " concealed chars " {{{ if exists("+conceallevel") syntax conceal on endif syntax spell toplevel if g:vimwiki_debug > 1 echom 'WikiLink1 Prefix: '.g:vimwiki_rxWikiLink1Prefix1 echom 'WikiLink1 Suffix: '.g:vimwiki_rxWikiLink1Suffix1 echom 'Weblink1 Prefix: '.g:vimwiki_rxWeblink1Prefix1 echom 'Weblink1 Suffix: '.g:vimwiki_rxWeblink1Suffix1 endif " VimwikiWikiLink1Char is for syntax markers (and also URL when a description " is present) and may be concealed let options = ' contained transparent contains=NONE' " conceal wikilink1 execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix.'/'.options execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix.'/'.options execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix1.'/'.options execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix1.'/'.options " conceal weblink1 execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Prefix1.'"'.options execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Suffix1.'"'.options if exists("+conceallevel") syntax conceal off endif " }}} " non concealed chars " {{{ " }}} " main syntax groups {{{ " Tables syntax match VimwikiTableRow /^\s*|.\+|\s*$/ \ transparent contains=VimwikiCellSeparator, \ VimwikiLinkT, \ VimwikiWeblink1T, \ VimwikiWikiLink1T, \ VimwikiNoExistsLinkT, \ VimwikiEmoticons, \ VimwikiTodo, \ VimwikiBoldT, \ VimwikiItalicT, \ VimwikiBoldItalicT, \ VimwikiItalicBoldT, \ VimwikiDelTextT, \ VimwikiSuperScriptT, \ VimwikiSubScriptT, \ VimwikiCodeT, \ VimwikiEqInT, \ @Spell " }}} " header groups highlighting "{{{ "}}} " syntax group highlighting "{{{ hi def link VimwikiWeblink1 VimwikiLink hi def link VimwikiWeblink1T VimwikiLink hi def link VimwikiWikiLink1 VimwikiLink hi def link VimwikiWikiLink1T VimwikiLink "}}} " EMBEDDED syntax setup "{{{ "}}} "
{ "pile_set_name": "Github" }
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Post include Msf::Post::Windows::Priv include Msf::Post::Windows::ShadowCopy def initialize(info={}) super(update_info(info, 'Name' => "Windows Manage Mount Shadow Copy", 'Description' => %q{ This module will attempt to mount a Volume Shadow Copy on the system. This is based on the VSSOwn Script originally posted by Tim Tomes and Mark Baggett. Works on win2k3 and later. }, 'License' => MSF_LICENSE, 'Platform' => ['win'], 'SessionTypes' => ['meterpreter'], 'Author' => ['theLightCosine'], 'References' => [ [ 'URL', 'http://pauldotcom.com/2011/11/safely-dumping-hashes-from-liv.html' ] ] )) register_options( [ OptString.new('DEVICE', [ true, 'DeviceObject of Shadowcopy to mount.' ]), OptString.new('PATH', [ true, 'Path to mount it to.' ]) ]) end def run unless is_admin? print_error("This module requires admin privs to run") return end if is_uac_enabled? print_error("This module requires UAC to be bypassed first") return end unless start_vss return end r = session.sys.process.execute("cmd.exe /C mklink /D #{datastore['DEVICE']} #{datastore['PATH']}", nil, {'Hidden' => true}) end end
{ "pile_set_name": "Github" }
#!/bin/bash set TB "vopt_tb -L models_lib -L vip_lib" source ./tcl_files/config/vsim.tcl source ./tcl_files/config/export_all.tcl
{ "pile_set_name": "Github" }
/* * Copyright (C) 2011 Google, Inc. * Copyright (C) 2012 Intel, Inc. * Copyright (C) 2013 Intel, Inc. * Copyright (C) 2014 Linaro Limited * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ /* This source file contains the implementation of the legacy version of * a goldfish pipe device driver. See goldfish_pipe_v2.c for the current * version. */ #include "goldfish_pipe.h" /* * IMPORTANT: The following constants must match the ones used and defined * in external/qemu/hw/goldfish_pipe.c in the Android source tree. */ /* pipe device registers */ #define PIPE_REG_COMMAND 0x00 /* write: value = command */ #define PIPE_REG_STATUS 0x04 /* read */ #define PIPE_REG_CHANNEL 0x08 /* read/write: channel id */ #define PIPE_REG_CHANNEL_HIGH 0x30 /* read/write: channel id */ #define PIPE_REG_SIZE 0x0c /* read/write: buffer size */ #define PIPE_REG_ADDRESS 0x10 /* write: physical address */ #define PIPE_REG_ADDRESS_HIGH 0x34 /* write: physical address */ #define PIPE_REG_WAKES 0x14 /* read: wake flags */ #define PIPE_REG_PARAMS_ADDR_LOW 0x18 /* read/write: batch data address */ #define PIPE_REG_PARAMS_ADDR_HIGH 0x1c /* read/write: batch data address */ #define PIPE_REG_ACCESS_PARAMS 0x20 /* write: batch access */ #define PIPE_REG_VERSION 0x24 /* read: device version */ /* list of commands for PIPE_REG_COMMAND */ #define CMD_OPEN 1 /* open new channel */ #define CMD_CLOSE 2 /* close channel (from guest) */ #define CMD_POLL 3 /* poll read/write status */ /* List of bitflags returned in status of CMD_POLL command */ #define PIPE_POLL_IN (1 << 0) #define PIPE_POLL_OUT (1 << 1) #define PIPE_POLL_HUP (1 << 2) /* The following commands are related to write operations */ #define CMD_WRITE_BUFFER 4 /* send a user buffer to the emulator */ #define CMD_WAKE_ON_WRITE 5 /* tell the emulator to wake us when writing * is possible */ #define CMD_READ_BUFFER 6 /* receive a user buffer from the emulator */ #define CMD_WAKE_ON_READ 7 /* tell the emulator to wake us when reading * is possible */ /* Possible status values used to signal errors - * see goldfish_pipe_error_convert */ #define PIPE_ERROR_INVAL -1 #define PIPE_ERROR_AGAIN -2 #define PIPE_ERROR_NOMEM -3 #define PIPE_ERROR_IO -4 /* Bit-flags used to signal events from the emulator */ #define PIPE_WAKE_CLOSED (1 << 0) /* emulator closed pipe */ #define PIPE_WAKE_READ (1 << 1) /* pipe can now be read from */ #define PIPE_WAKE_WRITE (1 << 2) /* pipe can now be written to */ #define MAX_PAGES_TO_GRAB 32 /* This data type models a given pipe instance */ struct goldfish_pipe { struct goldfish_pipe_dev *dev; struct mutex lock; unsigned long flags; wait_queue_head_t wake_queue; }; struct access_params { unsigned long channel; u32 size; unsigned long address; u32 cmd; u32 result; /* reserved for future extension */ u32 flags; }; /* Bit flags for the 'flags' field */ enum { BIT_CLOSED_ON_HOST = 0, /* pipe closed by host */ BIT_WAKE_ON_WRITE = 1, /* want to be woken on writes */ BIT_WAKE_ON_READ = 2, /* want to be woken on reads */ }; static u32 goldfish_cmd_status(struct goldfish_pipe *pipe, u32 cmd) { unsigned long flags; u32 status; struct goldfish_pipe_dev *dev = pipe->dev; spin_lock_irqsave(&dev->lock, flags); gf_write_ptr(pipe, dev->base + PIPE_REG_CHANNEL, dev->base + PIPE_REG_CHANNEL_HIGH); writel(cmd, dev->base + PIPE_REG_COMMAND); status = readl(dev->base + PIPE_REG_STATUS); spin_unlock_irqrestore(&dev->lock, flags); return status; } static void goldfish_cmd(struct goldfish_pipe *pipe, u32 cmd) { unsigned long flags; struct goldfish_pipe_dev *dev = pipe->dev; spin_lock_irqsave(&dev->lock, flags); gf_write_ptr(pipe, dev->base + PIPE_REG_CHANNEL, dev->base + PIPE_REG_CHANNEL_HIGH); writel(cmd, dev->base + PIPE_REG_COMMAND); spin_unlock_irqrestore(&dev->lock, flags); } /* This function converts an error code returned by the emulator through * the PIPE_REG_STATUS i/o register into a valid negative errno value. */ static int goldfish_pipe_error_convert(int status) { switch (status) { case PIPE_ERROR_AGAIN: return -EAGAIN; case PIPE_ERROR_NOMEM: return -ENOMEM; case PIPE_ERROR_IO: return -EIO; default: return -EINVAL; } } /* * Notice: QEMU will return 0 for un-known register access, indicating * param_acess is supported or not */ static int valid_batchbuffer_addr(struct goldfish_pipe_dev *dev, struct access_params *aps) { u32 aph, apl; u64 paddr; aph = readl(dev->base + PIPE_REG_PARAMS_ADDR_HIGH); apl = readl(dev->base + PIPE_REG_PARAMS_ADDR_LOW); paddr = ((u64)aph << 32) | apl; if (paddr != (__pa(aps))) return 0; return 1; } /* 0 on success */ static int setup_access_params_addr(struct platform_device *pdev, struct goldfish_pipe_dev *dev) { u64 paddr; struct access_params *aps; aps = devm_kzalloc(&pdev->dev, sizeof(struct access_params), GFP_KERNEL); if (!aps) return -1; /* FIXME */ paddr = __pa(aps); writel((u32)(paddr >> 32), dev->base + PIPE_REG_PARAMS_ADDR_HIGH); writel((u32)paddr, dev->base + PIPE_REG_PARAMS_ADDR_LOW); if (valid_batchbuffer_addr(dev, aps)) { dev->aps = aps; return 0; } else { devm_kfree(&pdev->dev, aps); return -1; } } /* A value that will not be set by qemu emulator */ #define INITIAL_BATCH_RESULT (0xdeadbeaf) static int access_with_param(struct goldfish_pipe_dev *dev, const int cmd, unsigned long address, unsigned long avail, struct goldfish_pipe *pipe, int *status) { struct access_params *aps = dev->aps; if (aps == NULL) return -1; aps->result = INITIAL_BATCH_RESULT; aps->channel = (unsigned long)pipe; aps->size = avail; aps->address = address; aps->cmd = cmd; writel(cmd, dev->base + PIPE_REG_ACCESS_PARAMS); /* * If the aps->result has not changed, that means * that the batch command failed */ if (aps->result == INITIAL_BATCH_RESULT) return -1; *status = aps->result; return 0; } static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer, size_t bufflen, int is_write) { unsigned long irq_flags; struct goldfish_pipe *pipe = filp->private_data; struct goldfish_pipe_dev *dev = pipe->dev; unsigned long address, address_end; struct page *pages[MAX_PAGES_TO_GRAB] = {}; int count = 0, ret = -EINVAL; /* If the emulator already closed the pipe, no need to go further */ if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)) return -EIO; /* Null reads or writes succeeds */ if (unlikely(bufflen == 0)) return 0; /* Check the buffer range for access */ if (!access_ok(is_write ? VERIFY_WRITE : VERIFY_READ, buffer, bufflen)) return -EFAULT; /* Serialize access to the pipe */ if (mutex_lock_interruptible(&pipe->lock)) return -ERESTARTSYS; address = (unsigned long)(void *)buffer; address_end = address + bufflen; while (address < address_end) { unsigned long page_end = (address & PAGE_MASK) + PAGE_SIZE; unsigned long next, avail; int status, wakeBit, page_i, num_contiguous_pages; long first_page, last_page, requested_pages; unsigned long xaddr, xaddr_prev, xaddr_i; /* * Attempt to grab multiple physically contiguous pages. */ first_page = address & PAGE_MASK; last_page = (address_end - 1) & PAGE_MASK; requested_pages = ((last_page - first_page) >> PAGE_SHIFT) + 1; if (requested_pages > MAX_PAGES_TO_GRAB) { requested_pages = MAX_PAGES_TO_GRAB; } ret = get_user_pages_fast(first_page, requested_pages, !is_write, pages); pr_debug("%s: requested pages: %d %ld %p\n", __func__, ret, requested_pages, (void*)first_page); if (ret == 0) { pr_err("%s: error: (requested pages == 0) (wanted %ld)\n", __func__, requested_pages); mutex_unlock(&pipe->lock); return ret; } if (ret < 0) { pr_err("%s: (requested pages < 0) %ld \n", __func__, requested_pages); mutex_unlock(&pipe->lock); return ret; } xaddr = page_to_phys(pages[0]) | (address & ~PAGE_MASK); xaddr_prev = xaddr; num_contiguous_pages = ret == 0 ? 0 : 1; for (page_i = 1; page_i < ret; page_i++) { xaddr_i = page_to_phys(pages[page_i]) | (address & ~PAGE_MASK); if (xaddr_i == xaddr_prev + PAGE_SIZE) { page_end += PAGE_SIZE; xaddr_prev = xaddr_i; num_contiguous_pages++; } else { pr_err("%s: discontinuous page boundary: %d pages instead\n", __func__, page_i); break; } } next = page_end < address_end ? page_end : address_end; avail = next - address; /* Now, try to transfer the bytes in the current page */ spin_lock_irqsave(&dev->lock, irq_flags); if (access_with_param(dev, is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER, xaddr, avail, pipe, &status)) { gf_write_ptr(pipe, dev->base + PIPE_REG_CHANNEL, dev->base + PIPE_REG_CHANNEL_HIGH); writel(avail, dev->base + PIPE_REG_SIZE); gf_write_ptr((void *)xaddr, dev->base + PIPE_REG_ADDRESS, dev->base + PIPE_REG_ADDRESS_HIGH); writel(is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER, dev->base + PIPE_REG_COMMAND); status = readl(dev->base + PIPE_REG_STATUS); } spin_unlock_irqrestore(&dev->lock, irq_flags); for (page_i = 0; page_i < ret; page_i++) { if (status > 0 && !is_write && page_i < num_contiguous_pages) { set_page_dirty(pages[page_i]); } put_page(pages[page_i]); } if (status > 0) { /* Correct transfer */ count += status; address += status; continue; } else if (status == 0) { /* EOF */ ret = 0; break; } else if (status < 0 && count > 0) { /* * An error occured and we already transfered * something on one of the previous pages. * Just return what we already copied and log this * err. * * Note: This seems like an incorrect approach but * cannot change it until we check if any user space * ABI relies on this behavior. */ if (status != PIPE_ERROR_AGAIN) pr_err_ratelimited("goldfish_pipe: backend returned error %d on %s\n", status, is_write ? "write" : "read"); ret = 0; break; } /* * If the error is not PIPE_ERROR_AGAIN, or if we are not in * non-blocking mode, just return the error code. */ if (status != PIPE_ERROR_AGAIN || (filp->f_flags & O_NONBLOCK) != 0) { ret = goldfish_pipe_error_convert(status); break; } /* * The backend blocked the read/write, wait until the backend * tells us it's ready to process more data. */ wakeBit = is_write ? BIT_WAKE_ON_WRITE : BIT_WAKE_ON_READ; set_bit(wakeBit, &pipe->flags); /* Tell the emulator we're going to wait for a wake event */ goldfish_cmd(pipe, is_write ? CMD_WAKE_ON_WRITE : CMD_WAKE_ON_READ); /* Unlock the pipe, then wait for the wake signal */ mutex_unlock(&pipe->lock); while (test_bit(wakeBit, &pipe->flags)) { if (wait_event_interruptible( pipe->wake_queue, !test_bit(wakeBit, &pipe->flags))) return -ERESTARTSYS; if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)) return -EIO; } /* Try to re-acquire the lock */ if (mutex_lock_interruptible(&pipe->lock)) return -ERESTARTSYS; } mutex_unlock(&pipe->lock); if (ret < 0) return ret; else return count; } static ssize_t goldfish_pipe_read(struct file *filp, char __user *buffer, size_t bufflen, loff_t *ppos) { return goldfish_pipe_read_write(filp, buffer, bufflen, 0); } static ssize_t goldfish_pipe_write(struct file *filp, const char __user *buffer, size_t bufflen, loff_t *ppos) { return goldfish_pipe_read_write(filp, (char __user *)buffer, bufflen, 1); } static unsigned int goldfish_pipe_poll(struct file *filp, poll_table *wait) { struct goldfish_pipe *pipe = filp->private_data; unsigned int mask = 0; int status; mutex_lock(&pipe->lock); poll_wait(filp, &pipe->wake_queue, wait); status = goldfish_cmd_status(pipe, CMD_POLL); mutex_unlock(&pipe->lock); if (status & PIPE_POLL_IN) mask |= POLLIN | POLLRDNORM; if (status & PIPE_POLL_OUT) mask |= POLLOUT | POLLWRNORM; if (status & PIPE_POLL_HUP) mask |= POLLHUP; if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)) mask |= POLLERR; return mask; } static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id) { struct goldfish_pipe_dev *dev = dev_id; unsigned long irq_flags; int count = 0; /* * We're going to read from the emulator a list of (channel,flags) * pairs corresponding to the wake events that occured on each * blocked pipe (i.e. channel). */ spin_lock_irqsave(&dev->lock, irq_flags); for (;;) { /* First read the channel, 0 means the end of the list */ struct goldfish_pipe *pipe; unsigned long wakes; unsigned long channel = 0; #ifdef CONFIG_64BIT channel = (u64)readl(dev->base + PIPE_REG_CHANNEL_HIGH) << 32; if (channel == 0) break; #endif channel |= readl(dev->base + PIPE_REG_CHANNEL); if (channel == 0) break; /* Convert channel to struct pipe pointer + read wake flags */ wakes = readl(dev->base + PIPE_REG_WAKES); pipe = (struct goldfish_pipe *)(ptrdiff_t)channel; /* Did the emulator just closed a pipe? */ if (wakes & PIPE_WAKE_CLOSED) { set_bit(BIT_CLOSED_ON_HOST, &pipe->flags); wakes |= PIPE_WAKE_READ | PIPE_WAKE_WRITE; } if (wakes & PIPE_WAKE_READ) clear_bit(BIT_WAKE_ON_READ, &pipe->flags); if (wakes & PIPE_WAKE_WRITE) clear_bit(BIT_WAKE_ON_WRITE, &pipe->flags); wake_up_interruptible(&pipe->wake_queue); count++; } spin_unlock_irqrestore(&dev->lock, irq_flags); return (count == 0) ? IRQ_NONE : IRQ_HANDLED; } /** * goldfish_pipe_open - open a channel to the AVD * @inode: inode of device * @file: file struct of opener * * Create a new pipe link between the emulator and the use application. * Each new request produces a new pipe. * * Note: we use the pipe ID as a mux. All goldfish emulations are 32bit * right now so this is fine. A move to 64bit will need this addressing */ static int goldfish_pipe_open(struct inode *inode, struct file *file) { struct goldfish_pipe *pipe; struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; int32_t status; /* Allocate new pipe kernel object */ pipe = kzalloc(sizeof(*pipe), GFP_KERNEL); if (pipe == NULL) return -ENOMEM; pipe->dev = dev; mutex_init(&pipe->lock); pr_debug("%s: call. pipe_dev dev=%p new_pipe_addr=%p file=%p\n", __func__, dev, pipe, file); /* spin lock init, write head of list, i guess */ init_waitqueue_head(&pipe->wake_queue); /* * Now, tell the emulator we're opening a new pipe. We use the * pipe object's address as the channel identifier for simplicity. */ status = goldfish_cmd_status(pipe, CMD_OPEN); if (status < 0) { kfree(pipe); return status; } /* All is done, save the pipe into the file's private data field */ file->private_data = pipe; return 0; } static int goldfish_pipe_release(struct inode *inode, struct file *filp) { struct goldfish_pipe *pipe = filp->private_data; pr_debug("%s: call. pipe=%p file=%p\n", __func__, pipe, filp); /* The guest is closing the channel, so tell the emulator right now */ goldfish_cmd(pipe, CMD_CLOSE); kfree(pipe); filp->private_data = NULL; return 0; } static const struct file_operations goldfish_pipe_fops = { .owner = THIS_MODULE, .read = goldfish_pipe_read, .write = goldfish_pipe_write, .poll = goldfish_pipe_poll, .open = goldfish_pipe_open, .release = goldfish_pipe_release, }; static struct miscdevice goldfish_pipe_miscdev = { .minor = MISC_DYNAMIC_MINOR, .name = "goldfish_pipe", .fops = &goldfish_pipe_fops, }; int goldfish_pipe_device_init_v1(struct platform_device *pdev) { struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; int err = devm_request_irq(&pdev->dev, dev->irq, goldfish_pipe_interrupt, IRQF_SHARED, "goldfish_pipe", dev); if (err) { dev_err(&pdev->dev, "unable to allocate IRQ for v1\n"); return err; } err = misc_register(&goldfish_pipe_miscdev); if (err) { dev_err(&pdev->dev, "unable to register v1 device\n"); return err; } setup_access_params_addr(pdev, dev); return 0; } void goldfish_pipe_device_deinit_v1(struct platform_device *pdev) { misc_deregister(&goldfish_pipe_miscdev); }
{ "pile_set_name": "Github" }
body{ color:#222222; font-family: Arial, Helvetica, sans-serif; } body, ol, ul, li, section, div, button{ margin:0; padding:0; } ul{ list-style-type:none; } body { -webkit-box-orient:vertical; -webkit-box-direction:normal; } section.content > ul{ list-style-type:none; overflow:auto; } section > p{ line-height:1.5; margin:0.5em 0; } section > p img{ display:inline-block; vertical-align:text-top; margin:0 5px; } section.content > ul > li{ margin-bottom:20px; } dt,dd{ margin:0px; } section.content div > dl > dd{ margin-bottom:20px; } section.content{ display:block; } #filter_list input[type='text']{ width:300px; } div.box > dl{ overflow:auto; /*width:386px;*/ } #menu_tabs{ display:block; z-index:100; padding:0 0 0 1px; } #menu_tabs li{ display:inline-block; margin:0px; padding:0px; } #menu_tabs li a{ color:black; text-decoration:none; display: inline-block; background:#888; color:#ccc; padding: 6px 12px; border:1px solid #898C95; font-size:13px; position:relative; margin:0 0 1px -1px; } #menu_tabs li a.active{ background: -moz-linear-gradient(top, #333, #888); background: -webkit-linear-gradient(top, #333, #888); background: -o-linear-gradient(top, #333, #888); background: linear-gradient(top, #333, #888); color:#fff; border-bottom:1px solid #888; z-index:100; } span.key, kbd.key{ display:inline-block; background:#334455; color:#eeeeee; padding:6px; border:2px solid black; border-radius:4px; font-size:x-large; font-weight:bold; } dt.disabled .key, li.disabled .key{ background:#cccccc; border:2px solid #bbbbbb; } #container{ width:100%; z-index:10; border-top:1px solid #999999; } h1{ background: -moz-linear-gradient(top, #333, #999); background: -webkit-linear-gradient(top, #333, #999); background: -o-linear-gradient(top, #333, #999); background: linear-gradient(top, #333, #999); font-size:small; border-top-left-radius:4px; border-top-right-radius:4px; margin:0px; padding:3px 8px; color:white; text-shadow: 3px 3px 3px black; line-height:1.4; } #container #inner_container{ bottom: 0px; left: 0px; position: fixed; right: 0px; top: 30px; background:#fff; } #inner_container section{ position:absolute; top:0%; bottom:0%; left:0%; color:#000; padding:0; overflow:auto; background:#ddd; display:none; } #inner_container section.left{ display:block; right:100%; left:-100%; -moz-transition: all 0.3s ease-in-out; /* Firefox */ -webkit-transition: all 0.3s ease-in-out; /* Safari and Chrome */ -o-transition: all 0.3s ease-in-out; /* Opera */ transition: all 0.3s ease-in-out; /* Browsers that Support it */ } #inner_container section.right{ display:block; left:100%; right:-100%; -moz-transition: all 0.3s ease-in-out; /* Firefox */ -webkit-transition: all 0.3s ease-in-out; /* Safari and Chrome */ -o-transition: all 0.3s ease-in-out; /* Opera */ transition: all 0.3s ease-in-out; /* Browsers that Support it */ } #inner_container section.active{ display:block; left:0%; right:0%; -moz-transition: all 0.3s ease-in-out; /* Firefox */ -webkit-transition: all 0.3s ease-in-out; /* Safari and Chrome */ -o-transition: all 0.3s ease-in-out; /* Opera */ transition: all 0.3s ease-in-out; /* Browsers that Support it */ } section > div > fieldset{ display:block; border:none; padding:0; margin:0; } optgroup{ background:#333333; color:#ffffff; } optgroup > option{ color:#000000; } .content > .box{ display:inline-block; vertical-align:top; } .content > .box > h3{ margin:0px; padding:0 10px; } #about dl{ margin:30px; } #about dl dd{ margin:10px 0 20px 50px; } #config_text{ width:98%; height:300px; } #advanced .margin{ margin:60px 0 0 0; } input:not([type="text"]),button,label{ cursor:pointer; } button{ -webkit-appearance: button; background: -moz-linear-gradient(top, #fff, #ddd); background: -webkit-linear-gradient(top, #fff, #ddd); background: -o-linear-gradient(top, #fff, #ddd); background: linear-gradient(top, #fff, #ddd); border: 1px solid #999; border-bottom-left-radius: 2px 2px; border-bottom-right-radius: 2px 2px; border-top-left-radius: 2px 2px; border-top-right-radius: 2px 2px; margin: 0.2em; padding: 0px 5px; } button:hover:not([disabled]){ background: -moz-linear-gradient(top, #fff, #9cf); background: -webkit-linear-gradient(top, #fff, #9cf); background: -o-linear-gradient(top, #fff, #9cf); background: linear-gradient(top, #fff, #9cf); } button[disabled]{ cursor:default; } section.content > p.sub{ margin-left:2em; } #AccelerationValue{ min-width:4em; width:4em; } input.input_button{ font-size:110%; min-width:5em; max-width:10em; min-height:2em; background:#ffffff; border-top:#999999 2px solid; border-left:#999999 2px solid; border-right:#cccccc 1px solid; border-bottom:#cccccc 1px solid; } .field_action button{ font-size:large; width:90%; padding:0.4em; } #cover{ position:fixed; background-color:rgba(128,128,128,0.9); z-index:10000; top:0px; left:0px; display:none; text-align:center; } #cover button{ font-size:large; margin:1em; } #action_result{ min-height:40px; } #scripts h3 input{ background:#111111; color:#ffffff; } #left_box{ width:200px; float:left; } #right_box:after{ content:''; display:block; clear:left; height:0; } #script_list{ list-style-type:none; } #script_list li{ margin:0; } #script_list li button{ background: -moz-linear-gradient(top, #111, #222); background: -webkit-linear-gradient(top, #111, #222); background: -o-linear-gradient(top, #111, #222); background: linear-gradient(top, #111, #222); color:#fff; padding:10px; margin:0px; border-bottom: 2px solid black; border-top: 1px solid #4A4B4D; border-right:none; cursor:pointer; width:99%; display:block; text-align:left; } #script_list li:last-child button{ border-bottom:2px solid #aaaaaa; } #script_list li button:hover{ background: -moz-linear-gradient(top, #555, #222); background: -webkit-linear-gradient(top, #555, #222); background: -o-linear-gradient(top, #555, #222); background: linear-gradient(top, #555, #222); } #scripts{ background:#ddd; } #right_box{ margin-left:200px; padding:0px; width:0px; } #right_box > div{ padding:10px; } #right_box button.top{ margin:5px 15px 5px 0; } #right_box h3{ margin:0; } #right_box fieldset{ margin:0; padding:10px; background:#fff; border:none; border-radius:6px; } #right_box fieldset div.global{ display:inline-block; } #right_box fieldset select.match{ display:inline-block; width: 19%; } #right_box fieldset .input{ width:70%; } #right_box fieldset .del{ width:8%;; } #current_name{ width:99%; } fieldset h4{ margin:0; padding:0.2em 0.25em 0.2em 0.2em; width:5em; text-align:center; border-radius:1px; display:inline-block; background:#777777; color:#ffffff; font-weight:normal; font-size:small; vertical-align:top; } fieldset > div{ clear:left; } fieldset select{ margin:0; } #edit-wrap{ position:relative; overflow:scroll; } #edit-area, #edit-bg{ -webkit-box-orient: vertical; -webkit-rtl-ordering: logical; -webkit-user-select: text; -moz-user-select: text; -o-user-select: text; user-select: text; -webkit-appearance:none; font:normal 15px monospace; position:relative; border:none; margin:0px; padding:0 0 0 40px; line-height:1.2em; white-space: pre-wrap; word-wrap:normal; resize:none; outline:none; overflow: visible; display:inline-block; min-width: 600px; min-height: 400px; } #edit-area{ opacity:0.3; position:absolute; top: 0px; left: 0px; } #edit-bg{ list-style-type:decimal; list-style-position:outside; } #edit-wrap div.line{ display:list-item; background:#efefef; } #options h2{ margin:5px; font-size:15px; } fieldset.disabled #edit-wrap { opacity: 0.3; }
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace Microsoft.Protocols.TestTools.StackSdk.Security.Cryptographic { internal enum ProviderType { PROV_RSA_FULL = 1, PROV_RSA_SIG = 2, PROV_DSS = 3, PROV_FORTEZZA = 4, PROV_MS_EXCHANGE = 5, PROV_SSL = 6, PROV_RSA_SCHANNEL = 12, PROV_DSS_DH = 13, PROV_EC_ECDSA_SIG = 14, PROV_EC_ECNRA_SIG = 15, PROV_EC_ECDSA_FULL = 16, PROV_EC_ECNRA_FULL = 17, PROV_DH_SCHANNEL = 18, PROV_SPYRUS_LYNKS = 20, PROV_RNG = 21, PROV_INTEL_SEC = 22, PROV_REPLACE_OWF = 23, PROV_RSA_AES = 24, } [Flags()] internal enum CryptAcquireContextTypes:uint { CRYPT_VERIFYCONTEXT = 0xF0000000, CRYPT_NEWKEYSET = 0x00000008, CRYPT_DELETEKEYSET = 0x00000010, CRYPT_MACHINE_KEYSET = 0x00000020, CRYPT_SILENT = 0x00000040, CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080, } /// <summary> /// The ALG_ID data type specifies an algorithm identifier. /// Parameters of this data type are passed to most of the functions in CryptoAPI. /// please refer: http://msdn.microsoft.com/en-us/library/aa375549(v=VS.85).aspx /// </summary> [SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32"), SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")] public enum AlgId : uint { /// <summary> /// Triple DES encryption algorithm. /// </summary> CALG_3DES = 0x00006603, /// <summary> /// Two-key triple DES encryption with effective key length equal to 112 bits. /// </summary> CALG_3DES_112 = 0x00006609, /// <summary> /// Advanced Encryption Standard (AES). This algorithm is supported by the Microsoft AES Cryptographic /// Provider. /// </summary> CALG_AES =0x00006611, /// <summary> /// 128 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider. /// </summary> CALG_AES_128 = 0x0000660e, /// <summary> /// 192 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider. /// </summary> CALG_AES_192 = 0x0000660f, /// <summary> /// 256 bit AES. This algorithm is supported by the Microsoft AES Cryptographic Provider. /// </summary> CALG_AES_256 = 0x00006610, /// <summary> /// An algorithm to create a 40-bit DES key that has parity bits and zeroed key bits to make its key /// length 64 bits. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_CYLINK_MEK = 0x0000660c, /// <summary> /// DES encryption algorithm. /// </summary> CALG_DES = 0x00006601, /// <summary> /// DESX encryption algorithm. /// </summary> CALG_DESX = 0x00006604, /// <summary> /// Diffie-Hellman ephemeral key exchange algorithm. /// </summary> CALG_DH_EPHEM = 0x0000aa02, /// <summary> /// Diffie-Hellman store and forward key exchange algorithm. /// </summary> CALG_DH_SF = 0x0000aa01, /// <summary> /// DSA public key signature algorithm. /// </summary> CALG_DSS_SIGN = 0x00002200, /// <summary> /// Elliptic curve Diffie-Hellman key exchange algorithm. /// </summary> CALG_ECDH = 0x0000aa05, /// <summary> /// Elliptic curve digital signature algorithm. /// </summary> CALG_ECDSA = 0x00002203, /// <summary> /// Elliptic curve Menezes, Qu, and Vanstone (MQV) key exchange algorithm. This algorithm is not supported. /// </summary> CALG_ECMQV = 0x0000a001, /// <summary> /// One way function hashing algorithm. /// </summary> CALG_HASH_REPLACE_OWF = 0x0000800b, /// <summary> /// Hughes MD5 hashing algorithm. /// </summary> CALG_HUGHES_MD5 = 0x0000a003, /// <summary> /// HMAC keyed hash algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_HMAC = 0x00008009, /// <summary> /// KEA key exchange algorithm (FORTEZZA). This algorithm is not supported. /// </summary> CALG_KEA_KEYX = 0x0000aa04, /// <summary> /// MAC keyed hash algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_MAC = 0x00008005, /// <summary> /// MD2 hashing algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_MD2 = 0x00008001, /// <summary> /// MD4 hashing algorithm. /// </summary> CALG_MD4 = 0x00008002, /// <summary> /// MD5 hashing algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_MD5 = 0x00008003, /// <summary> /// No signature algorithm. /// </summary> CALG_NO_SIGN = 0x00002000, /// <summary> /// The algorithm is only implemented in CNG. The macro, IS_SPECIAL_OID_INFO_ALGID, can be used to /// determine whether a cryptography algorithm is only supported by using the CNG functions. /// </summary> CALG_OID_INFO_CNG_ONLY = 0xffffffff, /// <summary> /// The algorithm is defined in the encoded parameters. The algorithm is only supported by using CNG. /// The macro, IS_SPECIAL_OID_INFO_ALGID, can be used to determine whether a cryptography algorithm is /// only supported by using the CNG functions. /// </summary> CALG_OID_INFO_PARAMETERS = 0xfffffffe, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_PCT1_MASTER = 0x00004c04, /// <summary> /// RC2 block encryption algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_RC2 = 0x00006602, /// <summary> /// RC4 stream encryption algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_RC4 = 0x00006801, /// <summary> /// RC5 block encryption algorithm. /// </summary> CALG_RC5 = 0x0000660d, /// <summary> /// RSA public key exchange algorithm. This algorithm is supported by the Microsoft Base Cryptographic /// Provider. /// </summary> CALG_RSA_KEYX = 0x0000a400, /// <summary> /// RSA public key signature algorithm. This algorithm is supported by the Microsoft Base Cryptographic /// Provider. /// </summary> CALG_RSA_SIGN = 0x00002400, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_SCHANNEL_ENC_KEY = 0x00004c07, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_SCHANNEL_MAC_KEY = 0x00004c03, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_SCHANNEL_MASTER_HASH = 0x00004c02, /// <summary> /// SEAL encryption algorithm. This algorithm is not supported. /// </summary> CALG_SEAL = 0x00006802, /// <summary> /// SHA hashing algorithm. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_SHA = 0x00008004, /// <summary> /// Same as CALG_SHA. This algorithm is supported by the Microsoft Base Cryptographic Provider. /// </summary> CALG_SHA1 = 0x00008004, /// <summary> /// 256 bit SHA hashing algorithm. This algorithm is supported by Microsoft Enhanced RSA and AES /// Cryptographic Provider. /// </summary> CALG_SHA_256 = 0x0000800c, /// <summary> /// 384 bit SHA hashing algorithm. This algorithm is supported by Microsoft Enhanced RSA and AES /// Cryptographic Provider. /// </summary> CALG_SHA_384 = 0x0000800d, /// <summary> /// 512 bit SHA hashing algorithm. This algorithm is supported by Microsoft Enhanced RSA and AES /// Cryptographic Provider. /// </summary> CALG_SHA_512 = 0x0000800e, /// <summary> /// Skipjack block encryption algorithm (FORTEZZA). This algorithm is not supported. /// </summary> CALG_SKIPJACK = 0x0000660a, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_SSL2_MASTER = 0x00004c05, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_SSL3_MASTER = 0x00004c01, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_SSL3_SHAMD5 = 0x00008008, /// <summary> /// TEK (FORTEZZA). This algorithm is not supported. /// </summary> CALG_TEK = 0x0000660b, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_TLS1_MASTER = 0x00004c06, /// <summary> /// Used by the Schannel.dll operations system. This ALG_ID should not be used by applications. /// </summary> CALG_TLS1PRF = 0x0000800a, } internal enum HashParameters { HP_ALGID = 0x0001, // Hash algorithm HP_HASHVAL = 0x0002, // Hash value HP_HASHSIZE = 0x0004 // Hash value size } [Flags()] internal enum CryptGenKeyTypes { CRYPT_EXPORTABLE = 0x00000001, CRYPT_USER_PROTECTED = 0x00000002, CRYPT_CREATE_SALT = 0x00000004, CRYPT_UPDATE_KEY = 0x00000008, CRYPT_NO_SALT = 0x00000010, CRYPT_PREGEN = 0x00000040, CRYPT_RECIPIENT = 0x00000010, CRYPT_INITIATOR = 0x00000040, CRYPT_ONLINE = 0x00000080, CRYPT_SF = 0x00000100, CRYPT_CREATE_IV = 0x00000200, CRYPT_KEK = 0x00000400, CRYPT_DATA_KEY = 0x00000800, CRYPT_VOLATILE = 0x00001000, CRYPT_SGCKEY = 0x00002000, CRYPT_ARCHIVABLE = 0x00004000, CRYPT_FORCE_KEY_PROTECTION_HIGH = 0x00008000, } internal enum CryptGetKeyParamParamType { KP_IV = 1, // Initialization vector KP_SALT = 2, // Salt value KP_PADDING = 3, // Padding values KP_MODE = 4, // Mode of the cipher KP_MODE_BITS = 5, // Number of bits to feedback KP_PERMISSIONS = 6, // Key permissions DWORD KP_ALGID = 7, // Key algorithm KP_BLOCKLEN = 8, // Block size of the cipher KP_KEYLEN = 9, // Length of key in bits KP_SALT_EX = 10, // Length of salt in bytes KP_P = 11, // DSS/Diffie-Hellman P value KP_G = 12, // DSS/Diffie-Hellman G value KP_Q = 13, // DSS Q value KP_X = 14, // Diffie-Hellman X value KP_Y = 15, // Y value KP_RA = 16, // Fortezza RA value KP_RB = 17, // Fortezza RB value KP_INFO = 18, // for putting information into an RSA envelope KP_EFFECTIVE_KEYLEN = 19, // setting and getting RC2 effective key length KP_SCHANNEL_ALG = 20, // for setting the Secure Channel algorithms KP_CLIENT_RANDOM = 21, // for setting the Secure Channel client random data KP_SERVER_RANDOM = 22, // for setting the Secure Channel server random data KP_RP = 23, KP_PRECOMP_MD5 = 24, KP_PRECOMP_SHA = 25, KP_CERTIFICATE = 26, // for setting Secure Channel certificate data (PCT1) KP_CLEAR_KEY = 27, // for setting Secure Channel clear key data (PCT1) KP_PUB_EX_LEN = 28, KP_PUB_EX_VAL = 29, KP_KEYVAL = 30, KP_ADMIN_PIN = 31, KP_KEYEXCHANGE_PIN = 32, KP_SIGNATURE_PIN = 33, KP_PREHASH = 34, KP_ROUNDS = 35, KP_OAEP_PARAMS = 36, // for setting OAEP params on RSA keys KP_CMS_KEY_INFO = 37, KP_CMS_DH_KEY_INFO = 38, KP_PUB_PARAMS = 39, // for setting public parameters KP_VERIFY_PARAMS = 40, // for verifying DSA and DH parameters KP_HIGHEST_VERSION = 41, // for TLS protocol version setting KP_GET_USE_COUNT = 42, // for use with PP_CRYPT_COUNT_KEY_USE contexts } internal enum CryptExportKeyBlobType { SIMPLEBLOB = 0x1, PUBLICKEYBLOB = 0x6, PRIVATEKEYBLOB = 0x7, PLAINTEXTKEYBLOB = 0x8, OPAQUEKEYBLOB = 0x9, PUBLICKEYBLOBEX = 0xA, SYMMETRICWRAPKEYBLOB = 0xB, KEYSTATEBLOB = 0xC, } internal enum CryptExportKeyTypes { CRYPT_Y_ONLY = 0x00000001, CRYPT_SSL2_FALLBACK = 0x00000002, CRYPT_DESTROYKEY = 0x00000004, CRYPT_OAEP = 0x00000040, // used with RSA encryptions/decryptions CRYPT_BLOB_VER3 = 0x00000080, // export version 3 of a blob type CRYPT_IPSEC_HMAC_KEY = 0x00000100, // CryptImportKey only } /// <summary> /// The flags defined by CryptSignHash function of CryptAPI. /// </summary> [Flags] public enum CryptSignHashFlag { /// <summary> /// No value to set. /// </summary> None = 0x00, /// <summary> /// Used with RSA providers. The hash object identifier (OID) is not placed in the RSA public key encryption. /// If this flag is not set, the hash OID in the default signature is as specified in the definition of /// DigestInfo in PKCS #1. /// </summary> NoHashOid = 0x01, /// <summary> /// This flag is not used. /// </summary> Type2Format = 0x02, /// <summary> /// Use the RSA signature padding method specified in the ANSI X9.31 standard. /// Windows 2000: CRYPT_X931_FORMAT is not supported. /// </summary> X931Format = 0x04, } /// <summary> /// Hash type of RSA signature. /// </summary> public enum CryptRsaSignHashType { /// <summary> /// MD5 hash algorithm /// </summary> MD5, /// <summary> /// MD5 hash algorithm /// </summary> SHA1, } internal static class NativeMethods { [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptAcquireContext(ref IntPtr hProv, string pszContainer, string pszProvider, ProviderType dwProvType, CryptAcquireContextTypes dwFlags); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptCreateHash(IntPtr hProv, AlgId algId, IntPtr hKey, uint dwFlags, ref IntPtr phHash); [DllImport("advapi32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptHashData(IntPtr hHash, byte[] pbData, uint dataLen, uint flags); [DllImport("advapi32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptDestroyHash(IntPtr hHash); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptGetHashParam(IntPtr hHash, HashParameters dwParam, [Out] byte[] pbData, ref uint pdwDataLen, uint dwFlags); [DllImport("advapi32.dll")] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptReleaseContext(IntPtr hProv, uint dwFlags); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptGenKey(IntPtr hProv, AlgId Algid, int dwFlags, ref IntPtr phKey); [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptDestroyKey(IntPtr phKey); [DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptExportKey(IntPtr hKey, IntPtr hExpKey, CryptExportKeyBlobType dwBlobType, CryptExportKeyTypes dwFlags, [In, Out] byte[] pbData, ref uint dwDataLen); [DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptImportKey(IntPtr hProv, byte[] pbKeyData, Int32 dwDataLen, IntPtr hPubKey, UInt32 dwFlags, ref IntPtr hKey); [DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CryptEncrypt(IntPtr hKey, IntPtr hHash, int Final, uint dwFlags, byte[] pbData, ref int pdwDataLen, int dwBufLen); [DllImport("advapi32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool CryptDuplicateKey(IntPtr hKey, IntPtr pdwReserved, uint dwFlags, ref IntPtr phKey); internal const string BCRYPT_OBJECT_LENGTH = "ObjectLength"; internal const string BCRYPT_ALGORITHM_NAME = "AlgorithmName"; internal const string BCRYPT_PROVIDER_HANDLE = "ProviderHandle"; internal const string BCRYPT_CHAINING_MODE = "ChainingMode"; internal const string BCRYPT_BLOCK_LENGTH = "BlockLength"; internal const string BCRYPT_KEY_LENGTH = "KeyLength"; internal const string BCRYPT_KEY_OBJECT_LENGTH = "KeyObjectLength"; internal const string BCRYPT_KEY_STRENGTH = "KeyStrength"; internal const string BCRYPT_KEY_LENGTHS = "KeyLengths"; internal const string BCRYPT_BLOCK_SIZE_LIST = "BlockSizeList"; internal const string BCRYPT_EFFECTIVE_KEY_LENGTH = "EffectiveKeyLength"; internal const string BCRYPT_HASH_LENGTH = "HashDigestLength"; internal const string BCRYPT_HASH_OID_LIST = "HashOIDList"; internal const string BCRYPT_PADDING_SCHEMES = "PaddingSchemes"; internal const string BCRYPT_SIGNATURE_LENGTH = "SignatureLength"; internal const string BCRYPT_HASH_BLOCK_LENGTH = "HashBlockLength"; internal const string BCRYPT_INITIALIZATION_VECTOR = "IV"; internal const string BCRYPT_CHAIN_MODE_NA = "ChainingModeN/A"; internal const string BCRYPT_CHAIN_MODE_CBC = "ChainingModeCBC"; internal const string BCRYPT_CHAIN_MODE_ECB = "ChainingModeECB"; internal const string BCRYPT_CHAIN_MODE_CFB = "ChainingModeCFB"; internal const string BCRYPT_CHAIN_MODE_CCM = "ChainingModeCCM"; internal const string BCRYPT_CHAIN_MODE_GCM = "ChainingModeGCM"; internal const uint AT_KEYEXCHANGE = 1; internal const uint AT_SIGNATURE = 2; [DllImport("bcrypt.dll", CharSet = CharSet.Auto, ExactSpelling = true)] internal static extern uint BCryptOpenAlgorithmProvider( out IntPtr phAlgorithm, string pszAlgId, string pszImplementation, uint dwFlags); [DllImport("bcrypt.dll")] internal static extern uint BCryptCloseAlgorithmProvider( IntPtr hAlgorithm, uint flags); [DllImport("bcrypt.dll")] internal static extern uint BCryptGenerateSymmetricKey( IntPtr hAlgorithm, [Out] out IntPtr phKey, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] pbKeyObject, uint cbKeyObject, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbSecret, uint cbSecret, uint dwFlags); [DllImport("bcrypt.dll")] internal static extern uint BCryptDestroyKey(IntPtr hKey); [DllImport("bcrypt.dll", CharSet = CharSet.Unicode)] internal static extern uint BCryptGetProperty( IntPtr hObject, string pszProperty, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] pbOutput, uint cbOutput, [Out] out uint pcbResult, uint flags); [DllImport("bcrypt.dll", CharSet = CharSet.Unicode)] internal static extern uint BCryptSetProperty( IntPtr hObject, string pszProperty, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbInput, uint cbInput, uint dwFlags); [DllImport("bcrypt.dll")] internal static extern uint BCryptEncrypt( IntPtr hKey, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbInput, uint cbInput, IntPtr pPaddingInfo, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbIV, uint cbIV, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] pbOutput, uint cbOutput, [Out] out uint pcbResult, uint dwFlags); [DllImport("bcrypt.dll")] internal static extern uint BCryptDecrypt( IntPtr hKey, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbInput, uint cbInput, IntPtr pPaddingInfo, [In, MarshalAs(UnmanagedType.LPArray)] byte[] pbIV, uint cbIV, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] pbOutput, uint cbOutput, [Out] out uint pcbResult, uint dwFlags); internal const uint BCRYPT_CIPHER_OPERATION = 0x00000001; internal const uint BCRYPT_HASH_OPERATION = 0x00000002; internal const uint BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION = 0x00000004; internal const uint BCRYPT_SECRET_AGREEMENT_OPERATION = 0x00000008; internal const uint BCRYPT_SIGNATURE_OPERATION = 0x00000010; internal const uint BCRYPT_RNG_OPERATION = 0x00000020; #pragma warning disable 649 internal struct BCRYPT_ALGORITHM_IDENTIFIER { [MarshalAs(UnmanagedType.LPWStr)] public string pszName; public uint dwClass; public uint dwFlags; } #pragma warning restore 649 [DllImport("bcrypt.dll", CharSet = CharSet.Unicode)] internal static extern uint BCryptEnumAlgorithms( uint dwAlgOperations, [Out] out uint pAlgCount, [Out] out IntPtr ppAlgList, uint dwFlags); [DllImport("bcrypt.dll", CharSet = CharSet.Unicode)] internal static extern uint BCryptFreeBuffer(IntPtr pvBuffer); [DllImport("Crypt32.dll", CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptAcquireCertificatePrivateKey( IntPtr pCertContext, uint dwFlags, IntPtr pvReserved, out IntPtr phCryptProvOrNCryptKey, out uint pdwkeySpec, [MarshalAs(UnmanagedType.Bool)] out bool pfCallerFreeProvOrNCryptKey); [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptSetHashParam( IntPtr hHash, HashParameters param, IntPtr pbData, uint flags); [DllImport("Advapi32.dll", CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool CryptSignHash( IntPtr hHash, uint keySpec, IntPtr sDescription, CryptSignHashFlag flags, IntPtr pbSignature, ref uint pdwSignLen); } }
{ "pile_set_name": "Github" }
#pragma once #include <unordered_map> #include <vector> #include "View2.h" #include <QMap> #include <QMutex> #include <QKeyEvent> #include <QElapsedTimer> #include "Sound.h" #include <CoreInterface.h> class Representation : public QObject { Q_OBJECT public: Representation(QObject* parent = nullptr); struct Performance { QElapsedTimer timer; qint64 mutex_ns; }; const Performance& GetPerformance() { return performance_; } void ResetPerformance(); kv::GrowingFrame GetGrowingFrame() const { return kv::GrowingFrame(new_frame_); } void Swap(); void Process(); void Click(int x, int y); void HandleKeyboardDown(QKeyEvent* event); void HandleKeyboardUp(QKeyEvent* event); void ResetKeysState(); void HandleInput(); SoundPlayer& GetSoundPlayer() { return player_; } signals: void chatMessage(const QString& html); void systemText(const QString& tab, const QString& text); void clearSystemTexts(); void removeEmptyTabs(); private: QMap<Qt::Key, bool> keys_state_; Performance performance_; QElapsedTimer autoplay_timer_; bool autoplay_; QElapsedTimer message_sending_interval_; QMutex mutex_; void SynchronizeViews(); void PerformPixelMovement(); void Draw(); void DrawInterface(); QElapsedTimer pixel_movement_tick_; quint32 current_frame_id_; bool is_updated_; using DataType = kv::FrameData; DataType* old_frame_; DataType* new_frame_; DataType first_data_; DataType second_data_; DataType current_frame_; struct ViewWithFrameId { View2 view; quint32 frame_id; }; std::unordered_map<quint32, ViewWithFrameId> views_; QVector<View2> interface_views_; class Camera { public: Camera(); void SetPos(int new_pos_x, int new_pos_y); void PerformPixelMovement(); int GetFullShiftX(); int GetFullShiftY(); private: int pos_x; int pos_y; int pixel_shift_x_; int pixel_shift_y_; } camera_; SoundPlayer player_; };
{ "pile_set_name": "Github" }
/**************************************************************************** ** ** Copyright (C) 2014 dragondjf ** ** QFramer is a frame based on Qt5.3, you will be more efficient with it. ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) ** become more and more important in modern software, deveployers should consider business and UE. ** So, QFramer is born. QFramer's goal is to be a mature solution ** which you only need to be focus on your business but UE for all Qters. ** ** Version : 0.2.5.0 ** Author : dragondjf ** Website : https://github.com/dragondjf ** Project : https://github.com/dragondjf/QCFramer ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme ** Wiki : https://github.com/dragondjf/QCFramer/wiki ** Lincence: LGPL V2 ** QQ: 465398889 ** Email: [email protected], [email protected], [email protected] ** ****************************************************************************/ #include "QFramer/futil.h" #include "mainwindow/mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { // qInstallMessageHandler(myMessageOutput); QApplication app(argc, argv); QApplication::setOrganizationName("DJF"); QApplication::setOrganizationDomain("https://github.com/dragondjf"); QApplication::setApplicationName("QFramer"); QApplication::setWindowIcon(QIcon(":/images/skin/images/QFramer.ico")); MainWindow *main = MainWindow::getInstance(); main->setAttribute(Qt::WA_DeleteOnClose); main->show(); return app.exec(); }
{ "pile_set_name": "Github" }
// // UIView+Frame.h // Cycript // // Created by AloneMonkey on 15/3/23. // Copyright (c) 2015年 Coder. All rights reserved. // #import <UIKit/UIKit.h> @interface UIView (Frame) @property (nonatomic, assign) CGFloat x; @property (nonatomic, assign) CGFloat y; @property (nonatomic, assign) CGFloat width; @property (nonatomic, assign) CGFloat height; @property (nonatomic, assign) CGPoint origin; @property (nonatomic, assign) CGSize size; @property (nonatomic, assign) CGFloat bottom; @property (nonatomic, assign) CGFloat tail; @property (nonatomic, assign) CGFloat middleX; @property (nonatomic, assign) CGFloat middleY; @end
{ "pile_set_name": "Github" }
/* InvocationTargetException.java -- Wrapper exception for reflection Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2012 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath 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, or (at your option) any later version. GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package java.lang.reflect; /** * InvocationTargetException is sort of a way to "wrap" whatever exception * comes up when a method or constructor is called via Reflection. As of * JDK 1.4, it was retrofitted to match the exception chaining of all other * exceptions, but <code>getTargetException()</code> still works. * * @author John Keiser * @author Tom Tromey ([email protected]) * @author Eric Blake ([email protected]) * @see Method#invoke(Object,Object[]) * @see Constructor#newInstance(Object[]) * @since 1.1 * @status updated to 1.7 */ public class InvocationTargetException extends ReflectiveOperationException { /** * Compatible with JDK 1.1+. */ private static final long serialVersionUID = 4085088731926701167L; /** * The chained exception. This field is only around for serial compatibility. * * @serial the chained exception */ private final Throwable target; /** * Construct an exception with null as the cause. The cause is initialized * to null. */ protected InvocationTargetException() { this(null, null); } /** * Create an <code>InvocationTargetException</code> using another * exception. * * @param targetException the exception to wrap */ public InvocationTargetException(Throwable targetException) { this(targetException, null); } /** * Create an <code>InvocationTargetException</code> using another * exception and an error message. * * @param targetException the exception to wrap * @param err an extra reason for the exception-throwing */ public InvocationTargetException(Throwable targetException, String err) { super(err, targetException); target = targetException; } /** * Get the wrapped (targeted) exception. * * @return the targeted exception * @see #getCause() */ public Throwable getTargetException() { return target; } /** * Returns the cause of this exception (which may be null). * * @return the cause * @since 1.4 */ public Throwable getCause() { return target; } }
{ "pile_set_name": "Github" }
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** 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 Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * John Bandhauer <[email protected]> * * Alternatively, the contents of this file may be used under the terms of * either of 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 ***** */ #ifndef XPC_MAP_CLASSNAME #error "Must #define XPC_MAP_CLASSNAME before #including xpc_map_end.h" #endif #ifndef XPC_MAP_QUOTED_CLASSNAME #error "Must #define XPC_MAP_QUOTED_CLASSNAME before #including xpc_map_end.h" #endif /**************************************************************/ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetClassName(char * *aClassName) { static const char sName[] = XPC_MAP_QUOTED_CLASSNAME; *aClassName = (char*) nsMemory::Clone(sName, sizeof(sName)); return NS_OK; } /**************************************************************/ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetScriptableFlags(PRUint32 *aFlags) { *aFlags = #ifdef XPC_MAP_WANT_PRECREATE nsIXPCScriptable::WANT_PRECREATE | #endif #ifdef XPC_MAP_WANT_CREATE nsIXPCScriptable::WANT_CREATE | #endif #ifdef XPC_MAP_WANT_POSTCREATE nsIXPCScriptable::WANT_POSTCREATE | #endif #ifdef XPC_MAP_WANT_ADDPROPERTY nsIXPCScriptable::WANT_ADDPROPERTY | #endif #ifdef XPC_MAP_WANT_DELPROPERTY nsIXPCScriptable::WANT_DELPROPERTY | #endif #ifdef XPC_MAP_WANT_GETPROPERTY nsIXPCScriptable::WANT_GETPROPERTY | #endif #ifdef XPC_MAP_WANT_SETPROPERTY nsIXPCScriptable::WANT_SETPROPERTY | #endif #ifdef XPC_MAP_WANT_ENUMERATE nsIXPCScriptable::WANT_ENUMERATE | #endif #ifdef XPC_MAP_WANT_NEWENUMERATE nsIXPCScriptable::WANT_NEWENUMERATE | #endif #ifdef XPC_MAP_WANT_NEWRESOLVE nsIXPCScriptable::WANT_NEWRESOLVE | #endif #ifdef XPC_MAP_WANT_CONVERT nsIXPCScriptable::WANT_CONVERT | #endif #ifdef XPC_MAP_WANT_FINALIZE nsIXPCScriptable::WANT_FINALIZE | #endif #ifdef XPC_MAP_WANT_CHECKACCESS nsIXPCScriptable::WANT_CHECKACCESS | #endif #ifdef XPC_MAP_WANT_CALL nsIXPCScriptable::WANT_CALL | #endif #ifdef XPC_MAP_WANT_CONSTRUCT nsIXPCScriptable::WANT_CONSTRUCT | #endif #ifdef XPC_MAP_WANT_HASINSTANCE nsIXPCScriptable::WANT_HASINSTANCE | #endif #ifdef XPC_MAP_WANT_TRACE nsIXPCScriptable::WANT_TRACE | #endif #ifdef XPC_MAP_WANT_EQUALITY nsIXPCScriptable::WANT_EQUALITY | #endif #ifdef XPC_MAP_WANT_OUTER_OBJECT nsIXPCScriptable::WANT_OUTER_OBJECT | #endif #ifdef XPC_MAP_WANT_INNER_OBJECT nsIXPCScriptable::WANT_INNER_OBJECT | #endif #ifdef XPC_MAP_FLAGS XPC_MAP_FLAGS | #endif 0; return NS_OK; } /**************************************************************/ #ifndef XPC_MAP_WANT_PRECREATE /* void preCreate (in nsISupports nativeObj, in JSContextPtr cx, in JSObjectPtr globalObj, out JSObjectPtr parentObj); */ NS_IMETHODIMP XPC_MAP_CLASSNAME::PreCreate(nsISupports *nativeObj, JSContext * cx, JSObject * globalObj, JSObject * *parentObj) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_CREATE NS_IMETHODIMP XPC_MAP_CLASSNAME::Create(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_POSTCREATE NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_ADDPROPERTY NS_IMETHODIMP XPC_MAP_CLASSNAME::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_DELPROPERTY NS_IMETHODIMP XPC_MAP_CLASSNAME::DelProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_GETPROPERTY NS_IMETHODIMP XPC_MAP_CLASSNAME::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval) {NS_WARNING("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_SETPROPERTY NS_IMETHODIMP XPC_MAP_CLASSNAME::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, jsval * vp, PRBool *_retval) {NS_WARNING("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_NEWENUMERATE NS_IMETHODIMP XPC_MAP_CLASSNAME::NewEnumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 enum_op, jsval * statep, jsid * idp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_ENUMERATE NS_IMETHODIMP XPC_MAP_CLASSNAME::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_NEWRESOLVE NS_IMETHODIMP XPC_MAP_CLASSNAME::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, PRUint32 flags, JSObject * *objp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_CONVERT NS_IMETHODIMP XPC_MAP_CLASSNAME::Convert(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 type, jsval * vp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_FINALIZE NS_IMETHODIMP XPC_MAP_CLASSNAME::Finalize(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_CHECKACCESS NS_IMETHODIMP XPC_MAP_CLASSNAME::CheckAccess(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval id, PRUint32 mode, jsval * vp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_CALL NS_IMETHODIMP XPC_MAP_CLASSNAME::Call(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_CONSTRUCT NS_IMETHODIMP XPC_MAP_CLASSNAME::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, PRUint32 argc, jsval * argv, jsval * vp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_HASINSTANCE NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval val, PRBool *bp, PRBool *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_TRACE NS_IMETHODIMP XPC_MAP_CLASSNAME::Trace(nsIXPConnectWrappedNative *wrapper, JSTracer *trc, JSObject * obj) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_EQUALITY NS_IMETHODIMP XPC_MAP_CLASSNAME::Equality(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, jsval val, PRBool *bp) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_OUTER_OBJECT NS_IMETHODIMP XPC_MAP_CLASSNAME::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_INNER_OBJECT NS_IMETHODIMP XPC_MAP_CLASSNAME::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval) {NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;} #endif #ifndef XPC_MAP_WANT_POST_CREATE_PROTOTYPE NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *proto) {return NS_OK;} #endif /**************************************************************/ #undef XPC_MAP_CLASSNAME #undef XPC_MAP_QUOTED_CLASSNAME #ifdef XPC_MAP_WANT_PRECREATE #undef XPC_MAP_WANT_PRECREATE #endif #ifdef XPC_MAP_WANT_CREATE #undef XPC_MAP_WANT_CREATE #endif #ifdef XPC_MAP_WANT_POSTCREATE #undef XPC_MAP_WANT_POSTCREATE #endif #ifdef XPC_MAP_WANT_ADDPROPERTY #undef XPC_MAP_WANT_ADDPROPERTY #endif #ifdef XPC_MAP_WANT_DELPROPERTY #undef XPC_MAP_WANT_DELPROPERTY #endif #ifdef XPC_MAP_WANT_GETPROPERTY #undef XPC_MAP_WANT_GETPROPERTY #endif #ifdef XPC_MAP_WANT_SETPROPERTY #undef XPC_MAP_WANT_SETPROPERTY #endif #ifdef XPC_MAP_WANT_ENUMERATE #undef XPC_MAP_WANT_ENUMERATE #endif #ifdef XPC_MAP_WANT_NEWENUMERATE #undef XPC_MAP_WANT_NEWENUMERATE #endif #ifdef XPC_MAP_WANT_NEWRESOLVE #undef XPC_MAP_WANT_NEWRESOLVE #endif #ifdef XPC_MAP_WANT_CONVERT #undef XPC_MAP_WANT_CONVERT #endif #ifdef XPC_MAP_WANT_FINALIZE #undef XPC_MAP_WANT_FINALIZE #endif #ifdef XPC_MAP_WANT_CHECKACCESS #undef XPC_MAP_WANT_CHECKACCESS #endif #ifdef XPC_MAP_WANT_CALL #undef XPC_MAP_WANT_CALL #endif #ifdef XPC_MAP_WANT_CONSTRUCT #undef XPC_MAP_WANT_CONSTRUCT #endif #ifdef XPC_MAP_WANT_HASINSTANCE #undef XPC_MAP_WANT_HASINSTANCE #endif #ifdef XPC_MAP_WANT_TRACE #undef XPC_MAP_WANT_TRACE #endif #ifdef XPC_MAP_WANT_EQUALITY #undef XPC_MAP_WANT_EQUALITY #endif #ifdef XPC_MAP_WANT_OUTER_OBJECT #undef XPC_MAP_WANT_OUTER_OBJECT #endif #ifdef XPC_MAP_WANT_POST_CREATE_PROTOTYPE #undef XPC_MAP_WANT_POST_CREATE_PROTOTYPE #endif #ifdef XPC_MAP_FLAGS #undef XPC_MAP_FLAGS #endif
{ "pile_set_name": "Github" }
'use strict'; const URL = require('url').URL; const fs = require('fs'); const Docker = require('dockerode'); const dockerConfig = require('../../../config/dockerConfig'); let dockerConnection; if (dockerConfig.host) { const dockerUrl = new URL(dockerConfig.host); dockerConnection = { host: dockerUrl.hostname, port: dockerUrl.port, ca: dockerConfig.certPath ? fs.readFileSync(dockerConfig.certPath + '/ca.pem') : undefined, cert: dockerConfig.certPath ? fs.readFileSync(dockerConfig.certPath + '/cert.pem') : undefined, key: dockerConfig.certPath ? fs.readFileSync(dockerConfig.certPath + '/key.pem') : undefined }; } else { dockerConnection = ({ socketPath: '/var/run/docker.sock' }); } const docker = new Docker(dockerConnection); const pullImage = async (dockerImage) => { const dockerImageStream = await docker.pull(dockerImage); return new Promise((resolve, reject) => { docker.modem.followProgress(dockerImageStream, (err) => { if (!err) { return resolve(); } else { return reject(err); } }); }); }; module.exports.runJob = async (dockerJobConfig) => { await pullImage(dockerJobConfig.dockerImage); const envVarArray = Object.keys(dockerJobConfig.environmentVariables).map((envVar) => { return `${envVar}=${dockerJobConfig.environmentVariables[envVar]}`; }); const promises = []; for (let i = 0; i < (dockerJobConfig.parallelism || 1); i++) { promises.push(startContainer(dockerJobConfig.dockerImage, dockerJobConfig.jobName, dockerJobConfig.runId, i, envVarArray)); } await Promise.all(promises); const genericJobResponse = { jobName: dockerJobConfig.jobName, id: dockerJobConfig.runId }; return genericJobResponse; }; const startContainer = async (dockerImage, jobName, runId, parallelIndex, envVarArray) => { const container = await docker.createContainer({ name: `${jobName}-${runId}-${parallelIndex}`, Image: dockerImage, Env: envVarArray }); await container.start(); }; module.exports.stopRun = async (jobPlatformName, platformSpecificInternalRunId) => { let containers = await docker.listContainers(); containers = containers.filter(container => container.Names && container.Names[0] && container.Names[0].includes(jobPlatformName) && container.Names[0].includes(platformSpecificInternalRunId)); containers.forEach(async container => { const containerToStop = await docker.getContainer(container.Id); await containerToStop.stop(); } ); }; module.exports.deleteAllContainers = async (jobPlatformName) => { const containers = await docker.listContainers({ all: true, filters: JSON.stringify({ name: [jobPlatformName], status: ['exited', 'dead'] }) }); containers.forEach(async container => { const containerToRemove = await docker.getContainer(container.Id); await containerToRemove.remove(); }); return { deleted: containers.length }; }; module.exports.getLogs = async (jobPlatformName, platformSpecificInternalRunId) => { let containers = await docker.listContainers({ all: true }); containers = containers.filter(container => container.Names && container.Names[0] && container.Names[0].includes(jobPlatformName) && container.Names[0].includes(platformSpecificInternalRunId)); const logs = []; for (let i = 0; i < containers.length; i++) { const containerToGetLogsFrom = await docker.getContainer(containers[i].Id); const logBuffer = await containerToGetLogsFrom.logs({ stdout: true, stderr: true }); const logString = logBuffer.toString('utf-8'); logs.push({ type: 'file', name: containers[i].Id + '.txt', content: logString }); } return logs; };
{ "pile_set_name": "Github" }
/* ** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ #ifndef ldo_h #define ldo_h #include "lobject.h" #include "lstate.h" #include "lzio.h" #define luaD_checkstack(L,n) \ if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ luaD_growstack(L, n); \ else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); #define incr_top(L) {luaD_checkstack(L,1); L->top++;} #define savestack(L,p) ((char *)(p) - (char *)L->stack) #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) #define saveci(L,p) ((char *)(p) - (char *)L->base_ci) #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) /* results from luaD_precall */ #define PCRLUA 0 /* initiated a call to a Lua function */ #define PCRC 1 /* did a call to a C function */ #define PCRYIELD 2 /* C funtion yielded */ /* type of protected functions, to be ran by `runprotected' */ typedef void (*Pfunc) (lua_State *L, void *ud); LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t oldtop, ptrdiff_t ef); LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); LUAI_FUNC void luaD_growstack (lua_State *L, int n); LUAI_FUNC void luaD_throw (lua_State *L, int errcode); LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- /* //device/apps/common/assets/res/any/strings.xml ** ** Copyright 2006, The Android Open Source Project ** ** 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. */ --> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="mmcc_imsi_unknown_in_hlr" msgid="5424518490295341205">"SIM haitumiki MM#2"</string> <string name="mmcc_illegal_ms" msgid="3527626511418944853">"SIM hairuhusiwi MM#3"</string> <string name="mmcc_illegal_me" msgid="3948912590657398489">"Simu hairuhusiwi MM#6"</string> </resources>
{ "pile_set_name": "Github" }
fn execute_bf program let program_len:int program_counter:int \ memory:hmap[int] memory_pointer:int \ stack:hmap[int] stack_pointer:int \ jumps:hmap[int] jumps_program_counter:int \ = $len(program) 0 [] 0 [] 0 [] 0 let program: [str] = [ @chars(program) ] while test $jumps_program_counter -lt $program_len if test @program[$jumps_program_counter] = "[" let search_depth: int = 0 let jump_target: int = $jumps_program_counter while test $search_depth -ge 0 let jump_target += 1 test $jump_target -ge $program_len && exit match @program[$jump_target] case "["; let search_depth += 1 case "]"; let search_depth -= 1 end end let jumps[$jumps_program_counter] = $jump_target end let jumps_program_counter += 1 end let memory[0] = 0 while test $program_counter -lt $program_len match @program[$program_counter] case "+" if test @memory[$memory_pointer] -eq 255 let memory[$memory_pointer] = 0 case "+" let memory_value = @memory[$memory_pointer] let memory[$memory_pointer] = $((1 + memory_value)) # TODO: let memory[$memory_pointer] += 1 case "-" if test @memory[$memory_pointer] -eq 0 let memory[$memory_pointer] = 255 case "-" let memory_value = @memory[$memory_pointer] let memory[$memory_pointer] = $((-1 + memory_value)) # TODO: let memory[$memory_pointer] -= 1 case ">" let memory_pointer += 1 if test @memory[$memory_pointer] = "" let memory[$memory_pointer] = 0 end case "<" let memory_pointer -= 1 if test @memory[$memory_pointer] = "" let memory[$memory_pointer] = 0 end case "[" let memory_value = @memory[$memory_pointer] if test $memory_value -ne 0 let stack[$stack_pointer] = $program_counter let stack_pointer += 1 else let program_counter = @jumps[$program_counter] end case "]" let stack_pointer -= 1 let program_counter = @stack[$stack_pointer] let program_counter -= 1 case "." # TODO: Nicer decimal to ASCII conversion printf \\$(printf '%03o' @memory[$memory_pointer]) case "," echo Input not supported yet end let program_counter += 1 end end if test @args[1] != "" execute_bf @args[1] else execute_bf '-[------->+<]>.++++++.-.++[----->++<]>.>-[--->+<]>--.----------\ -.---.+++++++..>++++++++++.' execute_bf '++++[++++>---<]>-.>-[--->+<]>---.--[->++++<]>+.++++++++.+++++.-\ -------.>-[--->+<]>.-[----->+<]>-.++++++++.---[->++++<]>.++[->++<]>.+.+\ +++++++.++.>++++++++++.' # https://github.com/brain-lang/brainfuck/blob/master/examples/sierpinski.bf execute_bf '[.--..]++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]\ +>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+][.]' # https://www.rosettacode.org/wiki/99_Bottles_of_Beer/EsoLang execute_bf '>+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]\ <<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]++++++\ +++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]>\ [<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]\ >>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++\ ++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-\ ]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>++\ +++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++\ +++++++++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++\ [<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-\ ]<++++.------------.---.>+++++++[<---------->-]<+.>++++++++[<++++++++++\ +>-]<-.>++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<----\ -.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>++++[<++++++>-]<--\ .>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.\ >>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++\ ++++>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<\ .>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]\ <-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++.------.>++\ +++++[<---------->-]<+.>++++++++[<++++++++++>-]<-.-.---------.>+++++++[\ <---------->-]<+.>+++++++[<++++++++++>-]<--.+++++++++++.++++++++.------\ ---.>++++++++[<---------->-]<++.>+++++[<+++++++++++++>-]<.+++++++++++++\ .----------.>+++++++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<\ ----->-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<+++++\ +++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++.>+++++[<+++++++\ ++++++>-]<.>+++[<++++++>-]<-.---.++++++.-------.----------.>++++++++[<-\ ---------->-]<+.---.[-]<<<->[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<++++++\ +++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-\ ]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<\ <-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>\ >-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]\ <++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<\ <+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++\ [<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<+++++++++\ ++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++[<+++++\ ++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-]<++++.\ ------------.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-.\ >++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<-----.---.+\ ++.---.[-]<<<]' end fn execute_bf program let program_len:int program_counter:int \ memory:hmap[int] memory_pointer:int \ stack:hmap[int] stack_pointer:int \ jumps:hmap[int] jumps_program_counter:int \ = $len(program) 0 [] 0 [] 0 [] 0 let program: [str] = [ @chars(program) ] while test $jumps_program_counter -lt $program_len if test @program[$jumps_program_counter] = "[" let search_depth: int = 0 let jump_target: int = $jumps_program_counter while test $search_depth -ge 0 let jump_target += 1 test $jump_target -ge $program_len && exit match @program[$jump_target] case "["; let search_depth += 1 case "]"; let search_depth -= 1 end end let jumps[$jumps_program_counter] = $jump_target end let jumps_program_counter += 1 end let memory[0] = 0 while test $program_counter -lt $program_len match @program[$program_counter] case "+" if test @memory[$memory_pointer] -eq 255 let memory[$memory_pointer] = 0 case "+" let memory_value = @memory[$memory_pointer] let memory[$memory_pointer] = $((1 + memory_value)) # TODO: let memory[$memory_pointer] += 1 case "-" if test @memory[$memory_pointer] -eq 0 let memory[$memory_pointer] = 255 case "-" let memory_value = @memory[$memory_pointer] let memory[$memory_pointer] = $((-1 + memory_value)) # TODO: let memory[$memory_pointer] -= 1 case ">" let memory_pointer += 1 if test @memory[$memory_pointer] = "" let memory[$memory_pointer] = 0 end case "<" let memory_pointer -= 1 if test @memory[$memory_pointer] = "" let memory[$memory_pointer] = 0 end case "[" let memory_value = @memory[$memory_pointer] if test $memory_value -ne 0 let stack[$stack_pointer] = $program_counter let stack_pointer += 1 else let program_counter = @jumps[$program_counter] end case "]" let stack_pointer -= 1 let program_counter = @stack[$stack_pointer] let program_counter -= 1 case "." # TODO: Nicer decimal to ASCII conversion printf \\$(printf '%03o' @memory[$memory_pointer]) case "," echo Input not supported yet end let program_counter += 1 end end if test @args[1] != "" execute_bf @args[1] else execute_bf '-[------->+<]>.++++++.-.++[----->++<]>.>-[--->+<]>--.----------\ -.---.+++++++..>++++++++++.' execute_bf '++++[++++>---<]>-.>-[--->+<]>---.--[->++++<]>+.++++++++.+++++.-\ -------.>-[--->+<]>.-[----->+<]>-.++++++++.---[->++++<]>.++[->++<]>.+.+\ +++++++.++.>++++++++++.' # https://github.com/brain-lang/brainfuck/blob/master/examples/sierpinski.bf execute_bf '[.--..]++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]\ +>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+][.]' # https://www.rosettacode.org/wiki/99_Bottles_of_Beer/EsoLang execute_bf '>+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]\ <<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]++++++\ +++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]>\ [<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]\ >>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++\ ++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-\ ]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>++\ +++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++\ +++++++++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++\ [<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-\ ]<++++.------------.---.>+++++++[<---------->-]<+.>++++++++[<++++++++++\ +>-]<-.>++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<----\ -.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>++++[<++++++>-]<--\ .>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.\ >>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++\ ++++>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<\ .>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]\ <-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++.------.>++\ +++++[<---------->-]<+.>++++++++[<++++++++++>-]<-.-.---------.>+++++++[\ <---------->-]<+.>+++++++[<++++++++++>-]<--.+++++++++++.++++++++.------\ ---.>++++++++[<---------->-]<++.>+++++[<+++++++++++++>-]<.+++++++++++++\ .----------.>+++++++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<\ ----->-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<+++++\ +++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++.>+++++[<+++++++\ ++++++>-]<.>+++[<++++++>-]<-.---.++++++.-------.----------.>++++++++[<-\ ---------->-]<+.---.[-]<<<->[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<++++++\ +++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-\ ]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<\ <-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>\ >-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]\ <++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<\ <+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++\ [<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<+++++++++\ ++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++[<+++++\ ++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-]<++++.\ ------------.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-.\ >++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<-----.---.+\ ++.---.[-]<<<]' end fn execute_bf program let program_len:int program_counter:int \ memory:hmap[int] memory_pointer:int \ stack:hmap[int] stack_pointer:int \ jumps:hmap[int] jumps_program_counter:int \ = $len(program) 0 [] 0 [] 0 [] 0 let program: [str] = [ @chars(program) ] while test $jumps_program_counter -lt $program_len if test @program[$jumps_program_counter] = "[" let search_depth: int = 0 let jump_target: int = $jumps_program_counter while test $search_depth -ge 0 let jump_target += 1 test $jump_target -ge $program_len && exit match @program[$jump_target] case "["; let search_depth += 1 case "]"; let search_depth -= 1 end end let jumps[$jumps_program_counter] = $jump_target end let jumps_program_counter += 1 end let memory[0] = 0 while test $program_counter -lt $program_len match @program[$program_counter] case "+" if test @memory[$memory_pointer] -eq 255 let memory[$memory_pointer] = 0 case "+" let memory_value = @memory[$memory_pointer] let memory[$memory_pointer] = $((1 + memory_value)) # TODO: let memory[$memory_pointer] += 1 case "-" if test @memory[$memory_pointer] -eq 0 let memory[$memory_pointer] = 255 case "-" let memory_value = @memory[$memory_pointer] let memory[$memory_pointer] = $((-1 + memory_value)) # TODO: let memory[$memory_pointer] -= 1 case ">" let memory_pointer += 1 if test @memory[$memory_pointer] = "" let memory[$memory_pointer] = 0 end case "<" let memory_pointer -= 1 if test @memory[$memory_pointer] = "" let memory[$memory_pointer] = 0 end case "[" let memory_value = @memory[$memory_pointer] if test $memory_value -ne 0 let stack[$stack_pointer] = $program_counter let stack_pointer += 1 else let program_counter = @jumps[$program_counter] end case "]" let stack_pointer -= 1 let program_counter = @stack[$stack_pointer] let program_counter -= 1 case "." # TODO: Nicer decimal to ASCII conversion printf \\$(printf '%03o' @memory[$memory_pointer]) case "," echo Input not supported yet end let program_counter += 1 end end if test @args[1] != "" execute_bf @args[1] else execute_bf '-[------->+<]>.++++++.-.++[----->++<]>.>-[--->+<]>--.----------\ -.---.+++++++..>++++++++++.' execute_bf '++++[++++>---<]>-.>-[--->+<]>---.--[->++++<]>+.++++++++.+++++.-\ -------.>-[--->+<]>.-[----->+<]>-.++++++++.---[->++++<]>.++[->++<]>.+.+\ +++++++.++.>++++++++++.' # https://github.com/brain-lang/brainfuck/blob/master/examples/sierpinski.bf execute_bf '[.--..]++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]\ +>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+][.]' # https://www.rosettacode.org/wiki/99_Bottles_of_Beer/EsoLang execute_bf '>+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]\ <<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]++++++\ +++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]>\ [<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]\ >>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++\ ++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-\ ]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>++\ +++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++\ +++++++++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++\ [<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-\ ]<++++.------------.---.>+++++++[<---------->-]<+.>++++++++[<++++++++++\ +>-]<-.>++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<----\ -.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>++++[<++++++>-]<--\ .>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.\ >>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++\ ++++>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<\ .>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]\ <-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++.------.>++\ +++++[<---------->-]<+.>++++++++[<++++++++++>-]<-.-.---------.>+++++++[\ <---------->-]<+.>+++++++[<++++++++++>-]<--.+++++++++++.++++++++.------\ ---.>++++++++[<---------->-]<++.>+++++[<+++++++++++++>-]<.+++++++++++++\ .----------.>+++++++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<\ ----->-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<+++++\ +++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++.>+++++[<+++++++\ ++++++>-]<.>+++[<++++++>-]<-.---.++++++.-------.----------.>++++++++[<-\ ---------->-]<+.---.[-]<<<->[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<++++++\ +++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-\ ]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<\ <-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>\ >-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]\ <++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<\ <+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++\ [<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<+++++++++\ ++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++[<+++++\ ++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-]<++++.\ ------------.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-.\ >++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<-----.---.+\ ++.---.[-]<<<]' end
{ "pile_set_name": "Github" }
// // LBXScanView.m // // // Created by lbxia on 15/11/15. // Copyright © 2015年 lbxia. All rights reserved. // #import "LBXScanView.h" @interface LBXScanView() //扫码区域各种参数 @property (nonatomic, strong) LBXScanViewStyle* viewStyle; //扫码区域 @property (nonatomic,assign)CGRect scanRetangleRect; //线条扫码动画封装 @property (nonatomic,strong)LBXScanLineAnimation *scanLineAnimation; //网格扫码动画封装 @property (nonatomic,strong)LBXScanNetAnimation *scanNetAnimation; //线条在中间位置,不移动 @property (nonatomic,strong)UIImageView *scanLineStill; /** @brief 启动相机时 菊花等待 */ @property(nonatomic,strong)UIActivityIndicatorView* activityView; /** @brief 启动相机中的提示文字 */ @property(nonatomic,strong)UILabel *labelReadying; @end @implementation LBXScanView -(id)initWithFrame:(CGRect)frame style:(LBXScanViewStyle*)style { if (self = [super initWithFrame:frame]) { self.viewStyle = style; self.backgroundColor = [UIColor clearColor]; } return self; } - (void)drawRect:(CGRect)rect { [self drawScanRect]; } - (void)startDeviceReadyingWithText:(NSString*)text { int XRetangleLeft = _viewStyle.xScanRetangleOffset; CGSize sizeRetangle = CGSizeMake(self.frame.size.width - XRetangleLeft*2, self.frame.size.width - XRetangleLeft*2); if (!_viewStyle.isNeedShowRetangle) { CGFloat w = sizeRetangle.width; CGFloat h = w / _viewStyle.whRatio; NSInteger hInt = (NSInteger)h; h = hInt; sizeRetangle = CGSizeMake(w, h); } //扫码区域Y轴最小坐标 CGFloat YMinRetangle = self.frame.size.height / 2.0 - sizeRetangle.height/2.0 - _viewStyle.centerUpOffset; //设备启动状态提示 if (!_activityView) { self.activityView = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(0, 0, 30, 30)]; [_activityView setCenter:CGPointMake(XRetangleLeft + sizeRetangle.width/2 - 50, YMinRetangle + sizeRetangle.height/2)]; [_activityView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge]; [self addSubview:_activityView]; CGRect labelReadyRect = CGRectMake(_activityView.frame.origin.x + _activityView.frame.size.width + 10, _activityView.frame.origin.y, 100, 30); self.labelReadying = [[UILabel alloc]initWithFrame:labelReadyRect]; _labelReadying.backgroundColor = [UIColor clearColor]; _labelReadying.textColor = [UIColor whiteColor]; _labelReadying.font = [UIFont systemFontOfSize:18.]; _labelReadying.text = text; [self addSubview:_labelReadying]; [_activityView startAnimating]; } } - (void)stopDeviceReadying { if (_activityView) { [_activityView stopAnimating]; [_activityView removeFromSuperview]; [_labelReadying removeFromSuperview]; self.activityView = nil; self.labelReadying = nil; } } /** * 开始扫描动画 */ - (void)startScanAnimation { switch (_viewStyle.anmiationStyle) { case LBXScanViewAnimationStyle_LineMove: { //线动画 if (!_scanLineAnimation) self.scanLineAnimation = [[LBXScanLineAnimation alloc]init]; [_scanLineAnimation startAnimatingWithRect:_scanRetangleRect InView:self Image:_viewStyle.animationImage]; } break; case LBXScanViewAnimationStyle_NetGrid: { //网格动画 if (!_scanNetAnimation) self.scanNetAnimation = [[LBXScanNetAnimation alloc]init]; [_scanNetAnimation startAnimatingWithRect:_scanRetangleRect InView:self Image:_viewStyle.animationImage]; } break; case LBXScanViewAnimationStyle_LineStill: { if (!_scanLineStill) { CGRect stillRect = CGRectMake(_scanRetangleRect.origin.x+20, _scanRetangleRect.origin.y + _scanRetangleRect.size.height/2, _scanRetangleRect.size.width-40, 2); _scanLineStill = [[UIImageView alloc]initWithFrame:stillRect]; _scanLineStill.image = _viewStyle.animationImage; } [self addSubview:_scanLineStill]; } default: break; } } /** * 结束扫描动画 */ - (void)stopScanAnimation { if (_scanLineAnimation) { [_scanLineAnimation stopAnimating]; } if (_scanNetAnimation) { [_scanNetAnimation stopAnimating]; } if (_scanLineStill) { [_scanLineStill removeFromSuperview]; } } - (void)drawScanRect { int XRetangleLeft = _viewStyle.xScanRetangleOffset; CGSize sizeRetangle = CGSizeMake(self.frame.size.width - XRetangleLeft*2, self.frame.size.width - XRetangleLeft*2); //if (!_viewStyle.isScanRetangelSquare) if (_viewStyle.whRatio != 1) { CGFloat w = sizeRetangle.width; CGFloat h = w / _viewStyle.whRatio; NSInteger hInt = (NSInteger)h; h = hInt; sizeRetangle = CGSizeMake(w, h); } //扫码区域Y轴最小坐标 CGFloat YMinRetangle = self.frame.size.height / 2.0 - sizeRetangle.height/2.0 - _viewStyle.centerUpOffset; CGFloat YMaxRetangle = YMinRetangle + sizeRetangle.height; CGFloat XRetangleRight = self.frame.size.width - XRetangleLeft; NSLog(@"frame:%@",NSStringFromCGRect(self.frame)); CGContextRef context = UIGraphicsGetCurrentContext(); //非扫码区域半透明 { //设置非识别区域颜色 CGContextSetRGBFillColor(context, _viewStyle.red_notRecoginitonArea, _viewStyle.green_notRecoginitonArea, _viewStyle.blue_notRecoginitonArea, _viewStyle.alpa_notRecoginitonArea); //填充矩形 //扫码区域上面填充 CGRect rect = CGRectMake(0, 0, self.frame.size.width, YMinRetangle); CGContextFillRect(context, rect); //扫码区域左边填充 rect = CGRectMake(0, YMinRetangle, XRetangleLeft,sizeRetangle.height); CGContextFillRect(context, rect); //扫码区域右边填充 rect = CGRectMake(XRetangleRight, YMinRetangle, XRetangleLeft,sizeRetangle.height); CGContextFillRect(context, rect); //扫码区域下面填充 rect = CGRectMake(0, YMaxRetangle, self.frame.size.width,self.frame.size.height - YMaxRetangle); CGContextFillRect(context, rect); //执行绘画 CGContextStrokePath(context); } if (_viewStyle.isNeedShowRetangle) { //中间画矩形(正方形) CGContextSetStrokeColorWithColor(context, _viewStyle.colorRetangleLine.CGColor); CGContextSetLineWidth(context, 1); CGContextAddRect(context, CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height)); //CGContextMoveToPoint(context, XRetangleLeft, YMinRetangle); //CGContextAddLineToPoint(context, XRetangleLeft+sizeRetangle.width, YMinRetangle); CGContextStrokePath(context); } _scanRetangleRect = CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height); //画矩形框4格外围相框角 //相框角的宽度和高度 int wAngle = _viewStyle.photoframeAngleW; int hAngle = _viewStyle.photoframeAngleH; //4个角的 线的宽度 CGFloat linewidthAngle = _viewStyle.photoframeLineW;// 经验参数:6和4 //画扫码矩形以及周边半透明黑色坐标参数 CGFloat diffAngle = 0.0f; //diffAngle = linewidthAngle / 2; //框外面4个角,与框有缝隙 //diffAngle = linewidthAngle/2; //框4个角 在线上加4个角效果 //diffAngle = 0;//与矩形框重合 switch (_viewStyle.photoframeAngleStyle) { case LBXScanViewPhotoframeAngleStyle_Outer: { diffAngle = linewidthAngle/3;//框外面4个角,与框紧密联系在一起 } break; case LBXScanViewPhotoframeAngleStyle_On: { diffAngle = 0; } break; case LBXScanViewPhotoframeAngleStyle_Inner: { diffAngle = -_viewStyle.photoframeLineW/2; } break; default: { diffAngle = linewidthAngle/3; } break; } CGContextSetStrokeColorWithColor(context, _viewStyle.colorAngle.CGColor); CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); // Draw them with a 2.0 stroke width so they are a bit more visible. CGContextSetLineWidth(context, linewidthAngle); // CGFloat leftX = XRetangleLeft - diffAngle; CGFloat topY = YMinRetangle - diffAngle; CGFloat rightX = XRetangleRight + diffAngle; CGFloat bottomY = YMaxRetangle + diffAngle; //左上角水平线 CGContextMoveToPoint(context, leftX-linewidthAngle/2, topY); CGContextAddLineToPoint(context, leftX + wAngle, topY); //左上角垂直线 CGContextMoveToPoint(context, leftX, topY-linewidthAngle/2); CGContextAddLineToPoint(context, leftX, topY+hAngle); //左下角水平线 CGContextMoveToPoint(context, leftX-linewidthAngle/2, bottomY); CGContextAddLineToPoint(context, leftX + wAngle, bottomY); //左下角垂直线 CGContextMoveToPoint(context, leftX, bottomY+linewidthAngle/2); CGContextAddLineToPoint(context, leftX, bottomY - hAngle); //右上角水平线 CGContextMoveToPoint(context, rightX+linewidthAngle/2, topY); CGContextAddLineToPoint(context, rightX - wAngle, topY); //右上角垂直线 CGContextMoveToPoint(context, rightX, topY-linewidthAngle/2); CGContextAddLineToPoint(context, rightX, topY + hAngle); //右下角水平线 CGContextMoveToPoint(context, rightX+linewidthAngle/2, bottomY); CGContextAddLineToPoint(context, rightX - wAngle, bottomY); //右下角垂直线 CGContextMoveToPoint(context, rightX, bottomY+linewidthAngle/2); CGContextAddLineToPoint(context, rightX, bottomY - hAngle); CGContextStrokePath(context); } //根据矩形区域,获取识别区域 + (CGRect)getScanRectWithPreView:(UIView*)view style:(LBXScanViewStyle*)style { int XRetangleLeft = style.xScanRetangleOffset; CGSize sizeRetangle = CGSizeMake(view.frame.size.width - XRetangleLeft*2, view.frame.size.width - XRetangleLeft*2); if (style.whRatio != 1) { CGFloat w = sizeRetangle.width; CGFloat h = w / style.whRatio; NSInteger hInt = (NSInteger)h; h = hInt; sizeRetangle = CGSizeMake(w, h); } //扫码区域Y轴最小坐标 CGFloat YMinRetangle = view.frame.size.height / 2.0 - sizeRetangle.height/2.0 - style.centerUpOffset; //扫码区域坐标 CGRect cropRect = CGRectMake(XRetangleLeft, YMinRetangle, sizeRetangle.width, sizeRetangle.height); //计算兴趣区域 CGRect rectOfInterest; //ref:http://www.cocoachina.com/ios/20141225/10763.html CGSize size = view.bounds.size; CGFloat p1 = size.height/size.width; CGFloat p2 = 1920./1080.; //使用了1080p的图像输出 if (p1 < p2) { CGFloat fixHeight = size.width * 1920. / 1080.; CGFloat fixPadding = (fixHeight - size.height)/2; rectOfInterest = CGRectMake((cropRect.origin.y + fixPadding)/fixHeight, cropRect.origin.x/size.width, cropRect.size.height/fixHeight, cropRect.size.width/size.width); } else { CGFloat fixWidth = size.height * 1080. / 1920.; CGFloat fixPadding = (fixWidth - size.width)/2; rectOfInterest = CGRectMake(cropRect.origin.y/size.height, (cropRect.origin.x + fixPadding)/fixWidth, cropRect.size.height/size.height, cropRect.size.width/fixWidth); } return rectOfInterest; } @end
{ "pile_set_name": "Github" }
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // Generated using tools/cldr/cldr-to-icu/build-icu-data.xml en_IL{ %%Parent{"en_001"} }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <ECSchema schemaName="CoreCustomAttributes" alias="CoreCA" version="01.00.00" description="Custom attributes to indicate core EC concepts, may include struct classes intended for use in core custom attributes." displayLabel="Core Custom Attributes" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2"> <ECEnumeration typeName="DateTimeComponent" backingTypeName="string" isStrict="true"> <ECEnumerator name="DateTime" value="DateTime"/> <ECEnumerator name="Date" value="Date"/> </ECEnumeration> <ECEnumeration typeName="DateTimeKind" backingTypeName="string" isStrict="true"> <ECEnumerator name="Unspecified" value="Unspecified"/> <ECEnumerator name="Utc" value="Utc"/> <ECEnumerator name="Local" value="Local"/> </ECEnumeration> <ECCustomAttributeClass typeName="ClassHasCurrentTimeStampProperty" modifier="Sealed" appliesTo="EntityClass"> <ECProperty propertyName="PropertyName" typeName="string"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="DateTimeInfo" description="Optional additional meta data for ECProperties of type DateTime." modifier="Sealed" appliesTo="PrimitiveProperty, ArrayProperty"> <ECProperty propertyName="DateTimeKind" typeName="DateTimeKind" description="Either Utc, Local or Unspecified. Default: Unspecified. When specifying a DateTimeKind, it is usually not necessary to specify a DateTimeComponent because a DateTimeKind implies the DateTimeComponent 'DateTime'."/> <ECProperty propertyName="DateTimeComponent" typeName="DateTimeComponent" description="Either DateTime or Date. Default: DateTime. Specifying 'Date' usually implies that a DateTimeKind is irrelevant, because dates (without time) don't need any timezone information."/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="DynamicSchema" description="Identifies a schema as dynamically generated by an application. Like versions of a schema may differ and are not guaranteed to merge without conflicts." displayLabel="Dynamic Schema" modifier="Sealed" appliesTo="Schema"/> <ECCustomAttributeClass typeName="HiddenClass" description="Identifies a class which is designed to be hidden from teh user interface. Hides the class it is applied to and all derived classes" modifier="Sealed" appliesTo="AnyClass"> <ECProperty propertyName="Show" typeName="boolean" description="If set to true show the hidden class. Defaults to False. Allows a derived class to be shown even though it's base class is hidden"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="HiddenProperty" description="Identifies a property which is designed to be hidden from the user interface" modifier="Sealed" appliesTo="AnyProperty"> <ECProperty propertyName="Show" typeName="boolean" description="If set to true show the hidden property. Defaults to False. Allows a property override to show a hidden property in a derived class"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="HiddenSchema" description="Identifies a schema which is designed to be hidden from the user interface. By default all classes in the schema are hidden as well." modifier="Sealed" appliesTo="Schema"> <ECProperty propertyName="ShowClasses" typeName="boolean" description="If true classe in the schema will be shown. Default is False. If set to true individual classes may be hidden using the HiddenClass custom attribute"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="IsMixin" description="Applied to abstract ECEntityClasses which serve as secondary base classes for normal ECEntityClasses." displayLabel="Is Mixin" modifier="Sealed" appliesTo="EntityClass"> <ECProperty propertyName="AppliesToEntityClass" typeName="string" description="This mixin may only be applied to entity classes which derive from this class. Class Name should be fully specified as 'alias:ClassName'"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="Localizable" description="Applied to a property to indicate that custom attributes using this property can be localized." displayLabel="Localizable" modifier="Sealed" appliesTo="PrimitiveProperty"/> <ECCustomAttributeClass typeName="NotSubclassableInReferencingSchemas" description="Makes a class 'sealed' outside of the schema containing the class" modifier="Sealed" appliesTo="AnyClass"> <ECArrayProperty propertyName="Exceptions" typeName="string" description="Optionally allows specific classes in other schemas to subclass this class. Use format '[SchemaName]:[ClassName]', e.g. 'Fruit:Banana'" minOccurs="0" maxOccurs="unbounded"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="PartialSchema" description="Identifies a schema file/object that may only contain part of the complete schema. Like versions of a schema may differ but are guaranteed to merge without conflicts." displayLabel="Partial Schema" modifier="Sealed" appliesTo="Schema"/> <ECStructClass typeName="SchemaNameAndPurpose" description="Used to define a supplemental schema and its purpose" modifier="Sealed"> <ECProperty propertyName="SchemaName" typeName="string" description="Full name of the supplemental schema"/> <ECProperty propertyName="Purpose" typeName="string" description="Purpose of the supplemental schema"/> </ECStructClass> <ECStructClass typeName="SchemaReference" description="Reference to a schema including name and version" displayLabel="Schema Reference" modifier="Sealed"> <ECProperty propertyName="SchemaName" typeName="string" description="Name of schema, excluding version" displayLabel="Schema Name"/> <ECProperty propertyName="MajorVersion" typeName="int" description="[This].[Write].[Minor]" displayLabel="Major Version"/> <ECProperty propertyName="MinorVersion" typeName="int" description="[Major].[Write].[This]" displayLabel="Minor Version"/> <ECProperty propertyName="WriteVersion" typeName="int" description="[Major].[This].[Minor]"/> </ECStructClass> <ECCustomAttributeClass typeName="SupplementalProvenance" modifier="Sealed" appliesTo="Schema"> <ECStructArrayProperty propertyName="SupplementalSchemaNamesAndPurposes" typeName="SchemaNameAndPurpose" minOccurs="0" maxOccurs="unbounded"/> </ECCustomAttributeClass> <ECCustomAttributeClass typeName="SupplementalSchema" description="Identifies a schema as a supplemental schema and stores extra metadata necessary for supplemental schemas" displayLabel="Supplemental Schema" modifier="Sealed" appliesTo="Schema"> <ECStructProperty propertyName="PrimarySchemaReference" typeName="SchemaReference" description="References the primary schema this supplemental should be applied to" displayLabel="Primary Schema Reference"/> <ECProperty propertyName="Precedence" typeName="int" description="Positive integer defining the precedence of this supplemental schema. Higher precedences override lower precences. The primary schema is considered to have a precedence between 199 and 200."/> <ECProperty propertyName="Purpose" typeName="string" description="A string representing the function of this supplemental schema. Standard name formatting for a supplemental schema is &lt;PrimarySchemaName&gt;_Supplemental_&lt;Purpose&gt;"/> </ECCustomAttributeClass> </ECSchema>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.camel</groupId> <artifactId>components</artifactId> <version>3.6.0-SNAPSHOT</version> </parent> <artifactId>camel-barcode</artifactId> <packaging>jar</packaging> <name>Camel :: Barcode</name> <description>Camel Barcode (e.g. QRcode, PDF417, DataMatrix) support</description> <properties> </properties> <dependencies> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-support</artifactId> </dependency> <dependency> <groupId>com.google.zxing</groupId> <artifactId>core</artifactId> <version>${zxing-version}</version> </dependency> <dependency> <groupId>com.google.zxing</groupId> <artifactId>javase</artifactId> <version>${zxing-version}</version> </dependency> <!-- testing --> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test-spring-junit5</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> </dependency> </dependencies> </project>
{ "pile_set_name": "Github" }
package user import ( "errors" "fmt" "syscall" ) var ( // The current operating system does not provide the required data for user lookups. ErrUnsupported = errors.New("user lookup: operating system does not provide passwd-formatted data") ) func lookupUser(filter func(u User) bool) (User, error) { // Get operating system-specific passwd reader-closer. passwd, err := GetPasswd() if err != nil { return User{}, err } defer passwd.Close() // Get the users. users, err := ParsePasswdFilter(passwd, filter) if err != nil { return User{}, err } // No user entries found. if len(users) == 0 { return User{}, fmt.Errorf("no matching entries in passwd file") } // Assume the first entry is the "correct" one. return users[0], nil } // CurrentUser looks up the current user by their user id in /etc/passwd. If the // user cannot be found (or there is no /etc/passwd file on the filesystem), // then CurrentUser returns an error. func CurrentUser() (User, error) { return LookupUid(syscall.Getuid()) } // LookupUser looks up a user by their username in /etc/passwd. If the user // cannot be found (or there is no /etc/passwd file on the filesystem), then // LookupUser returns an error. func LookupUser(username string) (User, error) { return lookupUser(func(u User) bool { return u.Name == username }) } // LookupUid looks up a user by their user id in /etc/passwd. If the user cannot // be found (or there is no /etc/passwd file on the filesystem), then LookupId // returns an error. func LookupUid(uid int) (User, error) { return lookupUser(func(u User) bool { return u.Uid == uid }) } func lookupGroup(filter func(g Group) bool) (Group, error) { // Get operating system-specific group reader-closer. group, err := GetGroup() if err != nil { return Group{}, err } defer group.Close() // Get the users. groups, err := ParseGroupFilter(group, filter) if err != nil { return Group{}, err } // No user entries found. if len(groups) == 0 { return Group{}, fmt.Errorf("no matching entries in group file") } // Assume the first entry is the "correct" one. return groups[0], nil } // CurrentGroup looks up the current user's group by their primary group id's // entry in /etc/passwd. If the group cannot be found (or there is no // /etc/group file on the filesystem), then CurrentGroup returns an error. func CurrentGroup() (Group, error) { return LookupGid(syscall.Getgid()) } // LookupGroup looks up a group by its name in /etc/group. If the group cannot // be found (or there is no /etc/group file on the filesystem), then LookupGroup // returns an error. func LookupGroup(groupname string) (Group, error) { return lookupGroup(func(g Group) bool { return g.Name == groupname }) } // LookupGid looks up a group by its group id in /etc/group. If the group cannot // be found (or there is no /etc/group file on the filesystem), then LookupGid // returns an error. func LookupGid(gid int) (Group, error) { return lookupGroup(func(g Group) bool { return g.Gid == gid }) }
{ "pile_set_name": "Github" }
""" Satchless An e-commerce framework for Python """ from . import process from . import item from . import cart __all__ = ['cart', 'item', 'process']
{ "pile_set_name": "Github" }
// // Author: Jeremy Goecks // // Modified from: // // Dalliance Genome Explorer // (c) Thomas Down 2006-2010 // // bigwig.js: indexed binary WIG (and BED) files // // Requirements: // * jquery and ajax-native plugin for reading binary data, jquery for promises // * spans for working working with genomic intervals // * jszlib for decompression. define(["libs/bbi/spans", "libs/bbi/jszlib", "libs/bbi/jquery-ajax-native"], function(spans, jszlib) { "use strict"; // -- Copied from das.js -- function DASFeature() { } function DASGroup(id) { if (id) this.id = id; } // -- End copy -- // -- Copied from bin.js -- function readInt(ba, offset) { return (ba[offset + 3] << 24) | (ba[offset + 2] << 16) | (ba[offset + 1] << 8) | (ba[offset]); } // -- End copy -- // Some globals. var Range = spans.Range; var union = spans.union; var intersection = spans.intersection; var jszlib_inflate_buffer = jszlib.inflateBuffer; var arrayCopy = jszlib.arrayCopy; var BIG_WIG_MAGIC = 0x888FFC26; var BIG_WIG_MAGIC_BE = 0x26FC8F88; var BIG_BED_MAGIC = 0x8789F2EB; var BIG_BED_MAGIC_BE = 0xEBF28987; var BIG_WIG_TYPE_GRAPH = 1; var BIG_WIG_TYPE_VSTEP = 2; var BIG_WIG_TYPE_FSTEP = 3; var M1 = 256; var M2 = 256*256; var M3 = 256*256*256; var M4 = 256*256*256*256; var BED_COLOR_REGEXP = new RegExp("^[0-9]+,[0-9]+,[0-9]+"); /** * Read binary data from a URL using HTTP Range header. Requires jQuery and ajax-native plugin. */ function read(url, start, size) { // Taken from bin.js: // This may be necessary for Safari: // if ((isSafari || this.opts.salt) && url.indexOf('?') < 0) { // url = url + '?salt=' + b64_sha1('' + Date.now() + ',' + (++seed)); // } var chunkSizeLimit = Math.pow(10, 6); // 1 MB if(size > chunkSizeLimit) { // TODO: raise error. } // Read data from remote file. return $.ajax({ type: 'GET', dataType: 'native', url: url, // Potential timeout on first request to catch mixed-content errors on Chromium. timeout: 5000, beforeSend: function(xhrObj) { // (size - 1) because range is inclusive. xhrObj.setRequestHeader("Range", "bytes=" + start + "-" + (start + (size - 1))); }, xhrFields: { responseType: 'arraybuffer' } }); } function bwg_readOffset(ba, o) { var offset = ba[o] + ba[o+1]*M1 + ba[o+2]*M2 + ba[o+3]*M3 + ba[o+4]*M4; return offset; } function BigWig() { } /** * Read the chromosome B+ tree header. */ BigWig.prototype.readChromTree = function() { var thisB = this; this.chromsToIDs = {}; this.idsToChroms = {}; this.maxID = 0; var udo = this.unzoomedDataOffset; var eb = (udo - this.chromTreeOffset) & 3; udo = udo + 4 - eb; // Read and parse the chrom tree, return the promise so that subsequent actions can be taken. return $.when(read(this.url, this.chromTreeOffset, udo - this.chromTreeOffset)).then(function(bpt) { var ba = new Uint8Array(bpt); var sa = new Int16Array(bpt); var la = new Int32Array(bpt); var bptMagic = la[0]; var blockSize = la[1]; var keySize = la[2]; var valSize = la[3]; var itemCount = bwg_readOffset(ba, 16); var rootNodeOffset = 32; var bptReadNode = function(offset) { var nodeType = ba[offset]; var cnt = sa[(offset/2) + 1]; offset += 4; for (var n = 0; n < cnt; ++n) { if (nodeType === 0) { offset += keySize; var childOffset = bwg_readOffset(ba, offset); offset += 8; childOffset -= thisB.chromTreeOffset; bptReadNode(childOffset); } else { var key = ''; for (var ki = 0; ki < keySize; ++ki) { var charCode = ba[offset++]; if (charCode !== 0) { key += String.fromCharCode(charCode); } } var chromId = (ba[offset+3]<<24) | (ba[offset+2]<<16) | (ba[offset+1]<<8) | (ba[offset+0]); var chromSize = (ba[offset + 7]<<24) | (ba[offset+6]<<16) | (ba[offset+5]<<8) | (ba[offset+4]); offset += 8; thisB.chromsToIDs[key] = chromId; if (key.indexOf('chr') === 0) { thisB.chromsToIDs[key.substr(3)] = chromId; } thisB.idsToChroms[chromId] = key; thisB.maxID = Math.max(thisB.maxID, chromId); } } }; bptReadNode(rootNodeOffset); }); } function BigWigView(bwg, cirTreeOffset, cirTreeLength, isSummary) { this.bwg = bwg; this.cirTreeOffset = cirTreeOffset; this.cirTreeLength = cirTreeLength; this.isSummary = isSummary; } BigWigView.prototype.readWigData = function(chrName, min, max) { var chr = this.bwg.chromsToIDs[chrName], rval; if (chr === undefined) { // Not an error because some .bwgs won't have data for all chromosomes. rval = []; } else { rval = this.readWigDataById(chr, min, max); } return rval; }; BigWigView.prototype.readWigDataById = function(chr, min, max) { var thisB = this, promise = $.Deferred(); // Read the R-tree index header and then read data again. if (!this.cirHeader) { $.when(read(thisB.bwg.url, this.cirTreeOffset, 48)).then(function(result) { thisB.cirHeader = result; var la = new Int32Array(thisB.cirHeader); thisB.cirBlockSize = la[1]; $.when(thisB.readWigDataById(chr, min, max)).then(function(result) { promise.resolve(result); }); }); return promise; } var blocksToFetch = []; var outstanding = 0; var beforeBWG = Date.now(); var filter = function(chromId, fmin, fmax, toks) { return ((chr < 0 || chromId == chr) && fmin <= max && fmax >= min); }; var cirFobRecur = function(offset, level) { if (thisB.bwg.instrument) console.log('level=' + level + '; offset=' + offset + '; time=' + (Date.now()|0)); outstanding += offset.length; if (offset.length == 1 && offset[0] - thisB.cirTreeOffset == 48 && thisB.cachedCirRoot) { cirFobRecur2(thisB.cachedCirRoot, 0, level); --outstanding; if (outstanding === 0) { $.when(thisB.fetchFeatures(filter, blocksToFetch)).then(function(result) { promise.resolve(result); }); } return; } var maxCirBlockSpan = 4 + (thisB.cirBlockSize * 32); // Upper bound on size, based on a completely full leaf node. var spans; for (var i = 0; i < offset.length; ++i) { var blockSpan = new Range(offset[i], offset[i] + maxCirBlockSpan); spans = spans ? union(spans, blockSpan) : blockSpan; } var fetchRanges = spans.ranges(); for (var r = 0; r < fetchRanges.length; ++r) { var fr = fetchRanges[r]; cirFobStartFetch(offset, fr, level); } }; var cirFobStartFetch = function(offset, fr, level, attempts) { var length = fr.max() - fr.min(); $.when(read(thisB.bwg.url, fr.min(), fr.max() - fr.min())).then(function(resultBuffer) { for (var i = 0; i < offset.length; ++i) { if (fr.contains(offset[i])) { cirFobRecur2(resultBuffer, offset[i] - fr.min(), level); if (offset[i] - thisB.cirTreeOffset == 48 && offset[i] - fr.min() === 0) thisB.cachedCirRoot = resultBuffer; --outstanding; if (outstanding === 0) { $.when(thisB.fetchFeatures(filter, blocksToFetch)).then(function(result) { promise.resolve(result); }); } } } }); }; var cirFobRecur2 = function(cirBlockData, offset, level) { var ba = new Uint8Array(cirBlockData); var sa = new Int16Array(cirBlockData); var la = new Int32Array(cirBlockData); var isLeaf = ba[offset]; var cnt = sa[offset/2 + 1]; offset += 4; if (isLeaf !== 0) { for (var i = 0; i < cnt; ++i) { var lo = offset/4; var startChrom = la[lo]; var startBase = la[lo + 1]; var endChrom = la[lo + 2]; var endBase = la[lo + 3]; var blockOffset = bwg_readOffset(ba, offset+16); var blockSize = bwg_readOffset(ba, offset+24); if (((chr < 0 || startChrom < chr) || (startChrom == chr && startBase <= max)) && ((chr < 0 || endChrom > chr) || (endChrom == chr && endBase >= min))) { blocksToFetch.push({offset: blockOffset, size: blockSize}); } offset += 32; } } else { var recurOffsets = []; for (var i = 0; i < cnt; ++i) { var lo = offset/4; var startChrom = la[lo]; var startBase = la[lo + 1]; var endChrom = la[lo + 2]; var endBase = la[lo + 3]; var blockOffset = bwg_readOffset(ba, offset+16); if ((chr < 0 || startChrom < chr || (startChrom == chr && startBase <= max)) && (chr < 0 || endChrom > chr || (endChrom == chr && endBase >= min))) { recurOffsets.push(blockOffset); } offset += 24; } if (recurOffsets.length > 0) { cirFobRecur(recurOffsets, level + 1); } } }; cirFobRecur([thisB.cirTreeOffset + 48], 1); return promise; }; /** * Fetch data for a set of blocks. Returns a promise that resolves to fetched data. */ BigWigView.prototype.fetchFeatures = function(filter, blocksToFetch) { var thisB = this, promise = $.Deferred(); blocksToFetch.sort(function(b0, b1) { return (b0.offset|0) - (b1.offset|0); }); if (blocksToFetch.length === 0) { return []; } else { var features = []; var createFeature = function(chr, fmin, fmax, opts) { if (!opts) { opts = {}; } var f = new DASFeature(); f._chromId = chr; f.segment = thisB.bwg.idsToChroms[chr]; f.min = fmin; f.max = fmax; f.type = thisB.bwg.type; for (var k in opts) { f[k] = opts[k]; } features.push(f); }; // Recursive function to read blocks of data. var tramp = function() { if (blocksToFetch.length === 0) { var afterBWG = Date.now(); // dlog('BWG fetch took ' + (afterBWG - beforeBWG) + 'ms'); return promise.resolve(features); } else { var block = blocksToFetch[0]; if (block.data) { thisB.parseFeatures(block.data, createFeature, filter); blocksToFetch.splice(0, 1); tramp(); } else { var fetchStart = block.offset; var fetchSize = block.size; var bi = 1; while (bi < blocksToFetch.length && blocksToFetch[bi].offset == (fetchStart + fetchSize)) { fetchSize += blocksToFetch[bi].size; ++bi; } $.when(read(thisB.bwg.url, fetchStart, fetchSize)).then(function(result) { var offset = 0; var bi = 0; while (offset < fetchSize) { var fb = blocksToFetch[bi]; var data; if (thisB.bwg.uncompressBufSize > 0) { data = jszlib_inflate_buffer(result, offset + 2, fb.size - 2); } else { var tmp = new Uint8Array(fb.size); // FIXME is this really the best we can do? arrayCopy(new Uint8Array(result, offset, fb.size), 0, tmp, 0, fb.size); data = tmp.buffer; } fb.data = data; offset += fb.size; ++bi; } tramp(); }); } } }; tramp(); } return promise; }; BigWigView.prototype.parseFeatures = function(data, createFeature, filter) { var ba = new Uint8Array(data); if (this.isSummary) { var sa = new Int16Array(data); var la = new Int32Array(data); var fa = new Float32Array(data); var itemCount = data.byteLength/32; for (var i = 0; i < itemCount; ++i) { var chromId = la[(i*8)]; var start = la[(i*8)+1]; var end = la[(i*8)+2]; var validCnt = la[(i*8)+3]; var minVal = fa[(i*8)+4]; var maxVal = fa[(i*8)+5]; var sumData = fa[(i*8)+6]; var sumSqData = fa[(i*8)+7]; if (filter(chromId, start + 1, end)) { var summaryOpts = {type: 'bigwig', score: sumData/validCnt, maxScore: maxVal}; if (this.bwg.type == 'bigbed') { summaryOpts.type = 'density'; } createFeature(chromId, start + 1, end, summaryOpts); } } } else if (this.bwg.type == 'bigwig') { var sa = new Int16Array(data); var la = new Int32Array(data); var fa = new Float32Array(data); var chromId = la[0]; var blockStart = la[1]; var blockEnd = la[2]; var itemStep = la[3]; var itemSpan = la[4]; var blockType = ba[20]; var itemCount = sa[11]; if (blockType == BIG_WIG_TYPE_FSTEP) { for (var i = 0; i < itemCount; ++i) { var score = fa[i + 6]; var fmin = blockStart + (i*itemStep) + 1, fmax = blockStart + (i*itemStep) + itemSpan; if (filter(chromId, fmin, fmax)) createFeature(chromId, fmin, fmax, {score: score}); } } else if (blockType == BIG_WIG_TYPE_VSTEP) { for (var i = 0; i < itemCount; ++i) { var start = la[(i*2) + 6] + 1; var end = start + itemSpan - 1; var score = fa[(i*2) + 7]; if (filter(chromId, start, end)) createFeature(chromId, start, end, {score: score}); } } else if (blockType == BIG_WIG_TYPE_GRAPH) { for (var i = 0; i < itemCount; ++i) { var start = la[(i*3) + 6] + 1; var end = la[(i*3) + 7]; var score = fa[(i*3) + 8]; if (start > end) { start = end; } if (filter(chromId, start, end)) createFeature(chromId, start, end, {score: score}); } } else { console.log('Currently not handling bwgType=' + blockType); } } else if (this.bwg.type == 'bigbed') { var offset = 0; var dfc = this.bwg.definedFieldCount; var schema = this.bwg.schema; while (offset < ba.length) { var chromId = (ba[offset+3]<<24) | (ba[offset+2]<<16) | (ba[offset+1]<<8) | (ba[offset+0]); var start = (ba[offset+7]<<24) | (ba[offset+6]<<16) | (ba[offset+5]<<8) | (ba[offset+4]); var end = (ba[offset+11]<<24) | (ba[offset+10]<<16) | (ba[offset+9]<<8) | (ba[offset+8]); offset += 12; var rest = ''; while (true) { var ch = ba[offset++]; if (ch != 0) { rest += String.fromCharCode(ch); } else { break; } } var featureOpts = {}; var bedColumns; if (rest.length > 0) { bedColumns = rest.split('\t'); } else { bedColumns = []; } if (bedColumns.length > 0 && dfc > 3) { featureOpts.label = bedColumns[0]; } if (bedColumns.length > 1 && dfc > 4) { var score = parseInt(bedColumns[1]); if (!isNaN(score)) featureOpts.score = score; } if (bedColumns.length > 2 && dfc > 5) { featureOpts.orientation = bedColumns[2]; } if (bedColumns.length > 5 && dfc > 8) { var color = bedColumns[5]; if (BED_COLOR_REGEXP.test(color)) { featureOpts.itemRgb = 'rgb(' + color + ')'; } } if (bedColumns.length > dfc-3 && schema) { for (var col = dfc - 3; col < bedColumns.length; ++col) { featureOpts[schema.fields[col+3].name] = bedColumns[col]; } } if (filter(chromId, start + 1, end, bedColumns)) { if (dfc < 12) { createFeature(chromId, start + 1, end, featureOpts); } else { // TODO: add block starts, sizes, thick start, thick end to feature. var thickStart = bedColumns[3]|0; var thickEnd = bedColumns[4]|0; var blockCount = bedColumns[6]|0; var blockSizes = bedColumns[7].split(','); var blockStarts = bedColumns[8].split(','); if (featureOpts.exonFrames) { var exonFrames = featureOpts.exonFrames.split(','); featureOpts.exonFrames = undefined; } featureOpts.type = 'transcript' var grp = new DASGroup(); for (var k in featureOpts) { grp[k] = featureOpts[k]; } grp.id = bedColumns[0]; grp.segment = this.bwg.idsToChroms[chromId]; grp.min = start + 1; grp.max = end; grp.notes = []; featureOpts.groups = [grp]; // Moving towards using bigGenePred model, but will // still support old Dalliance-style BED12+gene-name for the // foreseeable future. if (bedColumns.length > 9) { var geneId = featureOpts.geneName || bedColumns[9]; var geneName = geneId; if (bedColumns.length > 10) { geneName = bedColumns[10]; } if (featureOpts.geneName2) geneName = featureOpts.geneName2; var gg = $.extend({}, grp); gg.id = geneId; gg.label = geneName; gg.type = 'gene'; featureOpts.groups.push(gg); } var spanList = []; for (var b = 0; b < blockCount; ++b) { var bmin = (blockStarts[b]|0) + start; var bmax = bmin + (blockSizes[b]|0); var span = new Range(bmin, bmax); spanList.push(span); } var spans = union(spanList); var tsList = spans.ranges(); for (var s = 0; s < tsList.length; ++s) { var ts = tsList[s]; createFeature(chromId, ts.min() + 1, ts.max(), featureOpts); } if (thickEnd > thickStart) { var codingRegion = (featureOpts.orientation == '+') ? new Range(thickStart, thickEnd + 3) : new Range(thickStart - 3, thickEnd); // +/- 3 to account for stop codon var tl = intersection(spans, codingRegion); if (tl) { featureOpts.type = 'translation'; var tlList = tl.ranges(); var readingFrame = 0; var tlOffset = 0; while (tlList[0].min() > tsList[tlOffset].max()) tlOffset++; for (var s = 0; s < tlList.length; ++s) { // Record reading frame for every exon var index = s; if (featureOpts.orientation == '-') index = tlList.length - s - 1; var ts = tlList[index]; featureOpts.readframe = readingFrame; if (exonFrames) { var brf = parseInt(exonFrames[index + tlOffset]); if (typeof(brf) === 'number' && brf >= 0 && brf <= 2) { featureOpts.readframe = brf; featureOpts.readframeExplicit = true; } } var length = ts.max() - ts.min(); readingFrame = (readingFrame + length) % 3; createFeature(chromId, ts.min() + 1, ts.max(), featureOpts); } } } } } } } else { throw Error("Don't know what to do with " + this.bwg.type); } } // // nasty cut/paste, should roll back in! // BigWigView.prototype.getFirstAdjacent = function(chrName, pos, dir, callback) { var chr = this.bwg.chromsToIDs[chrName]; if (chr === undefined) { // Not an error because some .bwgs won't have data for all chromosomes. return callback([]); } else { this.getFirstAdjacentById(chr, pos, dir, callback); } } BigWigView.prototype.getFirstAdjacentById = function(chr, pos, dir, callback) { var thisB = this; if (!this.cirHeader) { this.bwg.data.slice(this.cirTreeOffset, 48).fetch(function(result) { thisB.cirHeader = result; var la = new Int32Array(thisB.cirHeader); thisB.cirBlockSize = la[1]; thisB.getFirstAdjacentById(chr, pos, dir, callback); }); return; } var blockToFetch = null; var bestBlockChr = -1; var bestBlockOffset = -1; var outstanding = 0; var beforeBWG = Date.now(); var cirFobRecur = function(offset, level) { outstanding += offset.length; var maxCirBlockSpan = 4 + (thisB.cirBlockSize * 32); // Upper bound on size, based on a completely full leaf node. var spans; for (var i = 0; i < offset.length; ++i) { var blockSpan = new Range(offset[i], offset[i] + maxCirBlockSpan); spans = spans ? union(spans, blockSpan) : blockSpan; } var fetchRanges = spans.ranges(); for (var r = 0; r < fetchRanges.length; ++r) { var fr = fetchRanges[r]; cirFobStartFetch(offset, fr, level); } } var cirFobStartFetch = function(offset, fr, level, attempts) { var length = fr.max() - fr.min(); thisB.bwg.data.slice(fr.min(), fr.max() - fr.min()).fetch(function(resultBuffer) { for (var i = 0; i < offset.length; ++i) { if (fr.contains(offset[i])) { cirFobRecur2(resultBuffer, offset[i] - fr.min(), level); --outstanding; if (outstanding == 0) { if (!blockToFetch) { if (dir > 0 && (chr != 0 || pos > 0)) { return thisB.getFirstAdjacentById(0, 0, dir, callback); } else if (dir < 0 && (chr != thisB.bwg.maxID || pos < 1000000000)) { return thisB.getFirstAdjacentById(thisB.bwg.maxID, 1000000000, dir, callback); } return callback([]); } thisB.fetchFeatures(function(chrx, fmin, fmax, toks) { return (dir < 0 && (chrx < chr || fmax < pos)) || (dir > 0 && (chrx > chr || fmin > pos)); }, [blockToFetch], function(features) { var bestFeature = null; var bestChr = -1; var bestPos = -1; for (var fi = 0; fi < features.length; ++fi) { var f = features[fi]; var chrx = f._chromId, fmin = f.min, fmax = f.max; if (bestFeature == null || ((dir < 0) && (chrx > bestChr || fmax > bestPos)) || ((dir > 0) && (chrx < bestChr || fmin < bestPos))) { bestFeature = f; bestPos = (dir < 0) ? fmax : fmin; bestChr = chrx; } } if (bestFeature != null) return callback([bestFeature]); else return callback([]); }); } } } }); } var cirFobRecur2 = function(cirBlockData, offset, level) { var ba = new Uint8Array(cirBlockData); var sa = new Int16Array(cirBlockData); var la = new Int32Array(cirBlockData); var isLeaf = ba[offset]; var cnt = sa[offset/2 + 1]; offset += 4; if (isLeaf != 0) { for (var i = 0; i < cnt; ++i) { var lo = offset/4; var startChrom = la[lo]; var startBase = la[lo + 1]; var endChrom = la[lo + 2]; var endBase = la[lo + 3]; var blockOffset = bwg_readOffset(ba, offset+16); var blockSize = bwg_readOffset(ba, offset+24); if ((dir < 0 && ((startChrom < chr || (startChrom == chr && startBase <= pos)))) || (dir > 0 && ((endChrom > chr || (endChrom == chr && endBase >= pos))))) { // console.log('Got an interesting block: startBase=' + startChrom + ':' + startBase + '; endBase=' + endChrom + ':' + endBase + '; offset=' + blockOffset + '; size=' + blockSize); if (/_random/.exec(thisB.bwg.idsToChroms[startChrom])) { // dlog('skipping random: ' + thisB.bwg.idsToChroms[startChrom]); } else if (blockToFetch == null || ((dir < 0) && (endChrom > bestBlockChr || (endChrom == bestBlockChr && endBase > bestBlockOffset)) || (dir > 0) && (startChrom < bestBlockChr || (startChrom == bestBlockChr && startBase < bestBlockOffset)))) { // dlog('best is: startBase=' + startChrom + ':' + startBase + '; endBase=' + endChrom + ':' + endBase + '; offset=' + blockOffset + '; size=' + blockSize); blockToFetch = {offset: blockOffset, size: blockSize}; bestBlockOffset = (dir < 0) ? endBase : startBase; bestBlockChr = (dir < 0) ? endChrom : startChrom; } } offset += 32; } } else { var bestRecur = -1; var bestPos = -1; var bestChr = -1; for (var i = 0; i < cnt; ++i) { var lo = offset/4; var startChrom = la[lo]; var startBase = la[lo + 1]; var endChrom = la[lo + 2]; var endBase = la[lo + 3]; var blockOffset = (la[lo + 4]<<32) | (la[lo + 5]); if ((dir < 0 && ((startChrom < chr || (startChrom == chr && startBase <= pos)) && (endChrom >= chr))) || (dir > 0 && ((endChrom > chr || (endChrom == chr && endBase >= pos)) && (startChrom <= chr)))) { if (bestRecur < 0 || endBase > bestPos) { bestRecur = blockOffset; bestPos = (dir < 0) ? endBase : startBase; bestChr = (dir < 0) ? endChrom : startChrom; } } offset += 24; } if (bestRecur >= 0) { cirFobRecur([bestRecur], level + 1); } } }; cirFobRecur([thisB.cirTreeOffset + 48], 1); } /** * Automatically choose a zoom level and return data from that level. */ BigWig.prototype.readWigData = function(chrName, min, max) { // Maximum number of data points to return when reading a bigwig. This is used // to choose the appropriate level. One data point ~= 25-65 bytes. // FIXME: For targeted sequencing, data points returned is going to be much lower, // so this will need to be tuned appropriately. var MAX_DATA_POINTS = 25000; var range = max - min, view; // If no zooming needed or available (common in bigbed), use unzoomed view. if (range <= MAX_DATA_POINTS || this.zoomLevels.length === 0) { view = this.getUnzoomedView(); } else { // Find reasonable zoom level. Reduction is the # of bases represented // by each data point at that level. for (var i = 0; i < this.zoomLevels.length; i++) { if (range/this.zoomLevels[i].reduction < MAX_DATA_POINTS) { view = this.getZoomedView(i); break; } } } return view.readWigData(chrName, min, max); } BigWig.prototype.getUnzoomedView = function() { if (!this.unzoomedView) { var cirLen = 4000; var nzl = this.zoomLevels[0]; if (nzl) { cirLen = this.zoomLevels[0].dataOffset - this.unzoomedIndexOffset; } this.unzoomedView = new BigWigView(this, this.unzoomedIndexOffset, cirLen, false); } return this.unzoomedView; } BigWig.prototype.getZoomedView = function(z) { var zh = this.zoomLevels[z]; if (!zh.view) { zh.view = new BigWigView(this, zh.indexOffset, /* this.zoomLevels[z + 1].dataOffset - zh.indexOffset */ 4000, true); } return zh.view; } /** * Create a BigWig object using a URL to a bigwig/bigbed file. Returns a promise * that resolves to the object when it's available. */ function makeBwg(url) { var promise = $.Deferred(), bwg = new BigWig(); bwg.url = url; // Read and parse bigwig header, including chrom tree. $.when(read(bwg.url, 0, 512)).then(function(result) { if (!result) { return promise.resolve(null, "Couldn't fetch file"); } var header = result; var ba = new Uint8Array(header); var sa = new Int16Array(header); var la = new Int32Array(header); var magic = ba[0] + (M1 * ba[1]) + (M2 * ba[2]) + (M3 * ba[3]); if (magic == BIG_WIG_MAGIC) { bwg.type = 'bigwig'; } else if (magic == BIG_BED_MAGIC) { bwg.type = 'bigbed'; } else if (magic == BIG_WIG_MAGIC_BE || magic == BIG_BED_MAGIC_BE) { return promise.resolve(null, "Currently don't support big-endian BBI files"); } else { return promise.resolve(null, "Not a supported format, magic=0x" + magic.toString(16)); } bwg.version = sa[2]; // 4 bwg.numZoomLevels = sa[3]; // 6 bwg.chromTreeOffset = bwg_readOffset(ba, 8); bwg.unzoomedDataOffset = bwg_readOffset(ba, 16); bwg.unzoomedIndexOffset = bwg_readOffset(ba, 24); bwg.fieldCount = sa[16]; // 32 bwg.definedFieldCount = sa[17]; // 34 bwg.asOffset = bwg_readOffset(ba, 36); bwg.totalSummaryOffset = bwg_readOffset(ba, 44); bwg.uncompressBufSize = la[13]; // 52 bwg.extHeaderOffset = bwg_readOffset(ba, 56); bwg.zoomLevels = []; for (var zl = 0; zl < bwg.numZoomLevels; ++zl) { var zlReduction = la[zl*6 + 16] var zlData = bwg_readOffset(ba, zl*24 + 72); var zlIndex = bwg_readOffset(ba, zl*24 + 80); bwg.zoomLevels.push({reduction: zlReduction, dataOffset: zlData, indexOffset: zlIndex}); } $.when(bwg.readChromTree()).then(function() { bwg.getAutoSQL(function(as) { bwg.schema = as; return promise.resolve(bwg); }); }); }); return promise; } BigWig.prototype._tsFetch = function(zoom, chr, min, max, callback) { var bwg = this; if (zoom >= this.zoomLevels.length - 1) { if (!this.topLevelReductionCache) { this.getZoomedView(this.zoomLevels.length - 1).readWigDataById(-1, 0, 300000000, function(feats) { bwg.topLevelReductionCache = feats; return bwg._tsFetch(zoom, chr, min, max, callback); }); } else { var f = []; var c = this.topLevelReductionCache; for (var fi = 0; fi < c.length; ++fi) { if (c[fi]._chromId == chr) { f.push(c[fi]); } } return callback(f); } } else { var view; if (zoom < 0) { view = this.getUnzoomedView(); } else { view = this.getZoomedView(zoom); } return view.readWigDataById(chr, min, max, callback); } } BigWig.prototype.thresholdSearch = function(chrName, referencePoint, dir, threshold, callback) { dir = (dir<0) ? -1 : 1; var bwg = this; var initialChr = this.chromsToIDs[chrName]; var candidates = [{chrOrd: 0, chr: initialChr, zoom: bwg.zoomLevels.length - 4, min: 0, max: 300000000, fromRef: true}] for (var i = 1; i <= this.maxID + 1; ++i) { var chrId = (initialChr + (dir*i)) % (this.maxID + 1); if (chrId < 0) chrId += (this.maxID + 1); candidates.push({chrOrd: i, chr: chrId, zoom: bwg.zoomLevels.length - 1, min: 0, max: 300000000}) } function fbThresholdSearchRecur() { if (candidates.length == 0) { return callback(null); } candidates.sort(function(c1, c2) { var d = c1.zoom - c2.zoom; if (d != 0) return d; d = c1.chrOrd - c2.chrOrd; if (d != 0) return d; else return c1.min - c2.min * dir; }); var candidate = candidates.splice(0, 1)[0]; bwg._tsFetch(candidate.zoom, candidate.chr, candidate.min, candidate.max, function(feats) { var rp = dir > 0 ? 0 : 300000000; if (candidate.fromRef) rp = referencePoint; for (var fi = 0; fi < feats.length; ++fi) { var f = feats[fi]; var score; if (f.maxScore != undefined) score = f.maxScore; else score = f.score; if (dir > 0) { if (score > threshold) { if (candidate.zoom < 0) { if (f.min > rp) return callback(f); } else if (f.max > rp) { candidates.push({chr: candidate.chr, chrOrd: candidate.chrOrd, zoom: candidate.zoom - 2, min: f.min, max: f.max, fromRef: candidate.fromRef}); } } } else { if (score > threshold) { if (candidate.zoom < 0) { if (f.max < rp) return callback(f); } else if (f.min < rp) { candidates.push({chr: candidate.chr, chrOrd: candidate.chrOrd, zoom: candidate.zoom - 2, min: f.min, max: f.max, fromRef: candidate.fromRef}); } } } } fbThresholdSearchRecur(); }); } fbThresholdSearchRecur(); } BigWig.prototype.getAutoSQL = function(callback) { var thisB = this; if (!this.asOffset) return callback(null); $.when(read(this.url, this.asOffset, 2048)).then(function(result) { var ba = new Uint8Array(result); var s = ''; for (var i = 0; i < ba.length; ++i) { if (ba[i] == 0) break; s += String.fromCharCode(ba[i]); } /* * Quick'n'dirty attempt to parse autoSql format. * See: http://www.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/059/5949/5949l2.html */ var header_re = /(\w+)\s+(\w+)\s+("([^"]+)")?\s+\(\s*/; var field_re = /([\w\[\]]+)\s+(\w+)\s*;\s*("([^"]+)")?\s*/g; var headerMatch = header_re.exec(s); if (headerMatch) { var as = { declType: headerMatch[1], name: headerMatch[2], comment: headerMatch[4], fields: [] }; s = s.substring(headerMatch[0]); for (var m = field_re.exec(s); m != null; m = field_re.exec(s)) { as.fields.push({type: m[1], name: m[2], comment: m[4]}); } return callback(as); } }); }; BigWig.prototype.getExtraIndices = function(callback) { var thisB = this; if (this.version < 4 || this.extHeaderOffset == 0 || this.type != 'bigbed') { return callback(null); } else { this.data.slice(this.extHeaderOffset, 64).fetch(function(result) { if (!result) { return callback(null, "Couldn't fetch extension header"); } var ba = new Uint8Array(result); var sa = new Int16Array(result); var la = new Int32Array(result); var extHeaderSize = sa[0]; var extraIndexCount = sa[1]; var extraIndexListOffset = bwg_readOffset(ba, 4); if (extraIndexCount == 0) { return callback(null); } // FIXME 20byte records only make sense for single-field indices. // Right now, these seem to be the only things around, but the format // is actually more general. thisB.data.slice(extraIndexListOffset, extraIndexCount * 20).fetch(function(eil) { if (!eil) { return callback(null, "Couldn't fetch index info"); } var ba = new Uint8Array(eil); var sa = new Int16Array(eil); var la = new Int32Array(eil); var indices = []; for (var ii = 0; ii < extraIndexCount; ++ii) { var eiType = sa[ii*10]; var eiFieldCount = sa[ii*10 + 1]; var eiOffset = bwg_readOffset(ba, ii*20 + 4); var eiField = sa[ii*10 + 8] var index = new BBIExtraIndex(thisB, eiType, eiFieldCount, eiOffset, eiField); indices.push(index); } callback(indices); }); }); } } function BBIExtraIndex(bbi, type, fieldCount, offset, field) { this.bbi = bbi; this.type = type; this.fieldCount = fieldCount; this.offset = offset; this.field = field; } BBIExtraIndex.prototype.lookup = function(name, callback) { var thisB = this; this.bbi.data.slice(this.offset, 32).fetch(function(bpt) { var ba = new Uint8Array(bpt); var sa = new Int16Array(bpt); var la = new Int32Array(bpt); var bptMagic = la[0]; var blockSize = la[1]; var keySize = la[2]; var valSize = la[3]; var itemCount = bwg_readOffset(ba, 16); var rootNodeOffset = 32; function bptReadNode(nodeOffset) { thisB.bbi.data.slice(nodeOffset, 4 + (blockSize * (keySize + valSize))).fetch(function(node) { var ba = new Uint8Array(node); var sa = new Uint16Array(node); var la = new Uint32Array(node); var nodeType = ba[0]; var cnt = sa[1]; var offset = 4; if (nodeType == 0) { var lastChildOffset = null; for (var n = 0; n < cnt; ++n) { var key = ''; for (var ki = 0; ki < keySize; ++ki) { var charCode = ba[offset++]; if (charCode != 0) { key += String.fromCharCode(charCode); } } var childOffset = bwg_readOffset(ba, offset); offset += 8; if (name.localeCompare(key) < 0 && lastChildOffset) { bptReadNode(lastChildOffset); return; } lastChildOffset = childOffset; } bptReadNode(lastChildOffset); } else { for (var n = 0; n < cnt; ++n) { var key = ''; for (var ki = 0; ki < keySize; ++ki) { var charCode = ba[offset++]; if (charCode != 0) { key += String.fromCharCode(charCode); } } // Specific for EI case. if (key == name) { var start = bwg_readOffset(ba, offset); var length = readInt(ba, offset + 8); return thisB.bbi.getUnzoomedView().fetchFeatures( function(chr, min, max, toks) { if (toks && toks.length > thisB.field - 3) return toks[thisB.field - 3] == name; }, [{offset: start, size: length}], callback); } offset += valSize; } return callback([]); } }); } bptReadNode(thisB.offset + rootNodeOffset); }); } return { makeBwg: makeBwg }; });
{ "pile_set_name": "Github" }
#include "arm-macros.h" TEST_BEGIN mov r1, #0xFFFFFFF8 mov r2, #7 cmp r2, #7 orreqs r1, r2 TEST_END
{ "pile_set_name": "Github" }
.splide { &__spinner { position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; display: inline-block; width: $spinner-size; height: $spinner-size; border-radius: 50%; border: 2px solid #999; border-left-color: transparent; animation: splide-loading 1s infinite linear; } }
{ "pile_set_name": "Github" }
#ifndef LM_BINARY_FORMAT_H #define LM_BINARY_FORMAT_H #include "lm/config.hh" #include "lm/model_type.hh" #include "lm/read_arpa.hh" #include "util/file_piece.hh" #include "util/mmap.hh" #include "util/scoped.hh" #include <cstddef> #include <vector> #include <stdint.h> namespace lm { namespace ngram { extern const char *kModelNames[6]; /*Inspect a file to determine if it is a binary lm. If not, return false. * If so, return true and set recognized to the type. This is the only API in * this header designed for use by decoder authors. */ bool RecognizeBinary(const char *file, ModelType &recognized); struct FixedWidthParameters { unsigned char order; float probing_multiplier; // What type of model is this? ModelType model_type; // Does the end of the file have the actual strings in the vocabulary? bool has_vocabulary; unsigned int search_version; }; // This is a macro instead of an inline function so constants can be assigned using it. #define ALIGN8(a) ((std::ptrdiff_t(((a)-1)/8)+1)*8) // Parameters stored in the header of a binary file. struct Parameters { FixedWidthParameters fixed; std::vector<uint64_t> counts; }; class BinaryFormat { public: explicit BinaryFormat(const Config &config); // Reading a binary file: // Takes ownership of fd void InitializeBinary(int fd, ModelType model_type, unsigned int search_version, Parameters &params); // Used to read parts of the file to update the config object before figuring out full size. void ReadForConfig(void *to, std::size_t amount, uint64_t offset_excluding_header) const; // Actually load the binary file and return a pointer to the beginning of the search area. void *LoadBinary(std::size_t size); uint64_t VocabStringReadingOffset() const { assert(vocab_string_offset_ != kInvalidOffset); return vocab_string_offset_; } // Writing a binary file or initializing in RAM from ARPA: // Size for vocabulary. void *SetupJustVocab(std::size_t memory_size, uint8_t order); // Warning: can change the vocaulary base pointer. void *GrowForSearch(std::size_t memory_size, std::size_t vocab_pad, void *&vocab_base); // Warning: can change vocabulary and search base addresses. void WriteVocabWords(const std::string &buffer, void *&vocab_base, void *&search_base); // Write the header at the beginning of the file. void FinishFile(const Config &config, ModelType model_type, unsigned int search_version, const std::vector<uint64_t> &counts); private: void MapFile(void *&vocab_base, void *&search_base); // Copied from configuration. const Config::WriteMethod write_method_; const char *write_mmap_; util::LoadMethod load_method_; // File behind memory, if any. util::scoped_fd file_; // If there is a file involved, a single mapping. util::scoped_memory mapping_; // If the data is only in memory, separately allocate each because the trie // knows vocab's size before it knows search's size (because SRILM might // have pruned). util::scoped_memory memory_vocab_, memory_search_; // Memory ranges. Note that these may not be contiguous and may not all // exist. std::size_t header_size_, vocab_size_, vocab_pad_; // aka end of search. uint64_t vocab_string_offset_; static const uint64_t kInvalidOffset = (uint64_t)-1; }; bool IsBinaryFormat(int fd); } // namespace ngram } // namespace lm #endif // LM_BINARY_FORMAT_H
{ "pile_set_name": "Github" }
// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,netbsd package unix const ( SYS_EXIT = 1 // { void|sys||exit(int rval); } SYS_FORK = 2 // { int|sys||fork(void); } SYS_READ = 3 // { ssize_t|sys||read(int fd, void *buf, size_t nbyte); } SYS_WRITE = 4 // { ssize_t|sys||write(int fd, const void *buf, size_t nbyte); } SYS_OPEN = 5 // { int|sys||open(const char *path, int flags, ... mode_t mode); } SYS_CLOSE = 6 // { int|sys||close(int fd); } SYS_LINK = 9 // { int|sys||link(const char *path, const char *link); } SYS_UNLINK = 10 // { int|sys||unlink(const char *path); } SYS_CHDIR = 12 // { int|sys||chdir(const char *path); } SYS_FCHDIR = 13 // { int|sys||fchdir(int fd); } SYS_CHMOD = 15 // { int|sys||chmod(const char *path, mode_t mode); } SYS_CHOWN = 16 // { int|sys||chown(const char *path, uid_t uid, gid_t gid); } SYS_BREAK = 17 // { int|sys||obreak(char *nsize); } SYS_GETPID = 20 // { pid_t|sys||getpid_with_ppid(void); } SYS_UNMOUNT = 22 // { int|sys||unmount(const char *path, int flags); } SYS_SETUID = 23 // { int|sys||setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t|sys||getuid_with_euid(void); } SYS_GETEUID = 25 // { uid_t|sys||geteuid(void); } SYS_PTRACE = 26 // { int|sys||ptrace(int req, pid_t pid, void *addr, int data); } SYS_RECVMSG = 27 // { ssize_t|sys||recvmsg(int s, struct msghdr *msg, int flags); } SYS_SENDMSG = 28 // { ssize_t|sys||sendmsg(int s, const struct msghdr *msg, int flags); } SYS_RECVFROM = 29 // { ssize_t|sys||recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } SYS_ACCEPT = 30 // { int|sys||accept(int s, struct sockaddr *name, socklen_t *anamelen); } SYS_GETPEERNAME = 31 // { int|sys||getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } SYS_GETSOCKNAME = 32 // { int|sys||getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } SYS_ACCESS = 33 // { int|sys||access(const char *path, int flags); } SYS_CHFLAGS = 34 // { int|sys||chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int|sys||fchflags(int fd, u_long flags); } SYS_SYNC = 36 // { void|sys||sync(void); } SYS_KILL = 37 // { int|sys||kill(pid_t pid, int signum); } SYS_GETPPID = 39 // { pid_t|sys||getppid(void); } SYS_DUP = 41 // { int|sys||dup(int fd); } SYS_PIPE = 42 // { int|sys||pipe(void); } SYS_GETEGID = 43 // { gid_t|sys||getegid(void); } SYS_PROFIL = 44 // { int|sys||profil(char *samples, size_t size, u_long offset, u_int scale); } SYS_KTRACE = 45 // { int|sys||ktrace(const char *fname, int ops, int facs, pid_t pid); } SYS_GETGID = 47 // { gid_t|sys||getgid_with_egid(void); } SYS___GETLOGIN = 49 // { int|sys||__getlogin(char *namebuf, size_t namelen); } SYS___SETLOGIN = 50 // { int|sys||__setlogin(const char *namebuf); } SYS_ACCT = 51 // { int|sys||acct(const char *path); } SYS_IOCTL = 54 // { int|sys||ioctl(int fd, u_long com, ... void *data); } SYS_REVOKE = 56 // { int|sys||revoke(const char *path); } SYS_SYMLINK = 57 // { int|sys||symlink(const char *path, const char *link); } SYS_READLINK = 58 // { ssize_t|sys||readlink(const char *path, char *buf, size_t count); } SYS_EXECVE = 59 // { int|sys||execve(const char *path, char * const *argp, char * const *envp); } SYS_UMASK = 60 // { mode_t|sys||umask(mode_t newmask); } SYS_CHROOT = 61 // { int|sys||chroot(const char *path); } SYS_VFORK = 66 // { int|sys||vfork(void); } SYS_SBRK = 69 // { int|sys||sbrk(intptr_t incr); } SYS_SSTK = 70 // { int|sys||sstk(int incr); } SYS_VADVISE = 72 // { int|sys||ovadvise(int anom); } SYS_MUNMAP = 73 // { int|sys||munmap(void *addr, size_t len); } SYS_MPROTECT = 74 // { int|sys||mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int|sys||madvise(void *addr, size_t len, int behav); } SYS_MINCORE = 78 // { int|sys||mincore(void *addr, size_t len, char *vec); } SYS_GETGROUPS = 79 // { int|sys||getgroups(int gidsetsize, gid_t *gidset); } SYS_SETGROUPS = 80 // { int|sys||setgroups(int gidsetsize, const gid_t *gidset); } SYS_GETPGRP = 81 // { int|sys||getpgrp(void); } SYS_SETPGID = 82 // { int|sys||setpgid(pid_t pid, pid_t pgid); } SYS_DUP2 = 90 // { int|sys||dup2(int from, int to); } SYS_FCNTL = 92 // { int|sys||fcntl(int fd, int cmd, ... void *arg); } SYS_FSYNC = 95 // { int|sys||fsync(int fd); } SYS_SETPRIORITY = 96 // { int|sys||setpriority(int which, id_t who, int prio); } SYS_CONNECT = 98 // { int|sys||connect(int s, const struct sockaddr *name, socklen_t namelen); } SYS_GETPRIORITY = 100 // { int|sys||getpriority(int which, id_t who); } SYS_BIND = 104 // { int|sys||bind(int s, const struct sockaddr *name, socklen_t namelen); } SYS_SETSOCKOPT = 105 // { int|sys||setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } SYS_LISTEN = 106 // { int|sys||listen(int s, int backlog); } SYS_GETSOCKOPT = 118 // { int|sys||getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } SYS_READV = 120 // { ssize_t|sys||readv(int fd, const struct iovec *iovp, int iovcnt); } SYS_WRITEV = 121 // { ssize_t|sys||writev(int fd, const struct iovec *iovp, int iovcnt); } SYS_FCHOWN = 123 // { int|sys||fchown(int fd, uid_t uid, gid_t gid); } SYS_FCHMOD = 124 // { int|sys||fchmod(int fd, mode_t mode); } SYS_SETREUID = 126 // { int|sys||setreuid(uid_t ruid, uid_t euid); } SYS_SETREGID = 127 // { int|sys||setregid(gid_t rgid, gid_t egid); } SYS_RENAME = 128 // { int|sys||rename(const char *from, const char *to); } SYS_FLOCK = 131 // { int|sys||flock(int fd, int how); } SYS_MKFIFO = 132 // { int|sys||mkfifo(const char *path, mode_t mode); } SYS_SENDTO = 133 // { ssize_t|sys||sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } SYS_SHUTDOWN = 134 // { int|sys||shutdown(int s, int how); } SYS_SOCKETPAIR = 135 // { int|sys||socketpair(int domain, int type, int protocol, int *rsv); } SYS_MKDIR = 136 // { int|sys||mkdir(const char *path, mode_t mode); } SYS_RMDIR = 137 // { int|sys||rmdir(const char *path); } SYS_SETSID = 147 // { int|sys||setsid(void); } SYS_SYSARCH = 165 // { int|sys||sysarch(int op, void *parms); } SYS_PREAD = 173 // { ssize_t|sys||pread(int fd, void *buf, size_t nbyte, int PAD, off_t offset); } SYS_PWRITE = 174 // { ssize_t|sys||pwrite(int fd, const void *buf, size_t nbyte, int PAD, off_t offset); } SYS_NTP_ADJTIME = 176 // { int|sys||ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int|sys||setgid(gid_t gid); } SYS_SETEGID = 182 // { int|sys||setegid(gid_t egid); } SYS_SETEUID = 183 // { int|sys||seteuid(uid_t euid); } SYS_PATHCONF = 191 // { long|sys||pathconf(const char *path, int name); } SYS_FPATHCONF = 192 // { long|sys||fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int|sys||getrlimit(int which, struct rlimit *rlp); } SYS_SETRLIMIT = 195 // { int|sys||setrlimit(int which, const struct rlimit *rlp); } SYS_MMAP = 197 // { void *|sys||mmap(void *addr, size_t len, int prot, int flags, int fd, long PAD, off_t pos); } SYS_LSEEK = 199 // { off_t|sys||lseek(int fd, int PAD, off_t offset, int whence); } SYS_TRUNCATE = 200 // { int|sys||truncate(const char *path, int PAD, off_t length); } SYS_FTRUNCATE = 201 // { int|sys||ftruncate(int fd, int PAD, off_t length); } SYS___SYSCTL = 202 // { int|sys||__sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, const void *new, size_t newlen); } SYS_MLOCK = 203 // { int|sys||mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int|sys||munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int|sys||undelete(const char *path); } SYS_GETPGID = 207 // { pid_t|sys||getpgid(pid_t pid); } SYS_REBOOT = 208 // { int|sys||reboot(int opt, char *bootstr); } SYS_POLL = 209 // { int|sys||poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_SEMGET = 221 // { int|sys||semget(key_t key, int nsems, int semflg); } SYS_SEMOP = 222 // { int|sys||semop(int semid, struct sembuf *sops, size_t nsops); } SYS_SEMCONFIG = 223 // { int|sys||semconfig(int flag); } SYS_MSGGET = 225 // { int|sys||msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int|sys||msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } SYS_MSGRCV = 227 // { ssize_t|sys||msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } SYS_SHMAT = 228 // { void *|sys||shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int|sys||shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int|sys||shmget(key_t key, size_t size, int shmflg); } SYS_TIMER_CREATE = 235 // { int|sys||timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid); } SYS_TIMER_DELETE = 236 // { int|sys||timer_delete(timer_t timerid); } SYS_TIMER_GETOVERRUN = 239 // { int|sys||timer_getoverrun(timer_t timerid); } SYS_FDATASYNC = 241 // { int|sys||fdatasync(int fd); } SYS_MLOCKALL = 242 // { int|sys||mlockall(int flags); } SYS_MUNLOCKALL = 243 // { int|sys||munlockall(void); } SYS_SIGQUEUEINFO = 245 // { int|sys||sigqueueinfo(pid_t pid, const siginfo_t *info); } SYS_MODCTL = 246 // { int|sys||modctl(int cmd, void *arg); } SYS___POSIX_RENAME = 270 // { int|sys||__posix_rename(const char *from, const char *to); } SYS_SWAPCTL = 271 // { int|sys||swapctl(int cmd, void *arg, int misc); } SYS_MINHERIT = 273 // { int|sys||minherit(void *addr, size_t len, int inherit); } SYS_LCHMOD = 274 // { int|sys||lchmod(const char *path, mode_t mode); } SYS_LCHOWN = 275 // { int|sys||lchown(const char *path, uid_t uid, gid_t gid); } SYS_MSYNC = 277 // { int|sys|13|msync(void *addr, size_t len, int flags); } SYS___POSIX_CHOWN = 283 // { int|sys||__posix_chown(const char *path, uid_t uid, gid_t gid); } SYS___POSIX_FCHOWN = 284 // { int|sys||__posix_fchown(int fd, uid_t uid, gid_t gid); } SYS___POSIX_LCHOWN = 285 // { int|sys||__posix_lchown(const char *path, uid_t uid, gid_t gid); } SYS_GETSID = 286 // { pid_t|sys||getsid(pid_t pid); } SYS___CLONE = 287 // { pid_t|sys||__clone(int flags, void *stack); } SYS_FKTRACE = 288 // { int|sys||fktrace(int fd, int ops, int facs, pid_t pid); } SYS_PREADV = 289 // { ssize_t|sys||preadv(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } SYS_PWRITEV = 290 // { ssize_t|sys||pwritev(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } SYS___GETCWD = 296 // { int|sys||__getcwd(char *bufp, size_t length); } SYS_FCHROOT = 297 // { int|sys||fchroot(int fd); } SYS_LCHFLAGS = 304 // { int|sys||lchflags(const char *path, u_long flags); } SYS_ISSETUGID = 305 // { int|sys||issetugid(void); } SYS_UTRACE = 306 // { int|sys||utrace(const char *label, void *addr, size_t len); } SYS_GETCONTEXT = 307 // { int|sys||getcontext(struct __ucontext *ucp); } SYS_SETCONTEXT = 308 // { int|sys||setcontext(const struct __ucontext *ucp); } SYS__LWP_CREATE = 309 // { int|sys||_lwp_create(const struct __ucontext *ucp, u_long flags, lwpid_t *new_lwp); } SYS__LWP_EXIT = 310 // { int|sys||_lwp_exit(void); } SYS__LWP_SELF = 311 // { lwpid_t|sys||_lwp_self(void); } SYS__LWP_WAIT = 312 // { int|sys||_lwp_wait(lwpid_t wait_for, lwpid_t *departed); } SYS__LWP_SUSPEND = 313 // { int|sys||_lwp_suspend(lwpid_t target); } SYS__LWP_CONTINUE = 314 // { int|sys||_lwp_continue(lwpid_t target); } SYS__LWP_WAKEUP = 315 // { int|sys||_lwp_wakeup(lwpid_t target); } SYS__LWP_GETPRIVATE = 316 // { void *|sys||_lwp_getprivate(void); } SYS__LWP_SETPRIVATE = 317 // { void|sys||_lwp_setprivate(void *ptr); } SYS__LWP_KILL = 318 // { int|sys||_lwp_kill(lwpid_t target, int signo); } SYS__LWP_DETACH = 319 // { int|sys||_lwp_detach(lwpid_t target); } SYS__LWP_UNPARK = 321 // { int|sys||_lwp_unpark(lwpid_t target, const void *hint); } SYS__LWP_UNPARK_ALL = 322 // { ssize_t|sys||_lwp_unpark_all(const lwpid_t *targets, size_t ntargets, const void *hint); } SYS__LWP_SETNAME = 323 // { int|sys||_lwp_setname(lwpid_t target, const char *name); } SYS__LWP_GETNAME = 324 // { int|sys||_lwp_getname(lwpid_t target, char *name, size_t len); } SYS__LWP_CTL = 325 // { int|sys||_lwp_ctl(int features, struct lwpctl **address); } SYS___SIGACTION_SIGTRAMP = 340 // { int|sys||__sigaction_sigtramp(int signum, const struct sigaction *nsa, struct sigaction *osa, const void *tramp, int vers); } SYS_PMC_GET_INFO = 341 // { int|sys||pmc_get_info(int ctr, int op, void *args); } SYS_PMC_CONTROL = 342 // { int|sys||pmc_control(int ctr, int op, void *args); } SYS_RASCTL = 343 // { int|sys||rasctl(void *addr, size_t len, int op); } SYS_KQUEUE = 344 // { int|sys||kqueue(void); } SYS__SCHED_SETPARAM = 346 // { int|sys||_sched_setparam(pid_t pid, lwpid_t lid, int policy, const struct sched_param *params); } SYS__SCHED_GETPARAM = 347 // { int|sys||_sched_getparam(pid_t pid, lwpid_t lid, int *policy, struct sched_param *params); } SYS__SCHED_SETAFFINITY = 348 // { int|sys||_sched_setaffinity(pid_t pid, lwpid_t lid, size_t size, const cpuset_t *cpuset); } SYS__SCHED_GETAFFINITY = 349 // { int|sys||_sched_getaffinity(pid_t pid, lwpid_t lid, size_t size, cpuset_t *cpuset); } SYS_SCHED_YIELD = 350 // { int|sys||sched_yield(void); } SYS_FSYNC_RANGE = 354 // { int|sys||fsync_range(int fd, int flags, off_t start, off_t length); } SYS_UUIDGEN = 355 // { int|sys||uuidgen(struct uuid *store, int count); } SYS_GETVFSSTAT = 356 // { int|sys||getvfsstat(struct statvfs *buf, size_t bufsize, int flags); } SYS_STATVFS1 = 357 // { int|sys||statvfs1(const char *path, struct statvfs *buf, int flags); } SYS_FSTATVFS1 = 358 // { int|sys||fstatvfs1(int fd, struct statvfs *buf, int flags); } SYS_EXTATTRCTL = 360 // { int|sys||extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } SYS_EXTATTR_SET_FILE = 361 // { int|sys||extattr_set_file(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } SYS_EXTATTR_GET_FILE = 362 // { ssize_t|sys||extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 363 // { int|sys||extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } SYS_EXTATTR_SET_FD = 364 // { int|sys||extattr_set_fd(int fd, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } SYS_EXTATTR_GET_FD = 365 // { ssize_t|sys||extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FD = 366 // { int|sys||extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } SYS_EXTATTR_SET_LINK = 367 // { int|sys||extattr_set_link(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } SYS_EXTATTR_GET_LINK = 368 // { ssize_t|sys||extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_LINK = 369 // { int|sys||extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } SYS_EXTATTR_LIST_FD = 370 // { ssize_t|sys||extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_FILE = 371 // { ssize_t|sys||extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_LINK = 372 // { ssize_t|sys||extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_SETXATTR = 375 // { int|sys||setxattr(const char *path, const char *name, const void *value, size_t size, int flags); } SYS_LSETXATTR = 376 // { int|sys||lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags); } SYS_FSETXATTR = 377 // { int|sys||fsetxattr(int fd, const char *name, const void *value, size_t size, int flags); } SYS_GETXATTR = 378 // { int|sys||getxattr(const char *path, const char *name, void *value, size_t size); } SYS_LGETXATTR = 379 // { int|sys||lgetxattr(const char *path, const char *name, void *value, size_t size); } SYS_FGETXATTR = 380 // { int|sys||fgetxattr(int fd, const char *name, void *value, size_t size); } SYS_LISTXATTR = 381 // { int|sys||listxattr(const char *path, char *list, size_t size); } SYS_LLISTXATTR = 382 // { int|sys||llistxattr(const char *path, char *list, size_t size); } SYS_FLISTXATTR = 383 // { int|sys||flistxattr(int fd, char *list, size_t size); } SYS_REMOVEXATTR = 384 // { int|sys||removexattr(const char *path, const char *name); } SYS_LREMOVEXATTR = 385 // { int|sys||lremovexattr(const char *path, const char *name); } SYS_FREMOVEXATTR = 386 // { int|sys||fremovexattr(int fd, const char *name); } SYS_GETDENTS = 390 // { int|sys|30|getdents(int fd, char *buf, size_t count); } SYS_SOCKET = 394 // { int|sys|30|socket(int domain, int type, int protocol); } SYS_GETFH = 395 // { int|sys|30|getfh(const char *fname, void *fhp, size_t *fh_size); } SYS_MOUNT = 410 // { int|sys|50|mount(const char *type, const char *path, int flags, void *data, size_t data_len); } SYS_MREMAP = 411 // { void *|sys||mremap(void *old_address, size_t old_size, void *new_address, size_t new_size, int flags); } SYS_PSET_CREATE = 412 // { int|sys||pset_create(psetid_t *psid); } SYS_PSET_DESTROY = 413 // { int|sys||pset_destroy(psetid_t psid); } SYS_PSET_ASSIGN = 414 // { int|sys||pset_assign(psetid_t psid, cpuid_t cpuid, psetid_t *opsid); } SYS__PSET_BIND = 415 // { int|sys||_pset_bind(idtype_t idtype, id_t first_id, id_t second_id, psetid_t psid, psetid_t *opsid); } SYS_POSIX_FADVISE = 416 // { int|sys|50|posix_fadvise(int fd, int PAD, off_t offset, off_t len, int advice); } SYS_SELECT = 417 // { int|sys|50|select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } SYS_GETTIMEOFDAY = 418 // { int|sys|50|gettimeofday(struct timeval *tp, void *tzp); } SYS_SETTIMEOFDAY = 419 // { int|sys|50|settimeofday(const struct timeval *tv, const void *tzp); } SYS_UTIMES = 420 // { int|sys|50|utimes(const char *path, const struct timeval *tptr); } SYS_ADJTIME = 421 // { int|sys|50|adjtime(const struct timeval *delta, struct timeval *olddelta); } SYS_FUTIMES = 423 // { int|sys|50|futimes(int fd, const struct timeval *tptr); } SYS_LUTIMES = 424 // { int|sys|50|lutimes(const char *path, const struct timeval *tptr); } SYS_SETITIMER = 425 // { int|sys|50|setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } SYS_GETITIMER = 426 // { int|sys|50|getitimer(int which, struct itimerval *itv); } SYS_CLOCK_GETTIME = 427 // { int|sys|50|clock_gettime(clockid_t clock_id, struct timespec *tp); } SYS_CLOCK_SETTIME = 428 // { int|sys|50|clock_settime(clockid_t clock_id, const struct timespec *tp); } SYS_CLOCK_GETRES = 429 // { int|sys|50|clock_getres(clockid_t clock_id, struct timespec *tp); } SYS_NANOSLEEP = 430 // { int|sys|50|nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS___SIGTIMEDWAIT = 431 // { int|sys|50|__sigtimedwait(const sigset_t *set, siginfo_t *info, struct timespec *timeout); } SYS__LWP_PARK = 434 // { int|sys|50|_lwp_park(const struct timespec *ts, lwpid_t unpark, const void *hint, const void *unparkhint); } SYS_KEVENT = 435 // { int|sys|50|kevent(int fd, const struct kevent *changelist, size_t nchanges, struct kevent *eventlist, size_t nevents, const struct timespec *timeout); } SYS_PSELECT = 436 // { int|sys|50|pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } SYS_POLLTS = 437 // { int|sys|50|pollts(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } SYS_STAT = 439 // { int|sys|50|stat(const char *path, struct stat *ub); } SYS_FSTAT = 440 // { int|sys|50|fstat(int fd, struct stat *sb); } SYS_LSTAT = 441 // { int|sys|50|lstat(const char *path, struct stat *ub); } SYS___SEMCTL = 442 // { int|sys|50|__semctl(int semid, int semnum, int cmd, ... union __semun *arg); } SYS_SHMCTL = 443 // { int|sys|50|shmctl(int shmid, int cmd, struct shmid_ds *buf); } SYS_MSGCTL = 444 // { int|sys|50|msgctl(int msqid, int cmd, struct msqid_ds *buf); } SYS_GETRUSAGE = 445 // { int|sys|50|getrusage(int who, struct rusage *rusage); } SYS_TIMER_SETTIME = 446 // { int|sys|50|timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } SYS_TIMER_GETTIME = 447 // { int|sys|50|timer_gettime(timer_t timerid, struct itimerspec *value); } SYS_NTP_GETTIME = 448 // { int|sys|50|ntp_gettime(struct ntptimeval *ntvp); } SYS_WAIT4 = 449 // { int|sys|50|wait4(pid_t pid, int *status, int options, struct rusage *rusage); } SYS_MKNOD = 450 // { int|sys|50|mknod(const char *path, mode_t mode, dev_t dev); } SYS_FHSTAT = 451 // { int|sys|50|fhstat(const void *fhp, size_t fh_size, struct stat *sb); } SYS_PIPE2 = 453 // { int|sys||pipe2(int *fildes, int flags); } SYS_DUP3 = 454 // { int|sys||dup3(int from, int to, int flags); } SYS_KQUEUE1 = 455 // { int|sys||kqueue1(int flags); } SYS_PACCEPT = 456 // { int|sys||paccept(int s, struct sockaddr *name, socklen_t *anamelen, const sigset_t *mask, int flags); } SYS_LINKAT = 457 // { int|sys||linkat(int fd1, const char *name1, int fd2, const char *name2, int flags); } SYS_RENAMEAT = 458 // { int|sys||renameat(int fromfd, const char *from, int tofd, const char *to); } SYS_MKFIFOAT = 459 // { int|sys||mkfifoat(int fd, const char *path, mode_t mode); } SYS_MKNODAT = 460 // { int|sys||mknodat(int fd, const char *path, mode_t mode, uint32_t dev); } SYS_MKDIRAT = 461 // { int|sys||mkdirat(int fd, const char *path, mode_t mode); } SYS_FACCESSAT = 462 // { int|sys||faccessat(int fd, const char *path, int amode, int flag); } SYS_FCHMODAT = 463 // { int|sys||fchmodat(int fd, const char *path, mode_t mode, int flag); } SYS_FCHOWNAT = 464 // { int|sys||fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); } SYS_FEXECVE = 465 // { int|sys||fexecve(int fd, char * const *argp, char * const *envp); } SYS_FSTATAT = 466 // { int|sys||fstatat(int fd, const char *path, struct stat *buf, int flag); } SYS_UTIMENSAT = 467 // { int|sys||utimensat(int fd, const char *path, const struct timespec *tptr, int flag); } SYS_OPENAT = 468 // { int|sys||openat(int fd, const char *path, int oflags, ... mode_t mode); } SYS_READLINKAT = 469 // { int|sys||readlinkat(int fd, const char *path, char *buf, size_t bufsize); } SYS_SYMLINKAT = 470 // { int|sys||symlinkat(const char *path1, int fd, const char *path2); } SYS_UNLINKAT = 471 // { int|sys||unlinkat(int fd, const char *path, int flag); } SYS_FUTIMENS = 472 // { int|sys||futimens(int fd, const struct timespec *tptr); } SYS___QUOTACTL = 473 // { int|sys||__quotactl(const char *path, struct quotactl_args *args); } SYS_POSIX_SPAWN = 474 // { int|sys||posix_spawn(pid_t *pid, const char *path, const struct posix_spawn_file_actions *file_actions, const struct posix_spawnattr *attrp, char *const *argv, char *const *envp); } SYS_RECVMMSG = 475 // { int|sys||recvmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout); } SYS_SENDMMSG = 476 // { int|sys||sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags); } )
{ "pile_set_name": "Github" }
{ "jsonSchemaSemanticVersion": "1.0.0", "imports": [ { "corpusPath": "cdm:/foundations.cdm.json" }, { "corpusPath": "/core/operationsCommon/Common.cdm.json", "moniker": "base_Common" }, { "corpusPath": "/core/operationsCommon/DataEntityView.cdm.json", "moniker": "base_DataEntityView" }, { "corpusPath": "/core/operationsCommon/Tables/Common/GAB/Main/DirPerson.cdm.json" }, { "corpusPath": "/core/operationsCommon/Tables/Finance/Ledger/Main/CompanyInfo.cdm.json" } ], "definitions": [ { "entityName": "SalesUserFrequentPersonList", "extendsEntity": "base_Common/Common", "exhibitsTraits": [ { "traitReference": "is.CDM.entityVersion", "arguments": [ { "name": "versionNumber", "value": "1.1" } ] } ], "hasAttributes": [ { "name": "User", "dataType": "UserId", "isNullable": true, "description": "" }, { "name": "Person", "dataType": "DirPersonRecId", "isNullable": true, "description": "" }, { "name": "DataAreaId", "dataType": "string", "isReadOnly": true }, { "entity": { "entityReference": "DirPerson" }, "name": "Relationship_DirPersonRelationship", "resolutionGuidance": { "entityByReference": { "allowReference": true } } }, { "entity": { "entityReference": "CompanyInfo" }, "name": "Relationship_CompanyRelationship", "resolutionGuidance": { "entityByReference": { "allowReference": true } } } ], "displayName": "Favorite contacts" }, { "dataTypeName": "UserId", "extendsDataType": "string" }, { "dataTypeName": "DirPersonRecId", "extendsDataType": "bigInteger" } ] }
{ "pile_set_name": "Github" }
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Catalog\Test\Unit\Controller\Adminhtml\Product; use Magento\Backend\App\Action\Context; use Magento\Catalog\Controller\Adminhtml\Product\Attribute; use Magento\Framework\App\RequestInterface; use Magento\Framework\Cache\FrontendInterface; use Magento\Framework\Message\ManagerInterface; use Magento\Framework\ObjectManager\ObjectManager; use Magento\Framework\Registry; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Framework\View\Result\PageFactory; use Magento\Framework\Controller\ResultFactory; /** * Class AttributeTest */ class AttributeTest extends \PHPUnit\Framework\TestCase { /** * @var ObjectManagerHelper */ protected $objectManager; /** * @var Context|\PHPUnit_Framework_MockObject_MockObject */ protected $contextMock; /** * @var Registry|\PHPUnit_Framework_MockObject_MockObject */ protected $coreRegistryMock; /** * @var FrontendInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $attributeLabelCacheMock; /** * @var PageFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $resultPageFactoryMock; /** * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $requestMock; /** * @var ResultFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $resultFactoryMock; /** * @var ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $messageManager; protected function setUp() { $this->objectManager = new ObjectManagerHelper($this); $this->contextMock = $this->getMockBuilder(Context::class) ->disableOriginalConstructor() ->getMock(); $this->attributeLabelCacheMock = $this->getMockBuilder(FrontendInterface::class) ->getMockForAbstractClass(); $this->coreRegistryMock = $this->getMockBuilder(Registry::class) ->disableOriginalConstructor() ->getMock(); $this->resultPageFactoryMock = $this->getMockBuilder(PageFactory::class) ->disableOriginalConstructor() ->getMock(); $this->requestMock = $this->getMockBuilder(RequestInterface::class) ->setMethods(['getPostValue', 'has']) ->getMockForAbstractClass(); $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) ->disableOriginalConstructor() ->getMock(); $this->messageManager = $this->getMockBuilder(ManagerInterface::class) ->disableOriginalConstructor() ->getMock(); $this->contextMock->expects($this->any()) ->method('getRequest') ->willReturn($this->requestMock); $this->contextMock->expects($this->any()) ->method('getResultFactory') ->willReturn($this->resultFactoryMock); $this->contextMock ->method('getMessageManager') ->willReturn($this->messageManager); } /** * @return Attribute */ protected function getModel() { return $this->objectManager->getObject(Attribute::class, [ 'context' => $this->contextMock, 'attributeLabelCache' => $this->attributeLabelCacheMock, 'coreRegistry' => $this->coreRegistryMock, 'resultPageFactory' => $this->resultPageFactoryMock, ]); } public function testDispatch() { $this->markTestSkipped('Should be dispatched in parent'); } }
{ "pile_set_name": "Github" }
<h2>DESCRIPTION</h2> <em>r.colors.stddev</em> set raster map color rules based on standard deviations from a map's mean value, either as a continuous color gradient or in color bands per standard deviation (S.D.) from the mean. <p>With the color band option values less that 1 S.D. from the mean are colored green, within 1-2 S.D. are colored yellow, within 2-3 S.D. are colored red, and beyond 3 S.D. are colored black. <p>For a differences map there is an option to lock the center of the color table at zero. Values more than two S.D. below the mean will be colored blue; values below the mean but less than 2 S.D. away will transition to white, and above the mean the colors will simularly transition to full red at +2 S.D. <h2>EXAMPLE</h2> North Carolina sample dataset location: <div class="code"><pre> g.region raster=elevation -p r.colors.stddev elevation </pre></div> <h2>SEE ALSO</h2> <em> <a href="r.colors.html">r.colors</a>, <a href="r.univar.html">r.univar</a>, <a href="v.colors.html">v.colors</a> </em> <h2>AUTHOR</h2> Hamish Bowman, <i>Dunedin, New Zealand</i> <!-- <p> <i>Last changed: $Date$</i> -->
{ "pile_set_name": "Github" }
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: gdal_create testing # Author: Even Rouault <even dot rouault @ spatialys.com> # ############################################################################### # Copyright (c) 2020, Even Rouault <even dot rouault at spatialys.com> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. ############################################################################### import os from osgeo import gdal import gdaltest import test_cli_utilities import pytest def get_gdal_create_path(): return test_cli_utilities.get_cli_utility_path('gdal_create') ############################################################################### def test_gdal_create_pdf_tif(): if get_gdal_create_path() is None: pytest.skip() (_, err) = gdaltest.runexternal_out_and_err(get_gdal_create_path() + ' tmp/tmp.tif -bands 3 -outsize 1 2 -a_srs EPSG:4326 -a_ullr 2 50 3 49 -a_nodata 5 -burn 1 2 -ot UInt16 -co COMPRESS=DEFLATE -mo FOO=BAR') assert (err is None or err == ''), 'got error/warning' ds = gdal.Open('tmp/tmp.tif') assert ds.RasterCount == 3 assert ds.RasterXSize == 1 assert ds.RasterYSize == 2 assert ds.GetRasterBand(1).DataType == gdal.GDT_UInt16 assert ds.GetRasterBand(1).GetNoDataValue() == 5 assert '4326' in ds.GetProjectionRef() assert ds.GetGeoTransform() == (2.0, 1.0, 0.0, 50.0, 0.0, -0.5) assert ds.GetRasterBand(1).Checksum() == 2 assert ds.GetRasterBand(2).Checksum() == 4 assert ds.GetRasterBand(3).Checksum() == 4 assert ds.GetMetadataItem('COMPRESSION', 'IMAGE_STRUCTURE') == 'DEFLATE' assert ds.GetMetadataItem('FOO') == 'BAR' ds = None os.unlink('tmp/tmp.tif') ############################################################################### def test_gdal_create_pdf_no_direct_write_capabilities(): if get_gdal_create_path() is None: pytest.skip() (_, err) = gdaltest.runexternal_out_and_err(get_gdal_create_path() + ' tmp/tmp.png -of PNG -outsize 1 2') assert (err is None or err == ''), 'got error/warning' ds = gdal.Open('tmp/tmp.png') assert ds.RasterCount == 1 assert ds.RasterXSize == 1 assert ds.RasterYSize == 2 assert ds.GetRasterBand(1).DataType == gdal.GDT_Byte assert ds.GetRasterBand(1).GetNoDataValue() is None assert ds.GetProjectionRef() == '' assert ds.GetGeoTransform(can_return_null=True) is None assert ds.GetRasterBand(1).Checksum() == 0 ds = None os.unlink('tmp/tmp.png') ############################################################################### def test_gdal_create_pdf_composition(): if get_gdal_create_path() is None: pytest.skip() drv = gdal.GetDriverByName('PDF') if drv is None: pytest.skip() if drv.GetMetadataItem('HAVE_POPPLER') is None: pytest.skip() open('tmp/tmp.xml', 'wt').write("""<PDFComposition> <Page> <DPI>72</DPI> <Width>20</Width> <Height>20</Height> <Content streamCompression="NONE"> <Raster dataset="../gcore/data/byte.tif" tileSize="16"> <Blending function="Multiply" opacity="0.7"/> </Raster> </Content> </Page> </PDFComposition>""") (_, err) = gdaltest.runexternal_out_and_err(get_gdal_create_path() + ' tmp/tmp.pdf -co COMPOSITION_FILE=tmp/tmp.xml') os.unlink('tmp/tmp.xml') assert (err is None or err == ''), 'got error/warning' assert os.path.exists('tmp/tmp.pdf') os.unlink('tmp/tmp.pdf') ############################################################################### def test_gdal_create_not_write_driver(): if get_gdal_create_path() is None: pytest.skip() (_, err) = gdaltest.runexternal_out_and_err(get_gdal_create_path() + ' /vsimem/tmp.tga -of TGA -outsize 1 2') assert 'This driver has no creation capabilities' in err
{ "pile_set_name": "Github" }
# contrib/adminpack/Makefile MODULE_big = adminpack OBJS = adminpack.o PG_CPPFLAGS = -I$(libpq_srcdir) EXTENSION = adminpack DATA = adminpack--1.0.sql ifdef USE_PGXS PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else subdir = contrib/adminpack top_builddir = ../.. include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif
{ "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 mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either of 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 ***** */ @import url(resource://gre/res/html.css); @import url(chrome://global/content/xul.css); @namespace parsererror url(http://www.mozilla.org/newlayout/xml/parsererror.xml); /* magic -- some of these rules are important to keep pages from overriding them */ /* Tables */ *|*::-moz-table { display: table !important; -moz-box-sizing: border-box; /* XXX do we really want this? */ } *|*::-moz-inline-table { display: inline-table !important; -moz-box-sizing: border-box; /* XXX do we really want this? */ } *|*::-moz-table-outer { display: inherit !important; /* table or inline-table */ margin: 0 ! important; padding: 0 ! important; border: none ! important; float: inherit; clear: inherit; position: inherit; top: inherit; right: inherit; bottom: inherit; left: inherit; z-index: inherit; page-break-before: inherit; page-break-after: inherit; vertical-align: inherit; /* needed for inline-table */ line-height: inherit; /* needed for vertical-align on inline-table */ } *|*::-moz-table-row { display: table-row !important; } /* The ::-moz-table-column pseudo-element is for extra columns at the end of a table. */ *|*::-moz-table-column { display: table-column !important; } *|*::-moz-table-column-group { display: table-column-group !important; } *|*::-moz-table-row-group { display: table-row-group !important; } *|*::-moz-table-cell { display: table-cell !important; white-space: inherit; } /* Lists */ *|*::-moz-list-bullet, *|*::-moz-list-number { display: inline; vertical-align: baseline; -moz-margin-end: 8px; } /* Links */ *|*:-moz-any-link { cursor: pointer; } *|*:-moz-any-link:focus { /* Don't specify the outline-color, we should always use initial value. */ outline: 1px dotted; } /* Miscellaneous */ *|*::-moz-anonymous-block, *|*::-moz-cell-content { display: block !important; position: static !important; } *|*::-moz-anonymous-block, *|*::-moz-anonymous-positioned-block { /* we currently inherit from the inline that is split */ outline: inherit; outline-offset: inherit; clip-path: inherit; filter: inherit; mask: inherit; -moz-box-ordinal-group: inherit !important; } *|*::-moz-xul-anonymous-block { display: block ! important; position: static ! important; float: none ! important; -moz-box-ordinal-group: inherit !important; } *|*::-moz-scrolled-content, *|*::-moz-scrolled-canvas, *|*::-moz-scrolled-page-sequence { /* e.g., text inputs, select boxes */ padding: inherit; /* The display doesn't affect the kind of frame constructed here. This just affects auto-width sizing of the block we create. */ display: block; -moz-box-orient: inherit; /* make unicode-bidi inherit, otherwise it has no effect on text inputs and blocks with overflow: scroll; */ unicode-bidi: inherit; -moz-column-count: inherit; -moz-column-width: inherit; -moz-column-gap: inherit; /* Do not change these. nsCSSFrameConstructor depends on them to create a good frame tree. */ position: static !important; float: none !important; } *|*::-moz-viewport, *|*::-moz-viewport-scroll, *|*::-moz-canvas, *|*::-moz-scrolled-canvas { display: block !important; background-color: inherit; } *|*::-moz-viewport-scroll { overflow: auto; } *|*::-moz-column-content { /* the column boxes inside a column-flowed block */ /* make unicode-bidi inherit, otherwise it has no effect on column boxes */ unicode-bidi: inherit; /* inherit the outer frame's display, otherwise we turn into an inline */ display: inherit !important; /* Carry through our parent's height so that %-height children get their heights set */ height: 100%; } *|*::-moz-page, *|*::-moz-page-sequence, *|*::-moz-scrolled-page-sequence { display: block !important; background: transparent; } *|*::-moz-pagecontent { display: block !important; } *|*::-moz-pagebreak { display: block !important; } *|*::-moz-anonymous-positioned-block { display: block !important; position: relative; top: inherit; left: inherit; bottom: inherit; right: inherit; z-index: inherit; clip: inherit; opacity: inherit; } /* Printing */ @media print { * { cursor: default !important; } } /* XML parse error reporting */ parsererror|parsererror { display: block; font-family: sans-serif; font-weight: bold; white-space: pre; margin: 1em; padding: 1em; border-width: thin; border-style: inset; border-color: red; font-size: 14pt; background-color: lightyellow; } parsererror|sourcetext { display: block; white-space: pre; font-family: -moz-fixed; margin-top: 2em; margin-bottom: 1em; color: red; font-weight: bold; font-size: 12pt; }
{ "pile_set_name": "Github" }
/* * Copyright 2014-2020 Real Logic Limited. * * 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 * * https://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. */ #include "aeron_math.h" extern int32_t aeron_add_wrap_i32(int32_t a, int32_t b); extern int32_t aeron_sub_wrap_i32(int32_t a, int32_t b); extern int32_t aeron_mul_wrap_i32(int32_t a, int32_t b);
{ "pile_set_name": "Github" }
echo %PREFIX% echo %CD%
{ "pile_set_name": "Github" }
/* This is a compiled file, you should be editing the file in the templates directory */ .pace { -webkit-pointer-events: none; pointer-events: none; -webkit-user-select: none; -moz-user-select: none; user-select: none; overflow: hidden; position: fixed; top: 0; left: 0; z-index: 2000; width: 100%; height: 12px; background: #fff; } .pace-inactive { display: none; } .pace .pace-progress { background-color: #0087E1; position: fixed; top: 0; right: 100%; width: 100%; height: 12px; overflow: hidden; -webkit-border-radius: 0 0 4px 0; -moz-border-radius: 0 0 4px 0; -o-border-radius: 0 0 4px 0; border-radius: 0 0 4px 0; -webkit-box-shadow: inset -1px 0 #00558F, inset 0 -1px #00558F, inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, .3); -moz-box-shadow: inset -1px 0 #00558F, inset 0 -1px #00558F, inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, .3); -o-box-shadow: inset -1px 0 #00558F, inset 0 -1px #00558F, inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, .3); box-shadow: inset -1px 0 #00558F, inset 0 -1px #00558F, inset 0 2px rgba(255, 255, 255, 0.5), inset 0 6px rgba(255, 255, 255, .3); } .pace .pace-activity { position: fixed; top: 0; left: 0; right: -28px; bottom: 0; -webkit-background-image: radial-gradient(rgba(255, 255, 255, .65) 0%, rgba(255, 255, 255, .15) 100%); -moz-background-image: radial-gradient(rgba(255, 255, 255, .65) 0%, rgba(255, 255, 255, .15) 100%); -o-background-image: radial-gradient(rgba(255, 255, 255, .65) 0%, rgba(255, 255, 255, .15) 100%); background-image: radial-gradient(rgba(255, 255, 255, .65) 0%, rgba(255, 255, 255, .15) 100%); -webkit-background-size: 28px 100%; -moz-background-size: 28px 100%; -o-background-size: 28px 100%; background-size: 28px 100%; -webkit-animation: pace-theme-mac-osx-motion 500ms linear infinite; -moz-animation: pace-theme-mac-osx-motion 500ms linear infinite; -ms-animation: pace-theme-mac-osx-motion 500ms linear infinite; -o-animation: pace-theme-mac-osx-motion 500ms linear infinite; animation: pace-theme-mac-osx-motion 500ms linear infinite; } @-webkit-keyframes pace-theme-mac-osx-motion { 0% { -webkit-transform: none; transform: none; } 100% { -webkit-transform: translate(-28px, 0); transform: translate(-28px, 0); } } @-moz-keyframes pace-theme-mac-osx-motion { 0% { -moz-transform: none; transform: none; } 100% { -moz-transform: translate(-28px, 0); transform: translate(-28px, 0); } } @-o-keyframes pace-theme-mac-osx-motion { 0% { -o-transform: none; transform: none; } 100% { -o-transform: translate(-28px, 0); transform: translate(-28px, 0); } } @-ms-keyframes pace-theme-mac-osx-motion { 0% { -ms-transform: none; transform: none; } 100% { -ms-transform: translate(-28px, 0); transform: translate(-28px, 0); } } @keyframes pace-theme-mac-osx-motion { 0% { transform: none; transform: none; } 100% { transform: translate(-28px, 0); transform: translate(-28px, 0); } }
{ "pile_set_name": "Github" }
/* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis * * gimppropgui-recursive-transform.c * Copyright (C) 2018 Ell * * 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 <https://www.gnu.org/licenses/>. */ #include "config.h" #include <gegl.h> #include <gtk/gtk.h> #include "libgimpmath/gimpmath.h" #include "libgimpwidgets/gimpwidgets.h" #include "propgui-types.h" #include "core/gimpcontext.h" #include "gimppropgui.h" #include "gimppropgui-generic.h" #include "gimppropgui-recursive-transform.h" #include "gimp-intl.h" #define MAX_N_TRANSFORMS 10 static void add_transform (GtkButton *button, GObject *config) { gchar *transform; gchar *new_transform; g_object_get (config, "transform", &transform, NULL); new_transform = g_strdup_printf ("%s;matrix (1, 0, 0, 0, 1, 0, 0, 0, 1)", transform); g_object_set (config, "transform", new_transform, NULL); g_free (transform); g_free (new_transform); } static void duplicate_transform (GtkButton *button, GObject *config) { gchar *transform; gchar *new_transform; gchar *delim; g_object_get (config, "transform", &transform, NULL); delim = strrchr (transform, ';'); if (! delim) delim = transform; else delim++; new_transform = g_strdup_printf ("%s;%s", transform, delim); g_object_set (config, "transform", new_transform, NULL); g_free (transform); g_free (new_transform); } static void remove_transform (GtkButton *button, GObject *config) { gchar *transform; gchar *delim; g_object_get (config, "transform", &transform, NULL); delim = strrchr (transform, ';'); if (delim) { *delim = '\0'; g_object_set (config, "transform", transform, NULL); } g_free (transform); } static void transform_grids_callback (GObject *config, GeglRectangle *area, const GimpMatrix3 *transforms, gint n_transforms) { GString *transforms_str = g_string_new (NULL); gchar *transform_str; gint i; g_object_set_data_full (G_OBJECT (config), "area", g_memdup (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); for (i = 0; i < n_transforms; i++) { if (i > 0) g_string_append (transforms_str, ";"); transform_str = gegl_matrix3_to_string ((GeglMatrix3 *) &transforms[i]); g_string_append (transforms_str, transform_str); g_free (transform_str); } transform_str = g_string_free (transforms_str, FALSE); g_object_set (config, "transform", transform_str, NULL); g_free (transform_str); } static void config_notify (GObject *config, const GParamSpec *pspec, gpointer set_data) { GtkWidget *add_button; GtkWidget *duplicate_button; GtkWidget *remove_button; GimpControllerTransformGridsCallback set_func; GeglRectangle *area; gchar *transform_str; gchar **transform_strs; GimpMatrix3 *transforms; gint n_transforms; gint i; add_button = g_object_get_data (G_OBJECT (config), "add-transform-button"); duplicate_button = g_object_get_data (G_OBJECT (config), "duplicate-transform-button"); remove_button = g_object_get_data (G_OBJECT (config), "remove-transform-button"); set_func = g_object_get_data (G_OBJECT (config), "set-func"); area = g_object_get_data (G_OBJECT (config), "area"); g_object_get (config, "transform", &transform_str, NULL); transform_strs = g_strsplit (transform_str, ";", -1); g_free (transform_str); for (n_transforms = 0; transform_strs[n_transforms]; n_transforms++); transforms = g_new (GimpMatrix3, n_transforms); for (i = 0; i < n_transforms; i++) { gegl_matrix3_parse_string ((GeglMatrix3 *) &transforms[i], transform_strs[i]); } set_func (set_data, area, transforms, n_transforms); g_strfreev (transform_strs); g_free (transforms); gtk_widget_set_sensitive (add_button, n_transforms < MAX_N_TRANSFORMS); gtk_widget_set_sensitive (duplicate_button, n_transforms < MAX_N_TRANSFORMS); gtk_widget_set_sensitive (remove_button, n_transforms > 1); } GtkWidget * _gimp_prop_gui_new_recursive_transform (GObject *config, GParamSpec **param_specs, guint n_param_specs, GeglRectangle *area, GimpContext *context, GimpCreatePickerFunc create_picker_func, GimpCreateControllerFunc create_controller_func, gpointer creator) { GtkWidget *vbox; g_return_val_if_fail (G_IS_OBJECT (config), NULL); g_return_val_if_fail (param_specs != NULL, NULL); g_return_val_if_fail (n_param_specs > 0, NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); /* skip the "transform" property, which is controlled by a transform-grid * controller. */ if (create_controller_func) { param_specs++; n_param_specs--; } vbox = _gimp_prop_gui_new_generic (config, param_specs, n_param_specs, area, context, create_picker_func, create_controller_func, creator); if (create_controller_func) { GtkWidget *outer_vbox; GtkWidget *hbox; GtkWidget *button; GtkWidget *image; GCallback set_func; gpointer set_data; outer_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, gtk_box_get_spacing (GTK_BOX (vbox))); gtk_box_pack_start (GTK_BOX (outer_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE); gtk_box_pack_start (GTK_BOX (outer_vbox), hbox, FALSE, FALSE, 2); gtk_widget_show (hbox); button = gtk_button_new (); gimp_help_set_help_data (button, _("Add transform"), NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); image = gtk_image_new_from_icon_name (GIMP_ICON_LIST_ADD, GTK_ICON_SIZE_MENU); gtk_container_add (GTK_CONTAINER (button), image); gtk_widget_show (image); g_signal_connect (button, "clicked", G_CALLBACK (add_transform), config); g_object_set_data (config, "add-transform-button", button); button = gtk_button_new (); gimp_help_set_help_data (button, _("Duplicate transform"), NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); image = gtk_image_new_from_icon_name (GIMP_ICON_OBJECT_DUPLICATE, GTK_ICON_SIZE_MENU); gtk_container_add (GTK_CONTAINER (button), image); gtk_widget_show (image); g_signal_connect (button, "clicked", G_CALLBACK (duplicate_transform), config); g_object_set_data (config, "duplicate-transform-button", button); button = gtk_button_new (); gimp_help_set_help_data (button, _("Remove transform"), NULL); gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); gtk_widget_show (button); image = gtk_image_new_from_icon_name (GIMP_ICON_LIST_REMOVE, GTK_ICON_SIZE_MENU); gtk_container_add (GTK_CONTAINER (button), image); gtk_widget_show (image); g_signal_connect (button, "clicked", G_CALLBACK (remove_transform), config); g_object_set_data (config, "remove-transform-button", button); vbox = outer_vbox; set_func = create_controller_func (creator, GIMP_CONTROLLER_TYPE_TRANSFORM_GRIDS, _("Recursive Transform: "), (GCallback) transform_grids_callback, config, &set_data); g_object_set_data (G_OBJECT (config), "set-func", set_func); g_object_set_data_full (G_OBJECT (config), "area", g_memdup (area, sizeof (GeglRectangle)), (GDestroyNotify) g_free); config_notify (config, NULL, set_data); g_signal_connect (config, "notify", G_CALLBACK (config_notify), set_data); } return vbox; }
{ "pile_set_name": "Github" }
# Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT) # Copyright (C) 2006-2010 RobotCub Consortium # All rights reserved. # # This software may be modified and distributed under the terms of the # BSD-3-Clause license. See the accompanying LICENSE file for details. cmake_minimum_required(VERSION 3.12) project(game_server) find_package(YARP COMPONENTS os REQUIRED) # using ACE add_definitions(-D_REENTRANT) if(WIN32 AND NOT CYGWIN) add_definitions(-DWIN32 -D_WINDOWS) endif(WIN32 AND NOT CYGWIN) if(WIN32 AND CYGWIN) add_definitions(-DCYGWIN) endif(WIN32 AND CYGWIN) add_executable(game_server) target_sources(game_server PRIVATE Game.cpp Login.cpp main.cpp Player.cpp Thing.cpp Things.cpp) target_include_directories(game_server PRIVATE ${CMAKE_SOURCE_DIR}) target_link_libraries(game_server PRIVATE ${YARP_LIBRARIES})
{ "pile_set_name": "Github" }
// +build linux darwin freebsd netbsd package command import ( "reflect" "testing" "time" "github.com/mackerelio/mackerel-agent/config" mkr "github.com/mackerelio/mackerel-client-go" ) var diceCommand = "go run ../_example/metrics-plugins/dice-with-meta.go" func TestRunOnce(t *testing.T) { if testing.Short() { origMetricsInterval := metricsInterval metricsInterval = 1 * time.Second defer func() { metricsInterval = origMetricsInterval }() } conf := &config.Config{ MetricPlugins: map[string]*config.MetricPlugin{ "metric1": { Command: config.Command{Cmd: diceCommand}, }, }, CheckPlugins: map[string]*config.CheckPlugin{ "check1": { Command: config.Command{Cmd: "echo 1"}, }, }, } err := RunOnce(conf, &AgentMeta{}) if err != nil { t.Errorf("RunOnce() should be nomal exit: %s", err) } } func TestRunOncePayload(t *testing.T) { if testing.Short() { origMetricsInterval := metricsInterval metricsInterval = 1 * time.Second defer func() { metricsInterval = origMetricsInterval }() } conf := &config.Config{ MetricPlugins: map[string]*config.MetricPlugin{ "metric1": { Command: config.Command{Cmd: diceCommand}, }, }, CheckPlugins: map[string]*config.CheckPlugin{ "check1": { Command: config.Command{Cmd: "echo 1"}, }, }, } graphdefs, hostSpec, metrics, err := runOncePayload(conf, &AgentMeta{}) if err != nil { t.Errorf("RunOnce() should be nomal exit: %s", err) } if !reflect.DeepEqual(graphdefs[0], &mkr.GraphDefsParam{ Name: "custom.dice", DisplayName: "My Dice", Unit: "integer", Metrics: []*mkr.GraphDefsMetric{ { Name: "custom.dice.d6", DisplayName: "Die (d6)", IsStacked: false, }, { Name: "custom.dice.d20", DisplayName: "Die (d20)", IsStacked: false, }, }, }) { t.Errorf("graphdefs are invalid") } if hostSpec.Name == "" { t.Errorf("hostname should be set") } if hostSpec.Checks[0].Name != "check1" { t.Errorf("first check name should be check1") } if len(metrics.Values) != 1 { t.Errorf("there must be some metric values") } if metrics.Values[0].Values["custom.dice.d20"] == 0 { t.Errorf("custom.dice.d20 name should be set") } }
{ "pile_set_name": "Github" }
/* * Copyright 2013 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs <[email protected]> */ #define NV_PGRAPH_GPCX_UNK__SIZE 0x00000002 #define CHIPSET GM107 #include "macros.fuc" .section #gm107_grgpc_data #define INCLUDE_DATA #include "com.fuc" #include "gpc.fuc" #undef INCLUDE_DATA .section #gm107_grgpc_code #define INCLUDE_CODE bra #init #include "com.fuc" #include "gpc.fuc" .align 256 #undef INCLUDE_CODE
{ "pile_set_name": "Github" }
/* jQuery Colorbox language configuration language: Serbian (sr) translated by: Sasa Stefanovic (baguje.com) */ jQuery.extend(jQuery.colorbox.settings, { current: "Slika {current} od {total}", previous: "Prethodna", next: "Sledeća", close: "Zatvori", xhrError: "Neuspešno učitavanje sadržaja.", imgError: "Neuspešno učitavanje slike.", slideshowStart: "Pokreni slideshow", slideshowStop: "Zaustavi slideshow" });
{ "pile_set_name": "Github" }
#ifndef DECODER_MODEL_WRAPPER_H #define DECODER_MODEL_WRAPPER_H #include "file_helper_decoder.h" template<typename dType> class neuralMT_model; //the entire model will lie on one GPU, but different models in the ensemble can lie on different GPU's template<typename dType> class decoder_model_wrapper { public: int gpu_num; int *d_ones; //vector of all ones, used for forward prop in beam search, on GPU dType *h_outputdist; dType *d_temp_swap_vals; int *d_input_vocab_indicies_source; int *d_current_indicies; int *h_current_indices; // every model should have this vector for model ensemble; neuralMT_model<dType> *model; //This is the model file_helper_decoder *fileh; //for file input, so each file can get read in seperately file_helper_decoder *fileh_multi_src; //reads in additional multi-source file int source_length; //current length of the source sentence being decoded int beam_size; int source_vocab_size; int target_vocab_size; int num_layers; int LSTM_size; bool attention_model; bool feed_input; bool combine_LSTM; int num_lines_in_file = -1; int longest_sent; bool multi_source = false; int source_length_bi; //current length of the source sentence being decoded int *d_input_vocab_indicies_source_bi; bool char_cnn = false; int *d_char_vocab_indicies_source; int longest_word; std::unordered_map<int,std::vector<int>> word_to_char_map; //for word index, what is the character sequence, this is read from a file int *h_new_char_indicies; int *d_new_char_indicies; std::string main_weight_file; std::string multi_src_weight_file; std::string main_integerized_file; std::string multi_src_integerized_file; Eigen::Matrix<dType,Eigen::Dynamic, Eigen::Dynamic,Eigen::RowMajor> outputdist; std::vector<int> viterbi_alignments_ind; //individual viterbi alignments before voting std::vector<dType> viterbi_alignments_scores; //individual viterbi scores // for shrink the target set vocab; dType *d_D_shrink; dType *d_softmax_original_D; // a pointer to refer the d_D in original softmax; dType *d_b_shrink; dType *d_softmax_original_b; int new_output_vocab_size = 0; int *h_new_vocab_index; int *d_new_vocab_index; // for policy 1 bool show_shrink_debug = false; bool policy_1_done = false; // for policy 2 int *h_alignments; // [cap+1, source_vocab_size] int *d_alignments; int cap = 0; // for LSH int nnz = 0; int target_vocab_policy = 0; global_params * p_params; decoder_model_wrapper() {}; ~decoder_model_wrapper() { delete fileh; delete model; if(multi_src_integerized_file != "NULL") { delete fileh_multi_src; } }; decoder_model_wrapper(int gpu_num,int beam_size, std::string main_weight_file,std::string multi_src_weight_file,std::string main_integerized_file, std::string multi_src_integerized_file,int longest_sent,global_params &params); void extract_model_info(std::string weights_file_name); //get how many layers, hiddenstate size, vocab sizes, etc void memcpy_vocab_indicies(); void prepare_target_vocab_set(); void before_target_vocab_shrink(); void after_target_vocab_shrink(); void forward_prop_source(); void forward_prop_target(int curr_index,int *h_current_indicies); template<typename Derived> void swap_decoding_states(const Eigen::MatrixBase<Derived> &indicies,int index); //copy h_outputdist to eigen template<typename Derived> void copy_dist_to_eigen(dType *h_outputdist,const Eigen::MatrixBase<Derived> &outputdist_const); template<typename Derived> void copy_dist_to_eigen(dType *h_outputdist,const Eigen::MatrixBase<Derived> &outputdist_const, int nnz); void target_copy_prev_states(); private: // prohibiting copying, per // http://stackoverflow.com/questions/9331561/why-does-my-classs-destructor-get-called-when-i-add-instances-to-a-vector // TODO: why can't this exist for emplace? //decoder_model_wrapper(const decoder_model_wrapper&); // copy constructor decoder_model_wrapper& operator=(const decoder_model_wrapper&); // assign operator }; #endif
{ "pile_set_name": "Github" }
title: $:/core/ui/Buttons/info tags: $:/tags/ViewToolbar caption: {{$:/core/images/info-button}} {{$:/language/Buttons/Info/Caption}} description: {{$:/language/Buttons/Info/Hint}} \whitespace trim \define button-content() <$list filter="[<tv-config-toolbar-icons>match[yes]]"> {{$:/core/images/info-button}} </$list> <$list filter="[<tv-config-toolbar-text>match[yes]]"> <span class="tc-btn-text"> <$text text={{$:/language/Buttons/Info/Caption}}/> </span> </$list> \end <$reveal state="$:/config/TiddlerInfo/Mode" type="match" text="popup"> <$button popup=<<tiddlerInfoState>> tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected"> <$macrocall $name="button-content" mode="inline"/> </$button> </$reveal> <$reveal state="$:/config/TiddlerInfo/Mode" type="match" text="sticky"> <$reveal state=<<tiddlerInfoState>> type="match" text="" default=""> <$button set=<<tiddlerInfoState>> setTo="yes" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected"> <$macrocall $name="button-content" mode="inline"/> </$button> </$reveal> <$reveal state=<<tiddlerInfoState>> type="nomatch" text="" default=""> <$button set=<<tiddlerInfoState>> setTo="" tooltip={{$:/language/Buttons/Info/Hint}} aria-label={{$:/language/Buttons/Info/Caption}} class=<<tv-config-toolbar-class>> selectedClass="tc-selected"> <$macrocall $name="button-content" mode="inline"/> </$button> </$reveal> </$reveal>
{ "pile_set_name": "Github" }
{ "images": [ { "filename": "ic_bookmark_48pt.png", "idiom": "universal", "scale": "1x" }, { "filename": "ic_bookmark_48pt_2x.png", "idiom": "universal", "scale": "2x" }, { "filename": "ic_bookmark_48pt_3x.png", "idiom": "universal", "scale": "3x" } ], "info": { "author": "xcode", "version": 1 } }
{ "pile_set_name": "Github" }
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can * obtain a copy of the License at * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html * or packager/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at packager/legal/LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" * exception as provided by Oracle in the GPL Version 2 section of the License * file that accompanied this code. * * Modifications: * If applicable, add the following below the License Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyright [year] [name of copyright owner]" * * Contributor(s): * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package com.sun.faces.application.resource; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.Override; import java.lang.String; import java.net.URL; import java.net.URLConnection; import java.util.Arrays; import java.util.zip.GZIPOutputStream; import javax.faces.application.*; import javax.faces.application.Application; import javax.faces.application.Resource; import javax.faces.application.ResourceHandler; import javax.faces.application.ResourceHandlerWrapper; import javax.faces.application.ResourceWrapper; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import com.sun.faces.cactus.ServletFacesTestCase; import com.sun.faces.config.WebConfiguration; import com.sun.faces.util.Util; import com.sun.faces.application.ApplicationAssociate; import com.sun.faces.config.InitFacesContext; import java.lang.reflect.Method; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; import javax.faces.FactoryFinder; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import org.apache.cactus.WebRequest; import org.apache.cactus.WebResponse; /** * Tests com.sun.faces.application.resource.ResourceHandlerImpl */ public class TestResourceHandlerImpl extends ServletFacesTestCase { /* HTTP Date format required by the HTTP/1.1 RFC */ private static final String RFC1123_DATE_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz"; private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); public TestResourceHandlerImpl() { super("TestResourceHandlerImpl"); initLocalHostPath(); } public TestResourceHandlerImpl(String name) { super(name); initLocalHostPath(); } private String path = "localhost:8080"; private void initLocalHostPath() { String containerPort = System.getProperty("container.port"); if (null == containerPort || 0 == containerPort.length()) { containerPort = "8080"; } path = "localhost:" + containerPort; } public void testAll() { } @Override public void setUp() { try { Method reInitializeFactoryManager = FactoryFinder.class.getDeclaredMethod("reInitializeFactoryManager", (Class<?>[]) null); reInitializeFactoryManager.setAccessible(true); reInitializeFactoryManager.invoke(null, (Object[]) null); FacesContext oldContext = FacesContext.getCurrentInstance(); if (null != oldContext && (oldContext instanceof InitFacesContext)) { // JAVASERVERFACES-2140 assert (Util.isUnitTestModeEnabled()); System.out.println("Re-initializing ExternalContext with ServletContext from cactus: " + getConfig().getServletContext()); System.out.flush(); ((InitFacesContext) oldContext).reInitializeExternalContext(getConfig().getServletContext()); } } catch (Exception e) { fail(e.getMessage()); } super.setUp(); } @Override public void tearDown() { super.tearDown(); } // ------------------------------------------------------------ Test Methods // ---------------------------------------------------------- Helper Methods private byte[] getBytes(URL url) throws Exception { return getBytes(url, false); } private byte[] getBytes(URL url, boolean compress) throws Exception { URLConnection c = url.openConnection(); c.setUseCaches(false); InputStream in = c.getInputStream(); return ((compress) ? getCompressedBytes(in) : getBytes(in)); } private byte[] getBytes(InputStream in) throws Exception { ByteArrayOutputStream o = new ByteArrayOutputStream(); for (int i = in.read(); i != -1; i = in.read()) { o.write(i); } in.close(); return o.toByteArray(); } private byte[] getCompressedBytes(InputStream in) throws Exception { ByteArrayOutputStream o = new ByteArrayOutputStream(); GZIPOutputStream compress = new GZIPOutputStream(o); for (int i = in.read(); i != -1; i = in.read()) { compress.write(i); } compress.flush(); compress.close(); return o.toByteArray(); } // ----------------------------------------------------------- Inner Classes private static class TestResponseWrapper extends HttpServletResponseWrapper { private TestServletOutputStream out; public byte[] getBytes() { return out.getBytes(); } public TestResponseWrapper(HttpServletResponse httpServletResponse) { super(httpServletResponse); } public ServletOutputStream getOutputStream() throws IOException { out = new TestServletOutputStream(super.getOutputStream()); return out; } private class TestServletOutputStream extends ServletOutputStream { private ServletOutputStream wrapped; private ByteArrayOutputStream out = new ByteArrayOutputStream(); public TestServletOutputStream(ServletOutputStream wrapped) { this.wrapped = wrapped; } public void write(int b) throws IOException { wrapped.write(b); out.write(b); } public void write(byte b[]) throws IOException { wrapped.write(b); out.write(b); } public void write(byte b[], int off, int len) throws IOException { wrapped.write(b, off, len); out.write(b, off, len); } public void flush() throws IOException { wrapped.flush(); out.flush(); } public void close() throws IOException { wrapped.close(); out.close(); } public byte[] getBytes() { return out.toByteArray(); } // @Override // public boolean isReady() { // throw new UnsupportedOperationException("Not supported"); // } // // @Override // public void setWriteListener(WriteListener wl) { // throw new UnsupportedOperationException("Not supported"); // } } } }
{ "pile_set_name": "Github" }
<?xml version='1.0'?> <entity_group> <group id='Visitor' name='Visitatore'/> <group id='Guest' name='Ospite'/> <group id='Customer' name='Cliente'/> </entity_group>
{ "pile_set_name": "Github" }
/* * Copyright 2008 Corbin Simpson <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef R300_CONTEXT_H #define R300_CONTEXT_H #define R300_BUFFER_ALIGNMENT 64 #include "draw/draw_vertex.h" #include "util/u_blitter.h" #include "pipe/p_context.h" #include "util/u_inlines.h" #include "util/u_transfer.h" #include "r300_defines.h" #include "r300_screen.h" #include "compiler/radeon_regalloc.h" struct u_upload_mgr; struct r300_context; struct r300_fragment_shader; struct r300_vertex_shader; struct r300_stencilref_context; enum colormask_swizzle { COLORMASK_BGRA, COLORMASK_RGBA, COLORMASK_RRRR, COLORMASK_AAAA, COLORMASK_GRRG, COLORMASK_ARRA, COLORMASK_BGRX, COLORMASK_RGBX, COLORMASK_NUM_SWIZZLES }; struct r300_atom { /* Name, for debugging. */ const char* name; /* Opaque state. */ void* state; /* Emit the state to the context. */ void (*emit)(struct r300_context*, unsigned, void*); /* Upper bound on number of dwords to emit. */ unsigned size; /* Whether this atom should be emitted. */ boolean dirty; /* Whether this atom may be emitted with state == NULL. */ boolean allow_null_state; }; struct r300_aa_state { struct r300_surface *dest; uint32_t aa_config; }; struct r300_blend_state { struct pipe_blend_state state; uint32_t cb_clamp[COLORMASK_NUM_SWIZZLES][8]; uint32_t cb_noclamp[8]; uint32_t cb_noclamp_noalpha[8]; uint32_t cb_no_readwrite[8]; }; struct r300_blend_color_state { struct pipe_blend_color state; uint32_t cb[3]; }; struct r300_clip_state { uint32_t cb[29]; }; struct r300_dsa_state { struct pipe_depth_stencil_alpha_state dsa; /* This is actually a command buffer with named dwords. */ uint32_t cb_begin; uint32_t z_buffer_control; /* R300_ZB_CNTL: 0x4f00 */ uint32_t z_stencil_control; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */ uint32_t stencil_ref_mask; /* R300_ZB_STENCILREFMASK: 0x4f08 */ uint32_t cb_reg; uint32_t stencil_ref_bf; /* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */ uint32_t cb_reg1; uint32_t alpha_value; /* R500_FG_ALPHA_VALUE: 0x4be0 */ /* Same, but without ZB reads and writes. */ uint32_t cb_zb_no_readwrite[8]; /* ZB not bound */ /* Emitted separately: */ uint32_t alpha_function; /* Whether a two-sided stencil is enabled. */ boolean two_sided; /* Whether a fallback should be used for a two-sided stencil ref value. */ boolean two_sided_stencil_ref; }; struct r300_hyperz_state { int flush; /* This is actually a command buffer with named dwords. */ uint32_t cb_flush_begin; uint32_t zb_zcache_ctlstat; /* R300_ZB_CACHE_CNTL */ uint32_t cb_begin; uint32_t zb_bw_cntl; /* R300_ZB_BW_CNTL */ uint32_t cb_reg1; uint32_t zb_depthclearvalue; /* R300_ZB_DEPTHCLEARVALUE */ uint32_t cb_reg2; uint32_t sc_hyperz; /* R300_SC_HYPERZ */ uint32_t cb_reg3; uint32_t gb_z_peq_config; /* R300_GB_Z_PEQ_CONFIG: 0x4028 */ }; struct r300_gpu_flush { uint32_t cb_flush_clean[6]; }; #define RS_STATE_MAIN_SIZE 27 struct r300_rs_state { /* Original rasterizer state. */ struct pipe_rasterizer_state rs; /* Draw-specific rasterizer state. */ struct pipe_rasterizer_state rs_draw; /* Command buffers. */ uint32_t cb_main[RS_STATE_MAIN_SIZE]; uint32_t cb_poly_offset_zb16[5]; uint32_t cb_poly_offset_zb24[5]; /* The index to cb_main where the cull_mode register value resides. */ unsigned cull_mode_index; /* Whether polygon offset is enabled. */ boolean polygon_offset_enable; /* This is emitted in the draw function. */ uint32_t color_control; /* R300_GA_COLOR_CONTROL: 0x4278 */ }; struct r300_rs_block { uint32_t vap_vtx_state_cntl; /* R300_VAP_VTX_STATE_CNTL: 0x2180 */ uint32_t vap_vsm_vtx_assm; /* R300_VAP_VSM_VTX_ASSM: 0x2184 */ uint32_t vap_out_vtx_fmt[2]; /* R300_VAP_OUTPUT_VTX_FMT_[0-1]: 0x2090 */ uint32_t gb_enable; uint32_t ip[8]; /* R300_RS_IP_[0-7], R500_RS_IP_[0-7] */ uint32_t count; /* R300_RS_COUNT */ uint32_t inst_count; /* R300_RS_INST_COUNT */ uint32_t inst[8]; /* R300_RS_INST_[0-7] */ }; struct r300_sampler_state { struct pipe_sampler_state state; uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */ uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */ /* Min/max LOD must be clamped to [0, last_level], thus * it's dependent on a currently bound texture */ unsigned min_lod, max_lod; }; struct r300_texture_format_state { uint32_t format0; /* R300_TX_FORMAT0: 0x4480 */ uint32_t format1; /* R300_TX_FORMAT1: 0x44c0 */ uint32_t format2; /* R300_TX_FORMAT2: 0x4500 */ uint32_t tile_config; /* R300_TX_OFFSET (subset thereof) */ uint32_t us_format0; /* R500_US_FORMAT0_0: 0x4640 (through 15) */ }; struct r300_sampler_view { struct pipe_sampler_view base; /* For resource_copy_region. */ unsigned width0_override; unsigned height0_override; /* Swizzles in the PIPE_SWIZZLE_* representation, * derived from base. */ unsigned char swizzle[4]; /* Copy of r300_texture::texture_format_state with format-specific bits * added. */ struct r300_texture_format_state format; /* The texture cache region for this texture. */ uint32_t texcache_region; }; struct r300_texture_sampler_state { struct r300_texture_format_state format; uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */ uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */ uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */ }; struct r300_textures_state { /* Textures. */ struct r300_sampler_view *sampler_views[16]; int sampler_view_count; /* Sampler states. */ struct r300_sampler_state *sampler_states[16]; int sampler_state_count; /* This is the merge of the texture and sampler states. */ unsigned count; uint32_t tx_enable; /* R300_TX_ENABLE: 0x4101 */ struct r300_texture_sampler_state regs[16]; }; struct r300_vertex_stream_state { /* R300_VAP_PROG_STREAK_CNTL_[0-7] */ uint32_t vap_prog_stream_cntl[8]; /* R300_VAP_PROG_STREAK_CNTL_EXT_[0-7] */ uint32_t vap_prog_stream_cntl_ext[8]; unsigned count; }; struct r300_invariant_state { uint32_t cb[24]; }; struct r300_vap_invariant_state { uint32_t cb[11]; }; struct r300_viewport_state { float xscale; /* R300_VAP_VPORT_XSCALE: 0x2098 */ float xoffset; /* R300_VAP_VPORT_XOFFSET: 0x209c */ float yscale; /* R300_VAP_VPORT_YSCALE: 0x20a0 */ float yoffset; /* R300_VAP_VPORT_YOFFSET: 0x20a4 */ float zscale; /* R300_VAP_VPORT_ZSCALE: 0x20a8 */ float zoffset; /* R300_VAP_VPORT_ZOFFSET: 0x20ac */ uint32_t vte_control; /* R300_VAP_VTE_CNTL: 0x20b0 */ }; struct r300_ztop_state { uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */ }; /* The next several objects are not pure Radeon state; they inherit from * various Gallium classes. */ struct r300_constant_buffer { /* Buffer of constants */ uint32_t *ptr; /* Remapping table. */ unsigned *remap_table; /* const buffer base */ uint32_t buffer_base; }; /* Query object. * * This is not a subclass of pipe_query because pipe_query is never * actually fully defined. So, rather than have it as a member, and do * subclass-style casting, we treat pipe_query as an opaque, and just * trust that our state tracker does not ever mess up query objects. */ struct r300_query { /* The kind of query. Currently only OQ is supported. */ unsigned type; /* The number of pipes where query results are stored. */ unsigned num_pipes; /* How many results have been written, in dwords. It's incremented * after end_query and flush. */ unsigned num_results; /* if begin has been emitted */ boolean begin_emitted; /* The buffer where query results are stored. */ struct pb_buffer *buf; }; struct r300_surface { struct pipe_surface base; /* Winsys buffer backing the texture. */ struct pb_buffer *buf; enum radeon_bo_domain domain; uint32_t offset; /* COLOROFFSET or DEPTHOFFSET. */ uint32_t pitch; /* COLORPITCH or DEPTHPITCH. */ uint32_t pitch_zmask; /* ZMASK_PITCH */ uint32_t pitch_hiz; /* HIZ_PITCH */ uint32_t pitch_cmask; /* CMASK_PITCH */ uint32_t format; /* US_OUT_FMT or ZB_FORMAT. */ /* Parameters dedicated to the CBZB clear. */ uint32_t cbzb_width; /* Aligned width. */ uint32_t cbzb_height; /* Half of the height. */ uint32_t cbzb_midpoint_offset; /* DEPTHOFFSET. */ uint32_t cbzb_pitch; /* DEPTHPITCH. */ uint32_t cbzb_format; /* ZB_FORMAT. */ /* Whether the CBZB clear is allowed on the surface. */ boolean cbzb_allowed; unsigned colormask_swizzle; }; struct r300_texture_desc { /* Width, height, and depth. * Most of the time, these are equal to pipe_texture::width0, height0, * and depth0. However, NPOT 3D textures must have dimensions aligned * to POT, and this is the only case when these variables differ from * pipe_texture. */ unsigned width0, height0, depth0; /* Buffer tiling. * Macrotiling is specified per-level because small mipmaps cannot * be macrotiled. */ enum radeon_bo_layout microtile; enum radeon_bo_layout macrotile[R300_MAX_TEXTURE_LEVELS]; /* Offsets into the buffer. */ unsigned offset_in_bytes[R300_MAX_TEXTURE_LEVELS]; /* Strides for each mip-level. */ unsigned stride_in_bytes[R300_MAX_TEXTURE_LEVELS]; /* Size of one zslice or face or 2D image based on the texture target. */ unsigned layer_size_in_bytes[R300_MAX_TEXTURE_LEVELS]; /* Total size of this texture, in bytes, * derived from the texture properties. */ unsigned size_in_bytes; /** * If non-zero, override the natural texture layout with * a custom stride (in bytes). * * \note Mipmapping fails for textures with a non-natural layout! * * \sa r300_texture_get_stride */ unsigned stride_in_bytes_override; /* Whether this texture has non-power-of-two dimensions. * It can be either a regular texture or a rectangle one. */ boolean is_npot; /* This flag says that hardware must use the stride for addressing * instead of the width. */ boolean uses_stride_addressing; /* Whether CBZB fast color clear is allowed on the miplevel. */ boolean cbzb_allowed[R300_MAX_TEXTURE_LEVELS]; /* Zbuffer compression info for each miplevel. */ boolean zcomp8x8[R300_MAX_TEXTURE_LEVELS]; /* If zero, then disable Z compression/HiZ. */ unsigned zmask_dwords[R300_MAX_TEXTURE_LEVELS]; unsigned hiz_dwords[R300_MAX_TEXTURE_LEVELS]; /* Zmask/HiZ strides for each miplevel. */ unsigned zmask_stride_in_pixels[R300_MAX_TEXTURE_LEVELS]; unsigned hiz_stride_in_pixels[R300_MAX_TEXTURE_LEVELS]; /* CMASK info for AA buffers (no mipmapping). */ unsigned cmask_dwords; unsigned cmask_stride_in_pixels; }; struct r300_resource { struct u_resource b; /* Winsys buffer backing this resource. */ struct pb_buffer *buf; enum radeon_bo_domain domain; /* Constant buffers and SWTCL vertex and index buffers are in user * memory. */ uint8_t *malloced_buffer; /* Texture description (addressing, layout, special features). */ struct r300_texture_desc tex; /* This is the level tiling flags were last time set for. * It's used to prevent redundant tiling-flags changes from happening.*/ unsigned surface_level; }; struct r300_vertex_element_state { unsigned count; struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS]; unsigned format_size[PIPE_MAX_ATTRIBS]; /* The size of the vertex, in dwords. */ unsigned vertex_size_dwords; struct r300_vertex_stream_state vertex_stream; }; enum r300_hiz_func { HIZ_FUNC_NONE, /* The function, when determined, is set in stone * until the next HiZ clear. */ /* MAX is written to the HiZ buffer. * Used for LESS, LEQUAL. */ HIZ_FUNC_MAX, /* MIN is written to the HiZ buffer. * Used for GREATER, GEQUAL. */ HIZ_FUNC_MIN, }; /* For deferred fragment shader state validation. */ enum r300_fs_validity_status { FRAGMENT_SHADER_VALID, /* No need to change/validate the FS. */ FRAGMENT_SHADER_MAYBE_DIRTY,/* Validate the FS if external state was changed. */ FRAGMENT_SHADER_DIRTY /* Always validate the FS (if the FS was changed) */ }; struct r300_context { /* Parent class */ struct pipe_context context; /* The interface to the windowing system, etc. */ struct radeon_winsys *rws; /* The submission context. */ struct radeon_winsys_ctx *ctx; /* The command stream. */ struct radeon_winsys_cs *cs; /* Screen. */ struct r300_screen *screen; /* Draw module. Used mostly for SW TCL. */ struct draw_context* draw; /* Vertex buffer for SW TCL. */ struct pb_buffer *vbo; /* Offset and size into the SW TCL VBO. */ size_t draw_vbo_offset; /* Accelerated blit support. */ struct blitter_context* blitter; /* Stencil two-sided reference value fallback. */ struct r300_stencilref_context *stencilref_fallback; /* The KIL opcode needs the first texture unit to be enabled * on r3xx-r4xx. In order to calm down the CS checker, we bind this * dummy texture there. */ struct r300_sampler_view *texkill_sampler; /* When no vertex buffer is set, this one is used instead to prevent * hardlocks. */ struct pipe_vertex_buffer dummy_vb; /* The currently active query. */ struct r300_query *query_current; /* The saved query for blitter operations. */ struct r300_query *blitter_saved_query; /* Query list. */ struct r300_query query_list; /* Various CSO state objects. */ /* Each atom is emitted in the order it appears here, which can affect * performance and stability if not handled with care. */ /* GPU flush. */ struct r300_atom gpu_flush; /* Clears must be emitted immediately after the flush. */ /* HiZ clear */ struct r300_atom hiz_clear; /* zmask clear */ struct r300_atom zmask_clear; /* cmask clear */ struct r300_atom cmask_clear; /* Anti-aliasing (MSAA) state. */ struct r300_atom aa_state; /* Framebuffer state. */ struct r300_atom fb_state; /* HyperZ state (various SC/ZB bits). */ struct r300_atom hyperz_state; /* ZTOP state. */ struct r300_atom ztop_state; /* Depth, stencil, and alpha state. */ struct r300_atom dsa_state; /* Blend state. */ struct r300_atom blend_state; /* Blend color state. */ struct r300_atom blend_color_state; /* Scissor state. */ struct r300_atom scissor_state; /* Sample mask. */ struct r300_atom sample_mask; /* Invariant state. This must be emitted to get the engine started. */ struct r300_atom invariant_state; /* Viewport state. */ struct r300_atom viewport_state; /* PVS flush. */ struct r300_atom pvs_flush; /* VAP invariant state. */ struct r300_atom vap_invariant_state; /* Vertex stream formatting state. */ struct r300_atom vertex_stream_state; /* Vertex shader. */ struct r300_atom vs_state; /* User clip planes. */ struct r300_atom clip_state; /* RS block state + VAP (vertex shader) output mapping state. */ struct r300_atom rs_block_state; /* Rasterizer state. */ struct r300_atom rs_state; /* Framebuffer state (pipelined regs). */ struct r300_atom fb_state_pipelined; /* Fragment shader. */ struct r300_atom fs; /* Fragment shader RC_CONSTANT_STATE variables. */ struct r300_atom fs_rc_constant_state; /* Fragment shader constant buffer. */ struct r300_atom fs_constants; /* Vertex shader constant buffer. */ struct r300_atom vs_constants; /* Texture cache invalidate. */ struct r300_atom texture_cache_inval; /* Textures state. */ struct r300_atom textures_state; /* Occlusion query. */ struct r300_atom query_start; /* The pointers to the first and the last atom. */ struct r300_atom *first_dirty, *last_dirty; /* Vertex elements for Gallium. */ struct r300_vertex_element_state *velems; /* Vertex info for Draw. */ struct vertex_info vertex_info; struct pipe_stencil_ref stencil_ref; struct pipe_viewport_state viewport; /* Stream locations for SWTCL. */ int stream_loc_notcl[16]; /* Flag indicating whether or not the HW is dirty. */ uint32_t dirty_hw; /* Whether polygon offset is enabled. */ boolean polygon_offset_enabled; /* Z buffer bit depth. */ uint32_t zbuffer_bpp; /* Whether rendering is conditional and should be skipped. */ boolean skip_rendering; /* The flag above saved by blitter. */ unsigned char blitter_saved_skip_rendering; /* Point sprites texcoord index, 1 bit per texcoord */ int sprite_coord_enable; /* Whether two-sided color selection is enabled (AKA light_twoside). */ boolean two_sided_color; boolean flatshade; boolean clip_halfz; /* Whether fast color clear is enabled. */ boolean cbzb_clear; /* Whether fragment shader needs to be validated. */ enum r300_fs_validity_status fs_status; /* Framebuffer multi-write. */ boolean fb_multiwrite; unsigned num_samples; boolean msaa_enable; boolean alpha_to_one; boolean alpha_to_coverage; void *dsa_decompress_zmask; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; unsigned nr_vertex_buffers; struct u_upload_mgr *uploader; struct slab_child_pool pool_transfers; /* Stat counter. */ uint64_t flush_counter; /* const tracking for VS */ int vs_const_base; /* Vertex array state info */ boolean vertex_arrays_dirty; boolean vertex_arrays_indexed; int vertex_arrays_offset; int vertex_arrays_instance_id; boolean instancing_enabled; /* Hyper-Z stats. */ boolean hyperz_enabled; /* Whether it owns Hyper-Z access. */ int64_t hyperz_time_of_last_flush; /* Time of the last flush with Z clear. */ unsigned num_z_clears; /* Since the last flush. */ /* ZMask state. */ boolean zmask_in_use; /* Whether ZMASK is enabled. */ boolean zmask_decompress; /* Whether ZMASK is being decompressed. */ struct pipe_surface *locked_zbuffer; /* Unbound zbuffer which still has data in ZMASK. */ /* HiZ state. */ boolean hiz_in_use; /* Whether HIZ is enabled. */ enum r300_hiz_func hiz_func; /* HiZ function. Can be either MIN or MAX. */ uint32_t hiz_clear_value; /* HiZ clear value. */ /* CMASK state. */ boolean cmask_access; boolean cmask_in_use; uint32_t color_clear_value; /* RGBA8 or RGBA1010102 */ uint32_t color_clear_value_ar; /* RGBA16F */ uint32_t color_clear_value_gb; /* RGBA16F */ /* Compiler state. */ struct rc_regalloc_state fs_regalloc_state; /* Register allocator info for * fragment shaders. */ }; #define foreach_atom(r300, atom) \ for (atom = &r300->gpu_flush; atom != (&r300->query_start)+1; atom++) #define foreach_dirty_atom(r300, atom) \ for (atom = r300->first_dirty; atom != r300->last_dirty; atom++) /* Convenience cast wrappers. */ static inline struct r300_query* r300_query(struct pipe_query* q) { return (struct r300_query*)q; } static inline struct r300_surface* r300_surface(struct pipe_surface* surf) { return (struct r300_surface*)surf; } static inline struct r300_resource* r300_resource(struct pipe_resource* tex) { return (struct r300_resource*)tex; } static inline struct r300_context* r300_context(struct pipe_context* context) { return (struct r300_context*)context; } static inline struct r300_fragment_shader *r300_fs(struct r300_context *r300) { return (struct r300_fragment_shader*)r300->fs.state; } static inline void r300_mark_atom_dirty(struct r300_context *r300, struct r300_atom *atom) { atom->dirty = TRUE; if (!r300->first_dirty) { r300->first_dirty = atom; r300->last_dirty = atom+1; } else { if (atom < r300->first_dirty) r300->first_dirty = atom; else if (atom+1 > r300->last_dirty) r300->last_dirty = atom+1; } } static inline struct pipe_surface * r300_get_nonnull_cb(struct pipe_framebuffer_state *fb, unsigned i) { if (fb->cbufs[i]) return fb->cbufs[i]; /* The i-th framebuffer is NULL, return any non-NULL one. */ for (i = 0; i < fb->nr_cbufs; i++) if (fb->cbufs[i]) return fb->cbufs[i]; return NULL; } struct pipe_context* r300_create_context(struct pipe_screen* screen, void *priv, unsigned flags); /* Context initialization. */ struct draw_stage* r300_draw_stage(struct r300_context* r300); void r300_init_blit_functions(struct r300_context *r300); void r300_init_flush_functions(struct r300_context* r300); void r300_init_query_functions(struct r300_context* r300); void r300_init_render_functions(struct r300_context *r300); void r300_init_state_functions(struct r300_context* r300); void r300_init_resource_functions(struct r300_context* r300); /* r300_blit.c */ void r300_decompress_zmask(struct r300_context *r300); void r300_decompress_zmask_locked_unsafe(struct r300_context *r300); void r300_decompress_zmask_locked(struct r300_context *r300); bool r300_is_blit_supported(enum pipe_format format); /* r300_flush.c */ void r300_flush(struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence); /* r300_hyperz.c */ void r300_update_hyperz_state(struct r300_context* r300); /* r300_query.c */ void r300_resume_query(struct r300_context *r300, struct r300_query *query); void r300_stop_query(struct r300_context *r300); /* r300_render_translate.c */ void r300_translate_index_buffer(struct r300_context *r300, const struct pipe_draw_info *info, struct pipe_resource **out_index_buffer, unsigned *index_size, unsigned index_offset, unsigned *start, unsigned count); /* r300_render_stencilref.c */ void r300_plug_in_stencil_ref_fallback(struct r300_context *r300); /* r300_render.c */ void r500_emit_index_bias(struct r300_context *r300, int index_bias); void r300_blitter_draw_rectangle(struct blitter_context *blitter, void *vertex_elements_cso, blitter_get_vs_func get_vs, int x1, int y1, int x2, int y2, float depth, unsigned num_instances, enum blitter_attrib_type type, const union blitter_attrib *attrib); /* r300_state.c */ enum r300_fb_state_change { R300_CHANGED_FB_STATE = 0, R300_CHANGED_HYPERZ_FLAG, R300_CHANGED_MULTIWRITE, R300_CHANGED_CMASK_ENABLE, }; void r300_mark_fb_state_dirty(struct r300_context *r300, enum r300_fb_state_change change); void r300_mark_fs_code_dirty(struct r300_context *r300); struct pipe_sampler_view * r300_create_sampler_view_custom(struct pipe_context *pipe, struct pipe_resource *texture, const struct pipe_sampler_view *templ, unsigned width0_override, unsigned height0_override); /* r300_state_derived.c */ void r300_update_derived_state(struct r300_context* r300); /* r300_debug.c */ void r500_dump_rs_block(struct r300_rs_block *rs); static inline boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags) { return SCREEN_DBG_ON(ctx->screen, flags); } static inline void CTX_DBG(struct r300_context * ctx, unsigned flags, const char * fmt, ...) { if (CTX_DBG_ON(ctx, flags)) { va_list va; va_start(va, fmt); vfprintf(stderr, fmt, va); va_end(va); } } #define DBG_ON CTX_DBG_ON #define DBG CTX_DBG #endif /* R300_CONTEXT_H */
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2011 * Heiko Schocher, DENX Software Engineering, [email protected]. */ #include <common.h> #include <nand.h> /* * The main entry for NAND booting. It's necessary that SDRAM is already * configured and available since this code loads the main U-Boot image * from NAND into SDRAM and starts it from there. */ void nand_boot(void) { __attribute__((noreturn)) void (*uboot)(void); /* * Load U-Boot image from NAND into RAM */ nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, (void *)CONFIG_SYS_NAND_U_BOOT_DST); #ifdef CONFIG_NAND_ENV_DST nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, (void *)CONFIG_NAND_ENV_DST); #ifdef CONFIG_ENV_OFFSET_REDUND nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); #endif #endif /* * Jump to U-Boot image */ uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; (*uboot)(); }
{ "pile_set_name": "Github" }
from io import open from setuptools import find_packages, setup def parse_requirements(filename): """ Parse a requirements pip file returning the list of required packages. It exclude commented lines and --find-links directives. Args: filename: pip requirements requirements Returns: list of required package with versions constraints """ with open(filename) as file: parsed_requirements = file.read().splitlines() parsed_requirements = [line.strip() for line in parsed_requirements if not ((line.strip()[0] == "#") or line.strip().startswith('--find-links') or ("git+https" in line))] return parsed_requirements def get_dependency_links(filename): """ Parse a requirements pip file looking for the --find-links directive. Args: filename: pip requirements requirements Returns: list of find-links's url """ with open(filename) as file: parsed_requirements = file.read().splitlines() dependency_links = list() for line in parsed_requirements: line = line.strip() if line.startswith('--find-links'): dependency_links.append(line.split('=')[1]) return dependency_links dependency_links = get_dependency_links('requirements.txt') parsed_requirements = parse_requirements('requirements.txt') setup( name="farm-haystack", version="0.4.0", author="Malte Pietsch, Timo Moeller, Branden Chan, Tanay Soni", author_email="[email protected]", description="Neural Question Answering at Scale. Use modern transformer based models like BERT to find answers in large document collections", long_description=open("README.rst", "r", encoding="utf-8").read(), long_description_content_type="text/x-rst", keywords="QA Question-Answering Reader Retriever BERT roberta albert squad mrc transfer-learning language-model transformer", license="Apache", url="https://github.com/deepset-ai/haystack", download_url="https://github.com/deepset-ai/haystack/archive/0.4.0.tar.gz", packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), dependency_links=dependency_links, install_requires=parsed_requirements, python_requires=">=3.6.0", tests_require=["pytest"], classifiers=[ "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Artificial Intelligence", ], )
{ "pile_set_name": "Github" }
<?php namespace PHPCensor\Helper; use voku\helper\AntiXSS; class Template { /** * @var AntiXSS */ protected static $antiXss = null; /** * @param string $string * * @return string */ public static function clean($string) { if (self::$antiXss === null) { self::$antiXss = new AntiXSS(); } $antiXss = self::$antiXss; return $antiXss->xss_clean($string); } }
{ "pile_set_name": "Github" }
digraph "oneDegreeRelationshipsDiagram" { graph [ rankdir="RL" bgcolor="#ffffff" label="\nGenerated by SchemaSpy" labeljust="l" nodesep="0.18" ranksep="0.46" fontname="Helvetica" fontsize="11" ration="compress" ]; node [ fontname="Helvetica" fontsize="11" shape="plaintext" ]; edge [ arrowsize="0.8" ]; "user" [ label=< <TABLE BORDER="2" CELLBORDER="1" CELLSPACING="0" BGCOLOR="#ffffff"> <TR><TD COLSPAN="4" BGCOLOR="#f5f5f5"><TABLE BORDER="0" CELLSPACING="0"><TR><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="29" HEIGHT="16"><B>user</B></TD><TD ALIGN="RIGHT">[table]</TD></TR></TABLE></TD></TR> <TR><TD PORT="userId" COLSPAN="2" ALIGN="LEFT"><TABLE BORDER="0" CELLSPACING="0" ALIGN="LEFT"><TR ALIGN="LEFT"><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="15" HEIGHT="16"><IMG SRC="../../images/primaryKeys.png"/></TD><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="52" HEIGHT="16">userId</TD></TR></TABLE></TD><TD PORT="userId.type" ALIGN="LEFT">int[10]</TD></TR> <TR><TD PORT="groupId" COLSPAN="2" ALIGN="LEFT"><TABLE BORDER="0" CELLSPACING="0" ALIGN="LEFT"><TR ALIGN="LEFT"><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="15" HEIGHT="16"><IMG SRC="../../images/foreignKeys.png"/></TD><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="52" HEIGHT="16">groupId</TD></TR></TABLE></TD><TD PORT="groupId.type" ALIGN="LEFT">int[10]</TD></TR> <TR><TD PORT="name" COLSPAN="2" ALIGN="LEFT"><TABLE BORDER="0" CELLSPACING="0" ALIGN="LEFT"><TR ALIGN="LEFT"><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="15" HEIGHT="16"></TD><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="52" HEIGHT="16">name</TD></TR></TABLE></TD><TD PORT="name.type" ALIGN="LEFT">varchar[16]</TD></TR> <TR><TD PORT="email" COLSPAN="2" BGCOLOR="#ffffff" ALIGN="LEFT"><TABLE BORDER="0" CELLSPACING="0" ALIGN="LEFT"><TR ALIGN="LEFT"><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="15" HEIGHT="16"></TD><TD ALIGN="LEFT" FIXEDSIZE="TRUE" WIDTH="52" HEIGHT="16">email</TD></TR></TABLE></TD><TD PORT="email.type" ALIGN="LEFT">varchar[40]</TD></TR> <TR><TD ALIGN="LEFT" BGCOLOR="#ffffff">&lt; 0</TD><TD ALIGN="RIGHT" BGCOLOR="#ffffff">0 rows</TD><TD ALIGN="RIGHT" BGCOLOR="#ffffff">0 &gt;</TD></TR> </TABLE>> URL="../../tables/user.html" target="_top" tooltip="user" ]; }
{ "pile_set_name": "Github" }
#ifndef sodium_runtime_H #define sodium_runtime_H #include "export.h" #ifdef __cplusplus extern "C" { #endif SODIUM_EXPORT_WEAK int sodium_runtime_has_neon(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_sse2(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_sse3(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_ssse3(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_sse41(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_avx(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_avx2(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_avx512f(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_pclmul(void); SODIUM_EXPORT_WEAK int sodium_runtime_has_aesni(void); /* ------------------------------------------------------------------------- */ int _sodium_runtime_get_cpu_features(void); #ifdef __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
subroutine da_oi_stats_qscat (stats_unit, iv, ob) !----------------------------------------------------------------------- ! Purpose: TBD !----------------------------------------------------------------------- implicit none integer, intent (in) :: stats_unit ! Output unit for stats. type (iv_type), intent (in) :: iv ! OI type(y_type), intent (in) :: ob ! Observation structure. type (stats_qscat_type) :: stats integer :: nu, nv integer :: n real :: u_inv, v_inv, u_obs, v_obs if (trace_use_dull) call da_trace_entry("da_oi_stats_qscat") nu = 0 nv = 0 stats%maximum%u = maxmin_type(-1.0E+20, 0, 0) stats%maximum%v = maxmin_type(-1.0E+20, 0, 0) stats%minimum%u = maxmin_type(1.0E+20, 0, 0) stats%minimum%v = maxmin_type(1.0E+20, 0, 0) stats%average = residual_qscat1_type(0.0, 0.0) stats%rms_err = stats%average do n=1, iv%info(qscat)%nlocal if (iv%info(qscat)%proc_domain(1,n)) then u_inv = iv%qscat(n)%u%inv v_inv = iv%qscat(n)%v%inv u_obs = ob%qscat(n)%u v_obs = ob%qscat(n)%v if (.not. wind_sd_qscat .and. wind_stats_sd) & call da_ffdduv_diagnose(u_obs, u_inv, u_obs, v_obs, v_inv, v_obs, & iv%qscat(n)%u%qc, iv%qscat(n)%v%qc, convert_uv2fd) if (wind_sd_qscat .and. .not. wind_stats_sd) & call da_ffdduv_diagnose(u_obs, u_inv, u_obs, v_obs, v_inv, v_obs, & iv%qscat(n)%u%qc, iv%qscat(n)%v%qc, convert_fd2uv) call da_stats_calculate(n, 0, iv%qscat(n)%u%qc, u_inv, nu, & stats%minimum%u, stats%maximum%u, stats%average%u, stats%rms_err%u) call da_stats_calculate(n, 0, iv%qscat(n)%v%qc, v_inv, nv, & stats%minimum%v, stats%maximum%v, stats%average%v, stats%rms_err%v) end if ! end if (iv%info(qscat)%proc_domain(1,n)) end do ! Do inter-processor communication to gather statistics. call da_proc_sum_int(nu) call da_proc_sum_int(nv) call da_proc_stats_combine(stats%average%u, stats%rms_err%u, & stats%minimum%u%value, stats%maximum%u%value, & stats%minimum%u%n, stats%maximum%u%n, & stats%minimum%u%l, stats%maximum%u%l) call da_proc_stats_combine(stats%average%v, stats%rms_err%v, & stats%minimum%v%value, stats%maximum%v%value, & stats%minimum%v%n, stats%maximum%v%n, & stats%minimum%v%l, stats%maximum%v%l) if (rootproc) then if (nu /= 0 .or. nv /= 0) then write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of OI for qscat' call da_print_stats_qscat(stats_unit, nu, nv, stats) end if end if if (trace_use_dull) call da_trace_exit("da_oi_stats_qscat") end subroutine da_oi_stats_qscat
{ "pile_set_name": "Github" }
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ module VZ.Sorting { /** * Compares tag names asciinumerically broken into components. * * <p>This is the comparison function used for sorting most string values in * TensorBoard. Unlike the standard asciibetical comparator, this function * knows that 'a10b' > 'a2b'. Fixed point and engineering notation are * supported. This function also splits the input by slash and underscore to * perform array comparison. Therefore it knows that 'a/a' < 'a+/a' even * though '+' < '/' in the ASCII table. */ export function compareTagNames(a, b: string): number { let ai = 0; let bi = 0; while (true) { if (ai === a.length) { return bi === b.length ? 0 : -1; } if (bi === b.length) { return 1; } if (isDigit(a[ai]) && isDigit(b[bi])) { const ais = ai; const bis = bi; ai = consumeNumber(a, ai + 1); bi = consumeNumber(b, bi + 1); const an = parseFloat(a.slice(ais, ai)); const bn = parseFloat(b.slice(bis, bi)); if (an < bn) { return -1; } if (an > bn) { return 1; } continue; } if (isBreak(a[ai])) { if (!isBreak(b[bi])) { return -1; } } else if (isBreak(b[bi])) { return 1; } else if (a[ai] < b[bi]) { return -1; } else if (a[ai] > b[bi]) { return 1; } ai++; bi++; } } function consumeNumber(s: string, i: number): number { enum State { NATURAL, REAL, EXPONENT_SIGN, EXPONENT } let state = State.NATURAL; for (; i < s.length; i++) { if (state === State.NATURAL) { if (s[i] === '.') { state = State.REAL; } else if (s[i] === 'e' || s[i] === 'E') { state = State.EXPONENT_SIGN; } else if (!isDigit(s[i])) { break; } } else if (state === State.REAL) { if (s[i] === 'e' || s[i] === 'E') { state = State.EXPONENT_SIGN; } else if (!isDigit(s[i])) { break; } } else if (state === State.EXPONENT_SIGN) { if (isDigit(s[i]) || s[i] === '+' || s[i] === '-') { state = State.EXPONENT; } else { break; } } else if (state === State.EXPONENT) { if (!isDigit(s[i])) { break; } } } return i; } function isDigit(c: string): boolean { return '0' <= c && c <= '9'; } function isBreak(c: string): boolean { // TODO(jart): Remove underscore when people stop using it like a slash. return c === '/' || c === '_' || isDigit(c); } }
{ "pile_set_name": "Github" }
using GameObjects; using GameObjects.Conditions; using System; using System.Runtime.Serialization;namespace GameObjects.Conditions.ConditionKindPack { [DataContract]public class ConditionKind2370 : ConditionKind { private int val; public override bool CheckConditionKind(Architecture a) { return a.BuildingDaysLeft >= val; } public override void InitializeParameter(string parameter) { try { this.val = int.Parse(parameter); } catch { } } } }
{ "pile_set_name": "Github" }
package wsevent import ( "sync" "github.com/douyu/jupiter/pkg/xlog" ) type ( WSEvent struct { option Option subscribersMtx sync.Mutex subscribers map[string][]SubscribeHandler } Option struct { } SubscribeHandler func(res interface{}) ) var ( instance *WSEvent ) func Init(o Option) { instance = &WSEvent{ option: o, subscribersMtx: sync.Mutex{}, subscribers: map[string][]SubscribeHandler{}, } } func Instance() *WSEvent { if instance == nil { xlog.Fatalf("wsevent MUST be initialized before call wsevent.Instance()") } return instance } func (w *WSEvent) Pub(event string, data interface{}) { w.subscribersMtx.Lock() defer w.subscribersMtx.Unlock() subs := w.subscribers[event] go func() { for _, sub := range subs { sub(data) } }() } func (w *WSEvent) RemoveEvent(event string) { w.subscribersMtx.Lock() defer w.subscribersMtx.Unlock() w.subscribers[event] = make([]SubscribeHandler, 0) } func (w *WSEvent) Sub(event string, handler SubscribeHandler) { w.subscribersMtx.Lock() defer w.subscribersMtx.Unlock() w.subscribers[event] = append(w.subscribers[event], handler) }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <UI> <Dialog Id="ExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)"> <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" /> <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUICancel)" /> <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.ExitDialogBitmap)" /> <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" /> <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" /> <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" /> <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" /> <Control Id="OptionalText" Type="Text" X="135" Y="110" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="[WIXUI_EXITDIALOGOPTIONALTEXT]"> <Condition Action="show">WIXUI_EXITDIALOGOPTIONALTEXT AND NOT Installed</Condition> </Control> <Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]"> <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition> </Control> </Dialog> <InstallUISequence> <Show Dialog="ExitDialog" OnExit="success" Overridable="yes" /> </InstallUISequence> <AdminUISequence> <Show Dialog="ExitDialog" OnExit="success" Overridable="yes" /> </AdminUISequence> </UI> </Fragment> </Wix>
{ "pile_set_name": "Github" }
var assert = require('assert'); var browserify = require('../'); var vm = require('vm'); var test = require('tap').test; test('fieldString', function (t) { t.plan(1); var dir = __dirname + '/field/'; var src = browserify({ require : dir + '/string.js' }).bundle(); var c = {}; vm.runInNewContext(src, c); t.equal( c.require('./string.js'), 'browser' ); t.end(); }); test('fieldObject', function (t) { t.plan(1); var dir = __dirname + '/field/'; var src = browserify({ require : dir + '/object.js' }).bundle(); var c = {}; vm.runInNewContext(src, c); t.equal( c.require('./object.js'), 'browser' ); t.end(); }); test('missObject', function (t) { t.plan(1); var dir = __dirname + '/field/'; var src = browserify({ require : dir + '/miss.js' }).bundle(); var c = {}; vm.runInNewContext(src, c); t.equal( c.require('./miss.js'), '!browser' ); t.end(); }); test('fieldSub', function (t) { t.plan(1); var dir = __dirname + '/field/'; var src = browserify({ require : dir + '/sub.js' }).bundle(); var c = {}; vm.runInNewContext(src, c); t.equal( c.require('./sub.js'), 'browser' ); t.end(); });
{ "pile_set_name": "Github" }
/** * Malay translation for bootstrap-datetimepicker * Ateman Faiz <[email protected]> */ ;(function($){ $.fn.datetimepicker.dates['ms'] = { days: ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu", "Ahad"], daysShort: ["Aha", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab", "Aha"], daysMin: ["Ah", "Is", "Se", "Ra", "Kh", "Ju", "Sa", "Ah"], months: ["Januari", "Februari", "Mac", "April", "Mei", "Jun", "Julai", "Ogos", "September", "Oktober", "November", "Disember"], monthsShort: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ogo", "Sep", "Okt", "Nov", "Dis"], today: "Hari Ini", suffix: [], meridiem: [] }; }(jQuery));
{ "pile_set_name": "Github" }
/* * Copyright © 2012, United States Government, as represented by the * Administrator of the National Aeronautics and Space Administration. * All rights reserved. * * The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is 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. */ /** * @file tgSensor.h * @brief Constains definition of abstract class tgSensor, which defines the methods that a sensor must implement. * @author Drew Sabelhaus * $Id$ */ #ifndef TG_SENSOR_H #define TG_SENSOR_H // Forward-declare the tgSenseable class, // so that we can have pointers to it. class tgSenseable; // From the C++ standard library: #include <iostream> //for strings #include <vector> // for returning lists of strings /** * This class defines methods for use with sensors. * Any individual sensor (ex., a tgRodSensor) will need to re-implement * both of these methods. * Note that we make everything pure virtual here to force re-definition. * Sensing data from objects occurs in two places in the NTRTsim workflow. * First, when setting up the simulation, a heading for the data is given. * This describes the data that will be returned. * Second, when the simulation is running, the data itself can be taken. * Note that it's up to the caller (e.g., a tgDataLogger2) to match up the headings * with the data. */ class tgSensor { public: /** * This constructor takes a pointer to a sense-able object. * Note that this creates complications with casting: in child classes, * this pointer will need to be casted to the particular type of sense-able * object that a sensor works on. * The reason why we declare it here as a pointer to the parent class * is for setup reasons: we want a tgDataLogger2 to be able to ask this * class, "Can you sense a particular tgSenseable?". * The way to do that is to pass in a pointer of the parent type, * and attempt a cast to the child type via a call to tgCast. */ tgSensor(tgSenseable* pSens); // Classes with virtual member functions must also have virtual destructors. virtual ~tgSensor(); /** * Create a descriptive heading for all the data that this class can return. * This will be a vector of strings, with each string being a heading. * Headings should have the following form: * The type of sensor, then an open parenthesis "(" and the tags * of the specific tgSenseable object, then a ")." and a label for the * specific field that will be output in that row. * For example, if sensor will be sensing a rod * with tags "t4 t5", its label for the X position might be "rod(t4 t5).X" * @return a list of strings, each being a descriptive heading for a * specific piece of data that will be returned. */ virtual std::vector<std::string> getSensorDataHeadings() = 0; /** * Return the data from this class itself. * Note that this MUST have the same number of elements as is returned by * the getDataHeading function. * @return a list of strings, each being a piece of sensor data, * in the same order as the headings. */ virtual std::vector<std::string> getSensorData() = 0; // TO-DO: should any of this be const? protected: /** * This class stores a pointer to its tgSenseable object. * Note that it is protected so that subclasses can access it, * but children will still need to cast it against their specific * type of tgSenseable (e.g., rod, cable, etc.) */ tgSenseable* m_pSens; }; #endif //TG_SENSOR_H
{ "pile_set_name": "Github" }
* * the following review contains spoilers * * " please someone stop joel schumacher before he vomits into a film canister again and tries to pass it off as a movie . " -- chuck dowling , the jacksonville film journal i wrote the above sentence in my review for 1997's batman and robin . apparently , no one heard my words . oh , how i wish you had heard them . oh how i wish someone had stopped him . . . because he's done it again . the plot of 8mm is similar to the 1977 paul schrader film hardcore , a surprisingly decent and engrossing tale . in fact , it was everything that 8mm is not . in the opening minutes of 8mm , we see private detective tom welles ( nicolas cage ) working on a case for a prestigious member of the u . s . government . keep this fact in mind , cage is trusted with an important case , which he solves . he returns home to his wife and new daughter , and even finds time to rake his yard ( keep that in mind too , it's important as well ) . he's hired by a rich elderly woman to solve a mystery . after her husband's death she comes across a film in his private safe . it appears to be snuff film , a sort of urban legend of the pornography industry in which someone is actually brutally murdered for the camera . the woman wants welles to locate the young girl in the film , hopefully to disprove that it is in fact a snuff film . so he sets off on a journey into the sordid underworld of sleaze to discover the truth about the film . the main problem with 8mm is that the whole film is completely pointless . welles is actually selected for the case by the old woman's lawyer ( anthony heald , an actor who always plays the same type of character , that being a bad guy ) . when you first see him , your first instinct is that he's behind the whole thing . the choice of casting does the film in . then , as welles begins his investigation , at times we will see a shadowy figure following him . the only person it could possibly be is the lawyer ( or someone sent by the lawyer ) because no one knows welles is even investigating anything yet . so your first instinct has now been confirmed . then , when it is in fact revealed that the lawyer is a part of the whole thing , he tells welles that he was chosen for the case because he was young and inexperienced ( in one of those ridiculous " since we're going to kill you anyway , why not tell you the whole thing " moments ) . but earlier when we see welles being hired for the case he's told that he was hired because he comes highly recommended . huh ? also , when the lawyer reveals himself to be a part of the whole thing , his main goal is to get the film back . so why did he give it up in the first place ? ! the lawyer had the film the whole time , then gave it away to the private detective thinking that he would just give up on the case and return the film ? ! it's totally absurd . . . and this is the screenwriter of seven ? late in the film there's a confrontation between all the main characters , and after a struggle one of the character's guns ends up underneath a car . cage , who has been handcuffed to a bed , is rapidly trying to get to his gun , which is on a table . james gandolfini's character goes for the gun under the car in what is supposed to be a scene of " suspense " . you see , the gun is just slightly out of reach from the side of the car he's trying to reach it from , and so instead of going around the car to the other side ( where he can easily reach it ) he just keeps stretching . go around to the other side of the car ! ! this goes on for minutes . then , after cage gets his gun , gandolfini then decides it would be best to go around to the other side of the car . boy , schumacher is really really getting on my nerves . i think the final straw would be when cage returns home , devastated by everything that he's seen on this case , and then is no longer able to rake his lawn ! we actually see a shot of him pathetically poking at leaves in his yard . other things that bugged me about 8mm : one would be the music , if you can call it that . whenever the score starts up , it sounds like techno music , and then this awful indian or middle eastern type music will accompany it . awful decision there joel . another is cage's performance . at this point he's capable of a wide range of performances , either good or bad . for 8mm , he delivers a very wooden one , and only shines when he's interacting with joaquin phoenix ( who gives a great performance as a porn shop clerk with a heart of gold who helps cage with his case ) . you're capable of much better mr . cage . now as for you mr . schumacher . . . i'm starting to doubt if you're capable of anything else besides urinating onto the institution of american cinema . [r]
{ "pile_set_name": "Github" }
# The MIT License # # Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant, Seiji Sogabe # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. Hudson\ is\ going\ to\ shut\ down=Hudson va s''\u00E9teindre
{ "pile_set_name": "Github" }
#!/bin/bash docker build -t mozilla/ssh_scan . if [[ "$TRAVIS_BRANCH" == "master" ]]; then if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then echo $DOCKER_PASS | docker login -u="$DOCKER_USER" --password-stdin;\ docker push mozilla/ssh_scan;\ else exit 0 fi else exit 0 fi
{ "pile_set_name": "Github" }
/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ var argscheck = require('cordova/argscheck'), exec = require('cordova/exec'), utils = require('cordova/utils'), CompassHeading = require('./CompassHeading'), CompassError = require('./CompassError'), timers = {}, eventTimerId = null, compass = { /** * Asynchronously acquires the current heading. * @param {Function} successCallback The function to call when the heading * data is available * @param {Function} errorCallback The function to call when there is an error * getting the heading data. * @param {CompassOptions} options The options for getting the heading data (not used). */ getCurrentHeading:function(successCallback, errorCallback, options) { argscheck.checkArgs('fFO', 'compass.getCurrentHeading', arguments); var win = function(result) { var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); successCallback(ch); }; var fail = errorCallback && function(code) { var ce = new CompassError(code); errorCallback(ce); }; // Get heading exec(win, fail, "Compass", "getHeading", [options]); }, /** * Asynchronously acquires the heading repeatedly at a given interval. * @param {Function} successCallback The function to call each time the heading * data is available * @param {Function} errorCallback The function to call when there is an error * getting the heading data. * @param {HeadingOptions} options The options for getting the heading data * such as timeout and the frequency of the watch. For iOS, filter parameter * specifies to watch via a distance filter rather than time. */ watchHeading:function(successCallback, errorCallback, options) { argscheck.checkArgs('fFO', 'compass.watchHeading', arguments); // Default interval (100 msec) var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; var id = utils.createUUID(); if (filter > 0) { // is an iOS request for watch by filter, no timer needed timers[id] = "iOS"; compass.getCurrentHeading(successCallback, errorCallback, options); } else { // Start watch timer to get headings timers[id] = window.setInterval(function() { compass.getCurrentHeading(successCallback, errorCallback); }, frequency); } if (cordova.platformId === 'browser' && !eventTimerId) { // Start firing deviceorientation events if haven't already var deviceorientationEvent = new Event('deviceorientation'); eventTimerId = window.setInterval(function() { window.dispatchEvent(deviceorientationEvent); }, 200); } return id; }, /** * Clears the specified heading watch. * @param {String} id The ID of the watch returned from #watchHeading. */ clearWatch:function(id) { // Stop javascript timer & remove from timer list if (id && timers[id]) { if (timers[id] != "iOS") { clearInterval(timers[id]); } else { // is iOS watch by filter so call into device to stop exec(null, null, "Compass", "stopHeading", []); } delete timers[id]; if (eventTimerId && Object.keys(timers).length === 0) { // No more watchers, so stop firing 'deviceorientation' events window.clearInterval(eventTimerId); eventTimerId = null; } } } }; module.exports = compass;
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0+ /* * PXA27x USB device driver for u-boot. * * Copyright (C) 2007 Rodolfo Giometti <[email protected]> * Copyright (C) 2007 Eurotech S.p.A. <[email protected]> * Copyright (C) 2008 Vivek Kutal <[email protected]> */ #include <common.h> #include <asm/arch/hardware.h> #include <asm/byteorder.h> #include <asm/io.h> #include <usbdevice.h> #include <usb/pxa27x_udc.h> #include <usb/udc.h> #include "ep0.h" /* number of endpoints on this UDC */ #define UDC_MAX_ENDPOINTS 24 static struct urb *ep0_urb; static struct usb_device_instance *udc_device; static int ep0state = EP0_IDLE; #ifdef USBDDBG static void udc_dump_buffer(char *name, u8 *buf, int len) { usbdbg("%s - buf %p, len %d", name, buf, len); print_buffer(0, buf, 1, len, 0); } #else #define udc_dump_buffer(name, buf, len) /* void */ #endif static inline void udc_ack_int_UDCCR(int mask) { writel(readl(USIR1) | mask, USIR1); } /* * If the endpoint has an active tx_urb, then the next packet of data from the * URB is written to the tx FIFO. * The total amount of data in the urb is given by urb->actual_length. * The maximum amount of data that can be sent in any one packet is given by * endpoint->tx_packetSize. * The number of data bytes from this URB that have already been transmitted * is given by endpoint->sent. * endpoint->last is updated by this routine with the number of data bytes * transmitted in this packet. */ static int udc_write_urb(struct usb_endpoint_instance *endpoint) { struct urb *urb = endpoint->tx_urb; int ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; u32 *data32 = (u32 *) urb->buffer; u8 *data8 = (u8 *) urb->buffer; unsigned int i, n, w, b, is_short; int timeout = 2000; /* 2ms */ if (!urb || !urb->actual_length) return -1; n = min_t(unsigned int, urb->actual_length - endpoint->sent, endpoint->tx_packetSize); if (n <= 0) return -1; usbdbg("write urb on ep %d", ep_num); #if defined(USBDDBG) && defined(USBDPARANOIA) usbdbg("urb: buf %p, buf_len %d, actual_len %d", urb->buffer, urb->buffer_length, urb->actual_length); usbdbg("endpoint: sent %d, tx_packetSize %d, last %d", endpoint->sent, endpoint->tx_packetSize, endpoint->last); #endif is_short = n != endpoint->tx_packetSize; w = n / 4; b = n % 4; usbdbg("n %d%s w %d b %d", n, is_short ? "-s" : "", w, b); udc_dump_buffer("urb write", data8 + endpoint->sent, n); /* Prepare for data send */ if (ep_num) writel(UDCCSR_PC ,UDCCSN(ep_num)); for (i = 0; i < w; i++) writel(data32[endpoint->sent / 4 + i], UDCDN(ep_num)); for (i = 0; i < b; i++) writeb(data8[endpoint->sent + w * 4 + i], UDCDN(ep_num)); /* Set "Packet Complete" if less data then tx_packetSize */ if (is_short) writel(ep_num ? UDCCSR_SP : UDCCSR0_IPR, UDCCSN(ep_num)); /* Wait for data sent */ if (ep_num) { while (!(readl(UDCCSN(ep_num)) & UDCCSR_PC)) { if (timeout-- == 0) return -1; else udelay(1); } } endpoint->last = n; if (ep_num) { usbd_tx_complete(endpoint); } else { endpoint->sent += n; endpoint->last -= n; } if (endpoint->sent >= urb->actual_length) { urb->actual_length = 0; endpoint->sent = 0; endpoint->last = 0; } if ((endpoint->sent >= urb->actual_length) && (!ep_num)) { usbdbg("ep0 IN stage done"); if (is_short) ep0state = EP0_IDLE; else ep0state = EP0_XFER_COMPLETE; } return 0; } static int udc_read_urb(struct usb_endpoint_instance *endpoint) { struct urb *urb = endpoint->rcv_urb; int ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; u32 *data32 = (u32 *) urb->buffer; unsigned int i, n; usbdbg("read urb on ep %d", ep_num); #if defined(USBDDBG) && defined(USBDPARANOIA) usbdbg("urb: buf %p, buf_len %d, actual_len %d", urb->buffer, urb->buffer_length, urb->actual_length); usbdbg("endpoint: rcv_packetSize %d", endpoint->rcv_packetSize); #endif if (readl(UDCCSN(ep_num)) & UDCCSR_BNE) n = readl(UDCBCN(ep_num)) & 0x3ff; else /* zlp */ n = 0; usbdbg("n %d%s", n, n != endpoint->rcv_packetSize ? "-s" : ""); for (i = 0; i < n; i += 4) data32[urb->actual_length / 4 + i / 4] = readl(UDCDN(ep_num)); udc_dump_buffer("urb read", (u8 *) data32, urb->actual_length + n); usbd_rcv_complete(endpoint, n, 0); return 0; } static int udc_read_urb_ep0(void) { u32 *data32 = (u32 *) ep0_urb->buffer; u8 *data8 = (u8 *) ep0_urb->buffer; unsigned int i, n, w, b; usbdbg("read urb on ep 0"); #if defined(USBDDBG) && defined(USBDPARANOIA) usbdbg("urb: buf %p, buf_len %d, actual_len %d", ep0_urb->buffer, ep0_urb->buffer_length, ep0_urb->actual_length); #endif n = readl(UDCBCR0); w = n / 4; b = n % 4; for (i = 0; i < w; i++) { data32[ep0_urb->actual_length / 4 + i] = readl(UDCDN(0)); /* ep0_urb->actual_length += 4; */ } for (i = 0; i < b; i++) { data8[ep0_urb->actual_length + w * 4 + i] = readb(UDCDN(0)); /* ep0_urb->actual_length++; */ } ep0_urb->actual_length += n; udc_dump_buffer("urb read", (u8 *) data32, ep0_urb->actual_length); writel(UDCCSR0_OPC | UDCCSR0_IPR, UDCCSR0); if (ep0_urb->actual_length == ep0_urb->device_request.wLength) return 1; return 0; } static void udc_handle_ep0(struct usb_endpoint_instance *endpoint) { u32 udccsr0 = readl(UDCCSR0); u32 *data = (u32 *) &ep0_urb->device_request; int i; usbdbg("udccsr0 %x", udccsr0); /* Clear stall status */ if (udccsr0 & UDCCSR0_SST) { usberr("clear stall status"); writel(UDCCSR0_SST, UDCCSR0); ep0state = EP0_IDLE; } /* previous request unfinished? non-error iff back-to-back ... */ if ((udccsr0 & UDCCSR0_SA) != 0 && ep0state != EP0_IDLE) ep0state = EP0_IDLE; switch (ep0state) { case EP0_IDLE: udccsr0 = readl(UDCCSR0); /* Start control request? */ if ((udccsr0 & (UDCCSR0_OPC | UDCCSR0_SA | UDCCSR0_RNE)) == (UDCCSR0_OPC | UDCCSR0_SA | UDCCSR0_RNE)) { /* Read SETUP packet. * SETUP packet size is 8 bytes (aka 2 words) */ usbdbg("try reading SETUP packet"); for (i = 0; i < 2; i++) { if ((readl(UDCCSR0) & UDCCSR0_RNE) == 0) { usberr("setup packet too short:%d", i); goto stall; } data[i] = readl(UDCDR0); } writel(readl(UDCCSR0) | UDCCSR0_OPC | UDCCSR0_SA, UDCCSR0); if ((readl(UDCCSR0) & UDCCSR0_RNE) != 0) { usberr("setup packet too long"); goto stall; } udc_dump_buffer("ep0 setup read", (u8 *) data, 8); if (ep0_urb->device_request.wLength == 0) { usbdbg("Zero Data control Packet\n"); if (ep0_recv_setup(ep0_urb)) { usberr("Invalid Setup Packet\n"); udc_dump_buffer("ep0 setup read", (u8 *)data, 8); goto stall; } writel(UDCCSR0_IPR, UDCCSR0); ep0state = EP0_IDLE; } else { /* Check direction */ if ((ep0_urb->device_request.bmRequestType & USB_REQ_DIRECTION_MASK) == USB_REQ_HOST2DEVICE) { ep0state = EP0_OUT_DATA; ep0_urb->buffer = (u8 *)ep0_urb->buffer_data; ep0_urb->buffer_length = sizeof(ep0_urb->buffer_data); ep0_urb->actual_length = 0; writel(UDCCSR0_IPR, UDCCSR0); } else { /* The ep0_recv_setup function has * already placed our response packet * data in ep0_urb->buffer and the * packet length in * ep0_urb->actual_length. */ if (ep0_recv_setup(ep0_urb)) { stall: usberr("Invalid setup packet"); udc_dump_buffer("ep0 setup read" , (u8 *) data, 8); ep0state = EP0_IDLE; writel(UDCCSR0_SA | UDCCSR0_OPC | UDCCSR0_FST | UDCCS0_FTF, UDCCSR0); return; } endpoint->tx_urb = ep0_urb; endpoint->sent = 0; usbdbg("EP0_IN_DATA"); ep0state = EP0_IN_DATA; if (udc_write_urb(endpoint) < 0) goto stall; } } return; } else if ((udccsr0 & (UDCCSR0_OPC | UDCCSR0_SA)) == (UDCCSR0_OPC|UDCCSR0_SA)) { usberr("Setup Active but no data. Stalling ....\n"); goto stall; } else { usbdbg("random early IRQs"); /* Some random early IRQs: * - we acked FST * - IPR cleared * - OPC got set, without SA (likely status stage) */ writel(udccsr0 & (UDCCSR0_SA | UDCCSR0_OPC), UDCCSR0); } break; case EP0_OUT_DATA: if ((udccsr0 & UDCCSR0_OPC) && !(udccsr0 & UDCCSR0_SA)) { if (udc_read_urb_ep0()) { read_complete: ep0state = EP0_IDLE; if (ep0_recv_setup(ep0_urb)) { /* Not a setup packet, stall next * EP0 transaction */ udc_dump_buffer("ep0 setup read", (u8 *) data, 8); usberr("can't parse setup packet\n"); goto stall; } } } else if (!(udccsr0 & UDCCSR0_OPC) && !(udccsr0 & UDCCSR0_IPR)) { if (ep0_urb->device_request.wLength == ep0_urb->actual_length) goto read_complete; usberr("Premature Status\n"); ep0state = EP0_IDLE; } break; case EP0_IN_DATA: /* GET_DESCRIPTOR etc */ if (udccsr0 & UDCCSR0_OPC) { writel(UDCCSR0_OPC | UDCCSR0_FTF, UDCCSR0); usberr("ep0in premature status"); ep0state = EP0_IDLE; } else { /* irq was IPR clearing */ if (udc_write_urb(endpoint) < 0) { usberr("ep0_write_error\n"); goto stall; } } break; case EP0_XFER_COMPLETE: writel(UDCCSR0_IPR, UDCCSR0); ep0state = EP0_IDLE; break; default: usbdbg("Default\n"); } writel(USIR0_IR0, USIR0); } static void udc_handle_ep(struct usb_endpoint_instance *endpoint) { int ep_addr = endpoint->endpoint_address; int ep_num = ep_addr & USB_ENDPOINT_NUMBER_MASK; int ep_isout = (ep_addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT; u32 flags = readl(UDCCSN(ep_num)) & (UDCCSR_SST | UDCCSR_TRN); if (flags) writel(flags, UDCCSN(ep_num)); if (ep_isout) udc_read_urb(endpoint); else udc_write_urb(endpoint); writel(UDCCSR_PC, UDCCSN(ep_num)); } static void udc_state_changed(void) { writel(readl(UDCCR) | UDCCR_SMAC, UDCCR); usbdbg("New UDC settings are: conf %d - inter %d - alter %d", (readl(UDCCR) & UDCCR_ACN) >> UDCCR_ACN_S, (readl(UDCCR) & UDCCR_AIN) >> UDCCR_AIN_S, (readl(UDCCR) & UDCCR_AAISN) >> UDCCR_AAISN_S); usbd_device_event_irq(udc_device, DEVICE_CONFIGURED, 0); writel(UDCISR1_IRCC, UDCISR1); } void udc_irq(void) { int handled; struct usb_endpoint_instance *endpoint; int ep_num, i; u32 udcisr0; do { handled = 0; /* Suspend Interrupt Request */ if (readl(USIR1) & UDCCR_SUSIR) { usbdbg("Suspend\n"); udc_ack_int_UDCCR(UDCCR_SUSIR); handled = 1; ep0state = EP0_IDLE; } /* Resume Interrupt Request */ if (readl(USIR1) & UDCCR_RESIR) { udc_ack_int_UDCCR(UDCCR_RESIR); handled = 1; usbdbg("USB resume\n"); } if (readl(USIR1) & (1<<31)) { handled = 1; udc_state_changed(); } /* Reset Interrupt Request */ if (readl(USIR1) & UDCCR_RSTIR) { udc_ack_int_UDCCR(UDCCR_RSTIR); handled = 1; usbdbg("Reset\n"); usbd_device_event_irq(udc_device, DEVICE_RESET, 0); } else { if (readl(USIR0)) usbdbg("UISR0: %x \n", readl(USIR0)); if (readl(USIR0) & 0x2) writel(0x2, USIR0); /* Control traffic */ if (readl(USIR0) & USIR0_IR0) { handled = 1; writel(USIR0_IR0, USIR0); udc_handle_ep0(udc_device->bus->endpoint_array); } endpoint = udc_device->bus->endpoint_array; for (i = 0; i < udc_device->bus->max_endpoints; i++) { ep_num = (endpoint[i].endpoint_address) & USB_ENDPOINT_NUMBER_MASK; if (!ep_num) continue; udcisr0 = readl(UDCISR0); if (udcisr0 & UDCISR_INT(ep_num, UDC_INT_PACKETCMP)) { writel(UDCISR_INT(ep_num, UDC_INT_PACKETCMP), UDCISR0); udc_handle_ep(&endpoint[i]); } } } } while (handled); } /* The UDCCR reg contains mask and interrupt status bits, * so using '|=' isn't safe as it may ack an interrupt. */ #define UDCCR_OEN (1 << 31) /* On-the-Go Enable */ #define UDCCR_MASK_BITS (UDCCR_OEN | UDCCR_UDE) static inline void udc_set_mask_UDCCR(int mask) { writel((readl(UDCCR) & UDCCR_MASK_BITS) | (mask & UDCCR_MASK_BITS), UDCCR); } static inline void udc_clear_mask_UDCCR(int mask) { writel((readl(UDCCR) & UDCCR_MASK_BITS) & ~(mask & UDCCR_MASK_BITS), UDCCR); } static void pio_irq_enable(int ep_num) { if (ep_num < 16) writel(readl(UDCICR0) | 3 << (ep_num * 2), UDCICR0); else { ep_num -= 16; writel(readl(UDCICR1) | 3 << (ep_num * 2), UDCICR1); } } /* * udc_set_nak * * Allow upper layers to signal lower layers should not accept more RX data */ void udc_set_nak(int ep_num) { /* TODO */ } /* * udc_unset_nak * * Suspend sending of NAK tokens for DATA OUT tokens on a given endpoint. * Switch off NAKing on this endpoint to accept more data output from host. */ void udc_unset_nak(int ep_num) { /* TODO */ } int udc_endpoint_write(struct usb_endpoint_instance *endpoint) { return udc_write_urb(endpoint); } /* Associate a physical endpoint with endpoint instance */ void udc_setup_ep(struct usb_device_instance *device, unsigned int id, struct usb_endpoint_instance *endpoint) { int ep_num, ep_addr, ep_isout, ep_type, ep_size; int config, interface, alternate; u32 tmp; usbdbg("setting up endpoint id %d", id); if (!endpoint) { usberr("endpoint void!"); return; } ep_num = endpoint->endpoint_address & USB_ENDPOINT_NUMBER_MASK; if (ep_num >= UDC_MAX_ENDPOINTS) { usberr("unable to setup ep %d!", ep_num); return; } pio_irq_enable(ep_num); if (ep_num == 0) { /* Done for ep0 */ return; } config = 1; interface = 0; alternate = 0; usbdbg("config %d - interface %d - alternate %d", config, interface, alternate); ep_addr = endpoint->endpoint_address; ep_num = ep_addr & USB_ENDPOINT_NUMBER_MASK; ep_isout = (ep_addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT; ep_type = ep_isout ? endpoint->rcv_attributes : endpoint->tx_attributes; ep_size = ep_isout ? endpoint->rcv_packetSize : endpoint->tx_packetSize; usbdbg("addr %x, num %d, dir %s, type %s, packet size %d", ep_addr, ep_num, ep_isout ? "out" : "in", ep_type == USB_ENDPOINT_XFER_ISOC ? "isoc" : ep_type == USB_ENDPOINT_XFER_BULK ? "bulk" : ep_type == USB_ENDPOINT_XFER_INT ? "int" : "???", ep_size ); /* Configure UDCCRx */ tmp = 0; tmp |= (config << UDCCONR_CN_S) & UDCCONR_CN; tmp |= (interface << UDCCONR_IN_S) & UDCCONR_IN; tmp |= (alternate << UDCCONR_AISN_S) & UDCCONR_AISN; tmp |= (ep_num << UDCCONR_EN_S) & UDCCONR_EN; tmp |= (ep_type << UDCCONR_ET_S) & UDCCONR_ET; tmp |= ep_isout ? 0 : UDCCONR_ED; tmp |= (ep_size << UDCCONR_MPS_S) & UDCCONR_MPS; tmp |= UDCCONR_EE; writel(tmp, UDCCN(ep_num)); usbdbg("UDCCR%c = %x", 'A' + ep_num-1, readl(UDCCN(ep_num))); usbdbg("UDCCSR%c = %x", 'A' + ep_num-1, readl(UDCCSN(ep_num))); } /* Connect the USB device to the bus */ void udc_connect(void) { usbdbg("UDC connect"); #ifdef CONFIG_USB_DEV_PULLUP_GPIO /* Turn on the USB connection by enabling the pullup resistor */ writel(readl(GPDR(CONFIG_USB_DEV_PULLUP_GPIO)) | GPIO_bit(CONFIG_USB_DEV_PULLUP_GPIO), GPDR(CONFIG_USB_DEV_PULLUP_GPIO)); writel(GPIO_bit(CONFIG_USB_DEV_PULLUP_GPIO), GPSR(CONFIG_USB_DEV_PULLUP_GPIO)); #else /* Host port 2 transceiver D+ pull up enable */ writel(readl(UP2OCR) | UP2OCR_DPPUE, UP2OCR); #endif } /* Disconnect the USB device to the bus */ void udc_disconnect(void) { usbdbg("UDC disconnect"); #ifdef CONFIG_USB_DEV_PULLUP_GPIO /* Turn off the USB connection by disabling the pullup resistor */ writel(GPIO_bit(CONFIG_USB_DEV_PULLUP_GPIO), GPCR(CONFIG_USB_DEV_PULLUP_GPIO)); #else /* Host port 2 transceiver D+ pull up disable */ writel(readl(UP2OCR) & ~UP2OCR_DPPUE, UP2OCR); #endif } /* Switch on the UDC */ void udc_enable(struct usb_device_instance *device) { ep0state = EP0_IDLE; /* enable endpoint 0, A, B's Packet Complete Interrupt. */ writel(0xffffffff, UDCICR0); writel(0xa8000000, UDCICR1); /* clear the interrupt status/control registers */ writel(0xffffffff, UDCISR0); writel(0xffffffff, UDCISR1); /* set UDC-enable */ udc_set_mask_UDCCR(UDCCR_UDE); udc_device = device; if (!ep0_urb) ep0_urb = usbd_alloc_urb(udc_device, udc_device->bus->endpoint_array); else usbinfo("ep0_urb %p already allocated", ep0_urb); usbdbg("UDC Enabled\n"); } /* Need to check this again */ void udc_disable(void) { usbdbg("disable UDC"); udc_clear_mask_UDCCR(UDCCR_UDE); /* Disable clock for USB device */ writel(readl(CKEN) & ~CKEN11_USB, CKEN); /* Free ep0 URB */ if (ep0_urb) { usbd_dealloc_urb(ep0_urb); ep0_urb = NULL; } /* Reset device pointer */ udc_device = NULL; } /* Allow udc code to do any additional startup */ void udc_startup_events(struct usb_device_instance *device) { /* The DEVICE_INIT event puts the USB device in the state STATE_INIT */ usbd_device_event_irq(device, DEVICE_INIT, 0); /* The DEVICE_CREATE event puts the USB device in the state * STATE_ATTACHED */ usbd_device_event_irq(device, DEVICE_CREATE, 0); /* Some USB controller driver implementations signal * DEVICE_HUB_CONFIGURED and DEVICE_RESET events here. * DEVICE_HUB_CONFIGURED causes a transition to the state * STATE_POWERED, and DEVICE_RESET causes a transition to * the state STATE_DEFAULT. */ udc_enable(device); } /* Initialize h/w stuff */ int udc_init(void) { udc_device = NULL; usbdbg("PXA27x usbd start"); /* Enable clock for USB device */ writel(readl(CKEN) | CKEN11_USB, CKEN); /* Disable the UDC */ udc_clear_mask_UDCCR(UDCCR_UDE); /* Disable IRQs: we don't use them */ writel(0, UDCICR0); writel(0, UDCICR1); return 0; }
{ "pile_set_name": "Github" }
Slow.v Fast.v
{ "pile_set_name": "Github" }
# kor2vec OOV없이 빠르고 정확한 한국어 Embedding ## Installation ```shell pip install git+https://github.com/naver/kor2vec.git ``` > Requirements : `tqdm`, `numpy` and support `torch >= 0.4.0` ## Introduction 한국어는 교착어라는 특성을 갖고 있습니다. 때문에 어간+어미(용언), 명사+조사 등등 다양한 형태의 수만가지의 단어 조합들을 만들어 낼 수 있는데요. 한국어를 사용하는 입장에서는 매우 편리한 특성이지만 한국어를 Embedding 해야하는 NLP 개발자들에게는 언제나 가장 큰 문제점으로 다가왔습니다. 때문에 `konlpy`나 `sentence piece`를 사용해서 한국어를 적절한 token 단위로 나눈뒤에 `Word2vec` 또는 자제적인 Embedding을 학습하여 교착어의 문제를 해결하였습니다. 하지만 이 방법에는 세가지 큰 문제점이 존재합니다. 1. 모든 inference, training 과정에 tokenizer가 붙어야 함으로 병목현상이 발생한다 2. tokenization 과정에서 의미를 잃어버리는 경우가 많다 (잘못된 tokenization) 3. 모든 단어와 문장을 cover하는 것은 불가능하다 (필연 OOV문제가 발생함) ## Solution 이러한 문제점을 해결하기 위해서 CNN을 기반으로 한 char-word 임베딩을 한국어에 적용하여 `kor2vec`을 만들게 되었습니다. - Embedding 학습 방법 : Skip-gram based embedding training - Char-word Encoder 모델 구조 : [Yoon Kim's Character-Aware Neural Language Modeling](https://arxiv.org/abs/1508.06615) ## Quick Start ```shell kor2vec train -c corpus/path -o output/model.kor2vec ``` ### inference ```python from kor2vec import Kor2Vec kor2vec = Kor2Vec.load("../model/path") kor2vec.embedding("안녕 아이오아이야 나는 클로바에서 왔어") >>> torch.tensor(5, 128) # embedding vector kor2vec.embedding("나는 도라에몽이라고 해 반가워", numpy=True) >>> numpy.array(4, 128) # numpy embedding vector input = kor2vec.to_seqs(["안녕 나는 뽀로로라고 해", "만나서 반가워 뽀로로"], seq_len=4) kor2vec.forward(input) >> torch.tensor([2, 4, 128]) ``` ### training ```python from kor2vec import Kor2vec kor2vec = Kor2Vec(embed_size=128) kor2vec.train("../path/corpus", batch_size=128) # takes some time kor2vec.save("../mode/path") # saving embedding ``` ### with pytorch ```python import torch.nn as nn from kor2vec import Kor2vec kor2vec = Kor2Vec.load("../model/path") # or kor2vec = SejongVector() lstm = nn.LSTM(128, 64, batch_first=True) dense = nn.Linear(64, 1) # Make tensor input sentences = ["이 영화는 정말 대박이에요", "우와 진짜 재미있었어요"] x = kor2vec.to_seqs(sentences, seq_len=10) # >>> tensor(batch_size, seq_len, char_seq_len) x = kor2vec(x) # tensor(batch_size, seq_len, 128) _, (x, xc) = lstm(x) # tensor(batch_size, 64) x = dense(x) # tensor(batch_size, 1) ``` ## License ``` Copyright 2018 NAVER Corp. 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. ``` ## Author 김준성 (Naver Clova AI intern) : [email protected]
{ "pile_set_name": "Github" }
-- some typos i:= 1 + 1 + 1; j:= 1 + + 1;
{ "pile_set_name": "Github" }
@import "../../variables"; .invoice { width: 100%; thead { th { padding: 1em; font-size: 16px; background-color: $green; } } &-big-head { width: 75%; } &-line { background-color: lighten($green, 36%); td { padding: 2em 1em; font-size: 16px; } } &-line:nth-of-type(even) { background-color: lighten($green, 30%); } &-total { td { background-color: $white; font-size: 18px; color: $medium-grey; padding-top: 2em; } &-label { padding: 1em; text-align: right; font-weight: 700; } &-amount { padding: 1em; font-weight: 700; } } }
{ "pile_set_name": "Github" }
/* * /MathJax/localization/nl/nl.js * * Copyright (c) 2009-2014 The MathJax Consortium * * 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. */ MathJax.Localization.addTranslation("nl",null,{menuTitle:"Nederlands",version:"2.4.0",isLoaded:true,domains:{_:{version:"2.4.0",isLoaded:true,strings:{CookieConfig:"MathJax heeft een gebruikersconfiguratie cookie aangetroffen dat code bevat die uitgevoerd moet worden. Wilt u deze uitvoeren?\n\\n\n(U zou op annuleren moeten drukken tenzij u het cookie zelf ingesteld heeft.)",MathProcessingError:"Wiskunde verwerkingsfout",MathError:"Wiskunde fout",LoadFile:"Bezig met laden van %1",Loading:"Bezig met laden",LoadFailed:"Bestand kan niet geladen worden: %1",ProcessMath:"Berekening verwerken: %1",Processing:"Bezig met verwerken",TypesetMath:"Berekening opmaken: %1",Typesetting:"Opmaken",MathJaxNotSupported:"Uw browser ondersteunt MathJax niet"}},FontWarnings:{},"HTML-CSS":{},HelpDialog:{},MathML:{},MathMenu:{},TeX:{}},plural:function(a){if(a===1){return 1}return 2},number:function(a){return a}});MathJax.Ajax.loadComplete("[MathJax]/localization/nl/nl.js");
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ChangeListManager"> <list default="true" id="5c176bf4-d71c-4c7c-bb96-433d4f711557" name="Default" comment="" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="TRACKING_ENABLED" value="true" /> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="LAST_RESOLUTION" value="IGNORE" /> </component> <component name="FileEditorManager"> <leaf /> </component> <component name="GradleLocalSettings"> <option name="externalProjectsViewState"> <projects_view /> </option> </component> <component name="IdeDocumentHistory"> <option name="CHANGED_PATHS"> <list> <option value="$PROJECT_DIR$/example/lib/main.dart" /> <option value="$PROJECT_DIR$/example/pubspec.yaml" /> <option value="$PROJECT_DIR$/pubspec.yaml" /> <option value="$PROJECT_DIR$/lib/battery.dart" /> <option value="$PROJECT_DIR$/README.md" /> <option value="$PROJECT_DIR$/example/README.md" /> </list> </option> </component> <component name="ProjectFrameBounds" extendedState="6"> <option name="y" value="23" /> <option name="width" value="1440" /> <option name="height" value="839" /> </component> <component name="ProjectReloadState"> <option name="STATE" value="1" /> </component> <component name="ProjectView"> <navigator currentView="ProjectPane" proportions="" version="1"> <flattenPackages /> <showMembers /> <showModules /> <showLibraryContents /> <hideEmptyPackages /> <abbreviatePackageNames /> <autoscrollToSource /> <autoscrollFromSource /> <sortByType /> <manualOrder /> <foldersAlwaysOnTop value="true" /> </navigator> <panes> <pane id="AndroidView" /> <pane id="PackagesPane" /> <pane id="ProjectPane"> <subPane> <expand> <path> <item name="battery" type="b2602c69:ProjectViewProjectNode" /> <item name="battery" type="462c0819:PsiDirectoryNode" /> </path> <path> <item name="battery" type="b2602c69:ProjectViewProjectNode" /> <item name="battery" type="462c0819:PsiDirectoryNode" /> <item name="example" type="462c0819:PsiDirectoryNode" /> </path> </expand> <select /> </subPane> </pane> <pane id="Scope" /> <pane id="Scratches" /> </panes> </component> <component name="PropertiesComponent"> <property name="android.sdk.path" value="$USER_HOME$/Library/Android/sdk" /> <property name="settings.editor.selected.configurable" value="configurable.group.appearance" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="dart.analysis.tool.window.force.activate" value="false" /> <property name="show.migrate.to.gradle.popup" value="false" /> <property name="io.flutter.reload.alreadyRun" value="true" /> </component> <component name="RunDashboard"> <option name="ruleStates"> <list> <RuleState> <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> </RuleState> <RuleState> <option name="name" value="StatusDashboardGroupingRule" /> </RuleState> </list> </option> </component> <component name="RunManager"> <configuration default="true" type="Application" factoryName="Application"> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> <option name="MAIN_CLASS_NAME" /> <option name="VM_PARAMETERS" /> <option name="PROGRAM_PARAMETERS" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH" /> <option name="ENABLE_SWING_INSPECTOR" value="false" /> <option name="ENV_VARIABLES" /> <option name="PASS_PARENT_ENVS" value="true" /> <module name="" /> <envs /> </configuration> <configuration name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter"> <option name="filePath" value="$PROJECT_DIR$/example/lib/main.dart" /> </configuration> <configuration default="true" type="Remote" factoryName="Remote"> <option name="USE_SOCKET_TRANSPORT" value="true" /> <option name="SERVER_MODE" value="false" /> <option name="SHMEM_ADDRESS" value="javadebug" /> <option name="HOST" value="localhost" /> <option name="PORT" value="5005" /> </configuration> <configuration default="true" type="TestNG" factoryName="TestNG"> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> <module name="" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH" /> <option name="SUITE_NAME" /> <option name="PACKAGE_NAME" /> <option name="MAIN_CLASS_NAME" /> <option name="METHOD_NAME" /> <option name="GROUP_NAME" /> <option name="TEST_OBJECT" value="CLASS" /> <option name="VM_PARAMETERS" value="-ea" /> <option name="PARAMETERS" /> <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> <option name="OUTPUT_DIRECTORY" /> <option name="ANNOTATION_TYPE" /> <option name="ENV_VARIABLES" /> <option name="PASS_PARENT_ENVS" value="true" /> <option name="TEST_SEARCH_SCOPE"> <value defaultName="singleModule" /> </option> <option name="USE_DEFAULT_REPORTERS" value="false" /> <option name="PROPERTIES_FILE" /> <envs /> <properties /> <listeners /> </configuration> <configuration name="&lt;template&gt;" type="Applet" default="true" selected="false"> <option name="MAIN_CLASS_NAME" /> <option name="HTML_FILE_NAME" /> <option name="HTML_USED" value="false" /> <option name="WIDTH" value="400" /> <option name="HEIGHT" value="300" /> <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> <option name="VM_PARAMETERS" /> </configuration> <configuration default="true" type="JUnit" factoryName="JUnit"> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> <module name="" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH" /> <option name="PACKAGE_NAME" /> <option name="MAIN_CLASS_NAME" /> <option name="METHOD_NAME" /> <option name="TEST_OBJECT" value="class" /> <option name="VM_PARAMETERS" value="-ea" /> <option name="PARAMETERS" /> <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> <option name="ENV_VARIABLES" /> <option name="PASS_PARENT_ENVS" value="true" /> <option name="TEST_SEARCH_SCOPE"> <value defaultName="singleModule" /> </option> <envs /> <patterns /> <method /> </configuration> <configuration name="&lt;template&gt;" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false"> <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" /> </configuration> </component> <component name="ShelveChangesManager" show_recycled="false"> <option name="remove_strategy" value="false" /> </component> <component name="SvnConfiguration"> <configuration /> </component> <component name="TaskManager"> <task active="true" id="Default" summary="Default task"> <changelist id="5c176bf4-d71c-4c7c-bb96-433d4f711557" name="Default" comment="" /> <created>1562597841881</created> <option name="number" value="Default" /> <option name="presentableId" value="Default" /> <updated>1562597841881</updated> </task> <servers /> </component> <component name="ToolWindowManager"> <frame x="0" y="23" width="1440" height="839" extended-state="6" /> <layout> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Dart Analysis" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32914925" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Flutter Outline" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21316166" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25381416" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Flutter Inspector" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.123032905" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.09153953" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> </layout> </component> <component name="VcsContentAnnotationSettings"> <option name="myLimit" value="2678400000" /> </component> <component name="XDebuggerManager"> <breakpoint-manager /> <watches-manager /> </component> <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/lib/battery.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/lib/battery.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/lib/battery.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/lib/battery.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="170"> <caret line="15" column="39" lean-forward="false" selection-start-line="15" selection-start-column="26" selection-end-line="15" selection-end-column="39" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/lib/battery.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="170"> <caret line="15" column="39" lean-forward="false" selection-start-line="15" selection-start-column="26" selection-end-line="15" selection-end-column="39" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/../../../../flutter/flutter/packages/flutter/lib/src/services/message_codecs.dart" /> <entry file="file://$PROJECT_DIR$/test/battery_test.dart" /> <entry file="file://$PROJECT_DIR$/pubspec.yaml"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="306"> <caret line="18" column="8" lean-forward="true" selection-start-line="18" selection-start-column="8" selection-end-line="18" selection-end-column="8" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/../../../../flutter/flutter/bin/cache/pkg/sky_engine/lib/async/stream.dart" /> <entry file="file://$PROJECT_DIR$/../../../../flutter/flutter/packages/flutter/lib/src/services/platform_channel.dart" /> <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="288"> <caret line="59" column="30" lean-forward="true" selection-start-line="59" selection-start-column="30" selection-end-line="59" selection-end-column="30" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/README.md" /> <entry file="file://$PROJECT_DIR$/example/README.md" /> <entry file="file://$PROJECT_DIR$/example/pubspec.yaml"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="170"> <caret line="10" column="15" lean-forward="false" selection-start-line="10" selection-start-column="15" selection-end-line="10" selection-end-column="15" /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/lib/battery.dart"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="98"> <caret line="21" column="30" lean-forward="false" selection-start-line="21" selection-start-column="30" selection-end-line="21" selection-end-column="30" /> <folding /> </state> </provider> </entry> </component> </project>
{ "pile_set_name": "Github" }
rule k2319_3a54acb489596b12 { meta: copyright="Copyright (c) 2014-2018 Support Intelligence Inc, All Rights Reserved." engine="saphire/1.3.8 divinorum/0.9992 icewater/0.4" viz_url="http://icewater.io/en/cluster/query?h64=k2319.3a54acb489596b12" cluster="k2319.3a54acb489596b12" cluster_size="6" filetype = "" tlp = "amber" version = "icewater snowflake" author = "Rick Wesson (@wessorh) [email protected]" date = "20180910" license = "RIL-1.0 [Rick's Internet License]" family="kryptik script aknjt" md5_hashes="['8186a50c98d5de96e5ac1ee4c33085b785e78313','372271557c45fff65c7cac75f2c69631dcfad37e','648318a6c131701cebb5966ba4664c60f0a2fe65']" cluster_members="http://icewater.io/en/cluster/detail?h64=k2319.3a54acb489596b12" strings: $hex_string = { 4a5d213d3d756e646566696e6564297b72657475726e206f5b4a5d3b7d76617220723d282835392e2c39382e304531293e3d28307831372c38362e344531293f } condition: filesize > 16384 and filesize < 65536 and $hex_string }
{ "pile_set_name": "Github" }
package cn.crap.utils; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import cn.crap.dto.SettingDto; import cn.crap.framework.SpringContextHolder; import cn.crap.service.tool.SettingCache; public class Aes { private static String handlerKey(String apiKey) { String tempKey = "HDALd)9dkA*&1kS$CKSJ}{|A"; if (apiKey.length() > 16) { apiKey = apiKey.substring(0, 16); } else if (apiKey.length() < 16) { apiKey = apiKey + tempKey.substring(0, 16 - apiKey.length()); } return apiKey; } public static final String iv="CRAPG_@W8#_19#10"; public static String encrypt(String data){ SettingCache settingCache = SpringContextHolder.getBean("settingCache", SettingCache.class); SettingDto setting = settingCache.get(ISetting.S_SECRETKEY); String PWD = ""; if(setting!=null) PWD = setting.getValue(); PWD = handlerKey(setting.getValue()); try { Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); int blockSize = cipher.getBlockSize(); byte[] dataBytes = data.getBytes(); int plaintextLength = dataBytes.length; if (plaintextLength % blockSize != 0) { plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize)); } byte[] plaintext = new byte[plaintextLength]; System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length); SecretKeySpec keyspec = new SecretKeySpec(PWD.getBytes(), "AES"); IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec); byte[] encrypted = cipher.doFinal(plaintext); return parseByte2HexStr(encrypted); } catch (Exception e) { e.printStackTrace(); return null; } } public static String desEncrypt(String data){ SettingCache settingCache = SpringContextHolder.getBean("settingCache", SettingCache.class); SettingDto setting = settingCache.get(ISetting.S_SECRETKEY); String PWD = ""; if(setting!=null) PWD = setting.getValue(); PWD = handlerKey(setting.getValue()); try { if(data==null||data.equals("")){ return ""; } data=data.trim(); byte[] encrypted1 = parseHexStr2Byte(data); Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); SecretKeySpec keyspec = new SecretKeySpec(PWD.getBytes(), "AES"); IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes()); cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec); byte[] original = cipher.doFinal(encrypted1); String originalString = new String(original); return originalString.trim(); } catch (Exception e) { e.printStackTrace(); return null; } } /**将二进制转换成16进制 * @param buf * @return */ public static String parseByte2HexStr(byte buf[]) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < buf.length; i++) { String hex = Integer.toHexString(buf[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; } sb.append(hex.toUpperCase()); } return sb.toString(); } /**将16进制转换为二进制 * @param hexStr * @return */ public static byte[] parseHexStr2Byte(String hexStr) { if (hexStr.length() < 1) return null; byte[] result = new byte[hexStr.length()/2]; for (int i = 0;i< hexStr.length()/2; i++) { int high = Integer.parseInt(hexStr.substring(i*2, i*2+1), 16); int low = Integer.parseInt(hexStr.substring(i*2+1, i*2+2), 16); result[i] = (byte) (high * 16 + low); } return result; } public static void main(String args[]){ } }
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package java.beans; import java.util.EventObject; /** * An event that indicates that a constraint or a boundary of a property has * changed. */ public class PropertyChangeEvent extends EventObject { private static final long serialVersionUID = 7042693688939648123L; String propertyName; Object oldValue; Object newValue; Object propagationId; /** * The constructor used to create a new {@code PropertyChangeEvent}. * * @param source * the changed bean. * @param propertyName * the changed property, or <code>null</code> to indicate an * unspecified set of the properties has changed. * @param oldValue * the previous value of the property, or <code>null</code> if * the <code>propertyName</code> is <code>null</code> or the * previous value is unknown. * @param newValue * the new value of the property, or <code>null</code> if the * <code>propertyName</code> is <code>null</code> or the new * value is unknown. */ public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue) { super(source); this.propertyName = propertyName; this.oldValue = oldValue; this.newValue = newValue; } /** * Returns the name of the property that has changed. If an unspecified set * of properties has changed it returns null. * * @return the name of the property that has changed, or null. */ public String getPropertyName() { return propertyName; } /** * Sets the propagationId object. * * @see #getPropagationId() */ public void setPropagationId(Object propagationId) { this.propagationId = propagationId; } /** * Returns the propagationId object. This is reserved for future use. Beans * 1.0 demands that a listener receiving this property and then sending its * own PropertyChangeEvent sets the received propagationId on the new * PropertyChangeEvent's propagationId field. * * @return the propagationId object. */ public Object getPropagationId() { return propagationId; } /** * Returns the old value that the property had. If the old value is unknown * this method returns null. * * @return the old property value or null. */ public Object getOldValue() { return oldValue; } /** * Returns the new value that the property now has. If the new value is * unknown this method returns null. * * @return the old property value or null. */ public Object getNewValue() { return newValue; } }
{ "pile_set_name": "Github" }
/* * (C) Copyright 2017-2020 OpenVidu (https://openvidu.io) * * 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 io.openvidu.server.kurento.kms; public interface LoadManager { public double calculateLoad(Kms kms); }
{ "pile_set_name": "Github" }
<template> <div> <repo-selector :repos="repos" @select="x => (repo = x)" /> <v-text-field label="Snapshot name*" v-model="name" /> <index-selector :indices="Object.keys(indices)" v-model="selectedIndices" /> <doc-checkbox v-for="option in booleanOptions" :key="option.title" v-model="option.value" :doc="option.doc" :label="option.title" /> <v-btn block class="mt-6" color="success" :disabled="selectedIndices.length === 0 || !name || !repo" > Create Snapshot </v-btn> </div> </template> <script> import IndexSelector from "./IndexSelector.vue"; import { mapState } from "vuex"; import DocCheckbox from "./DocCheckbox.vue"; import RepoSelector from "./RepoSelector.vue"; export default { components: { IndexSelector, DocCheckbox, RepoSelector }, props: { repos: { type: Array, required: true } }, computed: { ...mapState(["indices"]) }, data() { return { selectedIndices: [], repo: null, name: null, booleanOptions: { partial: { title: "Partial", value: false, doc: "By default, the entire snapshot will fail if one or more indices participating in the snapshot don’t have all primary shards available. This behaviour can be changed by setting partial to true." }, include_global_state: { title: "Include global state", value: true, doc: "By setting include_global_state to false it’s possible to prevent the cluster global state to be stored as part of the snapshot." }, ignore_unavailable: { title: "Ignore unavailable", value: false, doc: "By default, when ignore_unavailable option is not set and an index is missing the snapshot request will fail." } } }; } }; </script> <style scoped></style>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <launch> <!-- Usage: roslaunch chapter9_tutorials camera_timer.launch fps:=30 camera_index:=1 --> <!-- Logger config --> <env name="ROSCONSOLE_CONFIG_FILE" value="$(find chapter9_tutorials)/config/chapter9_tutorials.config"/> <!-- Arguments --> <!-- FPS. --> <arg name="fps" default="4"/> <!-- Camera index. --> <arg name="camera_index" default="1"/> <!-- View camera stream. --> <arg name="view" default="false"/> <!-- Save camera stream. --> <arg name="save" default="false"/> <!-- Run driver --> <node name="camera" pkg="chapter9_tutorials" type="camera_timer" output="screen"> <param name="fps" value="$(arg fps)"/> <param name="camera_index" value="$(arg camera_index)"/> </node> <group if="$(arg view)"> <node name="view" pkg="image_view" type="image_view"> <remap from="image" to="/camera/image_raw"/> </node> </group> <group if="$(arg save)"> <node name="record" pkg="rosbag" type="record" args="/camera/image_raw"/> </group> </launch>
{ "pile_set_name": "Github" }
<?php /** * PHPExcel * * Copyright (c) 2006 - 2014 PHPExcel * * This 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. * * This 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 this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ /** * PHPExcel_Worksheet_HeaderFooterDrawing * * @category PHPExcel * @package PHPExcel_Worksheet * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable { /** * Path * * @var string */ private $_path; /** * Name * * @var string */ protected $_name; /** * Offset X * * @var int */ protected $_offsetX; /** * Offset Y * * @var int */ protected $_offsetY; /** * Width * * @var int */ protected $_width; /** * Height * * @var int */ protected $_height; /** * Proportional resize * * @var boolean */ protected $_resizeProportional; /** * Create a new PHPExcel_Worksheet_HeaderFooterDrawing */ public function __construct() { // Initialise values $this->_path = ''; $this->_name = ''; $this->_offsetX = 0; $this->_offsetY = 0; $this->_width = 0; $this->_height = 0; $this->_resizeProportional = true; } /** * Get Name * * @return string */ public function getName() { return $this->_name; } /** * Set Name * * @param string $pValue * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setName($pValue = '') { $this->_name = $pValue; return $this; } /** * Get OffsetX * * @return int */ public function getOffsetX() { return $this->_offsetX; } /** * Set OffsetX * * @param int $pValue * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setOffsetX($pValue = 0) { $this->_offsetX = $pValue; return $this; } /** * Get OffsetY * * @return int */ public function getOffsetY() { return $this->_offsetY; } /** * Set OffsetY * * @param int $pValue * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setOffsetY($pValue = 0) { $this->_offsetY = $pValue; return $this; } /** * Get Width * * @return int */ public function getWidth() { return $this->_width; } /** * Set Width * * @param int $pValue * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setWidth($pValue = 0) { // Resize proportional? if ($this->_resizeProportional && $pValue != 0) { $ratio = $this->_width / $this->_height; $this->_height = round($ratio * $pValue); } // Set width $this->_width = $pValue; return $this; } /** * Get Height * * @return int */ public function getHeight() { return $this->_height; } /** * Set Height * * @param int $pValue * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setHeight($pValue = 0) { // Resize proportional? if ($this->_resizeProportional && $pValue != 0) { $ratio = $this->_width / $this->_height; $this->_width = round($ratio * $pValue); } // Set height $this->_height = $pValue; return $this; } /** * Set width and height with proportional resize * Example: * <code> * $objDrawing->setResizeProportional(true); * $objDrawing->setWidthAndHeight(160,120); * </code> * * @author Vincent@luo MSN:[email protected] * @param int $width * @param int $height * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setWidthAndHeight($width = 0, $height = 0) { $xratio = $width / $this->_width; $yratio = $height / $this->_height; if ($this->_resizeProportional && !($width == 0 || $height == 0)) { if (($xratio * $this->_height) < $height) { $this->_height = ceil($xratio * $this->_height); $this->_width = $width; } else { $this->_width = ceil($yratio * $this->_width); $this->_height = $height; } } return $this; } /** * Get ResizeProportional * * @return boolean */ public function getResizeProportional() { return $this->_resizeProportional; } /** * Set ResizeProportional * * @param boolean $pValue * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setResizeProportional($pValue = true) { $this->_resizeProportional = $pValue; return $this; } /** * Get Filename * * @return string */ public function getFilename() { return basename($this->_path); } /** * Get Extension * * @return string */ public function getExtension() { $parts = explode(".", basename($this->_path)); return end($parts); } /** * Get Path * * @return string */ public function getPath() { return $this->_path; } /** * Set Path * * @param string $pValue File path * @param boolean $pVerifyFile Verify file * @throws PHPExcel_Exception * @return PHPExcel_Worksheet_HeaderFooterDrawing */ public function setPath($pValue = '', $pVerifyFile = true) { if ($pVerifyFile) { if (file_exists($pValue)) { $this->_path = $pValue; if ($this->_width == 0 && $this->_height == 0) { // Get width/height list($this->_width, $this->_height) = getimagesize($pValue); } } else { throw new PHPExcel_Exception("File $pValue not found!"); } } else { $this->_path = $pValue; } return $this; } /** * Get hash code * * @return string Hash code */ public function getHashCode() { return md5( $this->_path . $this->_name . $this->_offsetX . $this->_offsetY . $this->_width . $this->_height . __CLASS__ ); } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ public function __clone() { $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { $this->$key = clone $value; } else { $this->$key = $value; } } } }
{ "pile_set_name": "Github" }
########################################################### # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written permission. # # # __all__ = ['DependencyLink', 'DependencyWdg'] from pyasm.common import Xml, TacticException, Container from pyasm.biz import File, FileGroup, FileRange, Snapshot, Project, SObjectNotFoundException from pyasm.search import Search from pyasm.web import Widget, WebContainer, HtmlElement, DivWdg, SpanWdg, FloatDivWdg from .table_element_wdg import FunctionalTableElement from .icon_wdg import IconButtonWdg, IconWdg from .file_wdg import ThumbWdg from .web_wdg import SwapDisplayWdg from tactic.ui.common import BaseRefreshWdg import os, re class DependencyLink(FunctionalTableElement): def get_display(self): sobject = self.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() button = IconButtonWdg("Dependency", IconWdg.DEPENDENCY) button.add_style("margin: 3px 5px") # view doesn't matter behavior = self.get_edit_behavior('pyasm.widget.DependencyWdg', search_type, \ search_id) button.add_behavior(behavior) return button def get_edit_behavior(self, class_name, search_type, search_id, view=''): '''get the default edit behavior''' behavior = { "type": "click_up", "cbfn_action": "spt.popup.get_widget", "options": { "title": "Dependency: %s" % search_type, "class_name": class_name, "popup_id": 'dependency_popup' }, "args": { "search_type": search_type, "search_id": search_id, "view": view, } } return behavior class DependencyWdg(BaseRefreshWdg): '''widget that follows a snapshot's dependencies and prints them out''' MAX_NODE_LENGTH = 100 def init(self): self.show_title = True self.mode = self.kwargs.get('mode') def set_show_title(self, flag): self.show_title = flag def get_display(self): if self.mode == 'detail': upstream = True div = DivWdg() self.snapshot_code = self.kwargs.get('snapshot_code') ref_snapshot = Snapshot.get_by_code(self.snapshot_code) self._handle_snapshot(ref_snapshot, div, upstream, recursive=False) return div self.web = WebContainer.get_web() if self.sobjects: snapshot = self.sobjects[0] else: search_type = self.kwargs.get("search_type") search_id = self.kwargs.get("search_id") snapshot = None if search_type == Snapshot.SEARCH_TYPE: snapshot = Search.get_by_id(search_type, search_id) else: snapshot = Snapshot.get_latest(search_type, search_id) if not snapshot: self.add(HtmlElement.h3("No snapshot found")) return super(DependencyWdg,self).get_display() widget = DivWdg() widget.add_style('min-width: 700px') if self.show_title: self.add(HtmlElement.h3("Asset Dependency")) from tactic.ui.panel import TableLayoutWdg table = TableLayoutWdg(search_type="sthpw/snapshot", mode='simple', view='table', width='700px') table.add_style('min-width: 700px') table.set_sobject(snapshot) widget.add(table) sobject = snapshot.get_sobject() search_type_obj = sobject.get_search_type_obj() #file_div = DivWdg(css='left_content discussion_child') file_div = DivWdg() file_div.add_color("background", "background", -20) file_div.add_color("color", "color") file_div.add_style("padding: 5px") file_div.add_border() #file_div.add_style('margin','0 10px 0 10px') file_div.add_style('padding','10px 0 0 10px') #file_div.add_style('-moz-border-radius: 6px') title = DivWdg() title.add_style("font-weight: bold") title.add_style("font-size: 1.2em") #title.add_style('margin-left', '10px') if self.show_title: title.add(search_type_obj.get_title() ) title.add(" - ") title.add(sobject.get_code() ) if sobject.has_value("description"): title.add(" : ") title.add(sobject.get_value("description") ) file_div.add(title) file_div.add(HtmlElement.br()) # find out how many 1st level ref nodes we are dealing with xml = snapshot.get_xml_value("snapshot") #self.total_ref_count = len(xml.get_nodes("snapshot/file/ref | snapshot/ref |snapshot/input_ref| snapshot/fref")) self._handle_snapshot(snapshot, file_div, upstream=True, recursive=True ) self._handle_snapshot(snapshot, file_div, upstream=False, recursive=True ) #widget.add(widget) widget.add(file_div) widget.add(HtmlElement.br(2)) #return super(DependencyWdg,self).get_display() return widget def _handle_snapshot(self, snapshot, widget, upstream, recursive=True): ''' handle the files and refs in this snapshot ''' if upstream: self._handle_files(snapshot, widget, upstream, recursive) # handle the refs in this snapshot self._handle_refs(snapshot, widget, upstream, recursive) return len(widget.widgets) def _handle_files(self, snapshot, widget, upstream, recursive=True): web_dir = snapshot.get_web_dir() xml = snapshot.get_xml_value("snapshot") # handle files files = xml.get_nodes("snapshot/file") for file in files: file_code = Xml.get_attribute(file, "file_code") file_type = Xml.get_attribute(file, "type") file_range = Xml.get_attribute(file, "file_range") #file_range = "1-4/1" dir = snapshot.get_client_lib_dir(file_type=file_type) lib_dir = snapshot.get_lib_dir(file_type=file_type) open_button = IconButtonWdg( "Explore: %s" % dir, IconWdg.LOAD, False) if dir == lib_dir: open_button.add_behavior({'type':'click_up', 'cbjs_action': '''var applet = spt.Applet.get(); spt.alert('You are not allowed to browse directories on a web server.'); '''}) else: open_button.add_behavior({'type':'click_up', 'dir' : dir, 'cbjs_action': ''' var applet = spt.Applet.get(); var dir = bvr.dir; applet.open_explorer(dir);'''}) open_button.add_class('small') open_button.add_style('float: left') widget.add(open_button) if file_range: file_name = Xml.get_attribute(file, "name") widget.add("%s [code = %s, type = %s]" % (file_name, file_code, file_type)) widget.add(HtmlElement.br(2)) # display all of the paths file_names = FileGroup.expand_paths( file_name, FileRange.get(file_range) ) for file_name in file_names: #link = HtmlElement.href(file_name, "%s/%s" % (web_dir, file_name), target="_blank" ) link = SpanWdg(file_name) link.add_color("color", "color") widget.add(link) widget.add(HtmlElement.br()) else: thumb = DependencyThumbWdg() thumb.set_show_filename(True) thumb.set_sobject(snapshot) thumb.set_icon_size(15) thumb.set_image_link_order([file_type]) thumb.set_option('detail', 'false') widget.add(SpanWdg(thumb, css='small')) widget.add("[code = %s, type = %s]" % ( file_code, file_type)) widget.add(HtmlElement.br()) block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") nodes = xml.get_nodes("snapshot/file[@file_code='%s']/ref" % file_code) widget.add(HtmlElement.br(clear="all")) # handle sub refs for node in nodes: self._handle_ref_node(node, block, upstream, recursive) block.add(HtmlElement.br()) if nodes: widget.add(block) widget.add(HtmlElement.br()) files = xml.get_nodes("snapshot/unknown_ref") if files: widget.add(HtmlElement.b("Unknown ref.")) for file in files: block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") block.add( IconWdg( "Unknown", IconWdg.UNKNOWN) ) path = Xml.get_attribute(file, "path") block.add(path) widget.add(block) def _handle_refs(self, snapshot, widget, upstream, recursive=True): xml = snapshot.get_xml_value("snapshot") # go through the references if upstream: nodes = xml.get_nodes("snapshot/ref") if nodes: widget.add(HtmlElement.b('Upstream ref.')) block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") for node in nodes: self._handle_ref_node(node, block, upstream, recursive) block.add(HtmlElement.br()) widget.add(block) # go through the input references nodes = xml.get_nodes("snapshot/input_ref") if nodes: widget.add(HtmlElement.br()) widget.add(HtmlElement.b("Input ref.")) block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") for node in nodes: self._handle_ref_node(node, block, upstream, recursive) widget.add(block) else: # go through the forward references nodes = xml.get_nodes("snapshot/fref") if nodes: widget.add(HtmlElement.b("Downstream ref.")) block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") for node in nodes: self._handle_ref_node(node, block, upstream, recursive) widget.add(block) def _handle_ref_node(self, node, widget, upstream=False, recursive=True): # get the reference snapshot (should maybe use the loader or # at least share the code instance = Xml.get_attribute(node,"instance") search_type = Xml.get_attribute(node,"search_type") search_id = Xml.get_attribute(node,"search_id") context = Xml.get_attribute(node,"context") version = Xml.get_attribute(node,"version") # this is often the Maya file node name or XSI long clip name node_name = Xml.get_attribute(node, "node") my_name = Xml.get_node_name(node) # get the snapshot ref_snapshot = Snapshot.get_by_version(search_type, search_id,\ context, version) #ref_snapshot = Snapshot.get_latest(search_type,search_id, context) if ref_snapshot == None: widget.add("|---> <font color='red'>Error: No reference found for [%s, %s, %s]</font>" % \ (search_type, search_id, context) ) return toggle_id = self.generate_unique_id('toggle') widget.add(FloatDivWdg(), toggle_id) version = ref_snapshot.get_value("version") try: sobject = ref_snapshot.get_sobject() except SObjectNotFoundException as e: widget.add('[%s|%s] may have been deleted or is not viewable.' % (ref_snapshot.get_value('search_type'),\ ref_snapshot.get_value('search_id'))) return search_type_obj = sobject.get_search_type_obj() # this is the top level icon usually thumb_span = SpanWdg() thumb_span.add_style("float: left") thumb = ThumbWdg() thumb.set_sobject(ref_snapshot) thumb.set_icon_size(15) # for input_ref, just get the latest icon if my_name == 'ref': thumb.set_version(version) # this has to be a FloatDivWdg widget.add(FloatDivWdg(thumb)) info_div = DivWdg() info_span = SpanWdg(css='med') info_span.add_color("color", "color") info_div.add(info_span) widget.add(info_div) info_span.add(HtmlElement.b(search_type_obj.get_title()) ) widget.add("&nbsp;&nbsp;") if instance != "": info_span.add(" : ") info_span.add( instance ) info_span.add(" : ") info_span.add(sobject.get_code() ) if sobject.has_value("description"): info_span.add(" : ") info_span.add(sobject.get_value("description") ) info_span.add( " : %s" % (context) ) info_span.add( " : v%0.2d " % (int(version)) ) if ref_snapshot.is_current(): info_span.add( IconWdg("Currency", IconWdg.DOT_GREEN) ) else: info_span.add( IconWdg("Currency", IconWdg.DOT_RED) ) #if not recursive: # return # input ref may not have node_name if node_name: node_name_len = len(node_name) suffix = '' if node_name_len > self.MAX_NODE_LENGTH: node_name_len = self.MAX_NODE_LENGTH suffix = '...' node_data = "<b>node</b> : %s %s" % (node_name[:node_name_len], suffix) node_span = SpanWdg(node_data) node_span.add_style('padding-left: 22px') widget.add(node_span) widget.add(HtmlElement.br()) # more info of this ref node is put into this div div_id = 'toggle_content_%s' % toggle_id div = DivWdg(id=div_id) div.add_style('display: none') swap = SwapDisplayWdg.get_triangle_wdg() swap.add_style('float: left') div.add_style('margin: 0 20px 0 20px') div.add(HtmlElement.br()) # stop the recursion after this around if recursive: recursive = False else: return # set up the toggle scripts title = None SwapDisplayWdg.create_swap_title(title, swap, div) swap.get_on_widget().add_behavior({'type': 'click_up', 'cbjs_action': "spt.panel.load('%s', 'pyasm.widget.DependencyWdg', {'mode':'detail', \ 'snapshot_code': '%s'}, {}, false)" %(div_id, ref_snapshot.get_code())}) widget.add(HtmlElement.br()) widget.set_widget(swap, toggle_id) widget.add(div) """ # set recursive to False here to keep it simple for now widget_len = self._handle_snapshot(ref_snapshot, div, upstream, recursive=False) # add the toggle swap on if there are contents in the content div if widget_len: widget.set_widget(swap, toggle_id) widget.add_style("margin-left: 12px") widget.add(HtmlElement.br()) widget.add(div) """ class DependencyThumbWdg(ThumbWdg): def set_text_link(self, widget, div, image_link): '''override how the text link is drawn''' div.add_style('float', 'left') div.add_style('margin-left', '10px') filename = os.path.basename(image_link) if len(filename) > 40: filename = "%s..." % (filename[0:40]) span = SpanWdg(css='med') #href = HtmlElement.href(filename, image_link) href = SpanWdg(filename) href.add_color("color", "color") span.add(href) widget.add(span) span.add_tip('Right-click and choose [Save Link As..] to save to disk.') def get_icon_info(self, image_link, repo_path=None, icon_type='icon'): icon_size = self.get_icon_size() p = re.compile(r'.*(\.jpg|\.png|\.tif)$') if p.match(image_link) and icon_type in self.info: icon_link = self.info.get('icon') else: icon_link = ThumbWdg.find_icon_link(image_link) if image_link.endswith(".pdf"): icon_size = int( 80.0 / 120.0 * float(icon_size) ) return icon_link, icon_size
{ "pile_set_name": "Github" }
## @file # Initializes TPM 2.0 device and measure FVs in PEI phase # # This module will initialize TPM device, measure reported FVs and BIOS version. # # Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # ## [Defines] INF_VERSION = 0x00010005 BASE_NAME = TrEEPei MODULE_UNI_FILE = TrEEPei.uni FILE_GUID = CA5A1928-6523-409d-A9FE-5DCC87387222 MODULE_TYPE = PEIM VERSION_STRING = 1.0 ENTRY_POINT = PeimEntryMA # # The following information is for reference only and not required by the build tools. # # VALID_ARCHITECTURES = IA32 X64 IPF EBC # # [BootMode] # S3_RESUME ## SOMETIMES_CONSUMES # [Sources] TrEEPei.c [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec SecurityPkg/SecurityPkg.dec [LibraryClasses] HobLib PeimEntryPoint PeiServicesLib BaseMemoryLib DebugLib Tpm2CommandLib PeiServicesTablePointerLib Tpm2DeviceLib HashLib PerformanceLib MemoryAllocationLib ReportStatusCodeLib [Guids] gTcgEventEntryHobGuid ## PRODUCES ## HOB gTpmErrorHobGuid ## SOMETIMES_PRODUCES ## HOB gMeasuredFvHobGuid ## PRODUCES ## HOB gEfiTpmDeviceInstanceNoneGuid ## SOMETIMES_PRODUCES ## GUID # TPM device identifier gEfiTpmDeviceInstanceTpm12Guid ## SOMETIMES_PRODUCES ## GUID # TPM device identifier [Ppis] gEfiPeiFirmwareVolumeInfoPpiGuid ## SOMETIMES_CONSUMES ## NOTIFY gEfiPeiFirmwareVolumeInfo2PpiGuid ## SOMETIMES_CONSUMES ## NOTIFY gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid ## SOMETIMES_CONSUMES gPeiTpmInitializedPpiGuid ## SOMETIMES_PRODUCES gPeiTpmInitializationDonePpiGuid ## PRODUCES gEfiEndOfPeiSignalPpiGuid ## SOMETIMES_CONSUMES ## NOTIFY [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString ## SOMETIMES_CONSUMES gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES gEfiSecurityPkgTokenSpaceGuid.PcdTpm2InitializationPolicy ## CONSUMES gEfiSecurityPkgTokenSpaceGuid.PcdTpm2SelfTestPolicy ## SOMETIMES_CONSUMES gEfiSecurityPkgTokenSpaceGuid.PcdTpm2ScrtmPolicy ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported ## CONSUMES gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice ## SOMETIMES_CONSUMES [Depex] gEfiPeiMasterBootModePpiGuid AND gEfiPeiReadOnlyVariable2PpiGuid AND gEfiTpmDeviceSelectedGuid [UserExtensions.TianoCore."ExtraFiles"] TrEEPeiExtra.uni
{ "pile_set_name": "Github" }
{ "props": { "allowOverflow": "Entfernt Überlauf-Neupositionierung für den Inhalt", "inputActivator": "Legt ein neues Aktivierungsziel für das abgelöste Element fest. Verwende, wenn detachable Elemente in `v-input`-Slots platziert werden", "maxWidth": "Legt die maximale Breite für den Inhalt fest", "minWidth": "Legt die minimale Breite für den Inhalt fest", "nudgeBottom": "Schiebe den Inhalt nach unten", "nudgeLeft": "Schiebe den Inhalt nach links", "nudgeRight": "Schiebe den Inhalt nach rechts", "nudgeTop": "Schiebe den Inhalt nach oben", "nudgeWidth": "Stoße die Breite an", "offsetOverflow": "Bewirkt, dass die Komponente durch Überlauf auf die gegenüberliegende Seite gedreht wird", "positionX": "Wird verwendet, um den Inhalt zu positionieren, wenn kein Aktivierungs-Slot verwendet wird", "positionY": "Wird verwendet, um den Inhalt zu positionieren, wenn kein Aktivierungs-Slot verwendet wird", "zIndex": "Der z-Index für die Komponente" } }
{ "pile_set_name": "Github" }