text
stringlengths
2
99k
meta
dict
From d028334281b218209412ec6e1dba56ca96320bd9 Mon Sep 17 00:00:00 2001 From: Gustavo Zacarias <[email protected]> Date: Tue, 10 Sep 2013 16:08:29 -0300 Subject: [PATCH] configure: uclinux is also linux Signed-off-by: Gustavo Zacarias <[email protected]> --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d52b1ce..9389b70 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_DISABLE_STATIC LT_INIT CHECK_GCC_FVISIBILITY case "$host" in -*-*-linux*) ;; +*-*-linux* | *-*-uclinux*) ;; *) AC_MSG_ERROR([Linux only, dude!]);; esac -- 1.8.1.5
{ "pile_set_name": "Github" }
package com.alibaba.datax.plugin.reader.hdfsreader.hfile; import com.alibaba.datax.common.util.Configuration; import com.alibaba.datax.plugin.reader.hdfsreader.Key; /** * Parser * @author davidhua * 2020/2/24 */ public interface HFileParser { String[] PARSE_COLUMNS = new String[]{Key.HFILE_PARSE_ROW_KEY, Key.HFILE_PARSE_FAMILY, Key.HFIEL_PARSE_QUALIFIER, Key.HFILE_PARSE_VALUE, Key.HFILE_TIMESTAMP}; /** * Parse HFile under input path * @param inputPath input path * @param parseConf configuration for parsing * @param action action */ void parse(String inputPath, Configuration parseConf, Action action); @FunctionalInterface interface Action{ /** * Process source lines * @param sourceLine source line * @return */ void process(String[] sourceLine); } }
{ "pile_set_name": "Github" }
import LayerConcurrencyHelper from '../../src/LayerConcurrencyHelper'; import CartoRuntimeError from '../../src/errors/carto-runtime-error'; describe('LayerConcurrencyHelper', () => { it('should allow sequential init & end of major and minor changes', () => { const helper = new LayerConcurrencyHelper(); let majorChange = helper.initMajorChange(); expect(majorChange).toEqual({ major: 0, minor: 0 }); helper.endMajorChange(majorChange); let minorChange = helper.initMinorChange(); expect(minorChange).toEqual({ major: 0, minor: 1 }); helper.endMinorChange(minorChange); }); describe('detectConcurrentChanges', () => { it('should block 2 concurrent major changes', () => { const helper = new LayerConcurrencyHelper(); let change1 = helper.initMajorChange(); let change2 = helper.initMajorChange(); // from a theorical concurrent update helper.endMajorChange(change2); // it doesn't raise an error... expect(() => { helper.endMajorChange(change1); // ...but this it does! }).toThrowError(CartoRuntimeError); }); it('should block 2 concurrent changes: 1 major vs 1 minor', () => { const helper = new LayerConcurrencyHelper(); let change1 = helper.initMinorChange(); let change2 = helper.initMajorChange(); helper.endMajorChange(change2); expect(() => { helper.endMinorChange(change1); }).toThrowError(CartoRuntimeError); }); it('should block 2 concurrent changes: 1 minor vs 1 minor', () => { const helper = new LayerConcurrencyHelper(); let change1 = helper.initMinorChange(); let change2 = helper.initMinorChange(); helper.endMinorChange(change2); expect(() => { helper.endMinorChange(change1); }).toThrowError(CartoRuntimeError); }); }); });
{ "pile_set_name": "Github" }
{ "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "scale" : "2x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
{ "pile_set_name": "Github" }
opengt set com 115200n81 set comecho off set senddelay 0.02 waitquiet 0.2 0.2 flash 0.1 :start send "AT+CGMI^m" get 1 "" $s print $s :continue exit 0
{ "pile_set_name": "Github" }
/* * Copyright 2015-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.funtl.leesite.modules.echarts.web; import java.util.HashMap; import java.util.Map; import java.util.Random; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.funtl.leesite.common.web.BaseController; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value = "${adminPath}/echarts/linedoublenum") public class LineDoubleNumController extends BaseController { private static final long serialVersionUID = -6886697421555222670L; private Map<String, Double[][]> axisDataArr; @RequestMapping(value = {"index", ""}) public String index(HttpServletRequest request, HttpServletResponse response, Model model) { //x+y轴数据Double[x轴数据][y轴数据] request.setAttribute("axisDataArr", getaxisDataArr()); return "modules/echarts/lineDoubleNum"; } public Map<String, Double[][]> getaxisDataArr() { Random random = new Random(); axisDataArr = new HashMap<String, Double[][]>(); Double[][] data1 = new Double[10][2]; for (int i = 0; i < 10; i++) { data1[i][0] = i + 0.0; data1[i][1] = random.nextInt(10) + 0.0; } axisDataArr.put("曲线一", data1); Double[][] data2 = new Double[10][2]; for (int i = 0; i < 10; i++) { data2[i][0] = i + 1.0; data2[i][1] = random.nextInt(10) + 0.0; } axisDataArr.put("曲线二", data2); return axisDataArr; } }
{ "pile_set_name": "Github" }
<?php /** * MainWP Manage Sites View. * * @package MainWP/Dashboard */ namespace MainWP\Dashboard; /** * Class MainWP_Manage_Sites_View * * @package MainWP\Dashboard */ class MainWP_Manage_Sites_View { /** * Method init_menu() * * Initiate Sites sub menu. * * @return add_submenu_page() */ public static function init_menu() { return add_submenu_page( 'mainwp_tab', __( 'Sites', 'mainwp' ), '<span id="mainwp-Sites">' . __( 'Sites', 'mainwp' ) . '</span>', 'read', 'managesites', array( MainWP_Manage_Sites::get_class_name(), 'render_manage_sites' ) ); } /** * Method init_subpages_menu() * * @param array $subPages Sub pages array. */ public static function init_subpages_menu( &$subPages ) { ?> <div id="menu-mainwp-Sites" class="mainwp-submenu-wrapper"> <div class="wp-submenu sub-open" style=""> <div class="mainwp_boxout"> <div class="mainwp_boxoutin"></div> <a href="<?php echo admin_url( 'admin.php?page=managesites' ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Manage Sites', 'mainwp' ); ?></a> <?php if ( mainwp_current_user_have_right( 'dashboard', 'add_sites' ) ) { ?> <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'managesites_add_new' ) ) { ?> <a href="<?php echo admin_url( 'admin.php?page=managesites&do=new' ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Add New', 'mainwp' ); ?></a> <?php } ?> <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'managesites_import' ) ) { ?> <a href="<?php echo admin_url( 'admin.php?page=managesites&do=bulknew' ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Import Sites', 'mainwp' ); ?></a> <?php } ?> <?php } ?> <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'ManageGroups' ) ) { ?> <a href="<?php echo admin_url( 'admin.php?page=ManageGroups' ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Groups', 'mainwp' ); ?></a> <?php } ?> <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'MonitoringSites' ) ) { ?> <a href="<?php echo admin_url( 'admin.php?page=MonitoringSites' ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Monitoring', 'mainwp' ); ?></a> <?php } ?> <?php if ( isset( $subPages ) && is_array( $subPages ) ) { foreach ( $subPages as $subPage ) { if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && true !== $subPage['menu_hidden'] ) ) { if ( MainWP_Menu::is_disable_menu_item( 3, 'ManageSites' . $subPage['slug'] ) ) { continue; } ?> <a href="<?php echo admin_url( 'admin.php?page=ManageSites' . $subPage['slug'] ); ?>" class="mainwp-submenu"><?php echo esc_html( $subPage['title'] ); ?></a> <?php } } } ?> </div> </div> </div> <?php } /** * Method init_left_menu() * * Initiate left Sites menu. * * @param array $subPages Sub pages array. */ public static function init_left_menu( $subPages = array() ) { MainWP_Menu::add_left_menu( array( 'title' => __( 'Sites', 'mainwp' ), 'parent_key' => 'mainwp_tab', 'slug' => 'managesites', 'href' => 'admin.php?page=managesites', 'icon' => '<i class="globe icon"></i>', ), 1 ); $items_menu = array( array( 'title' => __( 'Manage Sites', 'mainwp' ), 'parent_key' => 'managesites', 'slug' => 'managesites', 'href' => 'admin.php?page=managesites', 'right' => '', ), array( 'title' => __( 'Add New', 'mainwp' ), 'parent_key' => 'managesites', 'href' => 'admin.php?page=managesites&do=new', 'slug' => 'managesites', 'right' => 'add_sites', 'item_slug' => 'managesites_add_new', ), array( 'title' => __( 'Import Sites', 'mainwp' ), 'parent_key' => 'managesites', 'href' => 'admin.php?page=managesites&do=bulknew', 'slug' => 'managesites', 'right' => 'add_sites', 'item_slug' => 'managesites_import', ), array( 'title' => __( 'Groups', 'mainwp' ), 'parent_key' => 'managesites', 'href' => 'admin.php?page=ManageGroups', 'slug' => 'ManageGroups', 'right' => '', ), array( 'title' => __( 'Monitoring', 'mainwp' ), 'parent_key' => 'managesites', 'href' => 'admin.php?page=MonitoringSites', 'slug' => 'MonitoringSites', 'right' => '', ), ); MainWP_Menu::init_subpages_left_menu( $subPages, $items_menu, 'managesites', 'ManageSites' ); foreach ( $items_menu as $item ) { if ( isset( $item['item_slug'] ) ) { if ( MainWP_Menu::is_disable_menu_item( 3, $item['item_slug'] ) ) { continue; } } else { if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { continue; } } MainWP_Menu::add_left_menu( $item, 2 ); } } /** * Method render_header() * * Build Sites page header. * * @param string $shownPage Current Page. * @param string $subPages Sites subpages. */ public static function render_header( $shownPage = '', $subPages = '' ) { if ( '' === $shownPage ) { $shownPage = 'ManageSites'; } $site_id = 0; if ( isset( $_GET['id'] ) && ! empty( $_GET['id'] ) ) { $site_id = intval( $_GET['id'] ); } elseif ( isset( $_GET['backupid'] ) && ! empty( $_GET['backupid'] ) ) { $site_id = intval( $_GET['backupid'] ); } elseif ( isset( $_GET['updateid'] ) && ! empty( $_GET['updateid'] ) ) { $site_id = intval( $_GET['updateid'] ); } elseif ( isset( $_GET['dashboard'] ) && ! empty( $_GET['dashboard'] ) ) { $site_id = intval( $_GET['dashboard'] ); } elseif ( isset( $_GET['scanid'] ) && ! empty( $_GET['scanid'] ) ) { $site_id = intval( $_GET['scanid'] ); } elseif ( isset( $_GET['emailsettingsid'] ) && ! empty( $_GET['emailsettingsid'] ) ) { $site_id = intval( $_GET['emailsettingsid'] ); } $managesites_pages = array( 'ManageSites' => array( 'href' => 'admin.php?page=managesites', 'title' => __( 'Manage Sites', 'mainwp' ), 'access' => true, ), 'AddNew' => array( 'href' => 'admin.php?page=managesites&do=new', 'title' => __( 'Add New', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'add_sites' ), ), 'BulkAddNew' => array( 'href' => 'admin.php?page=managesites&do=bulknew', 'title' => __( 'Import Sites', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'add_sites' ), ), 'ManageGroups' => array( 'href' => 'admin.php?page=ManageGroups', 'title' => __( 'Groups', 'mainwp' ), 'access' => true, ), 'MonitoringSites' => array( 'href' => 'admin.php?page=MonitoringSites', 'title' => __( 'Monitoring', 'mainwp' ), 'access' => true, ), ); $site_pages = array( 'ManageSitesDashboard' => array( 'href' => 'admin.php?page=managesites&dashboard=' . $site_id, 'title' => __( 'Overview', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'access_individual_dashboard' ), ), 'ManageSitesEdit' => array( 'href' => 'admin.php?page=managesites&id=' . $site_id, 'title' => __( 'Edit', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'edit_sites' ), ), 'ManageSitesUpdates' => array( 'href' => 'admin.php?page=managesites&updateid=' . $site_id, 'title' => __( 'Updates', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'access_individual_dashboard' ), ), 'ManageSitesEmailSettings' => array( 'href' => 'admin.php?page=managesites&emailsettingsid=' . $site_id, 'title' => __( 'Email Settings', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'edit_sites' ), ), 'ManageSitesBackups' => array( 'href' => 'admin.php?page=managesites&backupid=' . $site_id, 'title' => __( 'Backups', 'mainwp' ), 'access' => mainwp_current_user_have_right( 'dashboard', 'execute_backups' ), ), 'SecurityScan' => array( 'href' => 'admin.php?page=managesites&scanid=' . $site_id, 'title' => __( 'Security Scan', 'mainwp' ), 'access' => true, ), ); /** * MainWP Use External Primary backup Method global. * * @global string */ global $mainwpUseExternalPrimaryBackupsMethod; if ( ! empty( $mainwpUseExternalPrimaryBackupsMethod ) ) { unset( $site_pages['ManageSitesBackups'] ); } elseif ( ! get_option( 'mainwp_enableLegacyBackupFeature' ) ) { if ( isset( $site_pages['ManageSitesBackups'] ) ) { unset( $site_pages['ManageSitesBackups'] ); } } $pagetitle = __( 'Sites', 'mainwp' ); if ( 0 !== $site_id ) { $website = MainWP_DB::instance()->get_website_by_id( $site_id ); $imgfavi = ''; if ( 1 == get_option( 'mainwp_use_favicon', 1 ) ) { $favi_url = MainWP_Connect::get_favico_url( $website ); $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/>&nbsp;'; } $pagetitle = $imgfavi . ' ' . $website->url; } $params = array( 'title' => $pagetitle, ); MainWP_UI::render_top_header( $params ); self::render_managesites_header( $site_pages, $managesites_pages, $subPages, $site_id, $shownPage ); if ( 'ManageSites' === $shownPage || 'MonitoringSites' === $shownPage ) { $which = strtolower( $shownPage ); MainWP_UI::render_second_top_header( $which ); } } /** * Method render_footer() * * Close the page container. * * @param string $shownPage Current Page. * @param string $subPages Sites subpages. */ public static function render_footer( $shownPage, $subPages = false ) { echo '</div>'; } /** * Method render_managesites_header() * * Render manage sites header. * * @param array $site_pages site pages. * @param array $managesites_pages manage site pages. * @param array $subPages sub pages. * @param int $site_id Site id. * @param string $shownPage Current Page. */ private static function render_managesites_header( $site_pages, $managesites_pages, $subPages, $site_id, $shownPage ) { $renderItems = array(); if ( isset( $managesites_pages[ $shownPage ] ) ) { foreach ( $managesites_pages as $page => $value ) { if ( MainWP_Menu::is_disable_menu_item( 3, $page ) ) { continue; } $item = $value; $item['active'] = ( $page == $shownPage ) ? true : false; $renderItems[] = $item; } } elseif ( $site_id ) { foreach ( $site_pages as $page => $value ) { if ( MainWP_Menu::is_disable_menu_item( 3, $page ) ) { continue; } $item = $value; $item['active'] = ( $page == $shownPage ) ? true : false; $renderItems[] = $item; } } if ( isset( $subPages ) && is_array( $subPages ) ) { foreach ( $subPages as $subPage ) { if ( MainWP_Menu::is_disable_menu_item( 3, 'ManageSites' . $subPage['slug'] ) ) { continue; } if ( isset( $subPage['sitetab'] ) && true === $subPage['sitetab'] && empty( $site_id ) ) { continue; } $item = array(); $item['title'] = $subPage['title']; $item['href'] = 'admin.php?page=ManageSites' . $subPage['slug'] . ( $site_id ? '&id=' . esc_attr( $site_id ) : '' ); $item['active'] = ( $subPage['slug'] == $shownPage ) ? true : false; $renderItems[] = $item; } } MainWP_UI::render_page_navigation( $renderItems ); } /** * Method render_import_sites() * * Render import sites dialog. */ public static function render_import_sites() { ?> <div id="mainwp-importing-sites" class="ui active inverted dimmer" style="display:none"> <div class="ui medium text loader"><?php esc_html_e( 'Importing', 'mainwp' ); ?></div> </div> <?php $errors = array(); if ( isset( $_FILES['mainwp_managesites_file_bulkupload']['error'] ) && UPLOAD_ERR_OK == $_FILES['mainwp_managesites_file_bulkupload']['error'] && check_admin_referer( 'mainwp-admin-nonce' ) ) { if ( isset( $_FILES['mainwp_managesites_file_bulkupload']['tmp_name'] ) && is_uploaded_file( $_FILES['mainwp_managesites_file_bulkupload']['tmp_name'] ) ) { $tmp_path = isset( $_FILES['mainwp_managesites_file_bulkupload']['tmp_name'] ) ? sanitize_text_field( wp_unslash( $_FILES['mainwp_managesites_file_bulkupload']['tmp_name'] ) ) : ''; MainWP_System_Utility::get_wp_file_system(); /** * WordPress files system object. * * @global object */ global $wp_filesystem; $content = $wp_filesystem->get_contents( $tmp_path ); // to compatible with EOL on OS. $content = str_replace( "\r\n", "\n", $content ); $content = str_replace( "\r", "\n", $content ); $lines = explode( "\n", $content ); $default_values = array( 'name' => '', 'url' => '', 'adminname' => '', 'wpgroups' => '', 'uniqueId' => '', 'http_user' => '', 'http_pass' => '', 'verify_certificate' => 1, 'ssl_version' => 'auto', ); if ( is_array( $lines ) && ( 0 < count( $lines ) ) ) { $row = 0; $header_line = null; foreach ( $lines as $originalLine ) { $line = trim( $originalLine ); if ( MainWP_Utility::starts_with( $line, '#' ) ) { continue; } $items = str_getcsv( $line, ',' ); if ( ( null == $header_line ) && ! empty( $_POST['mainwp_managesites_chk_header_first'] ) ) { $header_line = $line . "\r\n"; continue; } if ( 3 > count( $items ) ) { continue; } $x = 0; foreach ( $default_values as $field => $val ) { $value = isset( $items[ $x ] ) ? $items[ $x ] : $val; if ( 'verify_certificate' === $field ) { if ( 'T' === $value ) { $value = '1'; } elseif ( 'Y' === $value ) { $value = '0'; } } $import_data[ $field ] = $value; $x++; } $encoded = wp_json_encode( $import_data ); ?> <input type="hidden" id="mainwp_managesites_import_csv_line_<?php echo ( $row + 1 ); ?>" value="" encoded-data="<?php echo esc_attr( $encoded ); ?>" original="<?php echo esc_attr( $originalLine ); ?>" /> <?php $row++; } $header_line = trim( $header_line ); ?> <input type="hidden" id="mainwp_managesites_do_import" value="1"/> <input type="hidden" id="mainwp_managesites_total_import" value="<?php echo esc_attr( $row ); ?>"/> <div class="mainwp_managesites_import_listing" id="mainwp_managesites_import_logging"> <pre class="log"><?php echo esc_html( $header_line ); ?></pre> </div> <div class="mainwp_managesites_import_listing" id="mainwp_managesites_import_fail_logging" style="display: none;"> <?php echo esc_html( $header_line ); ?> </div> <?php } else { $errors[] = __( 'Invalid data. Please, review the import file.', 'mainwp' ) . '<br />'; } } else { $errors[] = __( 'Upload failed. Please, try again.', 'mainwp' ) . '<br />'; } } else { $errors[] = __( 'Upload failed. Please, try again.', 'mainwp' ) . '<br />'; } if ( 0 < count( $errors ) ) { ?> <div class="error below-h2"> <?php foreach ( $errors as $error ) { ?> <p><strong><?php esc_html_e( 'Error', 'mainwp' ); ?></strong>: <?php echo esc_html( $error ); ?></p> <?php } ?> </div> <?php } } /** * Method render_sync_exts_settings() * * Render sync extension settings. */ public static function render_sync_exts_settings() { $sync_extensions_options = apply_filters_deprecated( 'mainwp-sync-extensions-options', array( array() ), '4.0.7.2', 'mainwp_sync_extensions_options' ); // @deprecated Use 'mainwp_sync_extensions_options' instead. $sync_extensions_options = apply_filters( 'mainwp_sync_extensions_options', $sync_extensions_options ); $working_extensions = MainWP_Extensions_Handler::get_indexed_extensions_infor(); $available_exts_data = MainWP_Extensions_View::get_available_extensions(); if ( 0 < count( $working_extensions ) && 0 < count( $sync_extensions_options ) ) { ?> <h3 class="ui dividing header"> <?php esc_html_e( ' Extensions Settings Synchronization', 'mainwp' ); ?> <div class="sub header"><?php esc_html_e( 'You have Extensions installed that require an additional plugin to be installed on this new Child Site for the Extension to work correctly. From the list below select the plugins you want to install and if you want to apply the Extensions default settings to this Child site.', 'mainwp' ); ?></div> </h3> <?php foreach ( $working_extensions as $slug => $data ) { $dir_slug = dirname( $slug ); if ( ! isset( $sync_extensions_options[ $dir_slug ] ) ) { continue; } $sync_info = isset( $sync_extensions_options[ $dir_slug ] ) ? $sync_extensions_options[ $dir_slug ] : array(); $ext_name = str_replace( 'MainWP', '', $data['name'] ); $ext_name = str_replace( 'Extension', '', $ext_name ); $ext_name = trim( $ext_name ); $ext_name = esc_html( $ext_name ); $ext_data = isset( $available_exts_data[ dirname( $slug ) ] ) ? $available_exts_data[ dirname( $slug ) ] : array(); if ( isset( $ext_data['img'] ) ) { $img_url = $ext_data['img']; } else { $img_url = MAINWP_PLUGIN_URL . 'assets/images/extensions/placeholder.png'; } $html = '<div class="ui grid field">'; $html .= '<div class="sync-ext-row" slug="' . $dir_slug . '" ext_name = "' . esc_attr( $ext_name ) . '"status="queue">'; $html .= '<h4>' . $ext_name . '</h4>'; if ( isset( $sync_info['plugin_slug'] ) && ! empty( $sync_info['plugin_slug'] ) ) { $html .= '<div class="sync-install-plugin" slug="' . esc_attr( dirname( $sync_info['plugin_slug'] ) ) . '" plugin_name="' . esc_attr( $sync_info['plugin_name'] ) . '">'; $html .= '<div class="ui checkbox"><input type="checkbox" class="chk-sync-install-plugin" /> <label>' . esc_html( sprintf( __( 'Install %1$s plugin', 'mainwp' ), esc_html( $sync_info['plugin_name'] ) ) ) . '</label></div> '; $html .= '<i class="ui active inline loader tiny" style="display: none"></i> <span class="status"></span>'; $html .= '</div>'; if ( ! isset( $sync_info['no_setting'] ) || empty( $sync_info['no_setting'] ) ) { $html .= '<div class="sync-options options-row">'; $html .= '<div class="ui checkbox"><input type="checkbox" /><label> '; $html .= sprintf( __( 'Apply %1$s %2$ssettings%3$s', 'mainwp' ), esc_html( $sync_info['plugin_name'] ), '<a href="admin.php?page=' . $data['page'] . '">', '</a>' ); $html .= '</label>'; $html .= '</div> '; $html .= '<i class="ui active inline loader tiny" style="display: none"></i> <span class="status"></span>'; $html .= '</div>'; } } else { $html .= '<div class="sync-global-options options-row">'; $html .= '<div class="ui checkbox"><input type="checkbox" /> <label>' . esc_html( sprintf( __( 'Apply global %1$s options' ), trim( $ext_name ) ) ) . '</label></div> '; $html .= '<i class="ui active inline loader tiny" style="display: none"></i> <span class="status"></span>'; $html .= '</div>'; } $html .= '</div>'; $html .= '</div>'; echo $html; } } } /** * Method render_dashboard() * * Render individual Child Site Overview page. * * @param mixed $website Child Site. * @param mixed $page Page to render. * * @return string Sites Overview Page. */ public static function render_dashboard( &$website, &$page ) { if ( ! mainwp_current_user_have_right( 'dashboard', 'access_individual_dashboard' ) ) { mainwp_do_not_have_permissions( __( 'individual dashboard', 'mainwp' ) ); return; } ?> <div> <?php if ( -1 == $website->mainwpdir ) { echo '<div class="ui yellow message"><span class="mainwp_conflict" siteid="' . intval( $website->id ) . '"><strong>Configuration issue detected</strong>: MainWP has no write privileges to the uploads directory. Because of this some of the functionality might not work.</span></div>'; } /** * Screen layout columns global. * * @global string */ global $screen_layout_columns; MainWP_Overview::render_dashboard_body( array( $website ), $page, $screen_layout_columns ); ?> </div> <?php } /** * Method render_header_tabs() * * Render Sites sub page header tabs. * * @param mixed $active_tab Currently active tab. * @param mixed $active_text Currently active drop down text. * @param mixed $show_language_updates Whether or not to show translations. */ public static function render_header_tabs( $active_tab, $active_text, $show_language_updates ) { ?> <div class="mainwp-sub-header"> <div class="ui grid"> <div class="equal width row"> <div class="middle aligned column"> <?php echo apply_filters( 'mainwp_widgetupdates_actions_top', '' ); ?> </div> <div class="right aligned middle aligned column"> <div class="inline field"> <div class="ui selection dropdown"> <div class="text"><?php echo $active_text; ?></div> <i class="dropdown icon"></i> <div class="menu"> <div class="<?php echo 'WordPress' === $active_tab ? 'active' : ''; ?> item" data-tab="wordpress" data-value="wordpress"><?php esc_html_e( 'WordPress Updates', 'mainwp' ); ?></div> <div class="<?php echo 'plugins' === $active_tab ? 'active' : ''; ?> item" data-tab="plugins" data-value="plugins"><?php esc_html_e( 'Plugins Updates', 'mainwp' ); ?></div> <div class="<?php echo 'themes' === $active_tab ? 'active' : ''; ?> item" data-tab="themes" data-value="themes"><?php esc_html_e( 'Themes Updates', 'mainwp' ); ?></div> <?php if ( $show_language_updates ) : ?> <div class="<?php echo 'trans' === $active_tab ? 'active' : ''; ?> item" data-tab="translations" data-value="translations"><?php esc_html_e( 'Translations Updates', 'mainwp' ); ?></div> <?php endif; ?> <div class="<?php echo 'abandoned-plugins' === $active_tab ? 'active' : ''; ?> item" data-tab="abandoned-plugins" data-value="abandoned-plugins"><?php esc_html_e( 'Abandoned Plugins', 'mainwp' ); ?></div> <div class="<?php echo 'abandoned-themes' === $active_tab ? 'active' : ''; ?> item" data-tab="abandoned-themes" data-value="abandoned-themes"><?php esc_html_e( 'Abandoned Themes', 'mainwp' ); ?></div> </div> </div> </div> </div> </div> </div> </div> <?php } /** * Method render_scan_site() * * Render Security Scan sub page. * * @param mixed $website Child Site. */ public static function render_scan_site( &$website ) { if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_security_issues' ) ) { mainwp_do_not_have_permissions( __( 'security scan', 'mainwp' ) ); return; } ?> <div class="ui segment"> <h3 class="ui dividing header"><?php esc_html_e( 'Basic Security Check', 'mainwp' ); ?></h3> <?php // Render security check issues. $websiteid = isset( $_GET['scanid'] ) ? intval( $_GET['scanid'] ) : null; $website = MainWP_DB::instance()->get_website_by_id( $websiteid ); if ( empty( $website ) ) { return; } if ( mainwp_current_user_have_right( 'dashboard', 'manage_security_issues' ) ) { do_action_deprecated( 'mainwp-securityissues-sites', array( $website ), '4.0.7.2', 'mainwp_securityissues_sites' ); // @deprecated Use 'mainwp_securityissues_sites' instead. /** * Action: mainwp_securityissues_sites * * Fires on a child site Security Scan page at top. * * @hooked MainWP basic security scan features. * * @param object $website Object containing child site info. * * @since Unknown */ do_action( 'mainwp_securityissues_sites', $website ); } ?> <?php // Hook in MainWP Sucuri Extension. if ( mainwp_current_user_have_right( 'extension', 'mainwp-sucuri-extension' ) ) { if ( is_plugin_active( 'mainwp-sucuri-extension/mainwp-sucuri-extension.php' ) ) { do_action_deprecated( 'mainwp-sucuriscan-sites', array( $website ), '4.0.7.2', 'mainwp_sucuriscan_sites' ); // @deprecated Use 'mainwp_sucuriscan_sites' instead. /** * Action: mainwp_sucuriscan_sites * * Fires on a child site Security Scan page. * * @hooked MainWP Sucuri Extension data. * * @param object $website Object containing child site info. * * @since Unknown */ do_action( 'mainwp_sucuriscan_sites', $website ); } } ?> <?php // Hook in MainWP Wordfence Extension. if ( mainwp_current_user_have_right( 'extension', 'mainwp-wordfence-extension' ) ) { if ( is_plugin_active( 'mainwp-wordfence-extension/mainwp-wordfence-extension.php' ) ) { do_action_deprecated( 'mainwp-wordfence-sites', array( $website ), '4.0.7.2', 'mainwp_wordfence_sites' ); // @deprecated Use 'mainwp_wordfence_sites' instead. /** * Action: mainwp_wordfence_sites * * Fires on a child site Security Scan page. * * @hooked MainWP Wordfence Extension data. * * @param object $website Object containing child site info. * * @since Unknown */ do_action( 'mainwp_wordfence_sites', $website ); } } ?> </div> <?php } /** * Method render_edit_site() * * Render individual Child Site Edit sub page. * * @param mixed $websiteid Child Site ID. * @param mixed $updated Site settings updated check. * * @return string Edit Child Site sub page. */ public static function render_edit_site( $websiteid, $updated ) { if ( ! mainwp_current_user_have_right( 'dashboard', 'edit_sites' ) ) { mainwp_do_not_have_permissions( __( 'edit sites', 'mainwp' ) ); return; } $website = MainWP_DB::instance()->get_website_by_id( $websiteid, false, array( 'monitoring_notification_emails', 'settings_notification_emails' ) ); if ( ! MainWP_System_Utility::can_edit_website( $website ) ) { $website = null; } if ( empty( $website ) ) { return; } $groups = MainWP_DB_Common::instance()->get_groups_for_current_user(); ?> <div class="ui segment mainwp-edit-site-<?php echo intval( $website->id ); ?>" id="mainwp-edit-site"> <?php if ( $updated ) : ?> <div class="ui message green"><i class="close icon"></i> <?php esc_html_e( 'Child site settings saved successfully.', 'mainwp' ); ?></div> <?php endif; ?> <form method="POST" action="" id="mainwp-edit-single-site-form" enctype="multipart/form-data" class="ui form"> <?php wp_nonce_field( 'mainwp-admin-nonce' ); ?> <input type="hidden" name="wp_nonce" value="<?php echo wp_create_nonce( 'UpdateWebsite' . $website->id ); ?>" /> <h3 class="ui dividing header"><?php esc_html_e( 'General Settings', 'mainwp' ); ?></h3> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Site URL', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter your website URL.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left action input"> <select class="ui compact selection dropdown" id="mainwp_managesites_edit_siteurl_protocol" name="mainwp_managesites_edit_siteurl_protocol"> <option <?php echo ( MainWP_Utility::starts_with( $website->url, 'http:' ) ? 'selected' : '' ); ?> value="http">http://</option> <option <?php echo ( MainWP_Utility::starts_with( $website->url, 'https:' ) ? 'selected' : '' ); ?> value="https">https://</option> </select> <input type="text" id="mainwp_managesites_edit_siteurl" disabled="disabled" name="mainwp_managesites_edit_siteurl" value="<?php echo MainWP_Utility::remove_http_prefix( $website->url, true ); ?>" /> </div> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Administrator username', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the website Administrator username.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left labeled input"> <input type="text" id="mainwp_managesites_edit_siteadmin" name="mainwp_managesites_edit_siteadmin" value="<?php echo esc_attr( $website->adminname ); ?>" /> </div> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Site title', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the website title.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left labeled input"> <input type="text" id="mainwp_managesites_edit_sitename" name="mainwp_managesites_edit_sitename" value="<?php echo esc_attr( stripslashes( $website->name ) ); ?>" /> </div> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Unique security ID', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'If in use, enter the website Unique ID.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left labeled input"> <input type="text" id="mainwp_managesites_edit_uniqueId" name="mainwp_managesites_edit_uniqueId" value="<?php echo esc_attr( $website->uniqueId ); ?>" /> </div> </div> </div> <?php $groupsSite = MainWP_DB_Common::instance()->get_groups_by_website_id( $website->id ); $init_groups = ''; foreach ( $groups as $group ) { $init_groups .= ( isset( $groupsSite[ $group->id ] ) && $groupsSite[ $group->id ] ) ? ',' . $group->id : ''; } $init_groups = ltrim( $init_groups, ',' ); ?> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Groups', 'mainwp' ); ?></label> <div class="ten wide column" data-tooltip="<?php esc_attr_e( 'Add the website to existing group(s).', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui multiple selection dropdown" init-value="<?php echo esc_attr( $init_groups ); ?>"> <input name="mainwp_managesites_edit_addgroups" value="" type="hidden"> <i class="dropdown icon"></i> <div class="default text"><?php echo ( '' === $init_groups ) ? __( 'No groups added yet.', 'mainwp' ) : ''; ?></div> <div class="menu"> <?php foreach ( $groups as $group ) { ?> <div class="item" data-value="<?php echo $group->id; ?>"><?php echo $group->name; ?></div> <?php } ?> </div> </div> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Require backup before update', 'mainwp' ); ?></label> <div class="ui six wide column"> <select class="ui dropdown" id="mainwp_backup_before_upgrade" name="mainwp_backup_before_upgrade"> <option <?php echo ( 1 == $website->backup_before_upgrade ) ? 'selected' : ''; ?> value="1"><?php esc_html_e( 'Yes', 'mainwp' ); ?></option> <option <?php echo ( 0 == $website->backup_before_upgrade ) ? 'selected' : ''; ?> value="0"><?php esc_html_e( 'No', 'mainwp' ); ?></option> <option <?php echo ( 2 == $website->backup_before_upgrade ) ? 'selected' : ''; ?> value="2"><?php esc_html_e( 'Use global setting', 'mainwp' ); ?></option> </select> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Auto update core', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Enable if you want MainWP to automatically update WP Core on this website.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_automaticDailyUpdate" id="mainwp_automaticDailyUpdate" <?php echo ( 1 == $website->automatic_update ? 'checked="true"' : '' ); ?>><label for="mainwp_automaticDailyUpdate"></label> </div> </div> <?php if ( mainwp_current_user_have_right( 'dashboard', 'ignore_unignore_updates' ) ) : ?> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Ignore core updates', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Enable if you want to ignore WP Core updates on this website.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_is_ignoreCoreUpdates" id="mainwp_is_ignoreCoreUpdates" <?php echo ( 1 == $website->is_ignoreCoreUpdates ? 'checked="true"' : '' ); ?>><label for="mainwp_is_ignoreCoreUpdates"></label> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Ignore plugin updates', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Enable if you want to ignore plugin updates on this website.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_is_ignorePluginUpdates" id="mainwp_is_ignorePluginUpdates" <?php echo ( 1 == $website->is_ignorePluginUpdates ? 'checked="true"' : '' ); ?>><label for="mainwp_is_ignorePluginUpdates"></label> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Ignore theme updates', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Enable if you want to ignore theme updates on this website.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_is_ignoreThemeUpdates" id="mainwp_is_ignoreThemeUpdates" <?php echo ( 1 == $website->is_ignoreThemeUpdates ? 'checked="true"' : '' ); ?>><label for="mainwp_is_ignoreThemeUpdates"></label> </div> </div> <?php endif; ?> <h3 class="ui dividing header"><?php esc_html_e( 'Child Site Uptime Monitoring (Optional)', 'mainwp' ); ?></h3> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Enable basic uptime monitoring (optional)', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox mainwp-checkbox-showhide-elements" hide-parent="monitoring" data-tooltip="<?php esc_attr_e( 'Enable if you want to monitoring this website.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_managesites_edit_disableChecking" id="mainwp_managesites_edit_disableChecking" <?php echo ( 0 == $website->disable_status_check ? 'checked="true"' : '' ); ?>><label for="mainwp_managesites_edit_disableChecking"></label> </div> </div> <?php $check_interval = $website->status_check_interval; ?> <div class="ui grid field" <?php echo 1 == $website->disable_status_check ? 'style="display:none"' : ''; ?> hide-element="monitoring"> <label class="six wide column middle aligned"><?php esc_html_e( 'Check interval (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Check interval (optional)', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <select name="mainwp_managesites_edit_checkInterval" id="mainwp_managesites_edit_checkInterval" class="ui dropdown"> <option value="5" <?php echo ( 5 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Every 5 minutes', 'mainwp' ); ?></option> <option value="10" <?php echo ( 10 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Every 10 minutes', 'mainwp' ); ?></option> <option value="30" <?php echo ( 30 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Every 30 minutes', 'mainwp' ); ?></option> <option value="60" <?php echo ( 60 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Every hour', 'mainwp' ); ?></option> <option value="180" <?php echo ( 180 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Every 3 hours', 'mainwp' ); ?></option> <option value="360" <?php echo ( 360 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Every 6 hours', 'mainwp' ); ?></option> <option value="720" <?php echo ( 720 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Twice a day', 'mainwp' ); ?></option> <option value="1440" <?php echo ( 1440 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Once a day', 'mainwp' ); ?></option> <option value="0" <?php echo ( 0 == $check_interval ? 'selected' : '' ); ?>><?php esc_html_e( 'Use global setting', 'mainwp' ); ?></option> </select> </div> </div> <div class="ui grid field" <?php echo 1 == $website->disable_status_check ? 'style="display:none"' : ''; ?> hide-element="monitoring"> <label class="six wide column middle aligned"><?php esc_html_e( 'Additional notification emails (comma-separated)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Additional notification emails (comma-separated).', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left labeled input"> <input type="text" id="mainwp_managesites_edit_monitoringNotificationEmails" name="mainwp_managesites_edit_monitoringNotificationEmails" value="<?php echo ! empty( $website->monitoring_notification_emails ) ? esc_html( $website->monitoring_notification_emails ) : ''; ?>"/> </div> </div> </div> <h3 class="ui dividing header"><?php esc_html_e( 'Sites Health Monitoring (Optional)', 'mainwp' ); ?></h3> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Enable Child Site Health monitoring (optional)', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox mainwp-checkbox-showhide-elements" hide-parent="health-monitoring" data-tooltip="<?php esc_attr_e( 'Enable if you want to monitoring this website.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_managesites_edit_disableSiteHealthMonitoring" id="mainwp_managesites_edit_disableSiteHealthMonitoring" <?php echo ( 0 == $website->disable_status_check ? 'checked="true"' : '' ); ?>><label for="mainwp_managesites_edit_disableSiteHealthMonitoring"></label> </div> </div> <?php $healthThreshold = $website->health_threshold; ?> <div class="ui grid field" <?php echo 1 == $website->disable_status_check ? 'style="display:none"' : ''; ?> hide-element="health-monitoring"> <label class="six wide column middle aligned"><?php esc_html_e( 'Site health threshold (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Site health threshold.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <select name="mainwp_managesites_edit_healthThreshold" id="mainwp_managesites_edit_healthThreshold" class="ui dropdown"> <option value="80" <?php echo ( 80 == $healthThreshold ? 'selected' : '' ); ?>><?php esc_html_e( 'Should be improved', 'mainwp' ); ?></option> <option value="100" <?php echo ( 100 == $healthThreshold ? 'selected' : '' ); ?>><?php esc_html_e( 'Good', 'mainwp' ); ?></option> <option value="0" <?php echo ( 0 == $healthThreshold ? 'selected' : '' ); ?>><?php esc_html_e( 'Use global setting', 'mainwp' ); ?></option> </select> </div> </div> <h3 class="ui dividing header"><?php esc_html_e( 'Advanced Settings (Optional)', 'mainwp' ); ?></h3> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Verify certificate (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Do you want to verify SSL certificate.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <select class="ui dropdown" id="mainwp_managesites_edit_verifycertificate" name="mainwp_managesites_edit_verifycertificate"> <option <?php echo ( 1 == $website->verify_certificate ) ? 'selected' : ''; ?> value="1"><?php esc_html_e( 'Yes', 'mainwp' ); ?></option> <option <?php echo ( 0 == $website->verify_certificate ) ? 'selected' : ''; ?> value="0"><?php esc_html_e( 'No', 'mainwp' ); ?></option> <option <?php echo ( 2 == $website->verify_certificate ) ? 'selected' : ''; ?> value="2"><?php esc_html_e( 'Use global setting', 'mainwp' ); ?></option> </select> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'SSL version (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Select SSL Version. If you are not sure, select "Auto Detect".', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <select class="ui dropdown" id="mainwp_managesites_edit_ssl_version" name="mainwp_managesites_edit_ssl_version"> <option <?php echo ( 0 == $website->ssl_version ) ? 'selected' : ''; ?> value="0"><?php esc_html_e( 'Auto detect', 'mainwp' ); ?></option> <option <?php echo ( 6 == $website->ssl_version ) ? 'selected' : ''; ?> value="6"><?php esc_html_e( "Let's encrypt (TLS v1.2)", 'mainwp' ); ?></option> <option <?php echo ( 1 == $website->ssl_version ) ? 'selected' : ''; ?> value="1"><?php esc_html_e( 'TLS v1.x', 'mainwp' ); ?></option> <option <?php echo ( 2 == $website->ssl_version ) ? 'selected' : ''; ?> value="2"><?php esc_html_e( 'SSL v2', 'mainwp' ); ?></option> <option <?php echo ( 3 == $website->ssl_version ) ? 'selected' : ''; ?> value="3"><?php esc_html_e( 'SSL v3', 'mainwp' ); ?></option> <option <?php echo ( 4 == $website->ssl_version ) ? 'selected' : ''; ?> value="4"><?php esc_html_e( 'TLS v1.0', 'mainwp' ); ?></option> <option <?php echo ( 5 == $website->ssl_version ) ? 'selected' : ''; ?> value="5"><?php esc_html_e( 'TLS v1.1', 'mainwp' ); ?></option> </select> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Force IPv4 (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Do you want to force IPv4 for this child site?', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <select class="ui dropdown" id="mainwp_managesites_edit_forceuseipv4" name="mainwp_managesites_edit_forceuseipv4"> <option <?php echo ( 1 == $website->force_use_ipv4 ) ? 'selected' : ''; ?> value="1"><?php esc_html_e( 'Yes', 'mainwp' ); ?></option> <option <?php echo ( 0 == $website->force_use_ipv4 ) ? 'selected' : ''; ?> value="0"><?php esc_html_e( 'No', 'mainwp' ); ?></option> <option <?php echo ( 2 == $website->force_use_ipv4 ) ? 'selected' : ''; ?> value="2"><?php esc_html_e( 'Use global setting', 'mainwp' ); ?></option> </select> </div> </div> <input style="display:none" type="text" name="fakeusernameremembered"/> <input style="display:none" type="password" name="fakepasswordremembered"/> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'HTTP Username (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'If the child site is HTTP Basic Auth protected, enter the HTTP username here.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left labeled input"> <input type="text" id="mainwp_managesites_edit_http_user" name="mainwp_managesites_edit_http_user" value="<?php echo ( empty( $website->http_user ) ? '' : $website->http_user ); ?>" autocomplete="new-http-user" /> </div> </div> </div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'HTTP Password (optional)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'If the child site is HTTP Basic Auth protected, enter the HTTP password here.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <div class="ui left labeled input"> <input type="password" id="mainwp_managesites_edit_http_pass" name="mainwp_managesites_edit_http_pass" value="<?php echo ( empty( $website->http_pass ) ? '' : $website->http_pass ); ?>" autocomplete="new-password" /> </div> </div> </div> <?php do_action_deprecated( 'mainwp-manage-sites-edit', array( $website ), '4.0.7.2', 'mainwp_manage_sites_edit' ); // @deprecated Use 'mainwp_manage_sites_edit' instead. do_action_deprecated( 'mainwp-extension-sites-edit', array( $website ), '4.0.7.2', 'mainwp_manage_sites_edit' ); // @deprecated Use 'mainwp_manage_sites_edit' instead. /** This action is documented in ../pages/page-mainwp-manage-sites.php */ do_action( 'mainwp_manage_sites_edit', $website ); do_action( 'mainwp_extension_sites_edit_tablerow', $website ); ?> <div class="ui divider"></div> <input type="submit" name="submit" id="submit" class="ui button green big right floated" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/> </form> </div> </div> <?php } /** * Render signle site Email notification settings. * * Credits. * * Plugin-Name: WooCommerce. * Plugin URI: https://woocommerce.com/. * Author: Automattic. * Author URI: https://woocommerce.com. * License: GPLv3 or later. * * @param object $website Object containng the website info. * @param string $type Email type. * @param bool $updated_templ True if page loaded after update, false if not. */ public static function render_site_edit_email_settings( $website, $type, $updated_templ ) { $emails_settings = json_decode( $website->settings_notification_emails, true ); if ( ! is_array( $emails_settings ) ) { $emails_settings = array(); } // to fix incorrect field name. if ( isset( $emails_settings['daily_digets'] ) ) { $emails_settings['daily_digest'] = $emails_settings['daily_digets']; unset( $emails_settings['daily_digets'] ); } $default = MainWP_Notification_Settings::get_default_emails_fields( $type ); $options = isset( $emails_settings[ $type ] ) ? $emails_settings[ $type ] : array(); $options = array_merge( $default, $options ); $title = MainWP_Notification_Settings::get_notification_types( $type ); $siteid = $website->id; $email_description = MainWP_Notification_Settings::get_settings_desc( $type ); ?> <div class="ui segment"> <?php if ( $updated ) : ?> <div class="ui message green"><i class="close icon"></i> <?php esc_html_e( 'Email settings saved successfully.', 'mainwp' ); ?></div> <?php endif; ?> <?php MainWP_Notification_Settings::render_update_template_message( $updated_templ ); ?> <form method="POST" action="admin.php?page=managesites&emailsettingsid=<?php echo $siteid; ?>" class="ui form"> <input type="hidden" name="wp_nonce" value="<?php echo wp_create_nonce( 'UpdateWebsiteEmailSettings' . $siteid ); ?>" /> <input type="hidden" name="mainwp_managesites_setting_emails_type" value="<?php echo esc_html( $type ); ?>" /> <div class="ui info message"><?php _e( '<a href="https://mainwp.com/extension/boilerplate/" target="_blank">Boilerplate</a> and <a href="https://mainwp.com/extension/pro-reports/" target="_blank">Reports</a> extensions tokens are supported in the email settings and templates if extensions are in use.', 'mainwp' ); ?></div> <h3 class="ui header"><?php echo $title; ?></h3> <div class="sub header"><?php echo $email_description; ?></h3></div> <div class="ui divider"></div> <div class="ui grid field"> <label class="six wide column middle aligned"><?php esc_html_e( 'Enable', 'mainwp' ); ?></label> <div class="six wide column ui toggle checkbox" data-tooltip="<?php esc_attr_e( 'Enable this email notification.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="checkbox" name="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][disable]" id="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][disable]" <?php echo ( 0 == $options['disable'] ) ? 'checked="true"' : ''; ?>/> </div> </div> <div class="ui grid field" > <label class="six wide column middle aligned"><?php esc_html_e( 'Recipient(s)', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'You can add multiple emails by separating them with comma.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="text" name="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][recipients]" id="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][recipients]" value="<?php echo esc_html( $options['recipients'] ); ?>"/> </div> </div> <div class="ui grid field" > <label class="six wide column middle aligned"><?php esc_html_e( 'Subject', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the email subject.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="text" name="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][subject]" id="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][subject]" value="<?php echo esc_html( $options['subject'] ); ?>"/> </div> </div> <div class="ui grid field" > <label class="six wide column middle aligned"><?php esc_html_e( 'Email heading', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Enter the email heading.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <input type="text" name="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][heading]" id="mainwp_managesites_edit_settingEmails[<?php echo esc_html( $type ); ?>][heading]" value="<?php echo esc_html( $options['heading'] ); ?>"/> </div> </div> <div class="ui grid field" > <label class="six wide column middle aligned"><?php esc_html_e( 'HTML template', 'mainwp' ); ?></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Manage the email HTML template.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <?php $templ = MainWP_Notification_Template::get_template_name_by_notification_type( $type ); $overrided = MainWP_Notification_Template::instance()->is_overrided_template( $type ); echo $overrided ? esc_html__( 'This template has been overridden and can be found in:', 'mainwp' ) . ' <code>wp-content/uploads/mainwp/templates/' . $templ . '</code>' : esc_html__( 'To override and edit this email template copy:', 'mainwp' ) . ' <code>mainwp/templates/' . $templ . '</code> ' . esc_html__( 'to the folder:', 'mainwp' ) . ' <code>wp-content/uploads/mainwp/templates/' . $templ . '</code>'; ?> </div> </div> <div class="ui grid field" > <label class="six wide column middle aligned"></label> <div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'Manage the email HTML template.', 'mainwp' ); ?>" data-inverted="" data-position="top left"> <?php if ( $overrided ) { ?> <a href="<?php echo wp_nonce_url( 'admin.php?page=managesites&emailsettingsid=' . $siteid . '&edit-email=' . $type, 'delete-email-template' ); ?>" onclick="mainwp_confirm('<?php echo esc_js( 'Are you sure you want to delete this template file?', 'mainwp' ); ?>', function(){ window.location = jQuery('a#email-delete-template').attr('href');}); return false;" id="email-delete-template" class="ui button"><?php esc_html_e( 'Delete Template', 'mainwp' ); ?></a> <?php } else { ?> <a href="<?php echo wp_nonce_url( 'admin.php?page=managesites&emailsettingsid=' . $siteid . '&edit-email=' . $type, 'copy-email-template' ); ?>" class="ui button"><?php esc_html_e( 'Copy file to uploads', 'mainwp' ); ?></a> <?php } ?> <a href="javascript:void(0)" class="ui button" onclick="mainwp_view_template('<?php echo esc_js( $type ); ?>'); return false;"><?php esc_html_e( 'View Template', 'mainwp' ); ?></a> </div> </div> <div class="ui divider"></div> <a href="admin.php?page=managesites&emailsettingsid=<?php echo $siteid; ?>" class="ui big basic green button"><?php esc_html_e( 'Back', 'mainwp' ); ?></a> <input type="submit" name="submit" id="submit" class="ui button green big right floated" value="<?php esc_attr_e( 'Save Settings', 'mainwp' ); ?>"/> </form> </div> </div> <?php self::render_edit_template( $type, $siteid ); ?> <?php } /** * Render the email notification edit form. * * Credits. * * Plugin-Name: WooCommerce. * Plugin URI: https://woocommerce.com/. * Author: Automattic. * Author URI: https://woocommerce.com. * License: GPLv3 or later. * * @param string $type Email type. * @param int $siteid Child site ID. */ public static function render_edit_template( $type, $siteid = false ) { $template = MainWP_Notification_Template::get_template_name_by_notification_type( $type ); $default_dir = MainWP_Notification_Template::instance()->get_default_templates_dir(); $custom_dir = MainWP_Notification_Template::instance()->get_custom_templates_dir(); $custom_file = $custom_dir . $template; $default_file = $default_dir . $template; $template_file = apply_filters( 'mainwp_default_template_locate', $default_file, $template, $default_dir, $type, $website ); if ( $siteid ) { $localion = 'admin.php?page=managesites&emailsettingsid=' . $siteid . '&edit-email=' . $type; } else { $localion = 'admin.php?page=SettingsEmail&edit-email=' . $type; } $editable = false; ?> <div class="ui large modal" id="mainwp-edit-email-template-modal"> <div class="header"><?php esc_html_e( 'Edit Email Template', 'mainwp' ); ?></div> <div class="scrolling header"> <form method="POST" id="email-template-form" action="<?php echo esc_html( $localion ); ?>" class="ui form"> <input type="hidden" name="wp_nonce" value="<?php echo wp_create_nonce( 'save-email-template' ); ?>" /> <div class="template <?php echo esc_attr( $type ); ?>"> <?php if ( file_exists( $custom_file ) ) : ?> <div class="editor"> <textarea class="code" cols="80" rows="20" <?php if ( ! is_writable( $custom_file ) ) : // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable -- required to achieven desired results. Pull requests are welcome. ?> readonly="readonly" disabled="disabled" <?php else : $editable = true; ?> name="edit_<?php echo esc_attr( $type ) . '_code'; ?>"<?php endif; ?>><?php echo esc_html( file_get_contents( $custom_file ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- required to achieven desired results. Pull requests are welcome. ?></textarea> </div> <?php elseif ( file_exists( $template_file ) ) : ?> <div class="editor"> <textarea class="code" readonly="readonly" disabled="disabled" cols="25" rows="20"><?php echo esc_html( file_get_contents( $template_file ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- required to achieven desired results. Pull requests are welcome. ?></textarea> </div> <?php else : ?> <p><?php esc_html_e( 'File was not found.', 'mainwp' ); ?></p> <?php endif; ?> </div> </form> </div> <div class="actions"> <?php if ( $editable ) { ?> <input type="submit" form="email-template-form" class="ui green button" value="<?php esc_attr_e( 'Save', 'mainwp' ); ?>"/> <?php } ?> <input type="button" class="ui cancel button" value="<?php esc_attr_e( 'Close', 'mainwp' ); ?>"/> </div> </div> </div> <script type="text/javascript"> jQuery( document ).ready( function () { mainwp_view_template = function( templ ) { jQuery( "#mainwp-edit-email-template-modal" ).modal( { closable: false, onHide: function() { location.href = '<?php echo esc_js( $localion ); ?>'; } } ).modal( 'show' ); } } ); </script> <?php } /** * Render all email settings options. * * @param object $website Object containing the website info. * @param bool $updated True if page loaded after update, false if not. */ public static function render_edit_site_email_settings( $website, $updated ) { $emails_settings = json_decode( $website->settings_notification_emails, true ); if ( ! is_array( $emails_settings ) ) { $emails_settings = array(); } // to fix incorrect field name. if ( isset( $emails_settings['daily_digets'] ) ) { $emails_settings['daily_digest'] = $emails_settings['daily_digets']; unset( $emails_settings['daily_digets'] ); } $email_description = ''; $notification_emails = MainWP_Notification_Settings::get_notification_types(); $default_recipients = MainWP_System_Utility::get_notification_email(); ?> <div class="ui segment"> <?php if ( $updated ) : ?> <div class="ui message green"><i class="close icon"></i> <?php esc_html_e( 'Email settings saved successfully.', 'mainwp' ); ?></div> <?php endif; ?> <div class="ui info message"> <?php esc_html_e( 'Email notifications sent from MainWP Dashboard about this child site are listed below. Click on an email to configure it.', 'mainwp' ); ?> </div> <table class="ui single line table" id="mainwp-emails-settings-table"> <thead> <tr> <th class="collapsing"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> <th><?php esc_html_e( 'Email', 'mainwp' ); ?></th> <th><?php esc_html_e( 'Description', 'mainwp' ); ?></th> <th><?php esc_html_e( 'Recipient(s)', 'mainwp' ); ?></th> <th style="text-align:right"></th> </tr> </thead> <tbody> <?php foreach ( $notification_emails as $type => $name ) : ?> <?php $options = isset( $emails_settings[ $type ] ) ? $emails_settings[ $type ] : array(); $default = MainWP_Notification_Settings::get_default_emails_fields( $type ); $options = array_merge( $default, $options ); $email_description = MainWP_Notification_Settings::get_settings_desc( $type ); ?> <tr> <td><?php echo ( ! $options['disable'] ) ? '<span data-tooltip="Enabled." data-position="right center" data-inverted=""><i class="circular green check inverted icon"></i></span>' : '<span data-tooltip="Disabled." data-position="right center" data-inverted=""><i class="circular x icon inverted disabled"></i></span>'; ?></td> <td><a href="admin.php?page=managesites&emailsettingsid=<?php echo intval( $website->id ); ?>&edit-email=<?php echo rawurlencode( $type ); ?>" data-tooltip="<?php esc_html_e( 'Click to configure the email settings.', 'mainwp' ); ?>" data-position="right center" data-inverted=""><?php echo esc_html( $name ); ?></a></td> <td><?php echo esc_html( $email_description ); ?></td> <td><?php echo esc_html( $options['recipients'] ); ?></td> <td style="text-align:right"><a href="admin.php?page=managesites&emailsettingsid=<?php echo intval( $website->id ); ?>&edit-email=<?php echo rawurlencode( $type ); ?>" data-tooltip="<?php esc_html_e( 'Click to configure the email settings.', 'mainwp' ); ?>" data-position="left center" data-inverted="" class="ui green mini button"><?php esc_html_e( 'Manage', 'mainwp' ); ?></a></td> </tr> <?php endforeach; ?> </tbody> <tfoot> <tr> <th class="collapsing"><?php esc_html_e( 'Status', 'mainwp' ); ?></th> <th><?php esc_html_e( 'Email', 'mainwp' ); ?></th> <th><?php esc_html_e( 'Description', 'mainwp' ); ?></th> <th><?php esc_html_e( 'Recipient(s)', 'mainwp' ); ?></th> <th></th> </tr> </tfoot> </table> <?php /** * Action: mainwp_manage_sites_email_settings * * Fires on the Email Settigns page at bottom. * * @param object $website Object containing the website info. * * @since 4.1 */ do_action( 'mainwp_manage_sites_email_settings', $website ); ?> <script type="text/javascript"> jQuery( document ).ready( function() { jQuery( '#mainwp-emails-settings-table' ).DataTable( { "stateSave": true, "paging": false, "ordering": true, "columnDefs": [ { "orderable": false, "targets": [ 0, 3 ] } ], "order": [ [ 1, "asc" ] ] } ); } ); </script> </div> <?php } /** * Method m_reconnect_site() * * Reconnect chid site. * * @param object $website The website object. * @throws \Exception Exception on errors. * * @return boolean true|false. */ public static function m_reconnect_site( $website ) { if ( MainWP_System_Utility::can_edit_website( $website ) ) { try { if ( MainWP_Sync::sync_site( $website, true ) ) { return true; } if ( function_exists( 'openssl_pkey_new' ) ) { $conf = array( 'private_key_bits' => 2048 ); $conf_loc = MainWP_System_Utility::get_openssl_conf(); if ( ! empty( $conf_loc ) ) { $conf['config'] = $conf_loc; } $res = openssl_pkey_new( $conf ); openssl_pkey_export( $res, $privkey, null, $conf ); $pubkey = openssl_pkey_get_details( $res ); $pubkey = $pubkey['key']; } else { $privkey = '-1'; $pubkey = '-1'; } $information = MainWP_Connect::fetch_url_not_authed( $website->url, $website->adminname, 'register', array( 'pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $website->uniqueId, ), true, $website->verify_certificate, $website->http_user, $website->http_pass, $website->ssl_version ); if ( isset( $information['error'] ) && '' !== $information['error'] ) { $err = urldecode( $information['error'] ); $err = MainWP_Utility::esc_content( $err ); throw new \Exception( $err ); } else { if ( isset( $information['register'] ) && 'OK' === $information['register'] ) { MainWP_DB::instance()->update_website_values( $website->id, array( 'pubkey' => base64_encode( $pubkey ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode() used for backwards compatibility. 'privkey' => base64_encode( $privkey ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode() used for backwards compatibility. 'nossl' => $information['nossl'], 'nosslkey' => ( isset( $information['nosslkey'] ) ? $information['nosslkey'] : '' ), 'uniqueId' => ( isset( $information['uniqueId'] ) ? $information['uniqueId'] : '' ), ) ); MainWP_Sync::sync_information_array( $website, $information ); return true; } else { throw new \Exception( __( 'Undefined error!', 'mainwp' ) ); } } } catch ( MainWP_Exception $e ) { if ( 'HTTPERROR' === $e->getMessage() ) { throw new \Exception( 'HTTP error' . ( null != $e->get_message_extra() ? ' - ' . $e->get_message_extra() : '' ) ); } elseif ( 'NOMAINWP' === $e->getMessage() ) { $error = sprintf( __( 'MainWP Child plugin not detected. First, install and activate the plugin and add your site to your MainWP Dashboard afterward. If you continue experiencing this issue, check the child site for %1$sknown plugin conflicts%2$s, or check the %3$sMainWP Community%4$s for help.', 'mainwp' ), '<a href="https://meta.mainwp.com/t/known-plugin-conflicts/402">', '</a>', '<a href="https://meta.mainwp.com/c/community-support/5">', '</a>' ); throw new \Exception( $error ); } } } else { throw new \Exception( __( 'This operation is not allowed!', 'mainwp' ) ); } return false; } /** * Method add_site() * * Add Child Site. * * @param mixed $website Child Site. * * @return self add_wp_site() */ public static function add_site( $website = false ) { $params['url'] = isset( $_POST['managesites_add_wpurl'] ) ? sanitize_text_field( wp_unslash( $_POST['managesites_add_wpurl'] ) ) : ''; $params['name'] = isset( $_POST['managesites_add_wpname'] ) ? sanitize_text_field( wp_unslash( $_POST['managesites_add_wpname'] ) ) : ''; $params['wpadmin'] = isset( $_POST['managesites_add_wpadmin'] ) ? sanitize_text_field( wp_unslash( $_POST['managesites_add_wpadmin'] ) ) : ''; $params['unique_id'] = isset( $_POST['managesites_add_uniqueId'] ) ? sanitize_text_field( wp_unslash( $_POST['managesites_add_uniqueId'] ) ) : ''; $params['ssl_verify'] = empty( $_POST['verify_certificate'] ) ? null : intval( $_POST['verify_certificate'] ); $params['force_use_ipv4'] = ( ! isset( $_POST['force_use_ipv4'] ) || ( empty( $_POST['force_use_ipv4'] ) && ( '0' !== $_POST['force_use_ipv4'] ) ) ? null : intval( $_POST['force_use_ipv4'] ) ); $params['ssl_version'] = ! isset( $_POST['ssl_version'] ) || empty( $_POST['ssl_version'] ) ? null : intval( $_POST['ssl_version'] ); $params['http_user'] = isset( $_POST['managesites_add_http_user'] ) ? sanitize_text_field( wp_unslash( $_POST['managesites_add_http_user'] ) ) : ''; $params['http_pass'] = isset( $_POST['managesites_add_http_pass'] ) ? wp_unslash( $_POST['managesites_add_http_pass'] ) : ''; $params['groupids'] = isset( $_POST['groupids'] ) && ! empty( $_POST['groupids'] ) ? explode( ',', sanitize_text_field( wp_unslash( $_POST['groupids'] ) ) ) : array(); $params['groupnames_import'] = isset( $_POST['groupnames_import'] ) ? sanitize_text_field( wp_unslash( $_POST['groupnames_import'] ) ) : ''; if ( isset( $_POST['qsw_page'] ) ) { $params['qsw_page'] = sanitize_text_field( wp_unslash( $_POST['qsw_page'] ) ); } return self::add_wp_site( $website, $params ); } /** * Medthod add_wp_site() * * Add new Child Site. * * @param mixed $website Child Site. * @param array $params Array of new Child Site to add. * * @return array $message, $error, $id */ public static function add_wp_site( $website, $params = array() ) { // phpcs:ignore -- Current complexity is the only way to achieve desired results, pull request solutions appreciated. $error = ''; $message = ''; $id = 0; if ( $website ) { $error = __( 'The site is already connected to your MainWP Dashboard', 'mainwp' ); } else { try { if ( function_exists( 'openssl_pkey_new' ) ) { $conf = array( 'private_key_bits' => 2048 ); $conf_loc = MainWP_System_Utility::get_openssl_conf(); if ( ! empty( $conf_loc ) ) { $conf['config'] = $conf_loc; } $res = openssl_pkey_new( $conf ); openssl_pkey_export( $res, $privkey, null, $conf ); $pubkey = openssl_pkey_get_details( $res ); $pubkey = $pubkey['key']; } else { $privkey = '-1'; $pubkey = '-1'; } $url = $params['url']; $verifyCertificate = ( ! isset( $params['ssl_verify'] ) || ( empty( $params['ssl_verify'] ) && ( '0' !== $params['ssl_verify'] ) ) ? null : $params['ssl_verify'] ); $sslVersion = ! isset( $params['ssl_version'] ) || empty( $params['ssl_version'] ) ? 0 : $params['ssl_version']; $addUniqueId = isset( $params['unique_id'] ) ? $params['unique_id'] : ''; $http_user = isset( $params['http_user'] ) ? $params['http_user'] : ''; $http_pass = isset( $params['http_pass'] ) ? $params['http_pass'] : ''; $force_use_ipv4 = isset( $params['force_use_ipv4'] ) ? $params['force_use_ipv4'] : null; $information = MainWP_Connect::fetch_url_not_authed( $url, $params['wpadmin'], 'register', array( 'pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $addUniqueId, ), false, $verifyCertificate, $http_user, $http_pass, $sslVersion, array( 'force_use_ipv4' => $force_use_ipv4 ) ); if ( isset( $information['error'] ) && '' !== $information['error'] ) { $error = rawurlencode( urldecode( $information['error'] ) ); $error = str_replace( '%2F', '/', $error ); $error = str_replace( '%20', ' ', $error ); $err = str_replace( '%26', '&', $error ); } else { if ( isset( $information['register'] ) && 'OK' === $information['register'] ) { $groupids = array(); $groupnames = array(); $tmpArr = array(); if ( isset( $params['groupids'] ) && is_array( $params['groupids'] ) ) { foreach ( $params['groupids'] as $group ) { if ( is_numeric( $group ) ) { $groupids[] = $group; } else { $group = trim( $group ); if ( ! empty( $group ) ) { $tmpArr[] = $group; } } } foreach ( $tmpArr as $tmp ) { $getgroup = MainWP_DB_Common::instance()->get_group_by_name( trim( $tmp ) ); if ( $getgroup ) { if ( ! in_array( $getgroup->id, $groupids, true ) ) { $groupids[] = $getgroup->id; } } else { $groupnames[] = trim( $tmp ); } } } if ( ( isset( $params['groupnames_import'] ) && '' !== $params['groupnames_import'] ) ) { $tmpArr = preg_split( '/[;,]/', $params['groupnames_import'] ); foreach ( $tmpArr as $tmp ) { $group = MainWP_DB_Common::instance()->get_group_by_name( trim( $tmp ) ); if ( $group ) { if ( ! in_array( $group->id, $groupids, true ) ) { $groupids[] = $group->id; } } else { $groupnames[] = trim( $tmp ); } } } if ( ! isset( $information['uniqueId'] ) || empty( $information['uniqueId'] ) ) { $addUniqueId = ''; } $http_user = isset( $params['http_user'] ) ? $params['http_user'] : ''; $http_pass = isset( $params['http_pass'] ) ? $params['http_pass'] : ''; /** * Current user global. * * @global string */ global $current_user; $id = MainWP_DB::instance()->add_website( $current_user->ID, $params['name'], $params['url'], $params['wpadmin'], base64_encode( $pubkey ), base64_encode( $privkey ), $information['nossl'], ( isset( $information['nosslkey'] ) ? $information['nosslkey'] : null ), $groupids, $groupnames, $verifyCertificate, $addUniqueId, $http_user, $http_pass, $sslVersion ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode() used for http encoding compatible. if ( isset( $params['qsw_page'] ) && $params['qsw_page'] ) { $message = sprintf( __( '<div class="ui header">Congratulations you have connected %1$s.</div> You can add new sites at anytime from the Add New Site page.', 'mainwp' ), '<strong>' . $params['name'] . '</strong>' ); } else { $message = sprintf( __( 'Site successfully added - Visit the Site\'s %1$sDashboard%2$s now.', 'mainwp' ), '<a href="admin.php?page=managesites&dashboard=' . $id . '" style="text-decoration: none;" title="' . __( 'Dashboard', 'mainwp' ) . '">', '</a>' ); } /** * New site added * * Fires after adding a website to MainWP Dashboard. * * @param int $id Child site ID. * * @since 3.4 */ do_action( 'mainwp_added_new_site', $id ); $website = MainWP_DB::instance()->get_website_by_id( $id ); MainWP_Sync::sync_information_array( $website, $information ); } else { $error = __( 'Undefined error occurred. Please try again. For additional help, contact the MainWP Support.', 'mainwp' ); } } } catch ( MainWP_Exception $e ) { if ( 'HTTPERROR' == $e->getMessage() ) { $error = 'HTTP error' . ( null != $e->get_message_extra() ? ' - ' . $e->get_message_extra() : '' ); } elseif ( 'NOMAINWP' == $e->getMessage() ) { $error = __( 'MainWP Child Plugin not detected! Please make sure that the MainWP Child plugin is installed and activated on the child site. For additional help, contact the MainWP Support.', 'mainwp' ); } else { $error = $e->getMessage(); } } } return array( $message, $error, $id ); } /** * Method update_wp_site() * * Update Child Site. * * @param mixed $params Udate parameters. * * @return int Child Site ID on success and return 0 on failer. */ public static function update_wp_site( $params ) { if ( ! isset( $params['websiteid'] ) || ! MainWP_Utility::ctype_digit( $params['websiteid'] ) ) { return 0; } if ( isset( $params['is_staging'] ) ) { unset( $params['is_staging'] ); } $website = MainWP_DB::instance()->get_website_by_id( $params['websiteid'] ); if ( null == $website ) { return 0; } if ( ! MainWP_System_Utility::can_edit_website( $website ) ) { return 0; } $data = array(); $uniqueId = null; if ( isset( $params['name'] ) && ! empty( $params['name'] ) ) { $data['name'] = htmlentities( $params['name'] ); } if ( isset( $params['wpadmin'] ) && ! empty( $params['wpadmin'] ) ) { $data['adminname'] = $params['wpadmin']; } if ( isset( $params['unique_id'] ) ) { $data['uniqueId'] = $params['unique_id']; $uniqueId = $params['unique_id']; } if ( empty( $data ) ) { return 0; } MainWP_DB::instance()->update_website_values( $website->id, $data ); if ( null !== $uniqueId ) { try { $information = MainWP_Connect::fetch_url_authed( $website, 'update_values', array( 'uniqueId' => $uniqueId ) ); } catch ( MainWP_Exception $e ) { $error = $e->getMessage(); } } /** * Action: mainwp_updated_site * * Fires after updatig the child site options. * * @param int $website->id Child site ID. * @param array $data Child site data. * * @since 3.5.1 */ do_action( 'mainwp_updated_site', $website->id, $data ); return $website->id; } }
{ "pile_set_name": "Github" }
translateModelFMU( modelToOpen="Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.Fan", storeResult=false, modelName="", fmiVersion="2", fmiType="me", includeSource=false);
{ "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 org.apache.activemq.artemis.cli.commands.user; import io.airlift.airline.Command; import io.airlift.airline.Option; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.management.ManagementHelper; import org.apache.activemq.artemis.cli.commands.AbstractAction; import org.apache.activemq.artemis.cli.commands.ActionContext; /** * Adding a new user, example: * ./artemis user add --user-command-user guest --role admin --user-command-password *** */ @Command(name = "add", description = "Add a new user") public class AddUser extends PasswordAction { @Option(name = "--plaintext", description = "store the password in plaintext (Default: false)") boolean plaintext = false; @Override public Object execute(ActionContext context) throws Exception { super.execute(context); checkInputUser(); checkInputPassword(); checkInputRole(); add(); return null; } /** * Add a new user * * @throws Exception if communication with the broker fails */ private void add() throws Exception { performCoreManagement(new AbstractAction.ManagementCallback<ClientMessage>() { @Override public void setUpInvocation(ClientMessage message) throws Exception { ManagementHelper.putOperationInvocation(message, "broker", "addUser", userCommandUser, userCommandPassword, role, plaintext); } @Override public void requestSuccessful(ClientMessage reply) throws Exception { context.out.println(userCommandUser + " added successfully."); } @Override public void requestFailed(ClientMessage reply) throws Exception { String errMsg = (String) ManagementHelper.getResult(reply, String.class); context.err.println("Failed to add user " + userCommandUser + ". Reason: " + errMsg); } }); } }
{ "pile_set_name": "Github" }
// 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. namespace Microsoft.Deployment.WindowsInstaller { using System; using System.IO; using System.Text; using System.Globalization; using System.Runtime.InteropServices; /// <summary> /// Provides access to summary information of a Windows Installer database. /// </summary> public class SummaryInfo : InstallerHandle { internal const int MAX_PROPERTIES = 20; /// <summary> /// Gets a SummaryInfo object that can be used to examine, update, and add /// properties to the summary information stream of a package or transform. /// </summary> /// <param name="packagePath">Path to the package (database) or transform</param> /// <param name="enableWrite">True to reserve resources for writing summary information properties.</param> /// <exception cref="FileNotFoundException">the package does not exist or could not be read</exception> /// <exception cref="InstallerException">the package is an invalid format</exception> /// <remarks><p> /// The SummaryInfo object should be <see cref="InstallerHandle.Close"/>d after use. /// It is best that the handle be closed manually as soon as it is no longer /// needed, as leaving lots of unused handles open can degrade performance. /// </p><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msigetsummaryinformation.asp">MsiGetSummaryInformation</a> /// </p></remarks> public SummaryInfo(string packagePath, bool enableWrite) : base((IntPtr) SummaryInfo.OpenSummaryInfo(packagePath, enableWrite), true) { } internal SummaryInfo(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle) { } /// <summary>Gets or sets the Title summary information property.</summary> /// <remarks><p> /// The Title summary information property briefly describes the type of installer package. Phrases /// such as "Installation Database" or "Transform" or "Patch" may be used for this property. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string Title { get { return this[2]; } set { this[2] = value; } } /// <summary>Gets or sets the Subject summary information property.</summary> /// <remarks><p> /// The Subject summary information property conveys to a file browser the product that can be installed using /// the logic and data in this installer database. For example, the value of the summary property for /// Microsoft Office 97 would be "Microsoft Office 97 Professional". This value is typically set from the /// installer property ProductName. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string Subject { get { return this[3]; } set { this[3] = value; } } /// <summary>Gets or sets the Author summary information property.</summary> /// <remarks><p> /// The Author summary information property conveys to a file browser the manufacturer of the installation /// database. This value is typically set from the installer property Manufacturer. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string Author { get { return this[4]; } set { this[4] = value; } } /// <summary>Gets or sets the Keywords summary information property.</summary> /// <remarks><p> /// The Keywords summary information property is used by file browsers to hold keywords that permit the /// database file to be found in a keyword search. The set of keywords typically includes "Installer" as /// well as product-specific keywords, and may be localized. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string Keywords { get { return this[5]; } set { this[5] = value; } } /// <summary>Gets or sets the Comments summary information property.</summary> /// <remarks><p> /// The Comments summary information property conveys the general purpose of the installer database. By convention, /// the value for this summary property is set to the following: /// </p><p> /// "This installer database contains the logic and data required to install &lt;product name&gt;." /// </p><p> /// where &lt;product name&gt; is the name of the product being installed. In general the value for this summary /// property only changes in the product name, nothing else. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string Comments { get { return this[6]; } set { this[6] = value; } } /// <summary>Gets or sets the Template summary information property.</summary> /// <remarks><p> /// The Template summary information propery indicates the platform and language versions supported by the database. /// </p><p> /// The syntax of the Template Summary property information is: /// [platform property][,platform property][,...];[language id][,language id][,...] /// </p><p> /// For example, the following are all valid values for the Template Summary property: /// <list type="bullet"> /// <item>Intel;1033</item> /// <item>Intel64;1033</item> /// <item>;1033</item> /// <item>;</item> /// <item>Intel ;1033,2046</item> /// <item>Intel64;1033,2046</item> /// <item>Intel;0</item> /// </list> /// </p><p> /// If this is a 64-bit Windows Installer, enter Intel64 in the Template summary information property. Note that an /// installation package cannot have both the Intel and Intel64 properties set. /// </p><p> /// If the current platform does not match one of the platforms specified then the installer will not process the /// package. Not specifying a platform implies that the package is platform-independent. /// </p><p> /// Entering 0 in the language ID field of the Template summary information property, or leaving this field empty, /// indicates that the package is language neutral. /// </p><p> /// There are variations of this property depending on whether it is in a source installer database or a transform. /// </p><p> /// Source Installer Database - Only one language can be specified in a source installer database. Merge Modules are /// the only packages that may have multiple languages. For more information, see Multiple Language Merge Modules. /// </p><p> /// Transform - In a transform file, only one language may be specified. The specified platform and language determine /// whether a transform can be applied to a particular database. The platform property and the language property can /// be left blank if no transform restriction relies on them to validate the transform. /// </p><p> /// This summary property is REQUIRED. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string Template { get { return this[7]; } set { this[7] = value; } } /// <summary>Gets or sets the LastSavedBy summary information property.</summary> /// <remarks><p> /// The installer sets the Last Saved By summary information property to the value of the LogonUser property during /// an administrative installation. The installer never uses this property and a user never needs to modify it. /// Developers of a database editing tool may use this property to track the last person to modify the database. /// This property should be left set to null in a final shipping database. /// </p><p> /// In a transform, this summary property contains the platform and language ID(s) that a database should have /// after it has been transformed. The property specifies to what the Template should be set in the new database. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string LastSavedBy { get { return this[8]; } set { this[8] = value; } } /// <summary>Gets or sets the RevisionNumber summary information property.</summary> /// <remarks><p> /// The Revision Number summary information property contains the package code for the installer package. The /// package code is a unique identifier of the installer package. /// </p><p> /// The Revision Number summary information property of a patch package specifies the GUID patch code for /// the patch. This is followed by a list of patch code GUIDs for obsolete patches that are removed when this /// patch is applied. The patch codes are concatenated with no delimiters separating GUIDs in the list. /// </p><p> /// The Revision Number summary information property of a transform package lists the product code GUIDs /// and version of the new and original products and the upgrade code GUID. The list is separated with /// semicolons as follows. /// </p><p> /// Original-Product-Code Original-Product-Version ; New-Product Code New-Product-Version; Upgrade-Code /// </p><p> /// This summary property is REQUIRED. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string RevisionNumber { get { return this[9]; } set { this[9] = value; } } /// <summary>Gets or sets the CreatingApp summary information property.</summary> /// <remarks><p> /// The CreatingApp summary information property conveys which application created the installer database. /// In general the value for this summary property is the name of the software used to author this database. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public string CreatingApp { get { return this[18]; } set { this[18] = value; } } /// <summary>Gets or sets the LastPrintTime summary information property.</summary> /// <remarks><p> /// The LastPrintTime summary information property can be set to the date and time during an administrative /// installation to record when the administrative image was created. For non-administrative installations /// this property is the same as the CreateTime summary information property. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public DateTime LastPrintTime { get { return (DateTime) this[11, typeof(DateTime)]; } set { this[11, typeof(DateTime)] = value; } } /// <summary>Gets or sets the CreateTime summary information property.</summary> /// <remarks><p> /// The CreateTime summary information property conveys when the installer database was created. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public DateTime CreateTime { get { return (DateTime) this[12, typeof(DateTime)]; } set { this[12, typeof(DateTime)] = value; } } /// <summary>Gets or sets the LastSaveTime summary information property.</summary> /// <remarks><p> /// The LastSaveTime summary information property conveys when the last time the installer database was /// modified. Each time a user changes an installation the value for this summary property is updated to /// the current system time/date at the time the installer database was saved. Initially the value for /// this summary property is set to null to indicate that no changes have yet been made. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public DateTime LastSaveTime { get { return (DateTime) this[13, typeof(DateTime)]; } set { this[13, typeof(DateTime)] = value; } } /// <summary>Gets or sets the CodePage summary information property.</summary> /// <remarks><p> /// The Codepage summary information property is the numeric value of the ANSI code page used for any /// strings that are stored in the summary information. Note that this is not the same code page for /// strings in the installation database. The Codepage summary information property is used to translate /// the strings in the summary information into Unicode when calling the Unicode API functions. The /// Codepage summary information property must be set before any string properties are set in the /// summary information. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public short CodePage { get { return (short) this[1, typeof(short)]; } set { this[1, typeof(short)] = value; } } /// <summary>Gets or sets the PageCount summary information property.</summary> /// <remarks><p> /// For an installation package, the PageCount summary information property contains the minimum /// installer version required. For Windows Installer version 1.0, this property must be set to the /// integer 100. For 64-bit Windows Installer Packages, this property must be set to the integer 200. /// </p><p> /// For a transform package, the PageCount summary information property contains minimum installer /// version required to process the transform. Set to the greater of the two PageCount summary information /// property values belonging to the databases used to generate the transform. /// </p><p> /// The PageCount summary information property is set to null in patch packages. /// </p><p> /// This summary property is REQUIRED. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public int PageCount { get { return (int) this[14, typeof(int)]; } set { this[14, typeof(int)] = value; } } /// <summary>Gets or sets the WordCount summary information property.</summary> /// <remarks><p> /// The WordCount summary information property indicates the type of source file image. If this property is /// not present, it defaults to 0. Note that this property is stored in place of the standard Count property. /// </p><p> /// This property is a bit field. New bits may be added in the future. At present the following bits are /// available: /// <list type="bullet"> /// <item>Bit 0: 0 = long file names, 1 = short file names</item> /// <item>Bit 1: 0 = source is uncompressed, 1 = source is compressed</item> /// <item>Bit 2: 0 = source is original media, 1 = source is administrative installation</item> /// <item>[MSI 4.0] Bit 3: 0 = elevated privileges can be required to install, 1 = elevated privileges are not required to install</item> /// </list> /// </p><p> /// These are combined to give the WordCount summary information property one of the following values /// indicating a type of source file image: /// <list type="bullet"> /// <item>0 - Original source using long file names. Matches tree in Directory table.</item> /// <item>1 - Original source using short file names. Matches tree in Directory table.</item> /// <item>2 - Compressed source files using long file names. Matches cabinets and files in the Media table.</item> /// <item>3 - Compressed source files using short file names. Matches cabinets and files in the Media table.</item> /// <item>4 - Administrative image using long file names. Matches tree in Directory table.</item> /// <item>5 - Administrative image using short file names. Matches tree in Directory table.</item> /// </list> /// </p><p> /// Note that if the package is marked as compressed (bit 1 is set), the installer only installs files /// located at the root of the source. In this case, even files marked as uncompressed in the File table must /// be located at the root to be installed. To specify a source image that has both a cabinet file (compressed /// files) and uncompressed files that match the tree in the Directory table, mark the package as uncompressed /// by leaving bit 1 unset (value=0) in the WordCount summary information property and set /// <see cref="FileAttributes.Compressed"/> (value=16384) in the Attributes column of the File table /// for each file in the cabinet. /// </p><p> /// For a patch package, the WordCount summary information property specifies the patch engine that was used /// to create the patch files. The default value is 1 and indicates that MSPATCH was used to create the patch /// A value of "2" means that the patch is using smaller, optimized, files available only with Windows Installer /// version 1.2 or later. A patch with a WordCount of "2" fails immediately if used with a Windows Installer /// version earlier than 1.2. A patch with a WordCount of "3" fails immediately if used with a Windows Installer /// version earlier than 2.0. /// </p><p> /// This summary property is REQUIRED. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public int WordCount { get { return (int) this[15, typeof(int)]; } set { this[15, typeof(int)] = value; } } /// <summary>Gets or sets the CharacterCount summary information property.</summary> /// <remarks><p> /// The CharacterCount summary information property is only used in transforms. This part of the summary /// information stream is divided into two 16-bit words. The upper word contains the transform validation /// flags. The lower word contains the transform error condition flags. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public int CharacterCount { get { return (int) this[16, typeof(int)]; } set { this[16, typeof(int)] = value; } } /// <summary>Gets or sets the Security summary information property.</summary> /// <remarks><p> /// The Security summary information property conveys whether the package should be opened as read-only. The database /// editing tool should not modify a read-only enforced database and should issue a warning at attempts to modify a /// read-only recommended database. The following values of this property are applicable to Windows Installer files: /// <list type="bullet"> /// <item>0 - no restriction</item> /// <item>2 - read only recommended</item> /// <item>4 - read only enforced</item> /// </list> /// </p><p> /// This property should be set to read-only recommended (2) for an installation database and to read-only /// enforced (4) for a transform or patch. /// </p><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfogetproperty.asp">MsiSummaryInfoGetProperty</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfosetproperty.asp">MsiSummaryInfoSetProperty</a> /// </p></remarks> public int Security { get { return (int) this[19, typeof(int)]; } set { this[19, typeof(int)] = value; } } private object this[uint property, Type type] { get { uint dataType; StringBuilder stringValue = new StringBuilder(""); uint bufSize = 0; int intValue; long timeValue = 0; uint ret = RemotableNativeMethods.MsiSummaryInfoGetProperty( (int) this.Handle, property, out dataType, out intValue, ref timeValue, stringValue, ref bufSize); if (ret != 0 && dataType != (uint) VarEnum.VT_LPSTR) { throw InstallerException.ExceptionFromReturnCode(ret); } switch ((VarEnum) dataType) { case VarEnum.VT_EMPTY: { if (type == typeof(DateTime)) { return DateTime.MinValue; } else if (type == typeof(string)) { return String.Empty; } else if (type == typeof(short)) { return (short) 0; } else { return (int) 0; } } case VarEnum.VT_LPSTR: { if (ret == (uint) NativeMethods.Error.MORE_DATA) { stringValue.Capacity = (int) ++bufSize; ret = RemotableNativeMethods.MsiSummaryInfoGetProperty( (int) this.Handle, property, out dataType, out intValue, ref timeValue, stringValue, ref bufSize); } if (ret != 0) { throw InstallerException.ExceptionFromReturnCode(ret); } return stringValue.ToString(); } case VarEnum.VT_I2: case VarEnum.VT_I4: { if (type == typeof(string)) { return intValue.ToString(CultureInfo.InvariantCulture); } else if (type == typeof(short)) { return (short) intValue; } else { return intValue; } } case VarEnum.VT_FILETIME: { if (type == typeof(string)) { return DateTime.FromFileTime(timeValue).ToString(CultureInfo.InvariantCulture); } else { return DateTime.FromFileTime(timeValue); } } default: { throw new InstallerException(); } } } set { uint dataType = (uint) VarEnum.VT_NULL; string stringValue = ""; int intValue = 0; long timeValue = 0; if (type == typeof(short)) { dataType = (uint) VarEnum.VT_I2; intValue = (int)(short) value; // Double cast because value is a *boxed* short. } else if (type == typeof(int)) { dataType = (uint) VarEnum.VT_I4; intValue = (int) value; } else if (type == typeof(string)) { dataType = (uint) VarEnum.VT_LPSTR; stringValue = (string) value; } else // (type == typeof(DateTime)) { dataType = (uint) VarEnum.VT_FILETIME; timeValue = ((DateTime) value).ToFileTime(); } uint ret = NativeMethods.MsiSummaryInfoSetProperty( (int) this.Handle, property, dataType, intValue, ref timeValue, stringValue); if (ret != 0) { throw InstallerException.ExceptionFromReturnCode(ret); } } } private string this[uint property] { get { return (string) this[property, typeof(string)]; } set { this[property, typeof(string)] = value; } } /// <summary> /// Formats and writes the previously stored properties into the standard summary information stream. /// </summary> /// <exception cref="InstallerException">The stream cannot be successfully written.</exception> /// <remarks><p> /// This method may only be called once after all the property values have been set. Properties may /// still be read after the stream is written. /// </p><p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisummaryinfopersist.asp">MsiSummaryInfoPersist</a> /// </p></remarks> public void Persist() { uint ret = NativeMethods.MsiSummaryInfoPersist((int) this.Handle); if (ret != 0) { throw InstallerException.ExceptionFromReturnCode(ret); } } private static int OpenSummaryInfo(string packagePath, bool enableWrite) { int summaryInfoHandle; int maxProperties = !enableWrite ? 0 : SummaryInfo.MAX_PROPERTIES; uint ret = RemotableNativeMethods.MsiGetSummaryInformation( 0, packagePath, (uint) maxProperties, out summaryInfoHandle); if (ret != 0) { if (ret == (uint) NativeMethods.Error.FILE_NOT_FOUND || ret == (uint) NativeMethods.Error.ACCESS_DENIED) { throw new FileNotFoundException(null, packagePath); } else { throw InstallerException.ExceptionFromReturnCode(ret); } } return summaryInfoHandle; } } }
{ "pile_set_name": "Github" }
// // Created by Jesse Squires // http://www.jessesquires.com // // // Documentation // http://cocoadocs.org/docsets/JSQMessagesViewController // // // GitHub // https://github.com/jessesquires/JSQMessagesViewController // // // License // Copyright (c) 2014 Jesse Squires // Released under an MIT license: http://opensource.org/licenses/MIT // // ******************************** // Special thanks to the localization contributors! // // https://github.com/jessesquires/JSQMessagesViewController/issues/237 // ******************************** "load_earlier_messages" = "Load Earlier Messages"; "send" = "Send"; "new_message" = "New Message";
{ "pile_set_name": "Github" }
# Translation of vte to Croatiann # Copyright (C) Croatiann team # Translators: Automatski Prijevod <>,Denis Lackovic <[email protected]>,Robert Sedak <[email protected]> msgid "" msgstr "" "Project-Id-Version: vte 0\n" "Report-Msgid-Bugs-To: https://bugzilla.gnome.org/enter_bug.cgi?" "product=vte&keywords=I18N+L10N&component=general\n" "POT-Creation-Date: 2017-03-20 22:37+0000\n" "PO-Revision-Date: 2017-04-11 18:46+0200\n" "Last-Translator: gogo <[email protected]>\n" "Language-Team: Croatian <[email protected]>\n" "Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Launchpad-Export-Date: 2016-09-15 11:47+0000\n" "X-Generator: Poedit 1.8.7.1\n" #: ../src/iso2022.cc:73 ../src/iso2022.cc:81 ../src/iso2022.cc:111 #: ../src/vtegtk.cc:3262 #, c-format msgid "Unable to convert characters from %s to %s." msgstr "Nemoguća pretvorba znakova iz %s u %s." #. Translators: %s is replaced with error message returned by strerror(). #: ../src/vte.cc:4014 #, c-format msgid "Error reading from child: %s." msgstr "Greška prilikom čitanja nadređenog: %s." #: ../src/vte.cc:4153 #, c-format msgid "Error (%s) converting data for child, dropping." msgstr "Greška (%s) pri pretvorbi podataka za nadređenog, odbacujem." #: ../src/vte.cc:7922 msgid "WARNING" msgstr "UPOZORENJE" #: ../src/vte.cc:7923 msgid "GNUTLS not enabled; data will be written to disk unencrypted!" msgstr "GNUTLS nije omogućen; podaci će biti zapisivani nešifrirano na disk!" #~ msgid "Attempt to set invalid NRC map '%c'." #~ msgstr "Pokušaj postavljanja neispravne NRC mape '%c'." #~ msgid "Unrecognized identified coding system." #~ msgstr "Pronađen je nepoznati sustav kôdiranja." #~ msgid "Attempt to set invalid wide NRC map '%c'." #~ msgstr "Pokušaj postavljanja neispravne široke NRC mape '%c'." #~ msgid "can not run %s" #~ msgstr "nemoguće je pokrenuti %s" #~ msgid "Error creating signal pipe." #~ msgstr "Greška prilikom stvaranja slivnika signala." #~ msgid "Duplicate (%s/%s)!" #~ msgstr "Duplikat (%s/%s)!" #~ msgid "Error compiling regular expression \"%s\"." #~ msgstr "Greška u kompilaciji regularnog izraza \"%s\"." #~ msgid "No handler for control sequence `%s' defined." #~ msgstr "Nema određenog rukovatelja za kontrolni slijed `%s' ." #~ msgid "Unable to send data to child, invalid charset convertor" #~ msgstr "Nemoguće slanje podatka podređenom, neispravan pretvornik znakova" #~ msgid "Error reading PTY size, using defaults: %s." #~ msgstr "" #~ "Greška prilikom čitanja PTY veličine, koristim uobičajene postavke: %s." #~ msgid "Error setting PTY size: %s." #~ msgstr "Greška postavljanja PTY veličine: %s." #~ msgid "_vte_conv_open() failed setting word characters" #~ msgstr "_vte_conv_open() nije uspio postaviti znakove riječi" #~ msgid "Got unexpected (key?) sequence `%s'." #~ msgstr "Dobio sam neočekivani (tipkanjem?) slijed `%s'." #~ msgid "Could not open console.\n" #~ msgstr "Nemoguće otvaranje konzole\n" #~ msgid "Could not parse the geometry spec passed to --geometry" #~ msgstr "" #~ "Nemoguća obrada geometrijske specifikacije prosljeđene pomoću --geometry" #~ msgid "Unknown pixel mode %d.\n" #~ msgstr "Nepoznati način piksela %d.\n"
{ "pile_set_name": "Github" }
package io.udash.web.guide.views.ext.demo.bootstrap import io.udash.css.CssView import io.udash.web.guide.demos.AutoDemo import io.udash.web.guide.styles.partials.GuideStyles import scalatags.JsDom.all._ object StaticButtonsGroupDemo extends AutoDemo with CssView { private val (rendered, source) = { import io.udash._ import io.udash.bootstrap._ import BootstrapStyles.Color import io.udash.bootstrap.button._ import scalatags.JsDom.all._ div( UdashButtonGroup(vertical = true.toProperty)( UdashButton(Color.Primary.toProperty)("Button 1").render, UdashButton()("Button 2").render, UdashButton()("Button 3").render ) ).render }.withSourceCode override protected def demoWithSource(): (Modifier, Iterator[String]) = { (rendered.setup(_.applyTags(GuideStyles.frame)), source.linesIterator) } }
{ "pile_set_name": "Github" }
<?php /* * This file is part of ansi-to-html. * * (c) 2013 Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SensioLabs\AnsiConverter\Theme; /** * Base theme. */ class Theme { public function asCss($prefix = 'ansi_color') { $css = array(); foreach ($this->asArray() as $name => $color) { $css[] = sprintf('.%s_fg_%s { color: %s }', $prefix, $name, $color); $css[] = sprintf('.%s_bg_%s { background-color: %s }', $prefix, $name, $color); } return implode("\n", $css); } public function asArray() { return array( 'black' => 'black', 'red' => 'darkred', 'green' => 'green', 'yellow' => 'yellow', 'blue' => 'blue', 'magenta' => 'darkmagenta', 'cyan' => 'cyan', 'white' => 'white', 'brblack' => 'black', 'brred' => 'red', 'brgreen' => 'lightgreen', 'bryellow' => 'lightyellow', 'brblue' => 'lightblue', 'brmagenta' => 'magenta', 'brcyan' => 'lightcyan', 'brwhite' => 'white', ); } }
{ "pile_set_name": "Github" }
#!/bin/ksh -p # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # # Copyright (c) 2013 by Delphix. All rights reserved. # . $STF_SUITE/tests/functional/cli_user/misc/misc.cfg . $STF_SUITE/include/libtest.shlib # # DESCRIPTION: # Executing 'zpool import' as regular user should denied. # # STRATEGY: # 1. Create an array of options try to detect exported/destroyed pools. # 2. Execute 'zpool import' with each element of the array by regular user. # 3. Verify an error code is returned. # verify_runnable "both" typeset testpool if is_global_zone ; then testpool=$TESTPOOL.exported else testpool=${TESTPOOL%%/*} fi set -A args "" "-D" "-Df" "-f" "-f $TESTPOOL" "-Df $TESTPOOL" "-a" log_assert "Executing 'zpool import' by regular user fails" typeset -i i=0 while [[ $i -lt ${#args[*]} ]]; do log_mustnot $ZPOOL import ${args[i]} ((i = i + 1)) done log_pass "Executing 'zpool import' by regular user fails as expected."
{ "pile_set_name": "Github" }
import { FieldType } from './constant' import { Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon } from './geo' import { ServerDate } from './serverDate' interface DocumentModel { _id: string; } /** * 工具模块 * * @author haroldhu */ export class Util { /** * 格式化后端返回的文档数据 * * @param document - 后端文档数据 */ public static formatResDocumentData = (documents: DocumentModel[]) => { return documents.map(document => { return Util.formatField(document) }) }; /** * 格式化字段 * * 主要是递归数组和对象,把地理位置和日期时间转换为js对象。 * * @param document * @internal */ private static formatField = document => { const keys = Object.keys(document) let protoField = {} // 数组递归的情况 if (Array.isArray(document)) { protoField = [] } keys.forEach(key => { const item = document[key] const type = Util.whichType(item) // console.log(type, item) let realValue switch (type) { case FieldType.GeoPoint: realValue = new Point(item.coordinates[0], item.coordinates[1]) break case FieldType.GeoLineString: realValue = new LineString(item.coordinates.map(point => new Point(point[0], point[1]))) break case FieldType.GeoPolygon: realValue = new Polygon( item.coordinates.map( line => new LineString(line.map(([lng, lat]) => new Point(lng, lat))) ) ) break case FieldType.GeoMultiPoint: realValue = new MultiPoint(item.coordinates.map(point => new Point(point[0], point[1]))) break case FieldType.GeoMultiLineString: realValue = new MultiLineString( item.coordinates.map( line => new LineString(line.map(([lng, lat]) => new Point(lng, lat))) ) ) break case FieldType.GeoMultiPolygon: realValue = new MultiPolygon( item.coordinates.map( polygon => new Polygon( polygon.map(line => new LineString(line.map(([lng, lat]) => new Point(lng, lat)))) ) ) ) break case FieldType.Timestamp: realValue = new Date(item.$timestamp * 1000) break case FieldType.Object: case FieldType.Array: realValue = Util.formatField(item) break case FieldType.ServerDate: realValue = new Date(item.$date) break default: realValue = item } if (Array.isArray(protoField)) { protoField.push(realValue) } else { protoField[key] = realValue } }) return protoField }; /** * 查看数据类型 * * @param obj */ public static whichType = (obj: any): String => { let type = Object.prototype.toString.call(obj).slice(8, -1) if (type === FieldType.Object) { // console.log(obj) if (obj instanceof Point) { return FieldType.GeoPoint } else if (obj instanceof Date) { return FieldType.Timestamp } /* else if (obj instanceof Command) { return FieldType.Command; } */ else if ( obj instanceof ServerDate ) { return FieldType.ServerDate } if (obj.$timestamp) { type = FieldType.Timestamp } else if (obj.$date) { type = FieldType.ServerDate } else if (Point.validate(obj)) { type = FieldType.GeoPoint } else if (LineString.validate(obj)) { type = FieldType.GeoLineString } else if (Polygon.validate(obj)) { type = FieldType.GeoPolygon } else if (MultiPoint.validate(obj)) { type = FieldType.GeoMultiPoint } else if (MultiLineString.validate(obj)) { type = FieldType.GeoMultiLineString } else if (MultiPolygon.validate(obj)) { type = FieldType.GeoMultiPolygon } } return type }; /** * 生成文档ID * * 为创建新文档使用 */ public static generateDocId = () => { let chars = 'ABCDEFabcdef0123456789' let autoId = '' for (let i = 0; i < 24; i++) { autoId += chars.charAt(Math.floor(Math.random() * chars.length)) } return autoId }; }
{ "pile_set_name": "Github" }
// // LinkTextAttribute.cs // // Author: // Lluis Sanchez <[email protected]> // // Copyright (c) 2013 Xamarin 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 // 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. using System; using Xwt.Backends; using System.Collections.Generic; namespace Xwt.Drawing { public sealed class LinkTextAttribute: TextAttribute { public Uri Target { get; set; } public override bool Equals (object t) { var ot = t as LinkTextAttribute; return ot != null && Target == ot.Target && base.Equals (t); } public override int GetHashCode () { return base.GetHashCode () ^ (Target != null ? Target.GetHashCode () : 0); } } }
{ "pile_set_name": "Github" }
package types // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command // IDResponse Response to an API call that returns just an Id // swagger:model IdResponse type IDResponse struct { // The id of the newly created object. // Required: true ID string `json:"Id"` }
{ "pile_set_name": "Github" }
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace Microsoft.Azure.Cosmos.Tests.Routing { using System; using System.IO; using System.Text; using Microsoft.Azure.Documents.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; /// <summary> /// Tests <see cref="MurmurHash3"/> class and its compatibility with backend implementation. /// </summary> [TestClass] public class MurmurHash3Test { /// <summary> /// Tests hashing double value in same way PartitionKey does this. /// This test ensures doubles are hashed same way on backend and client. /// </summary> [TestMethod] public void TestDoubleHash() { byte[] bytes = BitConverter.GetBytes(374.0); Assert.AreEqual(3717946798U, MurmurHash3.Hash32(bytes, bytes.Length)); Assert.AreEqual( MurmurHash3.Hash128(bytes, bytes.Length, seed: 0).GetHigh(), Cosmos.MurmurHash3.Hash128((ReadOnlySpan<byte>)bytes.AsSpan(), seed: 0).GetHigh()); Assert.AreEqual( MurmurHash3.Hash128(bytes, bytes.Length, seed: 0).GetLow(), Cosmos.MurmurHash3.Hash128((ReadOnlySpan<byte>)bytes.AsSpan(), seed: 0).GetLow()); } /// <summary> /// Tests hashing string value in same way PartitionKey does this. /// This test ensures strings are hashed same way on backend and client. /// </summary> [TestMethod] public void TestStringHash() { byte[] bytes = Encoding.UTF8.GetBytes("afdgdd"); Assert.AreEqual(1099701186U, MurmurHash3.Hash32(bytes, bytes.Length)); Assert.AreEqual( MurmurHash3.Hash128(bytes, bytes.Length, seed: 0).GetHigh(), Cosmos.MurmurHash3.Hash128((ReadOnlySpan<byte>)bytes.AsSpan(), seed: 0).GetHigh()); Assert.AreEqual( MurmurHash3.Hash128(bytes, bytes.Length, seed: 0).GetLow(), Cosmos.MurmurHash3.Hash128((ReadOnlySpan<byte>)bytes.AsSpan(), seed: 0).GetLow()); } } }
{ "pile_set_name": "Github" }
export function Hey() { return 'Hey'; }
{ "pile_set_name": "Github" }
import { join } from '@stoplight/path'; import { Optional } from '@stoplight/types'; import * as child_process from 'child_process'; import { Transform } from 'stream'; import { normalizeLineEndings } from './helpers'; const cwd = join(__dirname, 'scenarios'); export type SpawnReturn = { stdout: string; stderr: string; status: number; }; export type SpawnFn = (command: string, env: Optional<typeof process.env>) => Promise<SpawnReturn>; const createStream = () => new Transform({ transform(chunk, encoding, done) { this.push(chunk); done(); }, }); function stringifyStream(stream: Transform) { let result = ''; stream.on('readable', () => { let chunk: string | null; // tslint:disable-next-line:no-conditional-assignment while ((chunk = stream.read()) !== null) { result += chunk; } }); return new Promise<string>((resolve, reject) => { stream.on('error', reject); stream.on('end', () => { resolve(result); }); }); } export const spawnNode: SpawnFn = async (script, env) => { const stderr = createStream(); const stdout = createStream(); const handle = child_process.spawn(script, [], { shell: true, windowsVerbatimArguments: false, env, cwd, stdio: 'pipe', }); handle.stderr.pipe(stderr); handle.stdout.pipe(stdout); const stderrText = (await stringifyStream(stderr)).trim(); const stdoutText = (await stringifyStream(stdout)).trim(); const status = await new Promise<number>(resolve => { handle.on('close', resolve); }); return { stderr: normalizeLineEndings(stderrText), stdout: normalizeLineEndings(stdoutText), status, }; };
{ "pile_set_name": "Github" }
var DESCRIPTORS = require('./_descriptors'); var getKeys = require('./_object-keys'); var toIObject = require('./_to-iobject'); var isEnum = require('./_object-pie').f; module.exports = function (isEntries) { return function (it) { var O = toIObject(it); var keys = getKeys(O); var length = keys.length; var i = 0; var result = []; var key; while (length > i) { key = keys[i++]; if (!DESCRIPTORS || isEnum.call(O, key)) { result.push(isEntries ? [key, O[key]] : O[key]); } } return result; }; };
{ "pile_set_name": "Github" }
layer at (0,0) size 800x600 RenderView at (0,0) size 800x600 layer at (0,0) size 800x356 RenderBlock {HTML} at (0,0) size 800x356 RenderBody {BODY} at (8,16) size 784x324 RenderBlock {P} at (0,0) size 784x18 RenderText {#text} at (0,0) size 579x18 text run at (0,0) width 579: "The square should consist of exactly five equal bands, orange, lime, orange, yellow, orange." RenderTable {TABLE} at (0,34) size 256x256 [bgcolor=#FFA500] [border: (3px solid #000000)] RenderTableSection {TBODY} at (3,3) size 250x250 RenderTableRow {TR} at (0,0) size 250x250 RenderTableCell {TD} at (0,0) size 50x250 [r=0 c=0 rs=1 cs=1] RenderBlock (anonymous) at (0,0) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,50) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#00FF00] RenderBlock (anonymous) at (0,150) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,150) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#FFFF00] RenderBlock (anonymous) at (0,250) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderTableCell {TD} at (50,0) size 50x250 [r=0 c=1 rs=1 cs=1] RenderBlock (anonymous) at (0,0) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,50) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#00FF00] RenderBlock (anonymous) at (0,150) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,150) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#FFFF00] RenderBlock (anonymous) at (0,250) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderTableCell {TD} at (100,0) size 50x250 [r=0 c=2 rs=1 cs=1] RenderBlock (anonymous) at (0,0) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,50) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#00FF00] RenderBlock (anonymous) at (0,100) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,150) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#FFFF00] RenderBlock (anonymous) at (0,250) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderTableCell {TD} at (150,0) size 50x250 [r=0 c=3 rs=1 cs=1] RenderBlock (anonymous) at (0,0) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,50) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#00FF00] RenderBlock (anonymous) at (0,200) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,150) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#FFFF00] RenderBlock (anonymous) at (0,250) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderTableCell {TD} at (200,0) size 50x250 [r=0 c=4 rs=1 cs=1] RenderBlock (anonymous) at (0,0) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,50) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#00FF00] RenderBlock (anonymous) at (0,50) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderInline {SPAN} at (0,0) size 0x0 RenderBlock (anonymous) at (0,150) size 50x50 RenderBlock {DIV} at (0,0) size 50x50 [bgcolor=#FFFF00] RenderBlock (anonymous) at (0,250) size 50x0 RenderInline {SPAN} at (0,0) size 0x0 RenderText {#text} at (0,0) size 0x0 RenderBlock {P} at (0,306) size 784x18 RenderText {#text} at (0,0) size 259x18 text run at (0,0) width 259: "This test is meaningless if you don't pass " RenderInline {A} at (0,0) size 49x18 [color=#0000EE] RenderText {#text} at (259,0) size 49x18 text run at (259,0) width 49: "test 006" RenderText {#text} at (308,0) size 4x18 text run at (308,0) width 4: "."
{ "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 org.apache.ranger.service; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map; import javax.persistence.EntityManager; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import javax.persistence.metamodel.EntityType; import javax.persistence.metamodel.Metamodel; import javax.persistence.metamodel.SingularAttribute; import org.apache.commons.lang.StringUtils; import org.apache.ranger.common.AppConstants; import org.apache.ranger.common.ContextUtil; import org.apache.ranger.common.SearchCriteria; import org.apache.ranger.common.SearchField; import org.apache.ranger.common.SortField; import org.apache.ranger.common.SortField.SORT_ORDER; import org.apache.ranger.common.UserSessionBase; import org.apache.ranger.entity.XXPortalUser; import org.apache.ranger.entity.XXPortalUserRole; import org.apache.ranger.entity.XXServiceDef; import org.apache.ranger.entity.XXTrxLog; import org.apache.ranger.entity.view.VXXTrxLog; import org.apache.ranger.plugin.store.EmbeddedServiceDefsUtil; import org.apache.ranger.view.VXTrxLog; import org.apache.ranger.view.VXTrxLogList; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @Service @Scope("singleton") public class XTrxLogService extends XTrxLogServiceBase<XXTrxLog, VXTrxLog> { Long keyadminCount = 0L; public XTrxLogService(){ searchFields.add(new SearchField("attributeName", "obj.attributeName", SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL)); searchFields.add(new SearchField("action", "obj.action", SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL)); searchFields.add(new SearchField("sessionId", "obj.sessionId", SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.FULL)); searchFields.add(new SearchField("startDate", "obj.createTime", SearchField.DATA_TYPE.DATE, SearchField.SEARCH_TYPE.GREATER_EQUAL_THAN)); searchFields.add(new SearchField("endDate", "obj.createTime", SearchField.DATA_TYPE.DATE, SearchField.SEARCH_TYPE.LESS_EQUAL_THAN)); searchFields.add(new SearchField("owner", "obj.addedByUserId", SearchField.DATA_TYPE.INT_LIST, SearchField.SEARCH_TYPE.FULL)); searchFields.add(new SearchField("objectClassType", "obj.objectClassType", SearchField.DATA_TYPE.INT_LIST, SearchField.SEARCH_TYPE.FULL)); sortFields.add(new SortField("createDate", "obj.createTime", true, SORT_ORDER.DESC)); } @Override protected void validateForCreate(VXTrxLog vObj) {} @Override protected void validateForUpdate(VXTrxLog vObj, XXTrxLog mObj) {} @Override public VXTrxLogList searchXTrxLogs(SearchCriteria searchCriteria) { EntityManager em = daoManager.getEntityManager(); CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder(); CriteriaQuery<VXXTrxLog> selectCQ = criteriaBuilder.createQuery(VXXTrxLog.class); Root<VXXTrxLog> rootEntityType = selectCQ.from(VXXTrxLog.class); Predicate predicate = generatePredicate(searchCriteria, em, criteriaBuilder, rootEntityType); selectCQ.where(predicate); if ("asc".equalsIgnoreCase(searchCriteria.getSortType())) { selectCQ.orderBy(criteriaBuilder.asc(rootEntityType.get("id"))); } else { selectCQ.orderBy(criteriaBuilder.desc(rootEntityType.get("id"))); } int startIndex = searchCriteria.getStartIndex(); int pageSize = searchCriteria.getMaxRows(); List<VXXTrxLog> resultList = em.createQuery(selectCQ).setFirstResult(startIndex).setMaxResults(pageSize) .getResultList(); int maxRowSize = Integer.MAX_VALUE; int minRowSize = 0; XXServiceDef xxServiceDef = daoManager.getXXServiceDef() .findByName(EmbeddedServiceDefsUtil.EMBEDDED_SERVICEDEF_KMS_NAME); UserSessionBase session = ContextUtil.getCurrentUserSession(); if (session != null && session.isKeyAdmin()) { resultList = em.createQuery(selectCQ).setFirstResult(minRowSize).setMaxResults(maxRowSize).getResultList(); } if (session != null && session.isAuditKeyAdmin()) { resultList = em.createQuery(selectCQ).setFirstResult(minRowSize).setMaxResults(maxRowSize).getResultList(); } List<VXTrxLog> trxLogList = new ArrayList<VXTrxLog>(); for (VXXTrxLog xTrxLog : resultList) { VXTrxLog trxLog = mapCustomViewToViewObj(xTrxLog); if (trxLog.getUpdatedBy() != null) { XXPortalUser xXPortalUser = daoManager.getXXPortalUser().getById(Long.parseLong(trxLog.getUpdatedBy())); if (xXPortalUser != null) { trxLog.setOwner(xXPortalUser.getLoginId()); } } trxLogList.add(trxLog); } List<VXTrxLog> keyAdminTrxLogList = new ArrayList<VXTrxLog>(); if (session != null && xxServiceDef != null && (session.isKeyAdmin()|| session.isAuditKeyAdmin())) { List<VXTrxLog> vXTrxLogs = new ArrayList<VXTrxLog>(); for (VXTrxLog xTrxLog : trxLogList) { int parentObjectClassType = xTrxLog.getParentObjectClassType(); Long parentObjectId = xTrxLog.getParentObjectId(); if (parentObjectClassType == AppConstants.CLASS_TYPE_XA_SERVICE_DEF && parentObjectId.equals(xxServiceDef.getId())) { vXTrxLogs.add(xTrxLog); } else if (parentObjectClassType == AppConstants.CLASS_TYPE_XA_SERVICE && !(parentObjectId.equals(xxServiceDef.getId()))) { for (VXTrxLog vxTrxLog : trxLogList) { if (parentObjectClassType == vxTrxLog.getObjectClassType() && parentObjectId.equals(vxTrxLog.getObjectId()) && vxTrxLog.getParentObjectId().equals(xxServiceDef.getId())) { vXTrxLogs.add(xTrxLog); break; } } } else if (xTrxLog.getObjectClassType() == AppConstants.CLASS_TYPE_XA_USER || xTrxLog.getObjectClassType() == AppConstants.CLASS_TYPE_RANGER_POLICY || xTrxLog.getObjectClassType() == AppConstants.HIST_OBJ_STATUS_UPDATED) { XXPortalUser xxPortalUser = null; if (xTrxLog.getUpdatedBy() != null) { xxPortalUser = daoManager.getXXPortalUser() .getById(Long.parseLong(xTrxLog.getUpdatedBy())); } if (xxPortalUser != null && xxPortalUser.getId() != null) { List<XXPortalUserRole> xxPortalUserRole = daoManager.getXXPortalUserRole() .findByUserId(xxPortalUser.getId()); if (xxPortalUserRole != null && (xxPortalUserRole.get(0).getUserRole().equalsIgnoreCase("ROLE_KEY_ADMIN") || xxPortalUserRole.get(0).getUserRole().equalsIgnoreCase("ROLE_KEY_ADMIN_AUDITOR"))) { vXTrxLogs.add(xTrxLog); } } } } keyadminCount = (long) vXTrxLogs.size(); if (vXTrxLogs != null && !vXTrxLogs.isEmpty()) { for (int k = startIndex; k <= pageSize; k++) { if (k < vXTrxLogs.size()) { keyAdminTrxLogList.add(vXTrxLogs.get(k)); } } } } VXTrxLogList vxTrxLogList = new VXTrxLogList(); vxTrxLogList.setStartIndex(startIndex); vxTrxLogList.setPageSize(pageSize); vxTrxLogList.setSortBy(searchCriteria.getSortBy()); vxTrxLogList.setSortType(searchCriteria.getSortType()); if (session != null && (session.isKeyAdmin() || session.isAuditKeyAdmin()) ) { vxTrxLogList.setVXTrxLogs(keyAdminTrxLogList); } else { vxTrxLogList.setVXTrxLogs(trxLogList); } return vxTrxLogList; } public Long searchXTrxLogsCount(SearchCriteria searchCriteria) { EntityManager em = daoManager.getEntityManager(); CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder(); CriteriaQuery<VXXTrxLog> selectCQ = criteriaBuilder.createQuery(VXXTrxLog.class); Root<VXXTrxLog> rootEntityType = selectCQ.from(VXXTrxLog.class); Predicate predicate = generatePredicate(searchCriteria, em, criteriaBuilder, rootEntityType); CriteriaQuery<Long> countCQ = criteriaBuilder.createQuery(Long.class); countCQ.select(criteriaBuilder.count(rootEntityType)).where(predicate); List<Long> countList = em.createQuery(countCQ).getResultList(); Long count = 0L; if(!CollectionUtils.isEmpty(countList)) { count = countList.get(0); if(count == null) { count = 0L; } } UserSessionBase session = ContextUtil.getCurrentUserSession(); if (session != null && session.isKeyAdmin()) { count = keyadminCount; } if (session != null && session.isAuditKeyAdmin()) { count = keyadminCount; } return count; } private Predicate generatePredicate(SearchCriteria searchCriteria, EntityManager em, CriteriaBuilder criteriaBuilder, Root<VXXTrxLog> rootEntityType) { Predicate predicate = criteriaBuilder.conjunction(); Map<String, Object> paramList = searchCriteria.getParamList(); if (CollectionUtils.isEmpty(paramList)) { return predicate; } Metamodel entityMetaModel = em.getMetamodel(); EntityType<VXXTrxLog> entityType = entityMetaModel.entity(VXXTrxLog.class); for (Map.Entry<String, Object> entry : paramList.entrySet()) { String key=entry.getKey(); for (SearchField searchField : searchFields) { if (!key.equalsIgnoreCase(searchField.getClientFieldName())) { continue; } String fieldName = searchField.getFieldName(); if (!StringUtils.isEmpty(fieldName)) { fieldName = fieldName.contains(".") ? fieldName.substring(fieldName.indexOf(".") + 1) : fieldName; } Object paramValue = entry.getValue(); boolean isListValue = false; if (paramValue != null && paramValue instanceof Collection) { isListValue = true; } // build where clause depending upon given parameters if (SearchField.DATA_TYPE.STRING.equals(searchField.getDataType())) { // build where clause for String datatypes SingularAttribute attr = entityType.getSingularAttribute(fieldName); if (attr != null) { Predicate stringPredicate = null; if (SearchField.SEARCH_TYPE.PARTIAL.equals(searchField.getSearchType())) { String val = "%" + paramValue + "%"; stringPredicate = criteriaBuilder.like(rootEntityType.get(attr), val); } else { stringPredicate = criteriaBuilder.equal(rootEntityType.get(attr), paramValue); } predicate = criteriaBuilder.and(predicate, stringPredicate); } } else if (SearchField.DATA_TYPE.INT_LIST.equals(searchField.getDataType()) || isListValue && SearchField.DATA_TYPE.INTEGER.equals(searchField.getDataType())) { // build where clause for integer lists or integers datatypes Collection<Number> intValueList = null; if (paramValue != null && (paramValue instanceof Integer || paramValue instanceof Long)) { intValueList = new ArrayList<Number>(); intValueList.add((Number) paramValue); } else { intValueList = (Collection<Number>) paramValue; } for (Number value : intValueList) { SingularAttribute attr = entityType.getSingularAttribute(fieldName); if (attr != null) { Predicate intPredicate = criteriaBuilder.equal(rootEntityType.get(attr), value); predicate = criteriaBuilder.and(predicate, intPredicate); } } } else if (SearchField.DATA_TYPE.DATE.equals(searchField.getDataType())) { // build where clause for date datatypes Date fieldValue = (Date) paramList.get(searchField.getClientFieldName()); if (fieldValue != null && searchField.getCustomCondition() == null) { SingularAttribute attr = entityType.getSingularAttribute(fieldName); Predicate datePredicate = null; if (SearchField.SEARCH_TYPE.LESS_THAN.equals(searchField.getSearchType())) { datePredicate = criteriaBuilder.lessThan(rootEntityType.get(attr), fieldValue); } else if (SearchField.SEARCH_TYPE.LESS_EQUAL_THAN.equals(searchField.getSearchType())) { datePredicate = criteriaBuilder.lessThanOrEqualTo(rootEntityType.get(attr), fieldValue); } else if (SearchField.SEARCH_TYPE.GREATER_THAN.equals(searchField.getSearchType())) { datePredicate = criteriaBuilder.greaterThan(rootEntityType.get(attr), fieldValue); } else if (SearchField.SEARCH_TYPE.GREATER_EQUAL_THAN.equals(searchField.getSearchType())) { datePredicate = criteriaBuilder.greaterThanOrEqualTo(rootEntityType.get(attr), fieldValue); } else { datePredicate = criteriaBuilder.equal(rootEntityType.get(attr), fieldValue); } predicate = criteriaBuilder.and(predicate, datePredicate); } } } } return predicate; } private VXTrxLog mapCustomViewToViewObj(VXXTrxLog vXXTrxLog){ VXTrxLog vXTrxLog = new VXTrxLog(); vXTrxLog.setId(vXXTrxLog.getId()); vXTrxLog.setAction(vXXTrxLog.getAction()); vXTrxLog.setAttributeName(vXXTrxLog.getAttributeName()); vXTrxLog.setCreateDate(vXXTrxLog.getCreateTime()); vXTrxLog.setNewValue(vXXTrxLog.getNewValue()); vXTrxLog.setPreviousValue(vXXTrxLog.getPreviousValue()); vXTrxLog.setSessionId(vXXTrxLog.getSessionId()); if(vXXTrxLog.getUpdatedByUserId()==null || vXXTrxLog.getUpdatedByUserId()==0){ vXTrxLog.setUpdatedBy(null); }else{ vXTrxLog.setUpdatedBy(String.valueOf(vXXTrxLog.getUpdatedByUserId())); } //We will have to get this from XXUser //vXTrxLog.setOwner(vXXTrxLog.getAddedByUserName()); vXTrxLog.setParentObjectId(vXXTrxLog.getParentObjectId()); vXTrxLog.setParentObjectClassType(vXXTrxLog.getParentObjectClassType()); vXTrxLog.setParentObjectName(vXXTrxLog.getParentObjectName()); vXTrxLog.setObjectClassType(vXXTrxLog.getObjectClassType()); vXTrxLog.setObjectId(vXXTrxLog.getObjectId()); vXTrxLog.setObjectName(vXXTrxLog.getObjectName()); vXTrxLog.setTransactionId(vXXTrxLog.getTransactionId()); return vXTrxLog; } @Override protected XXTrxLog mapViewToEntityBean(VXTrxLog vObj, XXTrxLog mObj, int OPERATION_CONTEXT) { XXTrxLog ret = null; if(vObj!=null && mObj!=null){ ret = super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT); XXPortalUser xXPortalUser=null; if(ret.getAddedByUserId()==null || ret.getAddedByUserId()==0){ if(!stringUtil.isEmpty(vObj.getOwner())){ xXPortalUser=daoManager.getXXPortalUser().findByLoginId(vObj.getOwner()); if(xXPortalUser!=null){ ret.setAddedByUserId(xXPortalUser.getId()); } } } if(ret.getUpdatedByUserId()==null || ret.getUpdatedByUserId()==0){ if(!stringUtil.isEmpty(vObj.getUpdatedBy())){ xXPortalUser= daoManager.getXXPortalUser().findByLoginId(vObj.getUpdatedBy()); if(xXPortalUser!=null){ ret.setUpdatedByUserId(xXPortalUser.getId()); } } } } return ret; } @Override protected VXTrxLog mapEntityToViewBean(VXTrxLog vObj, XXTrxLog mObj) { VXTrxLog ret = null; if(mObj!=null && vObj!=null){ ret = super.mapEntityToViewBean(vObj, mObj); XXPortalUser xXPortalUser=null; if(stringUtil.isEmpty(ret.getOwner())){ xXPortalUser= daoManager.getXXPortalUser().getById(mObj.getAddedByUserId()); if(xXPortalUser!=null){ ret.setOwner(xXPortalUser.getLoginId()); } } if(stringUtil.isEmpty(ret.getUpdatedBy())){ xXPortalUser= daoManager.getXXPortalUser().getById(mObj.getUpdatedByUserId()); if(xXPortalUser!=null){ ret.setUpdatedBy(xXPortalUser.getLoginId()); } } } return ret; } }
{ "pile_set_name": "Github" }
/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1beta1 // This file contains a collection of methods that can be used from go-restful to // generate Swagger API documentation for its models. Please read this PR for more // information on the implementation: https://github.com/emicklei/go-restful/pull/215 // // TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if // they are on one line! For multiple line or blocks that you want to ignore use ---. // Any context after a --- is ignored. // // Those methods can be generated by using hack/update-generated-swagger-docs.sh // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_AggregationRule = map[string]string{ "": "AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole", "clusterRoleSelectors": "ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added", } func (AggregationRule) SwaggerDoc() map[string]string { return map_AggregationRule } var map_ClusterRole = map[string]string{ "": "ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.", "metadata": "Standard object's metadata.", "rules": "Rules holds all the PolicyRules for this ClusterRole", "aggregationRule": "AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be stomped by the controller.", } func (ClusterRole) SwaggerDoc() map[string]string { return map_ClusterRole } var map_ClusterRoleBinding = map[string]string{ "": "ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace, and adds who information via Subject.", "metadata": "Standard object's metadata.", "subjects": "Subjects holds references to the objects the role applies to.", "roleRef": "RoleRef can only reference a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", } func (ClusterRoleBinding) SwaggerDoc() map[string]string { return map_ClusterRoleBinding } var map_ClusterRoleBindingList = map[string]string{ "": "ClusterRoleBindingList is a collection of ClusterRoleBindings", "metadata": "Standard object's metadata.", "items": "Items is a list of ClusterRoleBindings", } func (ClusterRoleBindingList) SwaggerDoc() map[string]string { return map_ClusterRoleBindingList } var map_ClusterRoleList = map[string]string{ "": "ClusterRoleList is a collection of ClusterRoles", "metadata": "Standard object's metadata.", "items": "Items is a list of ClusterRoles", } func (ClusterRoleList) SwaggerDoc() map[string]string { return map_ClusterRoleList } var map_PolicyRule = map[string]string{ "": "PolicyRule holds information that describes a policy rule, but does not contain information about who the rule applies to or which namespace the rule applies to.", "verbs": "Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds.", "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed.", "resources": "Resources is a list of resources this rule applies to. '*' represents all resources in the specified apiGroups. '*/foo' represents the subresource 'foo' for all resources in the specified apiGroups.", "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as \"pods\" or \"secrets\") or non-resource URL paths (such as \"/api\"), but not both.", } func (PolicyRule) SwaggerDoc() map[string]string { return map_PolicyRule } var map_Role = map[string]string{ "": "Role is a namespaced, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding.", "metadata": "Standard object's metadata.", "rules": "Rules holds all the PolicyRules for this Role", } func (Role) SwaggerDoc() map[string]string { return map_Role } var map_RoleBinding = map[string]string{ "": "RoleBinding references a role, but does not contain it. It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in. RoleBindings in a given namespace only have effect in that namespace.", "metadata": "Standard object's metadata.", "subjects": "Subjects holds references to the objects the role applies to.", "roleRef": "RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.", } func (RoleBinding) SwaggerDoc() map[string]string { return map_RoleBinding } var map_RoleBindingList = map[string]string{ "": "RoleBindingList is a collection of RoleBindings", "metadata": "Standard object's metadata.", "items": "Items is a list of RoleBindings", } func (RoleBindingList) SwaggerDoc() map[string]string { return map_RoleBindingList } var map_RoleList = map[string]string{ "": "RoleList is a collection of Roles", "metadata": "Standard object's metadata.", "items": "Items is a list of Roles", } func (RoleList) SwaggerDoc() map[string]string { return map_RoleList } var map_RoleRef = map[string]string{ "": "RoleRef contains information that points to the role being used", "apiGroup": "APIGroup is the group for the resource being referenced", "kind": "Kind is the type of resource being referenced", "name": "Name is the name of resource being referenced", } func (RoleRef) SwaggerDoc() map[string]string { return map_RoleRef } var map_Subject = map[string]string{ "": "Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names.", "kind": "Kind of object being referenced. Values defined by this API group are \"User\", \"Group\", and \"ServiceAccount\". If the Authorizer does not recognized the kind value, the Authorizer should report an error.", "apiGroup": "APIGroup holds the API group of the referenced subject. Defaults to \"\" for ServiceAccount subjects. Defaults to \"rbac.authorization.k8s.io\" for User and Group subjects.", "name": "Name of the object being referenced.", "namespace": "Namespace of the referenced object. If the object kind is non-namespace, such as \"User\" or \"Group\", and this value is not empty the Authorizer should report an error.", } func (Subject) SwaggerDoc() map[string]string { return map_Subject } // AUTO-GENERATED FUNCTIONS END HERE
{ "pile_set_name": "Github" }
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #include "stdafx.h" using namespace std; using namespace Common; namespace Federation { NodeId const NodeId::MinNodeId = StaticInit_MinNodeId(); NodeId const NodeId::MaxNodeId = StaticInit_MaxNodeId(); NodeId const & NodeId::StaticInit_MinNodeId() { static const NodeId min = NodeId(LargeInteger::StaticInit_Zero()); return min; } NodeId const & NodeId::StaticInit_MaxNodeId() { static const NodeId max = NodeId(LargeInteger::StaticInit_MaxValue()); return max; } NodeId::NodeId(LargeInteger const& from) : idValue_(from) { } NodeId::NodeId() { } bool NodeId::TryParse(wstring const& data, __out NodeId & id) { return LargeInteger::TryParse(data, id.idValue_); } LargeInteger const & NodeId::getIdValue() const { return idValue_; } bool NodeId::operator == (NodeId const& other ) const { return idValue_ == other.idValue_; } bool NodeId::operator != (NodeId const& other ) const { return idValue_ != other.idValue_; } bool NodeId::operator < (NodeId const& other ) const { return idValue_ < other.idValue_; } bool NodeId::operator >= (NodeId const& other ) const { return idValue_ >= other.idValue_; } bool NodeId::operator > (NodeId const& other ) const { return idValue_ > other.idValue_; } bool NodeId::operator <= (NodeId const& other ) const { return idValue_ <= other.idValue_; } const NodeId NodeId::operator +(LargeInteger const& value) const { return NodeId(idValue_ + value); } const NodeId NodeId::operator -(LargeInteger const& value) const { return NodeId(idValue_ - value); } void NodeId::operator++() { ++idValue_; } void NodeId::operator--() { --idValue_; } NodeId NodeId::SuccWalk(LargeInteger const& value) const { return *this + value; } NodeId NodeId::PredWalk(LargeInteger const& value) const { return *this - value; } LargeInteger NodeId::SuccDist(NodeId const& id) const { return (id.idValue_ - idValue_); } LargeInteger NodeId::PredDist(NodeId const& id) const { return (idValue_ - id.idValue_); } LargeInteger NodeId::MinDist(NodeId const& id) const { LargeInteger succDist = SuccDist(id); if (succDist.IsSmallerPart()) { return (succDist); } LargeInteger predDist = PredDist(id); return (predDist); } bool NodeId::Precedes(NodeId const& id) const { // Consider the common case to be true LargeInteger predDist = PredDist(id); if (predDist.IsSmallerPart()) { return (false); } LargeInteger succDist = SuccDist(id); if (succDist.IsSmallerPart()) { return (true); } // This can happen when the modulo size of the LargeInteger // is even. For example, n1=0 and n2=128 in the case of a byte // sized LargeInteger arrive at this point. We break the tie in // favor of the smaller number // // ************************************************************ // GopalK - Important Implementation note // -------------------------------------- // Though, the following is the mathematically correct behavior // routing table code makes the decision on whether n2 is a // successor of n1 solely on the succDist being less than // or equal to predDist in the interest of avoiding this third // check. This results in the anomaly of n1 considering n2 as // its successor and n2 considering n1 as its successor for the // nodes broken by this tie in the third case. This is not a // problem so far because nodes n1 and n2 do not have to agree // on this conflicting decision so far. If they do, this aspect // of routing table logic needs to be revisited // ************************************************************ ASSERT_IFNOT(succDist == predDist, "succDist:{0} != predDist:{1}", succDist, predDist); return (idValue_ < id.idValue_); } NodeId NodeId::GetSuccMidPoint(NodeId const & succID) const { LargeInteger dist = SuccDist(succID); return (SuccWalk(dist >> 1)); } NodeId NodeId::GetPredMidPoint(NodeId const & predID) const { LargeInteger dist = PredDist(predID); return (PredWalk((dist - LargeInteger::One) >> 1)); } void NodeId::WriteTo(Common::TextWriter& w, Common::FormatOptions const& options) const { idValue_.WriteTo(w, options); } wstring NodeId::ToString() const { return idValue_.ToString(); } void NodeId::ToPublicApi(__out FABRIC_NODE_ID & publicNodeId) const { publicNodeId = idValue_.ToPublicApi(); } ErrorCode NodeId::FromPublicApi(__in FABRIC_NODE_ID const& publicNodeId) { idValue_.FromPublicApi(publicNodeId); return ErrorCode::Success(); } }
{ "pile_set_name": "Github" }
import * as uploader from "file-cloud-uploader"; import * as async from "async"; import * as skipper from "skipper"; export class VFile { protected name protected options public cloud(req) { return (name, options) => { return new Promise((resolve, reject) => { req.file(name).upload((err, files) => { this._isError(err, resolve, () => { const cloudFiles = []; async.each(files, (file, cb) => { uploader(options.type, file.fd, options.config, (data) => { cloudFiles.push(data); cb(); }); }, (err1) => { this._isError(err1, reject, () => { resolve(cloudFiles); }); }); }) }); }); }; } public attach(app) { app.use(skipper()); app.use(this.use()); } public use() { return (req, res, next) => { req.cloud = this.cloud(req); next(); } } public _isError(err, reject, cb = null) { if (err) { return reject(err); } if (cb instanceof Function) { cb(); } } }
{ "pile_set_name": "Github" }
class JobControllerTest < Test::Unit::TestCase include Rack::Test::Methods def app Sinatra::Application end def setup @graph = { "id" => "doublynested", "name" => "doubly-nested-graph", "created_at" => 1415215545000, "updated_at" => 1415215545000, "nodes" => [ {"id" => "optimized-a", "properties" => {"alias" => "one", "operation" =>"operation-A", "step_type" => "mapper"}}, {"id" => "optimized-b", "properties" => {"alias" => "two", "operation" =>"operation-B", "step_type" => "mapper"}}, {"id" => "unoptimized-a", "properties" => {"alias" => "one", "operation" =>"operation-A", "step_type" => "mapper"}}, {"id" => "unoptimized-b", "properties" => {"alias" => "two", "operation" =>"operation-B", "step_type" => "mapper"}}, {"id" => "optimized-job1", "child" => "1"}, {"id" => "optimized-job2", "child" => "2"}, {"id" => "unoptimized-job1", "child" => "3"}, {"id" => "unoptimized-job2", "child" => "4"}, {"id" => "optimized", "child" => "5"}, {"id" => "unoptimized", "child" => "6"} ], "edges" => [ {"u" => "optimized-a", "v" => "optimized-b", "properties" =>{ "sampleOutput" =>["a\u00011\nb\u00012"], "schema" =>[ {"type" =>"CHARARRAY", "alias" =>"name"}, {"type" =>"INTEGER", "alias" =>"value"} ] } }, {"u" => "unoptimized-a", "v" => "unoptimized-b"} ], "node_groups" => [ {"id" => "1", "children" => ["optimized-a"]}, {"id" => "2", "children" => ["optimized-b"]}, {"id" => "3", "children" => ["unoptimized-a"]}, {"id" => "4", "children" => ["unoptimized-b"]}, {"id" => "5", "children" => ["optimized-job1","optimized-job2"]}, {"id" => "6", "children" => ["unoptimized-job1","unoptimized-job2"]} ] } @status_update = { "node_groups" => [ {"id" => "3", "status" => { "progress" => 10, "statusText" => "running", "startTime" => 1415215545000, "heartbeatTime" => 1415215545000, "endTime" => -1 } } ], "nodes" => [ {"id" => "optimized-a", "status" => { "statusText" => "borken" } } ] } @expected_list_response = { 'jobs' => [{ 'id' => @graph['id'], 'name' => @graph['name'], 'created_at' => @graph['created_at'] }], 'jobsTotal' => 1 } @expected_post_response = { 'id' => @graph['id'] } @expected_put_response = { 'id' => @graph['id'] } @node_update = { 'id' => 'optimized-a', 'status' => {'statusText' => 'failed'} } @node_group_update = { 'id' => '3', 'status' => {'statusText' => 'failed'} } @edge_update = { 'u' => 'unoptimized-a', 'v' => 'unoptimized-b', 'properties' => { 'sampleOutput' => ['a\u00011\nb\u00012'], 'schema' => [ {'type' => 'CHARARRAY', 'alias' => 'name'}, {'type' => 'INTEGER', 'alias' => 'value'} ] } } PlanService.save_graph({}, @graph.to_json) ElasticSearchAdaptor.instance.refresh! end def test_should_list_jobs get '/v1/job' assert last_response.ok? response = JSON.parse(last_response.body) first_job = @expected_list_response['jobs'].first response_job = response['jobs'].first assert_equal @expected_list_response['jobsTotal'], response['jobsTotal'] assert_equal first_job['id'], response_job['id'] assert_equal first_job['name'], response_job['name'] assert_equal first_job['created_at'], response_job['created_at'] assert_operator response_job['updated_at'], :>=, first_job['created_at'] end def test_should_post_jobs post '/v1/job', @graph.to_json assert last_response.ok? assert_equal @expected_post_response, JSON.parse(last_response.body) end def test_update_job put '/v1/job/'+@graph['id'], @status_update.to_json assert last_response.ok? assert_equal @expected_put_response, JSON.parse(last_response.body) ElasticSearchAdaptor.instance.refresh! get '/v1/job/'+@graph['id'] assert last_response.ok? updated = JSON.parse(last_response.body) expected_ng = @status_update['node_groups'].first expected_status = expected_ng['status'] expected_node = @status_update['nodes'].first ng = updated['node_groups'].find{|x| x['id'] == expected_ng['id']} node = updated['nodes'].find{|x| x['id'] == expected_node['id']} assert_equal( [expected_status['startTime'], expected_status['progress']], [ng['status']['startTime'], ng['status']['progress']] ) assert_equal expected_node['status']['statusText'], node['status']['statusText'] end def test_update_node put '/v1/job/'+@graph['id']+'/node/'+@node_update['id'], @node_update.to_json assert last_response.ok? assert_equal @expected_put_response, JSON.parse(last_response.body) ElasticSearchAdaptor.instance.refresh! get '/v1/job/'+@graph['id'] assert last_response.ok? updated = JSON.parse(last_response.body) node = updated['nodes'].find{|x| x['id'] == @node_update['id']} assert_equal @node_update['status']['statusText'], node['status']['statusText'] end def test_update_edge put '/v1/job/'+@graph['id']+'/edge/?u='+@edge_update['u']+'&v='+@edge_update['v'], @edge_update.to_json assert last_response.ok? assert_equal @expected_put_response, JSON.parse(last_response.body) ElasticSearchAdaptor.instance.refresh! get '/v1/job/'+@graph['id'] assert last_response.ok? updated = JSON.parse(last_response.body) edge = updated['edges'].find{|x| (x['u'] == @edge_update['u'] && x['v'] == @edge_update['v'])} assert_equal @edge_update['properties'], edge['properties'] end def test_update_node_group put '/v1/job/'+@graph['id']+'/nodeGroup/'+@node_group_update['id'], @node_group_update.to_json assert last_response.ok? assert_equal @expected_put_response, JSON.parse(last_response.body) ElasticSearchAdaptor.instance.refresh! get '/v1/job/'+@graph['id'] assert last_response.ok? updated = JSON.parse(last_response.body) node_group = updated['node_groups'].find{|x| x['id'] == @node_group_update['id']} assert_equal @node_group_update['status']['statusText'], node_group['status']['statusText'] end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Scheme LastUpgradeVersion = "0720" version = "1.3"> <BuildAction parallelizeBuildables = "YES" buildImplicitDependencies = "YES"> <BuildActionEntries> <BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D01CCC60486CAD60068D4B7" BuildableName = "Gain.vst" BlueprintName = "Gain" ReferencedContainer = "container:Gain.xcodeproj"> </BuildableReference> </BuildActionEntry> </BuildActionEntries> </BuildAction> <TestAction buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> </Testables> <AdditionalOptions> </AdditionalOptions> </TestAction> <LaunchAction buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" allowLocationSimulation = "YES"> <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D01CCC60486CAD60068D4B7" BuildableName = "Gain.vst" BlueprintName = "Gain" ReferencedContainer = "container:Gain.xcodeproj"> </BuildableReference> </MacroExpansion> <AdditionalOptions> </AdditionalOptions> </LaunchAction> <ProfileAction buildConfiguration = "Release" shouldUseLaunchSchemeArgsEnv = "YES" savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" BlueprintIdentifier = "8D01CCC60486CAD60068D4B7" BuildableName = "Gain.vst" BlueprintName = "Gain" ReferencedContainer = "container:Gain.xcodeproj"> </BuildableReference> </MacroExpansion> </ProfileAction> <AnalyzeAction buildConfiguration = "Debug"> </AnalyzeAction> <ArchiveAction buildConfiguration = "Release" revealArchiveInOrganizer = "YES"> </ArchiveAction> </Scheme>
{ "pile_set_name": "Github" }
// 这样写不行 const { odd } = require('./odd') exports.counter = 0; exports.even = function even(n) { exports.counter++; return n == 0 || odd(n - 1); } // 将require移到这里就行了
{ "pile_set_name": "Github" }
easyblock = 'CMakeMake' name = 'CLHEP' version = '2.2.0.8' homepage = 'http://proj-clhep.web.cern.ch/proj-clhep/' description = """The CLHEP project is intended to be a set of HEP-specific foundation and utility classes such as random generators, physics vectors, geometry and linear algebra. CLHEP is structured in a set of packages independent of any external package.""" toolchain = {'name': 'intel', 'version': '2016a'} toolchainopts = {'pic': True} sources = [SOURCELOWER_TGZ] source_urls = ['http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/tarFiles/'] builddependencies = [('CMake', '3.4.3')] separate_build_dir = True configopts = '-DCMAKE_BUILD_TYPE=Release' moduleclass = 'numlib'
{ "pile_set_name": "Github" }
/**************************************************************** Copyright 1990 - 1997 by AT&T, Lucent Technologies and Bellcore. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the names of AT&T, Bell Laboratories, Lucent or Bellcore or any of their entities not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. AT&T, Lucent and Bellcore disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall AT&T, Lucent or Bellcore be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. ****************************************************************/ #define FMAX 40 #define EXPMAXDIGS 8 #define EXPMAX 99999999 /* FMAX = max number of nonzero digits passed to atof() */ /* EXPMAX = 10^EXPMAXDIGS - 1 = largest allowed exponent absolute value */ #ifdef V10 /* Research Tenth-Edition Unix */ #include "local.h" #endif /* MAXFRACDIGS and MAXINTDIGS are for wrt_F -- bounds (not necessarily tight) on the maximum number of digits to the right and left of * the decimal point. */ #ifdef VAX #define MAXFRACDIGS 56 #define MAXINTDIGS 38 #else #ifdef CRAY #define MAXFRACDIGS 9880 #define MAXINTDIGS 9864 #else /* values that suffice for IEEE double */ #define MAXFRACDIGS 344 #define MAXINTDIGS 308 #endif #endif
{ "pile_set_name": "Github" }
/* timing.c Copyright (C) 2013 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. or both in parallel, as here. GNU Nettle 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 copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/. */ #if HAVE_CONFIG_H # include "config.h" #endif #include "timing.h" #include <errno.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #if HAVE_CLOCK_GETTIME && defined CLOCK_PROCESS_CPUTIME_ID #define TRY_CLOCK_GETTIME 1 struct timespec cgt_start; static void NORETURN PRINTF_STYLE(1,2) die(const char *format, ...) { va_list args; va_start(args, format); vfprintf(stderr, format, args); va_end(args); exit(EXIT_FAILURE); } static int cgt_works_p(void) { struct timespec now; return clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &now) == 0; } static void cgt_time_start(void) { if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &cgt_start) < 0) die("clock_gettime failed: %s\n", strerror(errno)); } static double cgt_time_end(void) { struct timespec end; if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end) < 0) die("clock_gettime failed: %s\n", strerror(errno)); return end.tv_sec - cgt_start.tv_sec + 1e-9 * (end.tv_nsec - cgt_start.tv_nsec); } #endif /* !HAVE_CLOCK_GETTIME */ static clock_t clock_start; static void clock_time_start(void) { clock_start = clock(); } static double clock_time_end(void) { return (double) (clock() - (clock_start)) / CLOCKS_PER_SEC; } void (*time_start)(void) = clock_time_start; double (*time_end)(void) = clock_time_end; void time_init(void) { /* Choose timing function */ #if TRY_CLOCK_GETTIME if (cgt_works_p()) { time_start = cgt_time_start; time_end = cgt_time_end; } else { fprintf(stderr, "clock_gettime not working, falling back to clock\n"); time_start = clock_time_start; time_end = clock_time_end; } #endif }
{ "pile_set_name": "Github" }
{% if redirect %} <script type="text/javascript"><!-- location = '{{ redirect }}'; //--></script> {% elseif klarna_checkout %} {{ klarna_checkout }} {% endif %}
{ "pile_set_name": "Github" }
<?php /* +-----------------------------------------------------------------------+ | Localization file of the Roundcube Webmail Zipdownload plugin | | | | Copyright (C) The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | | See the README file for a full license statement. | +-----------------------------------------------------------------------+ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-zipdownload/ */ $labels['downloadall'] = 'Niðurhala öllum viðhengjum'; $labels['download'] = 'Hlaða niður...'; $labels['downloadmbox'] = 'Mbox snið (.zip)'; $labels['downloadmaildir'] = 'Maildir snið (.zip)'; $labels['downloademl'] = 'Upprunalegt (.eml)'; $labels['sizelimiterror'] = 'Heildarstærð valinna skilaboða fer fram yfir ($size) takmörkin';
{ "pile_set_name": "Github" }
------------------------------------------------------------------------ -- ddDivide.decTest -- decDouble division -- -- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- [email protected] -- ------------------------------------------------------------------------ version: 2.59 precision: 16 maxExponent: 384 minExponent: -383 extended: 1 clamp: 1 rounding: half_even -- sanity checks dddiv001 divide 1 1 -> 1 dddiv002 divide 2 1 -> 2 dddiv003 divide 1 2 -> 0.5 dddiv004 divide 2 2 -> 1 dddiv005 divide 0 1 -> 0 dddiv006 divide 0 2 -> 0 dddiv007 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv008 divide 2 3 -> 0.6666666666666667 Inexact Rounded dddiv009 divide 3 3 -> 1 dddiv010 divide 2.4 1 -> 2.4 dddiv011 divide 2.4 -1 -> -2.4 dddiv012 divide -2.4 1 -> -2.4 dddiv013 divide -2.4 -1 -> 2.4 dddiv014 divide 2.40 1 -> 2.40 dddiv015 divide 2.400 1 -> 2.400 dddiv016 divide 2.4 2 -> 1.2 dddiv017 divide 2.400 2 -> 1.200 dddiv018 divide 2. 2 -> 1 dddiv019 divide 20 20 -> 1 dddiv020 divide 187 187 -> 1 dddiv021 divide 5 2 -> 2.5 dddiv022 divide 50 20 -> 2.5 dddiv023 divide 500 200 -> 2.5 dddiv024 divide 50.0 20.0 -> 2.5 dddiv025 divide 5.00 2.00 -> 2.5 dddiv026 divide 5 2.0 -> 2.5 dddiv027 divide 5 2.000 -> 2.5 dddiv028 divide 5 0.20 -> 25 dddiv029 divide 5 0.200 -> 25 dddiv030 divide 10 1 -> 10 dddiv031 divide 100 1 -> 100 dddiv032 divide 1000 1 -> 1000 dddiv033 divide 1000 100 -> 10 dddiv035 divide 1 2 -> 0.5 dddiv036 divide 1 4 -> 0.25 dddiv037 divide 1 8 -> 0.125 dddiv038 divide 1 16 -> 0.0625 dddiv039 divide 1 32 -> 0.03125 dddiv040 divide 1 64 -> 0.015625 dddiv041 divide 1 -2 -> -0.5 dddiv042 divide 1 -4 -> -0.25 dddiv043 divide 1 -8 -> -0.125 dddiv044 divide 1 -16 -> -0.0625 dddiv045 divide 1 -32 -> -0.03125 dddiv046 divide 1 -64 -> -0.015625 dddiv047 divide -1 2 -> -0.5 dddiv048 divide -1 4 -> -0.25 dddiv049 divide -1 8 -> -0.125 dddiv050 divide -1 16 -> -0.0625 dddiv051 divide -1 32 -> -0.03125 dddiv052 divide -1 64 -> -0.015625 dddiv053 divide -1 -2 -> 0.5 dddiv054 divide -1 -4 -> 0.25 dddiv055 divide -1 -8 -> 0.125 dddiv056 divide -1 -16 -> 0.0625 dddiv057 divide -1 -32 -> 0.03125 dddiv058 divide -1 -64 -> 0.015625 -- bcdTime dddiv060 divide 1 7 -> 0.1428571428571429 Inexact Rounded dddiv061 divide 1.2345678 1.9876543 -> 0.6211179680490717 Inexact Rounded -- 1234567890123456 dddiv071 divide 9999999999999999 1 -> 9999999999999999 dddiv072 divide 999999999999999 1 -> 999999999999999 dddiv073 divide 99999999999999 1 -> 99999999999999 dddiv074 divide 9999999999999 1 -> 9999999999999 dddiv075 divide 999999999999 1 -> 999999999999 dddiv076 divide 99999999999 1 -> 99999999999 dddiv077 divide 9999999999 1 -> 9999999999 dddiv078 divide 999999999 1 -> 999999999 dddiv079 divide 99999999 1 -> 99999999 dddiv080 divide 9999999 1 -> 9999999 dddiv081 divide 999999 1 -> 999999 dddiv082 divide 99999 1 -> 99999 dddiv083 divide 9999 1 -> 9999 dddiv084 divide 999 1 -> 999 dddiv085 divide 99 1 -> 99 dddiv086 divide 9 1 -> 9 dddiv090 divide 0. 1 -> 0 dddiv091 divide .0 1 -> 0.0 dddiv092 divide 0.00 1 -> 0.00 dddiv093 divide 0.00E+9 1 -> 0E+7 dddiv094 divide 0.0000E-50 1 -> 0E-54 dddiv095 divide 1 1E-8 -> 1E+8 dddiv096 divide 1 1E-9 -> 1E+9 dddiv097 divide 1 1E-10 -> 1E+10 dddiv098 divide 1 1E-11 -> 1E+11 dddiv099 divide 1 1E-12 -> 1E+12 dddiv100 divide 1 1 -> 1 dddiv101 divide 1 2 -> 0.5 dddiv102 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv103 divide 1 4 -> 0.25 dddiv104 divide 1 5 -> 0.2 dddiv105 divide 1 6 -> 0.1666666666666667 Inexact Rounded dddiv106 divide 1 7 -> 0.1428571428571429 Inexact Rounded dddiv107 divide 1 8 -> 0.125 dddiv108 divide 1 9 -> 0.1111111111111111 Inexact Rounded dddiv109 divide 1 10 -> 0.1 dddiv110 divide 1 1 -> 1 dddiv111 divide 2 1 -> 2 dddiv112 divide 3 1 -> 3 dddiv113 divide 4 1 -> 4 dddiv114 divide 5 1 -> 5 dddiv115 divide 6 1 -> 6 dddiv116 divide 7 1 -> 7 dddiv117 divide 8 1 -> 8 dddiv118 divide 9 1 -> 9 dddiv119 divide 10 1 -> 10 dddiv120 divide 3E+1 0.001 -> 3E+4 dddiv121 divide 2.200 2 -> 1.100 dddiv130 divide 12345 4.999 -> 2469.493898779756 Inexact Rounded dddiv131 divide 12345 4.99 -> 2473.947895791583 Inexact Rounded dddiv132 divide 12345 4.9 -> 2519.387755102041 Inexact Rounded dddiv133 divide 12345 5 -> 2469 dddiv134 divide 12345 5.1 -> 2420.588235294118 Inexact Rounded dddiv135 divide 12345 5.01 -> 2464.071856287425 Inexact Rounded dddiv136 divide 12345 5.001 -> 2468.506298740252 Inexact Rounded -- test possibly imprecise results dddiv220 divide 391 597 -> 0.6549413735343384 Inexact Rounded dddiv221 divide 391 -597 -> -0.6549413735343384 Inexact Rounded dddiv222 divide -391 597 -> -0.6549413735343384 Inexact Rounded dddiv223 divide -391 -597 -> 0.6549413735343384 Inexact Rounded -- test some cases that are close to exponent overflow, some with coefficient padding dddiv270 divide 1 1e384 -> 1E-384 Subnormal dddiv271 divide 1 0.9e384 -> 1.11111111111111E-384 Rounded Inexact Subnormal Underflow dddiv272 divide 1 0.99e384 -> 1.01010101010101E-384 Rounded Inexact Subnormal Underflow dddiv273 divide 1 0.9999999999999999e384 -> 1.00000000000000E-384 Rounded Inexact Subnormal Underflow dddiv274 divide 9e384 1 -> 9.000000000000000E+384 Clamped dddiv275 divide 9.9e384 1 -> 9.900000000000000E+384 Clamped dddiv276 divide 9.99e384 1 -> 9.990000000000000E+384 Clamped dddiv277 divide 9.9999999999999e384 1 -> 9.999999999999900E+384 Clamped dddiv278 divide 9.99999999999999e384 1 -> 9.999999999999990E+384 Clamped dddiv279 divide 9.999999999999999e384 1 -> 9.999999999999999E+384 dddiv285 divide 9.9e384 1.1 -> 9.000000000000000E+384 Clamped dddiv286 divide 9.99e384 1.1 -> 9.081818181818182E+384 Inexact Rounded dddiv287 divide 9.9999999999999e384 1.1 -> 9.090909090909000E+384 Clamped dddiv288 divide 9.99999999999999e384 1.1 -> 9.090909090909082E+384 Inexact Rounded dddiv289 divide 9.999999999999999e384 1.1 -> 9.090909090909090E+384 Clamped -- Divide into 0 tests dddiv301 divide 0 7 -> 0 dddiv302 divide 0 7E-5 -> 0E+5 dddiv303 divide 0 7E-1 -> 0E+1 dddiv304 divide 0 7E+1 -> 0.0 dddiv305 divide 0 7E+5 -> 0.00000 dddiv306 divide 0 7E+6 -> 0.000000 dddiv307 divide 0 7E+7 -> 0E-7 dddiv308 divide 0 70E-5 -> 0E+5 dddiv309 divide 0 70E-1 -> 0E+1 dddiv310 divide 0 70E+0 -> 0 dddiv311 divide 0 70E+1 -> 0.0 dddiv312 divide 0 70E+5 -> 0.00000 dddiv313 divide 0 70E+6 -> 0.000000 dddiv314 divide 0 70E+7 -> 0E-7 dddiv315 divide 0 700E-5 -> 0E+5 dddiv316 divide 0 700E-1 -> 0E+1 dddiv317 divide 0 700E+0 -> 0 dddiv318 divide 0 700E+1 -> 0.0 dddiv319 divide 0 700E+5 -> 0.00000 dddiv320 divide 0 700E+6 -> 0.000000 dddiv321 divide 0 700E+7 -> 0E-7 dddiv322 divide 0 700E+77 -> 0E-77 dddiv331 divide 0E-3 7E-5 -> 0E+2 dddiv332 divide 0E-3 7E-1 -> 0.00 dddiv333 divide 0E-3 7E+1 -> 0.0000 dddiv334 divide 0E-3 7E+5 -> 0E-8 dddiv335 divide 0E-1 7E-5 -> 0E+4 dddiv336 divide 0E-1 7E-1 -> 0 dddiv337 divide 0E-1 7E+1 -> 0.00 dddiv338 divide 0E-1 7E+5 -> 0.000000 dddiv339 divide 0E+1 7E-5 -> 0E+6 dddiv340 divide 0E+1 7E-1 -> 0E+2 dddiv341 divide 0E+1 7E+1 -> 0 dddiv342 divide 0E+1 7E+5 -> 0.0000 dddiv343 divide 0E+3 7E-5 -> 0E+8 dddiv344 divide 0E+3 7E-1 -> 0E+4 dddiv345 divide 0E+3 7E+1 -> 0E+2 dddiv346 divide 0E+3 7E+5 -> 0.00 -- These were 'input rounding' dddiv441 divide 12345678000 1 -> 12345678000 dddiv442 divide 1 12345678000 -> 8.100000664200054E-11 Inexact Rounded dddiv443 divide 1234567800 1 -> 1234567800 dddiv444 divide 1 1234567800 -> 8.100000664200054E-10 Inexact Rounded dddiv445 divide 1234567890 1 -> 1234567890 dddiv446 divide 1 1234567890 -> 8.100000073710001E-10 Inexact Rounded dddiv447 divide 1234567891 1 -> 1234567891 dddiv448 divide 1 1234567891 -> 8.100000067149001E-10 Inexact Rounded dddiv449 divide 12345678901 1 -> 12345678901 dddiv450 divide 1 12345678901 -> 8.100000073053901E-11 Inexact Rounded dddiv451 divide 1234567896 1 -> 1234567896 dddiv452 divide 1 1234567896 -> 8.100000034344000E-10 Inexact Rounded -- high-lows dddiv453 divide 1e+1 1 -> 1E+1 dddiv454 divide 1e+1 1.0 -> 1E+1 dddiv455 divide 1e+1 1.00 -> 1E+1 dddiv456 divide 1e+2 2 -> 5E+1 dddiv457 divide 1e+2 2.0 -> 5E+1 dddiv458 divide 1e+2 2.00 -> 5E+1 -- some from IEEE discussions dddiv460 divide 3e0 2e0 -> 1.5 dddiv461 divide 30e-1 2e0 -> 1.5 dddiv462 divide 300e-2 2e0 -> 1.50 dddiv464 divide 3000e-3 2e0 -> 1.500 dddiv465 divide 3e0 20e-1 -> 1.5 dddiv466 divide 30e-1 20e-1 -> 1.5 dddiv467 divide 300e-2 20e-1 -> 1.5 dddiv468 divide 3000e-3 20e-1 -> 1.50 dddiv469 divide 3e0 200e-2 -> 1.5 dddiv470 divide 30e-1 200e-2 -> 1.5 dddiv471 divide 300e-2 200e-2 -> 1.5 dddiv472 divide 3000e-3 200e-2 -> 1.5 dddiv473 divide 3e0 2000e-3 -> 1.5 dddiv474 divide 30e-1 2000e-3 -> 1.5 dddiv475 divide 300e-2 2000e-3 -> 1.5 dddiv476 divide 3000e-3 2000e-3 -> 1.5 -- some reciprocals dddiv480 divide 1 1.0E+33 -> 1E-33 dddiv481 divide 1 10E+33 -> 1E-34 dddiv482 divide 1 1.0E-33 -> 1E+33 dddiv483 divide 1 10E-33 -> 1E+32 -- RMS discussion table dddiv484 divide 0e5 1e3 -> 0E+2 dddiv485 divide 0e5 2e3 -> 0E+2 dddiv486 divide 0e5 10e2 -> 0E+3 dddiv487 divide 0e5 20e2 -> 0E+3 dddiv488 divide 0e5 100e1 -> 0E+4 dddiv489 divide 0e5 200e1 -> 0E+4 dddiv491 divide 1e5 1e3 -> 1E+2 dddiv492 divide 1e5 2e3 -> 5E+1 dddiv493 divide 1e5 10e2 -> 1E+2 dddiv494 divide 1e5 20e2 -> 5E+1 dddiv495 divide 1e5 100e1 -> 1E+2 dddiv496 divide 1e5 200e1 -> 5E+1 -- tryzeros cases rounding: half_up dddiv497 divide 0E+380 1000E-13 -> 0E+369 Clamped dddiv498 divide 0E-390 1000E+13 -> 0E-398 Clamped rounding: half_up -- focus on trailing zeros issues dddiv500 divide 1 9.9 -> 0.1010101010101010 Inexact Rounded dddiv501 divide 1 9.09 -> 0.1100110011001100 Inexact Rounded dddiv502 divide 1 9.009 -> 0.1110001110001110 Inexact Rounded dddiv511 divide 1 2 -> 0.5 dddiv512 divide 1.0 2 -> 0.5 dddiv513 divide 1.00 2 -> 0.50 dddiv514 divide 1.000 2 -> 0.500 dddiv515 divide 1.0000 2 -> 0.5000 dddiv516 divide 1.00000 2 -> 0.50000 dddiv517 divide 1.000000 2 -> 0.500000 dddiv518 divide 1.0000000 2 -> 0.5000000 dddiv519 divide 1.00 2.00 -> 0.5 dddiv521 divide 2 1 -> 2 dddiv522 divide 2 1.0 -> 2 dddiv523 divide 2 1.00 -> 2 dddiv524 divide 2 1.000 -> 2 dddiv525 divide 2 1.0000 -> 2 dddiv526 divide 2 1.00000 -> 2 dddiv527 divide 2 1.000000 -> 2 dddiv528 divide 2 1.0000000 -> 2 dddiv529 divide 2.00 1.00 -> 2 dddiv530 divide 2.40 2 -> 1.20 dddiv531 divide 2.40 4 -> 0.60 dddiv532 divide 2.40 10 -> 0.24 dddiv533 divide 2.40 2.0 -> 1.2 dddiv534 divide 2.40 4.0 -> 0.6 dddiv535 divide 2.40 10.0 -> 0.24 dddiv536 divide 2.40 2.00 -> 1.2 dddiv537 divide 2.40 4.00 -> 0.6 dddiv538 divide 2.40 10.00 -> 0.24 dddiv539 divide 0.9 0.1 -> 9 dddiv540 divide 0.9 0.01 -> 9E+1 dddiv541 divide 0.9 0.001 -> 9E+2 dddiv542 divide 5 2 -> 2.5 dddiv543 divide 5 2.0 -> 2.5 dddiv544 divide 5 2.00 -> 2.5 dddiv545 divide 5 20 -> 0.25 dddiv546 divide 5 20.0 -> 0.25 dddiv547 divide 2.400 2 -> 1.200 dddiv548 divide 2.400 2.0 -> 1.20 dddiv549 divide 2.400 2.400 -> 1 dddiv550 divide 240 1 -> 240 dddiv551 divide 240 10 -> 24 dddiv552 divide 240 100 -> 2.4 dddiv553 divide 240 1000 -> 0.24 dddiv554 divide 2400 1 -> 2400 dddiv555 divide 2400 10 -> 240 dddiv556 divide 2400 100 -> 24 dddiv557 divide 2400 1000 -> 2.4 -- +ve exponent dddiv600 divide 2.4E+9 2 -> 1.2E+9 dddiv601 divide 2.40E+9 2 -> 1.20E+9 dddiv602 divide 2.400E+9 2 -> 1.200E+9 dddiv603 divide 2.4000E+9 2 -> 1.2000E+9 dddiv604 divide 24E+8 2 -> 1.2E+9 dddiv605 divide 240E+7 2 -> 1.20E+9 dddiv606 divide 2400E+6 2 -> 1.200E+9 dddiv607 divide 24000E+5 2 -> 1.2000E+9 -- more zeros, etc. dddiv731 divide 5.00 1E-3 -> 5.00E+3 dddiv732 divide 00.00 0.000 -> NaN Division_undefined dddiv733 divide 00.00 0E-3 -> NaN Division_undefined dddiv734 divide 0 -0 -> NaN Division_undefined dddiv735 divide -0 0 -> NaN Division_undefined dddiv736 divide -0 -0 -> NaN Division_undefined dddiv741 divide 0 -1 -> -0 dddiv742 divide -0 -1 -> 0 dddiv743 divide 0 1 -> 0 dddiv744 divide -0 1 -> -0 dddiv745 divide -1 0 -> -Infinity Division_by_zero dddiv746 divide -1 -0 -> Infinity Division_by_zero dddiv747 divide 1 0 -> Infinity Division_by_zero dddiv748 divide 1 -0 -> -Infinity Division_by_zero dddiv751 divide 0.0 -1 -> -0.0 dddiv752 divide -0.0 -1 -> 0.0 dddiv753 divide 0.0 1 -> 0.0 dddiv754 divide -0.0 1 -> -0.0 dddiv755 divide -1.0 0 -> -Infinity Division_by_zero dddiv756 divide -1.0 -0 -> Infinity Division_by_zero dddiv757 divide 1.0 0 -> Infinity Division_by_zero dddiv758 divide 1.0 -0 -> -Infinity Division_by_zero dddiv761 divide 0 -1.0 -> -0E+1 dddiv762 divide -0 -1.0 -> 0E+1 dddiv763 divide 0 1.0 -> 0E+1 dddiv764 divide -0 1.0 -> -0E+1 dddiv765 divide -1 0.0 -> -Infinity Division_by_zero dddiv766 divide -1 -0.0 -> Infinity Division_by_zero dddiv767 divide 1 0.0 -> Infinity Division_by_zero dddiv768 divide 1 -0.0 -> -Infinity Division_by_zero dddiv771 divide 0.0 -1.0 -> -0 dddiv772 divide -0.0 -1.0 -> 0 dddiv773 divide 0.0 1.0 -> 0 dddiv774 divide -0.0 1.0 -> -0 dddiv775 divide -1.0 0.0 -> -Infinity Division_by_zero dddiv776 divide -1.0 -0.0 -> Infinity Division_by_zero dddiv777 divide 1.0 0.0 -> Infinity Division_by_zero dddiv778 divide 1.0 -0.0 -> -Infinity Division_by_zero -- Specials dddiv780 divide Inf -Inf -> NaN Invalid_operation dddiv781 divide Inf -1000 -> -Infinity dddiv782 divide Inf -1 -> -Infinity dddiv783 divide Inf -0 -> -Infinity dddiv784 divide Inf 0 -> Infinity dddiv785 divide Inf 1 -> Infinity dddiv786 divide Inf 1000 -> Infinity dddiv787 divide Inf Inf -> NaN Invalid_operation dddiv788 divide -1000 Inf -> -0E-398 Clamped dddiv789 divide -Inf Inf -> NaN Invalid_operation dddiv790 divide -1 Inf -> -0E-398 Clamped dddiv791 divide -0 Inf -> -0E-398 Clamped dddiv792 divide 0 Inf -> 0E-398 Clamped dddiv793 divide 1 Inf -> 0E-398 Clamped dddiv794 divide 1000 Inf -> 0E-398 Clamped dddiv795 divide Inf Inf -> NaN Invalid_operation dddiv800 divide -Inf -Inf -> NaN Invalid_operation dddiv801 divide -Inf -1000 -> Infinity dddiv802 divide -Inf -1 -> Infinity dddiv803 divide -Inf -0 -> Infinity dddiv804 divide -Inf 0 -> -Infinity dddiv805 divide -Inf 1 -> -Infinity dddiv806 divide -Inf 1000 -> -Infinity dddiv807 divide -Inf Inf -> NaN Invalid_operation dddiv808 divide -1000 Inf -> -0E-398 Clamped dddiv809 divide -Inf -Inf -> NaN Invalid_operation dddiv810 divide -1 -Inf -> 0E-398 Clamped dddiv811 divide -0 -Inf -> 0E-398 Clamped dddiv812 divide 0 -Inf -> -0E-398 Clamped dddiv813 divide 1 -Inf -> -0E-398 Clamped dddiv814 divide 1000 -Inf -> -0E-398 Clamped dddiv815 divide Inf -Inf -> NaN Invalid_operation dddiv821 divide NaN -Inf -> NaN dddiv822 divide NaN -1000 -> NaN dddiv823 divide NaN -1 -> NaN dddiv824 divide NaN -0 -> NaN dddiv825 divide NaN 0 -> NaN dddiv826 divide NaN 1 -> NaN dddiv827 divide NaN 1000 -> NaN dddiv828 divide NaN Inf -> NaN dddiv829 divide NaN NaN -> NaN dddiv830 divide -Inf NaN -> NaN dddiv831 divide -1000 NaN -> NaN dddiv832 divide -1 NaN -> NaN dddiv833 divide -0 NaN -> NaN dddiv834 divide 0 NaN -> NaN dddiv835 divide 1 NaN -> NaN dddiv836 divide 1000 NaN -> NaN dddiv837 divide Inf NaN -> NaN dddiv841 divide sNaN -Inf -> NaN Invalid_operation dddiv842 divide sNaN -1000 -> NaN Invalid_operation dddiv843 divide sNaN -1 -> NaN Invalid_operation dddiv844 divide sNaN -0 -> NaN Invalid_operation dddiv845 divide sNaN 0 -> NaN Invalid_operation dddiv846 divide sNaN 1 -> NaN Invalid_operation dddiv847 divide sNaN 1000 -> NaN Invalid_operation dddiv848 divide sNaN NaN -> NaN Invalid_operation dddiv849 divide sNaN sNaN -> NaN Invalid_operation dddiv850 divide NaN sNaN -> NaN Invalid_operation dddiv851 divide -Inf sNaN -> NaN Invalid_operation dddiv852 divide -1000 sNaN -> NaN Invalid_operation dddiv853 divide -1 sNaN -> NaN Invalid_operation dddiv854 divide -0 sNaN -> NaN Invalid_operation dddiv855 divide 0 sNaN -> NaN Invalid_operation dddiv856 divide 1 sNaN -> NaN Invalid_operation dddiv857 divide 1000 sNaN -> NaN Invalid_operation dddiv858 divide Inf sNaN -> NaN Invalid_operation dddiv859 divide NaN sNaN -> NaN Invalid_operation -- propagating NaNs dddiv861 divide NaN9 -Inf -> NaN9 dddiv862 divide NaN8 1000 -> NaN8 dddiv863 divide NaN7 Inf -> NaN7 dddiv864 divide NaN6 NaN5 -> NaN6 dddiv865 divide -Inf NaN4 -> NaN4 dddiv866 divide -1000 NaN3 -> NaN3 dddiv867 divide Inf NaN2 -> NaN2 dddiv871 divide sNaN99 -Inf -> NaN99 Invalid_operation dddiv872 divide sNaN98 -1 -> NaN98 Invalid_operation dddiv873 divide sNaN97 NaN -> NaN97 Invalid_operation dddiv874 divide sNaN96 sNaN94 -> NaN96 Invalid_operation dddiv875 divide NaN95 sNaN93 -> NaN93 Invalid_operation dddiv876 divide -Inf sNaN92 -> NaN92 Invalid_operation dddiv877 divide 0 sNaN91 -> NaN91 Invalid_operation dddiv878 divide Inf sNaN90 -> NaN90 Invalid_operation dddiv879 divide NaN sNaN89 -> NaN89 Invalid_operation dddiv881 divide -NaN9 -Inf -> -NaN9 dddiv882 divide -NaN8 1000 -> -NaN8 dddiv883 divide -NaN7 Inf -> -NaN7 dddiv884 divide -NaN6 -NaN5 -> -NaN6 dddiv885 divide -Inf -NaN4 -> -NaN4 dddiv886 divide -1000 -NaN3 -> -NaN3 dddiv887 divide Inf -NaN2 -> -NaN2 dddiv891 divide -sNaN99 -Inf -> -NaN99 Invalid_operation dddiv892 divide -sNaN98 -1 -> -NaN98 Invalid_operation dddiv893 divide -sNaN97 NaN -> -NaN97 Invalid_operation dddiv894 divide -sNaN96 -sNaN94 -> -NaN96 Invalid_operation dddiv895 divide -NaN95 -sNaN93 -> -NaN93 Invalid_operation dddiv896 divide -Inf -sNaN92 -> -NaN92 Invalid_operation dddiv897 divide 0 -sNaN91 -> -NaN91 Invalid_operation dddiv898 divide Inf -sNaN90 -> -NaN90 Invalid_operation dddiv899 divide -NaN -sNaN89 -> -NaN89 Invalid_operation -- Various flavours of divide by 0 dddiv901 divide 0 0 -> NaN Division_undefined dddiv902 divide 0.0E5 0 -> NaN Division_undefined dddiv903 divide 0.000 0 -> NaN Division_undefined dddiv904 divide 0.0001 0 -> Infinity Division_by_zero dddiv905 divide 0.01 0 -> Infinity Division_by_zero dddiv906 divide 0.1 0 -> Infinity Division_by_zero dddiv907 divide 1 0 -> Infinity Division_by_zero dddiv908 divide 1 0.0 -> Infinity Division_by_zero dddiv909 divide 10 0.0 -> Infinity Division_by_zero dddiv910 divide 1E+100 0.0 -> Infinity Division_by_zero dddiv911 divide 1E+100 0 -> Infinity Division_by_zero dddiv921 divide -0.0001 0 -> -Infinity Division_by_zero dddiv922 divide -0.01 0 -> -Infinity Division_by_zero dddiv923 divide -0.1 0 -> -Infinity Division_by_zero dddiv924 divide -1 0 -> -Infinity Division_by_zero dddiv925 divide -1 0.0 -> -Infinity Division_by_zero dddiv926 divide -10 0.0 -> -Infinity Division_by_zero dddiv927 divide -1E+100 0.0 -> -Infinity Division_by_zero dddiv928 divide -1E+100 0 -> -Infinity Division_by_zero dddiv931 divide 0.0001 -0 -> -Infinity Division_by_zero dddiv932 divide 0.01 -0 -> -Infinity Division_by_zero dddiv933 divide 0.1 -0 -> -Infinity Division_by_zero dddiv934 divide 1 -0 -> -Infinity Division_by_zero dddiv935 divide 1 -0.0 -> -Infinity Division_by_zero dddiv936 divide 10 -0.0 -> -Infinity Division_by_zero dddiv937 divide 1E+100 -0.0 -> -Infinity Division_by_zero dddiv938 divide 1E+100 -0 -> -Infinity Division_by_zero dddiv941 divide -0.0001 -0 -> Infinity Division_by_zero dddiv942 divide -0.01 -0 -> Infinity Division_by_zero dddiv943 divide -0.1 -0 -> Infinity Division_by_zero dddiv944 divide -1 -0 -> Infinity Division_by_zero dddiv945 divide -1 -0.0 -> Infinity Division_by_zero dddiv946 divide -10 -0.0 -> Infinity Division_by_zero dddiv947 divide -1E+100 -0.0 -> Infinity Division_by_zero dddiv948 divide -1E+100 -0 -> Infinity Division_by_zero -- Examples from SQL proposal (Krishna Kulkarni) dddiv1021 divide 1E0 1E0 -> 1 dddiv1022 divide 1E0 2E0 -> 0.5 dddiv1023 divide 1E0 3E0 -> 0.3333333333333333 Inexact Rounded dddiv1024 divide 100E-2 1000E-3 -> 1 dddiv1025 divide 24E-1 2E0 -> 1.2 dddiv1026 divide 2400E-3 2E0 -> 1.200 dddiv1027 divide 5E0 2E0 -> 2.5 dddiv1028 divide 5E0 20E-1 -> 2.5 dddiv1029 divide 5E0 2000E-3 -> 2.5 dddiv1030 divide 5E0 2E-1 -> 25 dddiv1031 divide 5E0 20E-2 -> 25 dddiv1032 divide 480E-2 3E0 -> 1.60 dddiv1033 divide 47E-1 2E0 -> 2.35 -- ECMAScript bad examples rounding: half_down dddiv1040 divide 5 9 -> 0.5555555555555556 Inexact Rounded rounding: half_even dddiv1041 divide 6 11 -> 0.5454545454545455 Inexact Rounded -- overflow and underflow tests .. note subnormal results -- signs dddiv1051 divide 1e+277 1e-311 -> Infinity Overflow Inexact Rounded dddiv1052 divide 1e+277 -1e-311 -> -Infinity Overflow Inexact Rounded dddiv1053 divide -1e+277 1e-311 -> -Infinity Overflow Inexact Rounded dddiv1054 divide -1e+277 -1e-311 -> Infinity Overflow Inexact Rounded dddiv1055 divide 1e-277 1e+311 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1056 divide 1e-277 -1e+311 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1057 divide -1e-277 1e+311 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1058 divide -1e-277 -1e+311 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped -- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) dddiv1060 divide 1e-291 1e+101 -> 1E-392 Subnormal dddiv1061 divide 1e-291 1e+102 -> 1E-393 Subnormal dddiv1062 divide 1e-291 1e+103 -> 1E-394 Subnormal dddiv1063 divide 1e-291 1e+104 -> 1E-395 Subnormal dddiv1064 divide 1e-291 1e+105 -> 1E-396 Subnormal dddiv1065 divide 1e-291 1e+106 -> 1E-397 Subnormal dddiv1066 divide 1e-291 1e+107 -> 1E-398 Subnormal dddiv1067 divide 1e-291 1e+108 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1068 divide 1e-291 1e+109 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1069 divide 1e-291 1e+110 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped -- [no equivalent of 'subnormal' for overflow] dddiv1070 divide 1e+60 1e-321 -> 1.000000000000E+381 Clamped dddiv1071 divide 1e+60 1e-322 -> 1.0000000000000E+382 Clamped dddiv1072 divide 1e+60 1e-323 -> 1.00000000000000E+383 Clamped dddiv1073 divide 1e+60 1e-324 -> 1.000000000000000E+384 Clamped dddiv1074 divide 1e+60 1e-325 -> Infinity Overflow Inexact Rounded dddiv1075 divide 1e+60 1e-326 -> Infinity Overflow Inexact Rounded dddiv1076 divide 1e+60 1e-327 -> Infinity Overflow Inexact Rounded dddiv1077 divide 1e+60 1e-328 -> Infinity Overflow Inexact Rounded dddiv1078 divide 1e+60 1e-329 -> Infinity Overflow Inexact Rounded dddiv1079 divide 1e+60 1e-330 -> Infinity Overflow Inexact Rounded dddiv1101 divide 1.0000E-394 1 -> 1.0000E-394 Subnormal dddiv1102 divide 1.000E-394 1e+1 -> 1.000E-395 Subnormal dddiv1103 divide 1.00E-394 1e+2 -> 1.00E-396 Subnormal dddiv1104 divide 1.0E-394 1e+3 -> 1.0E-397 Subnormal dddiv1105 divide 1.0E-394 1e+4 -> 1E-398 Subnormal Rounded dddiv1106 divide 1.3E-394 1e+4 -> 1E-398 Underflow Subnormal Inexact Rounded dddiv1107 divide 1.5E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1108 divide 1.7E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1109 divide 2.3E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1110 divide 2.5E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1111 divide 2.7E-394 1e+4 -> 3E-398 Underflow Subnormal Inexact Rounded dddiv1112 divide 1.49E-394 1e+4 -> 1E-398 Underflow Subnormal Inexact Rounded dddiv1113 divide 1.50E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1114 divide 1.51E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1115 divide 2.49E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1116 divide 2.50E-394 1e+4 -> 2E-398 Underflow Subnormal Inexact Rounded dddiv1117 divide 2.51E-394 1e+4 -> 3E-398 Underflow Subnormal Inexact Rounded dddiv1118 divide 1E-394 1e+4 -> 1E-398 Subnormal dddiv1119 divide 3E-394 1e+5 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1120 divide 5E-394 1e+5 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1121 divide 7E-394 1e+5 -> 1E-398 Underflow Subnormal Inexact Rounded dddiv1122 divide 9E-394 1e+5 -> 1E-398 Underflow Subnormal Inexact Rounded dddiv1123 divide 9.9E-394 1e+5 -> 1E-398 Underflow Subnormal Inexact Rounded dddiv1124 divide 1E-394 -1e+4 -> -1E-398 Subnormal dddiv1125 divide 3E-394 -1e+5 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1126 divide -5E-394 1e+5 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1127 divide 7E-394 -1e+5 -> -1E-398 Underflow Subnormal Inexact Rounded dddiv1128 divide -9E-394 1e+5 -> -1E-398 Underflow Subnormal Inexact Rounded dddiv1129 divide 9.9E-394 -1e+5 -> -1E-398 Underflow Subnormal Inexact Rounded dddiv1130 divide 3.0E-394 -1e+5 -> -0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1131 divide 1.0E-199 1e+200 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped dddiv1132 divide 1.0E-199 1e+199 -> 1E-398 Subnormal Rounded dddiv1133 divide 1.0E-199 1e+198 -> 1.0E-397 Subnormal dddiv1134 divide 2.0E-199 2e+198 -> 1.0E-397 Subnormal dddiv1135 divide 4.0E-199 4e+198 -> 1.0E-397 Subnormal dddiv1136 divide 10.0E-199 10e+198 -> 1.0E-397 Subnormal dddiv1137 divide 30.0E-199 30e+198 -> 1.0E-397 Subnormal -- randoms dddiv2010 divide -3.303226714900711E-35 8.796578842713183E+73 -> -3.755126594058783E-109 Inexact Rounded dddiv2011 divide 933153327821073.6 68782181090246.25 -> 13.56678885475763 Inexact Rounded dddiv2012 divide 5.04752436057906E-72 -8.179481771238642E+64 -> -6.170958627632835E-137 Inexact Rounded dddiv2013 divide -3707613309582318 3394911196503.048 -> -1092.109070010836 Inexact Rounded dddiv2014 divide 99689.0555190461 -4.735208553891464 -> -21052.72753765411 Inexact Rounded dddiv2015 divide -1447915775613329 269750797.8184875 -> -5367605.164925653 Inexact Rounded dddiv2016 divide -9.394881304225258E-19 -830585.0252671636 -> 1.131116143251358E-24 Inexact Rounded dddiv2017 divide -1.056283432738934 88.58754555124013 -> -0.01192361100159352 Inexact Rounded dddiv2018 divide 5763220933343.081 689089567025052.1 -> 0.008363529516524456 Inexact Rounded dddiv2019 divide 873819.122103216 9.740612494523300E-49 -> 8.970884763093948E+53 Inexact Rounded dddiv2020 divide 8022914.838533576 6178.566801742713 -> 1298.507420243583 Inexact Rounded dddiv2021 divide 203982.7605650363 -2158.283639053435 -> -94.51156320422168 Inexact Rounded dddiv2022 divide 803.6310547013030 7101143795399.238 -> 1.131692411611166E-10 Inexact Rounded dddiv2023 divide 9.251697842123399E-82 -1.342350220606119E-7 -> -6.892163982321936E-75 Inexact Rounded dddiv2024 divide -1.980600645637992E-53 -5.474262753214457E+77 -> 3.618022617703168E-131 Inexact Rounded dddiv2025 divide -210.0322996351690 -8.580951835872843E+80 -> 2.447657365434971E-79 Inexact Rounded dddiv2026 divide -1.821980314020370E+85 -3.018915267138165 -> 6.035215144503042E+84 Inexact Rounded dddiv2027 divide -772264503601.1047 5.158258271408988E-86 -> -1.497141986630614E+97 Inexact Rounded dddiv2028 divide -767.0532415847106 2.700027228028939E-59 -> -2.840909282772941E+61 Inexact Rounded dddiv2029 divide 496724.8548250093 7.32700588163100E+66 -> 6.779370220929013E-62 Inexact Rounded dddiv2030 divide -304232651447703.9 -108.9730808657440 -> 2791814721862.565 Inexact Rounded dddiv2031 divide -7.233817192699405E+42 -5711302004.149411 -> 1.266579352211430E+33 Inexact Rounded dddiv2032 divide -9.999221444912745E+96 4010569406446197 -> -2.493217404202250E+81 Inexact Rounded dddiv2033 divide -1837272.061937622 8.356322838066762 -> -219866.0939196882 Inexact Rounded dddiv2034 divide 2168.517555606529 209.1910258615061 -> 10.36620737756784 Inexact Rounded dddiv2035 divide -1.884389790576371E+88 2.95181953870583E+20 -> -6.383824505079828E+67 Inexact Rounded dddiv2036 divide 732263.6037438196 961222.3634446889 -> 0.7618045850698269 Inexact Rounded dddiv2037 divide -813461419.0348336 5.376293753809143E+84 -> -1.513052404285927E-76 Inexact Rounded dddiv2038 divide -45562133508108.50 -9.776843494690107E+51 -> 4.660208945029519E-39 Inexact Rounded dddiv2039 divide -6.489393172441016E+80 -9101965.097852113 -> 7.129661674897421E+73 Inexact Rounded dddiv2040 divide 3.694576237117349E+93 6683512.012622003 -> 5.527896456443912E+86 Inexact Rounded dddiv2041 divide -2.252877726403272E+19 -7451913256.181367 -> 3023220546.125531 Inexact Rounded dddiv2042 divide 518303.1989111842 50.01587020474133 -> 10362.77479107123 Inexact Rounded dddiv2043 divide 2.902087881880103E+24 33.32400992305702 -> 8.708699488989578E+22 Inexact Rounded dddiv2044 divide 549619.4559510557 1660824845196338 -> 3.309316196351104E-10 Inexact Rounded dddiv2045 divide -6775670774684043 8292152023.077262 -> -817118.4941891062 Inexact Rounded dddiv2046 divide -77.50923921524079 -5.636882655425815E+74 -> 1.375037302588405E-73 Inexact Rounded dddiv2047 divide -2.984889459605149E-10 -88106156784122.99 -> 3.387833005721384E-24 Inexact Rounded dddiv2048 divide 0.949517293997085 44767115.96450998 -> 2.121015110175589E-8 Inexact Rounded dddiv2049 divide -2760937211.084521 -1087015876975408 -> 0.000002539923537057024 Inexact Rounded dddiv2050 divide 28438351.85030536 -4.209397904088624E-47 -> -6.755919135770688E+53 Inexact Rounded dddiv2051 divide -85562731.6820956 -7.166045442530185E+45 -> 1.194002080621542E-38 Inexact Rounded dddiv2052 divide 2533802852165.25 7154.119606235955 -> 354173957.3317501 Inexact Rounded dddiv2053 divide -8858831346851.474 97.59734208801716 -> -90769186509.83577 Inexact Rounded dddiv2054 divide 176783629801387.5 840073263.3109817 -> 210438.3480848206 Inexact Rounded dddiv2055 divide -493506471796175.6 79733894790822.03 -> -6.189418854940746 Inexact Rounded dddiv2056 divide 790.1682542103445 829.9449370367435 -> 0.9520731062371214 Inexact Rounded dddiv2057 divide -8920459838.583164 -4767.889187899214 -> 1870945.294035581 Inexact Rounded dddiv2058 divide 53536687164422.1 53137.5007032689 -> 1007512330.385698 Inexact Rounded dddiv2059 divide 4.051532311146561E-74 -2.343089768972261E+94 -> -1.729140882606332E-168 Inexact Rounded dddiv2060 divide -14847758778636.88 3.062543516383807E-43 -> -4.848178874587497E+55 Inexact Rounded -- Division probably has pre-rounding, so need to test rounding -- explicitly rather than assume included through other tests; -- tests include simple rounding and also the tricky cases of sticky -- bits following two zeros -- -- 1/99999 gives 0.0000100001000010000100001000010000100001 -- 1234567890123456 -- -- 1/999999 gives 0.000001000001000001000001000001000001000001 -- 1234567890123456 rounding: ceiling dddiv3001 divide 1 3 -> 0.3333333333333334 Inexact Rounded dddiv3002 divide 2 3 -> 0.6666666666666667 Inexact Rounded dddiv3003 divide 1 99999 -> 0.00001000010000100002 Inexact Rounded dddiv3004 divide 1 999999 -> 0.000001000001000001001 Inexact Rounded rounding: floor dddiv3011 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv3012 divide 2 3 -> 0.6666666666666666 Inexact Rounded dddiv3013 divide 1 99999 -> 0.00001000010000100001 Inexact Rounded dddiv3014 divide 1 999999 -> 0.000001000001000001000 Inexact Rounded rounding: up dddiv3021 divide 1 3 -> 0.3333333333333334 Inexact Rounded dddiv3022 divide 2 3 -> 0.6666666666666667 Inexact Rounded dddiv3023 divide 1 99999 -> 0.00001000010000100002 Inexact Rounded dddiv3024 divide 1 999999 -> 0.000001000001000001001 Inexact Rounded rounding: down dddiv3031 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv3032 divide 2 3 -> 0.6666666666666666 Inexact Rounded dddiv3033 divide 1 99999 -> 0.00001000010000100001 Inexact Rounded dddiv3034 divide 1 999999 -> 0.000001000001000001000 Inexact Rounded rounding: half_up dddiv3041 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv3042 divide 2 3 -> 0.6666666666666667 Inexact Rounded dddiv3043 divide 1 99999 -> 0.00001000010000100001 Inexact Rounded dddiv3044 divide 1 999999 -> 0.000001000001000001000 Inexact Rounded rounding: half_down dddiv3051 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv3052 divide 2 3 -> 0.6666666666666667 Inexact Rounded dddiv3053 divide 1 99999 -> 0.00001000010000100001 Inexact Rounded dddiv3054 divide 1 999999 -> 0.000001000001000001000 Inexact Rounded rounding: half_even dddiv3061 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv3062 divide 2 3 -> 0.6666666666666667 Inexact Rounded dddiv3063 divide 1 99999 -> 0.00001000010000100001 Inexact Rounded dddiv3064 divide 1 999999 -> 0.000001000001000001000 Inexact Rounded rounding: 05up dddiv3071 divide 1 3 -> 0.3333333333333333 Inexact Rounded dddiv3072 divide 2 3 -> 0.6666666666666666 Inexact Rounded dddiv3073 divide 1 99999 -> 0.00001000010000100001 Inexact Rounded dddiv3074 divide 1 999999 -> 0.000001000001000001001 Inexact Rounded -- random divide tests with result near 1 rounding: half_even dddiv4001 divide 3195385192916917 3195385192946695 -> 0.9999999999906809 Inexact Rounded dddiv4002 divide 1393723067526993 1393723067519475 -> 1.000000000005394 Inexact Rounded dddiv4003 divide 759985543702302 759985543674015 -> 1.000000000037220 Inexact Rounded dddiv4004 divide 9579158456027302 9579158456036864 -> 0.9999999999990018 Inexact Rounded dddiv4005 divide 7079398299143569 7079398299156904 -> 0.9999999999981164 Inexact Rounded dddiv4006 divide 6636169255366598 6636169255336386 -> 1.000000000004553 Inexact Rounded dddiv4007 divide 6964813971340090 6964813971321554 -> 1.000000000002661 Inexact Rounded dddiv4008 divide 4182275225480784 4182275225454009 -> 1.000000000006402 Inexact Rounded dddiv4009 divide 9228325124938029 9228325124918730 -> 1.000000000002091 Inexact Rounded dddiv4010 divide 3428346338630192 3428346338609843 -> 1.000000000005936 Inexact Rounded dddiv4011 divide 2143511550722893 2143511550751754 -> 0.9999999999865356 Inexact Rounded dddiv4012 divide 1672732924396785 1672732924401811 -> 0.9999999999969953 Inexact Rounded dddiv4013 divide 4190714611948216 4190714611948664 -> 0.9999999999998931 Inexact Rounded dddiv4014 divide 3942254800848877 3942254800814556 -> 1.000000000008706 Inexact Rounded dddiv4015 divide 2854459826952334 2854459826960762 -> 0.9999999999970474 Inexact Rounded dddiv4016 divide 2853258953664731 2853258953684471 -> 0.9999999999930816 Inexact Rounded dddiv4017 divide 9453512638125978 9453512638146425 -> 0.9999999999978371 Inexact Rounded dddiv4018 divide 339476633940369 339476633912887 -> 1.000000000080954 Inexact Rounded dddiv4019 divide 4542181492688467 4542181492697735 -> 0.9999999999979596 Inexact Rounded dddiv4020 divide 7312600192399197 7312600192395424 -> 1.000000000000516 Inexact Rounded dddiv4021 divide 1811674985570111 1811674985603935 -> 0.9999999999813300 Inexact Rounded dddiv4022 divide 1706462639003481 1706462639017740 -> 0.9999999999916441 Inexact Rounded dddiv4023 divide 6697052654940368 6697052654934110 -> 1.000000000000934 Inexact Rounded dddiv4024 divide 5015283664277539 5015283664310719 -> 0.9999999999933842 Inexact Rounded dddiv4025 divide 2359501561537464 2359501561502464 -> 1.000000000014834 Inexact Rounded dddiv4026 divide 2669850227909157 2669850227901548 -> 1.000000000002850 Inexact Rounded dddiv4027 divide 9329725546974648 9329725547002445 -> 0.9999999999970206 Inexact Rounded dddiv4028 divide 3228562867071248 3228562867106206 -> 0.9999999999891723 Inexact Rounded dddiv4029 divide 4862226644921175 4862226644909380 -> 1.000000000002426 Inexact Rounded dddiv4030 divide 1022267997054529 1022267997071329 -> 0.9999999999835660 Inexact Rounded dddiv4031 divide 1048777482023719 1048777482000948 -> 1.000000000021712 Inexact Rounded dddiv4032 divide 9980113777337098 9980113777330539 -> 1.000000000000657 Inexact Rounded dddiv4033 divide 7506839167963908 7506839167942901 -> 1.000000000002798 Inexact Rounded dddiv4034 divide 231119751977860 231119751962453 -> 1.000000000066662 Inexact Rounded dddiv4035 divide 4034903664762962 4034903664795526 -> 0.9999999999919294 Inexact Rounded dddiv4036 divide 5700122152274696 5700122152251386 -> 1.000000000004089 Inexact Rounded dddiv4037 divide 6869599590293110 6869599590293495 -> 0.9999999999999440 Inexact Rounded dddiv4038 divide 5576281960092797 5576281960105579 -> 0.9999999999977078 Inexact Rounded dddiv4039 divide 2304844888381318 2304844888353073 -> 1.000000000012255 Inexact Rounded dddiv4040 divide 3265933651656452 3265933651682779 -> 0.9999999999919389 Inexact Rounded dddiv4041 divide 5235714985079914 5235714985066131 -> 1.000000000002632 Inexact Rounded dddiv4042 divide 5578481572827551 5578481572822945 -> 1.000000000000826 Inexact Rounded dddiv4043 divide 4909616081396134 4909616081373076 -> 1.000000000004696 Inexact Rounded dddiv4044 divide 636447224349537 636447224338757 -> 1.000000000016938 Inexact Rounded dddiv4045 divide 1539373428396640 1539373428364727 -> 1.000000000020731 Inexact Rounded dddiv4046 divide 2028786707377893 2028786707378866 -> 0.9999999999995204 Inexact Rounded dddiv4047 divide 137643260486222 137643260487419 -> 0.9999999999913036 Inexact Rounded dddiv4048 divide 247451519746765 247451519752267 -> 0.9999999999777653 Inexact Rounded dddiv4049 divide 7877858475022054 7877858474999794 -> 1.000000000002826 Inexact Rounded dddiv4050 divide 7333242694766258 7333242694744628 -> 1.000000000002950 Inexact Rounded dddiv4051 divide 124051503698592 124051503699397 -> 0.9999999999935108 Inexact Rounded dddiv4052 divide 8944737432385188 8944737432406860 -> 0.9999999999975771 Inexact Rounded dddiv4053 divide 9883948923406874 9883948923424843 -> 0.9999999999981820 Inexact Rounded dddiv4054 divide 6829178741654284 6829178741671973 -> 0.9999999999974098 Inexact Rounded dddiv4055 divide 7342752479768122 7342752479793385 -> 0.9999999999965595 Inexact Rounded dddiv4056 divide 8066426579008783 8066426578977563 -> 1.000000000003870 Inexact Rounded dddiv4057 divide 8992775071383295 8992775071352712 -> 1.000000000003401 Inexact Rounded dddiv4058 divide 5485011755545641 5485011755543611 -> 1.000000000000370 Inexact Rounded dddiv4059 divide 5779983054353918 5779983054365300 -> 0.9999999999980308 Inexact Rounded dddiv4060 divide 9502265102713774 9502265102735208 -> 0.9999999999977443 Inexact Rounded dddiv4061 divide 2109558399130981 2109558399116281 -> 1.000000000006968 Inexact Rounded dddiv4062 divide 5296182636350471 5296182636351521 -> 0.9999999999998017 Inexact Rounded dddiv4063 divide 1440019225591883 1440019225601844 -> 0.9999999999930827 Inexact Rounded dddiv4064 divide 8182110791881341 8182110791847174 -> 1.000000000004176 Inexact Rounded dddiv4065 divide 489098235512060 489098235534516 -> 0.9999999999540869 Inexact Rounded dddiv4066 divide 6475687084782038 6475687084756089 -> 1.000000000004007 Inexact Rounded dddiv4067 divide 8094348555736948 8094348555759236 -> 0.9999999999972465 Inexact Rounded dddiv4068 divide 1982766816291543 1982766816309463 -> 0.9999999999909621 Inexact Rounded dddiv4069 divide 9277314300113251 9277314300084467 -> 1.000000000003103 Inexact Rounded dddiv4070 divide 4335532959318934 4335532959293167 -> 1.000000000005943 Inexact Rounded dddiv4071 divide 7767113032981348 7767113032968132 -> 1.000000000001702 Inexact Rounded dddiv4072 divide 1578548053342868 1578548053370448 -> 0.9999999999825282 Inexact Rounded dddiv4073 divide 3790420686666898 3790420686636315 -> 1.000000000008068 Inexact Rounded dddiv4074 divide 871682421955147 871682421976441 -> 0.9999999999755714 Inexact Rounded dddiv4075 divide 744141054479940 744141054512329 -> 0.9999999999564746 Inexact Rounded dddiv4076 divide 8956824183670735 8956824183641741 -> 1.000000000003237 Inexact Rounded dddiv4077 divide 8337291694485682 8337291694451193 -> 1.000000000004137 Inexact Rounded dddiv4078 divide 4107775944683669 4107775944657097 -> 1.000000000006469 Inexact Rounded dddiv4079 divide 8691900057964648 8691900057997555 -> 0.9999999999962141 Inexact Rounded dddiv4080 divide 2229528520536462 2229528520502337 -> 1.000000000015306 Inexact Rounded dddiv4081 divide 398442083774322 398442083746273 -> 1.000000000070397 Inexact Rounded dddiv4082 divide 5319819776808759 5319819776838313 -> 0.9999999999944445 Inexact Rounded dddiv4083 divide 7710491299066855 7710491299041858 -> 1.000000000003242 Inexact Rounded dddiv4084 divide 9083231296087266 9083231296058160 -> 1.000000000003204 Inexact Rounded dddiv4085 divide 3566873574904559 3566873574890328 -> 1.000000000003990 Inexact Rounded dddiv4086 divide 596343290550525 596343290555614 -> 0.9999999999914663 Inexact Rounded dddiv4087 divide 278227925093192 278227925068104 -> 1.000000000090171 Inexact Rounded dddiv4088 divide 3292902958490649 3292902958519881 -> 0.9999999999911227 Inexact Rounded dddiv4089 divide 5521871364245881 5521871364229536 -> 1.000000000002960 Inexact Rounded dddiv4090 divide 2406505602883617 2406505602857997 -> 1.000000000010646 Inexact Rounded dddiv4091 divide 7741146984869208 7741146984867255 -> 1.000000000000252 Inexact Rounded dddiv4092 divide 4576041832414909 4576041832405102 -> 1.000000000002143 Inexact Rounded dddiv4093 divide 9183756982878057 9183756982901934 -> 0.9999999999974001 Inexact Rounded dddiv4094 divide 6215736513855159 6215736513870342 -> 0.9999999999975573 Inexact Rounded dddiv4095 divide 248554968534533 248554968551417 -> 0.9999999999320714 Inexact Rounded dddiv4096 divide 376314165668645 376314165659755 -> 1.000000000023624 Inexact Rounded dddiv4097 divide 5513569249809718 5513569249808906 -> 1.000000000000147 Inexact Rounded dddiv4098 divide 3367992242167904 3367992242156228 -> 1.000000000003467 Inexact Rounded dddiv4099 divide 6134869538966967 6134869538985986 -> 0.9999999999968999 Inexact Rounded -- Null tests dddiv9998 divide 10 # -> NaN Invalid_operation dddiv9999 divide # 10 -> NaN Invalid_operation
{ "pile_set_name": "Github" }
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("apl", function() { var builtInOps = { ".": "innerProduct", "\\": "scan", "/": "reduce", "⌿": "reduce1Axis", "⍀": "scan1Axis", "¨": "each", "⍣": "power" }; var builtInFuncs = { "+": ["conjugate", "add"], "−": ["negate", "subtract"], "×": ["signOf", "multiply"], "÷": ["reciprocal", "divide"], "⌈": ["ceiling", "greaterOf"], "⌊": ["floor", "lesserOf"], "∣": ["absolute", "residue"], "⍳": ["indexGenerate", "indexOf"], "?": ["roll", "deal"], "⋆": ["exponentiate", "toThePowerOf"], "⍟": ["naturalLog", "logToTheBase"], "○": ["piTimes", "circularFuncs"], "!": ["factorial", "binomial"], "⌹": ["matrixInverse", "matrixDivide"], "<": [null, "lessThan"], "≤": [null, "lessThanOrEqual"], "=": [null, "equals"], ">": [null, "greaterThan"], "≥": [null, "greaterThanOrEqual"], "≠": [null, "notEqual"], "≡": ["depth", "match"], "≢": [null, "notMatch"], "∈": ["enlist", "membership"], "⍷": [null, "find"], "∪": ["unique", "union"], "∩": [null, "intersection"], "∼": ["not", "without"], "∨": [null, "or"], "∧": [null, "and"], "⍱": [null, "nor"], "⍲": [null, "nand"], "⍴": ["shapeOf", "reshape"], ",": ["ravel", "catenate"], "⍪": [null, "firstAxisCatenate"], "⌽": ["reverse", "rotate"], "⊖": ["axis1Reverse", "axis1Rotate"], "⍉": ["transpose", null], "↑": ["first", "take"], "↓": [null, "drop"], "⊂": ["enclose", "partitionWithAxis"], "⊃": ["diclose", "pick"], "⌷": [null, "index"], "⍋": ["gradeUp", null], "⍒": ["gradeDown", null], "⊤": ["encode", null], "⊥": ["decode", null], "⍕": ["format", "formatByExample"], "⍎": ["execute", null], "⊣": ["stop", "left"], "⊢": ["pass", "right"] }; var isOperator = /[\.\/⌿⍀¨⍣]/; var isNiladic = /⍬/; var isFunction = /[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/; var isArrow = /←/; var isComment = /[⍝#].*$/; var stringEater = function(type) { var prev; prev = false; return function(c) { prev = c; if (c === type) { return prev === "\\"; } return true; }; }; return { startState: function() { return { prev: false, func: false, op: false, string: false, escape: false }; }, token: function(stream, state) { var ch, funcName, word; if (stream.eatSpace()) { return null; } ch = stream.next(); if (ch === '"' || ch === "'") { stream.eatWhile(stringEater(ch)); stream.next(); state.prev = true; return "string"; } if (/[\[{\(]/.test(ch)) { state.prev = false; return null; } if (/[\]}\)]/.test(ch)) { state.prev = true; return null; } if (isNiladic.test(ch)) { state.prev = false; return "niladic"; } if (/[¯\d]/.test(ch)) { if (state.func) { state.func = false; state.prev = false; } else { state.prev = true; } stream.eatWhile(/[\w\.]/); return "number"; } if (isOperator.test(ch)) { return "operator apl-" + builtInOps[ch]; } if (isArrow.test(ch)) { return "apl-arrow"; } if (isFunction.test(ch)) { funcName = "apl-"; if (builtInFuncs[ch] != null) { if (state.prev) { funcName += builtInFuncs[ch][1]; } else { funcName += builtInFuncs[ch][0]; } } state.func = true; state.prev = false; return "function " + funcName; } if (isComment.test(ch)) { stream.skipToEnd(); return "comment"; } if (ch === "∘" && stream.peek() === ".") { stream.next(); return "function jot-dot"; } stream.eatWhile(/[\w\$_]/); word = stream.current(); state.prev = true; return "keyword"; } }; }); CodeMirror.defineMIME("text/apl", "apl"); });
{ "pile_set_name": "Github" }
/// Copyright (c) 2012 Ecma International. All rights reserved. /** * @path ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-47.js * @description Object.defineProperty - 'name' property doesn't exist in 'O', [[Value]] of 'name' property is set as undefined if it is absent in data descriptor 'desc' (8.12.9 step 4.a.i) */ function testcase() { var obj = {}; Object.defineProperty(obj, "property", { writable: true, enumerable: true, configurable: false }); return dataPropertyAttributesAreCorrect(obj, "property", undefined, true, true, false); } runTestCase(testcase);
{ "pile_set_name": "Github" }
/***************************************************************************** ** $Source: /cygdrive/d/Private/_SVNROOT/bluemsx/blueMSX/Src/IoDevice/I8251.h,v $ ** ** $Revision: 1.7 $ ** ** $Date: 2008-03-31 19:42:19 $ ** ** More info: http://www.bluemsx.com ** ** Copyright (C) 2003-2006 Daniel Vik, Tomas Karlsson ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ****************************************************************************** */ #ifndef I8251_H #define I8251_H #include "MsxTypes.h" typedef int (*I8251Transmit) (void*, UInt8); typedef int (*I8251Signal) (void*); typedef void (*I8251Set) (void*, int); typedef int (*I8251Get) (void*); typedef enum { I8251_STOP_INV = 0, I8251_STOP_1 = 2, I8251_STOP_15 = 3, I8251_STOP_2 = 4 } I8251StopBits; typedef enum { I8251_PARITY_NONE, I8251_PARITY_EVEN, I8251_PARITY_ODD } I8251Parity; typedef struct I8251 I8251; UInt8 i8251Peek(I8251* usart, UInt16 port); UInt8 i8251Read(I8251* usart, UInt16 port); void i8251Write(I8251* usart, UInt16 port, UInt8 value); void i8251RxData(I8251* usart, UInt8 value); void i8251LoadState(I8251* usart); void i8251SaveState(I8251* usart); void i8251Reset(I8251* usart); void i8251Destroy(I8251* usart); I8251* i8251Create(I8251Transmit transmit, I8251Signal signal, I8251Set setDataBits, I8251Set setStopBits, I8251Set setParity, I8251Set setRxReady, I8251Set setDtr, I8251Set setRts, I8251Get getDtr, I8251Get getRts, void* ref); #endif
{ "pile_set_name": "Github" }
package codec import ( "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/codec/types" ) type ( // Marshaler defines the interface module codecs must implement in order to support // backwards compatibility with Amino while allowing custom Protobuf-based // serialization. Note, Amino can still be used without any dependency on // Protobuf. There are two typical implementations that fulfill this contract: // // 1. AminoCodec: Provides full Amino serialization compatibility. // 2. ProtoCodec: Provides full Protobuf serialization compatibility. Marshaler interface { BinaryMarshaler JSONMarshaler } BinaryMarshaler interface { MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) MustMarshalBinaryBare(o ProtoMarshaler) []byte MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) types.AnyUnpacker } JSONMarshaler interface { MarshalJSON(o proto.Message) ([]byte, error) MustMarshalJSON(o proto.Message) []byte UnmarshalJSON(bz []byte, ptr proto.Message) error MustUnmarshalJSON(bz []byte, ptr proto.Message) } // ProtoMarshaler defines an interface a type must implement as protocol buffer // defined message. ProtoMarshaler interface { proto.Message // for JSON serialization Marshal() ([]byte, error) MarshalTo(data []byte) (n int, err error) MarshalToSizedBuffer(dAtA []byte) (int, error) Size() int Unmarshal(data []byte) error } // AminoMarshaler defines an interface where Amino marshalling can be // overridden by custom marshalling. AminoMarshaler interface { MarshalAmino() ([]byte, error) UnmarshalAmino([]byte) error MarshalAminoJSON() ([]byte, error) UnmarshalAminoJSON([]byte) error } )
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. /** * String.prototype.split() returns an Array object with: * i) length equaled to 1, * ii) [[Get]](0) equaled to the result of converting this object to a string * * @path ch15/15.5/15.5.4/15.5.4.14/S15.5.4.14_A3_T5.js * @description Instance is Number(-1234567890) */ var __instance = new Number(-1234567890); __instance.split = String.prototype.split; var __split = __instance.split(); ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__split.constructor !== Array) { $ERROR('#1: var __instance = new Number(-1234567890); __instance.split = String.prototype.split; __split = __instance.split(); __split.constructor === Array. Actual: '+__split.constructor ); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (__split.length !== 1) { $ERROR('#2: var __instance = new Number(-1234567890); __instance.split = String.prototype.split; __split = __instance.split(); __split.length === 1. Actual: '+__split.length ); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#3 if (__split[0] !== "-1234567890") { $ERROR('#3: var __instance = new Number(-1234567890); __instance.split = String.prototype.split; __split = __instance.split(); __split[0] === "-1234567890". Actual: '+__split[0] ); } // //////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
/** * @license * Copyright 2020 Google LLC. 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. * ============================================================================= */ // TODO update import path once op is modularized. import {softplus} from '../../ops/ops'; import {Tensor} from '../../tensor'; import {Rank} from '../../types'; declare module '../../tensor' { interface Tensor<R extends Rank = Rank> { softplus<T extends Tensor>(this: T): T; } } Tensor.prototype.softplus = function<T extends Tensor>(this: T): T { this.throwIfDisposed(); return softplus(this); };
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="client"> <UniqueIdentifier>{3320444a-6b7b-4175-977b-1137d1e40a76}</UniqueIdentifier> </Filter> <Filter Include="common"> <UniqueIdentifier>{e37e9284-5135-41d3-82f6-67c83f29e5c4}</UniqueIdentifier> </Filter> <Filter Include="processor"> <UniqueIdentifier>{285d5fb7-5e58-422b-b658-27e0030be0ea}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\libs\breakpad\src\common\convert_UTF.c"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\string_conversion.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\windows\guid_string.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\windows\http_upload.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\windows\pdb_source_line_writer.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\windows\string_utils.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\basic_code_modules.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\basic_source_line_resolver.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\call_stack.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\logging.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\minidump.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\minidump_processor.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\pathname_stripper.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\process_state.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\simple_symbol_supplier.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\stackwalker.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\stackwalker_amd64.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\stackwalker_ppc.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\stackwalker_sparc.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\stackwalker_x86.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\client\windows\crash_generation\minidump_generator.cc"> <Filter>client</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\client\windows\crash_generation\crash_generation_client.cc"> <Filter>client</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\client\windows\handler\exception_handler.cc"> <Filter>client</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\client\windows\crash_generation\client_info.cc"> <Filter>client</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\client\windows\crash_generation\crash_generation_server.cc"> <Filter>client</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\client\windows\sender\crash_report_sender.cc"> <Filter>client</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\language.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\md5.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\common\module.cc"> <Filter>common</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\source_line_resolver_base.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\fast_source_line_resolver.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\cfi_frame_info.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\exploitability.cc"> <Filter>processor</Filter> </ClCompile> <ClCompile Include="..\..\libs\breakpad\src\processor\exploitability_win.cc"> <Filter>processor</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\libs\breakpad\src\common\convert_UTF.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\..\libs\breakpad\src\common\md5.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\..\libs\breakpad\src\common\string_conversion.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\..\libs\breakpad\src\common\windows\guid_string.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\..\libs\breakpad\src\common\windows\http_upload.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\..\libs\breakpad\src\common\windows\pdb_source_line_writer.h"> <Filter>common</Filter> </ClInclude> <ClInclude Include="..\..\libs\breakpad\src\common\windows\string_utils-inl.h"> <Filter>common</Filter> </ClInclude> </ItemGroup> <ItemGroup> <None Include="ClassDiagram1.cd" /> </ItemGroup> </Project>
{ "pile_set_name": "Github" }
package main import ( "math/rand" ) // chunkStrings chunks the string slice func chunkStrings(x []string, numChunks int) [][]string { var result [][]string chunkSize := (len(x) + numChunks - 1) / numChunks for i := 0; i < len(x); i += chunkSize { ub := i + chunkSize if ub > len(x) { ub = len(x) } result = append(result, x[i:ub]) } return result } // shuffleStrings shuffles strings func shuffleStrings(x []string, seed int64) { r := rand.New(rand.NewSource(seed)) for i := range x { j := r.Intn(i + 1) x[i], x[j] = x[j], x[i] } }
{ "pile_set_name": "Github" }
# /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. # * Distributed under the Boost Software License, Version 1.0. (See # * accompanying file LICENSE_1_0.txt or copy at # * http://www.boost.org/LICENSE_1_0.txt) # * * # ************************************************************************** */ # # /* See http://www.boost.org for most recent version. */ # # ifndef MSGPACK_PREPROCESSOR_SEQ_REPLACE_HPP # define MSGPACK_PREPROCESSOR_SEQ_REPLACE_HPP # # include <msgpack/preprocessor/arithmetic/dec.hpp> # include <msgpack/preprocessor/arithmetic/inc.hpp> # include <msgpack/preprocessor/config/config.hpp> # include <msgpack/preprocessor/comparison/equal.hpp> # include <msgpack/preprocessor/control/iif.hpp> # include <msgpack/preprocessor/seq/first_n.hpp> # include <msgpack/preprocessor/seq/rest_n.hpp> # include <msgpack/preprocessor/seq/size.hpp> # # /* MSGPACK_PP_SEQ_REPLACE */ # # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG() # define MSGPACK_PP_SEQ_REPLACE(seq, i, elem) MSGPACK_PP_SEQ_FIRST_N(i, seq) (elem) MSGPACK_PP_SEQ_REPLACE_DETAIL_REST(seq, i) # else # define MSGPACK_PP_SEQ_REPLACE(seq, i, elem) MSGPACK_PP_SEQ_REPLACE_I(seq, i, elem) # define MSGPACK_PP_SEQ_REPLACE_I(seq, i, elem) MSGPACK_PP_SEQ_FIRST_N(i, seq) (elem) MSGPACK_PP_SEQ_REPLACE_DETAIL_REST(seq, i) # endif # # define MSGPACK_PP_SEQ_REPLACE_DETAIL_REST_EMPTY(seq, i) # define MSGPACK_PP_SEQ_REPLACE_DETAIL_REST_VALID(seq, i) MSGPACK_PP_SEQ_REST_N(MSGPACK_PP_INC(i), seq) # define MSGPACK_PP_SEQ_REPLACE_DETAIL_REST(seq, i) \ MSGPACK_PP_IIF \ ( \ MSGPACK_PP_EQUAL(i,MSGPACK_PP_DEC(MSGPACK_PP_SEQ_SIZE(seq))), \ MSGPACK_PP_SEQ_REPLACE_DETAIL_REST_EMPTY, \ MSGPACK_PP_SEQ_REPLACE_DETAIL_REST_VALID \ ) \ (seq, i) \ /**/ # # endif
{ "pile_set_name": "Github" }
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_ValueType3507792607.h" // System.String struct String_t; // UnityEngine.XR.iOS.ARPlaneAnchorGameObject struct ARPlaneAnchorGameObject_t2305225887; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Collections.Generic.KeyValuePair`2<System.String,UnityEngine.XR.iOS.ARPlaneAnchorGameObject> struct KeyValuePair_2_t1977350371 { public: // TKey System.Collections.Generic.KeyValuePair`2::key String_t* ___key_0; // TValue System.Collections.Generic.KeyValuePair`2::value ARPlaneAnchorGameObject_t2305225887 * ___value_1; public: inline static int32_t get_offset_of_key_0() { return static_cast<int32_t>(offsetof(KeyValuePair_2_t1977350371, ___key_0)); } inline String_t* get_key_0() const { return ___key_0; } inline String_t** get_address_of_key_0() { return &___key_0; } inline void set_key_0(String_t* value) { ___key_0 = value; Il2CppCodeGenWriteBarrier(&___key_0, value); } inline static int32_t get_offset_of_value_1() { return static_cast<int32_t>(offsetof(KeyValuePair_2_t1977350371, ___value_1)); } inline ARPlaneAnchorGameObject_t2305225887 * get_value_1() const { return ___value_1; } inline ARPlaneAnchorGameObject_t2305225887 ** get_address_of_value_1() { return &___value_1; } inline void set_value_1(ARPlaneAnchorGameObject_t2305225887 * value) { ___value_1 = value; Il2CppCodeGenWriteBarrier(&___value_1, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
{ "pile_set_name": "Github" }
/* * Copyright Terracotta, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.ehcache.impl.internal.store.offheap; import org.ehcache.config.EvictionAdvisor; import org.ehcache.config.ResourcePools; import org.ehcache.config.builders.ExpiryPolicyBuilder; import org.ehcache.config.SizedResourcePool; import org.ehcache.config.builders.ResourcePoolsBuilder; import org.ehcache.config.units.MemoryUnit; import org.ehcache.core.statistics.DefaultStatisticsService; import org.ehcache.core.store.StoreConfigurationImpl; import org.ehcache.expiry.ExpiryPolicy; import org.ehcache.impl.internal.events.TestStoreEventDispatcher; import org.ehcache.core.spi.time.SystemTimeSource; import org.ehcache.core.spi.time.TimeSource; import org.ehcache.impl.serialization.JavaSerializer; import org.ehcache.internal.store.StoreFactory; import org.ehcache.internal.tier.AuthoritativeTierFactory; import org.ehcache.internal.tier.AuthoritativeTierSPITest; import org.ehcache.core.spi.ServiceLocator; import org.ehcache.core.spi.store.Store; import org.ehcache.core.spi.store.tiering.AuthoritativeTier; import org.ehcache.spi.serialization.Serializer; import org.ehcache.spi.service.ServiceConfiguration; import org.junit.Before; import org.terracotta.statistics.StatisticsManager; import java.util.Arrays; import static org.ehcache.config.ResourceType.Core.OFFHEAP; import static org.ehcache.core.spi.ServiceLocator.dependencySet; /** * OffHeapStoreSPITest */ public class OffHeapStoreSPITest extends AuthoritativeTierSPITest<String, String> { private AuthoritativeTierFactory<String, String> authoritativeTierFactory; @Before public void setUp() { authoritativeTierFactory = new AuthoritativeTierFactory<String, String>() { @Override public AuthoritativeTier<String, String> newStore() { return newStore(null, null, ExpiryPolicyBuilder.noExpiration(), SystemTimeSource.INSTANCE); } @Override public AuthoritativeTier<String, String> newStoreWithCapacity(long capacity) { return newStore(capacity, null, ExpiryPolicyBuilder.noExpiration(), SystemTimeSource.INSTANCE); } @Override public AuthoritativeTier<String, String> newStoreWithExpiry(ExpiryPolicy<? super String, ? super String> expiry, TimeSource timeSource) { return newStore(null, null, expiry, timeSource); } @Override public AuthoritativeTier<String, String> newStoreWithEvictionAdvisor(EvictionAdvisor<String, String> evictionAdvisor) { return newStore(null, evictionAdvisor, ExpiryPolicyBuilder.noExpiration(), SystemTimeSource.INSTANCE); } private AuthoritativeTier<String, String> newStore(Long capacity, EvictionAdvisor<String, String> evictionAdvisor, ExpiryPolicy<? super String, ? super String> expiry, TimeSource timeSource) { Serializer<String> keySerializer = new JavaSerializer<>(getClass().getClassLoader()); Serializer<String> valueSerializer = new JavaSerializer<>(getClass().getClassLoader()); ResourcePools resourcePools = getOffHeapResourcePool(capacity); SizedResourcePool offheapPool = resourcePools.getPoolForResource(OFFHEAP); MemoryUnit unit = (MemoryUnit)offheapPool.getUnit(); Store.Configuration<String, String> config = new StoreConfigurationImpl<>(getKeyType(), getValueType(), evictionAdvisor, getClass().getClassLoader(), expiry, resourcePools, 0, keySerializer, valueSerializer); OffHeapStore<String, String> store = new OffHeapStore<>(config, timeSource, new TestStoreEventDispatcher<>(), unit .toBytes(offheapPool.getSize()), new DefaultStatisticsService()); OffHeapStore.Provider.init(store); return store; } private ResourcePools getOffHeapResourcePool(Comparable<Long> capacityConstraint) { if (capacityConstraint == null) { capacityConstraint = 10L; } return ResourcePoolsBuilder.newResourcePoolsBuilder().offheap((Long)capacityConstraint, MemoryUnit.MB).build(); } @Override public Store.ValueHolder<String> newValueHolder(String value) { return new BasicOffHeapValueHolder<>(-1, value, SystemTimeSource.INSTANCE.getTimeMillis(), OffHeapValueHolder.NO_EXPIRE); } @Override public Class<String> getKeyType() { return String.class; } @Override public Class<String> getValueType() { return String.class; } @Override public ServiceConfiguration<?, ?>[] getServiceConfigurations() { return new ServiceConfiguration<?, ?>[0]; } @Override public ServiceLocator getServiceProvider() { ServiceLocator serviceLocator = dependencySet().build(); try { serviceLocator.startAllServices(); } catch (Exception e) { throw new RuntimeException(e); } return serviceLocator; } @Override public String createKey(long seed) { return Long.toString(seed); } @Override public String createValue(long seed) { char[] chars = new char[600 * 1024]; Arrays.fill(chars, (char) (0x1 + (seed & 0x7e))); return new String(chars); } @Override public void close(final Store<String, String> store) { OffHeapStore.Provider.close((OffHeapStore)store); StatisticsManager.nodeFor(store).clean(); } }; } @Override protected AuthoritativeTierFactory<String, String> getAuthoritativeTierFactory() { return authoritativeTierFactory; } @Override protected StoreFactory<String, String> getStoreFactory() { return getAuthoritativeTierFactory(); } public static void initStore(OffHeapStore<?, ?> offHeapStore) { OffHeapStore.Provider.init(offHeapStore); } public static void closeStore(OffHeapStore<?, ?> offHeapStore) { OffHeapStore.Provider.close(offHeapStore); StatisticsManager.nodeFor(offHeapStore).clean(); } }
{ "pile_set_name": "Github" }
var en_IND = {}; module['exports'] = en_IND; en_IND.title = "English (India)"; en_IND.name = require("./name"); en_IND.address = require("./address"); en_IND.internet = require("./internet"); en_IND.company = require("./company"); en_IND.phone_number = require("./phone_number");
{ "pile_set_name": "Github" }
[manpage_begin math n 1.2.5] [keywords math] [keywords statistics] [comment {-*- tcl -*- doctools manpage}] [moddesc {Tcl Math Library}] [titledesc {Tcl Math Library}] [category Mathematics] [require Tcl 8.2] [require math [opt 1.2.5]] [description] [para] The [package math] package provides utility math functions. [para] Besides a set of basic commands, available via the package [emph math], there are more specialised packages: [list_begin itemized] [item] [package math::bigfloat] - Arbitrary-precision floating-point arithmetic [item] [package math::bignum] - Arbitrary-precision integer arithmetic [item] [package math::calculus::romberg] - Robust integration methods for functions of one variable, using Romberg integration [item] [package math::calculus] - Integration of functions, solving ordinary differential equations [item] [package math::combinatorics] - Procedures for various combinatorial functions (for instance the Gamma function and "k out of n") [item] [package math::complexnumbers] - Complex number arithmetic [item] [package math::constants] - A set of well-known mathematical constants, such as Pi, E, and the golden ratio [item] [package math::fourier] - Discrete Fourier transforms [item] [package math::fuzzy] - Fuzzy comparisons of floating-point numbers [item] [package math::geometry] - 2D geometrical computations [item] [package math::interpolate] - Various interpolation methods [item] [package math::linearalgebra] - Linear algebra package [item] [package math::optimize] - Optimization methods [item] [package math::polynomials] - Polynomial arithmetic (includes families of classical polynomials) [item] [package math::rationalfunctions] - Arithmetic of rational functions [item] [package math::roman] - Manipulation (including arithmetic) of Roman numerals [item] [package math::special] - Approximations of special functions from mathematical physics [item] [package math::statistics] - Statistical operations and tests [list_end] [section "BASIC COMMANDS"] [list_begin definitions] [call [cmd ::math::cov] [arg value] [arg value] [opt [arg {value ...}]]] Return the coefficient of variation expressed as percent of two or more numeric values. [call [cmd ::math::integrate] [arg {list of xy value pairs}]] Return the area under a "curve" defined by a set of x,y pairs and the error bound as a list. [call [cmd ::math::fibonacci] [arg n]] Return the [arg n]'th Fibonacci number. [call [cmd ::math::max] [arg value] [opt [arg {value ...}]]] Return the maximum of one or more numeric values. [call [cmd ::math::mean] [arg value] [opt [arg {value ...}]]] Return the mean, or "average" of one or more numeric values. [call [cmd ::math::min] [arg value] [opt [arg {value ...}]]] Return the minimum of one or more numeric values. [call [cmd ::math::product] [arg value] [opt [arg {value ...}]]] Return the product of one or more numeric values. [call [cmd ::math::random] [opt [arg value1]] [opt [arg value2]]] Return a random number. If no arguments are given, the number is a floating point value between 0 and 1. If one argument is given, the number is an integer value between 0 and [arg value1]. If two arguments are given, the number is an integer value between [arg value1] and [arg value2]. [call [cmd ::math::sigma] [arg value] [arg value] [opt [arg {value ...}]]] Return the population standard deviation of two or more numeric values. [call [cmd ::math::stats] [arg value] [arg value] [opt [arg {value ...}]]] Return the mean, standard deviation, and coefficient of variation (as percent) as a list. [call [cmd ::math::sum] [arg value] [opt [arg {value ...}]]] Return the sum of one or more numeric values. [list_end] [vset CATEGORY math] [include ../doctools2base/include/feedback.inc] [manpage_end]
{ "pile_set_name": "Github" }
{ /* $Id$ */ /* The HTML 4.0 character lists can be found at http://www.w3.org/TR/REC-html40/sgml/entities.html. */ character = { /*******************************************/ /* -//W3C//ENTITIES Full Latin 1//EN//HTML */ /*******************************************/ nbsp = 160; iexcl = 161; cent = 162; pound = 163; curren = 164; yen = 165; brvbar = 166; sect = 167; uml = 168; copy = 169; ordf = 170; laquo = 171; not = 172; shy = 173; reg = 174; macr = 175; deg = 176; plusmn = 177; sup2 = 178; sup3 = 179; acute = 180; micro = 181; para = 182; middot = 183; cedil = 184; sup1 = 185; ordm = 186; raquo = 187; frac14 = 188; frac12 = 189; frac34 = 190; iquest = 191; Agrave = 192; Aacute = 193; Acirc = 194; Atilde = 195; Auml = 196; Aring = 197; AElig = 198; Ccedil = 199; Egrave = 200; Eacute = 201; Ecirc = 202; Euml = 203; Igrave = 204; Iacute = 205; Icirc = 206; Iuml = 207; ETH = 208; Ntilde = 209; Ograve = 210; Oacute = 211; Ocirc = 212; Otilde = 213; Ouml = 214; times = 215; Oslash = 216; Ugrave = 217; Uacute = 218; Ucirc = 219; Uuml = 220; Yacute = 221; THORN = 222; szlig = 223; agrave = 224; aacute = 225; acirc = 226; atilde = 227; auml = 228; aring = 229; aelig = 230; ccedil = 231; egrave = 232; eacute = 233; ecirc = 234; euml = 235; igrave = 236; iacute = 237; icirc = 238; iuml = 239; eth = 240; ntilde = 241; ograve = 242; oacute = 243; ocirc = 244; otilde = 245; ouml = 246; divide = 247; oslash = 248; ugrave = 249; uacute = 250; ucirc = 251; uuml = 252; yacute = 253; thorn = 254; yuml = 255; /**************************************/ /* -//W3C//ENTITIES Special//EN//HTML */ /**************************************/ /* C0 Controls and Basic Latin */ quot = 34; amp = 38; lt = 60; gt = 62; /* Latin Extended-A */ OElig = 338; oelig = 339; Scaron = 352; scaron = 353; Yuml = 376; /* Spacing Modifier Letters */ circ = 710; tilde = 732; /* General Punctuation */ ensp = 8194; emsp = 8195; thinsp = 8201; zwnj = 8204; zwj = 8205; lrm = 8206; rlm = 8207; ndash = 8211; mdash = 8212; lsquo = 8216; rsquo = 8217; sbquo = 8218; ldquo = 8220; rdquo = 8221; bdquo = 8222; dagger = 8224; Dagger = 8225; permil = 8240; lsaquo = 8249; rsaquo = 8250; euro = 8364; }; /* * Right now we're not sure when to use these extra HTML 4.0 entities, so we don't read them * at all. Ken thinks maybe there's some special math mode you go into and these become valid. * * We don't include these by default because they can play havoc with URL parsing, when someone * says, "http://www.blah.com/cgi/blah&prod=foo", the &prod will get turned into a multiplication * symbol, which isn't really what the person wanted. Of course, no one is smart enough to * quote & the way they are supposed to. * * So, these are left here for the future. */ extendedCharacter = { /***************************************/ /* -//W3C//ENTITIES Symbolic//EN//HTML */ /***************************************/ /* Latin Extended-B */ fnof = 402; /* Greek */ Alpha = 913; Beta = 914; Gamma = 915; Delta = 916; Epsilon = 917; Zeta = 918; Eta = 919; Theta = 920; Iota = 921; Kappa = 922; Lambda = 923; Mu = 924; Nu = 925; Xi = 926; Omicron = 927; Pi = 928; Rho = 929; Sigma = 931; Tau = 932; Upsilon = 933; Phi = 934; Chi = 935; Psi = 936; Omega = 937; alpha = 945; beta = 946; gamma = 947; delta = 948; epsilon = 949; /* 8712? */ zeta = 950; eta = 951; theta = 952; iota = 953; kappa = 954; lambda = 955; mu = 956; nu = 957; xi = 958; omicron = 959; pi = 960; rho = 961; sigmaf = 962; sigma = 963; tau = 964; upsilon = 965; phi = 966; chi = 967; psi = 968; omega = 969; thetasym = 977; upsih = 978; piv = 982; /* General Punctuation */ bull = 8226; hellip = 8230; prime = 8242; Prime = 8243; oline = 8254; frasl = 8260; /* Letterlike Symbols */ weierp = 8472; image = 8465; real = 8476; trade = 8482; alefsym = 8501; /* Arrows */ larr = 8592; uarr = 8593; rarr = 8594; darr = 8595; harr = 8596; crarr = 8629; lArr = 8656; uArr = 8657; rArr = 8658; dArr = 8659; hArr = 8660; forall = 8704; part = 8706; exist = 8707; empty = 8709; nabla = 8711; isin = 8712; notin = 8713; ni = 8715; prod = 8719; sum = 8721; minus = 8722; lowast = 8727; radic = 8730; prop = 8733; infin = 8734; ang = 8736; and = 8743; or = 8744; cap = 8745; cup = 8746; int = 8747; there4 = 8756; sim = 8764; cong = 8773; asymp = 8776; ne = 8800; equiv = 8801; le = 8804; ge = 8805; sub = 8834; sup = 8835; nsub = 8836; sube = 8838; supe = 8839; oplus = 8853; otimes = 8855; perp = 8869; sdot = 8901; /* Miscellaneous Technical */ lceil = 8968; rceil = 8969; lfloor = 8970; rfloor = 8971; lang = 9001; rang = 9002; /* Geometric Shapes */ loz = 9674; /* Miscellaneous Symbols */ spades = 9824; clubs = 9827; hearts = 9829; diams = 9830; }; /* * BELOW THIS POINT IS NOT USED ANY MORE, BUT WHO KNOWS WHAT WILL CHANGE */ nonstandardCharacters = { /*********************************************/ /* HTML 3.0 math symbols, Emacs W3-mode, ... */ /*********************************************/ sp = 32; blank = 32; excl = 33; num = 35; dollar = 36; percnt = 37; apos = 39; lpar = 40; rpar = 41; ast = 42; plus = 43; comma = 44; hyphen = 45; dash = 45; period = 46; sol = 47; colon = 58; semi = 59; equals = 61; quest = 63; commat = 64; lsqb = 91; bsol = 92; rsqb = 93; caret = 94; lowbar = 95; grave = 96; lcub = 123; verbar = 124; rcub = 125; brkbar = 166; die = 168; hibar = 175; half = 189; angst = 197; Dstrok = 208; /* Symbol Font Entities */ phiv = 981; varphi = 981; ldots = 8230; /* Standard NEXTSTEP encoding */ breve = 728; caron = 711; dblac = 733; dot = 729; ldquor = 8222; lsquor = 8218; emdash = 8212; endash = 8211; ogon = 731; rdquor = 8221; ring = 730; rsquor = 8217; /* I haven't seen any legit reference to this, but some people use it, and it's easy enough to support... */ nbrsp = 160; }; icon = { archive = "archive"; audio = "audio"; binary.document = "binary.document"; binhex.document = "binhex.document"; calculator = "calculator"; caution = "caution"; clock = "clock"; compressed.document = "compressed.document"; disk.drive = "disk.drive"; diskette = "diskette"; display = "display"; document = "document"; fax = "fax"; filing.cabinet = "filing.cabinet"; film = "film"; fixed.disk = "fixed.disk"; folder = "folder"; form = "form"; ftp = "ftp"; glossary = "glossary"; gopher = "gopher"; home = "home"; /* image = "image"; -- conflicts with "imaginary part", &#8465; */ index = "index"; keyboard = "keyboard"; mail = "mail"; mail.in = "mail.in"; mail.out = "mail.out"; map = "map"; mouse = "mouse"; next = "next"; notebook = "notebook"; parent = "parent"; previous = "previous"; printer = "printer"; scheduler = "scheduler"; stop = "stop"; summary = "summary"; symlink = "symlink"; telephone = "telephone"; telnet = "telnet"; text.document = "text.document"; tn3270 = "tn3270"; toc = "toc"; trash = "trash"; unknown.document = "unknown.document"; uuencoded.document = "uuencoded.document"; workstation = "workstation"; }; strings = { }; nonstandardStrings = { /* These aren't strictly legal */ Lt = "<"; LT = "<"; Gt = ">"; GT = ">"; Amp = "&"; AMP = "&"; Quot = "\""; QUOT = "\""; /* No unicode equivalents to these */ frac18 = "1/8"; frac38 = "3/8"; frac58 = "5/8"; frac78 = "7/8"; iff = "iff"; }; }
{ "pile_set_name": "Github" }
[Rank] In Commemoratione Sancti Pauli Apostoli;;Duplex majus;;4;;ex C1 [Rank1960] In Commemoratione Sancti Pauli Apostoli;;Duplex;;3;;vide C1 [Rule] ex C1; Gloria CredoDA Prefatio=Apostolis Sub unica concl [Introitus] !2 Tim. 1:12 v. I know Whom I have believed, and I am certain that He is able to guard the~ trust committed to Him, against that day; being a just judge. !Ps 138:1-2 O Lord, You have probed me and You know me; You know when I sit and when I~ stand. &Gloria v. I know Whom I have believed, and I am certain that He is able to guard the~ trust committed to Him, against that day; being a just judge. [Oratio] O God, Who taught vast numbers of the Gentiles by the preaching of the blessed~ Apostle Paul, grant we beseech You that, by honoring his memory, we may enjoy~ the benefit of his patronal intercession. $Per Dominum. _ $Oremus !Pro ST. PETER O God, Who, when giving blessed Peter, Your Apostle, the keys of the heavenly~ kingdom bestowed on him the power of binding and loosing, grant that by the help~ of his intercession we may be delivered from the bonds of our sins. $Qui vivis [Lectio] Olvasmány szent Pál apostol Galatákhoz irott leveléből !Gal 1:11-20 v. Biztosítalak benneteket, testvérek, hogy az általam hirdetett evangélium nem embertől való. Hiszen nem embertől kaptam vagy tanultam, hanem Jézus Krisztus kinyilatkoztatásából. Hallhattátok már, hogy azelőtt, még mint zsidó, milyen magatartást tanúsítottam: könyörtelenül üldöztem az Isten egyházát és a romlására törtem. A zsidó vallásosságban számos fajtámbeli kortársamat felülmúltam, mert fölöttébb buzgó követője voltam atyáim hagyományainak. De amikor tetszett annak, aki már születésemtől fogva kiválasztott és kegyelmével meghívott, hogy kinyilatkoztassa bennem Fiát, hogy hirdessem a pogányoknak, nem hallgattam a testre és a vérre, és Jeruzsálembe sem mentem föl apostolelődeimhez, hanem elmentem Arábiába, majd ismét visszatértem Damaszkuszba. Három év múltán azután fölmentem Jeruzsálembe, hogy megismerkedjem Péterrel, s nála maradtam tizenöt napig. Más apostolt nem is láttam, csak Jakabot, az Úr testvérét. Amit itt írok, Isten előtt mondom, nem hazugság. [Graduale] !Gal 2:8-9 He Who worked in Peter for the apostleship, worked also in me among the Gentiles;~ and they recognized the grace of God, that was given to me. !1 Cor. 15:10 V. The grace of God in me has not been fruitless; but His grace always remains~ in me. Alleluia, alleluia. V. Holy Apostle Paul, preacher of truth, and teacher of the Gentiles, intercede~ for us. Alleluia. [Evangelium] Evangélium + szent Máté Apostol kőnyvéből !Matt 10:16-22 v. Nézzétek, úgy küldelek titeket, mint bárányokat a farkasok közé! Legyetek tehát okosak, mint a kígyók, és egyszerűek, mint a galambok! Az emberekkel szemben legyetek óvatosak, mert bíróság elé állítanak, zsinagógáikban pedig megostoroztatnak benneteket! Miattam helytartók és királyok elé hurcolnak, hogy tegyetek előttük és a pogányok előtt tanúságot. Amikor átadnak benneteket a bíróságnak, ne töprengjetek, hogyan és mit mondjatok! Abban az órában megadatik nektek, hogyan beszéljetek. Mert hisz nem ti fogtok beszélni, hanem majd Atyátok Lelke szól belőletek. Halálra adja majd a testvér a testvért, az apa a gyermekét, a gyermekek meg szüleik ellen támadnak és vesztüket okozzák. Mindenki szemében gyűlöletesek lesztek nevemért. Aki azonban mindvégig kitart, az üdvözül. [Offertorium] !Ps 138:17 To me, Your friends, O God, are made exceedingly honorable; their principality~ is exceedingly strengthened. [Secreta] O Lord, make holy the offerings of Your people, through the prayer of Paul, Your~ Apostle, that those things which You have established as pleasing to You may be~ even more pleasing through his patronal intercession. $Per Dominum. _ $Oremus !Pro ST. PETER We beseech You, O Lord, may the prayer of the blessed Apostle Peter, recommend~ the petitions and offerings of Your Church, so what we celebrate in his honor~ may obtain forgiveness for us. $Per Dominum [Communio] !Matt 19:28-29 Amen I say to you that you who have left all things and followed Me, shall~ receive a hundredfold, and shall possess life everlasting. [Postcommunio] Having received Your sacrament, O Lord, we implore You, that what we have~ celebrated in honor of St. Paul, Your Apostle, may by his intercession benefit~ us as a healing remedy. $Per Dominum. _ $Oremus !Pro ST. PETER O Lord, may the gift we offer bring us joy, that as we praise Your wondrous work~ in Your Apostle Peter, so through him may we share Your generous forgiveness. $Per Dominum [Commemoratio Oratio] !For the Octave of St John Baptist O God, Who may this a day most worthy of our celebration because of blessed John;~ grant Your people the grace of spiritual joys and direct the minds of all the~ faithful into the path of eternal salvation. $Per Dominum [Commemoratio Secreta] !For the Octave of St John Baptist We heap Your altar with gifts, O Lord, celebrating the birth of him who~ announced the coming of the Saviour of the world, our Lord Jesus Christ, Your Son,~ and made His presence known. $Qui tecum [Commemoratio Postcommunio] !For the Octave of St John Baptist May Your Church, O God, rejoice at the birth of blessed John the Baptist,~ through whom she knew the author of her own rebirth, Your Son, our Lord Jesus~ Christ. $Qui tecum
{ "pile_set_name": "Github" }
<http://example.org/ex#a> <http://example.org/ex#b> "John said: \"Hello World!\"" .
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MapViewControlDemoViewController"> <connections> <outlet property="_closeButton" destination="271" id="273"/> <outlet property="_hiddenView" destination="270" id="276"/> <outlet property="_imgView" destination="272" id="274"/> <outlet property="_mapView" destination="247" id="256"/> <outlet property="_overlook" destination="253" id="284"/> <outlet property="_overlookdegree" destination="254" id="285"/> <outlet property="_rotate" destination="252" id="281"/> <outlet property="_rotatedegree" destination="156" id="282"/> <outlet property="_showMsgLabel" destination="242" id="268"/> <outlet property="_zoom" destination="251" id="277"/> <outlet property="_zoomdegree" destination="147" id="279"/> <outlet property="view" destination="1" id="12"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <view contentMode="scaleToFill" id="1"> <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view hidden="YES" contentMode="scaleToFill" id="270"> <rect key="frame" x="0.0" y="1" width="320" height="567"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="271"> <rect key="frame" x="113" y="382" width="104" height="30"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> <state key="normal" title="关闭"> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> </state> <connections> <action selector="closeButtonClicked:" destination="-2" eventType="touchUpInside" id="275"/> </connections> </button> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" id="272"> <rect key="frame" x="0.0" y="0.0" width="320" height="380"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> </imageView> </subviews> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> </view> <view contentMode="scaleToFill" id="247" customClass="BMKMapView"> <rect key="frame" x="0.0" y="95" width="320" height="473"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="251"> <rect key="frame" x="1" y="1" width="50" height="32"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> <state key="normal" title="缩放"/> <connections> <action selector="zoomButtonClicked:" destination="-1" eventType="touchUpInside" id="278"/> </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="252"> <rect key="frame" x="110" y="1" width="50" height="32"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> <state key="normal" title="旋转"> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> </state> <connections> <action selector="rotateButtonClicked:" destination="-1" eventType="touchUpInside" id="280"/> </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="253"> <rect key="frame" x="218" y="1" width="50" height="32"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/> <state key="normal" title="俯视"> <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> </state> <connections> <action selector="overlookButtonClicked:" destination="-1" eventType="touchUpInside" id="283"/> </connections> </button> <textField opaque="NO" clipsSubviews="YES" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="10" borderStyle="roundedRect" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" id="147"> <rect key="frame" x="53" y="1" width="50" height="30"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="15"/> <textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation" returnKeyType="done"/> <connections> <action selector="textFiledReturnEditing:" destination="-1" eventType="editingDidEndOnExit" id="249"/> </connections> </textField> <textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="90" borderStyle="roundedRect" textAlignment="center" minimumFontSize="17" id="156"> <rect key="frame" x="161" y="1" width="50" height="30"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation" returnKeyType="done"/> <connections> <action selector="textFiledReturnEditing:" destination="-1" eventType="editingDidEndOnExit" id="250"/> </connections> </textField> <textField opaque="NO" clipsSubviews="YES" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="-30" borderStyle="roundedRect" textAlignment="center" minimumFontSize="17" id="254"> <rect key="frame" x="270" y="1" width="50" height="30"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits" keyboardType="numbersAndPunctuation" returnKeyType="done"/> <connections> <action selector="textFiledReturnEditing:" destination="-1" eventType="editingDidEndOnExit" id="255"/> </connections> </textField> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="点击、长按或双击地图以获取地图状态" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="242"> <rect key="frame" x="0.0" y="33" width="320" height="62"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <nil key="highlightedColor"/> </label> </subviews> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> </view> </objects> </document>
{ "pile_set_name": "Github" }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" #include "gpu/command_buffer/service/gl_utils.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "ui/gfx/geometry/size.h" namespace { #define SHADER(src) \ "#ifdef GL_ES\n" \ "precision mediump float;\n" \ "#endif\n" #src const char* g_vertex_shader_source = { SHADER( uniform float u_clear_depth; attribute vec4 a_position; void main(void) { gl_Position = vec4(a_position.x, a_position.y, u_clear_depth, 1.0); } ), }; const char* g_fragment_shader_source = { SHADER( uniform vec4 u_clear_color; void main(void) { gl_FragColor = u_clear_color; } ), }; void CompileShader(GLuint shader, const char* shader_source) { glShaderSource(shader, 1, &shader_source, 0); glCompileShader(shader); #if DCHECK_IS_ON() GLint compile_status = GL_FALSE; glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status); if (GL_TRUE != compile_status) { char buffer[1024]; GLsizei length = 0; glGetShaderInfoLog(shader, sizeof(buffer), &length, buffer); std::string log(buffer, length); DLOG(ERROR) << "Error compiling shader: " << log; DLOG(ERROR) << "Shader compilation failure."; } #endif } } // namespace namespace gpu { namespace gles2 { ClearFramebufferResourceManager::ClearFramebufferResourceManager( const gles2::GLES2Decoder* decoder) : initialized_(false), program_(0u), buffer_id_(0u) { Initialize(decoder); } ClearFramebufferResourceManager::~ClearFramebufferResourceManager() { Destroy(); DCHECK(!buffer_id_); } void ClearFramebufferResourceManager::Initialize( const gles2::GLES2Decoder* decoder) { static_assert( kVertexPositionAttrib == 0u, "kVertexPositionAttrib must be 0"); DCHECK(!buffer_id_); glGenBuffersARB(1, &buffer_id_); glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); const GLfloat kQuadVertices[] = {-1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f}; glBufferData( GL_ARRAY_BUFFER, sizeof(kQuadVertices), kQuadVertices, GL_STATIC_DRAW); decoder->RestoreBufferBindings(); initialized_ = true; } void ClearFramebufferResourceManager::Destroy() { if (!initialized_) return; glDeleteProgram(program_); glDeleteBuffersARB(1, &buffer_id_); buffer_id_ = 0; } void ClearFramebufferResourceManager::ClearFramebuffer( const gles2::GLES2Decoder* decoder, const gfx::Size& max_viewport_size, GLbitfield mask, GLfloat clear_color_red, GLfloat clear_color_green, GLfloat clear_color_blue, GLfloat clear_color_alpha, GLfloat clear_depth_value, GLint clear_stencil_value) { if (!initialized_) { DLOG(ERROR) << "Uninitialized manager."; return; } if (!program_) { program_ = glCreateProgram(); GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER); CompileShader(vertex_shader, g_vertex_shader_source); glAttachShader(program_, vertex_shader); GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); CompileShader(fragment_shader, g_fragment_shader_source); glAttachShader(program_, fragment_shader); glBindAttribLocation(program_, kVertexPositionAttrib, "a_position"); glLinkProgram(program_); #if DCHECK_IS_ON() GLint linked = GL_FALSE; glGetProgramiv(program_, GL_LINK_STATUS, &linked); if (GL_TRUE != linked) DLOG(ERROR) << "Program link failure."; #endif depth_handle_ = glGetUniformLocation(program_, "u_clear_depth"); color_handle_ = glGetUniformLocation(program_, "u_clear_color"); glDeleteShader(fragment_shader); glDeleteShader(vertex_shader); } glUseProgram(program_); #if DCHECK_IS_ON() glValidateProgram(program_); GLint validation_status = GL_FALSE; glGetProgramiv(program_, GL_VALIDATE_STATUS, &validation_status); if (GL_TRUE != validation_status) DLOG(ERROR) << "Invalid shader."; #endif decoder->ClearAllAttributes(); glEnableVertexAttribArray(kVertexPositionAttrib); glBindBuffer(GL_ARRAY_BUFFER, buffer_id_); glVertexAttribPointer(kVertexPositionAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0); glUniform1f(depth_handle_, clear_depth_value); glUniform4f(color_handle_, clear_color_red, clear_color_green, clear_color_blue, clear_color_alpha); if (!(mask & GL_COLOR_BUFFER_BIT)) { glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); } if (mask & GL_DEPTH_BUFFER_BIT) { glEnable(GL_DEPTH_TEST); glDepthFunc(GL_ALWAYS); } else { glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); } if (mask & GL_STENCIL_BUFFER_BIT) { glEnable(GL_STENCIL_TEST); glStencilFunc(GL_ALWAYS, clear_stencil_value, 0xFF); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); } else { glDisable(GL_STENCIL_TEST); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilMask(0); } glDisable(GL_CULL_FACE); glDisable(GL_BLEND); glDisable(GL_POLYGON_OFFSET_FILL); glViewport(0, 0, max_viewport_size.width(), max_viewport_size.height()); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); decoder->RestoreAllAttributes(); decoder->RestoreProgramBindings(); decoder->RestoreBufferBindings(); decoder->RestoreGlobalState(); } } // namespace gles2 } // namespace gpu
{ "pile_set_name": "Github" }
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Copyright (c) 2016-2018 The VES code team (see the PEOPLE-VES file at the root of this folder for a list of names) See http://www.ves-code.org for more information. This file is part of VES code module. The VES code module 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 3 of the License, or (at your option) any later version. The VES code module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the VES code module. If not, see <http://www.gnu.org/licenses/>. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "Optimizer.h" #include "CoeffsVector.h" #include "core/ActionRegister.h" namespace PLMD { namespace ves { //+PLUMEDOC VES_OPTIMIZER OPT_DUMMY /* Dummy optimizer for debugging. This is dummy optimizer that can be used for debugging. It will not update the coefficients but can be used to monitor the gradient and Hessian for a given VES bias. \par Examples In the following input we use the OPT_DUMMY to monitor the gradient and Hessian for a given VES bias every 1 iteration. \plumedfile phi: TORSION ATOMS=5,7,9,15 bf1: BF_FOURIER ORDER=5 MINIMUM=-pi MAXIMUM=pi VES_LINEAR_EXPANSION ... ARG=phi BASIS_FUNCTIONS=bf1 LABEL=ves1 TEMP=300.0 GRID_BINS=100 ... VES_LINEAR_EXPANSION OPT_DUMMY ... BIAS=ves1 STRIDE=1000 LABEL=o1 MONITOR_HESSIAN GRADIENT_FILE=gradient.data GRADIENT_OUTPUT=1 GRADIENT_FMT=%12.6f HESSIAN_FILE=hessian.data HESSIAN_OUTPUT=1 HESSIAN_FMT=%12.6f ... OPT_DUMMY \endplumedfile */ //+ENDPLUMEDOC class Opt_Dummy : public Optimizer { public: static void registerKeywords(Keywords&); explicit Opt_Dummy(const ActionOptions&); void coeffsUpdate(const unsigned int c_id = 0) override; }; PLUMED_REGISTER_ACTION(Opt_Dummy,"OPT_DUMMY") void Opt_Dummy::registerKeywords(Keywords& keys) { Optimizer::registerKeywords(keys); // Optimizer::useMultipleWalkersKeywords(keys); Optimizer::useHessianKeywords(keys); Optimizer::useMonitorAverageGradientKeywords(keys); keys.addFlag("MONITOR_HESSIAN",false,"also monitor the Hessian"); } Opt_Dummy::Opt_Dummy(const ActionOptions&ao): PLUMED_VES_OPTIMIZER_INIT(ao) { log.printf(" fake optimizer that does not update coefficients\n"); log.printf(" can be used to monitor gradient and Hessian for debugging purposes\n"); bool monitor_hessian = false; parseFlag("MONITOR_HESSIAN",monitor_hessian); if(monitor_hessian) { turnOnHessian(); log.printf(" the Hessian will also be monitored\n"); } else { turnOffHessian(); } turnOffCoeffsOutputFiles(); checkRead(); } void Opt_Dummy::coeffsUpdate(const unsigned int c_id) {} } }
{ "pile_set_name": "Github" }
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "zcposoccrandread.h" #include "zcposocciterators.h" #include <vespa/vespalib/data/fileheader.h> #include <vespa/searchlib/queryeval/emptysearch.h> #include <vespa/fastos/file.h> #include <vespa/log/log.h> LOG_SETUP(".diskindex.zcposoccrandread"); using search::bitcompression::EG2PosOccEncodeContext; using search::bitcompression::EGPosOccEncodeContext; using search::bitcompression::EG2PosOccDecodeContext; using search::bitcompression::EG2PosOccDecodeContextCooked; using search::bitcompression::EGPosOccDecodeContext; using search::bitcompression::EGPosOccDecodeContextCooked; using search::bitcompression::PosOccFieldsParams; using search::bitcompression::FeatureDecodeContext; using search::index::FieldLengthInfo; using search::index::PostingListCounts; using search::index::PostingListHandle; using search::ComprFileReadContext; namespace { vespalib::string myId4("Zc.4"); vespalib::string myId5("Zc.5"); vespalib::string interleaved_features("interleaved_features"); } namespace search::diskindex { using vespalib::getLastErrorString; ZcPosOccRandRead::ZcPosOccRandRead() : _file(std::make_unique<FastOS_File>()), _fileSize(0), _posting_params(64, 1 << 30, 10000000, true, true, false), _numWords(0), _fileBitSize(0), _headerBitSize(0), _fieldsParams() { } ZcPosOccRandRead::~ZcPosOccRandRead() { if (_file->IsOpened()) { close(); } } search::queryeval::SearchIterator * ZcPosOccRandRead:: createIterator(const PostingListCounts &counts, const PostingListHandle &handle, const search::fef::TermFieldMatchDataArray &matchData, bool usebitVector) const { (void) usebitVector; assert((handle._bitLength != 0) == (counts._bitLength != 0)); assert((counts._numDocs != 0) == (counts._bitLength != 0)); assert(handle._bitOffsetMem <= handle._bitOffset); if (handle._bitLength == 0) { return new search::queryeval::EmptySearch; } const char *cmem = static_cast<const char *>(handle._mem); uint64_t memOffset = reinterpret_cast<unsigned long>(cmem) & 7; const uint64_t *mem = reinterpret_cast<const uint64_t *> (cmem - memOffset) + (memOffset * 8 + handle._bitOffset - handle._bitOffsetMem) / 64; int bitOffset = (memOffset * 8 + handle._bitOffset - handle._bitOffsetMem) & 63; Position start(mem, bitOffset); return create_zc_posocc_iterator(true, counts, start, handle._bitLength, _posting_params, _fieldsParams, matchData).release(); } void ZcPosOccRandRead::readPostingList(const PostingListCounts &counts, uint32_t firstSegment, uint32_t numSegments, PostingListHandle &handle) { // XXX: Ignore segments for now. (void) firstSegment; (void) numSegments; (void) counts; handle.drop(); if (handle._bitLength == 0) { return; } uint64_t startOffset = (handle._bitOffset + _headerBitSize) >> 3; // Align start at 64-bit boundary startOffset -= (startOffset & 7); void *mapPtr = _file->MemoryMapPtr(startOffset); if (mapPtr != nullptr) { handle._mem = mapPtr; handle._allocMem = nullptr; handle._allocSize = 0; } else { uint64_t endOffset = (handle._bitOffset + _headerBitSize + handle._bitLength + 7) >> 3; // Align end at 64-bit boundary endOffset += (-endOffset & 7); uint64_t vectorLen = endOffset - startOffset; size_t padBefore; size_t padAfter; size_t padExtraAfter; // Decode prefetch space _file->DirectIOPadding(startOffset, vectorLen, padBefore, padAfter); padExtraAfter = 0; if (padAfter < 16) { padExtraAfter = 16 - padAfter; } size_t mallocLen = padBefore + vectorLen + padAfter + padExtraAfter; void *mallocStart = nullptr; void *alignedBuffer = nullptr; if (mallocLen > 0) { alignedBuffer = _file->AllocateDirectIOBuffer(mallocLen, mallocStart); assert(mallocStart != nullptr); assert(endOffset + padAfter + padExtraAfter <= _fileSize); _file->ReadBuf(alignedBuffer, padBefore + vectorLen + padAfter, startOffset - padBefore); } // Zero decode prefetch memory to avoid uninitialized reads if (padExtraAfter > 0) { memset(reinterpret_cast<char *>(alignedBuffer) + padBefore + vectorLen + padAfter, '\0', padExtraAfter); } handle._mem = static_cast<char *>(alignedBuffer) + padBefore; handle._allocMem = mallocStart; handle._allocSize = mallocLen; } handle._bitOffsetMem = (startOffset << 3) - _headerBitSize; } bool ZcPosOccRandRead:: open(const vespalib::string &name, const TuneFileRandRead &tuneFileRead) { _file->setFAdviseOptions(tuneFileRead.getAdvise()); if (tuneFileRead.getWantMemoryMap()) { _file->enableMemoryMap(tuneFileRead.getMemoryMapFlags()); } else if (tuneFileRead.getWantDirectIO()) { _file->EnableDirectIO(); } bool res = _file->OpenReadOnly(name.c_str()); if (!res) { LOG(error, "could not open %s: %s", _file->GetFileName(), getLastErrorString().c_str()); return false; } _fileSize = _file->GetSize(); readHeader(); return true; } bool ZcPosOccRandRead::close() { _file->Close(); return true; } template <typename DecodeContext> void ZcPosOccRandRead::readHeader(const vespalib::string &identifier) { DecodeContext d(&_fieldsParams); ComprFileReadContext drc(d); drc.setFile(_file.get()); drc.setFileSize(_file->GetSize()); drc.allocComprBuf(512, 32768u); d.emptyBuffer(0); drc.readComprBuffer(); d.setReadContext(&drc); vespalib::FileHeader header; d.readHeader(header, _file->getSize()); uint32_t headerLen = header.getSize(); assert(header.hasTag("frozen")); assert(header.hasTag("fileBitSize")); assert(header.hasTag("format.0")); assert(header.hasTag("format.1")); assert(!header.hasTag("format.2")); assert(header.hasTag("numWords")); assert(header.hasTag("minChunkDocs")); assert(header.hasTag("docIdLimit")); assert(header.hasTag("minSkipDocs")); assert(header.getTag("frozen").asInteger() != 0); _fileBitSize = header.getTag("fileBitSize").asInteger(); assert(header.getTag("format.0").asString() == identifier); assert(header.getTag("format.1").asString() == d.getIdentifier()); _numWords = header.getTag("numWords").asInteger(); _posting_params._min_chunk_docs = header.getTag("minChunkDocs").asInteger(); _posting_params._doc_id_limit = header.getTag("docIdLimit").asInteger(); _posting_params._min_skip_docs = header.getTag("minSkipDocs").asInteger(); if (header.hasTag(interleaved_features) && (header.getTag(interleaved_features).asInteger() != 0)) { _posting_params._encode_interleaved_features = true; } // Read feature decoding specific subheader d.readHeader(header, "features."); // Align on 64-bit unit d.smallAlign(64); headerLen += (-headerLen & 7); assert(d.getReadOffset() == headerLen * 8); _headerBitSize = d.getReadOffset(); } void ZcPosOccRandRead::readHeader() { readHeader<EGPosOccDecodeContext<true>>(myId5); } const vespalib::string & ZcPosOccRandRead::getIdentifier() { return myId5; } const vespalib::string & ZcPosOccRandRead::getSubIdentifier() { PosOccFieldsParams fieldsParams; EGPosOccDecodeContext<true> d(&fieldsParams); return d.getIdentifier(); } const FieldLengthInfo & ZcPosOccRandRead::get_field_length_info() const { return _fieldsParams.getFieldParams()->get_field_length_info(); } Zc4PosOccRandRead:: Zc4PosOccRandRead() : ZcPosOccRandRead() { _posting_params._dynamic_k = false; } void Zc4PosOccRandRead::readHeader() { readHeader<EG2PosOccDecodeContext<true> >(myId4); } const vespalib::string & Zc4PosOccRandRead::getIdentifier() { return myId4; } const vespalib::string & Zc4PosOccRandRead::getSubIdentifier() { PosOccFieldsParams fieldsParams; EG2PosOccDecodeContext<true> d(&fieldsParams); return d.getIdentifier(); } }
{ "pile_set_name": "Github" }
// Simple Example of Checked C, from Section 3.2.1 of the spec #include <stdchecked.h> int find(int key, array_ptr<int> a: count(len), int len) { for (int i = 0; i < len; i++) { if (a[i] == key) { return i; } } return -1; }
{ "pile_set_name": "Github" }
{ "view" : { "id" : 9873843 , "title" : "Roger Wilco II" } }
{ "pile_set_name": "Github" }
// Copyright 2020 The Kubeflow 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. // Code generated by lister-gen. DO NOT EDIT. package v1 import ( v1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // TFJobLister helps list TFJobs. type TFJobLister interface { // List lists all TFJobs in the indexer. List(selector labels.Selector) (ret []*v1.TFJob, err error) // TFJobs returns an object that can list and get TFJobs. TFJobs(namespace string) TFJobNamespaceLister TFJobListerExpansion } // tFJobLister implements the TFJobLister interface. type tFJobLister struct { indexer cache.Indexer } // NewTFJobLister returns a new TFJobLister. func NewTFJobLister(indexer cache.Indexer) TFJobLister { return &tFJobLister{indexer: indexer} } // List lists all TFJobs in the indexer. func (s *tFJobLister) List(selector labels.Selector) (ret []*v1.TFJob, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1.TFJob)) }) return ret, err } // TFJobs returns an object that can list and get TFJobs. func (s *tFJobLister) TFJobs(namespace string) TFJobNamespaceLister { return tFJobNamespaceLister{indexer: s.indexer, namespace: namespace} } // TFJobNamespaceLister helps list and get TFJobs. type TFJobNamespaceLister interface { // List lists all TFJobs in the indexer for a given namespace. List(selector labels.Selector) (ret []*v1.TFJob, err error) // Get retrieves the TFJob from the indexer for a given namespace and name. Get(name string) (*v1.TFJob, error) TFJobNamespaceListerExpansion } // tFJobNamespaceLister implements the TFJobNamespaceLister // interface. type tFJobNamespaceLister struct { indexer cache.Indexer namespace string } // List lists all TFJobs in the indexer for a given namespace. func (s tFJobNamespaceLister) List(selector labels.Selector) (ret []*v1.TFJob, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1.TFJob)) }) return ret, err } // Get retrieves the TFJob from the indexer for a given namespace and name. func (s tFJobNamespaceLister) Get(name string) (*v1.TFJob, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { return nil, errors.NewNotFound(v1.Resource("tfjob"), name) } return obj.(*v1.TFJob), nil }
{ "pile_set_name": "Github" }
;;; compare-w.el --- compare text between windows for Emacs ;; Copyright (C) 1986, 1989, 1993, 1997, 2001, 2002, 2003, 2004, ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: convenience files ;; This file is part of GNU Emacs. ;; GNU Emacs 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. ;; GNU Emacs 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 Emacs. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; This package provides one entry point, compare-windows. It compares ;; text starting from point in two adjacent windows, advancing point ;; until it finds a difference. Option variables permit you to ignore ;; whitespace differences, or case differences, or both. ;;; Code: (defgroup compare-windows nil "Compare text between windows." :prefix "compare-" :group 'tools) (defcustom compare-windows-whitespace "\\(\\s-\\|\n\\)+" "Regexp or function that defines whitespace sequences for `compare-windows'. That command optionally ignores changes in whitespace. The value of `compare-windows-whitespace' is normally a regexp, but it can also be a function. The function's job is to categorize any whitespace around (including before) point; it should also advance past any whitespace. The function is called in each window, with point at the current scanning point. It gets one argument, the point where \\[compare-windows] was originally called; it should not look at any text before that point. If the function returns the same value for both windows, then the whitespace is considered to match, and is skipped." :type '(choice regexp function) :group 'compare-windows) (defcustom compare-ignore-whitespace nil "Non-nil means `compare-windows' ignores whitespace." :type 'boolean :group 'compare-windows :version "22.1") (defcustom compare-ignore-case nil "Non-nil means `compare-windows' ignores case differences." :type 'boolean :group 'compare-windows) (defcustom compare-windows-sync 'compare-windows-sync-default-function "Function or regexp that is used to synchronize points in two windows if before calling `compare-windows' points are located on mismatched positions. The value of `compare-windows-sync' can be a function. The function's job is to advance points in both windows to the next matching text. If the value of `compare-windows-sync' is a regexp, then points in both windows are advanced to the next occurrence of this regexp. The current default value is the general function `compare-windows-sync-default-function' that is able to synchronize points by using quadratic algorithm to find the first matching 32-character string in two windows. The other useful values of this variable could be such functions as `forward-word', `forward-sentence', `forward-paragraph', or a regexp containing some field separator or a newline, depending on the nature of the difference units separator. The variable can be made buffer-local. If the value of this variable is `nil' (option \"No sync\"), then no synchronization is performed, and the function `ding' is called to beep or flash the screen when points are mismatched." :type '(choice function regexp (const :tag "No sync" nil)) :group 'compare-windows :version "22.1") (defcustom compare-windows-sync-string-size 32 "Size of string from one window that is searched in second window. Small number makes difference regions more fine-grained, but it may fail by finding the wrong match. The bigger number makes difference regions more coarse-grained. The default value 32 is good for the most cases." :type 'integer :group 'compare-windows :version "22.1") (defcustom compare-windows-recenter nil "List of two values, each of which is used as argument of function `recenter' called in each of two windows to place matching points side-by-side. The value `(-1 0)' is useful if windows are split vertically, and the value `((4) (4))' for horizontally split windows." :type '(list sexp sexp) :group 'compare-windows :version "22.1") (defcustom compare-windows-highlight t "Non-nil means compare-windows highlights the differences. The value t removes highlighting immediately after invoking a command other than `compare-windows'. The value `persistent' leaves all highlighted differences. You can clear out all highlighting later with the command `compare-windows-dehighlight'." :type '(choice (const :tag "No highlighting" nil) (const :tag "Persistent highlighting" persistent) (other :tag "Highlight until next command" t)) :group 'compare-windows :version "22.1") (defface compare-windows '((t :inherit lazy-highlight)) "Face for highlighting of compare-windows difference regions." :group 'compare-windows :version "22.1") (defvar compare-windows-overlay1 nil) (defvar compare-windows-overlay2 nil) (defvar compare-windows-overlays1 nil) (defvar compare-windows-overlays2 nil) (defvar compare-windows-sync-point nil) ;;;###autoload (defun compare-windows (ignore-whitespace) "Compare text in current window with text in next window. Compares the text starting at point in each window, moving over text in each one as far as they match. This command pushes the mark in each window at the prior location of point in that window. If both windows display the same buffer, the mark is pushed twice in that buffer: first in the other window, then in the selected window. A prefix arg means reverse the value of variable `compare-ignore-whitespace'. If `compare-ignore-whitespace' is nil, then a prefix arg means ignore changes in whitespace. If `compare-ignore-whitespace' is non-nil, then a prefix arg means don't ignore changes in whitespace. The variable `compare-windows-whitespace' controls how whitespace is skipped. If `compare-ignore-case' is non-nil, changes in case are also ignored. If `compare-windows-sync' is non-nil, then successive calls of this command work in interlaced mode: on first call it advances points to the next difference, on second call it synchronizes points by skipping the difference, on third call it again advances points to the next difference and so on." (interactive "P") (if compare-ignore-whitespace (setq ignore-whitespace (not ignore-whitespace))) (let* (p1 p2 maxp1 maxp2 b1 b2 w2 (progress 1) (opoint1 (point)) opoint2 skip-func-1 skip-func-2 (sync-func (if (stringp compare-windows-sync) 'compare-windows-sync-regexp compare-windows-sync))) (setq p1 (point) b1 (current-buffer)) (setq w2 (next-window (selected-window))) (if (eq w2 (selected-window)) (setq w2 (next-window (selected-window) nil 'visible))) (if (eq w2 (selected-window)) (error "No other window")) (setq p2 (window-point w2) b2 (window-buffer w2)) (setq opoint2 p2) (setq maxp1 (point-max)) (setq skip-func-1 (if ignore-whitespace (if (stringp compare-windows-whitespace) (lambda (pos) (compare-windows-skip-whitespace pos) t) compare-windows-whitespace))) (with-current-buffer b2 (setq skip-func-2 (if ignore-whitespace (if (stringp compare-windows-whitespace) (lambda (pos) (compare-windows-skip-whitespace pos) t) compare-windows-whitespace))) (push-mark p2 t) (setq maxp2 (point-max))) (push-mark) (while (> progress 0) ;; If both windows have whitespace next to point, ;; optionally skip over it. (and skip-func-1 (save-excursion (let (p1a p2a w1 w2 result1 result2) (setq result1 (funcall skip-func-1 opoint1)) (setq p1a (point)) (set-buffer b2) (goto-char p2) (setq result2 (funcall skip-func-2 opoint2)) (setq p2a (point)) (if (and result1 result2 (eq result1 result2)) (setq p1 p1a p2 p2a))))) (let ((size (min (- maxp1 p1) (- maxp2 p2))) (case-fold-search compare-ignore-case)) (setq progress (compare-buffer-substrings b2 p2 (+ size p2) b1 p1 (+ size p1))) (setq progress (if (zerop progress) size (1- (abs progress)))) (setq p1 (+ p1 progress) p2 (+ p2 progress))) ;; Advance point now rather than later, in case we're interrupted. (goto-char p1) (set-window-point w2 p2) (when compare-windows-recenter (recenter (car compare-windows-recenter)) (with-selected-window w2 (recenter (cadr compare-windows-recenter))))) (if (= (point) opoint1) (if (not sync-func) (ding) ;; If points are not advanced (i.e. already on mismatch position), ;; then synchronize points between both windows (save-excursion (setq compare-windows-sync-point nil) (funcall sync-func) (setq p1 (point)) (set-buffer b2) (goto-char p2) (funcall sync-func) (setq p2 (point))) (goto-char p1) (set-window-point w2 p2) (when compare-windows-recenter (recenter (car compare-windows-recenter)) (with-selected-window w2 (recenter (cadr compare-windows-recenter)))) ;; If points are still not synchronized, then ding (when (and (= p1 opoint1) (= p2 opoint2)) ;; Display error message when current points in two windows ;; are unmatched and next matching points can't be found. (compare-windows-dehighlight) (ding) (message "No more matching points")))))) ;; Move forward over whatever might be called whitespace. ;; compare-windows-whitespace is a regexp that matches whitespace. ;; Match it at various starting points before the original point ;; and find the latest point at which a match ends. ;; Don't try starting points before START, though. ;; Value is non-nil if whitespace is found. ;; If there is whitespace before point, but none after, ;; then return t, but don't advance point. (defun compare-windows-skip-whitespace (start) (let ((end (point)) (beg (point)) (opoint (point))) (while (or (and (looking-at compare-windows-whitespace) (<= end (match-end 0)) ;; This match goes past END, so advance END. (progn (setq end (match-end 0)) (> (point) start))) (and (/= (point) start) ;; Consider at least the char before point, ;; unless it is also before START. (= (point) opoint))) ;; keep going back until whitespace ;; doesn't extend to or past end (forward-char -1)) (setq beg (point)) (goto-char end) (or (/= beg opoint) (/= end opoint)))) ;; Move forward to the next synchronization regexp. (defun compare-windows-sync-regexp () (if (stringp compare-windows-sync) (re-search-forward compare-windows-sync nil t))) ;; Function works in two passes: one call on each window. ;; On the first call both matching points are computed, ;; and one of them is stored in compare-windows-sync-point ;; to be used when this function is called on second window. (defun compare-windows-sync-default-function () (if (not compare-windows-sync-point) (let* ((w1 (selected-window)) (w2 (next-window w1)) (b2 (window-buffer w2)) (point-max2 (with-current-buffer b2 (point-max))) (op2 (window-point w2)) (op1 (point)) (region-size compare-windows-sync-string-size) (string-size compare-windows-sync-string-size) in-bounds-p s1 p2 p12s p12) (while (and ;; until matching points are found (not p12s) ;; until size exceeds the maximum points of both buffers ;; (bounds below take care to not overdo in each of them) (or (setq in-bounds-p (< region-size (max (- (point-max) op1) (- point-max2 op2)))) ;; until string size becomes smaller than 4 (> string-size 4))) (if in-bounds-p ;; make the next search in the double-sized region; ;; on first iteration it is 2*compare-windows-sync-string-size, ;; on last iterations it exceeds both buffers maximum points (setq region-size (* region-size 2)) ;; if region size exceeds the maximum points of both buffers, ;; then start to halve the string size until 4; ;; this helps to find differences near the end of buffers (setq string-size (/ string-size 2))) (let ((p1 op1) (bound1 (- (min (+ op1 region-size) (point-max)) string-size)) (bound2 (min (+ op2 region-size) point-max2))) (while (< p1 bound1) (setq s1 (buffer-substring-no-properties p1 (+ p1 string-size))) (setq p2 (with-current-buffer b2 (goto-char op2) (let ((case-fold-search compare-ignore-case)) (search-forward s1 bound2 t)))) (when p2 (setq p2 (- p2 string-size)) (setq p12s (cons (list (+ p1 p2) p1 p2) p12s))) (setq p1 (1+ p1))))) (when p12s ;; use closest matching points (i.e. points with minimal sum) (setq p12 (cdr (assq (apply 'min (mapcar 'car p12s)) p12s))) (goto-char (car p12)) (compare-windows-highlight op1 (car p12) (current-buffer) w1 op2 (cadr p12) b2 w2)) (setq compare-windows-sync-point (or (cadr p12) t))) ;; else set point in the second window to the pre-calculated value (if (numberp compare-windows-sync-point) (goto-char compare-windows-sync-point)) (setq compare-windows-sync-point nil))) ;; Highlight differences (defun compare-windows-highlight (beg1 end1 b1 w1 beg2 end2 b2 w2) (when compare-windows-highlight (if compare-windows-overlay1 (move-overlay compare-windows-overlay1 beg1 end1 b1) (setq compare-windows-overlay1 (make-overlay beg1 end1 b1)) (overlay-put compare-windows-overlay1 'face 'compare-windows) (overlay-put compare-windows-overlay1 'priority 1000)) (overlay-put compare-windows-overlay1 'window w1) (if compare-windows-overlay2 (move-overlay compare-windows-overlay2 beg2 end2 b2) (setq compare-windows-overlay2 (make-overlay beg2 end2 b2)) (overlay-put compare-windows-overlay2 'face 'compare-windows) (overlay-put compare-windows-overlay2 'priority 1000)) (overlay-put compare-windows-overlay2 'window w2) (if (not (eq compare-windows-highlight 'persistent)) ;; Remove highlighting before next command is executed (add-hook 'pre-command-hook 'compare-windows-dehighlight) (when compare-windows-overlay1 (push (copy-overlay compare-windows-overlay1) compare-windows-overlays1) (delete-overlay compare-windows-overlay1)) (when compare-windows-overlay2 (push (copy-overlay compare-windows-overlay2) compare-windows-overlays2) (delete-overlay compare-windows-overlay2))))) (defun compare-windows-dehighlight () "Remove highlighting created by `compare-windows-highlight'." (interactive) (remove-hook 'pre-command-hook 'compare-windows-dehighlight) (mapc 'delete-overlay compare-windows-overlays1) (mapc 'delete-overlay compare-windows-overlays2) (and compare-windows-overlay1 (delete-overlay compare-windows-overlay1)) (and compare-windows-overlay2 (delete-overlay compare-windows-overlay2))) (provide 'compare-w) ;; arch-tag: 4177aab1-48e6-4a98-b7a1-000ee285de46 ;;; compare-w.el ends here
{ "pile_set_name": "Github" }
/* calcH.h Generated by gSOAP 2.8.10 from calc.h Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved. The generated code is released under one of the following licenses: 1) GPL or 2) Genivia's license for commercial use. This program is released under the GPL with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. */ #ifndef calcH_H #define calcH_H #include "calcStub.h" namespace calc { #ifndef WITH_NOIDREF SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap*, int*); SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap*); SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*); #endif SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*); SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap); SOAP_FMAC3 void * SOAP_FMAC4 calc_instantiate(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 int SOAP_FMAC4 calc_fdelete(struct soap_clist*); SOAP_FMAC3 void* SOAP_FMAC4 soap_class_id_enter(struct soap*, const char*, void*, int, size_t, const char*, const char*); #ifndef SOAP_TYPE_calc_byte #define SOAP_TYPE_calc_byte (3) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char *, const char*); SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char *, const char*); #ifndef soap_write_byte #define soap_write_byte(soap, data) ( soap_begin_send(soap) || calc::soap_put_byte(soap, data, "byte", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char *, const char*, const char*); #ifndef soap_read_byte #define soap_read_byte(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_byte(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap*, char *, const char*, const char*); #ifndef SOAP_TYPE_calc_int #define SOAP_TYPE_calc_int (1) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int *, const char*); SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap*, const char*, int *, const char*); #ifndef soap_write_int #define soap_write_int(soap, data) ( soap_begin_send(soap) || calc::soap_put_int(soap, data, "int", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int *, const char*, const char*); #ifndef soap_read_int #define soap_read_int(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_int(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const char*); #ifndef SOAP_TYPE_calc_double #define SOAP_TYPE_calc_double (7) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_double(struct soap*, double *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_double(struct soap*, const char*, int, const double *, const char*); SOAP_FMAC3 double * SOAP_FMAC4 soap_in_double(struct soap*, const char*, double *, const char*); #ifndef soap_write_double #define soap_write_double(soap, data) ( soap_begin_send(soap) || calc::soap_put_double(soap, data, "double", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_double(struct soap*, const double *, const char*, const char*); #ifndef soap_read_double #define soap_read_double(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_double(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 double * SOAP_FMAC4 soap_get_double(struct soap*, double *, const char*, const char*); #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_SOAP_ENV__Fault #define SOAP_TYPE_calc_SOAP_ENV__Fault (31) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*); SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault *, const char*); #ifndef soap_write_SOAP_ENV__Fault #define soap_write_SOAP_ENV__Fault(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_SOAP_ENV__Fault(soap, data), 0) || calc::soap_put_SOAP_ENV__Fault(soap, data, "SOAP-ENV:Fault", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*); #ifndef soap_read_SOAP_ENV__Fault #define soap_read_SOAP_ENV__Fault(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_SOAP_ENV__Fault(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *, const char*, const char*); #define soap_new_SOAP_ENV__Fault(soap, n) soap_instantiate_SOAP_ENV__Fault(soap, n, NULL, NULL, NULL) #define soap_delete_SOAP_ENV__Fault(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct SOAP_ENV__Fault * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Fault(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap*, int, int, void*, size_t, const void*, size_t); #endif #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_SOAP_ENV__Reason #define SOAP_TYPE_calc_SOAP_ENV__Reason (30) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*); SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*); #ifndef soap_write_SOAP_ENV__Reason #define soap_write_SOAP_ENV__Reason(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_SOAP_ENV__Reason(soap, data), 0) || calc::soap_put_SOAP_ENV__Reason(soap, data, "SOAP-ENV:Reason", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*); #ifndef soap_read_SOAP_ENV__Reason #define soap_read_SOAP_ENV__Reason(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_SOAP_ENV__Reason(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*); #define soap_new_SOAP_ENV__Reason(soap, n) soap_instantiate_SOAP_ENV__Reason(soap, n, NULL, NULL, NULL) #define soap_delete_SOAP_ENV__Reason(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct SOAP_ENV__Reason * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Reason(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap*, int, int, void*, size_t, const void*, size_t); #endif #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_SOAP_ENV__Detail #define SOAP_TYPE_calc_SOAP_ENV__Detail (27) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*); SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail *, const char*); #ifndef soap_write_SOAP_ENV__Detail #define soap_write_SOAP_ENV__Detail(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_SOAP_ENV__Detail(soap, data), 0) || calc::soap_put_SOAP_ENV__Detail(soap, data, "SOAP-ENV:Detail", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*); #ifndef soap_read_SOAP_ENV__Detail #define soap_read_SOAP_ENV__Detail(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_SOAP_ENV__Detail(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *, const char*, const char*); #define soap_new_SOAP_ENV__Detail(soap, n) soap_instantiate_SOAP_ENV__Detail(soap, n, NULL, NULL, NULL) #define soap_delete_SOAP_ENV__Detail(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct SOAP_ENV__Detail * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Detail(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap*, int, int, void*, size_t, const void*, size_t); #endif #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_SOAP_ENV__Code #define SOAP_TYPE_calc_SOAP_ENV__Code (25) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*); SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code *, const char*); #ifndef soap_write_SOAP_ENV__Code #define soap_write_SOAP_ENV__Code(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_SOAP_ENV__Code(soap, data), 0) || calc::soap_put_SOAP_ENV__Code(soap, data, "SOAP-ENV:Code", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*); #ifndef soap_read_SOAP_ENV__Code #define soap_read_SOAP_ENV__Code(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_SOAP_ENV__Code(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *, const char*, const char*); #define soap_new_SOAP_ENV__Code(soap, n) soap_instantiate_SOAP_ENV__Code(soap, n, NULL, NULL, NULL) #define soap_delete_SOAP_ENV__Code(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct SOAP_ENV__Code * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Code(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap*, int, int, void*, size_t, const void*, size_t); #endif #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_SOAP_ENV__Header #define SOAP_TYPE_calc_SOAP_ENV__Header (24) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*); SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header *, const char*); #ifndef soap_write_SOAP_ENV__Header #define soap_write_SOAP_ENV__Header(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_SOAP_ENV__Header(soap, data), 0) || calc::soap_put_SOAP_ENV__Header(soap, data, "SOAP-ENV:Header", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*); #ifndef soap_read_SOAP_ENV__Header #define soap_read_SOAP_ENV__Header(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_SOAP_ENV__Header(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *, const char*, const char*); #define soap_new_SOAP_ENV__Header(soap, n) soap_instantiate_SOAP_ENV__Header(soap, n, NULL, NULL, NULL) #define soap_delete_SOAP_ENV__Header(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct SOAP_ENV__Header * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Header(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap*, int, int, void*, size_t, const void*, size_t); #endif #ifndef SOAP_TYPE_calc_ns__pow #define SOAP_TYPE_calc_ns__pow (23) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__pow(struct soap*, struct ns__pow *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__pow(struct soap*, const struct ns__pow *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__pow(struct soap*, const char*, int, const struct ns__pow *, const char*); SOAP_FMAC3 struct ns__pow * SOAP_FMAC4 soap_in_ns__pow(struct soap*, const char*, struct ns__pow *, const char*); #ifndef soap_write_ns__pow #define soap_write_ns__pow(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__pow(soap, data), 0) || calc::soap_put_ns__pow(soap, data, "ns:pow", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__pow(struct soap*, const struct ns__pow *, const char*, const char*); #ifndef soap_read_ns__pow #define soap_read_ns__pow(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__pow(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__pow * SOAP_FMAC4 soap_get_ns__pow(struct soap*, struct ns__pow *, const char*, const char*); #define soap_new_ns__pow(soap, n) soap_instantiate_ns__pow(soap, n, NULL, NULL, NULL) #define soap_delete_ns__pow(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__pow * SOAP_FMAC2 soap_instantiate_ns__pow(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__pow(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__powResponse #define SOAP_TYPE_calc_ns__powResponse (22) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__powResponse(struct soap*, struct ns__powResponse *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__powResponse(struct soap*, const struct ns__powResponse *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__powResponse(struct soap*, const char*, int, const struct ns__powResponse *, const char*); SOAP_FMAC3 struct ns__powResponse * SOAP_FMAC4 soap_in_ns__powResponse(struct soap*, const char*, struct ns__powResponse *, const char*); #ifndef soap_write_ns__powResponse #define soap_write_ns__powResponse(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__powResponse(soap, data), 0) || calc::soap_put_ns__powResponse(soap, data, "ns:powResponse", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__powResponse(struct soap*, const struct ns__powResponse *, const char*, const char*); #ifndef soap_read_ns__powResponse #define soap_read_ns__powResponse(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__powResponse(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__powResponse * SOAP_FMAC4 soap_get_ns__powResponse(struct soap*, struct ns__powResponse *, const char*, const char*); #define soap_new_ns__powResponse(soap, n) soap_instantiate_ns__powResponse(soap, n, NULL, NULL, NULL) #define soap_delete_ns__powResponse(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__powResponse * SOAP_FMAC2 soap_instantiate_ns__powResponse(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__powResponse(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__div #define SOAP_TYPE_calc_ns__div (20) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__div(struct soap*, struct ns__div *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__div(struct soap*, const struct ns__div *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__div(struct soap*, const char*, int, const struct ns__div *, const char*); SOAP_FMAC3 struct ns__div * SOAP_FMAC4 soap_in_ns__div(struct soap*, const char*, struct ns__div *, const char*); #ifndef soap_write_ns__div #define soap_write_ns__div(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__div(soap, data), 0) || calc::soap_put_ns__div(soap, data, "ns:div", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__div(struct soap*, const struct ns__div *, const char*, const char*); #ifndef soap_read_ns__div #define soap_read_ns__div(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__div(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__div * SOAP_FMAC4 soap_get_ns__div(struct soap*, struct ns__div *, const char*, const char*); #define soap_new_ns__div(soap, n) soap_instantiate_ns__div(soap, n, NULL, NULL, NULL) #define soap_delete_ns__div(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__div * SOAP_FMAC2 soap_instantiate_ns__div(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__div(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__divResponse #define SOAP_TYPE_calc_ns__divResponse (19) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__divResponse(struct soap*, struct ns__divResponse *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__divResponse(struct soap*, const struct ns__divResponse *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__divResponse(struct soap*, const char*, int, const struct ns__divResponse *, const char*); SOAP_FMAC3 struct ns__divResponse * SOAP_FMAC4 soap_in_ns__divResponse(struct soap*, const char*, struct ns__divResponse *, const char*); #ifndef soap_write_ns__divResponse #define soap_write_ns__divResponse(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__divResponse(soap, data), 0) || calc::soap_put_ns__divResponse(soap, data, "ns:divResponse", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__divResponse(struct soap*, const struct ns__divResponse *, const char*, const char*); #ifndef soap_read_ns__divResponse #define soap_read_ns__divResponse(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__divResponse(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__divResponse * SOAP_FMAC4 soap_get_ns__divResponse(struct soap*, struct ns__divResponse *, const char*, const char*); #define soap_new_ns__divResponse(soap, n) soap_instantiate_ns__divResponse(soap, n, NULL, NULL, NULL) #define soap_delete_ns__divResponse(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__divResponse * SOAP_FMAC2 soap_instantiate_ns__divResponse(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__divResponse(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__mul #define SOAP_TYPE_calc_ns__mul (17) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__mul(struct soap*, struct ns__mul *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__mul(struct soap*, const struct ns__mul *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__mul(struct soap*, const char*, int, const struct ns__mul *, const char*); SOAP_FMAC3 struct ns__mul * SOAP_FMAC4 soap_in_ns__mul(struct soap*, const char*, struct ns__mul *, const char*); #ifndef soap_write_ns__mul #define soap_write_ns__mul(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__mul(soap, data), 0) || calc::soap_put_ns__mul(soap, data, "ns:mul", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__mul(struct soap*, const struct ns__mul *, const char*, const char*); #ifndef soap_read_ns__mul #define soap_read_ns__mul(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__mul(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__mul * SOAP_FMAC4 soap_get_ns__mul(struct soap*, struct ns__mul *, const char*, const char*); #define soap_new_ns__mul(soap, n) soap_instantiate_ns__mul(soap, n, NULL, NULL, NULL) #define soap_delete_ns__mul(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__mul * SOAP_FMAC2 soap_instantiate_ns__mul(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__mul(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__mulResponse #define SOAP_TYPE_calc_ns__mulResponse (16) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__mulResponse(struct soap*, struct ns__mulResponse *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__mulResponse(struct soap*, const struct ns__mulResponse *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__mulResponse(struct soap*, const char*, int, const struct ns__mulResponse *, const char*); SOAP_FMAC3 struct ns__mulResponse * SOAP_FMAC4 soap_in_ns__mulResponse(struct soap*, const char*, struct ns__mulResponse *, const char*); #ifndef soap_write_ns__mulResponse #define soap_write_ns__mulResponse(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__mulResponse(soap, data), 0) || calc::soap_put_ns__mulResponse(soap, data, "ns:mulResponse", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__mulResponse(struct soap*, const struct ns__mulResponse *, const char*, const char*); #ifndef soap_read_ns__mulResponse #define soap_read_ns__mulResponse(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__mulResponse(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__mulResponse * SOAP_FMAC4 soap_get_ns__mulResponse(struct soap*, struct ns__mulResponse *, const char*, const char*); #define soap_new_ns__mulResponse(soap, n) soap_instantiate_ns__mulResponse(soap, n, NULL, NULL, NULL) #define soap_delete_ns__mulResponse(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__mulResponse * SOAP_FMAC2 soap_instantiate_ns__mulResponse(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__mulResponse(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__sub #define SOAP_TYPE_calc_ns__sub (14) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__sub(struct soap*, struct ns__sub *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__sub(struct soap*, const struct ns__sub *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__sub(struct soap*, const char*, int, const struct ns__sub *, const char*); SOAP_FMAC3 struct ns__sub * SOAP_FMAC4 soap_in_ns__sub(struct soap*, const char*, struct ns__sub *, const char*); #ifndef soap_write_ns__sub #define soap_write_ns__sub(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__sub(soap, data), 0) || calc::soap_put_ns__sub(soap, data, "ns:sub", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__sub(struct soap*, const struct ns__sub *, const char*, const char*); #ifndef soap_read_ns__sub #define soap_read_ns__sub(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__sub(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__sub * SOAP_FMAC4 soap_get_ns__sub(struct soap*, struct ns__sub *, const char*, const char*); #define soap_new_ns__sub(soap, n) soap_instantiate_ns__sub(soap, n, NULL, NULL, NULL) #define soap_delete_ns__sub(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__sub * SOAP_FMAC2 soap_instantiate_ns__sub(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__sub(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__subResponse #define SOAP_TYPE_calc_ns__subResponse (13) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__subResponse(struct soap*, struct ns__subResponse *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__subResponse(struct soap*, const struct ns__subResponse *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__subResponse(struct soap*, const char*, int, const struct ns__subResponse *, const char*); SOAP_FMAC3 struct ns__subResponse * SOAP_FMAC4 soap_in_ns__subResponse(struct soap*, const char*, struct ns__subResponse *, const char*); #ifndef soap_write_ns__subResponse #define soap_write_ns__subResponse(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__subResponse(soap, data), 0) || calc::soap_put_ns__subResponse(soap, data, "ns:subResponse", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__subResponse(struct soap*, const struct ns__subResponse *, const char*, const char*); #ifndef soap_read_ns__subResponse #define soap_read_ns__subResponse(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__subResponse(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__subResponse * SOAP_FMAC4 soap_get_ns__subResponse(struct soap*, struct ns__subResponse *, const char*, const char*); #define soap_new_ns__subResponse(soap, n) soap_instantiate_ns__subResponse(soap, n, NULL, NULL, NULL) #define soap_delete_ns__subResponse(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__subResponse * SOAP_FMAC2 soap_instantiate_ns__subResponse(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__subResponse(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__add #define SOAP_TYPE_calc_ns__add (11) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__add(struct soap*, struct ns__add *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__add(struct soap*, const struct ns__add *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__add(struct soap*, const char*, int, const struct ns__add *, const char*); SOAP_FMAC3 struct ns__add * SOAP_FMAC4 soap_in_ns__add(struct soap*, const char*, struct ns__add *, const char*); #ifndef soap_write_ns__add #define soap_write_ns__add(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__add(soap, data), 0) || calc::soap_put_ns__add(soap, data, "ns:add", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__add(struct soap*, const struct ns__add *, const char*, const char*); #ifndef soap_read_ns__add #define soap_read_ns__add(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__add(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__add * SOAP_FMAC4 soap_get_ns__add(struct soap*, struct ns__add *, const char*, const char*); #define soap_new_ns__add(soap, n) soap_instantiate_ns__add(soap, n, NULL, NULL, NULL) #define soap_delete_ns__add(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__add * SOAP_FMAC2 soap_instantiate_ns__add(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__add(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_calc_ns__addResponse #define SOAP_TYPE_calc_ns__addResponse (10) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns__addResponse(struct soap*, struct ns__addResponse *); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns__addResponse(struct soap*, const struct ns__addResponse *); SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns__addResponse(struct soap*, const char*, int, const struct ns__addResponse *, const char*); SOAP_FMAC3 struct ns__addResponse * SOAP_FMAC4 soap_in_ns__addResponse(struct soap*, const char*, struct ns__addResponse *, const char*); #ifndef soap_write_ns__addResponse #define soap_write_ns__addResponse(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_ns__addResponse(soap, data), 0) || calc::soap_put_ns__addResponse(soap, data, "ns:addResponse", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns__addResponse(struct soap*, const struct ns__addResponse *, const char*, const char*); #ifndef soap_read_ns__addResponse #define soap_read_ns__addResponse(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_ns__addResponse(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct ns__addResponse * SOAP_FMAC4 soap_get_ns__addResponse(struct soap*, struct ns__addResponse *, const char*, const char*); #define soap_new_ns__addResponse(soap, n) soap_instantiate_ns__addResponse(soap, n, NULL, NULL, NULL) #define soap_delete_ns__addResponse(soap, p) soap_delete(soap, p) SOAP_FMAC1 struct ns__addResponse * SOAP_FMAC2 soap_instantiate_ns__addResponse(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns__addResponse(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_PointerToSOAP_ENV__Reason #define SOAP_TYPE_calc_PointerToSOAP_ENV__Reason (33) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*); SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *); SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*); #ifndef soap_write_PointerToSOAP_ENV__Reason #define soap_write_PointerToSOAP_ENV__Reason(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_PointerToSOAP_ENV__Reason(soap, data), 0) || calc::soap_put_PointerToSOAP_ENV__Reason(soap, data, "SOAP-ENV:Reason", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*); #ifndef soap_read_PointerToSOAP_ENV__Reason #define soap_read_PointerToSOAP_ENV__Reason(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_PointerToSOAP_ENV__Reason(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*); #endif #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_PointerToSOAP_ENV__Detail #define SOAP_TYPE_calc_PointerToSOAP_ENV__Detail (32) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*); SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char *, int, struct SOAP_ENV__Detail *const*, const char *); SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail **, const char*); #ifndef soap_write_PointerToSOAP_ENV__Detail #define soap_write_PointerToSOAP_ENV__Detail(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_PointerToSOAP_ENV__Detail(soap, data), 0) || calc::soap_put_PointerToSOAP_ENV__Detail(soap, data, "SOAP-ENV:Detail", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*, const char*, const char*); #ifndef soap_read_PointerToSOAP_ENV__Detail #define soap_read_PointerToSOAP_ENV__Detail(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_PointerToSOAP_ENV__Detail(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail **, const char*, const char*); #endif #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_calc_PointerToSOAP_ENV__Code #define SOAP_TYPE_calc_PointerToSOAP_ENV__Code (26) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*); SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char *, int, struct SOAP_ENV__Code *const*, const char *); SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code **, const char*); #ifndef soap_write_PointerToSOAP_ENV__Code #define soap_write_PointerToSOAP_ENV__Code(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_PointerToSOAP_ENV__Code(soap, data), 0) || calc::soap_put_PointerToSOAP_ENV__Code(soap, data, "SOAP-ENV:Code", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*, const char*, const char*); #ifndef soap_read_PointerToSOAP_ENV__Code #define soap_read_PointerToSOAP_ENV__Code(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_PointerToSOAP_ENV__Code(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code **, const char*, const char*); #endif #ifndef SOAP_TYPE_calc_PointerTodouble #define SOAP_TYPE_calc_PointerTodouble (8) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTodouble(struct soap*, double *const*); SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTodouble(struct soap*, const char *, int, double *const*, const char *); SOAP_FMAC3 double ** SOAP_FMAC4 soap_in_PointerTodouble(struct soap*, const char*, double **, const char*); #ifndef soap_write_PointerTodouble #define soap_write_PointerTodouble(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_PointerTodouble(soap, data), 0) || calc::soap_put_PointerTodouble(soap, data, "double", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTodouble(struct soap*, double *const*, const char*, const char*); #ifndef soap_read_PointerTodouble #define soap_read_PointerTodouble(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_PointerTodouble(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 double ** SOAP_FMAC4 soap_get_PointerTodouble(struct soap*, double **, const char*, const char*); #ifndef SOAP_TYPE_calc__QName #define SOAP_TYPE_calc__QName (5) #endif #define soap_default__QName(soap, a) soap_default_string(soap, a) #define soap_serialize__QName(soap, a) soap_serialize_string(soap, a) SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char*const*, const char*); SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char **, const char*); #ifndef soap_write__QName #define soap_write__QName(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize__QName(soap, data), 0) || calc::soap_put__QName(soap, data, "byte", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char *const*, const char*, const char*); #ifndef soap_read__QName #define soap_read__QName(soap, data) ( soap_begin_recv(soap) || !calc::soap_get__QName(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap*, char **, const char*, const char*); #ifndef SOAP_TYPE_calc_string #define SOAP_TYPE_calc_string (4) #endif SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **); SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char *const*); SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char*const*, const char*); SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*); #ifndef soap_write_string #define soap_write_string(soap, data) ( soap_begin_send(soap) || (calc::soap_serialize_string(soap, data), 0) || calc::soap_put_string(soap, data, "byte", NULL) || soap_end_send(soap) ) #endif SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char *const*, const char*, const char*); #ifndef soap_read_string #define soap_read_string(soap, data) ( soap_begin_recv(soap) || !calc::soap_get_string(soap, data, NULL, NULL) || soap_end_recv(soap) ) #endif SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap*, char **, const char*, const char*); } // namespace calc #endif /* End of calcH.h */
{ "pile_set_name": "Github" }
![glm](doc/logo.png) [OpenGL Mathematics](http://glm.g-truc.net/) (*GLM*) is a header only C++ mathematics library for graphics software based on the [OpenGL Shading Language (GLSL) specifications](https://www.opengl.org/registry/doc/GLSLangSpec.4.50.diff.pdf). *GLM* provides classes and functions designed and implemented with the same naming conventions and functionalities than *GLSL* so that anyone who knows *GLSL*, can use *GLM* as well in C++. This project isn't limited to *GLSL* features. An extension system, based on the *GLSL* extension conventions, provides extended capabilities: matrix transformations, quaternions, data packing, random numbers, noise, etc... This library works perfectly with *[OpenGL](https://www.opengl.org)* but it also ensures interoperability with other third party libraries and SDK. It is a good candidate for software rendering (raytracing / rasterisation), image processing, physic simulations and any development context that requires a simple and convenient mathematics library. *GLM* is written in C++98 but can take advantage of C++11 when supported by the compiler. It is a platform independent library with no dependence and it officially supports the following compilers: - [Apple Clang 4.0](https://developer.apple.com/library/mac/documentation/CompilerTools/Conceptual/LLVMCompilerOverview/index.html) and higher - [GCC](http://gcc.gnu.org/) 4.2 and higher - [Intel C++ Composer](https://software.intel.com/en-us/intel-compilers) XE 2013 and higher - [LLVM](http://llvm.org/) 3.0 and higher - [Visual C++](http://www.visualstudio.com/) 2010 and higher - [CUDA](https://developer.nvidia.com/about-cuda) 4.0 and higher (experimental) - Any conform C++98 or C++11 compiler For more information about *GLM*, please have a look at the [manual](http://glm.g-truc.net/0.9.7/glm-0.9.7.pdf) and the [API reference documentation](http://glm.g-truc.net/0.9.7/api/index.html). The source code and the documentation are licensed under the [Happy Bunny License (Modified MIT) or the MIT License](./copying.txt). Thanks for contributing to the project by [submitting issues](https://github.com/g-truc/glm/issues) for bug reports and feature requests. Any feedback is welcome at [[email protected]](mailto://[email protected]). ```c++ #include <glm/vec3.hpp> // glm::vec3 #include <glm/vec4.hpp> // glm::vec4 #include <glm/mat4x4.hpp> // glm::mat4 #include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective #include <glm/gtc/constant.hpp> // glm::pi glm::mat4 camera(float Translate, glm::vec2 const & Rotate) { glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.f); glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); return Projection * View * Model; } ``` ## Project Health | Service | System | Compiler | Status | | ------- | ------ | -------- | ------ | | [Drone](https://drone.io/github.com/g-truc/glm) | Linux 64 bits | GCC 4.6.3 | [![Build Status](https://drone.io/github.com/g-truc/glm/status.png)](https://drone.io/github.com/g-truc/glm/latest) | ## [Lastest release](https://github.com/g-truc/glm/releases/latest) ## Release notes #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07 ##### Improvements: - Improved constexpr for constant functions coverage #198 - Added to_string for quat and dual_quat in GTX_string_cast #375 - Improved overall execution time of unit tests #396 ##### Fixes: - Fixed strict alignment warnings #235 #370 - Fixed link errors on compilers not supported default function #377 - Fixed compilation warnings in vec4 - Fixed non-identity quaternions for equal vectors #234 - Fixed excessive GTX_fast_trigonometry execution time #396 - Fixed Visual Studio 2015 'hides class member' warnings #394 - Fixed builtin bitscan never being used #392 - Removed unused func_noise.* files #398 #### [GLM 0.9.7.0](https://github.com/g-truc/glm/releases/tag/0.9.7.0) - 2015-08-02 ##### Features: - Added GTC_color_space: convertLinearToSRGB and convertSRGBToLinear functions - Added 'fmod' overload to GTX_common with tests #308 - Left handed perspective and lookAt functions #314 - Added functions eulerAngleXYZ and extractEulerAngleXYZ #311 - Added <glm/gtx/hash.hpp> to perform std::hash on GLM types #320 #367 - Added <glm/gtx/wrap.hpp> for texcoord wrapping - Added static components and precision members to all vector and quat types #350 - Added .gitignore #349 - Added support of defaulted functions to GLM types, to use them in unions #366 ##### Improvements: - Changed usage of __has_include to support Intel compiler #307 - Specialized integer implementation of YCoCg-R #310 - Don't show status message in 'FindGLM' if 'QUIET' option is set. #317 - Added master branch continuous integration service on Linux 64 #332 - Clarified manual regarding angle unit in GLM, added FAQ 11 #326 - Updated list of compiler versions ##### Fixes: - Fixed default precision for quat and dual_quat type #312 - Fixed (u)int64 MSB/LSB handling on BE archs #306 - Fixed multi-line comment warning in g++. #315 - Fixed specifier removal by 'std::make_pair<>' #333 - Fixed perspective fovy argument documentation #327 - Removed -m64 causing build issues on Linux 32 #331 - Fixed isfinite with C++98 compilers #343 - Fixed Intel compiler build error on Linux #354 - Fixed use of libstdc++ with Clang #351 - Fixed quaternion pow #346 - Fixed decompose warnings #373 - Fixed matrix conversions #371 ##### Deprecation: - Removed integer specification for 'mod' in GTC_integer #308 - Removed GTX_multiple, replaced by GTC_round -------------------------------------------------------------------------------- #### [GLM 0.9.6.3](https://github.com/g-truc/glm/releases/tag/0.9.6.3) - 2015-02-15 - Fixed Android doesn't have C++ 11 STL #284 -------------------------------------------------------------------------------- #### [GLM 0.9.6.2](https://github.com/g-truc/glm/releases/tag/0.9.6.2) - 2015-02-15 ##### Features: - Added display of GLM version with other GLM_MESSAGES - Added ARM instruction set detection -------------------------------------------------------------------------------- ##### Improvements: - Removed assert for perspective with zFar < zNear #298 - Added Visual Studio natvis support for vec1, quat and dualqual types - Cleaned up C++11 feature detections - Clarify GLM licensing ##### Fixes: - Fixed faceforward build #289 - Fixed conflict with Xlib #define True 1 #293 - Fixed decompose function VS2010 templating issues #294 - Fixed mat4x3 = mat2x3 * mat4x2 operator #297 - Fixed warnings in F2x11_1x10 packing function in GTC_packing #295 - Fixed Visual Studio natvis support for vec4 #288 - Fixed GTC_packing *pack*norm*x* build and added tests #292 - Disabled GTX_scalar_multiplication for GCC, failing to build tests #242 - Fixed Visual C++ 2015 constexpr errors: Disabled only partial support - Fixed functions not inlined with Clang #302 - Fixed memory corruption (undefined behaviour) #303 -------------------------------------------------------------------------------- #### [GLM 0.9.6.1](https://github.com/g-truc/glm/releases/tag/0.9.6.1) - 2014-12-10 ##### Features: - Added GLM_LANG_CXX14_FLAG and GLM_LANG_CXX1Z_FLAG language feature flags - Added C++14 detection ##### Improvements: - Clean up GLM_MESSAGES compilation log to report only detected capabilities ##### Fixes: - Fixed scalar uaddCarry build error with Cuda #276 - Fixed C++11 explicit conversion operators detection #282 - Fixed missing explicit convertion when using integer log2 with *vec1 types - Fixed 64 bits integer GTX_string_cast to_string on VC 32 bit compiler - Fixed Android build issue, STL C++11 is not supported by the NDK #284 - Fixed unsupported _BitScanForward64 and _BitScanReverse64 in VC10 - Fixed Visual C++ 32 bit build #283 - Fixed GLM_FORCE_SIZE_FUNC pragma message - Fixed C++98 only build - Fixed conflict between GTX_compatibility and GTC_quaternion #286 - Fixed C++ language restriction using GLM_FORCE_CXX** -------------------------------------------------------------------------------- #### [GLM 0.9.6.0](https://github.com/g-truc/glm/releases/tag/0.9.6.0) - 2014-11-30 ##### Features: - Exposed template vector and matrix types in 'glm' namespace #239, #244 - Added GTX_scalar_multiplication for C++ 11 compiler only #242 - Added GTX_range for C++ 11 compiler only #240 - Added closestPointOnLine function for tvec2 to GTX_closest_point #238 - Added GTC_vec1 extension, *vec1 support to *vec* types - Updated GTX_associated_min_max with vec1 support - Added support of precision and integers to linearRand #230 - Added Integer types support to GTX_string_cast #249 - Added vec3 slerp #237 - Added GTX_common with isdenomal #223 - Added GLM_FORCE_SIZE_FUNC to replace .length() by .size() #245 - Added GLM_FORCE_NO_CTOR_INIT - Added 'uninitialize' to explicitly not initialize a GLM type - Added GTC_bitfield extension, promoted GTX_bit - Added GTC_integer extension, promoted GTX_bit and GTX_integer - Added GTC_round extension, promoted GTX_bit - Added GLM_FORCE_EXPLICIT_CTOR to require explicit type conversions #269 - Added GTX_type_aligned for aligned vector, matrix and quaternion types ##### Improvements: - Rely on C++11 to implement isinf and isnan - Removed GLM_FORCE_CUDA, Cuda is implicitly detected - Separated Apple Clang and LLVM compiler detection - Used pragma once - Undetected C++ compiler automatically compile with GLM_FORCE_CXX98 and GLM_FORCE_PURE - Added not function (from GLSL specification) on VC12 - Optimized bitfieldReverse and bitCount functions - Optimized findLSB and findMSB functions. - Optimized matrix-vector multiple performance with Cuda #257, #258 - Reduced integer type redifinitions #233 - Rewrited of GTX_fast_trigonometry #264 #265 - Made types trivially copyable #263 - Removed <iostream> in GLM tests - Used std features within GLM without redeclaring - Optimized cot function #272 - Optimized sign function #272 - Added explicit cast from quat to mat3 and mat4 #275 ##### Fixes: - Fixed std::nextafter not supported with C++11 on Android #217 - Fixed missing value_type for dual quaternion - Fixed return type of dual quaternion length - Fixed infinite loop in isfinite function with GCC #221 - Fixed Visual Studio 14 compiler warnings - Fixed implicit conversion from another tvec2 type to another tvec2 #241 - Fixed lack of consistency of quat and dualquat constructors - Fixed uaddCarray #253 - Fixed float comparison warnings #270 ##### Deprecation: - Removed degrees for function parameters - Removed GLM_FORCE_RADIANS, active by default - Removed VC 2005 / 8 and 2008 / 9 support - Removed GCC 3.4 to 4.3 support - Removed LLVM GCC support - Removed LLVM 2.6 to 3.1 support - Removed CUDA 3.0 to 3.2 support -------------------------------------------------------------------------------- #### [GLM 0.9.5.4 - 2014-06-21](https://github.com/g-truc/glm/releases/tag/0.9.5.4) - Fixed non-utf8 character #196 - Added FindGLM install for CMake #189 - Fixed GTX_color_space - saturation #195 - Fixed glm::isinf and glm::isnan for with Android NDK 9d #191 - Fixed builtin GLM_ARCH_SSE4 #204 - Optimized Quaternion vector rotation #205 - Fixed missing doxygen @endcond tag #211 - Fixed instruction set detection with Clang #158 - Fixed orientate3 function #207 - Fixed lerp when cosTheta is close to 1 in quaternion slerp #210 - Added GTX_io for io with <iostream> #144 - Fixed fastDistance ambiguity #215 - Fixed tweakedInfinitePerspective #208 and added user-defined epsilon to tweakedInfinitePerspective - Fixed std::copy and std::vector with GLM types #214 - Fixed strict aliasing issues #212, #152 - Fixed std::nextafter not supported with C++11 on Android #213 - Fixed corner cases in exp and log functions for quaternions #199 -------------------------------------------------------------------------------- #### GLM 0.9.5.3 - 2014-04-02 - Added instruction set auto detection with Visual C++ using _M_IX86_FP - /arch compiler argument - Fixed GTX_raw_data code dependency - Fixed GCC instruction set detection - Added GLM_GTX_matrix_transform_2d extension (#178, #176) - Fixed CUDA issues (#169, #168, #183, #182) - Added support for all extensions but GTX_string_cast to CUDA - Fixed strict aliasing warnings in GCC 4.8.1 / Android NDK 9c (#152) - Fixed missing bitfieldInterleave definisions - Fixed usubBorrow (#171) - Fixed eulerAngle*** not consistent for right-handed coordinate system (#173) - Added full tests for eulerAngle*** functions (#173) - Added workaround for a CUDA compiler bug (#186, #185) -------------------------------------------------------------------------------- #### GLM 0.9.5.2 - 2014-02-08 - Fixed initializer list ambiguity (#159, #160) - Fixed warnings with the Android NDK 9c - Fixed non power of two matrix products - Fixed mix function link error - Fixed SSE code included in GLM tests on "pure" platforms - Fixed undefined reference to fastInverseSqrt (#161) - Fixed GLM_FORCE_RADIANS with <glm/ext.hpp> build error (#165) - Fix dot product clamp range for vector angle functions. (#163) - Tentative fix for strict aliasing warning in GCC 4.8.1 / Android NDK 9c (#152) - Fixed GLM_GTC_constants description brief (#162) -------------------------------------------------------------------------------- #### GLM 0.9.5.1 - 2014-01-11 - Fixed angle and orientedAngle that sometimes return NaN values (#145) - Deprecated degrees for function parameters and display a message - Added possible static_cast conversion of GLM types (#72) - Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146) - Fixed mismatch between some declarations and definitions - Fixed inverse link error when using namespace glm; (#147) - Optimized matrix inverse and division code (#149) - Added intersectRayPlane function (#153) - Fixed outerProduct return type (#155) -------------------------------------------------------------------------------- #### GLM 0.9.5.0 - 2013-12-25 - Added forward declarations (glm/fwd.hpp) for faster compilations - Added per feature headers - Minimized GLM internal dependencies - Improved Intel Compiler detection - Added bitfieldInterleave and _mm_bit_interleave_si128 functions - Added GTX_scalar_relational - Added GTX_dual_quaternion - Added rotation function to GTX_quaternion (#22) - Added precision variation of each type - Added quaternion comparison functions - Fixed GTX_multiple for negative value - Removed GTX_ocl_type extension - Fixed post increment and decrement operators - Fixed perspective with zNear == 0 (#71) - Removed l-value swizzle operators - Cleaned up compiler detection code for unsupported compilers - Replaced C cast by C++ casts - Fixed .length() that should return a int and not a size_t - Added GLM_FORCE_SIZE_T_LENGTH and glm::length_t - Removed unnecessary conversions - Optimized packing and unpacking functions - Removed the normalization of the up argument of lookAt function (#114) - Added low precision specializations of inversesqrt - Fixed ldexp and frexp implementations - Increased assert coverage - Increased static_assert coverage - Replaced GLM traits by STL traits when possible - Allowed including individual core feature - Increased unit tests completness - Added creating of a quaternion from two vectors - Added C++11 initializer lists - Fixed umulExtended and imulExtended implementations for vector types (#76) - Fixed CUDA coverage for GTC extensions - Added GTX_io extension - Improved GLM messages enabled when defining GLM_MESSAGES - Hidden matrix _inverse function implementation detail into private section -------------------------------------------------------------------------------- #### [GLM 0.9.4.6](https://github.com/g-truc/glm/releases/tag/0.9.4.6) - 2013-09-20 - Fixed detection to select the last known compiler if newer version #106 - Fixed is_int and is_uint code duplication with GCC and C++11 #107 - Fixed test suite build while using Clang in C++11 mode - Added c++1y mode support in CMake test suite - Removed ms extension mode to CMake when no using Visual C++ - Added pedantic mode to CMake test suite for Clang and GCC - Added use of GCC frontend on Unix for ICC and Visual C++ fronted on Windows for ICC - Added compilation errors for unsupported compiler versions - Fixed glm::orientation with GLM_FORCE_RADIANS defined #112 - Fixed const ref issue on assignment operator taking a scalar parameter #116 - Fixed glm::eulerAngleY implementation #117 -------------------------------------------------------------------------------- #### GLM 0.9.4.5 - 2013-08-12 - Fixed CUDA support - Fixed inclusion of intrinsics in "pure" mode #92 - Fixed language detection on GCC when the C++0x mode isn't enabled #95 - Fixed issue #97: register is deprecated in C++11 - Fixed issue #96: CUDA issues - Added Windows CE detection #92 - Added missing value_ptr for quaternions #99 -------------------------------------------------------------------------------- #### GLM 0.9.4.4 - 2013-05-29 - Fixed slerp when costheta is close to 1 #65 - Fixed mat4x2 value_type constructor #70 - Fixed glm.natvis for Visual C++ 12 #82 - Added assert in inversesqrt to detect division by zero #61 - Fixed missing swizzle operators #86 - Fixed CUDA warnings #86 - Fixed GLM natvis for VC11 #82 - Fixed GLM_GTX_multiple with negative values #79 - Fixed glm::perspective when zNear is zero #71 -------------------------------------------------------------------------------- #### GLM 0.9.4.3 - 2013-03-20 - Detected qualifier for Clang - Fixed C++11 mode for GCC, couldn't be enabled without MS extensions - Fixed squad, intermediate and exp quaternion functions - Fixed GTX_polar_coordinates euclidean function, takes a vec2 instead of a vec3 - Clarify the license applying on the manual - Added a docx copy of the manual - Fixed GLM_GTX_matrix_interpolation - Fixed isnan and isinf on Android with Clang - Autodetected C++ version using __cplusplus value - Fixed mix for bool and bvec* third parameter -------------------------------------------------------------------------------- #### GLM 0.9.4.2 - 2013-02-14 - Fixed compAdd from GTX_component_wise - Fixed SIMD support for Intel compiler on Windows - Fixed isnan and isinf for CUDA compiler - Fixed GLM_FORCE_RADIANS on glm::perspective - Fixed GCC warnings - Fixed packDouble2x32 on XCode - Fixed mix for vec4 SSE implementation - Fixed 0x2013 dash character in comments that cause issue in Windows Japanese mode - Fixed documentation warnings - Fixed CUDA warnings -------------------------------------------------------------------------------- #### GLM 0.9.4.1 - 2012-12-22 - Improved half support: -0.0 case and implicit conversions - Fixed Intel Composer Compiler support on Linux - Fixed interaction between quaternion and euler angles - Fixed GTC_constants build - Fixed GTX_multiple - Fixed quat slerp using mix function when cosTheta close to 1 - Improved fvec4SIMD and fmat4x4SIMD implementations - Fixed assert messages - Added slerp and lerp quaternion functions and tests -------------------------------------------------------------------------------- #### GLM 0.9.4.0 - 2012-11-18 - Added Intel Composer Compiler support - Promoted GTC_espilon extension - Promoted GTC_ulp extension - Removed GLM website from the source repository - Added GLM_FORCE_RADIANS so that all functions takes radians for arguments - Fixed detection of Clang and LLVM GCC on MacOS X - Added debugger visualizers for Visual C++ 2012 -------------------------------------------------------------------------------- #### [GLM 0.9.3.4](https://github.com/g-truc/glm/releases/tag/0.9.3.4) - 2012-06-30 - Added SSE4 and AVX2 detection. - Removed VIRTREV_xstream and the incompatibility generated with GCC - Fixed C++11 compiler option for GCC - Removed MS language extension option for GCC (not fonctionnal) - Fixed bitfieldExtract for vector types - Fixed warnings - Fixed SSE includes -------------------------------------------------------------------------------- #### GLM 0.9.3.3 - 2012-05-10 - Fixed isinf and isnan - Improved compatibility with Intel compiler - Added CMake test build options: SIMD, C++11, fast math and MS land ext - Fixed SIMD mat4 test on GCC - Fixed perspectiveFov implementation - Fixed matrixCompMult for none-square matrices - Fixed namespace issue on stream operators - Fixed various warnings - Added VC11 support -------------------------------------------------------------------------------- #### GLM 0.9.3.2 - 2012-03-15 - Fixed doxygen documentation - Fixed Clang version detection - Fixed simd mat4 /= operator -------------------------------------------------------------------------------- #### GLM 0.9.3.1 - 2012-01-25 - Fixed platform detection - Fixed warnings - Removed detail code from Doxygen doc -------------------------------------------------------------------------------- #### GLM 0.9.3.0 - 2012-01-09 - Added CPP Check project - Fixed conflict with Windows headers - Fixed isinf implementation - Fixed Boost conflict - Fixed warnings -------------------------------------------------------------------------------- #### GLM 0.9.3.B - 2011-12-12 - Added support for Chrone Native Client - Added epsilon constant - Removed value_size function from vector types - Fixed roundEven on GCC - Improved API documentation - Fixed modf implementation - Fixed step function accuracy - Fixed outerProduct -------------------------------------------------------------------------------- #### GLM 0.9.3.A - 2011-11-11 - Improved doxygen documentation - Added new swizzle operators for C++11 compilers - Added new swizzle operators declared as functions - Added GLSL 4.20 length for vector and matrix types - Promoted GLM_GTC_noise extension: simplex, perlin, periodic noise functions - Promoted GLM_GTC_random extension: linear, gaussian and various random number generation distribution - Added GLM_GTX_constants: provides usefull constants - Added extension versioning - Removed many unused namespaces - Fixed half based type contructors - Added GLSL core noise functions -------------------------------------------------------------------------------- #### [GLM 0.9.2.7](https://github.com/g-truc/glm/releases/tag/0.9.2.7) - 2011-10-24 - Added more swizzling constructors - Added missing none-squared matrix products -------------------------------------------------------------------------------- #### [GLM 0.9.2.6](https://github.com/g-truc/glm/releases/tag/0.9.2.6) - 2011-10-01 - Fixed half based type build on old GCC - Fixed /W4 warnings on Visual C++ - Fixed some missing l-value swizzle operators -------------------------------------------------------------------------------- #### GLM 0.9.2.5 - 2011-09-20 - Fixed floatBitToXint functions - Fixed pack and unpack functions - Fixed round functions -------------------------------------------------------------------------------- #### GLM 0.9.2.4 - 2011-09-03 - Fixed extensions bugs -------------------------------------------------------------------------------- #### GLM 0.9.2.3 - 2011-06-08 - Fixed build issues -------------------------------------------------------------------------------- #### GLM 0.9.2.2 - 2011-06-02 - Expend matrix constructors flexibility - Improved quaternion implementation - Fixed many warnings across platforms and compilers -------------------------------------------------------------------------------- #### GLM 0.9.2.1 - 2011-05-24 - Automatically detect CUDA support - Improved compiler detection - Fixed errors and warnings in VC with C++ extensions disabled - Fixed and tested GLM_GTX_vector_angle - Fixed and tested GLM_GTX_rotate_vector -------------------------------------------------------------------------------- #### GLM 0.9.2.0 - 2011-05-09 - Added CUDA support - Added CTest test suite - Added GLM_GTX_ulp extension - Added GLM_GTX_noise extension - Added GLM_GTX_matrix_interpolation extension - Updated quaternion slerp interpolation -------------------------------------------------------------------------------- #### [GLM 0.9.1.3](https://github.com/g-truc/glm/releases/tag/0.9.1.3) - 2011-05-07 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.1.2 - 2011-04-15 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.1.1 - 2011-03-17 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.1.0 - 2011-03-03 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.1.B - 2011-02-13 - Updated API documentation - Improved SIMD implementation - Fixed Linux build -------------------------------------------------------------------------------- #### [GLM 0.9.0.8](https://github.com/g-truc/glm/releases/tag/0.9.0.8) - 2011-02-13 - Added quaternion product operator. - Clarify that GLM is a header only library. -------------------------------------------------------------------------------- #### GLM 0.9.1.A - 2011-01-31 - Added SIMD support - Added new swizzle functions - Improved static assert error message with C++0x static_assert - New setup system - Reduced branching - Fixed trunc implementation -------------------------------------------------------------------------------- #### [GLM 0.9.0.7](https://github.com/g-truc/glm/releases/tag/0.9.0.7) - 2011-01-30 - Added GLSL 4.10 packing functions - Added == and != operators for every types. -------------------------------------------------------------------------------- #### GLM 0.9.0.6 - 2010-12-21 - Many matrices bugs fixed -------------------------------------------------------------------------------- #### GLM 0.9.0.5 - 2010-11-01 - Improved Clang support - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.0.4 - 2010-10-04 - Added autoexp for GLM - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.0.3 - 2010-08-26 - Fixed non-squared matrix operators -------------------------------------------------------------------------------- #### GLM 0.9.0.2 - 2010-07-08 - Added GLM_GTX_int_10_10_10_2 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.0.1 - 2010-06-21 - Fixed extensions errors -------------------------------------------------------------------------------- #### GLM 0.9.0.0 - 2010-05-25 - Objective-C support - Fixed warnings - Updated documentation -------------------------------------------------------------------------------- #### GLM 0.9.B.2 - 2010-04-30 - Git transition - Removed experimental code from releases - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.9.B.1 - 2010-04-03 - Based on GLSL 4.00 specification - Added the new core functions - Added some implicit conversion support -------------------------------------------------------------------------------- #### GLM 0.9.A.2 - 2010-02-20 - Improved some possible errors messages - Improved declarations and definitions match -------------------------------------------------------------------------------- #### GLM 0.9.A.1 - 2010-02-09 - Removed deprecated features - Internal redesign -------------------------------------------------------------------------------- #### GLM 0.8.4.4 final - 2010-01-25 - Fixed warnings -------------------------------------------------------------------------------- #### GLM 0.8.4.3 final - 2009-11-16 - Fixed Half float arithmetic - Fixed setup defines -------------------------------------------------------------------------------- #### GLM 0.8.4.2 final - 2009-10-19 - Fixed Half float adds -------------------------------------------------------------------------------- #### GLM 0.8.4.1 final - 2009-10-05 - Updated documentation - Fixed MacOS X build -------------------------------------------------------------------------------- #### GLM 0.8.4.0 final - 2009-09-16 - Added GCC 4.4 and VC2010 support - Added matrix optimizations -------------------------------------------------------------------------------- #### GLM 0.8.3.5 final - 2009-08-11 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.8.3.4 final - 2009-08-10 - Updated GLM according GLSL 1.5 spec - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.8.3.3 final - 2009-06-25 - Fixed bugs -------------------------------------------------------------------------------- #### GLM 0.8.3.2 final - 2009-06-04 - Added GLM_GTC_quaternion - Added GLM_GTC_type_precision -------------------------------------------------------------------------------- #### GLM 0.8.3.1 final - 2009-05-21 - Fixed old extension system. -------------------------------------------------------------------------------- #### GLM 0.8.3.0 final - 2009-05-06 - Added stable extensions. - Added new extension system. -------------------------------------------------------------------------------- #### GLM 0.8.2.3 final - 2009-04-01 - Fixed bugs. -------------------------------------------------------------------------------- #### GLM 0.8.2.2 final - 2009-02-24 - Fixed bugs. -------------------------------------------------------------------------------- #### GLM 0.8.2.1 final - 2009-02-13 - Fixed bugs. -------------------------------------------------------------------------------- #### GLM 0.8.2 final - 2009-01-21 - Fixed bugs. -------------------------------------------------------------------------------- #### GLM 0.8.1 final - 2008-10-30 - Fixed bugs. -------------------------------------------------------------------------------- #### GLM 0.8.0 final - 2008-10-23 - New method to use extension. -------------------------------------------------------------------------------- #### GLM 0.8.0 beta3 - 2008-10-10 - Added CMake support for GLM tests. -------------------------------------------------------------------------------- #### GLM 0.8.0 beta2 - 2008-10-04 - Improved half scalars and vectors support. -------------------------------------------------------------------------------- #### GLM 0.8.0 beta1 - 2008-09-26 - Improved GLSL conformance - Added GLSL 1.30 support - Improved API documentation -------------------------------------------------------------------------------- #### GLM 0.7.6 final - 2008-08-08 - Improved C++ standard comformance - Added Static assert for types checking -------------------------------------------------------------------------------- #### GLM 0.7.5 final - 2008-07-05 - Added build message system with Visual Studio - Pedantic build with GCC -------------------------------------------------------------------------------- #### GLM 0.7.4 final - 2008-06-01 - Added external dependencies system. -------------------------------------------------------------------------------- #### GLM 0.7.3 final - 2008-05-24 - Fixed bugs - Added new extension group -------------------------------------------------------------------------------- #### GLM 0.7.2 final - 2008-04-27 - Updated documentation - Added preprocessor options -------------------------------------------------------------------------------- #### GLM 0.7.1 final - 2008-03-24 - Disabled half on GCC - Fixed extensions -------------------------------------------------------------------------------- #### GLM 0.7.0 final - 2008-03-22 - Changed to MIT license - Added new documentation -------------------------------------------------------------------------------- #### GLM 0.6.4 - 2007-12-10 - Fixed swizzle operators -------------------------------------------------------------------------------- #### GLM 0.6.3 - 2007-11-05 - Fixed type data accesses - Fixed 3DSMax sdk conflict -------------------------------------------------------------------------------- #### GLM 0.6.2 - 2007-10-08 - Fixed extension -------------------------------------------------------------------------------- #### GLM 0.6.1 - 2007-10-07 - Fixed a namespace error - Added extensions -------------------------------------------------------------------------------- #### GLM 0.6.0 : 2007-09-16 - Added new extension namespace mecanium - Added Automatic compiler detection -------------------------------------------------------------------------------- #### GLM 0.5.1 - 2007-02-19 - Fixed swizzle operators -------------------------------------------------------------------------------- #### GLM 0.5.0 - 2007-01-06 - Upgrated to GLSL 1.2 - Added swizzle operators - Added setup settings -------------------------------------------------------------------------------- #### GLM 0.4.1 - 2006-05-22 - Added OpenGL examples -------------------------------------------------------------------------------- #### GLM 0.4.0 - 2006-05-17 - Added missing operators to vec* and mat* - Added first GLSL 1.2 features - Fixed windows.h before glm.h when windows.h required -------------------------------------------------------------------------------- #### GLM 0.3.2 - 2006-04-21 - Fixed texcoord components access. - Fixed mat4 and imat4 division operators. -------------------------------------------------------------------------------- #### GLM 0.3.1 - 2006-03-28 - Added GCC 4.0 support under MacOS X. - Added GCC 4.0 and 4.1 support under Linux. - Added code optimisations. -------------------------------------------------------------------------------- #### GLM 0.3 - 2006-02-19 - Improved GLSL type conversion and construction compliance. - Added experimental extensions. - Added Doxygen Documentation. - Added code optimisations. - Fixed bugs. -------------------------------------------------------------------------------- #### GLM 0.2 - 2005-05-05 - Improve adaptative from GLSL. - Add experimental extensions based on OpenGL extension process. - Fixe bugs. -------------------------------------------------------------------------------- #### GLM 0.1 - 2005-02-21 - Add vec2, vec3, vec4 GLSL types - Add ivec2, ivec3, ivec4 GLSL types - Add bvec2, bvec3, bvec4 GLSL types - Add mat2, mat3, mat4 GLSL types - Add almost all functions
{ "pile_set_name": "Github" }
import React, { Component } from 'react'; import OpenViduVideoComponent from './OvVideo'; import './UserVideo.css'; export default class UserVideoComponent extends Component { getNicknameTag() { // Gets the nickName of the user return JSON.parse(this.props.streamManager.stream.connection.data).clientData; } render() { return ( <div> {this.props.streamManager !== undefined ? ( <div className="streamcomponent"> <OpenViduVideoComponent streamManager={this.props.streamManager} /> <div><p>{this.getNicknameTag()}</p></div> </div> ) : null} </div> ); } }
{ "pile_set_name": "Github" }
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M22 6.98V16c0 1.1-.9 2-2 2H6l-4 4V4c0-1.1.9-2 2-2h10.1c-.06.32-.1.66-.1 1 0 2.76 2.24 5 5 5 1.13 0 2.16-.39 3-1.02zM16 3c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z" /> , 'MarkChatUnreadRounded');
{ "pile_set_name": "Github" }
#!/usr/bin/env python # # Copyright 2015 Free Software Foundation, Inc. # # SPDX-License-Identifier: GPL-3.0-or-later # # ''' [0] Erdal Arikan: 'Channel Polarization: A Method for Constructing Capacity-Achieving Codes for Symmetric Binary-Input Memoryless Channels', 2009 foundational paper for polar codes. ''' from .channel_construction_bec import calculate_bec_channel_capacities from .channel_construction_bec import design_snr_to_bec_eta from .channel_construction_bec import bhattacharyya_bounds from .helper_functions import * try: from .channel_construction_awgn import tal_vardy_tpm_algorithm except ImportError: print("SciPy missing. Overwrite Tal-Vardy algorithm with BEC approximation") def tal_vardy_tpm_algorithm(block_size, design_snr, mu): return bhattacharyya_bounds(design_snr, block_size) Z_PARAM_FIRST_HEADER_LINE = "Bhattacharyya parameters (Z-parameters) for a polar code" def get_frozen_bit_indices_from_capacities(chan_caps, nfrozen): indexes = np.array([], dtype=int) while indexes.size < nfrozen: index = np.argmin(chan_caps).astype(int) indexes = np.append(indexes, index) chan_caps[index] = 2.0 # make absolutely sure value is out of range! return np.sort(indexes) def get_frozen_bit_indices_from_z_parameters(z_params, nfrozen): indexes = np.array([], dtype=int) while indexes.size < nfrozen: index = np.argmax(z_params).astype(int) indexes = np.append(indexes, index) z_params[index] = -1.0 return np.sort(indexes) def get_bec_frozen_indices(nblock, kfrozen, eta): bec_caps = calculate_bec_channel_capacities(eta, nblock) positions = get_frozen_bit_indices_from_capacities(bec_caps, kfrozen) return positions def get_frozen_bit_mask(frozen_indices, block_size): frozen_mask = np.zeros(block_size, dtype=int) frozen_mask[frozen_indices] = 1 return frozen_mask def frozen_bit_positions(block_size, info_size, design_snr=0.0): if not design_snr > -1.5917: print('bad value for design_nsr, must be > -1.5917! default=0.0') design_snr = 0.0 eta = design_snr_to_bec_eta(design_snr) return get_bec_frozen_indices(block_size, block_size - info_size, eta) def generate_filename(block_size, design_snr, mu): filename = "polar_code_z_parameters_N" + str(int(block_size)) filename += "_SNR" + str(float(design_snr)) + "_MU" + str(int(mu)) + ".polar" return filename def default_dir(): dir_def = "~/.gnuradio/polar/" import os path = os.path.expanduser(dir_def) try: os.makedirs(path) except OSError: if not os.path.isdir(path): raise return path def save_z_parameters(z_params, block_size, design_snr, mu, alt_construction_method='Tal-Vardy algorithm'): path = default_dir() filename = generate_filename(block_size, design_snr, mu) header = Z_PARAM_FIRST_HEADER_LINE + "\n" header += "Channel construction method: " + alt_construction_method + "\n" header += "Parameters:\n" header += "block_size=" + str(block_size) + "\n" header += "design_snr=" + str(design_snr) + "\n" header += "mu=" + str(mu) np.savetxt(path + filename, z_params, header=header) def load_z_parameters(block_size, design_snr, mu): path = default_dir() filename = generate_filename(block_size, design_snr, mu) full_file = path + filename import os if not os.path.isfile(full_file): z_params = tal_vardy_tpm_algorithm(block_size, design_snr, mu) save_z_parameters(z_params, block_size, design_snr, mu) z_params = np.loadtxt(full_file) return z_params def main(): np.set_printoptions(precision=3, linewidth=150) print('channel construction Bhattacharyya bounds by Arikan') n = 10 m = 2 ** n k = m // 2 design_snr = 0.0 mu = 32 z_params = load_z_parameters(m, design_snr, mu) z_bounds = bhattacharyya_bounds(design_snr, m) print(z_params[-10:]) if 0: import matplotlib.pyplot as plt plt.plot(z_params) plt.plot(z_bounds) plt.show() if __name__ == '__main__': main()
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="refresh" content="0;URL=../../../std/sync/struct.RwLockReadGuard.html"> </head> <body> <p>Redirecting to <a href="../../../std/sync/struct.RwLockReadGuard.html">../../../std/sync/struct.RwLockReadGuard.html</a>...</p> <script>location.replace("../../../std/sync/struct.RwLockReadGuard.html" + location.search + location.hash);</script> </body> </html>
{ "pile_set_name": "Github" }
AW;;அரூபா AF;;ஆப்கானிஸ்தான் AO;;அங்கோலா AI;;அங்குல்லா AX;;அலண்ட் தீவுகள் AL;;அல்பேனியா AD;;அன்டோரா AE;;ஐக்கிய அராபிய எமிரேட்சு AR;;அர்ஜென்டினா AM;;அர்மெனியா AS;;அமெரிக்க சமோவா AQ;;அண்டார்ட்டிக்கா TF;;ஃப்ரெஞ்ச் தெற்கு பிரதேசம் AG;;ஆன்டிகுவா மற்றும் பார்புடா AU;;ஆஸ்திரேலியா AT;;ஆஸ்திரியா AZ;;அசர்பைசான் BI;;புருண்டி BE;;பெல்ஜியம் BJ;;பெனின் BQ;;Bonaire, Sint Eustatius and Saba BF;;பர்கினோ பாஸோ BD;;வங்காளதேசம் BG;;பல்கேரியா BH;;பஹ்ரெயின் BS;;பஹாமாஸ் BA;;போஸ்னியா ஹெர்ஸிகோவினா BL;;செயின்ட் பார்த்லெமி BY;;பெலாருஸ் BZ;;பெலிஸ் BM;;பெர்முடா BO;;பொலிவியா BR;;பிரேசில் BB;;பார்படாஸ் BN;;ப்ரூனே தருசலம் BT;;பூட்டான் BV;;போவெட் தீவு BW;;போட்ஸ்வானா CF;;மத்திய ஆப்ரிக்க குடியரசு CA;;கனடா CC;;கோகோஸ்(கீலிங்) தீவு CH;;சுவிட்சர்லாந்து CL;;சிலி CN;;சீனா CI;;கோத் ட்லவோர் CM;;கேமரூன் CD;;காங்கோ குடியரசு CG;;காங்கோ CK;;குக் தீவு CO;;கொலம்பியா KM;;கோமரோஸ் CV;;கேப் வெர்டி CR;;கோஸ்டாரிகா CU;;க்யூபா CW;;Curaçao CX;;கிறிஸ்துமஸ் தீவு KY;;கேமான் தீவுகள் CY;;சைப்ரஸ் CZ;;Czechia DE;;ஜெர்மனி DJ;;சிபூட்டி DM;;டொமினிக்கா DK;;டென்மார்க் DO;;டொமினிக்கன் குடியரசு DZ;;அல்ஜீரியா EC;;ஈக்வடார் EG;;எகிப்து ER;;எரிட்ரேயா EH;;மேற்கு சஹாரா ES;;ஸ்பெயின் EE;;எசுதோனியா ET;;எதியோப்பியா FI;;பின்லாந்து FJ;;பிஜி FK;;பாக்லான்ட் தீவுகள் (மால்வினாஸ்) FR;;ஃப்ரான்ஸ் FO;;பேரோ தீவுகள் FM;;மைக்ரோனிஸியா கூட்டு நாடுகள் GA;;கபோன் GB;;ஐக்கிய இராஜ்ஜியம் GE;;ஜார்ஜியா GG;;க்ரென்சி GH;;கானா GI;;கிப்ரால்டர் GN;;கினி GP;;காஉடிலொபி GM;;கம்பியா GW;;கினி-பீசோ GQ;;ஈக்குவிடோரியல் கினி GR;;கிரீஸ் GD;;கிரனாடா GL;;கிரீன்லாந்து GT;;குவாதமாலா GF;;ஃப்ரெஞ்ச் கையானா GU;;குவாம் GY;;கயானா HK;;ஹாங்காங் HM;;ஹெர்ட் தீவு மற்றும் மெக் டொனால்ட் தீவுகள் HN;;ஹோன்டுராஸ் HR;;குரோவேசியா HT;;கையிட்டி HU;;ஹங்கேரி ID;;இந்தோனேசியா IM;;ஐல் ஆஃப் மேன் IN;;இந்தியா IO;;ப்ரிட்டிஷ் இந்திய பெருங்கடல் பிரதேசம் IE;;அயர்லாந்து IR;;ஈரான், இஸ்லாமிக் குடியரசு IQ;;ஈராக் IS;;ஐஸ்லாந்து IL;;இஸ்ரேல் IT;;இத்தாலி JM;;ஜமைக்கா JE;;ஜெர்சி JO;;ஜோர்டான் JP;;ஜப்பான் KZ;;கசகிஸ்தான் KE;;கென்யா KG;;கிரைகிசுத்தான் KH;;கம்போடியா KI;;கிரிபாடி KN;;செயின்ட் கிட்ஸ் மற்றும் நிவிஸ் KR;;கொரிய குடியரசு KW;;குவைத் LA;;லவொ மக்கள் சுதந்திர குடியரசு LB;;லெபனான் LR;;லைபீரியா LY;;லைபீரியா LC;;செயின்ட் லூசியா LI;;லீச்சென்சுதீன் LK;;இலங்கை LS;;லெசோதோ LT;;லிதுவேனியா LU;;லக்ஸம்பர்க் LV;;லட்வியா MO;;மகாவோ MF;;செயின் மார்டின் (பிரெஞ்சு பகுதி) MA;;மொரோக்கோ MC;;மொனாக்கோ MD;;மோல்டோவா MG;;மடகாஸ்கர் MV;;மாலதீவுகள் MX;;மெக்ஸிகோ MH;;மார்சல் தீவுகள் MK;;புதிய கலிடோனியா ML;;மாலி MT;;மால்டா MM;;மியான்மர் ME;;மோன்டே நெக்ரோ MN;;மங்கோலியா MP;;வட மரியானா தீவுகள் MZ;;மொசாம்பிக் MR;;மொரிசியேனியா MS;;மொன்சாராட் MQ;;மார்டினீக்கு MU;;மொரீஷியஸ் MW;;மலாவி MY;;மலேசியா YT;;மயோதி NA;;நமீபியா NC;;புதிய கலிடோனியா NE;;நைகர் NF;;நொர்ஃபோக் தீவு NG;;நைஜீரியா NI;;நிகராகுவா NU;;நியூ NL;;நெதர்லாந்து NO;;நார்வே NP;;நேபாளம் NR;;நௌரு NZ;;நியூசிலாந்து OM;;ஓமான் PK;;பாகிஸ்தான் PA;;பனாமா PN;;பிட்கேரின் PE;;பெரு PH;;பிலிப்பைன்ஸ் PW;;பலாவு PG;;பாப்புவா-நியூகினி PL;;போலந்து PR;;போர்ட்டோ ரீக்கோ KP;;கொரிய ஜனநாயக மக்கள் குடியரசு PT;;போர்ச்சுகல் PY;;பராகுவே PS;;Palestine, State of PF;;ஃப்ரெஞ்ச் பாலினேசியா QA;;கதார் RE;;ரீயூனியன் RO;;ரோமானியா RU;;ரஷ்யன் கூட்டமைப்பு RW;;ருவாண்டா SA;;சவூதி அரேபியா SD;;சூடான் SN;;செனகல் SG;;சிங்கப்பூர் GS;;தெற்கு ஜார்ஜியா மற்றும் தெற்கு சான்ட்விட்ச் SH;;Saint Helena, Ascension and Tristan da Cunha SJ;;சவால்பார்ட் மற்றும் ஜன் மேயன் SB;;சாலமன் தீவுகள் SL;;சியராலியோன் SV;;எல் சால்வடார் SM;;சான் மரீனோ SO;;சோமாலியா PM;;செயின்ட் பியார் மற்றும் மிக்யுலன் RS;;செர்பியா SS;;சூடான் குடியரசு ST;;சோ டோமி மற்றும் பிரின்சிபி SR;;சூரினாம் SK;;சுலோவேக்கியா SI;;ஸ்லோவேனியா SE;;சுவீடன் SZ;;Eswatini SX;;செயின் மார்டின் (பிரெஞ்சு பகுதி) SC;;சீசெல்சு SY;;சிரியன் அரபு குடியரசு TC;;துருக்கஸ் மற்றும் கைசோஸ் தீவுகள் TD;;சாட் TG;;டோகோ TH;;தாய்லாந்து TJ;;தசிக்கிசுதான் TK;;டோகெலௌ TM;;துர்க்மெனிஸ்தான் TL;;திமோர்-லெஸ்டி TO;;டொங்கா TT;;ட்ரைனிடேட் மற்றும் டோபேகோ TN;;துனீசியா TR;;துருக்கி TV;;துவாலு TW;;தாய்வான் TZ;;Tanzania UG;;உகாண்டா UA;;உக்ரெயின் UM;;ஐக்கிய நாடுகள் சிறு சுற்றியுள்ள தீவுகள் UY;;உருகுவே US;;ஐக்கிய அமெரிக்கா UZ;;உஸ்பெகிஸ்தான் VA;;ஹொலி சி (வாடிகன் நகர நாடு) VC;;செயின்ட் வின்சென்ட் மற்றும் க்ரினடின்ஸ் VE;;வெனிசூலா VG;;வெர்ஜின் தீவுகள், ப்ரிட்டீஷ் VI;;வெர்ஜின் தீவுகள் , யு.எஸ் VN;;வியட்னாம் VU;;வனாட்டு WF;;வாலிஸ் மற்றும் ப்யூடுனா WS;;சமோவா YE;;யேமன் ZA;;தென் ஆப்ரிக்கா ZM;;சாம்பியா ZW;;ஜிம்பாப்வே
{ "pile_set_name": "Github" }
# Contribution Guidelines Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms. --- Please ensure that: - The submitted tool is related to webpack – not to web performance in general. If the tool is not related to webpack, you may want to submit it to the [`awesome-wpo`](https://github.com/davidsonfellipe/awesome-wpo) or [`webpack-libs-optimizations`](https://github.com/GoogleChromeLabs/webpack-libs-optimizations) repos. - The submitted plugin or loader has at least 1000+ weekly downloads. There’re lots of useful tools out there, but including every webpack plugin into this repo will actually make it less helpful! To ensure the list stays helpful for most people, we’ve set the downloads limit as the acceptance criterion. Thank you for your suggestions! ## Updating your PR A lot of times, making a PR adhere to the standards above can be difficult. If the maintainers notice anything that we’d like changed, we’ll ask you to edit your PR before we merge it. There’s no need to open a new PR, just edit the existing one. If you’re not sure how to do that, [here is a guide](https://github.com/RichardLitt/knowledge/blob/master/github/amending-a-commit-guide.md) on the different ways you can update your PR so that we can merge it.
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 1ba8d1176c817374b97c04409a853fc5 timeCreated: 1494348128 licenseType: Free MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
#pragma once // MESSAGE GIMBAL_TORQUE_CMD_REPORT PACKING #define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT 214 MAVPACKED( typedef struct __mavlink_gimbal_torque_cmd_report_t { int16_t rl_torque_cmd; /*< Roll Torque Command.*/ int16_t el_torque_cmd; /*< Elevation Torque Command.*/ int16_t az_torque_cmd; /*< Azimuth Torque Command.*/ uint8_t target_system; /*< System ID.*/ uint8_t target_component; /*< Component ID.*/ }) mavlink_gimbal_torque_cmd_report_t; #define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN 8 #define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN 8 #define MAVLINK_MSG_ID_214_LEN 8 #define MAVLINK_MSG_ID_214_MIN_LEN 8 #define MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC 69 #define MAVLINK_MSG_ID_214_CRC 69 #if MAVLINK_COMMAND_24BIT #define MAVLINK_MESSAGE_INFO_GIMBAL_TORQUE_CMD_REPORT { \ 214, \ "GIMBAL_TORQUE_CMD_REPORT", \ 5, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_gimbal_torque_cmd_report_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_gimbal_torque_cmd_report_t, target_component) }, \ { "rl_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_gimbal_torque_cmd_report_t, rl_torque_cmd) }, \ { "el_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_gimbal_torque_cmd_report_t, el_torque_cmd) }, \ { "az_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_gimbal_torque_cmd_report_t, az_torque_cmd) }, \ } \ } #else #define MAVLINK_MESSAGE_INFO_GIMBAL_TORQUE_CMD_REPORT { \ "GIMBAL_TORQUE_CMD_REPORT", \ 5, \ { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_gimbal_torque_cmd_report_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_gimbal_torque_cmd_report_t, target_component) }, \ { "rl_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_gimbal_torque_cmd_report_t, rl_torque_cmd) }, \ { "el_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_gimbal_torque_cmd_report_t, el_torque_cmd) }, \ { "az_torque_cmd", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_gimbal_torque_cmd_report_t, az_torque_cmd) }, \ } \ } #endif /** * @brief Pack a gimbal_torque_cmd_report message * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * * @param target_system System ID. * @param target_component Component ID. * @param rl_torque_cmd Roll Torque Command. * @param el_torque_cmd Elevation Torque Command. * @param az_torque_cmd Azimuth Torque Command. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, int16_t rl_torque_cmd, int16_t el_torque_cmd, int16_t az_torque_cmd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN]; _mav_put_int16_t(buf, 0, rl_torque_cmd); _mav_put_int16_t(buf, 2, el_torque_cmd); _mav_put_int16_t(buf, 4, az_torque_cmd); _mav_put_uint8_t(buf, 6, target_system); _mav_put_uint8_t(buf, 7, target_component); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); #else mavlink_gimbal_torque_cmd_report_t packet; packet.rl_torque_cmd = rl_torque_cmd; packet.el_torque_cmd = el_torque_cmd; packet.az_torque_cmd = az_torque_cmd; packet.target_system = target_system; packet.target_component = target_component; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); #endif msg->msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); } /** * @brief Pack a gimbal_torque_cmd_report message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param target_system System ID. * @param target_component Component ID. * @param rl_torque_cmd Roll Torque Command. * @param el_torque_cmd Elevation Torque Command. * @param az_torque_cmd Azimuth Torque Command. * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system,uint8_t target_component,int16_t rl_torque_cmd,int16_t el_torque_cmd,int16_t az_torque_cmd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN]; _mav_put_int16_t(buf, 0, rl_torque_cmd); _mav_put_int16_t(buf, 2, el_torque_cmd); _mav_put_int16_t(buf, 4, az_torque_cmd); _mav_put_uint8_t(buf, 6, target_system); _mav_put_uint8_t(buf, 7, target_component); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); #else mavlink_gimbal_torque_cmd_report_t packet; packet.rl_torque_cmd = rl_torque_cmd; packet.el_torque_cmd = el_torque_cmd; packet.az_torque_cmd = az_torque_cmd; packet.target_system = target_system; packet.target_component = target_component; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); #endif msg->msgid = MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT; return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); } /** * @brief Encode a gimbal_torque_cmd_report struct * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * @param gimbal_torque_cmd_report C-struct to read the message contents from */ static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) { return mavlink_msg_gimbal_torque_cmd_report_pack(system_id, component_id, msg, gimbal_torque_cmd_report->target_system, gimbal_torque_cmd_report->target_component, gimbal_torque_cmd_report->rl_torque_cmd, gimbal_torque_cmd_report->el_torque_cmd, gimbal_torque_cmd_report->az_torque_cmd); } /** * @brief Encode a gimbal_torque_cmd_report struct on a channel * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param gimbal_torque_cmd_report C-struct to read the message contents from */ static inline uint16_t mavlink_msg_gimbal_torque_cmd_report_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) { return mavlink_msg_gimbal_torque_cmd_report_pack_chan(system_id, component_id, chan, msg, gimbal_torque_cmd_report->target_system, gimbal_torque_cmd_report->target_component, gimbal_torque_cmd_report->rl_torque_cmd, gimbal_torque_cmd_report->el_torque_cmd, gimbal_torque_cmd_report->az_torque_cmd); } /** * @brief Send a gimbal_torque_cmd_report message * @param chan MAVLink channel to send the message * * @param target_system System ID. * @param target_component Component ID. * @param rl_torque_cmd Roll Torque Command. * @param el_torque_cmd Elevation Torque Command. * @param az_torque_cmd Azimuth Torque Command. */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS static inline void mavlink_msg_gimbal_torque_cmd_report_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t rl_torque_cmd, int16_t el_torque_cmd, int16_t az_torque_cmd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN]; _mav_put_int16_t(buf, 0, rl_torque_cmd); _mav_put_int16_t(buf, 2, el_torque_cmd); _mav_put_int16_t(buf, 4, az_torque_cmd); _mav_put_uint8_t(buf, 6, target_system); _mav_put_uint8_t(buf, 7, target_component); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); #else mavlink_gimbal_torque_cmd_report_t packet; packet.rl_torque_cmd = rl_torque_cmd; packet.el_torque_cmd = el_torque_cmd; packet.az_torque_cmd = az_torque_cmd; packet.target_system = target_system; packet.target_component = target_component; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); #endif } /** * @brief Send a gimbal_torque_cmd_report message * @param chan MAVLink channel to send the message * @param struct The MAVLink struct to serialize */ static inline void mavlink_msg_gimbal_torque_cmd_report_send_struct(mavlink_channel_t chan, const mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS mavlink_msg_gimbal_torque_cmd_report_send(chan, gimbal_torque_cmd_report->target_system, gimbal_torque_cmd_report->target_component, gimbal_torque_cmd_report->rl_torque_cmd, gimbal_torque_cmd_report->el_torque_cmd, gimbal_torque_cmd_report->az_torque_cmd); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, (const char *)gimbal_torque_cmd_report, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); #endif } #if MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* This varient of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ static inline void mavlink_msg_gimbal_torque_cmd_report_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t rl_torque_cmd, int16_t el_torque_cmd, int16_t az_torque_cmd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_int16_t(buf, 0, rl_torque_cmd); _mav_put_int16_t(buf, 2, el_torque_cmd); _mav_put_int16_t(buf, 4, az_torque_cmd); _mav_put_uint8_t(buf, 6, target_system); _mav_put_uint8_t(buf, 7, target_component); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, buf, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); #else mavlink_gimbal_torque_cmd_report_t *packet = (mavlink_gimbal_torque_cmd_report_t *)msgbuf; packet->rl_torque_cmd = rl_torque_cmd; packet->el_torque_cmd = el_torque_cmd; packet->az_torque_cmd = az_torque_cmd; packet->target_system = target_system; packet->target_component = target_component; _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_CRC); #endif } #endif #endif // MESSAGE GIMBAL_TORQUE_CMD_REPORT UNPACKING /** * @brief Get field target_system from gimbal_torque_cmd_report message * * @return System ID. */ static inline uint8_t mavlink_msg_gimbal_torque_cmd_report_get_target_system(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 6); } /** * @brief Get field target_component from gimbal_torque_cmd_report message * * @return Component ID. */ static inline uint8_t mavlink_msg_gimbal_torque_cmd_report_get_target_component(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 7); } /** * @brief Get field rl_torque_cmd from gimbal_torque_cmd_report message * * @return Roll Torque Command. */ static inline int16_t mavlink_msg_gimbal_torque_cmd_report_get_rl_torque_cmd(const mavlink_message_t* msg) { return _MAV_RETURN_int16_t(msg, 0); } /** * @brief Get field el_torque_cmd from gimbal_torque_cmd_report message * * @return Elevation Torque Command. */ static inline int16_t mavlink_msg_gimbal_torque_cmd_report_get_el_torque_cmd(const mavlink_message_t* msg) { return _MAV_RETURN_int16_t(msg, 2); } /** * @brief Get field az_torque_cmd from gimbal_torque_cmd_report message * * @return Azimuth Torque Command. */ static inline int16_t mavlink_msg_gimbal_torque_cmd_report_get_az_torque_cmd(const mavlink_message_t* msg) { return _MAV_RETURN_int16_t(msg, 4); } /** * @brief Decode a gimbal_torque_cmd_report message into a struct * * @param msg The message to decode * @param gimbal_torque_cmd_report C-struct to decode the message contents into */ static inline void mavlink_msg_gimbal_torque_cmd_report_decode(const mavlink_message_t* msg, mavlink_gimbal_torque_cmd_report_t* gimbal_torque_cmd_report) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS gimbal_torque_cmd_report->rl_torque_cmd = mavlink_msg_gimbal_torque_cmd_report_get_rl_torque_cmd(msg); gimbal_torque_cmd_report->el_torque_cmd = mavlink_msg_gimbal_torque_cmd_report_get_el_torque_cmd(msg); gimbal_torque_cmd_report->az_torque_cmd = mavlink_msg_gimbal_torque_cmd_report_get_az_torque_cmd(msg); gimbal_torque_cmd_report->target_system = mavlink_msg_gimbal_torque_cmd_report_get_target_system(msg); gimbal_torque_cmd_report->target_component = mavlink_msg_gimbal_torque_cmd_report_get_target_component(msg); #else uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN; memset(gimbal_torque_cmd_report, 0, MAVLINK_MSG_ID_GIMBAL_TORQUE_CMD_REPORT_LEN); memcpy(gimbal_torque_cmd_report, _MAV_PAYLOAD(msg), len); #endif }
{ "pile_set_name": "Github" }
<?php /** * PHPMailer RFC821 SMTP email transport class. * Version 5.2.7 * PHP version 5.0.0 * @category PHP * @package PHPMailer * @link https://github.com/PHPMailer/PHPMailer/ * @author Marcus Bointon (coolbru) <[email protected]> * @author Jim Jagielski (jimjag) <[email protected]> * @author Andy Prevost (codeworxtech) <[email protected]> * @copyright 2013 Marcus Bointon * @copyright 2004 - 2008 Andy Prevost * @copyright 2010 - 2012 Jim Jagielski * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL) */ /** * PHPMailer RFC821 SMTP email transport class. * * Implements RFC 821 SMTP commands * and provides some utility methods for sending mail to an SMTP server. * * PHP Version 5.0.0 * * @category PHP * @package PHPMailer * @link https://github.com/PHPMailer/PHPMailer/blob/master/class.smtp.php * @author Chris Ryan <[email protected]> * @author Marcus Bointon <[email protected]> * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL) */ class SMTP { /** * The PHPMailer SMTP Version number. */ const VERSION = '5.2.7'; /** * SMTP line break constant. */ const CRLF = "\r\n"; /** * The SMTP port to use if one is not specified. */ const DEFAULT_SMTP_PORT = 25; /** * The PHPMailer SMTP Version number. * @type string * @deprecated This should be a constant * @see SMTP::VERSION */ public $Version = '5.2.7'; /** * SMTP server port number. * @type int * @deprecated This is only ever ued as default value, so should be a constant * @see SMTP::DEFAULT_SMTP_PORT */ public $SMTP_PORT = 25; /** * SMTP reply line ending * @type string * @deprecated Use the class constant instead * @see SMTP::CRLF */ public $CRLF = "\r\n"; /** * Debug output level. * Options: 0 for no output, 1 for commands, 2 for data and commands * @type int */ public $do_debug = 0; /** * The function/method to use for debugging output. * Options: 'echo', 'html' or 'error_log' * @type string */ public $Debugoutput = 'echo'; /** * Whether to use VERP. * @type bool */ public $do_verp = false; /** * The SMTP timeout value for reads, in seconds. * @type int */ public $Timeout = 15; /** * The SMTP timelimit value for reads, in seconds. * @type int */ public $Timelimit = 30; /** * The socket for the server connection. * @type resource */ protected $smtp_conn; /** * Error message, if any, for the last call. * @type string */ protected $error = ''; /** * The reply the server sent to us for HELO. * @type string */ protected $helo_rply = ''; /** * The most recent reply received from the server. * @type string */ protected $last_reply = ''; /** * Constructor. * @access public */ public function __construct() { $this->smtp_conn = 0; $this->error = null; $this->helo_rply = null; $this->do_debug = 0; } /** * Output debugging info via a user-selected method. * @param string $str Debug string to output * @return void */ protected function edebug($str) { switch ($this->Debugoutput) { case 'error_log': //Don't output, just log error_log($str); break; case 'html': //Cleans up output a bit for a better looking, HTML-safe output echo htmlentities( preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, 'UTF-8' ) . "<br>\n"; break; case 'echo': default: //Just echoes whatever was received echo $str; } } /** * Connect to an SMTP server. * @param string $host SMTP server IP or host name * @param int $port The port number to connect to * @param int $timeout How long to wait for the connection to open * @param array $options An array of options for stream_context_create() * @access public * @return bool */ public function connect($host, $port = null, $timeout = 30, $options = array()) { // Clear errors to avoid confusion $this->error = null; // Make sure we are __not__ connected if ($this->connected()) { // Already connected, generate error $this->error = array('error' => 'Already connected to a server'); return false; } if (empty($port)) { $port = self::DEFAULT_SMTP_PORT; } // Connect to the SMTP server $errno = 0; $errstr = ''; $socket_context = stream_context_create($options); //Suppress errors; connection failures are handled at a higher level $this->smtp_conn = @stream_socket_client( $host . ":" . $port, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $socket_context ); // Verify we connected properly if (empty($this->smtp_conn)) { $this->error = array( 'error' => 'Failed to connect to server', 'errno' => $errno, 'errstr' => $errstr ); if ($this->do_debug >= 1) { $this->edebug( 'SMTP -> ERROR: ' . $this->error['error'] . ": $errstr ($errno)" ); } return false; } // SMTP server can take longer to respond, give longer timeout for first read // Windows does not have support for this timeout function if (substr(PHP_OS, 0, 3) != 'WIN') { $max = ini_get('max_execution_time'); if ($max != 0 && $timeout > $max) { // Don't bother if unlimited @set_time_limit($timeout); } stream_set_timeout($this->smtp_conn, $timeout, 0); } // Get any announcement $announce = $this->get_lines(); if ($this->do_debug >= 2) { $this->edebug('SMTP -> FROM SERVER:' . $announce); } return true; } /** * Initiate a TLS (encrypted) session. * @access public * @return bool */ public function startTLS() { if (!$this->sendCommand("STARTTLS", "STARTTLS", 220)) { return false; } // Begin encrypted connection if (!stream_socket_enable_crypto( $this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT ) ) { return false; } return true; } /** * Perform SMTP authentication. * Must be run after hello(). * @see hello() * @param string $username The user name * @param string $password The password * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5) * @param string $realm The auth realm for NTLM * @param string $workstation The auth workstation for NTLM * @access public * @return bool True if successfully authenticated. */ public function authenticate( $username, $password, $authtype = 'LOGIN', $realm = '', $workstation = '' ) { if (empty($authtype)) { $authtype = 'LOGIN'; } switch ($authtype) { case 'PLAIN': // Start authentication if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) { return false; } // Send encoded username and password if (!$this->sendCommand( 'User & Password', base64_encode("\0" . $username . "\0" . $password), 235 ) ) { return false; } break; case 'LOGIN': // Start authentication if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) { return false; } if (!$this->sendCommand("Username", base64_encode($username), 334)) { return false; } if (!$this->sendCommand("Password", base64_encode($password), 235)) { return false; } break; case 'NTLM': /* * ntlm_sasl_client.php * Bundled with Permission * * How to telnet in windows: * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication */ require_once 'extras/ntlm_sasl_client.php'; $temp = new stdClass(); $ntlm_client = new ntlm_sasl_client_class; //Check that functions are available if (!$ntlm_client->Initialize($temp)) { $this->error = array('error' => $temp->error); if ($this->do_debug >= 1) { $this->edebug( 'You need to enable some modules in your php.ini file: ' . $this->error['error'] ); } return false; } //msg1 $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1 if (!$this->sendCommand( 'AUTH NTLM', 'AUTH NTLM ' . base64_encode($msg1), 334 ) ) { return false; } //Though 0 based, there is a white space after the 3 digit number //msg2 $challenge = substr($this->last_reply, 3); $challenge = base64_decode($challenge); $ntlm_res = $ntlm_client->NTLMResponse( substr($challenge, 24, 8), $password ); //msg3 $msg3 = $ntlm_client->TypeMsg3( $ntlm_res, $username, $realm, $workstation ); // send encoded username return $this->sendCommand('Username', base64_encode($msg3), 235); break; case 'CRAM-MD5': // Start authentication if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) { return false; } // Get the challenge $challenge = base64_decode(substr($this->last_reply, 4)); // Build the response $response = $username . ' ' . $this->hmac($challenge, $password); // send encoded credentials return $this->sendCommand('Username', base64_encode($response), 235); break; } return true; } /** * Calculate an MD5 HMAC hash. * Works like hash_hmac('md5', $data, $key) * in case that function is not available * @param string $data The data to hash * @param string $key The key to hash with * @access protected * @return string */ protected function hmac($data, $key) { if (function_exists('hash_hmac')) { return hash_hmac('md5', $data, $key); } // The following borrowed from // http://php.net/manual/en/function.mhash.php#27225 // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // by Lance Rushing $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } /** * Check connection state. * @access public * @return bool True if connected. */ public function connected() { if (!empty($this->smtp_conn)) { $sock_status = stream_get_meta_data($this->smtp_conn); if ($sock_status['eof']) { // the socket is valid but we are not connected if ($this->do_debug >= 1) { $this->edebug( 'SMTP -> NOTICE: EOF caught while checking if connected' ); } $this->close(); return false; } return true; // everything looks good } return false; } /** * Close the socket and clean up the state of the class. * Don't use this function without first trying to use QUIT. * @see quit() * @access public * @return void */ public function close() { $this->error = null; // so there is no confusion $this->helo_rply = null; if (!empty($this->smtp_conn)) { // close the connection and cleanup fclose($this->smtp_conn); $this->smtp_conn = 0; } } /** * Send an SMTP DATA command. * Issues a data command and sends the msg_data to the server, * finializing the mail transaction. $msg_data is the message * that is to be send with the headers. Each header needs to be * on a single line followed by a <CRLF> with the message headers * and the message body being separated by and additional <CRLF>. * Implements rfc 821: DATA <CRLF> * @param string $msg_data Message data to send * @access public * @return bool */ public function data($msg_data) { if (!$this->sendCommand('DATA', 'DATA', 354)) { return false; } /* The server is ready to accept data! * according to rfc821 we should not send more than 1000 * including the CRLF * characters on a single line so we will break the data up * into lines by \r and/or \n then if needed we will break * each of those into smaller lines to fit within the limit. * in addition we will be looking for lines that start with * a period '.' and append and additional period '.' to that * line. NOTE: this does not count towards limit. */ // Normalize the line breaks before exploding $msg_data = str_replace("\r\n", "\n", $msg_data); $msg_data = str_replace("\r", "\n", $msg_data); $lines = explode("\n", $msg_data); /* We need to find a good way to determine if headers are * in the msg_data or if it is a straight msg body * currently I am assuming rfc822 definitions of msg headers * and if the first field of the first line (':' separated) * does not contain a space then it _should_ be a header * and we can process all lines before a blank "" line as * headers. */ $field = substr($lines[0], 0, strpos($lines[0], ':')); $in_headers = false; if (!empty($field) && !strstr($field, ' ')) { $in_headers = true; } //RFC 2822 section 2.1.1 limit $max_line_length = 998; foreach ($lines as $line) { $lines_out = null; if ($line == '' && $in_headers) { $in_headers = false; } // ok we need to break this line up into several smaller lines while (strlen($line) > $max_line_length) { $pos = strrpos(substr($line, 0, $max_line_length), ' '); // Patch to fix DOS attack if (!$pos) { $pos = $max_line_length - 1; $lines_out[] = substr($line, 0, $pos); $line = substr($line, $pos); } else { $lines_out[] = substr($line, 0, $pos); $line = substr($line, $pos + 1); } /* If processing headers add a LWSP-char to the front of new line * rfc822 on long msg headers */ if ($in_headers) { $line = "\t" . $line; } } $lines_out[] = $line; // send the lines to the server while (list(, $line_out) = @each($lines_out)) { if (strlen($line_out) > 0) { if (substr($line_out, 0, 1) == '.') { $line_out = '.' . $line_out; } } $this->client_send($line_out . self::CRLF); } } // Message data has been sent, complete the command return $this->sendCommand('DATA END', '.', 250); } /** * Send an SMTP HELO or EHLO command. * Used to identify the sending server to the receiving server. * This makes sure that client and server are in a known state. * Implements from RFC 821: HELO <SP> <domain> <CRLF> * and RFC 2821 EHLO. * @param string $host The host name or IP to connect to * @access public * @return bool */ public function hello($host = '') { // Try extended hello first (RFC 2821) if (!$this->sendHello('EHLO', $host)) { if (!$this->sendHello('HELO', $host)) { return false; } } return true; } /** * Send an SMTP HELO or EHLO command. * Low-level implementation used by hello() * @see hello() * @param string $hello The HELO string * @param string $host The hostname to say we are * @access protected * @return bool */ protected function sendHello($hello, $host) { $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250); $this->helo_rply = $this->last_reply; return $noerror; } /** * Send an SMTP MAIL command. * Starts a mail transaction from the email address specified in * $from. Returns true if successful or false otherwise. If True * the mail transaction is started and then one or more recipient * commands may be called followed by a data command. * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF> * @param string $from Source address of this message * @access public * @return bool */ public function mail($from) { $useVerp = ($this->do_verp ? ' XVERP' : ''); return $this->sendCommand( 'MAIL FROM', 'MAIL FROM:<' . $from . '>' . $useVerp, 250 ); } /** * Send an SMTP QUIT command. * Closes the socket if there is no error or the $close_on_error argument is true. * Implements from rfc 821: QUIT <CRLF> * @param bool $close_on_error Should the connection close if an error occurs? * @access public * @return bool */ public function quit($close_on_error = true) { $noerror = $this->sendCommand('QUIT', 'QUIT', 221); $e = $this->error; //Save any error if ($noerror or $close_on_error) { $this->close(); $this->error = $e; //Restore any error from the quit command } return $noerror; } /** * Send an SMTP RCPT command. * Sets the TO argument to $to. * Returns true if the recipient was accepted false if it was rejected. * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> * @param string $to The address the message is being sent to * @access public * @return bool */ public function recipient($to) { return $this->sendCommand( 'RCPT TO ', 'RCPT TO:<' . $to . '>', array(250, 251) ); } /** * Send an SMTP RSET command. * Abort any transaction that is currently in progress. * Implements rfc 821: RSET <CRLF> * @access public * @return bool True on success. */ public function reset() { return $this->sendCommand('RSET', 'RSET', 250); } /** * Send a command to an SMTP server and check its return code. * @param string $command The command name - not sent to the server * @param string $commandstring The actual command to send * @param int|array $expect One or more expected integer success codes * @access protected * @return bool True on success. */ protected function sendCommand($command, $commandstring, $expect) { if (!$this->connected()) { $this->error = array( "error" => "Called $command without being connected" ); return false; } $this->client_send($commandstring . self::CRLF); $reply = $this->get_lines(); $code = substr($reply, 0, 3); if ($this->do_debug >= 2) { $this->edebug('SMTP -> FROM SERVER:' . $reply); } if (!in_array($code, (array)$expect)) { $this->last_reply = null; $this->error = array( "error" => "$command command failed", "smtp_code" => $code, "detail" => substr($reply, 4) ); if ($this->do_debug >= 1) { $this->edebug( 'SMTP -> ERROR: ' . $this->error['error'] . ': ' . $reply ); } return false; } $this->last_reply = $reply; $this->error = null; return true; } /** * Send an SMTP SAML command. * Starts a mail transaction from the email address specified in $from. * Returns true if successful or false otherwise. If True * the mail transaction is started and then one or more recipient * commands may be called followed by a data command. This command * will send the message to the users terminal if they are logged * in and send them an email. * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF> * @param string $from The address the message is from * @access public * @return bool */ public function sendAndMail($from) { return $this->sendCommand("SAML", "SAML FROM:$from", 250); } /** * Send an SMTP VRFY command. * @param string $name The name to verify * @access public * @return bool */ public function verify($name) { return $this->sendCommand("VRFY", "VRFY $name", array(250, 251)); } /** * Send an SMTP NOOP command. * Used to keep keep-alives alive, doesn't actually do anything * @access public * @return bool */ public function noop() { return $this->sendCommand("NOOP", "NOOP", 250); } /** * Send an SMTP TURN command. * This is an optional command for SMTP that this class does not support. * This method is here to make the RFC821 Definition * complete for this class and __may__ be implemented in future * Implements from rfc 821: TURN <CRLF> * @access public * @return bool */ public function turn() { $this->error = array( 'error' => 'The SMTP TURN command is not implemented' ); if ($this->do_debug >= 1) { $this->edebug('SMTP -> NOTICE: ' . $this->error['error']); } return false; } /** * Send raw data to the server. * @param string $data The data to send * @access public * @return int|bool The number of bytes sent to the server or FALSE on error */ public function client_send($data) { if ($this->do_debug >= 1) { $this->edebug("CLIENT -> SMTP: $data"); } return fwrite($this->smtp_conn, $data); } /** * Get the latest error. * @access public * @return array */ public function getError() { return $this->error; } /** * Get the last reply from the server. * @access public * @return string */ public function getLastReply() { return $this->last_reply; } /** * Read the SMTP server's response. * Either before eof or socket timeout occurs on the operation. * With SMTP we can tell if we have more lines to read if the * 4th character is '-' symbol. If it is a space then we don't * need to read anything else. * @access protected * @return string */ protected function get_lines() { $data = ''; $endtime = 0; // If the connection is bad, give up now if (!is_resource($this->smtp_conn)) { return $data; } stream_set_timeout($this->smtp_conn, $this->Timeout); if ($this->Timelimit > 0) { $endtime = time() + $this->Timelimit; } while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { $str = @fgets($this->smtp_conn, 515); if ($this->do_debug >= 4) { $this->edebug("SMTP -> get_lines(): \$data was \"$data\""); $this->edebug("SMTP -> get_lines(): \$str is \"$str\""); } $data .= $str; if ($this->do_debug >= 4) { $this->edebug("SMTP -> get_lines(): \$data is \"$data\""); } // if 4th character is a space, we are done reading, break the loop if (substr($str, 3, 1) == ' ') { break; } // Timed-out? Log and break $info = stream_get_meta_data($this->smtp_conn); if ($info['timed_out']) { if ($this->do_debug >= 4) { $this->edebug( 'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)' ); } break; } // Now check if reads took too long if ($endtime) { if (time() > $endtime) { if ($this->do_debug >= 4) { $this->edebug( 'SMTP -> get_lines(): timelimit reached (' . $this->Timelimit . ' sec)' ); } break; } } } return $data; } /** * Enable or disable VERP address generation. * @param bool $enabled */ public function setVerp($enabled = false) { $this->do_verp = $enabled; } /** * Get VERP address generation mode. * @return bool */ public function getVerp() { return $this->do_verp; } /** * Set debug output method. * @param string $method The function/method to use for debugging output. */ public function setDebugOutput($method = 'echo') { $this->Debugoutput = $method; } /** * Get debug output method. * @return string */ public function getDebugOutput() { return $this->Debugoutput; } /** * Set debug output level. * @param int $level */ public function setDebugLevel($level = 0) { $this->do_debug = $level; } /** * Get debug output level. * @return int */ public function getDebugLevel() { return $this->do_debug; } /** * Set SMTP timeout. * @param int $timeout */ public function setTimeout($timeout = 0) { $this->Timeout = $timeout; } /** * Get SMTP timeout. * @return int */ public function getTimeout() { return $this->Timeout; } }
{ "pile_set_name": "Github" }
/* This file is part of VoltDB. * Copyright (C) 2008-2020 VoltDB 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 AUTHORS 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. */ package org.voltdb.sysprocs.saverestore; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.Set; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.voltcore.utils.CoreUtils; import org.voltdb.FlakyTestRule; import org.voltdb.FlakyTestRule.Flaky; import org.voltdb.MockVoltDB; import org.voltdb.SnapshotTableInfo; import org.voltdb.VoltDB; import org.voltdb.VoltSystemProcedure.SynthesizedPlanFragment; import org.voltdb.VoltTable; import org.voltdb.VoltZK.MailboxType; import org.voltdb.catalog.Table; import org.voltdb.sysprocs.SysProcFragmentId; public class TestReplicatedTableSaveFileState { @Rule public FlakyTestRule ftRule = new FlakyTestRule(); private static final String TABLE_NAME = "test_table"; private static final String DATABASE_NAME = "database"; @Before public void setUp() { m_state = new ReplicatedTableSaveFileState(TABLE_NAME, 0); m_siteInput = ClusterSaveFileState.constructEmptySaveFileStateVoltTable(); } @Test public void testLoadOperation() { assertEquals(m_state.getTableName(), TABLE_NAME); addHostToTestData(0); addHostToTestData(1); addHostToTestData(3); m_siteInput.resetRowPosition(); while (m_siteInput.advanceRow()) { try { // this will add the active row of m_siteInput m_state.addHostData(m_siteInput); } catch (IOException e) { e.printStackTrace(); assertTrue(false); } } assertTrue(m_state.isConsistent()); assertTrue(m_state.getConsistencyResult(). contains("has consistent savefile state")); Set<Integer> sites = m_state.getHostsWithThisTable(); assertTrue(sites.contains(0)); assertTrue(sites.contains(1)); assertFalse(sites.contains(2)); assertTrue(sites.contains(3)); } @Test public void testInconsistentIsReplicated() { addHostToTestData(0); addBadHostToTestData(1); m_siteInput.resetRowPosition(); while (m_siteInput.advanceRow()) { try { // this will add the active row of m_siteInput m_state.addHostData(m_siteInput); } catch (IOException e) { assertTrue(m_state.getConsistencyResult(). contains("but has a savefile which indicates partitioning at site")); return; } } assertTrue(false); } // Things that should get added: // Add some non-exec sites // /* * Test the easiest possible restore plan: table is replicated before and * after save/restore, and every site has a copy of the table */ @Test @Flaky(description="TestReplicatedTableSaveFileState.testEasyRestorePlan") public void testEasyRestorePlan() throws Exception { MockVoltDB catalog_creator = new MockVoltDB(); VoltDB.replaceVoltDBInstanceForTest(catalog_creator); catalog_creator.addTable(TABLE_NAME, true); int number_of_sites = 4; for (int i = 0; i < number_of_sites; ++i) { addHostToTestData(i); catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( i, i), i); } // Add some non-exec sites for more test coverage catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( 0, number_of_sites), MailboxType.Initiator); catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( 1, number_of_sites + 1), MailboxType.Initiator); m_siteInput.resetRowPosition(); while (m_siteInput.advanceRow()) { try { // this will add the active row of m_siteInput m_state.addHostData(m_siteInput); } catch (IOException e) { e.printStackTrace(); assertTrue(false); } } SynthesizedPlanFragment[] test_plan = generateRestorePlan(catalog_creator); assertEquals(test_plan.length, number_of_sites + 1); for (int i = 0; i < number_of_sites - 1; ++i) { assertEquals(test_plan[i].fragmentId, SysProcFragmentId.PF_restoreLoadReplicatedTable); assertFalse(test_plan[i].multipartition); assertEquals((int)test_plan[i].siteId, i); assertEquals(test_plan[i].parameters.toArray()[0], TABLE_NAME); } assertEquals(test_plan[number_of_sites].fragmentId, SysProcFragmentId.PF_restoreReceiveResultTables); assertFalse(test_plan[number_of_sites].multipartition); assertEquals(test_plan[number_of_sites].parameters.toArray()[0], m_state.getRootDependencyId()); catalog_creator.shutdown(null); } /* * Test the restore plan when one of the sites doesn't have access to * a copy of the table */ @Test public void testSiteMissingTableRestorePlan() throws Exception { MockVoltDB catalog_creator = new MockVoltDB(); VoltDB.replaceVoltDBInstanceForTest(catalog_creator); catalog_creator.addTable(TABLE_NAME, true); int number_of_sites = 4; for (int i = 0; i < number_of_sites - 1; ++i) { addHostToTestData(i); catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( i, i), i); } catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( number_of_sites - 1, number_of_sites - 1), number_of_sites - 1); // Add some non-exec sites for more test coverage catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( 0, number_of_sites), MailboxType.Initiator); catalog_creator.addSite(CoreUtils.getHSIdFromHostAndSite( 1, number_of_sites + 1), MailboxType.Initiator); m_siteInput.resetRowPosition(); while (m_siteInput.advanceRow()) { try { // this will add the active row of m_siteInput m_state.addHostData(m_siteInput); } catch (IOException e) { e.printStackTrace(); assertTrue(false); } } SynthesizedPlanFragment[] test_plan = generateRestorePlan(catalog_creator); assertEquals(test_plan.length, number_of_sites + 1); for (int i = 0; i < number_of_sites - 1; ++i) { assertEquals(test_plan[i].fragmentId, SysProcFragmentId.PF_restoreLoadReplicatedTable); assertFalse(test_plan[i].multipartition); assertEquals(test_plan[i].siteId, CoreUtils.getHSIdFromHostAndSite( i, i)); assertEquals(test_plan[i].parameters.toArray()[0], TABLE_NAME); } assertEquals(test_plan[number_of_sites - 1].fragmentId, SysProcFragmentId.PF_restoreDistributeReplicatedTableAsReplicated); assertEquals(test_plan[number_of_sites - 1].siteId, 0); assertFalse(test_plan[number_of_sites - 1].multipartition); assertEquals(test_plan[number_of_sites - 1].parameters.toArray()[0], TABLE_NAME); assertEquals(3, test_plan[number_of_sites - 1].parameters.toArray()[1]); assertEquals(test_plan[number_of_sites].fragmentId, SysProcFragmentId.PF_restoreReceiveResultTables); assertFalse(test_plan[number_of_sites].multipartition); assertEquals(test_plan[number_of_sites].parameters.toArray()[0], m_state.getRootDependencyId()); catalog_creator.shutdown(null); } private void addHostToTestData(int hostId) { m_siteInput.addRow(hostId, "host", hostId, "ohost", "cluster", DATABASE_NAME, TABLE_NAME, 0, "TRUE", 0, 1); } private void addBadHostToTestData(int hostId) { m_siteInput.addRow(hostId, "host", hostId, "ohost", "cluster", DATABASE_NAME, TABLE_NAME, 0, "FALSE", 0, 2); } private SynthesizedPlanFragment[] generateRestorePlan(MockVoltDB mvdb) { Table testTable = mvdb.getTable(TABLE_NAME); return m_state.generateRestorePlan(new SnapshotTableInfo(testTable), VoltDB.instance().getSiteTrackerForSnapshot()); } private ReplicatedTableSaveFileState m_state; private VoltTable m_siteInput; }
{ "pile_set_name": "Github" }
/* * JBoss, Home of Professional Open Source * Copyright 2015, Red Hat, Inc., and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jboss.weld.tests.decorators.overloading; import java.util.Collection; import java.util.Set; import jakarta.decorator.Decorator; import jakarta.decorator.Delegate; import jakarta.inject.Inject; import org.jboss.weld.test.util.ActionSequence; /** * * @author Martin Kouba */ @Decorator public class BravoServiceDecorator implements BravoService { @Inject @Delegate private BravoService delegate; @Override public void run(Set<Integer> values) { ActionSequence.addAction(Set.class.getName()); delegate.run(values); } @Override public void run(Collection<Integer> values) { ActionSequence.addAction(Collection.class.getName()); delegate.run(values); } }
{ "pile_set_name": "Github" }
<div class="orchard-layouts-root"> @Display(Model.LayoutRoot) </div>
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head><link rel="apple-touch-icon" sizes="180x180" href="/glide/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/glide/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/glide/favicon-16x16.png"><link rel="manifest" href="/glide/manifest.json"> <!-- Generated by javadoc (1.8.0_144) on Mon Dec 04 08:57:27 PST 2017 --> <title>DefaultImageHeaderParser (glide API)</title> <meta name="date" content="2017-12-04"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DefaultImageHeaderParser (glide API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/CircleCrop.html" title="class in com.bumptech.glide.load.resource.bitmap"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/Downsampler.html" title="class in com.bumptech.glide.load.resource.bitmap"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html" target="_top">Frames</a></li> <li><a href="DefaultImageHeaderParser.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.bumptech.glide.load.resource.bitmap</div> <h2 title="Class DefaultImageHeaderParser" class="title">Class DefaultImageHeaderParser</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="http://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li>com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></dd> </dl> <hr> <br> <pre>public final class <span class="typeNameLabel">DefaultImageHeaderParser</span> extends <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> implements <a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></pre> <div class="block">A class for parsing the exif orientation and other data from an image header.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== NESTED CLASS SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="nested.class.summary"> <!-- --> </a> <h3>Nested Class Summary</h3> <ul class="blockList"> <li class="blockList"><a name="nested.classes.inherited.from.class.com.bumptech.glide.load.ImageHeaderParser"> <!-- --> </a> <h3>Nested classes/interfaces inherited from interface&nbsp;com.bumptech.glide.load.<a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></h3> <code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.ImageType.html" title="enum in com.bumptech.glide.load">ImageHeaderParser.ImageType</a></code></li> </ul> </li> </ul> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <ul class="blockList"> <li class="blockList"><a name="fields.inherited.from.class.com.bumptech.glide.load.ImageHeaderParser"> <!-- --> </a> <h3>Fields inherited from interface&nbsp;com.bumptech.glide.load.<a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></h3> <code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html#UNKNOWN_ORIENTATION">UNKNOWN_ORIENTATION</a></code></li> </ul> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html#DefaultImageHeaderParser--">DefaultImageHeaderParser</a></span>()</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html#getOrientation-java.nio.ByteBuffer-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-">getOrientation</a></span>(<a href="http://d.android.com/reference/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;byteBuffer, <a href="../../../../../../com/bumptech/glide/load/engine/bitmap_recycle/ArrayPool.html" title="interface in com.bumptech.glide.load.engine.bitmap_recycle">ArrayPool</a>&nbsp;byteArrayPool)</code>&nbsp;</td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html#getOrientation-java.io.InputStream-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-">getOrientation</a></span>(<a href="http://d.android.com/reference/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is, <a href="../../../../../../com/bumptech/glide/load/engine/bitmap_recycle/ArrayPool.html" title="interface in com.bumptech.glide.load.engine.bitmap_recycle">ArrayPool</a>&nbsp;byteArrayPool)</code> <div class="block">Parse the orientation from the image header.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.ImageType.html" title="enum in com.bumptech.glide.load">ImageHeaderParser.ImageType</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html#getType-java.nio.ByteBuffer-">getType</a></span>(<a href="http://d.android.com/reference/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;byteBuffer)</code>&nbsp;</td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.ImageType.html" title="enum in com.bumptech.glide.load">ImageHeaderParser.ImageType</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html#getType-java.io.InputStream-">getType</a></span>(<a href="http://d.android.com/reference/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is)</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.<a href="http://d.android.com/reference/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> <code><a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://d.android.com/reference/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="DefaultImageHeaderParser--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>DefaultImageHeaderParser</h4> <pre>public&nbsp;DefaultImageHeaderParser()</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getType-java.io.InputStream-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getType</h4> <pre>public&nbsp;<a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.ImageType.html" title="enum in com.bumptech.glide.load">ImageHeaderParser.ImageType</a>&nbsp;getType(<a href="http://d.android.com/reference/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is) throws <a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html#getType-java.io.InputStream-">getType</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> </dl> </li> </ul> <a name="getType-java.nio.ByteBuffer-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getType</h4> <pre>public&nbsp;<a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.ImageType.html" title="enum in com.bumptech.glide.load">ImageHeaderParser.ImageType</a>&nbsp;getType(<a href="http://d.android.com/reference/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;byteBuffer) throws <a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html#getType-java.nio.ByteBuffer-">getType</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> </dl> </li> </ul> <a name="getOrientation-java.io.InputStream-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getOrientation</h4> <pre>public&nbsp;int&nbsp;getOrientation(<a href="http://d.android.com/reference/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;is, <a href="../../../../../../com/bumptech/glide/load/engine/bitmap_recycle/ArrayPool.html" title="interface in com.bumptech.glide.load.engine.bitmap_recycle">ArrayPool</a>&nbsp;byteArrayPool) throws <a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> <div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html#getOrientation-java.io.InputStream-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-">ImageHeaderParser</a></code></span></div> <div class="block">Parse the orientation from the image header. If it doesn't handle this image type (or this is not an image) it will return a default value rather than throwing an exception.</div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html#getOrientation-java.io.InputStream-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-">getOrientation</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></code></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>The exif orientation if present or -1 if the header couldn't be parsed or doesn't contain an orientation</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> </dl> </li> </ul> <a name="getOrientation-java.nio.ByteBuffer-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getOrientation</h4> <pre>public&nbsp;int&nbsp;getOrientation(<a href="http://d.android.com/reference/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;byteBuffer, <a href="../../../../../../com/bumptech/glide/load/engine/bitmap_recycle/ArrayPool.html" title="interface in com.bumptech.glide.load.engine.bitmap_recycle">ArrayPool</a>&nbsp;byteArrayPool) throws <a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html#getOrientation-java.nio.ByteBuffer-com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool-">getOrientation</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../com/bumptech/glide/load/ImageHeaderParser.html" title="interface in com.bumptech.glide.load">ImageHeaderParser</a></code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://d.android.com/reference/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/CircleCrop.html" title="class in com.bumptech.glide.load.resource.bitmap"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/Downsampler.html" title="class in com.bumptech.glide.load.resource.bitmap"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParser.html" target="_top">Frames</a></li> <li><a href="DefaultImageHeaderParser.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
form=未知 tags= 谁谓之推贤, 于世何功果。 绝尔晋侯交, 禁我唐虞火。 国闭檀榆烟, 大礼成隳堕。 暗室枯槁饭, 冷面相看坐。 阳升既非佑, 阴伏若为佐。 焉冻群生腹, 将止天下祸。 但究冤滥刑, 天道无不可。 鄙哉前朝翊赞臣, 訏谟之规何琐琐。
{ "pile_set_name": "Github" }
// // WXNetworkDomain.m // PonyDebuggerDerivedSources // // Generated on 8/23/12 // // Licensed to Square, Inc. under one or more contributor license agreements. // See the LICENSE file distributed with this work for the terms under // which Square, Inc. licenses this file to you. // #import "WXObject.h" #import "WXNetworkDomain.h" #import "WXObject.h" #import "WXNetworkTypes.h" #import "WXSourceDebuggerDomainController.h" @interface WXNetworkDomain () //Commands @end @implementation WXNetworkDomain @dynamic delegate; + (NSString *)domainName; { return @"Network"; } // Events // Fired when page is about to send HTTP request. - (void)requestWillBeSentWithRequestId:(NSString *)requestId frameId:(NSString *)frameId loaderId:(NSString *)loaderId documentURL:(NSString *)documentURL request:(WXNetworkRequest *)request timestamp:(NSNumber *)timestamp initiator:(WXNetworkInitiator *)initiator redirectResponse:(WXNetworkResponse *)redirectResponse; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:8]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (frameId != nil) { [params setObject:[frameId WX_JSONObject] forKey:@"frameId"]; } if (loaderId != nil) { [params setObject:[loaderId WX_JSONObject] forKey:@"loaderId"]; } if (documentURL != nil) { [params setObject:[documentURL WX_JSONObject] forKey:@"documentURL"]; } if (request != nil) { [params setObject:[request WX_JSONObject] forKey:@"request"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (initiator != nil) { [params setObject:[initiator WX_JSONObject] forKey:@"initiator"]; } if (redirectResponse != nil) { [params setObject:[redirectResponse WX_JSONObject] forKey:@"redirectResponse"]; } [self.debuggingServer sendEventWithName:@"Network.requestWillBeSent" parameters:params]; } // Fired if request ended up loading from cache. - (void)requestServedFromCacheWithRequestId:(NSString *)requestId; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:1]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } [self.debuggingServer sendEventWithName:@"Network.requestServedFromCache" parameters:params]; } // Fired when HTTP response is available. - (void)responseReceivedWithRequestId:(NSString *)requestId frameId:(NSString *)frameId loaderId:(NSString *)loaderId timestamp:(NSNumber *)timestamp type:(NSString *)type response:(WXNetworkResponse *)response; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:6]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (frameId != nil) { [params setObject:[frameId WX_JSONObject] forKey:@"frameId"]; } if (loaderId != nil) { [params setObject:[loaderId WX_JSONObject] forKey:@"loaderId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (type != nil) { [params setObject:[type WX_JSONObject] forKey:@"type"]; } if (response != nil) { [params setObject:[response WX_JSONObject] forKey:@"response"]; } [self.debuggingServer sendEventWithName:@"Network.responseReceived" parameters:params]; [[WXSourceDebuggerDomainController defaultInstance] getScriptSourceTreeWithId:requestId url:response.url isContentScript:[NSNumber numberWithBool:NO] sourceMapURL:@""]; } // Fired when data chunk was received over the network. - (void)dataReceivedWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp dataLength:(NSNumber *)dataLength encodedDataLength:(NSNumber *)encodedDataLength; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:4]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (dataLength != nil) { [params setObject:[dataLength WX_JSONObject] forKey:@"dataLength"]; } if (encodedDataLength != nil) { [params setObject:[encodedDataLength WX_JSONObject] forKey:@"encodedDataLength"]; } [self.debuggingServer sendEventWithName:@"Network.dataReceived" parameters:params]; } // Fired when HTTP request has finished loading. - (void)loadingFinishedWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:2]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } [self.debuggingServer sendEventWithName:@"Network.loadingFinished" parameters:params]; } // Fired when HTTP request has failed to load. - (void)loadingFailedWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp errorText:(NSString *)errorText canceled:(NSNumber *)canceled; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:4]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (errorText != nil) { [params setObject:[errorText WX_JSONObject] forKey:@"errorText"]; } if (canceled != nil) { [params setObject:[canceled WX_JSONObject] forKey:@"canceled"]; } [self.debuggingServer sendEventWithName:@"Network.loadingFailed" parameters:params]; } // Fired when HTTP request has been served from memory cache. - (void)requestServedFromMemoryCacheWithRequestId:(NSString *)requestId frameId:(NSString *)frameId loaderId:(NSString *)loaderId documentURL:(NSString *)documentURL timestamp:(NSNumber *)timestamp initiator:(WXNetworkInitiator *)initiator resource:(WXNetworkCachedResource *)resource; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:7]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (frameId != nil) { [params setObject:[frameId WX_JSONObject] forKey:@"frameId"]; } if (loaderId != nil) { [params setObject:[loaderId WX_JSONObject] forKey:@"loaderId"]; } if (documentURL != nil) { [params setObject:[documentURL WX_JSONObject] forKey:@"documentURL"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (initiator != nil) { [params setObject:[initiator WX_JSONObject] forKey:@"initiator"]; } if (resource != nil) { [params setObject:[resource WX_JSONObject] forKey:@"resource"]; } [self.debuggingServer sendEventWithName:@"Network.requestServedFromMemoryCache" parameters:params]; } // Fired when WebSocket is about to initiate handshake. - (void)webSocketWillSendHandshakeRequestWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp request:(WXNetworkWebSocketRequest *)request; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:3]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (request != nil) { [params setObject:[request WX_JSONObject] forKey:@"request"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketWillSendHandshakeRequest" parameters:params]; } // Fired when WebSocket handshake response becomes available. - (void)webSocketHandshakeResponseReceivedWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp response:(WXNetworkWebSocketResponse *)response; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:3]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (response != nil) { [params setObject:[response WX_JSONObject] forKey:@"response"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketHandshakeResponseReceived" parameters:params]; } // Fired upon WebSocket creation. - (void)webSocketCreatedWithRequestId:(NSString *)requestId url:(NSString *)url; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:2]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (url != nil) { [params setObject:[url WX_JSONObject] forKey:@"url"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketCreated" parameters:params]; } // Fired when WebSocket is closed. - (void)webSocketClosedWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:2]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketClosed" parameters:params]; } // Fired when WebSocket frame is received. - (void)webSocketFrameReceivedWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp response:(WXNetworkWebSocketFrame *)response; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:3]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (response != nil) { [params setObject:[response WX_JSONObject] forKey:@"response"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketFrameReceived" parameters:params]; } // Fired when WebSocket frame error occurs. - (void)webSocketFrameErrorWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp errorMessage:(NSString *)errorMessage; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:3]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (errorMessage != nil) { [params setObject:[errorMessage WX_JSONObject] forKey:@"errorMessage"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketFrameError" parameters:params]; } // Fired when WebSocket frame is sent. - (void)webSocketFrameSentWithRequestId:(NSString *)requestId timestamp:(NSNumber *)timestamp response:(WXNetworkWebSocketFrame *)response; { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:3]; if (requestId != nil) { [params setObject:[requestId WX_JSONObject] forKey:@"requestId"]; } if (timestamp != nil) { [params setObject:[timestamp WX_JSONObject] forKey:@"timestamp"]; } if (response != nil) { [params setObject:[response WX_JSONObject] forKey:@"response"]; } [self.debuggingServer sendEventWithName:@"Network.webSocketFrameSent" parameters:params]; } - (void)handleMethodWithName:(NSString *)methodName parameters:(NSDictionary *)params responseCallback:(WXResponseCallback)responseCallback; { if ([methodName isEqualToString:@"enable"] && [self.delegate respondsToSelector:@selector(domain:enableWithCallback:)]) { [self.delegate domain:self enableWithCallback:^(id error) { responseCallback(nil, error); }]; } else if ([methodName isEqualToString:@"disable"] && [self.delegate respondsToSelector:@selector(domain:disableWithCallback:)]) { [self.delegate domain:self disableWithCallback:^(id error) { responseCallback(nil, error); }]; } else if ([methodName isEqualToString:@"setUserAgentOverride"] && [self.delegate respondsToSelector:@selector(domain:setUserAgentOverrideWithUserAgent:callback:)]) { [self.delegate domain:self setUserAgentOverrideWithUserAgent:[params objectForKey:@"userAgent"] callback:^(id error) { responseCallback(nil, error); }]; } else if ([methodName isEqualToString:@"setExtraHTTPHeaders"] && [self.delegate respondsToSelector:@selector(domain:setExtraHTTPHeadersWithHeaders:callback:)]) { [self.delegate domain:self setExtraHTTPHeadersWithHeaders:[params objectForKey:@"headers"] callback:^(id error) { responseCallback(nil, error); }]; } else if ([methodName isEqualToString:@"getResponseBody"] && [self.delegate respondsToSelector:@selector(domain:getResponseBodyWithRequestId:callback:)]) { [self.delegate domain:self getResponseBodyWithRequestId:[params objectForKey:@"requestId"] callback:^(NSString *body, NSNumber *base64Encoded, id error) { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:2]; if (body != nil) { [params setObject:body forKey:@"body"]; } if (base64Encoded != nil) { [params setObject:base64Encoded forKey:@"base64Encoded"]; } responseCallback(params, error); }]; } else if ([methodName isEqualToString:@"canClearBrowserCache"] && [self.delegate respondsToSelector:@selector(domain:canClearBrowserCacheWithCallback:)]) { [self.delegate domain:self canClearBrowserCacheWithCallback:^(NSNumber *result, id error) { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:1]; if (result != nil) { [params setObject:result forKey:@"result"]; } responseCallback(params, error); }]; } else if ([methodName isEqualToString:@"clearBrowserCache"] && [self.delegate respondsToSelector:@selector(domain:clearBrowserCacheWithCallback:)]) { [self.delegate domain:self clearBrowserCacheWithCallback:^(id error) { responseCallback(nil, error); }]; } else if ([methodName isEqualToString:@"canClearBrowserCookies"] && [self.delegate respondsToSelector:@selector(domain:canClearBrowserCookiesWithCallback:)]) { [self.delegate domain:self canClearBrowserCookiesWithCallback:^(NSNumber *result, id error) { NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithCapacity:1]; if (result != nil) { [params setObject:result forKey:@"result"]; } responseCallback(params, error); }]; } else if ([methodName isEqualToString:@"clearBrowserCookies"] && [self.delegate respondsToSelector:@selector(domain:clearBrowserCookiesWithCallback:)]) { [self.delegate domain:self clearBrowserCookiesWithCallback:^(id error) { responseCallback(nil, error); }]; } else if ([methodName isEqualToString:@"setCacheDisabled"] && [self.delegate respondsToSelector:@selector(domain:setCacheDisabledWithCacheDisabled:callback:)]) { [self.delegate domain:self setCacheDisabledWithCacheDisabled:[params objectForKey:@"cacheDisabled"] callback:^(id error) { responseCallback(nil, error); }]; } else { [super handleMethodWithName:methodName parameters:params responseCallback:responseCallback]; } } @end @implementation WXDebugger (WXNetworkDomain) - (WXNetworkDomain *)networkDomain; { return [self domainForName:@"Network"]; } @end
{ "pile_set_name": "Github" }
test: flake8 --exclude=migrations --ignore=E501,E225,E121,E123,E124,E125,E127,E128 --exit-zero gargoyle || exit 1 python setup.py test release: git tag $(VERSION) git push origin $(VERSION) git push origin master python setup.py sdist upload .PHONY: test release
{ "pile_set_name": "Github" }
# Changes in Elastic 5.0 ## Enforce context.Context in PerformRequest and Do We enforce the usage of `context.Context` everywhere you execute a request. You need to change all your `Do()` calls to pass a context: `Do(ctx)`. This enables automatic request cancelation and many other patterns. If you don't need this, simply pass `context.TODO()` or `context.Background()`. ## Warmers removed Warmers are no longer necessary and have been [removed in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_index_apis.html#_warmers). ## Optimize removed Optimize was deprecated in ES 2.0 and has been [removed in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_rest_api_changes.html#_literal__optimize_literal_endpoint_removed). Use [Force Merge](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) instead. ## Missing Query removed The `missing` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-exists-query.html#_literal_missing_literal_query). Use `exists` query with `must_not` in `bool` query instead. ## And Query removed The `and` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). Use `must` clauses in a `bool` query instead. ## Not Query removed TODO Is it removed? ## Or Query removed The `or` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). Use `should` clauses in a `bool` query instead. ## Filtered Query removed The `filtered` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). Use `bool` query instead, which supports `filter` clauses too. ## Limit Query removed The `limit` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). Use the `terminate_after` parameter instead. # Template Query removed The `template` query has been [deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-template-query.html). You should use Search Templates instead. We remove it from Elastic 5.0 as the 5.0 update is already a good opportunity to get rid of old stuff. ## `_timestamp` and `_ttl` removed Both of these fields were deprecated and are now [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_mapping_changes.html#_literal__timestamp_literal_and_literal__ttl_literal). ## Search template Put/Delete API returns `acknowledged` only The response type for Put/Delete search templates has changed. It only returns a single `acknowledged` flag now. ## Fields has been renamed to Stored Fields The `fields` parameter has been renamed to `stored_fields`. See [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_search_changes.html#_literal_fields_literal_parameter). ## Fielddatafields has been renamed to Docvaluefields The `fielddata_fields` parameter [has been renamed](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_search_changes.html#_literal_fielddata_fields_literal_parameter) to `docvalue_fields`. ## Type exists endpoint changed The endpoint for checking whether a type exists has been changed from `HEAD {index}/{type}` to `HEAD {index}/_mapping/{type}`. See [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_rest_api_changes.html#_literal_head_index_type_literal_replaced_with_literal_head_index__mapping_type_literal). ## Refresh parameter changed The `?refresh` parameter previously could be a boolean value. It indicated whether changes made by a request (e.g. by the Bulk API) should be immediately visible in search, or not. Using `refresh=true` had the positive effect of immediately seeing the changes when searching; the negative effect is that it is a rather big performance hit. With 5.0, you now have the choice between these 3 values. * `"true"` - Refresh immediately * `"false"` - Do not refresh (the default value) * `"wait_for"` - Wait until ES made the document visible in search See [?refresh](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-refresh.html) in the documentation. Notice that `true` and `false` (the boolean values) are no longer available now in Elastic. You must use a string instead, with one of the above values. ## ReindexerService removed The `ReindexerService` was a custom solution that was started in the ES 1.x era to automate reindexing data, from one index to another or even between clusters. ES 2.3 introduced its own [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) so we're going to remove our custom solution and ask you to use the native reindexer. The `ReindexService` is available via `client.Reindex()` (which used to point to the custom reindexer). ## Delete By Query back in core The [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) was moved into a plugin in 2.0. Now its back in core with a complete rewrite based on the Bulk API. It has it's own endpoint at `/_delete_by_query`. Delete By Query, Reindex, and Update By Query are very similar under the hood. ## Reindex, Delete By Query, and Update By Query response changed The response from the above APIs changed a bit. E.g. the `retries` value used to be an `int64` and returns separate values for `bulk` and `search` now: ``` // Old { ... "retries": 123, ... } ``` ``` // New { ... "retries": { "bulk": 123, "search": 0 }, ... } ``` ## ScanService removed The `ScanService` is removed. Use the (new) `ScrollService` instead. ## New ScrollService There was confusion around `ScanService` and `ScrollService` doing basically the same. One was returning slices and didn't support all query details, the other returned one document after another and wasn't safe for concurrent use. So we merged the two and merged it into a new `ScrollService` that removes all the problems with the older services. In other words: If you used `ScanService`, switch to `ScrollService`. If you used the old `ScrollService`, you might need to fix some things but overall it should just work. Changes: - We replaced `elastic.EOS` with `io.EOF` to indicate the "end of scroll". TODO Not implemented yet ## Suggesters They have been [completely rewritten in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_suggester.html). Some changes: - Suggesters no longer have an [output](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_suggester.html#_simpler_completion_indexing). TODO Fix all structural changes in suggesters ## Percolator Percolator has [changed considerably](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_percolator.html). Elastic 5.0 adds the new [Percolator Query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-percolate-query.html) which can be used in combination with the new [Percolator type](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/percolator.html). The Percolate service is removed from Elastic 5.0. ## Remove Consistency, add WaitForActiveShards The `consistency` parameter has been removed in a lot of places, e.g. the Bulk, Index, Delete, Delete-by-Query, Reindex, Update, and Update-by-Query API. It has been replaced by a somewhat similar `wait_for_active_shards` parameter. See https://github.com/elastic/elasticsearch/pull/19454.
{ "pile_set_name": "Github" }
<?php /** * Copyright since 2007 PrestaShop SA and Contributors * PrestaShop is an International Registered Trademark & Property of PrestaShop SA * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://devdocs.prestashop.com/ for more information. * * @author PrestaShop SA and Contributors <[email protected]> * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShop\PrestaShop\Adapter\Supplier\CommandHandler; use Address; use PrestaShop\PrestaShop\Adapter\Supplier\AbstractSupplierHandler; use PrestaShop\PrestaShop\Core\Domain\Supplier\Command\EditSupplierCommand; use PrestaShop\PrestaShop\Core\Domain\Supplier\CommandHandler\EditSupplierHandlerInterface; use PrestaShop\PrestaShop\Core\Domain\Supplier\Exception\SupplierException; use PrestaShopException; use Supplier; /** * Handles command which edits supplier using legacy object model */ final class EditSupplierHandler extends AbstractSupplierHandler implements EditSupplierHandlerInterface { /** * {@inheritdoc} * * @throws SupplierException */ public function handle(EditSupplierCommand $command) { $supplierId = $command->getSupplierId(); $supplier = $this->getSupplier($supplierId); $address = $this->getSupplierAddress($supplierId); $this->populateSupplierWithData($supplier, $command); $this->populateAddressWithData($address, $command); try { $this->validateFields($supplier, $address); if (false === $supplier->update()) { throw new SupplierException(sprintf('Cannot update supplier with id "%s"', $supplier->id)); } if (false === $address->update()) { throw new SupplierException(sprintf('Cannot update supplier address with id "%s"', $address->id)); } if (null !== $command->getAssociatedShops()) { $this->associateWithShops($supplier, $command->getAssociatedShops()); } } catch (PrestaShopException $e) { throw new SupplierException(sprintf('Cannot update supplier with id "%s"', $supplier->id)); } } /** * Populates Supplier object with given data * * @param Supplier $supplier * @param EditSupplierCommand $command */ private function populateSupplierWithData(Supplier $supplier, EditSupplierCommand $command) { if (null !== $command->getName()) { $supplier->name = $command->getName(); } if (null !== $command->getLocalizedDescriptions()) { $supplier->description = $command->getLocalizedDescriptions(); } if (null !== $command->getLocalizedMetaDescriptions()) { $supplier->meta_description = $command->getLocalizedMetaDescriptions(); } if (null !== $command->getLocalizedMetaKeywords()) { $supplier->meta_keywords = $command->getLocalizedMetaKeywords(); } if (null !== $command->getLocalizedMetaTitles()) { $supplier->meta_title = $command->getLocalizedMetaTitles(); } if (null !== $command->isEnabled()) { $supplier->active = $command->isEnabled(); } $supplier->date_upd = date('Y-m-d H:i:s'); } /** * Populates Supplier address with given data * * @param Address $address * @param EditSupplierCommand $command */ private function populateAddressWithData(Address $address, EditSupplierCommand $command) { if (null !== $command->getAddress()) { $address->address1 = $command->getAddress(); } if (null !== $command->getAddress2()) { $address->address2 = $command->getAddress2(); } if (null !== $command->getPostCode()) { $address->postcode = $command->getPostCode(); } if (null !== $command->getPhone()) { $address->phone = $command->getPhone(); } if (null !== $command->getMobilePhone()) { $address->phone_mobile = $command->getMobilePhone(); } if (null !== $command->getCity()) { $address->city = $command->getCity(); } if (null !== $command->getCountryId()) { $address->id_country = $command->getCountryId(); } if (null !== $command->getStateId()) { $address->id_state = $command->getStateId(); } if (null !== $command->getDni()) { $address->dni = $command->getDni(); } } }
{ "pile_set_name": "Github" }
gcr.io/google_containers/hyperkube-arm:v1.5.4
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:color="@android:color/white" android:state_checked="false"/> <item android:color="#FF7000" android:state_checked="true"/> </selector>
{ "pile_set_name": "Github" }
{if $searchresult_tooShort or $searchresult_error or $searchresult_noEntries or $searchresult_results} <p class="msg-notice search-msg"><span class="icon-info-circled" aria-hidden="true"></span> <b>{$CONST.QUICKSEARCH}:</b> {$content_message}</p> {elseif $content_message} <p class="msg-notice content-msg"><span class="icon-info-circled" aria-hidden="true"></span> {$content_message}</p> {/if} {$ENTRIES} {$ARCHIVES}
{ "pile_set_name": "Github" }
<cib admin_epoch="0" epoch="1" num_updates="1" dc-uuid="0" have-quorum="false" remote-tls-port="0" validate-with="pacemaker-3.0" cib-last-written="Fri Jul 13 13:51:13 2012"> <configuration> <crm_config> <cluster_property_set id="no-stonith"> <nvpair id="opt-no-stonith" name="stonith-enabled" value="false"/> </cluster_property_set> <cluster_property_set id="cib-bootstrap-options"> <nvpair id="nvpair.id21832" name="no-quorum-policy" value="ignore"/> </cluster_property_set> </crm_config> <nodes> <node id="uuid1" uname="node1" type="member"/> <node id="uuid2" uname="node2" type="member"/> </nodes> <resources> <primitive id="rsc1" class="ocf" provider="heartbeat" type="apache"> <meta_attributes id="primitive-rsc1.meta"> <nvpair id="multiple_active.meta.auto-21" name="multiple-active" value="stop_only"/> </meta_attributes> </primitive> </resources> <constraints/> </configuration> <status> <node_state id="uuid1" ha="active" uname="node1" crmd="online" join="member" expected="member" in_ccm="true"> <lrm id="any"> <lrm_resources id="lrm_resources.id21904"> <lrm_resource id="rsc1" class="ocf" provider="heartbeat" type="apache"> <lrm_rsc_op id="rsc1_start_0" operation="start" interval="0" op-status="0" rc-code="0" call-id="1" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" crm_feature_set="1.0.6" transition-key="0:0:0:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" transition-magic="0:0;0:0:0:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"/> </lrm_resource> </lrm_resources> </lrm> </node_state> <node_state id="uuid2" ha="active" uname="node2" crmd="online" join="member" expected="member" in_ccm="true"> <lrm id="any"> <lrm_resources id="lrm_resources.id21962"> <lrm_resource id="rsc1" class="ocf" provider="heartbeat" type="apache"> <lrm_rsc_op id="rsc1_start_0" operation="start" interval="0" op-status="0" rc-code="0" call-id="1" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" crm_feature_set="1.0.6" transition-key="0:0:0:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" transition-magic="0:0;0:0:0:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"/> </lrm_resource> </lrm_resources> </lrm> </node_state> </status> </cib>
{ "pile_set_name": "Github" }
#import "EXPMatchers+beginWith.h" EXPMatcherImplementationBegin(beginWith, (id expected)) { BOOL actualIsNil = (actual == nil); BOOL expectedIsNil = (expected == nil); //This condition allows the comparison of an immutable string or ordered collection to the mutable type of the same BOOL actualAndExpectedAreCompatible = (([actual isKindOfClass:[NSString class]] && [expected isKindOfClass:[NSString class]]) || ([actual isKindOfClass:[NSArray class]] && [expected isKindOfClass:[NSArray class]]) || ([actual isKindOfClass:[NSOrderedSet class]] && [expected isKindOfClass:[NSOrderedSet class]])); prerequisite(^BOOL { return actualAndExpectedAreCompatible; }); match(^BOOL { if ([actual isKindOfClass:[NSString class]]) { return [actual hasPrefix:expected]; } else if ([actual isKindOfClass:[NSArray class]]) { if ([expected count] > [actual count] || [expected count] == 0) { return NO; } NSArray *subArray = [actual subarrayWithRange:NSMakeRange(0, [expected count])]; return [subArray isEqualToArray:expected]; } else { if ([expected count] > [actual count] || [expected count] == 0) { return NO; } NSOrderedSet *subset = [NSOrderedSet orderedSetWithOrderedSet:actual range:NSMakeRange(0, [expected count]) copyItems:NO]; return [subset isEqualToOrderedSet:expected]; } }); failureMessageForTo(^NSString *{ if (actualIsNil) return @"the object is nil/null"; if (expectedIsNil) return @"the expected value is nil/null"; if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; return [NSString stringWithFormat:@"expected: %@ to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; }); failureMessageForNotTo(^NSString *{ if (actualIsNil) return @"the object is nil/null"; if (expectedIsNil) return @"the expected value is nil/null"; if (!actualAndExpectedAreCompatible) return [NSString stringWithFormat:@"%@ and %@ are not instances of one of %@, %@, or %@", EXPDescribeObject(actual), EXPDescribeObject(expected), [NSString class], [NSArray class], [NSOrderedSet class]]; return [NSString stringWithFormat:@"expected: %@ not to begin with %@", EXPDescribeObject(actual), EXPDescribeObject(expected)]; }); } EXPMatcherImplementationEnd EXPMatcherAliasImplementation(startWith, beginWith, (id expected));
{ "pile_set_name": "Github" }
import { defaultRegionInfoProvider } from "./endpoints"; import { Logger as __Logger } from "@aws-sdk/types"; export const ClientSharedValues = { apiVersion: "2019-09-27", disableHostPrefix: false, logger: {} as __Logger, regionInfoProvider: defaultRegionInfoProvider, signingName: "ses", };
{ "pile_set_name": "Github" }
import 'dart:async'; import 'package:angel_orm/angel_orm.dart'; import 'package:logging/logging.dart'; // import 'package:pool/pool.dart'; import 'package:sqljocky5/connection/connection.dart'; import 'package:sqljocky5/sqljocky.dart'; class MySqlExecutor extends QueryExecutor { /// An optional [Logger] to write to. final Logger logger; final Querier _connection; MySqlExecutor(this._connection, {this.logger}); Future<void> close() { if (_connection is MySqlConnection) { return (_connection as MySqlConnection).close(); } else { return Future.value(); } } Future<Transaction> _startTransaction() { if (_connection is Transaction) { return Future.value(_connection as Transaction); } else if (_connection is MySqlConnection) { return (_connection as MySqlConnection).begin(); } else { throw StateError('Connection must be transaction or connection'); } } @override Future<List<List>> query( String tableName, String query, Map<String, dynamic> substitutionValues, [List<String> returningFields]) { // Change @id -> ? for (var name in substitutionValues.keys) { query = query.replaceAll('@$name', '?'); } logger?.fine('Query: $query'); logger?.fine('Values: $substitutionValues'); if (returningFields?.isNotEmpty != true) { return _connection .prepared(query, substitutionValues.values) .then((results) => results.map((r) => r.toList()).toList()); } else { return Future(() async { var tx = await _startTransaction(); try { var writeResults = await tx.prepared(query, substitutionValues.values); var fieldSet = returningFields.map((s) => '`$s`').join(','); var fetchSql = 'select $fieldSet from $tableName where id = ?;'; logger?.fine(fetchSql); var readResults = await tx.prepared(fetchSql, [writeResults.insertId]); var mapped = readResults.map((r) => r.toList()).toList(); await tx.commit(); return mapped; } catch (_) { await tx?.rollback(); rethrow; } }); } } @override Future<T> transaction<T>(FutureOr<T> Function(QueryExecutor) f) async { if (_connection is Transaction) { return await f(this); } Transaction tx; try { tx = await _startTransaction(); var executor = MySqlExecutor(tx, logger: logger); var result = await f(executor); await tx.commit(); return result; } catch (_) { await tx?.rollback(); rethrow; } } }
{ "pile_set_name": "Github" }
//===-- X86InstrBuilder.h - Functions to aid building x86 insts -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file exposes functions that may be used with BuildMI from the // MachineInstrBuilder.h file to handle X86'isms in a clean way. // // The BuildMem function may be used with the BuildMI function to add entire // memory references in a single, typed, function call. X86 memory references // can be very complex expressions (described in the README), so wrapping them // up behind an easier to use interface makes sense. Descriptions of the // functions are included below. // // For reference, the order of operands for memory references is: // (Operand), Base, Scale, Index, Displacement. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H #define LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H #include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineOperand.h" #include "llvm/MC/MCInstrDesc.h" #include <cassert> namespace llvm { /// X86AddressMode - This struct holds a generalized full x86 address mode. /// The base register can be a frame index, which will eventually be replaced /// with BP or SP and Disp being offsetted accordingly. The displacement may /// also include the offset of a global value. struct X86AddressMode { enum { RegBase, FrameIndexBase } BaseType; union { unsigned Reg; int FrameIndex; } Base; unsigned Scale; unsigned IndexReg; int Disp; const GlobalValue *GV; unsigned GVOpFlags; X86AddressMode() : BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(nullptr), GVOpFlags(0) { Base.Reg = 0; } void getFullAddress(SmallVectorImpl<MachineOperand> &MO) { assert(Scale == 1 || Scale == 2 || Scale == 4 || Scale == 8); if (BaseType == X86AddressMode::RegBase) MO.push_back(MachineOperand::CreateReg(Base.Reg, false, false, false, false, false, false, 0, false)); else { assert(BaseType == X86AddressMode::FrameIndexBase); MO.push_back(MachineOperand::CreateFI(Base.FrameIndex)); } MO.push_back(MachineOperand::CreateImm(Scale)); MO.push_back(MachineOperand::CreateReg(IndexReg, false, false, false, false, false, false, 0, false)); if (GV) MO.push_back(MachineOperand::CreateGA(GV, Disp, GVOpFlags)); else MO.push_back(MachineOperand::CreateImm(Disp)); MO.push_back(MachineOperand::CreateReg(0, false, false, false, false, false, false, 0, false)); } }; /// Compute the addressing mode from an machine instruction starting with the /// given operand. static inline X86AddressMode getAddressFromInstr(const MachineInstr *MI, unsigned Operand) { X86AddressMode AM; const MachineOperand &Op0 = MI->getOperand(Operand); if (Op0.isReg()) { AM.BaseType = X86AddressMode::RegBase; AM.Base.Reg = Op0.getReg(); } else { AM.BaseType = X86AddressMode::FrameIndexBase; AM.Base.FrameIndex = Op0.getIndex(); } const MachineOperand &Op1 = MI->getOperand(Operand + 1); AM.Scale = Op1.getImm(); const MachineOperand &Op2 = MI->getOperand(Operand + 2); AM.IndexReg = Op2.getReg(); const MachineOperand &Op3 = MI->getOperand(Operand + 3); if (Op3.isGlobal()) AM.GV = Op3.getGlobal(); else AM.Disp = Op3.getImm(); return AM; } /// addDirectMem - This function is used to add a direct memory reference to the /// current instruction -- that is, a dereference of an address in a register, /// with no scale, index or displacement. An example is: DWORD PTR [EAX]. /// static inline const MachineInstrBuilder & addDirectMem(const MachineInstrBuilder &MIB, unsigned Reg) { // Because memory references are always represented with five // values, this adds: Reg, 1, NoReg, 0, NoReg to the instruction. return MIB.addReg(Reg).addImm(1).addReg(0).addImm(0).addReg(0); } /// Replace the address used in the instruction with the direct memory /// reference. static inline void setDirectAddressInInstr(MachineInstr *MI, unsigned Operand, unsigned Reg) { // Direct memory address is in a form of: Reg/FI, 1 (Scale), NoReg, 0, NoReg. MI->getOperand(Operand).ChangeToRegister(Reg, /*isDef=*/false); MI->getOperand(Operand + 1).setImm(1); MI->getOperand(Operand + 2).setReg(0); MI->getOperand(Operand + 3).ChangeToImmediate(0); MI->getOperand(Operand + 4).setReg(0); } static inline const MachineInstrBuilder & addOffset(const MachineInstrBuilder &MIB, int Offset) { return MIB.addImm(1).addReg(0).addImm(Offset).addReg(0); } static inline const MachineInstrBuilder & addOffset(const MachineInstrBuilder &MIB, const MachineOperand& Offset) { return MIB.addImm(1).addReg(0).add(Offset).addReg(0); } /// addRegOffset - This function is used to add a memory reference of the form /// [Reg + Offset], i.e., one with no scale or index, but with a /// displacement. An example is: DWORD PTR [EAX + 4]. /// static inline const MachineInstrBuilder & addRegOffset(const MachineInstrBuilder &MIB, unsigned Reg, bool isKill, int Offset) { return addOffset(MIB.addReg(Reg, getKillRegState(isKill)), Offset); } /// addRegReg - This function is used to add a memory reference of the form: /// [Reg + Reg]. static inline const MachineInstrBuilder &addRegReg(const MachineInstrBuilder &MIB, unsigned Reg1, bool isKill1, unsigned Reg2, bool isKill2) { return MIB.addReg(Reg1, getKillRegState(isKill1)).addImm(1) .addReg(Reg2, getKillRegState(isKill2)).addImm(0).addReg(0); } static inline const MachineInstrBuilder & addFullAddress(const MachineInstrBuilder &MIB, const X86AddressMode &AM) { assert(AM.Scale == 1 || AM.Scale == 2 || AM.Scale == 4 || AM.Scale == 8); if (AM.BaseType == X86AddressMode::RegBase) MIB.addReg(AM.Base.Reg); else { assert(AM.BaseType == X86AddressMode::FrameIndexBase); MIB.addFrameIndex(AM.Base.FrameIndex); } MIB.addImm(AM.Scale).addReg(AM.IndexReg); if (AM.GV) MIB.addGlobalAddress(AM.GV, AM.Disp, AM.GVOpFlags); else MIB.addImm(AM.Disp); return MIB.addReg(0); } /// addFrameReference - This function is used to add a reference to the base of /// an abstract object on the stack frame of the current function. This /// reference has base register as the FrameIndex offset until it is resolved. /// This allows a constant offset to be specified as well... /// static inline const MachineInstrBuilder & addFrameReference(const MachineInstrBuilder &MIB, int FI, int Offset = 0) { MachineInstr *MI = MIB; MachineFunction &MF = *MI->getParent()->getParent(); MachineFrameInfo &MFI = MF.getFrameInfo(); const MCInstrDesc &MCID = MI->getDesc(); auto Flags = MachineMemOperand::MONone; if (MCID.mayLoad()) Flags |= MachineMemOperand::MOLoad; if (MCID.mayStore()) Flags |= MachineMemOperand::MOStore; MachineMemOperand *MMO = MF.getMachineMemOperand( MachinePointerInfo::getFixedStack(MF, FI, Offset), Flags, MFI.getObjectSize(FI), MFI.getObjectAlign(FI)); return addOffset(MIB.addFrameIndex(FI), Offset) .addMemOperand(MMO); } /// addConstantPoolReference - This function is used to add a reference to the /// base of a constant value spilled to the per-function constant pool. The /// reference uses the abstract ConstantPoolIndex which is retained until /// either machine code emission or assembly output. In PIC mode on x86-32, /// the GlobalBaseReg parameter can be used to make this a /// GlobalBaseReg-relative reference. /// static inline const MachineInstrBuilder & addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI, unsigned GlobalBaseReg, unsigned char OpFlags) { //FIXME: factor this return MIB.addReg(GlobalBaseReg).addImm(1).addReg(0) .addConstantPoolIndex(CPI, 0, OpFlags).addReg(0); } } // end namespace llvm #endif // LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H
{ "pile_set_name": "Github" }
package com.flycms.module.topic.dao; import com.flycms.module.topic.model.Topic; import com.flycms.module.topic.model.TopicCategory; import com.flycms.module.topic.model.TopicEdit; import com.flycms.module.topic.model.TopicInfo; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.Date; import java.util.List; /** * Open source house, All rights reserved * 开发公司:28844.com<br/> * 版权:开源中国<br/> * * @author sun-kaifei * @version 1.0 <br/> * @email [email protected] * @Date: 10:08 2018/8/18 */ @Repository public interface TopicDao { // /////////////////////////////// // ///// 增加 //////// // /////////////////////////////// //添加话题 public int addTopic(Topic topic); /** * 添加话题与个信息关联 * * @param infoId * 用户id * @param topicId * 话题id * @param infoType * 信息类型,0问题,1文章,2分享 * @param status * 信息显示状态,默认为显示,0不显示,1显示 * @return */ public int addTopicAndInfo(@Param("id") Long id,@Param("infoId") Long infoId,@Param("topicId") Long topicId,@Param("infoType") Integer infoType,@Param("status") Integer status); /** * 添加用户关注的关注的标签id * * @param userId * 用户id * @param topicId * 话题id * @param createTime * 添加时间 * @return */ public int addTopicAndUser(@Param("userId") Long userId,@Param("topicId") Long topicId,@Param("createTime") Date createTime); //添加话题分类信息 public int addTopicCategory(TopicCategory topicCategory); //用户增加编辑话题信息 public int addUserEditTopic(TopicEdit topicEdit); // /////////////////////////////// // ///// 刪除 //////// // /////////////////////////////// /** * 按id删除话题 * * @param id * @return */ public int deleteTopicById(@Param("id") Integer id); /** * 按用户id和话题id删除关注的话题信息 * * @param userId * 用户id * @param topicId * 话题id * @return */ public int deleteTopicbyUserId(@Param("userId") Long userId,@Param("topicId") Long topicId); /** * 按用户id和话题id删除关注的话题信息 * * @param infoId * 信息id * @param topicId * 话题id * @param infoType * 信息类型 * @return */ public int deleteTopicAndInfo(@Param("infoId") Long infoId,@Param("topicId") Long topicId,@Param("infoType") Integer infoType); // /////////////////////////////// // ///// 修改 //////// // /////////////////////////////// /** * 按id更新标签信息 * * @param topic * @return */ public int updateTopicById(Topic topic); /** * 按id更新话题统计信息 * * @param id * @return */ public int updateTopicByCount(@Param("id") long id); /** * 按id更新审核状态 * * @param status * @param id * @return */ public int updateTagStatus(@Param("status") Integer status,@Param("id") long id); /** * 该话题被关注数量 * * @param id * @return */ public int updateTopicFollowByCount(@Param("id") long id); // /////////////////////////////// // ///// 查詢 //////// // /////////////////////////////// //按id查询话题信息 public Topic findTopicByShorturl(@Param("shortUrl") String shortUrl); /** * 按id查询话题 * * @param id * 话题id * @param status * 审核状态:0所有状态,1未审核,2审核 * @return */ public Topic findTopicById(@Param("id") Long id,@Param("status") Integer status); /** * 按话题查询该话题信息 * * @param topic * 话题 * @return */ public Topic findTopicByTopic(@Param("topic") String topic); /** * 查询文章短域名是否存在 * * @param shortUrl * @return */ public int checkTopicByShorturl(@Param("shortUrl") String shortUrl); /** * 按话题查询是否存在 * * @param topic * 话题 * @return */ public int checkTopicByTopic(@Param("topic") String topic); /** * 查询用户下是否该关注标签 * * @param userId * 用户id * @param topicId * 话题id * @return */ public int checkTopicByUserId(@Param("userId") Long userId,@Param("topicId") Long topicId); /** * 查询标签所有数量 * * @return */ public int getTopicCount( @Param("topic") String topic, @Param("type") String type, @Param("isgood") Integer isgood, @Param("status") Integer status ); /** * 查标签列表 * * @param offset * @param rows * @return */ public List<Topic> getTopicList( @Param("topic") String topic, @Param("type") String type, @Param("isgood") Integer isgood, @Param("status") Integer status, @Param("orderBy") String orderBy, @Param("order") String order, @Param("offset") Integer offset, @Param("rows") Integer rows); /** * 查标签列表 * * @param offset * @param rows * @return */ public List<Topic> getTopicRandList( @Param("topic") String topic, @Param("type") String type, @Param("isgood") Integer isgood, @Param("status") Integer status, @Param("orderBy") String orderBy, @Param("order") String order, @Param("offset") Integer offset, @Param("rows") Integer rows); /** * 查询所有tag信息 * * @return */ public List<Topic> allWord(); /** * 查询话题关联的信息数量 * * @param infoType * 分类id,0问答,1文章,2分享 * @param topicId * 话题id * @param status * 信息显示状态,默认为显示,0不显示,1显示 * * @return */ public int getTopicAndInfoCount( @Param("infoType") Integer infoType, @Param("topicId") Long topicId, @Param("status") Integer status); /** * * 查询话题关联的信息list * * @param infoType * 分类id,0问答,1文章,2分享 * @param topicId * 话题id * @param status * 信息显示状态,默认为显示,0不显示,1显示 * @param orderBy * @param order * @param offset * @param rows * @return */ public List<TopicInfo> getTopicAndInfoList( @Param("infoType") Integer infoType, @Param("topicId") Long topicId, @Param("status") Integer status, @Param("orderBy") String orderBy, @Param("order") String order, @Param("offset") Integer offset, @Param("rows") Integer rows); /** * 按文章id查询所有文章关联的话题 * * @param infoType * 分类id,0问答,1文章,2分享 * @param infoId * 文章id * @return */ public List<Topic> getInfoByTopicList(@Param("infoType") Integer infoType,@Param("infoId") long infoId); /** * 按用户id查询所有关注标签数量 * * @param userId * @return */ public int getUserTagsCount(@Param("user_id") long userId); /** * 按用户id查询所有关注标签列表 * * @param userId * @return */ public List<Topic> getUserTagsList(@Param("user_id") long userId, @Param("offset") Integer offset, @Param("rows") Integer rows); }
{ "pile_set_name": "Github" }
var Document = require('../../../substance/document'); var Annotation = require('../annotation/annotation'); var Link = function(node, doc) { Annotation.call(this, node, doc); }; Link.type = { id: "link", parent: "annotation", properties: { "url": "string" } }; Link.Prototype = function() {}; Link.Prototype.prototype = Annotation.prototype; Link.prototype = new Link.Prototype(); Link.prototype.constructor = Link; // Do not fragment this annotation Link.fragmentation = Annotation.NEVER; Document.Node.defineProperties(Link); module.exports = Link;
{ "pile_set_name": "Github" }
/* This file is part of the dynarmic project. * Copyright (c) 2016 MerryMage * SPDX-License-Identifier: 0BSD */ #pragma once #include <optional> #include "common/assert.h" #include "common/bit_util.h" #include "common/common_types.h" #include "common/fp/rounding_mode.h" namespace Dynarmic::FP { /** * Representation of the Floating-Point Control Register. */ class FPCR final { public: FPCR() = default; FPCR(const FPCR&) = default; FPCR(FPCR&&) = default; explicit FPCR(u32 data) : value{data & mask} {} FPCR& operator=(const FPCR&) = default; FPCR& operator=(FPCR&&) = default; FPCR& operator=(u32 data) { value = data & mask; return *this; } /// Get alternate half-precision control flag. bool AHP() const { return Common::Bit<26>(value); } /// Set alternate half-precision control flag. void AHP(bool ahp) { value = Common::ModifyBit<26>(value, ahp); } /// Get default NaN mode control bit. bool DN() const { return Common::Bit<25>(value); } /// Set default NaN mode control bit. void DN(bool dn) { value = Common::ModifyBit<25>(value, dn); } /// Get flush-to-zero mode control bit. bool FZ() const { return Common::Bit<24>(value); } /// Set flush-to-zero mode control bit. void FZ(bool fz) { value = Common::ModifyBit<24>(value, fz); } /// Get rounding mode control field. FP::RoundingMode RMode() const { return static_cast<FP::RoundingMode>(Common::Bits<22, 23>(value)); } /// Set rounding mode control field. void RMode(FP::RoundingMode rounding_mode) { ASSERT_MSG(static_cast<u32>(rounding_mode) <= 0b11, "FPCR: Invalid rounding mode"); value = Common::ModifyBits<22, 23>(value, static_cast<u32>(rounding_mode)); } /// Get the stride of a vector when executing AArch32 VFP instructions. /// This field has no function in AArch64 state. std::optional<size_t> Stride() const { switch (Common::Bits<20, 21>(value)) { case 0b00: return 1; case 0b11: return 2; default: return std::nullopt; } } /// Set the stride of a vector when executing AArch32 VFP instructions. /// This field has no function in AArch64 state. void Stride(size_t stride) { ASSERT_MSG(stride >= 1 && stride <= 2, "FPCR: Invalid stride"); value = Common::ModifyBits<20, 21>(value, stride == 1 ? 0b00u : 0b11u); } /// Get flush-to-zero (half-precision specific) mode control bit. bool FZ16() const { return Common::Bit<19>(value); } /// Set flush-to-zero (half-precision specific) mode control bit. void FZ16(bool fz16) { value = Common::ModifyBit<19>(value, fz16); } /// Gets the length of a vector when executing AArch32 VFP instructions. /// This field has no function in AArch64 state. size_t Len() const { return Common::Bits<16, 18>(value) + 1; } /// Sets the length of a vector when executing AArch32 VFP instructions. /// This field has no function in AArch64 state. void Len(size_t len) { ASSERT_MSG(len >= 1 && len <= 8, "FPCR: Invalid len"); value = Common::ModifyBits<16, 18>(value, static_cast<u32>(len - 1)); } /// Get input denormal exception trap enable flag. bool IDE() const { return Common::Bit<15>(value); } /// Set input denormal exception trap enable flag. void IDE(bool ide) { value = Common::ModifyBit<15>(value, ide); } /// Get inexact exception trap enable flag. bool IXE() const { return Common::Bit<12>(value); } /// Set inexact exception trap enable flag. void IXE(bool ixe) { value = Common::ModifyBit<12>(value, ixe); } /// Get underflow exception trap enable flag. bool UFE() const { return Common::Bit<11>(value); } /// Set underflow exception trap enable flag. void UFE(bool ufe) { value = Common::ModifyBit<11>(value, ufe); } /// Get overflow exception trap enable flag. bool OFE() const { return Common::Bit<10>(value); } /// Set overflow exception trap enable flag. void OFE(bool ofe) { value = Common::ModifyBit<10>(value, ofe); } /// Get division by zero exception trap enable flag. bool DZE() const { return Common::Bit<9>(value); } /// Set division by zero exception trap enable flag. void DZE(bool dze) { value = Common::ModifyBit<9>(value, dze); } /// Get invalid operation exception trap enable flag. bool IOE() const { return Common::Bit<8>(value); } /// Set invalid operation exception trap enable flag. void IOE(bool ioe) { value = Common::ModifyBit<8>(value, ioe); } /// Gets the underlying raw value within the FPCR. u32 Value() const { return value; } /// Gets the StandardFPSCRValue (A32 ASIMD). FPCR ASIMDStandardValue() const { FPCR stdvalue; stdvalue.AHP(AHP()); stdvalue.FZ16(FZ16()); stdvalue.FZ(true); stdvalue.DN(true); return stdvalue; } private: // Bits 0-7, 13-14, and 27-31 are reserved. static constexpr u32 mask = 0x07FF9F00; u32 value = 0; }; inline bool operator==(FPCR lhs, FPCR rhs) { return lhs.Value() == rhs.Value(); } inline bool operator!=(FPCR lhs, FPCR rhs) { return !operator==(lhs, rhs); } } // namespace Dynarmic::FP
{ "pile_set_name": "Github" }
/** * * WARNING! This file was autogenerated by: * _ _ _ _ __ __ * | | | | | | |\ \ / / * | | | | |_| | \ V / * | | | | _ | / \ * | |_| | | | |/ /^\ \ * \___/\_| |_/\/ \/ * * This file was autogenerated by UnrealHxGenerator using UHT definitions. * It only includes UPROPERTYs and UFUNCTIONs. Do not modify it! * In order to add more definitions, create or edit a type with the same name/package, but with an `_Extra` suffix **/ package unreal; /** Holds settings for the editor Launch On With Map Iterations test. **/ @:glueCppIncludes("Classes/Tests/AutomationTestSettings.h") @:noCopy @:noEquals @:uextern @:ustruct extern class FLaunchOnTestSettings { /** This is the device to be used for launch on. Example: WindowsNoEditor, Android, IOS, Linux **/ @:uproperty public var DeviceID : unreal.FString; /** Map to be used for the Launch On test * **/ @:uproperty public var LaunchOnTestmap : unreal.FFilePath; }
{ "pile_set_name": "Github" }
#include <iostream> #include <string> #include <occi.h> using namespace std; // import names (@\sref{sec:namespaces}@) using namespace oracle::occi; int main() { string dbConn= "172.17.42.1", user= "herbert", password= "NSA_go_away"; Environment *env = Environment::createEnvironment(); Connection *conn = env->createConnection(user, password, dbConn); string query= "select problem from my_solutions" " where award_worthy != 0"; Statement *stmt = conn->createStatement(query); ResultSet *rs = stmt->executeQuery(); while (rs->next()) cout << rs->getString(1) << endl; stmt->closeResultSet(rs); conn->terminateStatement(stmt); env->terminateConnection(conn); Environment::terminateEnvironment(env); } // Oracle queries #if 0 create user herbert identified by NSA_go_away ; grant create session, create table to herbert; alter user herbert quota 10m on system; create table my_solutions ( problem varchar2(100), award_worthy number(1) ); insert into my_solutions values ( 'Gauss circle', 1 ); insert into my_solutions values ( 'Congruent numbers', 0 ); insert into my_solutions values ( 'Amicable numbers', 1 ); #endif
{ "pile_set_name": "Github" }
#pragma once /** @addtogroup coreSolver * * @{ */ /*****************************************************************************/ /** Abstract interface class for numerical time integration methods in open modelica. \date October, 1st, 2008 \author */ /***************************************************************************** Copyright (c) 2008, OSMC *****************************************************************************/ class ISolver { public: /// Enumeration to control the time integration enum SOLVERCALL { UNDEF_CALL = 0x00000000, FIRST_CALL = 0x00000100, ///< First call to solver RECALL = 0x00000400, ///< Call to solver after restart (state vector of solver has to be reinitialized RECORDCALL = 0x00004000, ///< Erster Aufruf zum recorden von y0 }; /// Enum to define the current status of the solver enum SOLVERSTATUS { UNDEF_STATUS = 0x00000, CONTINUE = 0x00001, ///< Continue integration USER_STOP = 0x00002, ///< Integration stopped by user SOLVERERROR = 0x00004, ///< An error occurred. Integration was stopped DONE = 0x00008, ///< Integration successfully done }; /// Enumeration to denote the event status enum ZEROSTATUS { EQUAL_ZERO, ///< Value of zero function smaller than given tolerance (_zeroTol) ZERO_CROSSING, ///< zero crossing = change in sign of zero function NO_ZERO, ///< Even though zero crossing occurred, no value of zero function did not become zero in given interval UNCHANGED_SIGN ///< no zero crossing = continue time integration }; virtual ~ISolver() { }; /// Set start time virtual void setStartTime(const double& time) = 0; /// Set end time virtual void setEndTime(const double& time) = 0; /// Set the initial step size (needed for reinitialization after external zero search) virtual void setInitStepSize(const double& stepSize) = 0; /// (Re-) initialize the solver virtual void initialize() = 0; virtual bool stateSelection() = 0; /// Approximation of the numerical solution in a given time interval virtual void solve(const SOLVERCALL command = UNDEF_CALL) = 0; /// Provides the status of the solver after returning virtual SOLVERSTATUS getSolverStatus() = 0; ///sets time out in secondsW virtual void setTimeOut(unsigned int time_out) = 0; virtual void stop() = 0; /// Write out statistical information (statistical information of last simulation, e.g. time, number of steps, etc.) virtual void writeSimulationInfo() = 0; /// Indicates whether a solver error occurred during integration, returns type of error and provides error message /*virtual int reportErrorMessage(ostream& messageStream) = 0;*/ }; /** @} */ // end of coreSolver
{ "pile_set_name": "Github" }
<?php /* * This file is part of the HWIOAuthBundle package. * * (c) Hardware Info <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner; use Symfony\Component\OptionsResolver\OptionsResolver; /** * BitbucketResourceOwner. * * @author Joseph Bielawski <[email protected]> */ class BitbucketResourceOwner extends GenericOAuth1ResourceOwner { /** * {@inheritdoc} */ protected $paths = [ 'identifier' => 'user.username', 'nickname' => 'user.username', 'realname' => 'user.display_name', 'profilepicture' => 'user.avatar', ]; /** * {@inheritdoc} */ protected function configureOptions(OptionsResolver $resolver) { parent::configureOptions($resolver); $resolver->setDefaults([ 'authorization_url' => 'https://bitbucket.org/api/1.0/oauth/authenticate', 'request_token_url' => 'https://bitbucket.org/api/1.0/oauth/request_token', 'access_token_url' => 'https://bitbucket.org/api/1.0/oauth/access_token', 'infos_url' => 'https://bitbucket.org/api/1.0/user', ]); } }
{ "pile_set_name": "Github" }
(ns examples.test.macros.chain-2 (:use clojure.test examples.macros.chain-2)) (deftest test-chain-2 (are [x y] (= x y) (macroexpand-1 '(examples.macros.chain-2/chain a b)) '(. a b) (macroexpand-1 '(examples.macros.chain-2/chain a b c)) '(chain (. a b) c)))
{ "pile_set_name": "Github" }
# this is just a proof of concept toy. class RegOr def initialize(re1, re2) @re1 = re1 @re2 = re2 end def =~ (str) @re1 =~ str or @re2 =~ str end end class RegAnd def initialize(re1, re2) @re1 = re1 @re2 = re2 end def =~ (str) @re1 =~ str and @re2 =~ str end end class Regexp def |(other) RegOr.new(self, other) end def &(other) RegAnd.new(self, other) end end if __FILE__ == $0 p "abc" =~ /b/|/c/ p "abc" =~ /b/&/c/ end
{ "pile_set_name": "Github" }
#!/usr/bin/env ruby # # Simple(ish) Ruby Sinatra bot to verify that all commits on a Github # pull request have a Signed-off-by line in the commit message. # # Note that this code was heavily inspired by # http://git-scm.com/book/en/v2/GitHub-Scripting-GitHub # ############################################################################## require 'rubygems' require 'httparty' require 'sinatra' require 'json' # Put Sinatra on flatbed port 5000 (a fairly arbitrary choice) set :port, 5000 # Globals user_agent = 'ofiwg/signed-off-by-checker' # Read the Github auth token in from the environment (it wouldn't do # the hard-code it where it would show up in a public Github repo!) auth_token = ENV['GITHUB_AUTH_TOKEN'] if auth_token == nil then puts "Someone forgot to set \$GITHUB_AUTH_TOKEN before launching me. Aborting!\n" exit 1 end # Github webhooks are not delivered as HTTP GETs. If we don't have # this Sinatra method here, Sinatra displays a goofy error message if # someone just visits "https://url_to_this_script". get '/' do 'Nothing to see here but us chickens' end # Github delivers webhooks via HTTP POSTs. post '/' do push = JSON.parse(request.body.read) repo_name = push['repository']['full_name'] # If this is not a push on a pull request (i.e., if there's no # commits to examine, such as if this is a test webhook ping from # github), then just return HTTP status 200 (i.e., success) with a # handy message that you can see in the Github webhook debug logs. if push['action'] == nil || (push['action'] != 'synchronize' && push['action'] != 'opened') then return [200, 'This is not a pull request opened or synchronize push; nothing for this bot to do!'] end # This webhook will have only delivered the *new* commits on this # PR. We need to examine *all* the commits -- so we can discard the # commits that were delivered in this webhook push. Instead, do a # fetch to get all the commits on this PR (note: putting the # Authorization header in this request just in case this is a # private repo). commits_url = push['pull_request']['commits_url'] commits = HTTParty.get(commits_url, :headers => { 'Content-Type' => 'application/json', 'User-Agent' => user_agent, 'Authorization' => "token #{auth_token}" } ) # Sanity check: If we've got no commits, do nothing. if commits.length == 0 then return [200, 'Somehow there are no commits on this PR... Weird...'] end # Ok, we have commits. Go through them. happy = true targetURL = 'https://github.com/ofiwg/libfabric/wiki#how-to-contribute' debug_message = "checking debug URL: #{commits_url}\n\n" final_message = '' commits.each_with_index do |commit, index| sha = commit['sha'] status_url = "https://api.github.com/repos/#{repo_name}/statuses/#{sha}" debug_message += "examining commit index #{index} / sha #{sha}:\nstatus url: #{status_url}\n\n#{commit.to_json}\n\n" status = { 'context' => 'Signed-off-by checker' } # Look for a Signed-off-by string in this commit if /Signed-off-by/.match commit['commit']['message'] status['state'] = 'success' status['description'] = 'This commit is signed off' else status['state'] = 'failure' status['description'] = 'This commit is not signed off' status['target_url'] = targetURL happy = false end final_message = status['description'] # If this is the last commit in the array (and there's more than # one commit in the array), override its state and description to # represent the entire PR (because Github shows the status of the # last commit as the status of the overall PR). if index == (commits.length - 1) && index > 0 then if happy then status['state'] = 'success' status['description'] = 'All commits were signed off. Yay!' else status['state'] = 'failure' status['description'] = 'At least one commit was not signed off' status['target_url'] = targetURL end final_message = status['description'] end # Send the result back to Github for this specific commit HTTParty.post(status_url, :body => status.to_json, :headers => { 'Content-Type' => 'application/json', 'User-Agent' => user_agent, 'Authorization' => "token #{auth_token}" } ) end # Return HTTP status 200 (success) and a handy message that shows up # in the Github webhook debug logs. return [200, "#{debug_message} -- #{final_message}"] end
{ "pile_set_name": "Github" }
# Pattern\.BeginInputOrLine\(\) Method [Home](../../../../../../README.md) **Containing Type**: [Pattern](../README.md) **Assembly**: Pihrtsoft\.Text\.RegularExpressions\.Linq\.dll \ Appends a pattern that is matched at the beginning of the string \(or line if the [RegexOptions.Multiline](https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regexoptions.multiline) option is applied\)\. ```csharp public Pihrtsoft.Text.RegularExpressions.Linq.QuantifiablePattern BeginInputOrLine() ``` ### Returns [QuantifiablePattern](../../QuantifiablePattern/README.md)
{ "pile_set_name": "Github" }
# test_config.py # Copyright (C) 2008, 2009 Michael Trier ([email protected]) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import glob import io from git import ( GitConfigParser ) from git.compat import string_types from git.config import cp from git.test.lib import ( TestCase, fixture_path, SkipTest, ) from git.test.lib import with_rw_directory import os.path as osp from git.util import rmfile _tc_lock_fpaths = osp.join(osp.dirname(__file__), 'fixtures/*.lock') def _rm_lock_files(): for lfp in glob.glob(_tc_lock_fpaths): rmfile(lfp) class TestBase(TestCase): def setUp(self): _rm_lock_files() def tearDown(self): for lfp in glob.glob(_tc_lock_fpaths): if osp.isfile(lfp): raise AssertionError('Previous TC left hanging git-lock file: %s', lfp) def _to_memcache(self, file_path): with open(file_path, "rb") as fp: sio = io.BytesIO(fp.read()) sio.name = file_path return sio def test_read_write(self): # writer must create the exact same file as the one read before for filename in ("git_config", "git_config_global"): file_obj = self._to_memcache(fixture_path(filename)) with GitConfigParser(file_obj, read_only=False) as w_config: w_config.read() # enforce reading assert w_config._sections w_config.write() # enforce writing # we stripped lines when reading, so the results differ assert file_obj.getvalue() self.assertEqual(file_obj.getvalue(), self._to_memcache(fixture_path(filename)).getvalue()) # creating an additional config writer must fail due to exclusive access with self.assertRaises(IOError): GitConfigParser(file_obj, read_only=False) # should still have a lock and be able to make changes assert w_config._lock._has_lock() # changes should be written right away sname = "my_section" oname = "mykey" val = "myvalue" w_config.add_section(sname) assert w_config.has_section(sname) w_config.set(sname, oname, val) assert w_config.has_option(sname, oname) assert w_config.get(sname, oname) == val sname_new = "new_section" oname_new = "new_key" ival = 10 w_config.set_value(sname_new, oname_new, ival) assert w_config.get_value(sname_new, oname_new) == ival file_obj.seek(0) r_config = GitConfigParser(file_obj, read_only=True) assert r_config.has_section(sname) assert r_config.has_option(sname, oname) assert r_config.get(sname, oname) == val # END for each filename def test_includes_order(self): with GitConfigParser(list(map(fixture_path, ("git_config", "git_config_global")))) as r_config: r_config.read() # enforce reading # Simple inclusions, again checking them taking precedence assert r_config.get_value('sec', 'var0') == "value0_included" # This one should take the git_config_global value since included # values must be considered as soon as they get them assert r_config.get_value('diff', 'tool') == "meld" try: assert r_config.get_value('sec', 'var1') == "value1_main" except AssertionError: raise SkipTest( 'Known failure -- included values are not in effect right away' ) @with_rw_directory def test_lock_reentry(self, rw_dir): fpl = osp.join(rw_dir, 'l') gcp = GitConfigParser(fpl, read_only=False) with gcp as cw: cw.set_value('include', 'some_value', 'a') # entering again locks the file again... with gcp as cw: cw.set_value('include', 'some_other_value', 'b') # ...so creating an additional config writer must fail due to exclusive access with self.assertRaises(IOError): GitConfigParser(fpl, read_only=False) # but work when the lock is removed with GitConfigParser(fpl, read_only=False): assert osp.exists(fpl) # reentering with an existing lock must fail due to exclusive access with self.assertRaises(IOError): gcp.__enter__() def test_multi_line_config(self): file_obj = self._to_memcache(fixture_path("git_config_with_comments")) with GitConfigParser(file_obj, read_only=False) as config: ev = "ruby -e '\n" ev += " system %(git), %(merge-file), %(--marker-size=%L), %(%A), %(%O), %(%B)\n" ev += " b = File.read(%(%A))\n" ev += " b.sub!(/^<+ .*\\nActiveRecord::Schema\\.define.:version => (\\d+). do\\n=+\\nActiveRecord::Schema\\." # noqa E501 ev += "define.:version => (\\d+). do\\n>+ .*/) do\n" ev += " %(ActiveRecord::Schema.define(:version => #{[$1, $2].max}) do)\n" ev += " end\n" ev += " File.open(%(%A), %(w)) {|f| f.write(b)}\n" ev += " exit 1 if b.include?(%(<)*%L)'" self.assertEqual(config.get('merge "railsschema"', 'driver'), ev) self.assertEqual(config.get('alias', 'lg'), "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset'" " --abbrev-commit --date=relative") self.assertEqual(len(config.sections()), 23) def test_base(self): path_repo = fixture_path("git_config") path_global = fixture_path("git_config_global") r_config = GitConfigParser([path_repo, path_global], read_only=True) assert r_config.read_only num_sections = 0 num_options = 0 # test reader methods assert r_config._is_initialized is False for section in r_config.sections(): num_sections += 1 for option in r_config.options(section): num_options += 1 val = r_config.get(section, option) val_typed = r_config.get_value(section, option) assert isinstance(val_typed, (bool, int, float, ) + string_types) assert val assert "\n" not in option assert "\n" not in val # writing must fail with self.assertRaises(IOError): r_config.set(section, option, None) with self.assertRaises(IOError): r_config.remove_option(section, option) # END for each option with self.assertRaises(IOError): r_config.remove_section(section) # END for each section assert num_sections and num_options assert r_config._is_initialized is True # get value which doesnt exist, with default default = "my default value" assert r_config.get_value("doesnt", "exist", default) == default # it raises if there is no default though with self.assertRaises(cp.NoSectionError): r_config.get_value("doesnt", "exist") @with_rw_directory def test_config_include(self, rw_dir): def write_test_value(cw, value): cw.set_value(value, 'value', value) # end def check_test_value(cr, value): assert cr.get_value(value, 'value') == value # end # PREPARE CONFIG FILE A fpa = osp.join(rw_dir, 'a') with GitConfigParser(fpa, read_only=False) as cw: write_test_value(cw, 'a') fpb = osp.join(rw_dir, 'b') fpc = osp.join(rw_dir, 'c') cw.set_value('include', 'relative_path_b', 'b') cw.set_value('include', 'doesntexist', 'foobar') cw.set_value('include', 'relative_cycle_a_a', 'a') cw.set_value('include', 'absolute_cycle_a_a', fpa) assert osp.exists(fpa) # PREPARE CONFIG FILE B with GitConfigParser(fpb, read_only=False) as cw: write_test_value(cw, 'b') cw.set_value('include', 'relative_cycle_b_a', 'a') cw.set_value('include', 'absolute_cycle_b_a', fpa) cw.set_value('include', 'relative_path_c', 'c') cw.set_value('include', 'absolute_path_c', fpc) # PREPARE CONFIG FILE C with GitConfigParser(fpc, read_only=False) as cw: write_test_value(cw, 'c') with GitConfigParser(fpa, read_only=True) as cr: for tv in ('a', 'b', 'c'): check_test_value(cr, tv) # end for each test to verify assert len(cr.items('include')) == 8, "Expected all include sections to be merged" # test writable config writers - assure write-back doesn't involve includes with GitConfigParser(fpa, read_only=False, merge_includes=True) as cw: tv = 'x' write_test_value(cw, tv) with GitConfigParser(fpa, read_only=True) as cr: with self.assertRaises(cp.NoSectionError): check_test_value(cr, tv) # But can make it skip includes altogether, and thus allow write-backs with GitConfigParser(fpa, read_only=False, merge_includes=False) as cw: write_test_value(cw, tv) with GitConfigParser(fpa, read_only=True) as cr: check_test_value(cr, tv) def test_rename(self): file_obj = self._to_memcache(fixture_path('git_config')) with GitConfigParser(file_obj, read_only=False, merge_includes=False) as cw: with self.assertRaises(ValueError): cw.rename_section("doesntexist", "foo") with self.assertRaises(ValueError): cw.rename_section("core", "include") nn = "bee" assert cw.rename_section('core', nn) is cw assert not cw.has_section('core') assert len(cw.items(nn)) == 4 def test_complex_aliases(self): file_obj = self._to_memcache(fixture_path('.gitconfig')) with GitConfigParser(file_obj, read_only=False) as w_config: self.assertEqual(w_config.get('alias', 'rbi'), '"!g() { git rebase -i origin/${1:-master} ; } ; g"') self.assertEqual(file_obj.getvalue(), self._to_memcache(fixture_path('.gitconfig')).getvalue()) def test_empty_config_value(self): cr = GitConfigParser(fixture_path('git_config_with_empty_value'), read_only=True) assert cr.get_value('core', 'filemode'), "Should read keys with values" with self.assertRaises(cp.NoOptionError): cr.get_value('color', 'ui')
{ "pile_set_name": "Github" }