text
stringlengths
2
100k
meta
dict
/** * MegaMek - Copyright (C) 2007 Ben Mazur ([email protected]) * * 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. */ package megamek.common.weapons; import java.util.Vector; import megamek.common.AmmoType; import megamek.common.Compute; import megamek.common.Coords; import megamek.common.IGame; import megamek.common.Mounted; import megamek.common.Report; import megamek.common.TargetRoll; import megamek.common.ToHitData; import megamek.common.actions.WeaponAttackAction; import megamek.server.Server; /** * @author arlith */ public class MekMortarSmokeHandler extends AmmoWeaponHandler { /** * */ private static final long serialVersionUID = -2073773899108954657L; /** * @param t * @param w * @param g * @param s */ public MekMortarSmokeHandler(ToHitData t, WeaponAttackAction w, IGame g, Server s) { super(t, w, g, s); } /* * (non-Javadoc) * * @see megamek.common.weapons.WeaponHandler#calcDamagePerHit() */ @Override protected int calcDamagePerHit() { return 0; } /* * (non-Javadoc) * * @see megamek.common.weapons.AttackHandler#handle(int, java.util.Vector) */ @Override public boolean handle(IGame.Phase phase, Vector<Report> vPhaseReport) { if (!cares(phase)) { return true; } Coords targetPos = target.getPosition(); Mounted ammoUsed = ae.getEquipment(waa.getAmmoId()); final AmmoType atype = ammoUsed == null ? null : (AmmoType) ammoUsed .getType(); if ((atype == null) || (atype.getMunitionType() != AmmoType.M_SMOKE_WARHEAD)) { System.err.println("MekMortarFlareHandler: not using smoke ammo!"); return true; } // Report weapon attack and its to-hit value. Report r = new Report(3120); r.indent(); r.newlines = 0; r.subject = subjectId; if (wtype != null) { r.add(wtype.getName() + " " + atype.getSubMunitionName()); } else { r.add("Error: From Nowhwere"); } r.add(target.getDisplayName(), true); vPhaseReport.addElement(r); if (toHit.getValue() == TargetRoll.IMPOSSIBLE) { r = new Report(3135); r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r); return false; } else if (toHit.getValue() == TargetRoll.AUTOMATIC_FAIL) { r = new Report(3140); r.newlines = 0; r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r); } else if (toHit.getValue() == TargetRoll.AUTOMATIC_SUCCESS) { r = new Report(3145); r.newlines = 0; r.subject = subjectId; r.add(toHit.getDesc()); vPhaseReport.addElement(r); } else { // roll to hit r = new Report(3150); r.newlines = 0; r.subject = subjectId; r.add(toHit.getValue()); vPhaseReport.addElement(r); } // dice have been rolled, thanks r = new Report(3155); r.newlines = 0; r.subject = subjectId; r.add(roll); vPhaseReport.addElement(r); // do we hit? bMissed = roll < toHit.getValue(); // Set Margin of Success/Failure. toHit.setMoS(roll - Math.max(2, toHit.getValue())); int duration = wtype.getRackSize() * 2; if (!bMissed) { r = new Report(3190); r.subject = subjectId; r.add(targetPos.getBoardNum()); vPhaseReport.addElement(r); } else { // only scatters by one d6 targetPos = Compute.scatter(targetPos, 1); if (game.getBoard().contains(targetPos)) { // misses and scatters to another hex r = new Report(3195); r.subject = subjectId; r.add(targetPos.getBoardNum()); vPhaseReport.addElement(r); } else { // misses and scatters off-board r = new Report(3200); r.subject = subjectId; vPhaseReport.addElement(r); return !bMissed; } } server.deliverSmokeMortar(targetPos, vPhaseReport, duration); return false; } }
{ "pile_set_name": "Github" }
<div id="header"> <h1>iText<sup>&reg;</sup> XMLWorker</h1> </div> <h2>Introduction</h2> <p>The iText<sup>&reg;</sup> XMLWorker is a package created for transforming XML files to PDF. Although parsing XML was already possible with iText, a new version has been created. Many developers use the XML to PDF capabilities to parse simple HTML/XHTML snippets to PDF but the support for CSS was somewhat limited. In the new XMLWorker there is better support for CSS. Initially this is done purely for parsing XHTML tags with CSS2, which is created with a wysiwyg editors (e.g. TinyMCE or CKEditor) for instance. Of course it does not end here. By using the XMLWorker it is possible to parse all kinds of XML and use CSS in them, although this requires specific implementation of the XML-tags and/or CSS-styles.</p> <h2>Current Limitations</h2> <p>The XMLWorker is initially created to parse snippets and absolute positioning is not yet supported. As a result, it is currently not possible to surround everything with borders for instance. For the current CSS limitations see CSS Support.</p> <h2>Parsing XHTML/CSS snippets</h2> <p>Parsing XHTML snippets can be done with the default implementation for parsing HTML to PDF. See code examples for usage tips.</p> <h3>Supported tags</h3> <table> <tbody> <tr style="vertical-align: top;"><th>Tag</th><th>Comment</th><th>Supported Attributes</th></tr> <tr> <td>xml</td> <td>if available used for parsing charset / must be tested more deeply</td> <td>encoding</td> </tr> <tr> <td>html</td> <td>ignored</td> <td>&nbsp;</td> </tr> <tr> <td>head</td> <td>ignored</td> <td>&nbsp;</td> </tr> <tr> <td>title</td> <td>if a document is available, the title is set with <code>document.addTitle(title)</code>.</td> <td>&nbsp;</td> </tr> <tr> <td>meta</td> <td>parses http-equiv="Content-Type" and the charset</td> <td>http-equiv, content</td> </tr> <tr> <td>script</td> <td>ignored</td> <td>&nbsp;</td> </tr> <tr> <td>style</td> <td>parsed and added to css processing</td> <td>&nbsp;</td> </tr> <tr> <td>link</td> <td>css is parsed and added to global styles</td> <td>type, href</td> </tr> <tr> <td>body</td> <td>direct content in body is added</td> <td>&nbsp;</td> </tr> <tr> <td>a</td> <td>supported</td> <td>href, name</td> </tr> <tr> <td>br</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>div</td> <td>direct content in div is added</td> <td>&nbsp;</td> </tr> <tr> <td>h1 to h6</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>p</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>span</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>img</td> <td>supported</td> <td>src, width, height</td> </tr> <tr> <td>hr</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>ul, ol, li</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>dfn, dl, dt</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>table</td> <td>supported<br />Nested tables can work, but we advise against using them</td> <td>width, border, cellspacing, cellpadding</td> </tr> <tr> <td>tr</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>td, th</td> <td>supported</td> <td>width, rowspan, colspan</td> </tr> <tr> <td>thead, tfoot, tbody</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>caption</td> <td>caption element of a table is supported</td> <td>&nbsp;</td> </tr> <tr> <td>sub</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>sup</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>small, big</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>b, strong</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>u, ins</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>i, cite, em, var, dfn, address</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>pre, tt, code, kbd, samp</td> <td>supported</td> <td>&nbsp;</td> </tr> <tr> <td>s, strike, del</td> <td>supported</td> <td>&nbsp;</td> </tr> </tbody> </table> <h3>Known issues</h3> <p>The implementation is not fully finished. There are a couple areas that need to be fixed/improved and are still worked on.<br />It is possible not all CSS will behave as expected, there is a lot and not every possible combination is fully tested and implemented.<br />Javascript is totally ignored at the moment.<br />The provided snippets content character encoding is taken into account, but no tests has been done with it yet.</p> <h2>CSS Support</h2> <p>n = not supported, f = fully supported, s = somehow supported</p> <table> <tbody> <tr><th>Property<br />The CSS property (CSS2/3)</th><th>Text<br />CSS properties applicable on text</th><th>tables<br />CSS properties applicable on tables (table, td, tr)</th><th>list<br />CSS properties applicable on list (ul, ol, li)</th><th>image<br />CSS properties applicable on images (img)</th></tr> <tr> <td>background</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>background-attachment</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>background-color</td> <td>f</td> <td>f</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>background-image</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>background-position</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>background-repeat</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>border</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-bottom</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-bottom-color</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-bottom-style</td> <td>n</td> <td>s</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-bottom-width</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-color</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-collapse</td> <td>&nbsp;</td> <td>n - always collapsed</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>border-left</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-left-color</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-left-style</td> <td>n</td> <td>s</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-left-width</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-right</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-right-color</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-right-style</td> <td>n</td> <td>s</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-right-width</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-spacing</td> <td>&nbsp;</td> <td>n</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>border-style</td> <td>n</td> <td>s</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-top</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-top-color</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-top-style</td> <td>n</td> <td>s</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-top-width</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>border-width</td> <td>n</td> <td>f</td> <td>n</td> <td>n</td> </tr> <tr> <td>bottom</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>caption-side</td> <td>&nbsp;</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>clear</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>clip</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>color</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>content</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>counter-increment</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>counter-reset</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>cursor</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>direction</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>display</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>empty-cells</td> <td>&nbsp;</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>float</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>font</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>font-family</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>font-size</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>font-style</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>font-variant</td> <td>n</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>font-weight</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>height</td> <td>n</td> <td>f</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>left</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>letter-spacing</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>line-height</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>list-style</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>list-style-image</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>list-style-position</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>list-style-type</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>margin</td> <td>f</td> <td>f</td> <td>s (not on li)</td> <td>n</td> </tr> <tr> <td>margin-bottom</td> <td>f</td> <td>f</td> <td>f</td> <td>n</td> </tr> <tr> <td>margin-left</td> <td>f</td> <td>f</td> <td>f (not on li)</td> <td>n</td> </tr> <tr> <td>margin-right</td> <td>f</td> <td>f</td> <td>s (not on li)</td> <td>n</td> </tr> <tr> <td>margin-top</td> <td>f</td> <td>f</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>max-height</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>max-width</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>min-height</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>min-width</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>orphans</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>outline</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>outline-color</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>outline-style</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>outline-width</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>overflow</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>padding</td> <td>f</td> <td>f</td> <td>s</td> <td>n</td> </tr> <tr> <td>padding-bottom</td> <td>f</td> <td>f</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>padding-left</td> <td>f</td> <td>f</td> <td>f (not on li)</td> <td>&nbsp;</td> </tr> <tr> <td>padding-right</td> <td>f</td> <td>f</td> <td>f (not on li)</td> <td>&nbsp;</td> </tr> <tr> <td>padding-top</td> <td>f</td> <td>f</td> <td>f</td> <td>&nbsp;</td> </tr> <tr> <td>page-break-after</td> <td>s - only value always</td> <td>s - only value always</td> <td>s - only value always</td> <td>s - only value always</td> </tr> <tr> <td>page-break-before</td> <td>s - only value always</td> <td>s - only value always</td> <td>s - only value always</td> <td>s - only value always</td> </tr> <tr> <td>page-break-inside</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>position</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>quotes</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>right</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>table-layout</td> <td>&nbsp;</td> <td>s</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>text-align</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>text-decoration</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>text-indent</td> <td>f</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>text-shadow</td> <td>n</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>text-transform</td> <td>n</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>top</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>unicode-bidi</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>vertical-align</td> <td>f</td> <td>f</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>visibility</td> <td>n</td> <td>n</td> <td>n</td> <td>n</td> </tr> <tr> <td>white-space</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>widows</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>width</td> <td>n</td> <td>f</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>word-spacing</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> <tr> <td>z-index</td> <td>n</td> <td>n</td> <td>n</td> <td>&nbsp;</td> </tr> </tbody> </table> <h3>Notes</h3> <p>When using <code>page-break-before</code> and <code>page-break-after</code> inside tags that are 1 element in PDF (like lists or tables) the outcome of adding a new page is unpredicted.</p> <h2>Examples</h2> <h3>Default XHTML/CSS processing (Java):</h3> <p>The quick way</p> <pre> // create a document to write to final Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream("out.pdf")); // make sure it's open doc.open(); // read the html from somewhere BufferedInputStream bis = new BufferedInputStream(new FileInputStream("snippet.html")); // parse and listen for elements to add to the document helper.parseXHtml(new ElementHandler() { public void addAll(final List&lt;Element&gt; currentContent) throws DocumentException { for (Element e : currentContent) { doc.add(e); } } public void add(final Element e) throws DocumentException { doc.add(e); } }, new InputStreamReader(bis)); doc.close(); </pre> <p>The extended setup</p> <pre> // Create a TagProcessor DefaultTagProcessorFactory htmlTagProcessorFactory = (DefaultTagProcessorFactory) new Tags().getHtmlTagProcessorFactory(); // if needed override tag that you don't want to parse to DummyTagProcessor htmlTagProcessorFactory.addProcessor("img", new DummyTagProcessor()); htmlTagProcessorFactory.addProcessor("link", new DummyTagProcessor()); // Create a fresh configuration and set needed configuration objects. XMLWorkerConfigurationImpl config = new XMLWorkerConfigurationImpl(); // Attach the default CSS to a new CSSResolver CssFile defaultCSS = new XMLWorkerHelper().getDefaultCSS(); StyleAttrCSSResolver cssResolver = new StyleAttrCSSResolver(); cssResolver.addCssFile(defaultCSS); // attach more CSS files if needed cssResolver.addCssFile(otherCssFile); // set the TagProcessorFactory config.tagProcessorFactory(htmlTagProcessorFactory).cssResolver(cssResolver) .acceptUnknown(true); // create a document final Document doc = new Document(); doc.setPageSize(PageSize.A4); // create writer PdfWriter writer = PdfWriter.getInstance(doc, outputStream); writer.setPageEvent(new WatermarkEvent()); // set margins for first page float margin = CssUtils.getInstance().parsePxInCmMmPcToPt("8px"); doc.setMargins(margin, margin, margin, margin); // OPEN the document ! doc.open(); config.document(doc).pdfWriter(writer); // create the worker final XMLWorker worker = new XMLWorkerImpl(config); // attach an ElementHandler worker.setDocumentListener(new ElementHandler() { public void addAll(final List&lt;Element&gt; arg0) throws DocumentException { for (Element e : arg0) { doc.add(e); } } public void add(final Element e) throws DocumentException { doc.add(e); } }); // Set the worker in the parser and start parsing XMLParser p = new XMLParser(worker); p.parse(new StringReader(content)); writer.close(); </pre> <h2>Demo</h2> <p>There is an <a href="http://demo.itextsupport.com/xmlworker">online demo</a> available where input can be done through a tinyMCE editor and a PDF is created from the provided input.</p> <h2>Plans for the future</h2> <ul> <li>support absolute positioning, this would require an intermediate step to be added to the current transformation process.</li> <li>Provide a way to add none <code>com.itextpf.text.Element</code> objects to the document. (e.g. a ColumnText)</li> </ul>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2010-2012 LinkedIn, 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 krati.store; /** * StoreWriter * * @author jwu * @since 09/15, 2011 */ public interface StoreWriter<K, V> { /** * Maps the specified <code>key</code> to the specified <code>value</code> in this store. * * @param key - the key * @param value - the value * @return <code>true</code> if this store is changed as a result of this operation. * Otherwise, <cod>false</code>. * @throws Exception if this operation cannot be completed. */ public boolean put(K key, V value) throws Exception; /** * Removes the specified <code>key</code> from this store. * * @param key - the key * @return <code>true</code> if this store is changed as a result of this operation. * Otherwise, <cod>false</code>. * @throws Exception if this operation cannot be completed. */ public boolean delete(K key) throws Exception; }
{ "pile_set_name": "Github" }
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "TrackEditors/ParticleTrackEditor.h" #include "Rendering/DrawElements.h" #include "Framework/MultiBox/MultiBoxBuilder.h" #include "Curves/IntegralCurve.h" #include "SequencerSectionPainter.h" #include "EditorStyleSet.h" #include "Editor/UnrealEdEngine.h" #include "Particles/Emitter.h" #include "Particles/ParticleSystemComponent.h" #include "UnrealEdGlobals.h" #include "Tracks/MovieSceneParticleTrack.h" #include "ISectionLayoutBuilder.h" #include "Sections/MovieSceneParticleSection.h" #include "CommonMovieSceneTools.h" #include "Particles/ParticleLODLevel.h" #include "Particles/ParticleModuleRequired.h" #include "EnumKeyArea.h" #include "Matinee/InterpTrackToggle.h" #include "MatineeImportTools.h" namespace AnimatableParticleEditorConstants { // @todo Sequencer Allow this to be customizable const uint32 ParticleTrackHeight = 20; } #define LOCTEXT_NAMESPACE "FParticleTrackEditor" FParticleSection::FParticleSection( UMovieSceneSection& InSection, TSharedRef<ISequencer>InOwningSequencer ) : Section( InSection ) , OwningSequencerPtr( InOwningSequencer ) { ParticleKeyEnum = FindObject<UEnum>( ANY_PACKAGE, TEXT( "EParticleKey" ) ); checkf( ParticleKeyEnum != nullptr, TEXT( "FParticleSection could not find the EParticleKey UEnum by name." ) ) LeftKeyBrush = FEditorStyle::GetBrush( "Sequencer.KeyLeft" ); RightKeyBrush = FEditorStyle::GetBrush( "Sequencer.KeyRight" ); } FParticleSection::~FParticleSection() { } UMovieSceneSection* FParticleSection::GetSectionObject() { return &Section; } float FParticleSection::GetSectionHeight() const { return (float)AnimatableParticleEditorConstants::ParticleTrackHeight; } void FParticleSection::GenerateSectionLayout( class ISectionLayoutBuilder& LayoutBuilder ) const { UMovieSceneParticleSection* ParticleSection = Cast<UMovieSceneParticleSection>( &Section ); LayoutBuilder.SetSectionAsKeyArea( MakeShareable( new FEnumKeyArea( ParticleSection->GetParticleCurve(), ParticleSection, ParticleKeyEnum ) ) ); } int32 FParticleSection::OnPaintSection( FSequencerSectionPainter& InPainter ) const { TSharedPtr<ISequencer> OwningSequencer = OwningSequencerPtr.Pin(); if (!OwningSequencer.IsValid()) { return InPainter.LayerId + 1; } const ESlateDrawEffect DrawEffects = InPainter.bParentEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect; UMovieSceneParticleSection* AnimSection = Cast<UMovieSceneParticleSection>( &Section ); const FTimeToPixel& TimeToPixelConverter = InPainter.GetTimeConverter(); FLinearColor TrackColor; // @todo Sequencer - These values should be cached and then refreshed only when the particle system changes. bool bIsLooping = false; float LastEmitterEndTime = 0; UMovieSceneParticleSection* ParticleSection = Cast<UMovieSceneParticleSection>( &Section ); if ( ParticleSection != nullptr ) { UMovieSceneParticleTrack* ParentTrack = Cast<UMovieSceneParticleTrack>( ParticleSection->GetOuter() ); if ( ParentTrack != nullptr ) { TrackColor = ParentTrack->GetColorTint(); FGuid ObjectHandle; for ( const FMovieSceneBinding& Binding : OwningSequencer->GetFocusedMovieSceneSequence()->GetMovieScene()->GetBindings() ) { if ( Binding.GetTracks().Contains( ParentTrack ) ) { ObjectHandle = Binding.GetObjectGuid(); break; } } if ( ObjectHandle.IsValid() ) { for (TWeakObjectPtr<> Object : OwningSequencer->FindObjectsInCurrentSequence(ObjectHandle)) { UParticleSystemComponent* ParticleSystemComponent = Cast<UParticleSystemComponent>(Object.Get()); if(AEmitter* ParticleSystemActor = Cast<AEmitter>(Object.Get())) { ParticleSystemComponent = ParticleSystemActor->GetParticleSystemComponent(); } if ( ParticleSystemComponent != nullptr && ParticleSystemComponent->Template != nullptr ) { for ( UParticleEmitter* Emitter : ParticleSystemComponent->Template->Emitters ) { UParticleModuleRequired* RequiredModule = Emitter->GetLODLevel( 0 )->RequiredModule; bIsLooping |= RequiredModule->EmitterLoops == 0; LastEmitterEndTime = FMath::Max( LastEmitterEndTime, RequiredModule->EmitterDelay + RequiredModule->EmitterDuration ); } } } } } } // @todo Sequencer - This should only draw the visible ranges. TArray<TRange<float>> DrawRanges; TOptional<float> CurrentRangeStart; for ( auto KeyIterator = ParticleSection->GetParticleCurve().GetKeyIterator(); KeyIterator; ++KeyIterator ) { FIntegralKey Key = *KeyIterator; if ( (EParticleKey::Type)Key.Value == EParticleKey::Activate ) { if ( CurrentRangeStart.IsSet() == false ) { CurrentRangeStart = Key.Time; } else { if ( bIsLooping == false ) { if ( Key.Time > CurrentRangeStart.GetValue() + LastEmitterEndTime ) { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), CurrentRangeStart.GetValue() + LastEmitterEndTime ) ); } else { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), Key.Time ) ); } CurrentRangeStart = Key.Time; } } } if ( (EParticleKey::Type)Key.Value == EParticleKey::Deactivate ) { if ( CurrentRangeStart.IsSet() ) { if (bIsLooping) { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), Key.Time ) ); } else { if ( Key.Time > CurrentRangeStart.GetValue() + LastEmitterEndTime ) { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), CurrentRangeStart.GetValue() + LastEmitterEndTime ) ); } else { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), Key.Time ) ); } } CurrentRangeStart.Reset(); } } } if ( CurrentRangeStart.IsSet() ) { if ( bIsLooping ) { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), OwningSequencer->GetViewRange().GetUpperBoundValue() ) ); } else { DrawRanges.Add( TRange<float>( CurrentRangeStart.GetValue(), CurrentRangeStart.GetValue() + LastEmitterEndTime ) ); } } for ( const TRange<float>& DrawRange : DrawRanges ) { float XOffset = TimeToPixelConverter.TimeToPixel(DrawRange.GetLowerBoundValue()); float XSize = TimeToPixelConverter.TimeToPixel(DrawRange.GetUpperBoundValue()) - XOffset; FSlateDrawElement::MakeBox( InPainter.DrawElements, InPainter.LayerId, InPainter.SectionGeometry.ToPaintGeometry( FVector2D( XOffset, (InPainter.SectionGeometry.GetLocalSize().Y - SequencerSectionConstants::KeySize.Y) / 2 ), FVector2D( XSize, SequencerSectionConstants::KeySize.Y ) ), FEditorStyle::GetBrush( "Sequencer.Section.Background" ), DrawEffects ); FSlateDrawElement::MakeBox( InPainter.DrawElements, InPainter.LayerId, InPainter.SectionGeometry.ToPaintGeometry( FVector2D( XOffset, (InPainter.SectionGeometry.GetLocalSize().Y - SequencerSectionConstants::KeySize.Y) / 2 ), FVector2D( XSize, SequencerSectionConstants::KeySize.Y ) ), FEditorStyle::GetBrush( "Sequencer.Section.BackgroundTint" ), DrawEffects, TrackColor ); } return InPainter.LayerId+1; } const FSlateBrush* FParticleSection::GetKeyBrush( FKeyHandle KeyHandle ) const { UMovieSceneParticleSection* ParticleSection = Cast<UMovieSceneParticleSection>( &Section ); if ( ParticleSection != nullptr ) { FIntegralKey ParticleKey = ParticleSection->GetParticleCurve().GetKey(KeyHandle); if ( (EParticleKey::Type)ParticleKey.Value == EParticleKey::Activate ) { return LeftKeyBrush; } else if ( (EParticleKey::Type)ParticleKey.Value == EParticleKey::Deactivate ) { return RightKeyBrush; } } return nullptr; } FVector2D FParticleSection::GetKeyBrushOrigin( FKeyHandle KeyHandle ) const { UMovieSceneParticleSection* ParticleSection = Cast<UMovieSceneParticleSection>( &Section ); if ( ParticleSection != nullptr ) { FIntegralKey ParticleKey = ParticleSection->GetParticleCurve().GetKey(KeyHandle); if ( (EParticleKey::Type)ParticleKey.Value == EParticleKey::Activate ) { return FVector2D(-1.0f, 1.0f); } else if ( (EParticleKey::Type)ParticleKey.Value == EParticleKey::Deactivate ) { return FVector2D(1.0f, 1.0f); } } return FVector2D(0.0f, 0.0f); } FParticleTrackEditor::FParticleTrackEditor( TSharedRef<ISequencer> InSequencer ) : FMovieSceneTrackEditor( InSequencer ) { } TSharedRef<ISequencerTrackEditor> FParticleTrackEditor::CreateTrackEditor( TSharedRef<ISequencer> InSequencer ) { return MakeShareable( new FParticleTrackEditor( InSequencer ) ); } bool FParticleTrackEditor::SupportsType( TSubclassOf<UMovieSceneTrack> Type ) const { return Type == UMovieSceneParticleTrack::StaticClass(); } TSharedRef<ISequencerSection> FParticleTrackEditor::MakeSectionInterface( UMovieSceneSection& SectionObject, UMovieSceneTrack& Track, FGuid ObjectBinding ) { check( SupportsType( SectionObject.GetOuter()->GetClass() ) ); const TSharedPtr<ISequencer> OwningSequencer = GetSequencer(); return MakeShareable( new FParticleSection( SectionObject, OwningSequencer.ToSharedRef() ) ); } void FParticleTrackEditor::BuildObjectBindingTrackMenu(FMenuBuilder& MenuBuilder, const FGuid& ObjectBinding, const UClass* ObjectClass) { if (ObjectClass->IsChildOf(AEmitter::StaticClass()) || ObjectClass->IsChildOf(UParticleSystemComponent::StaticClass())) { const TSharedPtr<ISequencer> ParentSequencer = GetSequencer(); MenuBuilder.AddMenuEntry( LOCTEXT("AddParticleTrack", "Particle Toggle Track"), LOCTEXT("TriggerParticlesTooltip", "Adds a track for controlling particle emitter state."), FSlateIcon(), FUIAction(FExecuteAction::CreateSP(this, &FParticleTrackEditor::AddParticleKey, ObjectBinding)) ); } } void FParticleTrackEditor::AddParticleKey( const FGuid ObjectGuid ) { TSharedPtr<ISequencer> SequencerPtr = GetSequencer(); UObject* Object = SequencerPtr.IsValid() ? SequencerPtr->FindSpawnedObjectOrTemplate(ObjectGuid) : nullptr; if (Object) { AnimatablePropertyChanged( FOnKeyProperty::CreateRaw( this, &FParticleTrackEditor::AddKeyInternal, Object ) ); } } FKeyPropertyResult FParticleTrackEditor::AddKeyInternal( float KeyTime, UObject* Object ) { FKeyPropertyResult KeyPropertyResult; FFindOrCreateHandleResult HandleResult = FindOrCreateHandleToObject( Object ); FGuid ObjectHandle = HandleResult.Handle; KeyPropertyResult.bHandleCreated |= HandleResult.bWasCreated; if (ObjectHandle.IsValid()) { FFindOrCreateTrackResult TrackResult = FindOrCreateTrackForObject(ObjectHandle, UMovieSceneParticleTrack::StaticClass()); UMovieSceneTrack* Track = TrackResult.Track; KeyPropertyResult.bTrackCreated |= TrackResult.bWasCreated; if (KeyPropertyResult.bTrackCreated && ensure(Track)) { UMovieSceneParticleTrack* ParticleTrack = Cast<UMovieSceneParticleTrack>(Track); ParticleTrack->AddNewSection(KeyTime); ParticleTrack->SetDisplayName(LOCTEXT("TrackName", "Particle System")); KeyPropertyResult.bTrackModified = true; } } return KeyPropertyResult; } void CopyInterpParticleTrack(TSharedRef<ISequencer> Sequencer, UInterpTrackToggle* MatineeToggleTrack, UMovieSceneParticleTrack* ParticleTrack) { if (FMatineeImportTools::CopyInterpParticleTrack(MatineeToggleTrack, ParticleTrack)) { Sequencer.Get().NotifyMovieSceneDataChanged( EMovieSceneDataChangeType::MovieSceneStructureItemAdded ); } } void FParticleTrackEditor::BuildTrackContextMenu( FMenuBuilder& MenuBuilder, UMovieSceneTrack* Track ) { UInterpTrackToggle* MatineeToggleTrack = nullptr; for ( UObject* CopyPasteObject : GUnrealEd->MatineeCopyPasteBuffer ) { MatineeToggleTrack = Cast<UInterpTrackToggle>( CopyPasteObject ); if ( MatineeToggleTrack != nullptr ) { break; } } UMovieSceneParticleTrack* ParticleTrack = Cast<UMovieSceneParticleTrack>( Track ); MenuBuilder.AddMenuEntry( NSLOCTEXT( "Sequencer", "PasteMatineeToggleTrack", "Paste Matinee Particle Track" ), NSLOCTEXT( "Sequencer", "PasteMatineeToggleTrackTooltip", "Pastes keys from a Matinee particle track into this track." ), FSlateIcon(), FUIAction( FExecuteAction::CreateStatic( &CopyInterpParticleTrack, GetSequencer().ToSharedRef(), MatineeToggleTrack, ParticleTrack ), FCanExecuteAction::CreateLambda( [=]()->bool { return MatineeToggleTrack != nullptr && MatineeToggleTrack->ToggleTrack.Num() > 0 && ParticleTrack != nullptr; } ) ) ); } #undef LOCTEXT_NAMESPACE
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <PropertyGroup> <SchemaVersion>2.0</SchemaVersion> <ProjectVersion>6.0</ProjectVersion> <ProjectGuid>fee31e0f-40f4-11e0-93cf-000c29a22d21</ProjectGuid> <avrdevice>AT32UC3B0256</avrdevice> <avrdeviceseries>uc3b</avrdeviceseries> <OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory> <AvrGccProjectExtensions /> <AssemblyName>$(MSBuildProjectName)</AssemblyName> <Name>$(MSBuildProjectName)</Name> <RootNamespace>$(MSBuildProjectName)</RootNamespace> <OutputType>Executable</OutputType> <Language>C</Language> <ToolchainName>com.Atmel.AVRGCC32</ToolchainName> <ToolchainFlavour>Native</ToolchainFlavour> <avrtool /> <AsfFrameworkConfig> <framework-data> <options> <option id="avr32.drivers.gpio" value="Add" config="" content-id="Atmel.ASF" /> <option id="avr32.drivers.pm" value="Add" config="" content-id="Atmel.ASF" /> <option id="avr32.drivers.spi" value="Add" config="" content-id="Atmel.ASF" /> <option id="avr32.services.fs.fat" value="Add" config="" content-id="Atmel.ASF" /> <option id="common.boards" value="Add" config="" content-id="Atmel.ASF" /> <option id="common.services.storage.ctrl_access" value="Add" config="" content-id="Atmel.ASF" /> <option id="common.services.usb.class.hid.device.keyboard.single" value="Add" config="" content-id="Atmel.ASF" /> </options> <configurations> <configuration key="config.utils.interrupt.intc" value="yes" default="yes" content-id="Atmel.ASF" /> <configuration key="config.avr32.drivers.intc.exception" value="yes" default="yes" content-id="Atmel.ASF" /> <configuration key="config.avr32.utils.trampoline" value="yes" default="yes" content-id="Atmel.ASF" /> <configuration key="config.avr32.utils.gccstartup" value="yes" default="yes" content-id="Atmel.ASF" /> <configuration key="config.common.services.usb.device.optimization" value="normal" default="normal" content-id="Atmel.ASF" /> <configuration key="config.avr32.drivers.usbb.device.sleepmgr" value="with_sleepmgr" default="with_sleepmgr" content-id="Atmel.ASF" /> </configurations> <files> <file path="src/asf/common/utils/interrupt.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="common/utils/interrupt.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/file.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/file.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/fs_com.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fs_com.h" changed="False" content-id="Atmel.ASF" /> <file path="src/config/conf_explorer.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fat_example/conf_explorer.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/fat_unusual.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fat_unusual.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/file.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/file.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/boards/evk1101/led.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/boards/evk1101/led.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/pm/pm_conf_clocks.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/pm/pm_conf_clocks.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/navigation.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/navigation.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/intc/exception.S" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/intc/exception.S" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/navigation.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/navigation.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/fat.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fat.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/boards/evk1101/led.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/boards/evk1101/led.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/services/fs/fat/fat.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fat.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/spi/spi.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/spi/spi.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/preprocessor/stringz.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/preprocessor/stringz.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/status_codes.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/status_codes.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/intc/intc.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/intc/intc.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/intc/intc.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/intc/intc.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/boards/board.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="common/boards/board.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/pm/power_clocks_lib.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/pm/power_clocks_lib.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/flashc/flashc.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/flashc/flashc.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/pm/power_clocks_lib.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/pm/power_clocks_lib.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/storage/ctrl_access/ctrl_access.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="common/services/storage/ctrl_access/ctrl_access.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/boards/evk1101/evk1101.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/boards/evk1101/evk1101.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/pm/pm.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/pm/pm.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/storage/ctrl_access/ctrl_access.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="common/services/storage/ctrl_access/ctrl_access.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/preprocessor/mrepeat.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/preprocessor/mrepeat.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/pm/pm.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/pm/pm.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/preprocessor/preprocessor.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/preprocessor/preprocessor.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/linker_scripts/at32uc3b/0256/gcc/link_uc3b0256.lds" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/linker_scripts/at32uc3b/0256/gcc/link_uc3b0256.lds" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/gpio/gpio.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/gpio/gpio.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/startup/startup_uc3.S" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/startup/startup_uc3.S" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/startup/trampoline_uc3.S" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/startup/trampoline_uc3.S" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/gpio/gpio.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/gpio/gpio.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/spi/spi.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/spi/spi.h" changed="False" content-id="Atmel.ASF" /> <file path="src/config/conf_access.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fat_example/conf_access.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/startup/trampoline_uc3.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/startup/trampoline_uc3.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="./avr32/services/fs/fat/fat_example/at32uc3b0256_evk1101/as5_32/asf.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/utils/interrupt/interrupt_avr32.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="common/utils/interrupt/interrupt_avr32.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/parts.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/parts.h" changed="False" content-id="Atmel.ASF" /> <file path="src/fat_example.c" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/services/fs/fat/fat_example/fat_example.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/preprocessor/tpaste.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/preprocessor/tpaste.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/pm/sleep.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/pm/sleep.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/utils/compiler.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/utils/compiler.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/flashc/flashc.h" framework="com.atmel.avr32.sf.uc3b" version="2.3.0-15278.151" source="avr32/drivers/flashc/flashc.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/usbb/usbb_device.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="avr32/drivers/usbb/usbb_device.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/usbb/usbb_otg.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="avr32/drivers/usbb/usbb_otg.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/avr32/drivers/usbb/usbb_device.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="avr32/drivers/usbb/usbb_device.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/sleepmgr/uc3/sleepmgr.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/sleepmgr/uc3/sleepmgr.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/sleepmgr/uc3/sleepmgr.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/sleepmgr/uc3/sleepmgr.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/sleepmgr/sleepmgr.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/sleepmgr/sleepmgr.h" changed="False" content-id="Atmel.ASF" /> <file path="src/config/conf_sleepmgr.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/sleepmgr/uc3/module_config/conf_sleepmgr.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/uc3b0_b1/sysclk.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/uc3b0_b1/sysclk.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/sysclk.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/sysclk.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/genclk.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/genclk.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/uc3b0_b1/pll.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/uc3b0_b1/pll.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/uc3b0_b1/genclk.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/uc3b0_b1/genclk.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/uc3b0_b1/sysclk.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/uc3b0_b1/sysclk.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/uc3b0_b1/osc.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/uc3b0_b1/osc.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/pll.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/pll.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/clock/osc.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/osc.h" changed="False" content-id="Atmel.ASF" /> <file path="src/config/conf_clock.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/clock/uc3b0_b1/module_config/conf_clock.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/udc/udc.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/udc/udc.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/udc/udi.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/udc/udi.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/usb_protocol.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/usb_protocol.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/udc/udc_desc.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/udc/udc_desc.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/udc/udc.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/udc/udc.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/usb_atmel.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/usb_atmel.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/udc/udd.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/udc/udd.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/usb_protocol_hid.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/usb_protocol_hid.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/device/kbd/udi_hid_kbd_desc.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/kbd/udi_hid_kbd_desc.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/device/kbd/udi_hid_kbd.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/kbd/udi_hid_kbd.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/device/kbd/udi_hid_kbd_conf.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/kbd/udi_hid_kbd_conf.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/device/kbd/udi_hid_kbd.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/kbd/udi_hid_kbd.h" changed="False" content-id="Atmel.ASF" /> <file path="src/config/conf_usb.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/kbd/module_config/conf_usb.h" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/device/udi_hid.c" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/udi_hid.c" changed="False" content-id="Atmel.ASF" /> <file path="src/asf/common/services/usb/class/hid/device/udi_hid.h" framework="com.atmel.avr32.sf.uc3b" version="2.2.2" source="common/services/usb/class/hid/device/udi_hid.h" changed="False" content-id="Atmel.ASF" /> </files> <documentation help="http://asf.atmel.com/docs/latest/avr32/services/fs/fat/fat_example/at32uc3b0256_evk1101/doxygen/html/" /> </framework-data> </AsfFrameworkConfig> <AsfVersion>2.9.0</AsfVersion> <KeepTimersRunning>true</KeepTimersRunning> <OverrideVtor>false</OverrideVtor> <OverrideVtorValue /> <eraseonlaunchrule>0</eraseonlaunchrule> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <OutputFileName>duck</OutputFileName> <OutputFileExtension>.elf</OutputFileExtension> <ToolchainSettings> <Avr32Gcc xmlns=""> <avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex> <avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss> <avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep> <avr32gcc.compiler.symbols.DefSymbols> <ListValues> <Value>BOARD=EVK1101</Value> </ListValues> </avr32gcc.compiler.symbols.DefSymbols> <avr32gcc.compiler.directories.IncludePaths> <ListValues> <Value>../src</Value> <Value>../src/asf/avr32/boards</Value> <Value>../src/asf/avr32/boards/evk1101</Value> <Value>../src/asf/avr32/drivers/flashc</Value> <Value>../src/asf/avr32/drivers/gpio</Value> <Value>../src/asf/avr32/drivers/intc</Value> <Value>../src/asf/avr32/drivers/pm</Value> <Value>../src/asf/avr32/drivers/spi</Value> <Value>../src/asf/avr32/services/fs/fat</Value> <Value>../src/asf/avr32/services/fs/fat/fat_example</Value> <Value>../src/asf/avr32/utils</Value> <Value>../src/asf/avr32/utils/preprocessor</Value> <Value>../src/asf/common/boards</Value> <Value>../src/asf/common/services/storage/ctrl_access</Value> <Value>../src/asf/common/utils</Value> <Value>../src/config</Value> <Value>../src/asf/avr32/drivers/usbb</Value> <Value>../src/asf/common/services/sleepmgr</Value> <Value>../src/asf/common/services/clock</Value> <Value>../src/asf/common/services/usb</Value> <Value>../src/asf/common/services/usb/udc</Value> <Value>../src/asf/common/services/usb/class/hid</Value> <Value>../src/asf/common/services/usb/class/hid/device/kbd</Value> <Value>../src/asf/common/services/usb/class/hid/device</Value> <Value>../src/asf/avr32/components/memory/sd_mmc/sd_mmc_spi</Value> </ListValues> </avr32gcc.compiler.directories.IncludePaths> <avr32gcc.compiler.optimization.level>Optimize for size (-Os)</avr32gcc.compiler.optimization.level> <avr32gcc.compiler.optimization.OtherFlags>-fdata-sections</avr32gcc.compiler.optimization.OtherFlags> <avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection> <avr32gcc.compiler.warnings.AllWarnings>True</avr32gcc.compiler.warnings.AllWarnings> <avr32gcc.compiler.miscellaneous.OtherFlags>-std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -mrelax</avr32gcc.compiler.miscellaneous.OtherFlags> <avr32gcc.linker.general.DoNotUseStandardStartFiles>True</avr32gcc.linker.general.DoNotUseStandardStartFiles> <avr32gcc.linker.libraries.Libraries> <ListValues> <Value>m</Value> </ListValues> </avr32gcc.linker.libraries.Libraries> <avr32gcc.linker.optimization.GarbageCollectUnusedSections>True</avr32gcc.linker.optimization.GarbageCollectUnusedSections> <avr32gcc.linker.miscellaneous.LinkerFlags>-T../src/asf/avr32/utils/linker_scripts/at32uc3b/0256/gcc/link_uc3b0256.lds -Wl,--relax</avr32gcc.linker.miscellaneous.LinkerFlags> <avr32gcc.assembler.general.AssemblerFlags>-mrelax</avr32gcc.assembler.general.AssemblerFlags> <avr32gcc.assembler.general.IncludePaths> <ListValues> <Value>../src</Value> <Value>../src/asf/avr32/boards</Value> <Value>../src/asf/avr32/boards/evk1101</Value> <Value>../src/asf/avr32/drivers/flashc</Value> <Value>../src/asf/avr32/drivers/gpio</Value> <Value>../src/asf/avr32/drivers/intc</Value> <Value>../src/asf/avr32/drivers/pm</Value> <Value>../src/asf/avr32/drivers/spi</Value> <Value>../src/asf/avr32/services/fs/fat</Value> <Value>../src/asf/avr32/services/fs/fat/fat_example</Value> <Value>../src/asf/avr32/utils</Value> <Value>../src/asf/avr32/utils/preprocessor</Value> <Value>../src/asf/common/boards</Value> <Value>../src/asf/common/services/storage/ctrl_access</Value> <Value>../src/asf/common/utils</Value> <Value>../src/config</Value> <Value>../src/asf/avr32/drivers/usbb</Value> <Value>../src/asf/common/services/sleepmgr</Value> <Value>../src/asf/common/services/clock</Value> <Value>../src/asf/common/services/usb</Value> <Value>../src/asf/common/services/usb/udc</Value> <Value>../src/asf/common/services/usb/class/hid</Value> <Value>../src/asf/common/services/usb/class/hid/device/kbd</Value> <Value>../src/asf/common/services/usb/class/hid/device</Value> </ListValues> </avr32gcc.assembler.general.IncludePaths> <avr32gcc.preprocessingassembler.general.AssemblerFlags>-mrelax</avr32gcc.preprocessingassembler.general.AssemblerFlags> <avr32gcc.preprocessingassembler.general.IncludePaths> <ListValues> <Value>../src</Value> <Value>../src/asf/avr32/boards</Value> <Value>../src/asf/avr32/boards/evk1101</Value> <Value>../src/asf/avr32/drivers/flashc</Value> <Value>../src/asf/avr32/drivers/gpio</Value> <Value>../src/asf/avr32/drivers/intc</Value> <Value>../src/asf/avr32/drivers/pm</Value> <Value>../src/asf/avr32/drivers/spi</Value> <Value>../src/asf/avr32/services/fs/fat</Value> <Value>../src/asf/avr32/services/fs/fat/fat_example</Value> <Value>../src/asf/avr32/utils</Value> <Value>../src/asf/avr32/utils/preprocessor</Value> <Value>../src/asf/common/boards</Value> <Value>../src/asf/common/services/storage/ctrl_access</Value> <Value>../src/asf/common/utils</Value> <Value>../src/config</Value> <Value>../src/asf/avr32/drivers/usbb</Value> <Value>../src/asf/common/services/sleepmgr</Value> <Value>../src/asf/common/services/clock</Value> <Value>../src/asf/common/services/usb</Value> <Value>../src/asf/common/services/usb/udc</Value> <Value>../src/asf/common/services/usb/class/hid</Value> <Value>../src/asf/common/services/usb/class/hid/device/kbd</Value> <Value>../src/asf/common/services/usb/class/hid/device</Value> </ListValues> </avr32gcc.preprocessingassembler.general.IncludePaths> </Avr32Gcc> </ToolchainSettings> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <OutputFileName>Rand_Delay</OutputFileName> <OutputFileExtension>.elf</OutputFileExtension> <ToolchainSettings> <Avr32Gcc xmlns=""> <avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex> <avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss> <avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep> <avr32gcc.compiler.symbols.DefSymbols> <ListValues> <Value>BOARD=EVK1101</Value> </ListValues> </avr32gcc.compiler.symbols.DefSymbols> <avr32gcc.compiler.directories.IncludePaths> <ListValues> <Value>../src</Value> <Value>../src/asf/avr32/boards</Value> <Value>../src/asf/avr32/boards/evk1101</Value> <Value>../src/asf/avr32/drivers/flashc</Value> <Value>../src/asf/avr32/drivers/gpio</Value> <Value>../src/asf/avr32/drivers/intc</Value> <Value>../src/asf/avr32/drivers/pm</Value> <Value>../src/asf/avr32/drivers/spi</Value> <Value>../src/asf/avr32/services/fs/fat</Value> <Value>../src/asf/avr32/services/fs/fat/fat_example</Value> <Value>../src/asf/avr32/utils</Value> <Value>../src/asf/avr32/utils/preprocessor</Value> <Value>../src/asf/common/boards</Value> <Value>../src/asf/common/services/storage/ctrl_access</Value> <Value>../src/asf/common/utils</Value> <Value>../src/config</Value> <Value>../src/asf/avr32/drivers/usbb</Value> <Value>../src/asf/common/services/sleepmgr</Value> <Value>../src/asf/common/services/clock</Value> <Value>../src/asf/common/services/usb</Value> <Value>../src/asf/common/services/usb/udc</Value> <Value>../src/asf/common/services/usb/class/hid</Value> <Value>../src/asf/common/services/usb/class/hid/device/kbd</Value> <Value>../src/asf/common/services/usb/class/hid/device</Value> <Value>../src/asf/avr32/components/memory/sd_mmc/sd_mmc_spi</Value> </ListValues> </avr32gcc.compiler.directories.IncludePaths> <avr32gcc.compiler.optimization.level>Optimize (-O1)</avr32gcc.compiler.optimization.level> <avr32gcc.compiler.optimization.OtherFlags>-fdata-sections</avr32gcc.compiler.optimization.OtherFlags> <avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection> <avr32gcc.compiler.optimization.DebugLevel>Maximum (-g3)</avr32gcc.compiler.optimization.DebugLevel> <avr32gcc.compiler.warnings.AllWarnings>True</avr32gcc.compiler.warnings.AllWarnings> <avr32gcc.compiler.miscellaneous.OtherFlags>-std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Werror-implicit-function-declaration -Wpointer-arith -mrelax</avr32gcc.compiler.miscellaneous.OtherFlags> <avr32gcc.linker.general.DoNotUseStandardStartFiles>True</avr32gcc.linker.general.DoNotUseStandardStartFiles> <avr32gcc.linker.libraries.Libraries> <ListValues> <Value>m</Value> </ListValues> </avr32gcc.linker.libraries.Libraries> <avr32gcc.linker.optimization.GarbageCollectUnusedSections>True</avr32gcc.linker.optimization.GarbageCollectUnusedSections> <avr32gcc.linker.miscellaneous.LinkerFlags>-T../src/asf/avr32/utils/linker_scripts/at32uc3b/0256/gcc/link_uc3b0256.lds -Wl,--relax</avr32gcc.linker.miscellaneous.LinkerFlags> <avr32gcc.assembler.general.AssemblerFlags>-mrelax</avr32gcc.assembler.general.AssemblerFlags> <avr32gcc.assembler.general.IncludePaths> <ListValues> <Value>../src</Value> <Value>../src/asf/avr32/boards</Value> <Value>../src/asf/avr32/boards/evk1101</Value> <Value>../src/asf/avr32/drivers/flashc</Value> <Value>../src/asf/avr32/drivers/gpio</Value> <Value>../src/asf/avr32/drivers/intc</Value> <Value>../src/asf/avr32/drivers/pm</Value> <Value>../src/asf/avr32/drivers/spi</Value> <Value>../src/asf/avr32/services/fs/fat</Value> <Value>../src/asf/avr32/services/fs/fat/fat_example</Value> <Value>../src/asf/avr32/utils</Value> <Value>../src/asf/avr32/utils/preprocessor</Value> <Value>../src/asf/common/boards</Value> <Value>../src/asf/common/services/storage/ctrl_access</Value> <Value>../src/asf/common/utils</Value> <Value>../src/config</Value> <Value>../src/asf/avr32/drivers/usbb</Value> <Value>../src/asf/common/services/sleepmgr</Value> <Value>../src/asf/common/services/clock</Value> <Value>../src/asf/common/services/usb</Value> <Value>../src/asf/common/services/usb/udc</Value> <Value>../src/asf/common/services/usb/class/hid</Value> <Value>../src/asf/common/services/usb/class/hid/device/kbd</Value> <Value>../src/asf/common/services/usb/class/hid/device</Value> </ListValues> </avr32gcc.assembler.general.IncludePaths> <avr32gcc.preprocessingassembler.general.AssemblerFlags>-mrelax</avr32gcc.preprocessingassembler.general.AssemblerFlags> <avr32gcc.preprocessingassembler.general.IncludePaths> <ListValues> <Value>../src</Value> <Value>../src/asf/avr32/boards</Value> <Value>../src/asf/avr32/boards/evk1101</Value> <Value>../src/asf/avr32/drivers/flashc</Value> <Value>../src/asf/avr32/drivers/gpio</Value> <Value>../src/asf/avr32/drivers/intc</Value> <Value>../src/asf/avr32/drivers/pm</Value> <Value>../src/asf/avr32/drivers/spi</Value> <Value>../src/asf/avr32/services/fs/fat</Value> <Value>../src/asf/avr32/services/fs/fat/fat_example</Value> <Value>../src/asf/avr32/utils</Value> <Value>../src/asf/avr32/utils/preprocessor</Value> <Value>../src/asf/common/boards</Value> <Value>../src/asf/common/services/storage/ctrl_access</Value> <Value>../src/asf/common/utils</Value> <Value>../src/config</Value> <Value>../src/asf/avr32/drivers/usbb</Value> <Value>../src/asf/common/services/sleepmgr</Value> <Value>../src/asf/common/services/clock</Value> <Value>../src/asf/common/services/usb</Value> <Value>../src/asf/common/services/usb/udc</Value> <Value>../src/asf/common/services/usb/class/hid</Value> <Value>../src/asf/common/services/usb/class/hid/device/kbd</Value> <Value>../src/asf/common/services/usb/class/hid/device</Value> </ListValues> </avr32gcc.preprocessingassembler.general.IncludePaths> </Avr32Gcc> </ToolchainSettings> </PropertyGroup> <ItemGroup> <None Include="src\asf.h"> <SubType>compile</SubType> </None> <Compile Include="src\asf\avr32\boards\evk1101\evk1101.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\boards\evk1101\init.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\boards\evk1101\led.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\boards\evk1101\led.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\components\memory\sd_mmc\sd_mmc_spi\sd_mmc_spi.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\components\memory\sd_mmc\sd_mmc_spi\sd_mmc_spi.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\components\memory\sd_mmc\sd_mmc_spi\sd_mmc_spi_mem.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\components\memory\sd_mmc\sd_mmc_spi\sd_mmc_spi_mem.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\flashc\flashc.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\flashc\flashc.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\gpio\gpio.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\gpio\gpio.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\intc\exception.S"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\intc\intc.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\intc\intc.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\pm\pm.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\pm\pm.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\pm\pm_conf_clocks.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\pm\power_clocks_lib.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\pm\power_clocks_lib.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\pm\sleep.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\spi\spi.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\spi\spi.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\usbb\usbb_device.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\usbb\usbb_device.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\drivers\usbb\usbb_otg.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\fat.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\fat.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\fat_unusual.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\file.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\file.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\fs_com.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\navigation.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\services\fs\fat\navigation.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\compiler.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\linker_scripts\at32uc3b\0256\gcc\link_uc3b0256.lds"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\parts.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\preprocessor\mrepeat.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\preprocessor\preprocessor.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\preprocessor\stringz.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\preprocessor\tpaste.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\startup\startup_uc3.S"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\startup\trampoline_uc3.S"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\startup\trampoline_uc3.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\avr32\utils\status_codes.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\boards\board.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\genclk.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\osc.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\pll.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\sysclk.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\uc3b0_b1\genclk.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\uc3b0_b1\osc.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\uc3b0_b1\pll.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\uc3b0_b1\sysclk.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\clock\uc3b0_b1\sysclk.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\sleepmgr\sleepmgr.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\sleepmgr\uc3\sleepmgr.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\sleepmgr\uc3\sleepmgr.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\storage\ctrl_access\ctrl_access.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\storage\ctrl_access\ctrl_access.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\device\kbd\udi_hid_kbd.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\device\kbd\udi_hid_kbd.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\device\kbd\udi_hid_kbd_conf.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\device\kbd\udi_hid_kbd_desc.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\device\udi_hid.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\device\udi_hid.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\class\hid\usb_protocol_hid.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\udc\udc.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\udc\udc.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\udc\udc_desc.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\udc\udd.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\udc\udi.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\usb_atmel.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\services\usb\usb_protocol.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\utils\interrupt.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\asf\common\utils\interrupt\interrupt_avr32.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_access.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_board.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_clock.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_explorer.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_sd_mmc_spi.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_sleepmgr.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\config\conf_usb.h"> <SubType>compile</SubType> </Compile> <Compile Include="src\main.c"> <SubType>compile</SubType> </Compile> <Compile Include="src\main.h"> <SubType>compile</SubType> </Compile> </ItemGroup> <ItemGroup> <Folder Include="src\" /> <Folder Include="src\asf\" /> <Folder Include="src\asf\avr32\" /> <Folder Include="src\asf\avr32\boards\" /> <Folder Include="src\asf\avr32\boards\evk1101\" /> <Folder Include="src\asf\avr32\components\" /> <Folder Include="src\asf\avr32\components\memory\" /> <Folder Include="src\asf\avr32\components\memory\sd_mmc\" /> <Folder Include="src\asf\avr32\components\memory\sd_mmc\sd_mmc_spi\" /> <Folder Include="src\asf\avr32\drivers\" /> <Folder Include="src\asf\avr32\drivers\flashc\" /> <Folder Include="src\asf\avr32\drivers\gpio\" /> <Folder Include="src\asf\avr32\drivers\intc\" /> <Folder Include="src\asf\avr32\drivers\pm\" /> <Folder Include="src\asf\avr32\drivers\spi\" /> <Folder Include="src\asf\avr32\drivers\usbb\" /> <Folder Include="src\asf\avr32\services\" /> <Folder Include="src\asf\avr32\services\fs\" /> <Folder Include="src\asf\avr32\services\fs\fat\" /> <Folder Include="src\asf\avr32\utils\" /> <Folder Include="src\asf\avr32\utils\linker_scripts\" /> <Folder Include="src\asf\avr32\utils\linker_scripts\at32uc3b\" /> <Folder Include="src\asf\avr32\utils\linker_scripts\at32uc3b\0256\" /> <Folder Include="src\asf\avr32\utils\linker_scripts\at32uc3b\0256\gcc\" /> <Folder Include="src\asf\avr32\utils\preprocessor\" /> <Folder Include="src\asf\avr32\utils\startup\" /> <Folder Include="src\asf\common\" /> <Folder Include="src\asf\common\boards\" /> <Folder Include="src\asf\common\services\" /> <Folder Include="src\asf\common\services\clock\" /> <Folder Include="src\asf\common\services\clock\uc3b0_b1\" /> <Folder Include="src\asf\common\services\sleepmgr\" /> <Folder Include="src\asf\common\services\sleepmgr\uc3\" /> <Folder Include="src\asf\common\services\storage\" /> <Folder Include="src\asf\common\services\storage\ctrl_access\" /> <Folder Include="src\asf\common\services\usb\" /> <Folder Include="src\asf\common\services\usb\class\" /> <Folder Include="src\asf\common\services\usb\class\hid\" /> <Folder Include="src\asf\common\services\usb\class\hid\device\" /> <Folder Include="src\asf\common\services\usb\class\hid\device\kbd\" /> <Folder Include="src\asf\common\services\usb\udc\" /> <Folder Include="src\asf\common\utils\" /> <Folder Include="src\asf\common\utils\interrupt\" /> <Folder Include="src\config\" /> </ItemGroup> <Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\AvrGCC32.targets" /> </Project>
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright (c) 2015 Low Latency Trading Limited : Author Richard Rose * 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.rr.core.socket; import java.io.IOException; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CyclicBarrier; import org.junit.Assert; import com.rr.core.dummy.warmup.DummyAppProperties; import com.rr.core.lang.BaseTestCase; import com.rr.core.lang.ViewString; import com.rr.core.lang.ZString; import com.rr.core.os.SocketFactory; import com.rr.core.session.socket.SocketConfig; import com.rr.core.utils.Utils; // test using selector for reading from channel public class TestMulticastSocketFromFactory extends BaseTestCase { private static final int MSG_SIZE = 16; // 8 bytes for long pingId, 8 bytes for nanoSent String _mcastGroupAddress = "226.1.1.1"; int _msDelay; static String _nicIP = getNIC(); private class Consumer implements Runnable { private LiteMulticastSocket _inSocket = null; private final ByteBuffer _inBuf = ByteBuffer.allocateDirect( MSG_SIZE+1 ); private final ByteBuffer _outBuf = ByteBuffer.allocateDirect( MSG_SIZE+1 ); private String _id; private final int _consume; private final int _port; private final CyclicBarrier _cb; private volatile int _in; public Consumer( String id, int consume, int port, CyclicBarrier cb ) { _id = id; _consume = consume; _port = port; _cb = cb; } @Override public void run() { try { _cb.await(); inConnect(); consume( _consume ); inClose(); } catch( Exception e ) { fail( e.getMessage() ); } } public void inConnect() throws IOException { SocketConfig sc = new SocketConfig(); sc.setPort( _port ); sc.setDisableLoopback( false ); sc.setQOS( 0x08 ); sc.setTTL( 3 ); sc.setNic( new ViewString(_nicIP) ); ZString[] mcastAddrs = { new ViewString(_mcastGroupAddress) }; sc.setMulticastGroups( mcastAddrs ); _inSocket = SocketFactory.instance().createMulticastSocket( sc, _inBuf, _outBuf ); _inSocket.configureBlocking( false ); _inSocket.setTcpNoDelay( true ); System.out.println( "Connected " + _id ); } public void inClose() { try { if ( _inSocket != null ) _inSocket.close(); } catch( Exception e ) { /* NADA */ } } public int getIn() { return _in; } void consume( int max ) throws Exception { _in = 0; while( _in < max ) { int read = getMessage( MSG_SIZE ); if ( read > 0 ) { _inBuf.flip(); long now = Utils.nanoTime(); long id = _inBuf.getLong(); long sent = _inBuf.getLong(); long delay = Math.abs( (sent - now) / 1000 ); System.out.println( "Consumer " + _id + ", Read id=" + id + ", usecs=" + delay ); ++_in; } } } private int getMessage( int msgSize ) throws Exception { _inBuf.clear(); while( true ) { _inSocket.read(); if ( _inBuf.position() >= msgSize ) { break; } Thread.sleep(1); } return _inBuf.position(); } } private class Producer implements Runnable { private final String _id; private final ByteBuffer _inBuf = ByteBuffer.allocateDirect( MSG_SIZE+1 ); private final ByteBuffer _outBuf = ByteBuffer.allocateDirect( MSG_SIZE+1 ); private LiteMulticastSocket _outSocket = null; private final int _send; private final int _port; private CyclicBarrier _cb; private volatile int _out; public Producer( String id, int send, int port, CyclicBarrier cb ) { _id = id; _send = send; _port = port; _cb = cb; } @Override public void run() { try { _cb.await(); outConnect(); produce( _send ); outClose(); } catch( Exception e ) { fail( e.getMessage() ); } } protected final void writeSocket() throws IOException { _outSocket.write(); } public void outConnect() throws IOException { SocketConfig sc = new SocketConfig(); sc.setServer( true ); sc.setPort( _port ); sc.setDisableLoopback( false ); sc.setQOS( 0x08 ); sc.setTTL( 3 ); sc.setNic( new ViewString(_nicIP) ); ZString[] mcastAddrs = { new ViewString(_mcastGroupAddress) }; sc.setMulticastGroups( mcastAddrs ); _outSocket = SocketFactory.instance().createMulticastSocket( sc, _inBuf, _outBuf ); _outSocket.configureBlocking( false ); _outSocket.setTcpNoDelay( true ); System.out.println( "Connected " + _id ); } public void outClose() { try { if ( _outSocket != null ) _outSocket.close(); } catch( Exception e ) { /* NADA */ } } void produce( int max ) throws Exception { _out = 0; while( _out < max ) { send( _out, Utils.nanoTime() ); ++_out; System.out.println( _id + " Sent id=" + _out ); try{ Thread.sleep( _msDelay ); } catch( Exception e ) { /* dont care */ } } } private void send( long idx, long nanoTime ) throws IOException { _outBuf.clear(); _outBuf.putLong( idx ); _outBuf.putLong( nanoTime ); _outBuf.flip(); writeSocket(); } public int getOut() { return _out; } } { Map<String,String> p = new HashMap<String,String>(); try { DummyAppProperties.testInit( p ); } catch( Exception e ) { Assert.fail( e.getMessage() ); } } public void testSimpleMCast() throws Exception { doRun( 1, 1, 10, 14880 ); } private static String getNIC() { String nic = System.getProperty( "NIC" ); if ( nic == null ) { nic = "127.0.0.1"; } System.out.println( "NIC=" + nic ); return nic; } private void doRun( int numConsumers, int numProducers, int sendPerProducer, int port ) { int totalConsume = numProducers * sendPerProducer; Consumer[] consumers = new Consumer[ numConsumers ]; Thread[] tCons = new Thread[ numConsumers ]; CyclicBarrier cb = new CyclicBarrier( numProducers + numConsumers ); for( int i=0; i < numConsumers ; ++i ) { consumers[i] = new Consumer( "C"+i, totalConsume, port, cb ); tCons[i] = new Thread( consumers[i], "CONSUMER" + i ); } Producer[] producers = new Producer[ numProducers ]; Thread[] tProd = new Thread[ numProducers ]; for( int i=0; i < numProducers ; ++i ) { producers[i] = new Producer( "P"+i, sendPerProducer, port, cb ); tProd[i] = new Thread( producers[i], "PRODUCER" + i ); } _msDelay = 1; for( int i=0; i < numConsumers ; ++i ) { tCons[i].start(); } for( int i=0; i < numProducers ; ++i ) { tProd[i].start(); } for( int i=0; i < numProducers ; ++i ) { try { tProd[i].join(); } catch( InterruptedException e ) { // dont care } } for( int i=0; i < numConsumers ; ++i ) { try { tCons[i].join( totalConsume / 10000 + 1000 ); } catch( InterruptedException e ) { // dont care } } for( int i=0; i < numConsumers ; ++i ) { assertTrue( consumers[i].getIn() > totalConsume / 2 ); } for( int i=0; i < numProducers ; ++i ) { assertTrue( producers[i].getOut() > sendPerProducer / 2 ); } } }
{ "pile_set_name": "Github" }
CFLAGS+=-fPIC ifeq ($(findstring osx,$(ARCH)), osx) CFLAGS=-fno-common INCLUDES+=-I../jpeg/ endif LIB=tiff.a OBJS=fax3sm_winnt.o tif_aux.o tif_close.o tif_codec.o tif_compress.o tif_dir.o tif_dirinfo.o tif_dirread.o tif_dirwrite.o tif_dumpmode.o tif_error.o tif_fax3.o tif_flush.o tif_getimage.o tif_jpeg.o tif_luv.o tif_lzw.o tif_next.o tif_ojpeg.o tif_open.o tif_packbits.o tif_pixarlog.o tif_predict.o tif_print.o tif_read.o tif_strip.o tif_swab.o tif_thunder.o tif_tile.o tif_version.o tif_warning.o tif_write.o tif_zip.o include ../../../Makefile.include
{ "pile_set_name": "Github" }
/** * This program 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * **/ #pragma once /** * @file CUnsignedNumber.h * @author Jacques-Olivier Lachaud (\c [email protected] ) * Laboratory of Mathematics (CNRS, UMR 5807), University of Savoie, France * @author David Coeurjolly (\c [email protected] ) * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France * * @date 2010/07/02 * * Header file for concept CUnsignedNumber.cpp * * This file is part of the DGtal library. */ #if defined(CUnsignedNumber_RECURSES) #error Recursive header files inclusion detected in CUnsignedNumber.h #else // defined(CUnsignedNumber_RECURSES) /** Prevents recursive inclusion of headers. */ #define CUnsignedNumber_RECURSES #if !defined CUnsignedNumber_h /** Prevents repeated inclusion of headers. */ #define CUnsignedNumber_h ////////////////////////////////////////////////////////////////////////////// // Inclusions #include <iostream> #include "DGtal/base/Common.h" #include "DGtal/base/ConceptUtils.h" #include "DGtal/kernel/NumberTraits.h" #include "DGtal/base/CQuantity.h" ////////////////////////////////////////////////////////////////////////////// namespace DGtal { namespace concepts { ///////////////////////////////////////////////////////////////////////////// // class CUnsignedNumber /** Description of \b concept '\b CUnsignedNumber' <p> @ingroup Concepts @brief Aim: Concept checking for Unsigned numbers. Models of this concept should be listed in NumberTraits class and should have the isUnsigned property. # Refinement of - CQuantity # Associated types # Notation - \e X : A type that is a model of CUnsignedNumber - \e x, \e y : Object of type X # Definitions # Valid expressions Name | Expression | Type requirements | Return type| Precondition | Semantics | Postcondition | Complexity -----|------------|--------------------|------------|--------------|-----------|---------------|----------- \a X should be tagged \b true in \a NumberTraits for \a IsUnsigned. | typename NumberTraits<X>::IsUnsigned | TagTrue | | | | | | # Invariants# # Models# unsigned short, unsigned int, unsigned long long, uint16_t, uint32_t, uint64_t. # Notes# */ template <typename T> struct CUnsignedNumber: CQuantity<T> { // ----------------------- Concept checks ------------------------------ public: BOOST_CONCEPT_USAGE(CUnsignedNumber) { // Will compile iff Unsigned. ConceptUtils::checkTrue( myIsUnsigned ); } // ------------------------- Private Datas -------------------------------- private: // ------------------------- Internals ------------------------------------ private: typename NumberTraits<T>::IsUnsigned myIsUnsigned; }; // end of concept CUnsignedNumber } } // namespace DGtal // /////////////////////////////////////////////////////////////////////////////// #endif // !defined CUnsignedNumber_h #undef CUnsignedNumber_RECURSES #endif // else defined(CUnsignedNumber_RECURSES)
{ "pile_set_name": "Github" }
import language.experimental.macros import scala.reflect.macros.blackbox.Context object M { def m(a: Any, b: Any): Any = macro mImpl def mImpl(c: Context)(a: c.Expr[Any], b: c.Expr[Any]) = c.universe.reify(println(a.splice)) @reflect.internal.annotations.compileTimeOnly("cto may only be used as an argument to " + "m") def cto = 0 }
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 5 09:26:51 2018 @author: Kazuki """ from glob import glob from os import system import pandas as pd import sys sys.path.append('/home/kazuki_onodera/Python') import lgbmextension as ex import lightgbm as lgb import multiprocessing import utils utils.start(__file__) #============================================================================== SEED = 71 base_folder = ['../data/001_train'] target_folders = glob('../data/3*_train') folders = base_folder+target_folders X = pd.concat([ utils.read_pickles(f) for f in (folders) ], axis=1) y = utils.read_pickles('../data/label').TARGET if X.columns.duplicated().sum()>0: raise Exception(f'duplicated!: { X.columns[X.columns.duplicated()] }') print('no dup :) ') print(f'X.shape {X.shape}') param = { 'objective': 'binary', 'metric': 'auc', 'learning_rate': 0.01, 'max_depth': -1, 'num_leaves': 255, 'max_bin': 255, 'colsample_bytree': 0.1, 'subsample': 0.5, 'nthread': int(multiprocessing.cpu_count()/2), # 'nthread': multiprocessing.cpu_count(), 'bagging_freq': 1, 'seed': SEED } categorical_feature = ['NAME_CONTRACT_TYPE', 'CODE_GENDER', 'FLAG_OWN_CAR', 'FLAG_OWN_REALTY', 'NAME_TYPE_SUITE', 'NAME_INCOME_TYPE', 'NAME_EDUCATION_TYPE', 'NAME_FAMILY_STATUS', 'NAME_HOUSING_TYPE', 'OCCUPATION_TYPE', 'WEEKDAY_APPR_PROCESS_START', 'ORGANIZATION_TYPE', 'FONDKAPREMONT_MODE', 'HOUSETYPE_MODE', 'WALLSMATERIAL_MODE', 'EMERGENCYSTATE_MODE'] categorical_feature += ['prev_DL1-0NAME_CONTRACT_TYPE', 'prev_DL1-0WEEKDAY_APPR_PROCESS_START', 'prev_DL1-0NAME_CASH_LOAN_PURPOSE', 'prev_DL1-0NAME_CONTRACT_STATUS', 'prev_DL1-0NAME_PAYMENT_TYPE', 'prev_DL1-0CODE_REJECT_REASON', 'prev_DL1-0NAME_TYPE_SUITE', 'prev_DL1-0NAME_CLIENT_TYPE', 'prev_DL1-0NAME_GOODS_CATEGORY', 'prev_DL1-0NAME_PORTFOLIO', 'prev_DL1-0NAME_PRODUCT_TYPE', 'prev_DL1-0CHANNEL_TYPE', 'prev_DL1-0NAME_SELLER_INDUSTRY', 'prev_DL1-0NAME_YIELD_GROUP', 'prev_DL1-0PRODUCT_COMBINATION', 'prev_DL1-1NAME_CONTRACT_TYPE', 'prev_DL1-1WEEKDAY_APPR_PROCESS_START', 'prev_DL1-1NAME_CASH_LOAN_PURPOSE', 'prev_DL1-1NAME_CONTRACT_STATUS', 'prev_DL1-1NAME_PAYMENT_TYPE', 'prev_DL1-1CODE_REJECT_REASON', 'prev_DL1-1NAME_TYPE_SUITE', 'prev_DL1-1NAME_CLIENT_TYPE', 'prev_DL1-1NAME_GOODS_CATEGORY', 'prev_DL1-1NAME_PORTFOLIO', 'prev_DL1-1NAME_PRODUCT_TYPE', 'prev_DL1-1CHANNEL_TYPE', 'prev_DL1-1NAME_SELLER_INDUSTRY', 'prev_DL1-1NAME_YIELD_GROUP', 'prev_DL1-1PRODUCT_COMBINATION', 'prev_DL1-2NAME_CONTRACT_TYPE', 'prev_DL1-2WEEKDAY_APPR_PROCESS_START', 'prev_DL1-2NAME_CASH_LOAN_PURPOSE', 'prev_DL1-2NAME_CONTRACT_STATUS', 'prev_DL1-2NAME_PAYMENT_TYPE', 'prev_DL1-2CODE_REJECT_REASON', 'prev_DL1-2NAME_TYPE_SUITE', 'prev_DL1-2NAME_CLIENT_TYPE', 'prev_DL1-2NAME_GOODS_CATEGORY', 'prev_DL1-2NAME_PORTFOLIO', 'prev_DL1-2NAME_PRODUCT_TYPE', 'prev_DL1-2CHANNEL_TYPE', 'prev_DL1-2NAME_SELLER_INDUSTRY', 'prev_DL1-2NAME_YIELD_GROUP', 'prev_DL1-2PRODUCT_COMBINATION'] dtrain = lgb.Dataset(X, y, categorical_feature=list( set(X.columns)&set(categorical_feature)) ) #dtrain.construct() ret = lgb.cv(param, dtrain, 9999, nfold=5, early_stopping_rounds=50, verbose_eval=10, # categorical_feature=list( set(X.columns)&set(categorical_feature)), seed=SEED) print(f"CV auc-mean {ret['auc-mean'][-1]}") dtrain = lgb.Dataset(X, y, categorical_feature=list( set(X.columns)&set(categorical_feature)) ) model = lgb.train(param, dtrain, len(ret['auc-mean'])) #model = lgb.train(param, dtrain, 300, valid_sets=[dtrain], valid_names=['train']) imp = ex.getImp(model) imp.to_csv(f'LOG/imp_{__file__}.csv', index=False) """ imp = pd.read_csv('LOG/imp_111-1_cv_filter.py.csv') """ # ============================================================================= # # ============================================================================= imp = imp.set_index('index') feature_all = imp[imp['split'] != 0].index.tolist() import gc def read_pickle(folder, usecols): df = pd.read_pickle(folder+'/000.p') col = list( set(usecols) & set(df.columns)) if len(col)>0: print(folder) df = utils.read_pickles(folder, col) utils.to_pickles(df, folder+'_filtered', utils.SPLIT_SIZE) del df; gc.collect() folder = folder.replace('_train', '_test') df = utils.read_pickles(folder, col) utils.to_pickles(df, folder+'_filtered', utils.SPLIT_SIZE) else: print(f'{folder} doesnt have valid features') pass [read_pickle(f, feature_all) for f in target_folders] #============================================================================== utils.end(__file__)
{ "pile_set_name": "Github" }
/* Firefox Quantum userChrome.css tweaks ************************************************/ /* Github: https://github.com/aris-t2/customcssforfx ************************************/ /****************************************************************************************/ @media (prefers-reduced-motion: reduce) { .tab-throbber[busy], .tab-throbber[progress] { width: 16px !important; height: 16px !important; animation: unset !important; -moz-context-properties: unset !important; fill: unset !important; animation: unset !important; opacity: unset !important; animation: unset !important; } .tab-throbber[busy] { background-image: url("./../../image/tabthrobber_fx56_connecting.png") !important; } .tab-throbber-fallback[busy] { list-style-image: url("./../../image/tabthrobber_fx56_connecting.png") !important; } .tab-throbber[progress]{ background-image: url("./../../image/tabthrobber_loading-ubuntu.png") !important; } .tab-throbber-fallback[progress] { list-style-image: url("./../../image/tabthrobber_loading-ubuntu.png") !important; } } @media (prefers-reduced-motion: no-preference) { .tab-throbber[busy]::before, .tab-throbber[progress]::before { width: 16px !important; height: 16px !important; animation: unset !important; -moz-context-properties: unset !important; fill: unset !important; animation: unset !important; opacity: unset !important; animation: unset !important; } .tab-throbber[busy]::before { background-image: url("./../../image/tabthrobber_fx56_connecting.png") !important; } .tab-throbber-fallback[busy] { list-style-image: url("./../../image/tabthrobber_fx56_connecting.png") !important; } .tab-throbber[progress]::before{ background-image: url("./../../image/tabthrobber_loading-ubuntu.png") !important; } .tab-throbber-fallback[progress] { list-style-image: url("./../../image/tabthrobber_loading-ubuntu.png") !important; } } /**/
{ "pile_set_name": "Github" }
// This file was procedurally generated from the following sources: // - src/dstr-binding/obj-ptrn-list-err.case // - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template /*--- description: Binding property list evaluation is interrupted by an abrupt completion (static class expression async generator method (default parameter)) esid: sec-runtime-semantics-bindingclassdeclarationevaluation features: [async-iteration] flags: [generated] info: | ClassDeclaration : class BindingIdentifier ClassTail 1. Let className be StringValue of BindingIdentifier. 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with argument className. [...] 14.5.14 Runtime Semantics: ClassDefinitionEvaluation 21. For each ClassElement m in order from methods a. If IsStatic of m is false, then b. Else, Let status be the result of performing PropertyDefinitionEvaluation for m with arguments F and false. [...] Runtime Semantics: PropertyDefinitionEvaluation AsyncGeneratorMethod : async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } 1. Let propKey be the result of evaluating PropertyName. 2. ReturnIfAbrupt(propKey). 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. Otherwise let strict be false. 4. Let scope be the running execution context's LexicalEnvironment. 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, AsyncGeneratorBody, scope, strict). [...] 13.3.3.5 Runtime Semantics: BindingInitialization BindingPropertyList : BindingPropertyList , BindingProperty 1. Let status be the result of performing BindingInitialization for BindingPropertyList using value and environment as arguments. 2. ReturnIfAbrupt(status). ---*/ var initCount = 0; function thrower() { throw new Test262Error(); } class C { static async *method({ a, b = thrower(), c = ++initCount } = {}) { } }; var method = C.method; assert.throws(Test262Error, function() { method(); }); assert.sameValue(initCount, 0);
{ "pile_set_name": "Github" }
package com.central.common.config; import com.central.common.utils.CustomThreadPoolTaskExecutor; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.core.task.TaskExecutor; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.ThreadPoolExecutor; /** * @author zlt * @date 2018/12/13 */ @Setter @Getter @EnableAsync(proxyTargetClass = true) public class DefaultAsycTaskConfig { /** * 线程池维护线程的最小数量. */ @Value("${asyc-task.corePoolSize:10}") private int corePoolSize; /** * 线程池维护线程的最大数量 */ @Value("${asyc-task.maxPoolSize:200}") private int maxPoolSize; /** * 队列最大长度 */ @Value("${asyc-task.queueCapacity:10}") private int queueCapacity; /** * 线程池前缀 */ @Value("${asyc-task.threadNamePrefix:ZltExecutor-}") private String threadNamePrefix; @Bean public TaskExecutor taskExecutor() { ThreadPoolTaskExecutor executor = new CustomThreadPoolTaskExecutor(); executor.setCorePoolSize(corePoolSize); executor.setMaxPoolSize(maxPoolSize); executor.setQueueCapacity(queueCapacity); executor.setThreadNamePrefix(threadNamePrefix); /* rejection-policy:当pool已经达到max size的时候,如何处理新任务 CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行 */ executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); executor.initialize(); return executor; } }
{ "pile_set_name": "Github" }
using Loon.Core; using Loon.Core.Graphics.Opengl; using Loon.Core.Geom; namespace Loon.Action.Sprite { public class Picture : LObject, ISprite { private bool visible; private int width, height; private LTexture image; public Picture(string fileName) :this(fileName, 0, 0){ } public Picture(int x, int y):this((LTexture) null, x, y) { } public Picture(string fileName, int x, int y): this(new LTexture(fileName), x, y) { } public Picture(LTexture image):this(image, 0, 0) { } public Picture(LTexture image, int x, int y) { if (image != null) { this.SetImage(image); this.width = image.GetWidth(); this.height = image.GetHeight(); } this.SetLocation(x, y); this.visible = true; } public virtual void CreateUI(GLEx g) { if (visible) { if (alpha > 0 && alpha < 1) { g.SetAlpha(alpha); } g.DrawTexture(image, X(), Y()); if (alpha > 0 && alpha < 1) { g.SetAlpha(1.0f); } } } public virtual bool Equals(Picture p) { if (image.Equals(p.image)) { return true; } if (this.width == p.width && this.height == p.height) { if (image.GetHashCode() == p.image.GetHashCode()) { return true; } } return false; } public override int GetHeight() { return height; } public override int GetWidth() { return width; } public override void Update(long timer) { } public virtual bool IsVisible() { return visible; } public virtual void SetVisible(bool visible) { this.visible = visible; } public virtual void Dispose() { if (image != null) { image.Dispose(); image = null; } } public virtual void SetImage(string fileName) { this.image = new LTexture(fileName); this.width = image.GetWidth(); this.height = image.GetHeight(); } public virtual void SetImage(LTexture image) { this.image = image; this.width = image.GetWidth(); this.height = image.GetHeight(); } public virtual RectBox GetCollisionBox() { return GetRect(X(), Y(), width, height); } public virtual LTexture GetBitmap() { return image; } } }
{ "pile_set_name": "Github" }
{ "Configuration": { "timeStepSize": 0.001, "numberOfStepsPerRenderUpdate": 2, "particleRadius": 0.025, "density0": 1000, "simulationMethod": 4, "gravitation": [0.1,-9.81,0], "cflMethod": 0, "cflFactor": 0.5, "cflMaxTimeStepSize": 0.005, "maxIterations": 100, "maxError": 0.01, "maxIterationsV": 100, "maxErrorV": 0.1, "stiffness": 50000, "exponent": 7, "velocityUpdateMethod": 0, "enableDivergenceSolver": true, "boundaryHandlingMethod": 2 }, "Materials": [ { "id": "Fluid", "surfaceTension": 0.2, "surfaceTensionMethod": 0, "viscosity": 0.6, "viscosityMethod": 3, "viscoMaxIter": 200, "viscoMaxError": 0.05 } ], "RigidBodies": [ { "geometryFile": "../models/UnitBox.obj", "translation": [0,-0.25,0], "rotationAxis": [1, 0, 0], "rotationAngle": 0, "scale": [3, 0.5, 3], "color": [0.1, 0.4, 0.6, 1.0], "isDynamic": false, "isWall": false, "mapInvert": false, "mapThickness": 0.0, "mapResolution": [20,20,20] } ], "FluidBlocks": [ { "denseMode": 0, "start": [-0.1, 0.01, -0.4], "end": [0.1, 6.0, 0.4], "translation": [0, 0.1, 0.0], "scale": [0.75,1,0.75] } ] }
{ "pile_set_name": "Github" }
#include "gpgmeutils.h" #include <stdio.h> #define BUF_LEN 1024 jboolean UTILS_setStringMember(JNIEnv* env, jobject self, jclass selfclass, const char* fieldname, const char* fieldvalue) { //get the field from the class jfieldID fld = (*env)->GetFieldID(env, selfclass, fieldname, "Ljava/lang/String;"); if (fld == NULL) { return JNI_FALSE; } jstring jval = (*env)->NewStringUTF(env, fieldvalue); if (jval == NULL) { return JNI_FALSE; } (*env)->SetObjectField(env, self, fld, jval); return JNI_TRUE; } jboolean UTILS_setIntMember(JNIEnv* env, jobject self, jclass selfclass, const char* fieldname, int fieldvalue) { //get the field from the class jlong jval = (jlong) fieldvalue; jfieldID fld = (*env)->GetFieldID(env, selfclass, fieldname, "I"); if (fld == NULL) { return JNI_FALSE; } if (jval == 0) { return JNI_FALSE; } (*env)->SetIntField(env, self, fld, jval); return JNI_TRUE; } void UTILS_setBooleanMember(JNIEnv* env, jobject self, jclass selfclass, const char* fieldname, unsigned int fieldvalue) { //get the field from the class jboolean jval = (jboolean) fieldvalue; jfieldID fld = (*env)->GetFieldID(env, selfclass, fieldname, "Z"); if (fld == NULL) { return; } if (jval == 0) { return; } (*env)->SetBooleanField(env, self, fld, jval); } jboolean UTILS_onErrorThrowException(JNIEnv* env, gpgme_error_t err) { if (err) { char exceptionString[BUF_LEN]; /* this is enough */ int spaceUsed; jclass exception = (*env)->FindClass(env, "com/freiheit/gnupg/GnuPGException"); if (exception == NULL) { return JNI_TRUE; } spaceUsed = snprintf(exceptionString, BUF_LEN, "%u: ", err); gpgme_strerror_r(err, exceptionString + spaceUsed, BUF_LEN - spaceUsed); (*env)->ThrowNew(env, exception, exceptionString); (*env)->DeleteLocalRef(env, exception); return JNI_TRUE; } else { return JNI_FALSE; } } int UTILS_copyRecipientsFromJvm(JNIEnv* env, jlongArray recipients, gpgme_key_t keys[]) { //how many keys from recipients did we receive? jsize len = (*env)->GetArrayLength(env, recipients); if (len < 1) { return len; } //allocate native memory from recipient keys jlong* carr = (*env)->GetLongArrayElements(env, recipients, NULL); if (carr == NULL) { return -1; } //copy recipient keys to new array... int i; for (i = 0; i < len; i++) { keys[i] = KEY(carr[i]); } //and mark the end of the array with a NULL. keys[len] = NULL; //release the memory allocated from the recipients key list (*env)->ReleaseLongArrayElements(env, recipients, carr, 0); return len; }
{ "pile_set_name": "Github" }
(ns prone.hiccough "A very minimal templating DSL inspired by hiccup. Using this to avoid depending on a specific version of a tool that most people already have in their web stack" (:require [clojure.string :as str])) (defn- render-attr [[k v]] (str " " (name k) "=\"" v "\"")) (defn tag [type attrs & contents] (str "<" (name type) (str/join (map render-attr attrs)) ">" (str/join (flatten contents)) "</" (name type) ">")) (defn- render-1 [form] (cond (nil? form) "" (vector? form) (let [attrs (if (map? (second form)) (second form) nil) forms (if attrs (rest (rest form)) (rest form))] (tag (first form) (or attrs {}) (map render-1 forms))) (seq? form) (str/join "\n" (map render-1 form)) :else form)) (defn render "Render one or more forms of data as markup. Translates hiccup-like [:div {} 'Hey'] to (tag :div {} 'Hey') and returns the resulting string. Also accepts raw strings, numbers, nils and other data" [& forms] (str/join "\n" (map render-1 forms)))
{ "pile_set_name": "Github" }
======================================== GStreamer & Bluetooth ======================================== .. contents:: 目錄 介紹 ======================================== 參考: `藍牙 </multimedia/bluetooth>`_ 透過 PulseAudio 串給 BlueZ ======================================== .. code-block:: sh # 一般透過 PulseAudio 播放音樂 $ gst-launch-1.0 -v filesrc location=test.mp3 ! decodebin ! pulsesink # 透過 PulseAudio 傳音樂給藍芽喇叭 # 先用 pacmd 了解裝置名稱 $ pacmd list-cards | rg "(bluez_sink|alsa_output)" | rg -v monitor alsa_output.pci-0000_00_1f.3.analog-stereo/#0: Built-in Audio Analog Stereo bluez_sink.FF_FF_FF_FF_FF_FF.a2dp_sink/#1: SRS-XB30 $ gst-launch-1.0 -v filesrc location=test.mp3 ! decodebin ! pulsesink device=bluez_sink.FF_FF_FF_FF_FF_FF.a2dp_sink 透過 ALSA 和 BlueALSA 串給 BlueZ ======================================== .. code-block:: sh # 一般透過 ALSA 播放音樂 $ gst-launch-1.0 -v filesrc location=test.mp3 ! decodebin ! alsasink .. code-block:: sh # 因為 BlueZ 的限制,只能有一個人控制藍牙音訊裝置, # BlueALSA 和 PulseAudio 會互相打架, # 要使用 BlueALSA 的話有以下選擇: # 1. 關閉 PulseAudio,只開 ALSA # 2. 關閉 PulseAudio 對藍牙音訊的掌控,但是保留 PulseAudio 對其他裝置的掌控,讓 BlueALSA 掌控藍牙音訊 # 抓 Arch Linux 的 BlueALSA 套件 git clone https://aur.archlinux.org/bluez-alsa-git.git # 編譯套件 makepkg # 安裝套件 sudo pacman -U bluez-alsa-git-*.pkg.tar.xz # 根據套件指示更改設定檔: # =====-> # You have to grant BlueZ access to user bluealsa # Add those lines to /etc/dbus-1/system.d/bluetooth.conf <policy user="bluealsa"> <allow send_destination="org.bluez"/> </policy> # Users can use this service when they are members of the "audio" group. # <===== # 關閉 PulseAudio systemctl --user stop pulseaudio.socket # 開啟 BlueALSA sudo systemctl start bluealsa.service # 開啟 BlueZ systemctl restart bluetooth 2> /dev/null # 連接裝置 bluetoothctl connect FF:FF:FF:FF:FF:FF # 列出 bluealsa 狀態 sudo amixer -D bluealsa # 列出 bluealsa 支援的 simple controls sudo amixer -D bluealsa scontrols # 透過 bluealsa 設定音量 sudo amixer -D bluealsa set 'SRS-XB30 - A2DP' 30% # 透過 aplay 播放 wav 檔 sudo aplay -D bluealsa:HCI=hci0,DEV=FF:FF:FF:FF:FF:FF,PROFILE=a2dp test.wav # 用 GStreamer 透過 ALSA 和 BlueALSA 傳給 BlueZ sudo gst-launch-1.0 -v filesrc location=test.wav ! decodebin ! alsasink device=bluealsa:HCI=hci0,DEV=FF:FF:FF:FF:FF:FF,PROFILE=a2dp 直接透過 BlueZ ========================================
{ "pile_set_name": "Github" }
/* * Copyright 2017-2020 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example; import io.micrometer.core.instrument.MeterRegistry; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class ExampleController { private final MeterRegistry meterRegistry; public ExampleController(MeterRegistry meterRegistry) { this.meterRegistry = meterRegistry; } @PostMapping("/{id}") public String counter(@PathVariable String id) { this.meterRegistry.counter(id).increment(); return "Ping return successfully"; } }
{ "pile_set_name": "Github" }
#include <stdio.h> #include <objc/runtime.h> #import <Foundation/Foundation.h> @interface TargetClass : NSObject @end @interface TargetClass(LoadedMethods) - (void) m0; - (void) m1; - (void) m2; - (void) m3; - (void) m4; - (void) m5; - (void) m6; - (void) m7; - (void) m8; - (void) m9; - (void) m10; - (void) m11; - (void) m12; - (void) m13; - (void) m14; - (void) m15; @end @interface TN:TargetClass @end @implementation TN - (void) m1 { [super m1]; } - (void) m3 { [self m1]; } - (void) m2 { [self willChangeValueForKey: @"m4"]; [self didChangeValueForKey: @"m4"]; } - (void)observeValueForKeyPath:(NSString *) keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { // suppress warning keyPath = nil; object = nil; change = nil; context = NULL; } @end @implementation TargetClass(LoadedMethods) - (void) m0 { ; } - (void) m1 { ; } - (void) m2 { ; } - (void) m3 { ; } - (void) m4 { ; } - (void) m5 { ; } - (void) m6 { ; } - (void) m7 { ; } - (void) m8 { ; } - (void) m9 { ; } - (void) m10 { ; } - (void) m11 { ; } - (void) m12 { ; } - (void) m13 { ; } - (void) m14 { ; } - (void) m15 { ; } @end
{ "pile_set_name": "Github" }
{ "created_at": "2015-02-27T22:28:06.814476", "description": "Official software for blink(1) USB RGB LED by ThingM", "fork": false, "full_name": "todbot/blink1", "language": "C#", "updated_at": "2015-02-27T23:42:10.092141" }
{ "pile_set_name": "Github" }
// @flow import { eventChannel } from 'redux-saga'; import { call } from 'redux-saga/effects'; import { CALL } from 'shared/keys'; import validateEffects from 'testSaga/validateEffects'; const identity = value => value; test('returns error message for missing actual value', () => { const result = validateEffects( eventChannel, 'call', CALL, false, null, call(identity), 1, ); expect(result).toMatch(/expected call effect, but the saga yielded nothing/); });
{ "pile_set_name": "Github" }
/* * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.crypto.provider; import java.security.SecureRandom; import java.security.InvalidParameterException; import java.security.InvalidAlgorithmParameterException; import java.security.spec.AlgorithmParameterSpec; import javax.crypto.KeyGeneratorSpi; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; /** * This class generates a secret key for use with the Blowfish algorithm. * * @author Jan Luehe * */ public final class BlowfishKeyGenerator extends KeyGeneratorSpi { private SecureRandom random = null; private int keysize = 16; // default keysize (in number of bytes) /** * Empty constructor */ public BlowfishKeyGenerator() { } /** * Initializes this key generator. * * @param random the source of randomness for this generator */ protected void engineInit(SecureRandom random) { this.random = random; } /** * Initializes this key generator with the specified parameter * set and a user-provided source of randomness. * * @param params the key generation parameters * @param random the source of randomness for this key generator * * @exception InvalidAlgorithmParameterException if <code>params</code> is * inappropriate for this key generator */ protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException ("Blowfish key generation does not take any parameters"); } /** * Initializes this key generator for a certain keysize, using the given * source of randomness. * * @param keysize the keysize. This is an algorithm-specific * metric specified in number of bits. * @param random the source of randomness for this key generator */ protected void engineInit(int keysize, SecureRandom random) { if (((keysize % 8) != 0) || (keysize < 32) || (keysize > 448)) { throw new InvalidParameterException("Keysize must be " + "multiple of 8, and can " + "only range from 32 to 448 " + "(inclusive)"); } this.keysize = keysize / 8; this.engineInit(random); } /** * Generates a Blowfish key. * * @return the new Blowfish key */ protected SecretKey engineGenerateKey() { if (this.random == null) { this.random = SunJCE.getRandom(); } byte[] keyBytes = new byte[this.keysize]; this.random.nextBytes(keyBytes); return new SecretKeySpec(keyBytes, "Blowfish"); } }
{ "pile_set_name": "Github" }
// Copyright 2014 Unknwon // // 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 ini import ( "strings" "testing" . "github.com/smartystreets/goconvey/convey" ) func Test_Section(t *testing.T) { Convey("Test CRD sections", t, func() { cfg, err := Load([]byte(_CONF_DATA), "testdata/conf.ini") So(err, ShouldBeNil) So(cfg, ShouldNotBeNil) Convey("Get section strings", func() { So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,author,package,package.sub,features,types,array,note,comments,advance") }) Convey("Delete a section", func() { cfg.DeleteSection("") So(cfg.SectionStrings()[0], ShouldNotEqual, DEFAULT_SECTION) }) Convey("Create new sections", func() { cfg.NewSections("test", "test2") _, err := cfg.GetSection("test") So(err, ShouldBeNil) _, err = cfg.GetSection("test2") So(err, ShouldBeNil) }) }) } func Test_SectionRaw(t *testing.T) { Convey("Test section raw string", t, func() { cfg, err := LoadSources( LoadOptions{ Insensitive: true, UnparseableSections: []string{"core_lesson", "comments"}, }, "testdata/aicc.ini") So(err, ShouldBeNil) So(cfg, ShouldNotBeNil) Convey("Get section strings", func() { So(strings.Join(cfg.SectionStrings(), ","), ShouldEqual, "DEFAULT,core,core_lesson,comments") }) Convey("Validate non-raw section", func() { val, err := cfg.Section("core").GetKey("lesson_status") So(err, ShouldBeNil) So(val.String(), ShouldEqual, "C") }) Convey("Validate raw section", func() { So(cfg.Section("core_lesson").Body(), ShouldEqual, `my lesson state data – 1111111111111111111000000000000000001110000 111111111111111111100000000000111000000000 – end my lesson state data`) }) }) }
{ "pile_set_name": "Github" }
body { font-family: 'Helvetica', sans-serif; } h1 { margin: 0; font-size: 0.8em; } h2 { margin-top: 0; } table { border-collapse: collapse; } td { border: 1px solid gray; padding: 5px; }
{ "pile_set_name": "Github" }
/** * MaNGOS is a full featured server for World of Warcraft, supporting * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 * * Copyright (C) 2005-2014 MaNGOS project <http://getmangos.eu> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * World of Warcraft, and all World of Warcraft or Warcraft art, images, * and lore are copyrighted by Blizzard Entertainment, Inc. */ #ifndef MANGOSSERVER_DYNAMICOBJECT_H #define MANGOSSERVER_DYNAMICOBJECT_H #include "Object.h" #include "DBCEnums.h" #include "Unit.h" enum DynamicObjectType { DYNAMIC_OBJECT_PORTAL = 0x0, // unused DYNAMIC_OBJECT_AREA_SPELL = 0x1, DYNAMIC_OBJECT_FARSIGHT_FOCUS = 0x2, }; struct SpellEntry; class DynamicObject : public WorldObject { public: explicit DynamicObject(); void AddToWorld() override; void RemoveFromWorld() override; bool Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type); void Update(uint32 update_diff, uint32 p_time) override; void Delete(); uint32 GetSpellId() const { return m_spellId; } SpellEffectIndex GetEffIndex() const { return m_effIndex; } uint32 GetDuration() const { return m_aliveDuration; } ObjectGuid const& GetCasterGuid() const { return GetGuidValue(DYNAMICOBJECT_CASTER); } Unit* GetCaster() const; float GetRadius() const { return m_radius; } DynamicObjectType GetType() const { return (DynamicObjectType)GetByteValue(DYNAMICOBJECT_BYTES, 0); } bool IsAffecting(Unit* unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); } void AddAffected(Unit* unit) { m_affected.insert(unit->GetObjectGuid()); } void RemoveAffected(Unit* unit) { m_affected.erase(unit->GetObjectGuid()); } void Delay(int32 delaytime); bool IsHostileTo(Unit const* unit) const override; bool IsFriendlyTo(Unit const* unit) const override; float GetObjectBoundingRadius() const override // overwrite WorldObject version { return 0.0f; // dynamic object not have real interact size } bool IsVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const override; GridReference<DynamicObject>& GetGridRef() { return m_gridRef; } protected: uint32 m_spellId; SpellEffectIndex m_effIndex; int32 m_aliveDuration; float m_radius; // radius apply persistent effect, 0 = no persistent effect bool m_positive; GuidSet m_affected; private: GridReference<DynamicObject> m_gridRef; }; #endif
{ "pile_set_name": "Github" }
// // CompatibleAnimationKeypath.swift // Lottie_iOS // // Created by Tyler Hedrick on 3/6/19. // import Foundation #if os(iOS) || os(tvOS) || os(watchOS) /// An Objective-C compatible wrapper around Lottie's AnimationKeypath @objc public final class CompatibleAnimationKeypath: NSObject { /// Creates a keypath from a dot separated string. The string is separated by "." @objc public init(keypath: String) { animationKeypath = AnimationKeypath(keypath: keypath) } /// Creates a keypath from a list of strings. @objc public init(keys: [String]) { animationKeypath = AnimationKeypath(keys: keys) } public let animationKeypath: AnimationKeypath } #endif
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <PersistentConnection/NSObject-Protocol.h> @class NSString; @protocol PCInterfaceMonitorProtocol <NSObject> @property(readonly, nonatomic) BOOL isNetworkingPowerExpensiveToUse; @property(readonly, nonatomic) BOOL isRadioHot; @property(readonly, nonatomic) BOOL isBadLinkQuality; @property(readonly, nonatomic) BOOL isPoorLinkQuality; @property(readonly, retain, nonatomic) NSString *linkQualityString; @property(readonly, nonatomic) BOOL isInternetReachable; @property(readonly, nonatomic) BOOL isInterfaceHistoricallyUsable; @property(readonly, nonatomic) BOOL isInterfaceUsable; @property(readonly, nonatomic) int linkQuality; @property(readonly, nonatomic) long long interfaceIdentifier; @optional @property(readonly, nonatomic) NSString *networkCode; @property(readonly, nonatomic) struct __CFString *wwanInterfaceName; @property(readonly, nonatomic) BOOL isLTEWithCDRX; @property(readonly, nonatomic) int currentRAT; @end
{ "pile_set_name": "Github" }
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Vamp feature extraction plugins using Paul Brossier's Aubio library. Centre for Digital Music, Queen Mary, University of London. This file copyright 2006 Chris Cannam. 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. See the file COPYING included with this distribution for more information. */ #ifndef _ONSET_PLUGIN_H_ #define _ONSET_PLUGIN_H_ #include <vamp-sdk/Plugin.h> #include <aubio/aubio.h> #ifdef HAVE_AUBIO4 enum OnsetType { OnsetEnergy, OnsetSpecDiff, OnsetHFC, OnsetComplex, OnsetPhase, OnsetKL, OnsetMKL, OnsetSpecFlux // new in 0.4! }; #endif class Onset : public Vamp::Plugin { public: Onset(float inputSampleRate); virtual ~Onset(); bool initialise(size_t channels, size_t stepSize, size_t blockSize); void reset(); InputDomain getInputDomain() const { return TimeDomain; } std::string getIdentifier() const; std::string getName() const; std::string getDescription() const; std::string getMaker() const; int getPluginVersion() const; std::string getCopyright() const; ParameterList getParameterDescriptors() const; float getParameter(std::string) const; void setParameter(std::string, float); size_t getPreferredStepSize() const; size_t getPreferredBlockSize() const; OutputList getOutputDescriptors() const; FeatureSet process(const float *const *inputBuffers, Vamp::RealTime timestamp); FeatureSet getRemainingFeatures(); protected: fvec_t *m_ibuf; fvec_t *m_onset; #ifdef HAVE_AUBIO4 aubio_onset_t *m_onsetdet; OnsetType m_onsettype; float m_minioi; #else cvec_t *m_fftgrain; aubio_pvoc_t *m_pv; aubio_pickpeak_t *m_peakpick; aubio_onsetdetection_t *m_onsetdet; aubio_onsetdetection_type m_onsettype; size_t m_channelCount; #endif float m_silence; float m_threshold; size_t m_stepSize; size_t m_blockSize; Vamp::RealTime m_delay; Vamp::RealTime m_lastOnset; }; #endif
{ "pile_set_name": "Github" }
/* * Copyright 2000-2009 JetBrains s.r.o. * * 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.intellij.openapi.vcs.changes.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.vcs.VcsDataKeys; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeList; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public abstract class RevertSelectedChangesAction extends RevertCommittedStuffAbstractAction { public static class Revert extends RevertSelectedChangesAction { public Revert() { super(true); } } public static class Apply extends RevertSelectedChangesAction { public Apply() { super(false); } } protected RevertSelectedChangesAction(boolean reverse) { super(reverse); } @Override protected boolean isEnabled(@NotNull AnActionEvent e) { return super.isEnabled(e) && allSelectedChangeListsAreRevertable(e); } private static boolean allSelectedChangeListsAreRevertable(@NotNull AnActionEvent e) { ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS); if (changeLists == null) { return true; } for (ChangeList list : changeLists) { if (list instanceof CommittedChangeList) { if (!((CommittedChangeList)list).isModifiable()) { return false; } } } return true; } @Override protected Change @Nullable [] getChanges(@NotNull AnActionEvent e, boolean isFromUpdate) { if (!isFromUpdate) { // to ensure directory flags for SVN are initialized e.getData(VcsDataKeys.CHANGES_WITH_MOVED_CHILDREN); } return e.getData(VcsDataKeys.SELECTED_CHANGES_IN_DETAILS); } }
{ "pile_set_name": "Github" }
# Copyright 2019 Google LLC # # 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. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Sheets.V4.Model.SetBasicFilterRequest do @moduledoc """ Sets the basic filter associated with a sheet. ## Attributes * `filter` (*type:* `GoogleApi.Sheets.V4.Model.BasicFilter.t`, *default:* `nil`) - The filter to set. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :filter => GoogleApi.Sheets.V4.Model.BasicFilter.t() } field(:filter, as: GoogleApi.Sheets.V4.Model.BasicFilter) end defimpl Poison.Decoder, for: GoogleApi.Sheets.V4.Model.SetBasicFilterRequest do def decode(value, options) do GoogleApi.Sheets.V4.Model.SetBasicFilterRequest.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Sheets.V4.Model.SetBasicFilterRequest do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
{ "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. # http\://shardingsphere.apache.org/schema/shardingsphere/encrypt=org.apache.shardingsphere.encrypt.spring.namespace.handler.EncryptRuleNamespaceHandler
{ "pile_set_name": "Github" }
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> <glade-interface> <widget class="GtkDialog" id="SelectImageDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Select Image</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="default_width">650</property> <property name="default_height">450</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="dialog-action_area1"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="cancelbutton1"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> <widget class="GtkButton" id="okButton"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">0</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkNotebook" id="notebook"> <property name="border_width">6</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="show_tabs">True</property> <property name="show_border">True</property> <property name="tab_pos">GTK_POS_TOP</property> <property name="scrollable">False</property> <property name="enable_popup">False</property> <signal name="switch_page" handler="OnCurrentPageChanged" last_modification_time="Thu, 18 May 2006 12:07:20 GMT"/> <child> <widget class="GtkVBox" id="vbox1"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="iconScrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <placeholder/> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkImage" id="previewIcon"> <property name="visible">True</property> <property name="icon_size">4</property> <property name="icon_name">gtk-missing-image</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">3</property> <property name="ypad">3</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkVBox" id="vbox3"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> <widget class="GtkHBox" id="hbox3"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="label" translatable="yes">_Icon Name:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="mnemonic_widget">iconNameEntry</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkEntry" id="iconNameEntry"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <signal name="changed" handler="OnIconNameChanged" last_modification_time="Fri, 10 Mar 2006 13:48:39 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkComboBox" id="iconSizeCombo"> <property name="visible">True</property> <property name="items" translatable="yes"></property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> <signal name="changed" handler="OnIconSizeChanged" last_modification_time="Fri, 10 Mar 2006 13:50:33 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <placeholder/> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> </child> <child> <widget class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="label" translatable="yes">Themed Icons</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="type">tab</property> </packing> </child> <child> <widget class="GtkVBox" id="vbox2"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkHBox" id="hbox2"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="scrolledwindow7"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <widget class="GtkTreeView" id="resourceList"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">False</property> <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">True</property> <property name="fixed_height_mode">False</property> <property name="hover_selection">False</property> <property name="hover_expand">False</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkVButtonBox" id="vbuttonbox1"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_START</property> <property name="spacing">6</property> <child> <widget class="GtkButton" id="buttonAdd"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-add</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnAddResource" last_modification_time="Fri, 10 Mar 2006 11:17:29 GMT"/> </widget> </child> <child> <widget class="GtkButton" id="buttonRemove"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-delete</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnRemoveResource" last_modification_time="Fri, 10 Mar 2006 11:17:42 GMT"/> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox4"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkImage" id="previewResource"> <property name="width_request">30</property> <property name="height_request">30</property> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="label" translatable="yes">Resource Name:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkEntry" id="resourceNameEntry"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <signal name="changed" handler="OnResourceNameChanged" last_modification_time="Fri, 10 Mar 2006 16:31:30 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> </child> <child> <widget class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="label" translatable="yes">Resources</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="type">tab</property> </packing> </child> <child> <widget class="GtkFileChooserWidget" id="fileChooser"> <property name="border_width">12</property> <property name="visible">True</property> <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> <property name="local_only">True</property> <property name="select_multiple">False</property> <property name="show_hidden">False</property> </widget> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> </child> <child> <widget class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="label" translatable="yes">Files</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="type">tab</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> </child> </widget> <widget class="GtkDialog" id="FlagsSelectorDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Flags</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="default_width">500</property> <property name="default_height">450</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox2"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="dialog-action_area2"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="cancelbutton2"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> <widget class="GtkButton" id="okbutton1"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-5</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkScrolledWindow" id="scrolledwindow8"> <property name="border_width">6</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> <property name="shadow_type">GTK_SHADOW_IN</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <widget class="GtkTreeView" id="treeView"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">False</property> <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">True</property> <property name="fixed_height_mode">False</property> <property name="hover_selection">False</property> <property name="hover_expand">False</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> </child> </widget> <widget class="GtkDialog" id="TextEditorDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Text</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="default_width">600</property> <property name="default_height">350</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox3"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="dialog-action_area3"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="cancelbutton3"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> <widget class="GtkButton" id="okbutton2"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-5</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkVBox" id="vbox4"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="scrolledwindow9"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <widget class="GtkTextView" id="textview"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="overwrite">False</property> <property name="accepts_tab">True</property> <property name="justification">GTK_JUSTIFY_LEFT</property> <property name="wrap_mode">GTK_WRAP_CHAR</property> <property name="cursor_visible">True</property> <property name="pixels_above_lines">0</property> <property name="pixels_below_lines">0</property> <property name="pixels_inside_wrap">0</property> <property name="left_margin">0</property> <property name="right_margin">0</property> <property name="indent">0</property> <property name="text" translatable="yes"></property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkCheckButton" id="checkTranslatable"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">Translatable</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="active">False</property> <property name="inconsistent">False</property> <property name="draw_indicator">True</property> <signal name="toggled" handler="OnTranslatableToggled" last_modification_time="Fri, 17 Mar 2006 16:37:34 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkTable" id="translationTable"> <property name="visible">True</property> <property name="n_rows">2</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">6</property> <property name="column_spacing">6</property> <child> <widget class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="label" translatable="yes">Translation Context Hint:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> <property name="top_attach">0</property> <property name="bottom_attach">1</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> <widget class="GtkLabel" id="label8"> <property name="visible">True</property> <property name="label" translatable="yes">Comment for Translators</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> <widget class="GtkEntry" id="entryContext"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">0</property> <property name="bottom_attach">1</property> <property name="y_options"></property> </packing> </child> <child> <widget class="GtkEntry" id="entryComment"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> <property name="y_options"></property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> </child> </widget> <widget class="GtkDialog" id="SelectIconDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Select Image</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="default_width">650</property> <property name="default_height">450</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="vbox5"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="hbuttonbox1"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="button1"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> <widget class="GtkButton" id="okButton"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-5</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkNotebook" id="notebook"> <property name="border_width">6</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="show_tabs">True</property> <property name="show_border">True</property> <property name="tab_pos">GTK_POS_TOP</property> <property name="scrollable">False</property> <property name="enable_popup">False</property> <signal name="switch_page" handler="OnCurrentPageChanged" last_modification_time="Thu, 18 May 2006 12:05:33 GMT"/> <child> <widget class="GtkVBox" id="vbox6"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="iconScrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <placeholder/> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox5"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkImage" id="previewIcon"> <property name="visible">True</property> <property name="icon_size">4</property> <property name="icon_name">gtk-missing-image</property> <property name="xalign">0.5</property> <property name="yalign">0</property> <property name="xpad">3</property> <property name="ypad">3</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkVBox" id="vbox7"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> <widget class="GtkHBox" id="hbox6"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkLabel" id="label9"> <property name="visible">True</property> <property name="label" translatable="yes">_Icon Name:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="mnemonic_widget">stockIconEntry</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkEntry" id="stockIconEntry"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <signal name="changed" handler="OnIconNameChanged" last_modification_time="Fri, 10 Mar 2006 13:48:39 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <placeholder/> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkVBox" id="labelWarningIcon"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> <widget class="GtkHSeparator" id="hseparator2"> <property name="visible">True</property> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox11"> <property name="border_width">3</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">3</property> <child> <widget class="GtkImage" id="image1"> <property name="visible">True</property> <property name="stock">gtk-dialog-warning</property> <property name="icon_size">1</property> <property name="xalign">0.5</property> <property name="yalign">0</property> <property name="xpad">0</property> <property name="ypad">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkLabel" id="labelWarning"> <property name="width_request">513</property> <property name="visible">True</property> <property name="label" translatable="yes">The selected icon may not show at run time if the required icon factory is not properly initialized.</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">True</property> <property name="selectable">False</property> <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> </child> <child> <widget class="GtkLabel" id="label10"> <property name="visible">True</property> <property name="label" translatable="yes">Stock Icons</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="type">tab</property> </packing> </child> <child> <widget class="GtkVBox" id="vbox8"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkHBox" id="hbox7"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="customIconScrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_NONE</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <placeholder/> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkVButtonBox" id="vbuttonbox2"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_START</property> <property name="spacing">6</property> <child> <widget class="GtkButton" id="button3"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-add</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnAddIcon" last_modification_time="Wed, 17 May 2006 11:25:29 GMT"/> </widget> </child> <child> <widget class="GtkButton" id="button4"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-edit</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnEditIcon" last_modification_time="Wed, 17 May 2006 11:24:58 GMT"/> </widget> </child> <child> <widget class="GtkButton" id="button5"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-delete</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnRemoveIcon" last_modification_time="Wed, 17 May 2006 11:25:18 GMT"/> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="tab_expand">False</property> <property name="tab_fill">True</property> </packing> </child> <child> <widget class="GtkLabel" id="label12"> <property name="visible">True</property> <property name="label" translatable="yes">Project Icons</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="type">tab</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> </child> </widget> <widget class="GtkDialog" id="EditIconDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Edit Icon</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="default_width">650</property> <property name="default_height">400</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox4"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="dialog-action_area4"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="cancelbutton4"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> <widget class="GtkButton" id="okButton"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-5</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkVBox" id="vbox12"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkHBox" id="hbox15"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkLabel" id="label21"> <property name="visible">True</property> <property name="label" translatable="yes">Icon name:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkEntry" id="nameEntry"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">True</property> <property name="visibility">True</property> <property name="max_length">0</property> <property name="text" translatable="yes"></property> <property name="has_frame">True</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <property name="width_chars">20</property> <signal name="changed" handler="OnNameChanged" last_modification_time="Wed, 17 May 2006 15:53:15 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkHSeparator" id="hseparator1"> <property name="visible">True</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkRadioButton" id="radioSingle"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">Single source icon</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="active">False</property> <property name="inconsistent">False</property> <property name="draw_indicator">True</property> <signal name="clicked" handler="OnSingleClicked" last_modification_time="Wed, 17 May 2006 12:17:45 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkHBox" id="hboxSingle"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkLabel" id="label20"> <property name="width_request">12</property> <property name="visible">True</property> <property name="label" translatable="yes"></property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkLabel" id="label17"> <property name="visible">True</property> <property name="label" translatable="yes">Image:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="label_xalign">0</property> <property name="label_yalign">0.5</property> <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> <child> <widget class="GtkHBox" id="hbox14"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkImage" id="imageImage"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> </widget> <packing> <property name="padding">6</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkLabel" id="imageLabel"> <property name="visible">True</property> <property name="label">image name</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkButton" id="button9"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">Select Image...</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnSelectImage" last_modification_time="Wed, 17 May 2006 12:11:57 GMT"/> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkRadioButton" id="radioMultiple"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">Multiple source icon</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="active">False</property> <property name="inconsistent">False</property> <property name="draw_indicator">True</property> <property name="group">radioSingle</property> <signal name="clicked" handler="OnMultipleClicked" last_modification_time="Wed, 17 May 2006 12:18:00 GMT"/> </widget> <packing> <property name="padding">3</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox12"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> <widget class="GtkLabel" id="label19"> <property name="width_request">12</property> <property name="visible">True</property> <property name="label" translatable="yes"></property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkHBox" id="hboxMultiple"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="scrolledwindow13"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_IN</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <widget class="GtkTreeView" id="sourceList"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">True</property> <property name="rules_hint">False</property> <property name="reorderable">False</property> <property name="enable_search">True</property> <property name="fixed_height_mode">False</property> <property name="hover_selection">False</property> <property name="hover_expand">False</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkVButtonBox" id="vbuttonbox3"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_START</property> <property name="spacing">3</property> <child> <widget class="GtkButton" id="button10"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-add</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnAddSource" last_modification_time="Wed, 17 May 2006 12:12:11 GMT"/> </widget> </child> <child> <widget class="GtkButton" id="button11"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-delete</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnRemoveSource" last_modification_time="Wed, 17 May 2006 12:12:21 GMT"/> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> </child> </widget> <widget class="GtkDialog" id="EditIconFactoryDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Edit Icon Factory</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> <property name="default_width">450</property> <property name="default_height">460</property> <property name="resizable">True</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="vbox14"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="hbuttonbox2"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="button17"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-close</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-7</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox22"> <property name="border_width">12</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkScrolledWindow" id="iconListScrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="shadow_type">GTK_SHADOW_NONE</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property> <child> <placeholder/> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkVButtonBox" id="vbuttonbox4"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_START</property> <property name="spacing">6</property> <child> <widget class="GtkButton" id="button18"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-add</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnAddIcon" last_modification_time="Wed, 17 May 2006 11:25:29 GMT"/> </widget> </child> <child> <widget class="GtkButton" id="button19"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-edit</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnEditIcon" last_modification_time="Wed, 17 May 2006 11:24:58 GMT"/> </widget> </child> <child> <widget class="GtkButton" id="button20"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-delete</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <signal name="clicked" handler="OnRemoveIcon" last_modification_time="Wed, 17 May 2006 11:25:18 GMT"/> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> </child> </widget> <widget class="GtkDialog" id="AddNonContainerDialog"> <property name="visible">True</property> <property name="title" translatable="yes">Widget Designer</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">True</property> <property name="resizable">False</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox5"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child internal-child="action_area"> <widget class="GtkHButtonBox" id="dialog-action_area5"> <property name="visible">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property> <child> <widget class="GtkButton" id="cancelbutton5"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-cancel</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> <widget class="GtkButton" id="okbutton"> <property name="visible">True</property> <property name="can_default">True</property> <property name="has_default">True</property> <property name="can_focus">True</property> <property name="label">gtk-ok</property> <property name="use_stock">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-5</property> </widget> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox23"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> <child> <widget class="GtkImage" id="image2"> <property name="visible">True</property> <property name="stock">gtk-dialog-warning</property> <property name="icon_size">6</property> <property name="xalign">0</property> <property name="yalign">0</property> <property name="xpad">0</property> <property name="ypad">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkVBox" id="mainBox"> <property name="border_width">6</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkLabel" id="label22"> <property name="width_request">449</property> <property name="visible">True</property> <property name="label" translatable="yes">You are trying to add a non-container widget into the main window. In &lt;b&gt;GTK#&lt;/b&gt;, widget positioning is controlled by a special type of widgets called &lt;b&gt;Container&lt;/b&gt; widgets. If you don't place the widget into a container, it will fill the all the available space in the window. Are you sure you want to continue?</property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">True</property> <property name="selectable">False</property> <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkHBox" id="hbox24"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">6</property> <child> <widget class="GtkLabel" id="label23"> <property name="visible">True</property> <property name="label" translatable="yes">To know more about this topic see the article:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> <child> <widget class="GtkButton" id="linkButton"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">GTK# Widget Layout and Packing</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">True</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> <child> <widget class="GtkCheckButton" id="showCheck"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">Don't show this message again</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="active">False</property> <property name="inconsistent">False</property> <property name="draw_indicator">True</property> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> <property name="pack_type">GTK_PACK_END</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">True</property> <property name="fill">True</property> </packing> </child> </widget> <packing> <property name="padding">0</property> <property name="expand">False</property> <property name="fill">False</property> </packing> </child> </widget> </child> </widget> </glade-interface>
{ "pile_set_name": "Github" }
var convert = require('./convert'), func = convert('findIndex', require('../findIndex')); func.placeholder = require('./placeholder'); module.exports = func;
{ "pile_set_name": "Github" }
/*------------------------------------------------------------------------- * * tuptable.h * tuple table support stuff * * * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/executor/tuptable.h * *------------------------------------------------------------------------- */ #ifndef TUPTABLE_H #define TUPTABLE_H #include "access/htup.h" #include "access/tupdesc.h" #include "storage/buf.h" /*---------- * The executor stores tuples in a "tuple table" which is a List of * independent TupleTableSlots. There are several cases we need to handle: * 1. physical tuple in a disk buffer page * 2. physical tuple constructed in palloc'ed memory * 3. "minimal" physical tuple constructed in palloc'ed memory * 4. "virtual" tuple consisting of Datum/isnull arrays * * The first two cases are similar in that they both deal with "materialized" * tuples, but resource management is different. For a tuple in a disk page * we need to hold a pin on the buffer until the TupleTableSlot's reference * to the tuple is dropped; while for a palloc'd tuple we usually want the * tuple pfree'd when the TupleTableSlot's reference is dropped. * * A "minimal" tuple is handled similarly to a palloc'd regular tuple. * At present, minimal tuples never are stored in buffers, so there is no * parallel to case 1. Note that a minimal tuple has no "system columns". * (Actually, it could have an OID, but we have no need to access the OID.) * * A "virtual" tuple is an optimization used to minimize physical data * copying in a nest of plan nodes. Any pass-by-reference Datums in the * tuple point to storage that is not directly associated with the * TupleTableSlot; generally they will point to part of a tuple stored in * a lower plan node's output TupleTableSlot, or to a function result * constructed in a plan node's per-tuple econtext. It is the responsibility * of the generating plan node to be sure these resources are not released * for as long as the virtual tuple needs to be valid. We only use virtual * tuples in the result slots of plan nodes --- tuples to be copied anywhere * else need to be "materialized" into physical tuples. Note also that a * virtual tuple does not have any "system columns". * * It is also possible for a TupleTableSlot to hold both physical and minimal * copies of a tuple. This is done when the slot is requested to provide * the format other than the one it currently holds. (Originally we attempted * to handle such requests by replacing one format with the other, but that * had the fatal defect of invalidating any pass-by-reference Datums pointing * into the existing slot contents.) Both copies must contain identical data * payloads when this is the case. * * The Datum/isnull arrays of a TupleTableSlot serve double duty. When the * slot contains a virtual tuple, they are the authoritative data. When the * slot contains a physical tuple, the arrays contain data extracted from * the tuple. (In this state, any pass-by-reference Datums point into * the physical tuple.) The extracted information is built "lazily", * ie, only as needed. This serves to avoid repeated extraction of data * from the physical tuple. * * A TupleTableSlot can also be "empty", holding no valid data. This is * the only valid state for a freshly-created slot that has not yet had a * tuple descriptor assigned to it. In this state, tts_isempty must be * TRUE, tts_shouldFree FALSE, tts_tuple NULL, tts_buffer InvalidBuffer, * and tts_nvalid zero. * * The tupleDescriptor is simply referenced, not copied, by the TupleTableSlot * code. The caller of ExecSetSlotDescriptor() is responsible for providing * a descriptor that will live as long as the slot does. (Typically, both * slots and descriptors are in per-query memory and are freed by memory * context deallocation at query end; so it's not worth providing any extra * mechanism to do more. However, the slot will increment the tupdesc * reference count if a reference-counted tupdesc is supplied.) * * When tts_shouldFree is true, the physical tuple is "owned" by the slot * and should be freed when the slot's reference to the tuple is dropped. * * If tts_buffer is not InvalidBuffer, then the slot is holding a pin * on the indicated buffer page; drop the pin when we release the * slot's reference to that buffer. (tts_shouldFree should always be * false in such a case, since presumably tts_tuple is pointing at the * buffer page.) * * tts_nvalid indicates the number of valid columns in the tts_values/isnull * arrays. When the slot is holding a "virtual" tuple this must be equal * to the descriptor's natts. When the slot is holding a physical tuple * this is equal to the number of columns we have extracted (we always * extract columns from left to right, so there are no holes). * * tts_values/tts_isnull are allocated when a descriptor is assigned to the * slot; they are of length equal to the descriptor's natts. * * tts_mintuple must always be NULL if the slot does not hold a "minimal" * tuple. When it does, tts_mintuple points to the actual MinimalTupleData * object (the thing to be pfree'd if tts_shouldFreeMin is true). If the slot * has only a minimal and not also a regular physical tuple, then tts_tuple * points at tts_minhdr and the fields of that struct are set correctly * for access to the minimal tuple; in particular, tts_minhdr.t_data points * MINIMAL_TUPLE_OFFSET bytes before tts_mintuple. This allows column * extraction to treat the case identically to regular physical tuples. * * tts_slow/tts_off are saved state for slot_deform_tuple, and should not * be touched by any other code. *---------- */ typedef struct TupleTableSlot { NodeTag type; bool tts_isempty; /* true = slot is empty */ bool tts_shouldFree; /* should pfree tts_tuple? */ bool tts_shouldFreeMin; /* should pfree tts_mintuple? */ bool tts_slow; /* saved state for slot_deform_tuple */ HeapTuple tts_tuple; /* physical tuple, or NULL if virtual */ TupleDesc tts_tupleDescriptor; /* slot's tuple descriptor */ MemoryContext tts_mcxt; /* slot itself is in this context */ Buffer tts_buffer; /* tuple's buffer, or InvalidBuffer */ int tts_nvalid; /* # of valid values in tts_values */ Datum *tts_values; /* current per-attribute values */ bool *tts_isnull; /* current per-attribute isnull flags */ MinimalTuple tts_mintuple; /* minimal tuple, or NULL if none */ HeapTupleData tts_minhdr; /* workspace for minimal-tuple-only case */ long tts_off; /* saved state for slot_deform_tuple */ } TupleTableSlot; #define TTS_HAS_PHYSICAL_TUPLE(slot) \ ((slot)->tts_tuple != NULL && (slot)->tts_tuple != &((slot)->tts_minhdr)) /* * TupIsNull -- is a TupleTableSlot empty? */ #define TupIsNull(slot) \ ((slot) == NULL || (slot)->tts_isempty) /* in executor/execTuples.c */ extern TupleTableSlot *MakeTupleTableSlot(void); extern TupleTableSlot *ExecAllocTableSlot(List **tupleTable); extern void ExecResetTupleTable(List *tupleTable, bool shouldFree); extern TupleTableSlot *MakeSingleTupleTableSlot(TupleDesc tupdesc); extern void ExecDropSingleTupleTableSlot(TupleTableSlot *slot); extern void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc); extern TupleTableSlot *ExecStoreTuple(HeapTuple tuple, TupleTableSlot *slot, Buffer buffer, bool shouldFree); extern TupleTableSlot *ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree); extern TupleTableSlot *ExecClearTuple(TupleTableSlot *slot); extern TupleTableSlot *ExecStoreVirtualTuple(TupleTableSlot *slot); extern TupleTableSlot *ExecStoreAllNullTuple(TupleTableSlot *slot); extern HeapTuple ExecCopySlotTuple(TupleTableSlot *slot); extern MinimalTuple ExecCopySlotMinimalTuple(TupleTableSlot *slot); extern HeapTuple ExecFetchSlotTuple(TupleTableSlot *slot); extern MinimalTuple ExecFetchSlotMinimalTuple(TupleTableSlot *slot); extern Datum ExecFetchSlotTupleDatum(TupleTableSlot *slot); extern HeapTuple ExecMaterializeSlot(TupleTableSlot *slot); extern TupleTableSlot *ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot); extern TupleTableSlot *ExecMakeSlotContentsReadOnly(TupleTableSlot *slot); /* in access/common/heaptuple.c */ extern Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull); extern void slot_getallattrs(TupleTableSlot *slot); extern void slot_getsomeattrs(TupleTableSlot *slot, int attnum); extern bool slot_attisnull(TupleTableSlot *slot, int attnum); #endif /* TUPTABLE_H */
{ "pile_set_name": "Github" }
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.sql.*"%> <%@page import="com.sectooladdict.database.ConnectionPoolManager"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Login page with hard-coded administrative credentials</title> </head> <body> <!-- <%@ include file="include.jsp"%> --> <% //if(username.equalsIgnoreCase("admin") && password.equalsIgnoreCase("1234abcd")) { out.println("The system is up and running"); out.flush(); %> </body> </html>
{ "pile_set_name": "Github" }
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Aws.WafV2.Inputs { public sealed class WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchSingleHeaderGetArgs : Pulumi.ResourceArgs { /// <summary> /// The name of the query header to inspect. This setting must be provided as lower case characters. /// </summary> [Input("name", required: true)] public Input<string> Name { get; set; } = null!; public WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchSingleHeaderGetArgs() { } } }
{ "pile_set_name": "Github" }
#!/usr/bin/env python # Copyright 2010-2014 RethinkDB, all rights reserved. import sys """This script is used to generate the RDB_MAKE_SERIALIZABLE_*() and RDB_MAKE_ME_SERIALIZABLE_*() macro definitions. Because there are so many variations, and because they are so similar, it's easier to just have a Python script to generate them. This script is meant to be run as follows (assuming you are in the top directory): $ ./scripts/generate_serialize_macros.py > src/rpc/serialize_macros.hpp """ def generate_make_serializable_macro(nfields): fields = "".join(", field%d" % (i + 1) for i in xrange(nfields)) zeroarg = ("UNUSED " if nfields == 0 else "") print("#define RDB_MAKE_SERIALIZABLE_%d(type_t%s) \\" % \ (nfields, fields)) print(" template <cluster_version_t W> \\") print(" void serialize(%swrite_message_t *wm, %sconst type_t &thing) { \\" % (zeroarg, zeroarg)) for i in xrange(nfields): print(" serialize<W>(wm, thing.field%d); \\" % (i + 1) print(" } \\") print(" template <cluster_version_t W> \\") print(" archive_result_t deserialize(%sread_stream_t *s, %stype_t *thing) { \\" % (zeroarg, zeroarg)) print(" archive_result_t res = archive_result_t::SUCCESS; \\") for i in xrange(nfields): print(" res = deserialize<W>(s, deserialize_deref(thing->field%d)); \\" % (i + 1)) print(" if (bad(res)) { return res; } \\") print(" return res; \\") print(" } \\") print(" extern int dont_use_RDB_MAKE_SERIALIZABLE_within_a_class_body") print() print("#define RDB_MAKE_SERIALIZABLE_%d_FOR_CLUSTER(type_t%s) \\" % \ (nfields, fields)) print(" template <> \\") print(" void serialize<cluster_version_t::CLUSTER>( \\") print(" %swrite_message_t *wm, %sconst type_t &thing) { \\" % (zeroarg, zeroarg)) for i in xrange(nfields): print(" serialize<cluster_version_t::CLUSTER>(wm, thing.field%d); \\" % (i + 1)) print(" } \\") print(" template <> \\") print(" archive_result_t deserialize<cluster_version_t::CLUSTER>( \\") print(" %sread_stream_t *s, %stype_t *thing) { \\" % (zeroarg, zeroarg)) print(" archive_result_t res = archive_result_t::SUCCESS; \\") for i in xrange(nfields): print(" res = deserialize<cluster_version_t::CLUSTER>( \\") print(" s, deserialize_deref(thing->field%d)); \\" % (i + 1)) print(" if (bad(res)) { return res; } \\") print(" return res; \\") print(" } \\") print(" extern int dont_use_RDB_MAKE_SERIALIZABLE_FOR_CLUSTER_within_a_class_body") print() # See the note in the comment below. print("#define RDB_IMPL_SERIALIZABLE_%d(type_t%s) RDB_MAKE_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields, nfields, fields)) print() print("#define RDB_IMPL_SERIALIZABLE_%d_FOR_CLUSTER(type_t%s) \\" % (nfields, fields)) print(" RDB_MAKE_SERIALIZABLE_%d_FOR_CLUSTER(type_t%s);" % (nfields, fields)) print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v1_13(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v1_13(type_t)") print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v1_16(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v1_16(type_t)") print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v2_1(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v2_1(type_t)") print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v2_2(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v2_2(type_t)") print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v2_3(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v2_3(type_t)") print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v2_4(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v2_4(type_t)") print() print("#define RDB_IMPL_SERIALIZABLE_%d_SINCE_v2_5(type_t%s) \\" % (nfields, fields)) print(" RDB_IMPL_SERIALIZABLE_%d(type_t%s); \\" % (nfields, fields)) print(" INSTANTIATE_SERIALIZABLE_SINCE_v2_5(type_t)") print("#define RDB_MAKE_ME_SERIALIZABLE_%d(type_t%s) \\" % \ (nfields, fields)) print(" template <cluster_version_t W> \\") print(" friend void serialize(%swrite_message_t *wm, %sconst type_t &thing) { \\" % (zeroarg, zeroarg)) for i in xrange(nfields): print(" serialize<W>(wm, thing.field%d); \\" % (i + 1)) print(" } \\") print(" template <cluster_version_t W> \\") print(" friend archive_result_t deserialize(%sread_stream_t *s, %stype_t *thing) { \\" % (zeroarg, zeroarg)) print(" archive_result_t res = archive_result_t::SUCCESS; \\") for i in xrange(nfields): print(" res = deserialize<W>(s, deserialize_deref(thing->field%d)); \\" % (i + 1)) print(" if (bad(res)) { return res; } \\") print(" return res; \\") print(" }") if __name__ == "__main__": print("// Copyright 2010-2014 RethinkDB, all rights reserved.") print("#ifndef RPC_SERIALIZE_MACROS_HPP_") print("#define RPC_SERIALIZE_MACROS_HPP_") print() print("/* This file is automatically generated by '%s'." % " ".join(sys.argv)) print("Please modify '%s' instead of modifying this file.*/" % sys.argv[0]) print() print("#include <type_traits>") print() print("#include \"containers/archive/archive.hpp\"") print("#include \"containers/archive/versioned.hpp\"") print("#include \"errors.hpp\"") print("#include \"version.hpp\"") print() print(""") /* The purpose of these macros is to make it easier to serialize and unserialize data types that consist of a simple series of fields, each of which is serializable. Suppose we have a type "struct point_t { int32_t x, y; }" that we want to be able to serialize. To make it serializable automatically, either write RDB_MAKE_SERIALIZABLE_2(point_t, x, y) at the global scope, or write RDB_MAKE_ME_SERIALIZABLE_2(point_t, x, y) within the body of the point_t type. The _FOR_CLUSTER variants of the macros exist to indicate that a type can only be serialized for use within the cluster, thus should not be serialized to disk. The _SINCE_v1_13 variants of the macros exist to make the conversion to versioned serialization easier. They must only be used for types which serialization format has not changed since version 1.13.0. Once the format changes, you can still use the macros without the _SINCE_v1_13 suffix and instantiate the serialize() and deserialize() functions explicitly for a certain version. We use dummy "extern int" declarations to force a compile error in macros that should not be used inside of class bodies. */ """.strip() print("namespace helper {") print() print("/* When a `static_assert` is used within a templated class or function,") print(" * but does not depend on any template parameters the C++ compiler is free") print(" * to evaluate the assert even before instantiating that template. This") print(" * helper class allows a `static_assert(false, ...)` to depend on the") print(" * `cluster_version_t` template parameter.") print(" * Also see http://stackoverflow.com/a/14637534. */") print("template <cluster_version_t W>") print("struct always_false") print(" : std::false_type { };") print() print("} // namespace helper") print() print("#define RDB_DECLARE_SERIALIZABLE(type_t) \\") print(" template <cluster_version_t W> \\") print(" void serialize(write_message_t *, const type_t &); \\") print(" template <cluster_version_t W> \\") print(" archive_result_t deserialize(read_stream_t *s, type_t *thing); \\") print(" extern int dont_use_RDB_DECLARE_SERIALIZABLE_within_a_class_body") print() print("#define RDB_DECLARE_SERIALIZABLE_FOR_CLUSTER(type_t) \\") print(" template <cluster_version_t W> \\") print(" void serialize(write_message_t *, const type_t &) { \\") print(" static_assert(helper::always_false<W>::value, \\") print(" \"This type is only serializable for cluster.\"); \\") print(" unreachable(); \\") print(" } \\") print(" template <> \\") print(" void serialize<cluster_version_t::CLUSTER>( \\") print(" write_message_t *, const type_t &); \\") print(" template <cluster_version_t W> \\") print(" archive_result_t deserialize(read_stream_t *, type_t *) { \\") print(" static_assert(helper::always_false<W>::value, \\") print(" \"This type is only deserializable for cluster.\"); \\") print(" unreachable(); \\") print(" } \\") print(" template <> \\") print(" archive_result_t deserialize<cluster_version_t::CLUSTER>( \\") print(" read_stream_t *s, type_t *thing)") print() print("#define RDB_DECLARE_ME_SERIALIZABLE(type_t) \\") print(" template <cluster_version_t W> \\") print(" friend void serialize(write_message_t *, const type_t &); \\") print(" template <cluster_version_t W> \\") print(" friend archive_result_t deserialize(read_stream_t *s, type_t *thing)") for nfields in xrange(20): generate_make_serializable_macro(nfields) print() print("#endif // RPC_SERIALIZE_MACROS_HPP_")
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">{ "Info": [ { "IsSuccess": "True", "InAddress": "高雄市林園區鳳林路二段757之1號", "InSRS": "EPSG:4326", "InFuzzyType": "[單雙號機制]+[最近門牌號機制]", "InFuzzyBuffer": "0", "InIsOnlyFullMatch": "False", "InIsLockCounty": "True", "InIsLockTown": "False", "InIsLockVillage": "False", "InIsLockRoadSection": "False", "InIsLockLane": "False", "InIsLockAlley": "False", "InIsLockArea": "False", "InIsSameNumber_SubNumber": "True", "InCanIgnoreVillage": "True", "InCanIgnoreNeighborhood": "True", "InReturnMaxCount": "0", "OutTotal": "1", "OutMatchType": "完全比對", "OutMatchCode": "[高雄市]\tFULL:1", "OutTraceInfo": "[高雄市]\t { 完全比對 } 找到符合的門牌地址" } ], "AddressList": [ { "FULL_ADDR": "高雄市林園區林園里19鄰鳳林路二段757之1號", "COUNTY": "高雄市", "TOWN": "林園區", "VILLAGE": "林園里", "NEIGHBORHOOD": "19鄰", "ROAD": "鳳林路", "SECTION": "2", "LANE": "", "ALLEY": "", "SUB_ALLEY": "", "TONG": "", "NUMBER": "757之1號", "X": 120.395769, "Y": 22.512971 } ] }</string>
{ "pile_set_name": "Github" }
// Load modules var Lab = require('lab'); var Cryptiles = require('.'); // Declare internals var internals = {}; // Test shortcuts var expect = Lab.expect; var before = Lab.before; var after = Lab.after; var describe = Lab.experiment; var it = Lab.test; describe('Cryptiles', function () { describe('#randomString', function () { it('should generate the right length string', function (done) { for (var i = 1; i <= 1000; ++i) { expect(Cryptiles.randomString(i).length).to.equal(i); } done(); }); it('returns an error on invalid bits size', function (done) { expect(Cryptiles.randomString(99999999999999999999).message).to.equal('Failed generating random bits: Argument #1 must be number > 0'); done(); }); }); describe('#randomBits', function () { it('returns an error on invalid input', function (done) { expect(Cryptiles.randomBits(0).message).to.equal('Invalid random bits count'); done(); }); }); describe('#fixedTimeComparison', function () { var a = Cryptiles.randomString(50000); var b = Cryptiles.randomString(150000); it('should take the same amount of time comparing different string sizes', function (done) { var now = Date.now(); Cryptiles.fixedTimeComparison(b, a); var t1 = Date.now() - now; now = Date.now(); Cryptiles.fixedTimeComparison(b, b); var t2 = Date.now() - now; expect(t2 - t1).to.be.within(-20, 20); done(); }); it('should return true for equal strings', function (done) { expect(Cryptiles.fixedTimeComparison(a, a)).to.equal(true); done(); }); it('should return false for different strings (size, a < b)', function (done) { expect(Cryptiles.fixedTimeComparison(a, a + 'x')).to.equal(false); done(); }); it('should return false for different strings (size, a > b)', function (done) { expect(Cryptiles.fixedTimeComparison(a + 'x', a)).to.equal(false); done(); }); it('should return false for different strings (size, a = b)', function (done) { expect(Cryptiles.fixedTimeComparison(a + 'x', a + 'y')).to.equal(false); done(); }); }); });
{ "pile_set_name": "Github" }
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'sandi_meter/version' Gem::Specification.new do |spec| spec.name = "sandi_meter" spec.version = SandiMeter::VERSION spec.authors = ["Anatoli Makarevich"] spec.email = ["[email protected]"] spec.description = %q{Sandi Metz rules checker} spec.summary = %q{Sandi Metz rules checker} spec.homepage = "https://github.com/makaroni4/sandi_meter" spec.license = "MIT" spec.required_ruby_version = '>= 1.9.0' spec.files = %w(LICENSE README.md Rakefile sandi_meter.gemspec) spec.files += Dir.glob("html/*") spec.files += Dir.glob("lib/**/*.rb") spec.files += Dir.glob("bin/**/*") spec.files += Dir.glob("spec/**/*") spec.executables = ["sandi_meter"] spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.13" spec.add_runtime_dependency "mixlib-cli" spec.add_runtime_dependency "json" spec.add_runtime_dependency "launchy" end
{ "pile_set_name": "Github" }
{ "coverage": { "US Census": { "geoid": "35027", "name": "Lincoln", "state": "New Mexico" }, "country": "us", "state": "nm", "county": "Lincoln" }, "schema": 2, "layers": { "addresses": [ { "name": "county", "data": "https://services.arcgis.com/4YineAQdtmx0tv46/ArcGIS/rest/services/LincolnNMFeatures/FeatureServer/0", "protocol": "ESRI", "conform": { "format": "geojson", "number": { "function": "regexp", "field": "FULLADDR", "pattern": "(\\d+)[A-Z]?$" }, "street": { "function": "regexp", "field": "FULLADDR", "pattern": "^(.+?)\\b(?:\\s*(?:-|=|\\.)\\s*)(?:\\d+[A-Z]?)?$" }, "unit": { "function": "regexp", "field": "FULLADDR", "pattern": "\\d+([A-Z])$" } }, "test": { "enabled": true, "description": "these are the tests that exercise number-suffixed addresses", "acceptance-tests": [ { "description": "= delimiter, alphanumeric number", "inputs": { "FULLADDR": "SAN MIGUEL RD=114A" }, "expected": { "number": "114", "street": "SAN MIGUEL RD", "unit": "A" } }, { "description": "= delimiter with padding", "inputs": { "FULLADDR": "LAGUNA VISTA PL = 102" }, "expected": { "number": "102", "street": "LAGUNA VISTA PL", "unit": "" } }, { "description": "street ends with number", "inputs": { "FULLADDR": "US HWY 54-11457" }, "expected": { "number": "11457", "street": "US HWY 54", "unit": "" } }, { "description": ". delimiter", "inputs": { "FULLADDR": "N. CENTRAL DR.310" }, "expected": { "number": "310", "street": "N. CENTRAL DR", "unit": "" } }, { "description": "0-length delimiter, doesn't currently work", "inputs": { "FULLADDR": "HULL RD0405" }, "expected": { "number": "0405", "street": "", "unit": "" } } ] } } ] } }
{ "pile_set_name": "Github" }
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\DBAL; use Doctrine\Common\EventManager; /** * Factory for creating Doctrine\DBAL\Connection instances. * * @author Roman Borschel <[email protected]> * @since 2.0 */ final class DriverManager { /** * List of supported drivers and their mappings to the driver classes. * * To add your own driver use the 'driverClass' parameter to * {@link DriverManager::getConnection()}. * * @var array */ private static $_driverMap = array( 'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver', 'pdo_sqlite' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver', 'pdo_pgsql' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver', 'pdo_oci' => 'Doctrine\DBAL\Driver\PDOOracle\Driver', 'oci8' => 'Doctrine\DBAL\Driver\OCI8\Driver', 'ibm_db2' => 'Doctrine\DBAL\Driver\IBMDB2\DB2Driver', 'pdo_sqlsrv' => 'Doctrine\DBAL\Driver\PDOSqlsrv\Driver', 'mysqli' => 'Doctrine\DBAL\Driver\Mysqli\Driver', 'drizzle_pdo_mysql' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver', 'sqlanywhere' => 'Doctrine\DBAL\Driver\SQLAnywhere\Driver', 'sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver', ); /** * List of URL schemes from a database URL and their mappings to driver. */ private static $driverSchemeAliases = array( 'db2' => 'ibm_db2', 'mssql' => 'pdo_sqlsrv', 'mysql' => 'pdo_mysql', 'mysql2' => 'pdo_mysql', // Amazon RDS, for some weird reason 'postgres' => 'pdo_pgsql', 'postgresql' => 'pdo_pgsql', 'pgsql' => 'pdo_pgsql', 'sqlite' => 'pdo_sqlite', 'sqlite3' => 'pdo_sqlite', ); /** * Private constructor. This class cannot be instantiated. */ private function __construct() { } /** * Creates a connection object based on the specified parameters. * This method returns a Doctrine\DBAL\Connection which wraps the underlying * driver connection. * * $params must contain at least one of the following. * * Either 'driver' with one of the following values: * * pdo_mysql * pdo_sqlite * pdo_pgsql * pdo_oci (unstable) * pdo_sqlsrv * pdo_sqlsrv * mysqli * sqlanywhere * sqlsrv * ibm_db2 (unstable) * drizzle_pdo_mysql * * OR 'driverClass' that contains the full class name (with namespace) of the * driver class to instantiate. * * Other (optional) parameters: * * <b>user (string)</b>: * The username to use when connecting. * * <b>password (string)</b>: * The password to use when connecting. * * <b>driverOptions (array)</b>: * Any additional driver-specific options for the driver. These are just passed * through to the driver. * * <b>pdo</b>: * You can pass an existing PDO instance through this parameter. The PDO * instance will be wrapped in a Doctrine\DBAL\Connection. * * <b>wrapperClass</b>: * You may specify a custom wrapper class through the 'wrapperClass' * parameter but this class MUST inherit from Doctrine\DBAL\Connection. * * <b>driverClass</b>: * The driver class to use. * * @param array $params The parameters. * @param \Doctrine\DBAL\Configuration|null $config The configuration to use. * @param \Doctrine\Common\EventManager|null $eventManager The event manager to use. * * @return \Doctrine\DBAL\Connection * * @throws \Doctrine\DBAL\DBALException */ public static function getConnection( array $params, Configuration $config = null, EventManager $eventManager = null) { // create default config and event manager, if not set if ( ! $config) { $config = new Configuration(); } if ( ! $eventManager) { $eventManager = new EventManager(); } $params = self::parseDatabaseUrl($params); // check for existing pdo object if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) { throw DBALException::invalidPdoInstance(); } elseif (isset($params['pdo'])) { $params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME); } else { self::_checkParams($params); } if (isset($params['driverClass'])) { $className = $params['driverClass']; } else { $className = self::$_driverMap[$params['driver']]; } $driver = new $className(); $wrapperClass = 'Doctrine\DBAL\Connection'; if (isset($params['wrapperClass'])) { if (is_subclass_of($params['wrapperClass'], $wrapperClass)) { $wrapperClass = $params['wrapperClass']; } else { throw DBALException::invalidWrapperClass($params['wrapperClass']); } } return new $wrapperClass($params, $driver, $config, $eventManager); } /** * Returns the list of supported drivers. * * @return array */ public static function getAvailableDrivers() { return array_keys(self::$_driverMap); } /** * Checks the list of parameters. * * @param array $params The list of parameters. * * @return void * * @throws \Doctrine\DBAL\DBALException */ private static function _checkParams(array $params) { // check existence of mandatory parameters // driver if ( ! isset($params['driver']) && ! isset($params['driverClass'])) { throw DBALException::driverRequired(); } // check validity of parameters // driver if (isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) { throw DBALException::unknownDriver($params['driver'], array_keys(self::$_driverMap)); } if (isset($params['driverClass']) && ! in_array('Doctrine\DBAL\Driver', class_implements($params['driverClass'], true))) { throw DBALException::invalidDriverClass($params['driverClass']); } } /** * Extracts parts from a database URL, if present, and returns an * updated list of parameters. * * @param array $params The list of parameters. * * @return array A modified list of parameters with info from a database * URL extracted into indidivual parameter parts. * * @throws DBALException */ private static function parseDatabaseUrl(array $params) { if (!isset($params['url'])) { return $params; } // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $params['url']); $url = parse_url($url); if ($url === false) { throw new DBALException('Malformed parameter "url".'); } if (isset($url['scheme'])) { $params['driver'] = str_replace('-', '_', $url['scheme']); // URL schemes must not contain underscores, but dashes are ok if (isset(self::$driverSchemeAliases[$params['driver']])) { $params['driver'] = self::$driverSchemeAliases[$params['driver']]; // use alias like "postgres", else we just let checkParams decide later if the driver exists (for literal "pdo-pgsql" etc) } } if (isset($url['host'])) { $params['host'] = $url['host']; } if (isset($url['port'])) { $params['port'] = $url['port']; } if (isset($url['user'])) { $params['user'] = $url['user']; } if (isset($url['pass'])) { $params['password'] = $url['pass']; } if (isset($url['path'])) { $params = self::parseDatabaseUrlPath($url, $params); } if (isset($url['query'])) { $query = array(); parse_str($url['query'], $query); // simply ingest query as extra params, e.g. charset or sslmode $params = array_merge($params, $query); // parse_str wipes existing array elements } return $params; } /** * Parses the given URL and resolves the given connection parameters. * * @param array $url The URL parts to evaluate. * @param array $params The connection parameters to resolve. * * @return array The resolved connection parameters. */ private static function parseDatabaseUrlPath(array $url, array $params) { if (!isset($url['scheme'])) { $params['dbname'] = $url['path']; return $params; } $url['path'] = substr($url['path'], 1); if (strpos($url['scheme'], 'sqlite') !== false) { return self::parseSqliteDatabaseUrlPath($url, $params); } $params['dbname'] = $url['path']; return $params; } /** * Parses the given SQLite URL and resolves the given connection parameters. * * @param array $url The SQLite URL parts to evaluate. * @param array $params The connection parameters to resolve. * * @return array The resolved connection parameters. */ private static function parseSqliteDatabaseUrlPath(array $url, array $params) { if ($url['path'] === ':memory:') { $params['memory'] = true; return $params; } $params['path'] = $url['path']; // pdo_sqlite driver uses 'path' instead of 'dbname' key return $params; } }
{ "pile_set_name": "Github" }
for i in range(1,10): for j in range (1,i+1): print(j,"x",i,"=",i*j,end='\t') print() print() i=0 j=0 while i<9: i+=1 while j<i: j+=1 if (i%2)==0: j=0 break print(j,"x",i,"=",i*j,end='\t') if i==j: j=0 print() break
{ "pile_set_name": "Github" }
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: #ident "$Id$" /* COPYING CONDITIONS NOTICE: This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation, and provided that the following conditions are met: * Redistributions of source code must retain this COPYING CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the PATENT MARKING NOTICE (below), and the PATENT RIGHTS GRANT (below). * Redistributions in binary form must reproduce this COPYING CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the PATENT MARKING NOTICE (below), and the PATENT RIGHTS GRANT (below) in the documentation and/or other materials provided with the distribution. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. COPYRIGHT NOTICE: TokuDB, Tokutek Fractal Tree Indexing Library. Copyright (C) 2007-2013 Tokutek, Inc. DISCLAIMER: 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. UNIVERSITY PATENT NOTICE: The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it. PATENT MARKING NOTICE: This software is covered by US Patent No. 8,185,551. This software is covered by US Patent No. 8,489,638. PATENT RIGHTS GRANT: "THIS IMPLEMENTATION" means the copyrightable works distributed by Tokutek as part of the Fractal Tree project. "PATENT CLAIMS" means the claims of patents that are owned or licensable by Tokutek, both currently or in the future; and that in the absence of this license would be infringed by THIS IMPLEMENTATION or by using or running THIS IMPLEMENTATION. "PATENT CHALLENGE" shall mean a challenge to the validity, patentability, enforceability and/or non-infringement of any of the PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS. Tokutek hereby grants to you, for the term and geographical scope of the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, transfer, and otherwise run, modify, and propagate the contents of THIS IMPLEMENTATION, where such license applies only to the PATENT CLAIMS. This grant does not include claims that would be infringed only as a consequence of further modifications of THIS IMPLEMENTATION. If you or your agent or licensee institute or order or agree to the institution of patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that THIS IMPLEMENTATION constitutes direct or contributory patent infringement, or inducement of patent infringement, then any rights granted to you under this License shall terminate as of the date such litigation is filed. If you or your agent or exclusive licensee institute or order or agree to the institution of a PATENT CHALLENGE, then Tokutek may terminate any rights granted to you under this License. */ #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ifndef TOKU_ASSERT_H #define TOKU_ASSERT_H /* The problem with assert.h: If NDEBUG is set then it doesn't execute the function, if NDEBUG isn't set then we get a branch that isn't taken. */ /* This version will complain if NDEBUG is set. */ /* It evaluates the argument and then calls a function toku_do_assert() which takes all the hits for the branches not taken. */ #include "toku_config.h" #include <stdint.h> #include <errno.h> #ifdef NDEBUG #error NDEBUG should not be set #endif static inline int get_error_errno(void); static inline int get_maybe_error_errno(void) { return errno; } static inline void set_errno(int new_errno) { errno = new_errno; } void toku_assert_init(void) __attribute__((constructor)); void toku_assert_set_fpointers(int (*toku_maybe_get_engine_status_text_pointer)(char*, int), void (*toku_maybe_set_env_panic_pointer)(int, const char*), uint64_t num_rows); void toku_do_assert(int /*expr*/,const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/) __attribute__((__visibility__("default"))); void toku_do_assert_fail(const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/) __attribute__((__visibility__("default"))) __attribute__((__noreturn__)); void toku_do_assert_zero_fail(uintptr_t/*expr*/, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/) __attribute__((__visibility__("default"))) __attribute__((__noreturn__)); void toku_do_assert_expected_fail(uintptr_t/*expr*/, uintptr_t /*expected*/, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/) __attribute__((__visibility__("default"))) __attribute__((__noreturn__)); // Define GCOV if you want to get test-coverage information that ignores the assert statements. // #define GCOV extern void (*do_assert_hook)(void); // Set this to a function you want called after printing the assertion failure message but before calling abort(). By default this is NULL. #if defined(GCOV) || TOKU_WINDOWS #define assert(expr) toku_do_assert((expr) != 0, #expr, __FUNCTION__, __FILE__, __LINE__, 1) #define assert_zero(expr) toku_do_assert((expr) == 0, #expr, __FUNCTION__, __FILE__, __LINE__, 1) #define assert_equals(expr, expected) toku_do_assert((expr) == (expected), (expected), #expr, __FUNCTION__, __FILE__, __LINE__, 1) #else #define assert(expr) ((expr) ? (void)0 : toku_do_assert_fail(#expr, __FUNCTION__, __FILE__, __LINE__, 1)) #define assert_zero(expr) ((expr) == 0 ? (void)0 : toku_do_assert_zero_fail((uintptr_t)(expr), #expr, __FUNCTION__, __FILE__, __LINE__, 1)) #define assert_equals(expr, expected) ((expr) == (expected) ? (void)0 : toku_do_assert_expected_fail((uintptr_t)(expr), (uintptr_t)(expected), #expr, __FUNCTION__, __FILE__, __LINE__, 1)) #define assert_null(expr) ((expr) == nullptr ? (void)0 : toku_do_assert_zero_fail((uintptr_t)(expr), #expr, __FUNCTION__, __FILE__, __LINE__, 1)) #endif #ifdef GCOV #define WHEN_GCOV(x) x #define WHEN_NOT_GCOV(x) #else #define WHEN_GCOV(x) #define WHEN_NOT_GCOV(x) x #endif /* This is not a part of compile time library? */ /* #if !defined(__clang__) #include <type_traits> # define ENSURE_POD(type) static_assert(std::is_pod<type>::value, #type " isn't POD") #else # define ENSURE_POD(type) // TEMP, clang is much more strict about POD. #endif */ #define lazy_assert(a) assert(a) // indicates code is incomplete #define lazy_assert_zero(a) assert_zero(a) // indicates code is incomplete #define lazy_assert_equals(a, b) assert_equals(a, b) // indicates code is incomplete #define invariant(a) assert(a) // indicates a code invariant that must be true #define invariant_null(a) assert_null(a) // indicates a code invariant that must be true #define invariant_notnull(a) assert(a) // indicates a code invariant that must be true #define invariant_zero(a) assert_zero(a) // indicates a code invariant that must be true #define invariant_equals(a, b) assert_equals(a, b) // indicates a code invariant that must be true #define resource_assert(a) assert(a) // indicates resource must be available, otherwise unrecoverable #define resource_assert_zero(a) assert_zero(a) // indicates resource must be available, otherwise unrecoverable #define resource_assert_equals(a, b) assert_equals(a, b) // indicates resource must be available, otherwise unrecoverable #if TOKU_DEBUG_PARANOID #define paranoid_invariant(a) assert(a) #define paranoid_invariant_null(a) assert_null(a) #define paranoid_invariant_notnull(a) assert(a) #define paranoid_invariant_zero(a) assert_zero(a) #else // !TOKU_DEBUG_PARANOID #define paranoid_invariant(a) ((void) 0) #define paranoid_invariant_null(a) ((void) 0) #define paranoid_invariant_notnull(a) ((void) 0) #define paranoid_invariant_zero(a) ((void) 0) #endif static inline int get_error_errno(void) { invariant(errno); return errno; } extern bool toku_gdb_dump_on_assert; #endif
{ "pile_set_name": "Github" }
K 14 svn:executable V 1 * END
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Helper; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\DebugFormatterHelper; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Process\Process; use Symfony\Component\Process\ProcessBuilder; class ProcessHelperTest extends TestCase { /** * @dataProvider provideCommandsAndOutput */ public function testVariousProcessRuns($expected, $cmd, $verbosity, $error) { $helper = new ProcessHelper(); $helper->setHelperSet(new HelperSet(array(new DebugFormatterHelper()))); $output = $this->getOutputStream($verbosity); $helper->run($output, $cmd, $error); $this->assertEquals($expected, $this->getOutput($output)); } public function testPassedCallbackIsExecuted() { $helper = new ProcessHelper(); $helper->setHelperSet(new HelperSet(array(new DebugFormatterHelper()))); $output = $this->getOutputStream(StreamOutput::VERBOSITY_NORMAL); $executed = false; $callback = function () use (&$executed) { $executed = true; }; $helper->run($output, 'php -r "echo 42;"', null, $callback); $this->assertTrue($executed); } public function provideCommandsAndOutput() { $successOutputVerbose = <<<'EOT' RUN php -r "echo 42;" RES Command ran successfully EOT; $successOutputDebug = <<<'EOT' RUN php -r "echo 42;" OUT 42 RES Command ran successfully EOT; $successOutputDebugWithTags = <<<'EOT' RUN php -r "echo '<info>42</info>';" OUT <info>42</info> RES Command ran successfully EOT; $successOutputProcessDebug = <<<'EOT' RUN 'php' '-r' 'echo 42;' OUT 42 RES Command ran successfully EOT; $syntaxErrorOutputVerbose = <<<'EOT' RUN php -r "fwrite(STDERR, 'error message');usleep(50000);fwrite(STDOUT, 'out message');exit(252);" RES 252 Command did not run successfully EOT; $syntaxErrorOutputDebug = <<<'EOT' RUN php -r "fwrite(STDERR, 'error message');usleep(500000);fwrite(STDOUT, 'out message');exit(252);" ERR error message OUT out message RES 252 Command did not run successfully EOT; $errorMessage = 'An error occurred'; $args = new ProcessBuilder(array('php', '-r', 'echo 42;')); $args = $args->getProcess()->getCommandLine(); $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); return array( array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null), array($successOutputVerbose, 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), array($successOutputDebug, 'php -r "echo 42;"', StreamOutput::VERBOSITY_DEBUG, null), array($successOutputDebugWithTags, 'php -r "echo \'<info>42</info>\';"', StreamOutput::VERBOSITY_DEBUG, null), array('', 'php -r "syntax error"', StreamOutput::VERBOSITY_VERBOSE, null), array($syntaxErrorOutputVerbose, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, null), array($syntaxErrorOutputDebug, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, null), array($errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERBOSE, $errorMessage), array($syntaxErrorOutputVerbose.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(50000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_VERY_VERBOSE, $errorMessage), array($syntaxErrorOutputDebug.$errorMessage.PHP_EOL, 'php -r "fwrite(STDERR, \'error message\');usleep(500000);fwrite(STDOUT, \'out message\');exit(252);"', StreamOutput::VERBOSITY_DEBUG, $errorMessage), array($successOutputProcessDebug, array('php', '-r', 'echo 42;'), StreamOutput::VERBOSITY_DEBUG, null), array($successOutputDebug, new Process('php -r "echo 42;"'), StreamOutput::VERBOSITY_DEBUG, null), ); } private function getOutputStream($verbosity) { return new StreamOutput(fopen('php://memory', 'r+', false), $verbosity, false); } private function getOutput(StreamOutput $output) { rewind($output->getStream()); return stream_get_contents($output->getStream()); } }
{ "pile_set_name": "Github" }
module Admin::ConsultationsHelper def consulation_response_help_text(response) if response.is_a?(ConsultationOutcome) "You can add attachments after saving this page." else "Optional - publish the feedback received from the public. You can add attachments after saving this page." end end def consultation_opening_phrase(consultation) return "Opening date TBC" if consultation.opening_at.nil? date = absolute_time(consultation.opening_at) ((consultation.opening_at < Time.zone.today ? "Opened at " : "Opens at ") + date).html_safe end def consultation_closing_phrase(consultation) return "Closing date TBC" if consultation.closing_at.nil? date = absolute_time(consultation.closing_at) ((consultation.closing_at < Time.zone.today ? "Closed at " : "Closes at ") + date).html_safe end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="8"> <results class_id="0" tracking_level="0" version="0"> <compiler>GNU C++ version 4.5.1 20100617 (prerelease)</compiler> <platform>linux</platform> <entries class_id="1" tracking_level="0" version="0"> <count>256</count> <item_version>0</item_version> <item class_id="2" tracking_level="0" version="0"> <type>string</type> <size>4</size> <data>0.0074473220000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021171600000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021249610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020889610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020989610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021022810000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020897610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207932</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020796</data> </item> <item> <type>string</type> <size>4</size> <data>0.00206676</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021010830000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020941230000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020960029999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0022728430000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021422430000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021111599999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020897210000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020777199999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207756</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020766400000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020919610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020888820000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020911620000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002101922</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207456</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020878400000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020859200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002087963</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021150030000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020946430000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002101323</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020741600000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207048</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020697200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020688</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020761210000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021957610000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002088922</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020608800000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207632</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020790000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020759200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002086563</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020913630000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021061630000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021424030000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020861200000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020792000000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020831199999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020748800000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020908810000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020839210000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020882019999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020667200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020760000000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020742</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020731200000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.002098721</data> </item> <item> <type>string</type> <size>4</size> <data>0.002094963</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020910030000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021128430000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020812000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020832800000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020760800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020872810000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.002092801</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020863209999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.002081641</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020940020000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020796400000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207428</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020808800000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002087401</data> </item> <item> <type>string</type> <size>4</size> <data>0.002102881</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020912830000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002095043</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020720000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021351600000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020774000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020770000000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020883210000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002102521</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020871209999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020829210000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020788</data> </item> <item> <type>string</type> <size>4</size> <data>0.0022383620000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021013220000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020742400000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020818799999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.00208304</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020769600000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020958030000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002107083</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020970430000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.002090083</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020642</data> </item> <item> <type>string</type> <size>4</size> <data>0.00206924</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020811600000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020840810000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020956010000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021117220000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.002084762</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020757600000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020830800000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020730800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020841200000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021030430000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002085763</data> </item> <item> <type>string</type> <size>4</size> <data>0.0022383630000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021111630000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020823600000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020833200000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020757200000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020928410000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021011610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020833610000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020972820000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020638800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020747600000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020711200000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020848810000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021020430000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002103443</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020883630000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020817600000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020656800000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020790000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020752000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002078641</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020934009999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020846810000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020884010000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.00208224</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020734400000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020746000000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020917209999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.002091561</data> </item> <item> <type>string</type> <size>4</size> <data>0.002099643</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020947230000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020736000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021564399999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021086</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020864400000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020888009999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020872410000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021153610000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020850809999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020748800000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020727600000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.00206544</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020935610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020951210000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020952810000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002109203</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020785199999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020814800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207932</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020870800000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021083600000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020882410000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020863209999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020938810000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020698400000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207412</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020688</data> </item> <item> <type>string</type> <size>4</size> <data>0.00208376</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020955610000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020943610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020893610000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020961230000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020729200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00206996</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021200800000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020985630000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021015600000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002084481</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020864810000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020774400000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020692800000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207136</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020879610000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002089441</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021005609999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021022409999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020743200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020792800000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020774000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020765600000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020830830000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020838829999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020982410000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020833610000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020726</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020782800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020529599999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021279210000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002089161</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020892010000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207544</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020828400000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020691200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207704</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020880429999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020918429999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021526430000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002085323</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020922810000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020669200000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.00215372</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207304</data> </item> <item> <type>string</type> <size>4</size> <data>0.002076601</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020949620000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002083321</data> </item> <item> <type>string</type> <size>4</size> <data>0.002073961</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020738000000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020674400000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00207888</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020933230000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020924430000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021093230000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020860030000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020732400000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020663999999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.00206828</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020734</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020888009999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020840010000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021071610000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020698800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002078</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020668800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020828000000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021036430000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.002105923</data> </item> <item> <type>string</type> <size>4</size> <data>0.002094963</data> </item> <item> <type>string</type> <size>4</size> <data>0.0022069630000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.00209384</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020772</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020736800000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020742</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020923210000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.002086081</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020877210000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020729200000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0021266810000000001</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020851610000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.00208464</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020736400000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020819600000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020852399999999999</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020909230000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.002100963</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020798030000000003</data> </item> <item> <type>string</type> <size>4</size> <data>0.002048865</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020709600000000002</data> </item> <item> <type>string</type> <size>4</size> <data>0.0020917600000000002</data> </item> </entries> </results>
{ "pile_set_name": "Github" }
{ "generated_in":"0.1224", "stat":"ok", "moderators":{ "on_this_page":"1", "page":"1", "perpage":"25", "total":"1", "moderator":{ "display_name":"Blake Whitman", "id":"151382", "is_plus":"1", "is_staff":"1", "profileurl":"http:\/\/vimeo.com\/blakewhitman", "realname":"Blake Whitman", "username":"blakewhitman", "videosurl":"http:\/\/vimeo.com\/blakewhitman\/videos", "portraits":{ "portrait":[ { "height":"30", "width":"30", "_content":"http:\/\/images.vimeo.com\/11\/60\/62\/116062176\/116062176_30.jpg" }, { "height":"75", "width":"75", "_content":"http:\/\/images.vimeo.com\/11\/60\/62\/116062176\/116062176_75.jpg" }, { "height":"100", "width":"100", "_content":"http:\/\/images.vimeo.com\/11\/60\/62\/116062176\/116062176_100.jpg" }, { "height":"300", "width":"300", "_content":"http:\/\/images.vimeo.com\/11\/60\/62\/116062176\/116062176_300.jpg" } ] } } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2013 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #include <stdio.h> // fprintf(), NULL #include <stdlib.h> // exit(), EXIT_SUCCESS #include <dlfcn.h> #include <string.h> #include <stdlib.h> // for atoi() #include "test.h" // PASS(), FAIL(), XPASS(), XFAIL() extern int foo(); int main(int argc, const char* argv[]) { int expectedResult = atoi(argv[1]); int actualResult = foo(); //fprintf(stderr, "foo() returned %d, expected %d\n", actualResult, expectedResult); if ( actualResult != expectedResult ) FAIL("framework-DYLD_LIBRARY_PATH using wrong dylib. foo() returned %d, expected %d", actualResult, expectedResult); else PASS("framework-DYLD_LIBRARY_PATH"); return EXIT_SUCCESS; }
{ "pile_set_name": "Github" }
<?php /** * Mockery * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://github.com/padraic/mockery/blob/master/LICENSE * 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. * * @category Mockery * @package Mockery * @copyright Copyright (c) 2010 Pádraic Brady (http://blog.astrumfutura.com) * @license http://github.com/padraic/mockery/blob/master/LICENSE New BSD License */ namespace Mockery\CountValidator; class Exception extends \OutOfBoundsException { }
{ "pile_set_name": "Github" }
[package] description = "CITA node." name = "cita-chain" version = "20.2.0" authors = ["Rivtower Technologies <[email protected]>"] license = "Apache-2.0" edition = "2018" [dependencies] dotenv = "0.13.0" clap = "2" serde_json = "1.0" cita-logger = "0.1.1" cita-types = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } libproto = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } pubsub = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } cita-directories = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } util = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } error = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } jsonrpc-types = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } core = { path = "./core" } common-types = { path = "./types" } proof = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } cita_db = { version = "0.1", package = "cita-database" } [build-dependencies] util = { git = "https://github.com/citahub/cita-common.git", branch = "develop" } [features] default = ["secp256k1", "sha3hash", "rabbitmq"] secp256k1 = ["libproto/secp256k1", "proof/secp256k1"] ed25519 = ["libproto/ed25519", "proof/ed25519"] sm2 = ["libproto/sm2", "proof/sm2"] sha3hash = ["libproto/sha3hash", "proof/sha3hash"] blake2bhash = ["libproto/blake2bhash", "proof/blake2bhash"] sm3hash = ["libproto/sm3hash", "proof/sm3hash"] rabbitmq = ["pubsub/rabbitmq"] zeromq = ["pubsub/zeromq"] kafka = ["pubsub/kafka"]
{ "pile_set_name": "Github" }
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> </resources>
{ "pile_set_name": "Github" }
// Spinning Icons // -------------------------- .#{$fa-css-prefix}-spin { -webkit-animation: fa-spin 2s infinite linear; animation: fa-spin 2s infinite linear; } .#{$fa-css-prefix}-pulse { -webkit-animation: fa-spin 1s infinite steps(8); animation: fa-spin 1s infinite steps(8); } @-webkit-keyframes fa-spin { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(359deg); transform: rotate(359deg); } } @keyframes fa-spin { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(359deg); transform: rotate(359deg); } }
{ "pile_set_name": "Github" }
ace.define("ace/snippets/erlang",["require","exports","module"], function(require, exports, module) { "use strict"; exports.snippetText = "# module and export all\n\ snippet mod\n\ -module(${1:`Filename('', 'my')`}).\n\ \n\ -compile([export_all]).\n\ \n\ start() ->\n\ ${2}\n\ \n\ stop() ->\n\ ok.\n\ # define directive\n\ snippet def\n\ -define(${1:macro}, ${2:body}).${3}\n\ # export directive\n\ snippet exp\n\ -export([${1:function}/${2:arity}]).\n\ # include directive\n\ snippet inc\n\ -include(\"${1:file}\").${2}\n\ # behavior directive\n\ snippet beh\n\ -behaviour(${1:behaviour}).${2}\n\ # if expression\n\ snippet if\n\ if\n\ ${1:guard} ->\n\ ${2:body}\n\ end\n\ # case expression\n\ snippet case\n\ case ${1:expression} of\n\ ${2:pattern} ->\n\ ${3:body};\n\ end\n\ # anonymous function\n\ snippet fun\n\ fun (${1:Parameters}) -> ${2:body} end${3}\n\ # try...catch\n\ snippet try\n\ try\n\ ${1}\n\ catch\n\ ${2:_:_} -> ${3:got_some_exception}\n\ end\n\ # record directive\n\ snippet rec\n\ -record(${1:record}, {\n\ ${2:field}=${3:value}}).${4}\n\ # todo comment\n\ snippet todo\n\ %% TODO: ${1}\n\ ## Snippets below (starting with '%') are in EDoc format.\n\ ## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details\n\ # doc comment\n\ snippet %d\n\ %% @doc ${1}\n\ # end of doc comment\n\ snippet %e\n\ %% @end\n\ # specification comment\n\ snippet %s\n\ %% @spec ${1}\n\ # private function marker\n\ snippet %p\n\ %% @private\n\ # OTP application\n\ snippet application\n\ -module(${1:`Filename('', 'my')`}).\n\ \n\ -behaviour(application).\n\ \n\ -export([start/2, stop/1]).\n\ \n\ start(_Type, _StartArgs) ->\n\ case ${2:root_supervisor}:start_link() of\n\ {ok, Pid} ->\n\ {ok, Pid};\n\ Other ->\n\ {error, Other}\n\ end.\n\ \n\ stop(_State) ->\n\ ok. \n\ # OTP supervisor\n\ snippet supervisor\n\ -module(${1:`Filename('', 'my')`}).\n\ \n\ -behaviour(supervisor).\n\ \n\ %% API\n\ -export([start_link/0]).\n\ \n\ %% Supervisor callbacks\n\ -export([init/1]).\n\ \n\ -define(SERVER, ?MODULE).\n\ \n\ start_link() ->\n\ supervisor:start_link({local, ?SERVER}, ?MODULE, []).\n\ \n\ init([]) ->\n\ Server = {${2:my_server}, {$2, start_link, []},\n\ permanent, 2000, worker, [$2]},\n\ Children = [Server],\n\ RestartStrategy = {one_for_one, 0, 1},\n\ {ok, {RestartStrategy, Children}}.\n\ # OTP gen_server\n\ snippet gen_server\n\ -module(${1:`Filename('', 'my')`}).\n\ \n\ -behaviour(gen_server).\n\ \n\ %% API\n\ -export([\n\ start_link/0\n\ ]).\n\ \n\ %% gen_server callbacks\n\ -export([init/1, handle_call/3, handle_cast/2, handle_info/2,\n\ terminate/2, code_change/3]).\n\ \n\ -define(SERVER, ?MODULE).\n\ \n\ -record(state, {}).\n\ \n\ %%%===================================================================\n\ %%% API\n\ %%%===================================================================\n\ \n\ start_link() ->\n\ gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).\n\ \n\ %%%===================================================================\n\ %%% gen_server callbacks\n\ %%%===================================================================\n\ \n\ init([]) ->\n\ {ok, #state{}}.\n\ \n\ handle_call(_Request, _From, State) ->\n\ Reply = ok,\n\ {reply, Reply, State}.\n\ \n\ handle_cast(_Msg, State) ->\n\ {noreply, State}.\n\ \n\ handle_info(_Info, State) ->\n\ {noreply, State}.\n\ \n\ terminate(_Reason, _State) ->\n\ ok.\n\ \n\ code_change(_OldVsn, State, _Extra) ->\n\ {ok, State}.\n\ \n\ %%%===================================================================\n\ %%% Internal functions\n\ %%%===================================================================\n\ \n\ "; exports.scope = "erlang"; });
{ "pile_set_name": "Github" }
/* Copyright 2013 Google Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * Utils */ (function() { var namespace = WEBLAB.namespace('WEBLAB.utils'); namespace.Utils = function() { /** * [addListener adds an event listener cross-browser] * @param {[DOMElement]} aElement * @param {[DOMEvent]} aEvent * @param {[Function]} aCallback */ this.addListener = null; /** * [removeListener removes an event listener cross-browser] * @param {[DOMElement]} aElement * @param {[DOMEvent]} aEvent * @param {[Function]} aCallback */ this.removeListener = null; /** * [stopEvent stops propagation and prevents default actions of an event cross-browser] * @param {[DOMEvent]} aEvent */ this.stopEvent = null; }; var utils = WEBLAB.utils.Utils; //add and remove listeners functions definitions depending on browser if (typeof window.addEventListener === 'function') { utils.addListener = function(aElement, aEvent, aCallback) { aElement.addEventListener(aEvent, aCallback, false); }; utils.removeListener = function(aElement, aEvent, aCallback) { aElement.removeEventListener(aEvent, aCallback, false); }; } else if (typeof document.attachEvent === 'function') { //IE utils.addListener = function(aElement, aEvent, aCallback) { aElement.attachEvent('on' + aEvent, aCallback); }; utils.removeListener = function(aElement, aEvent, aCallback) { aElement.detachEvent('on' + aEvent, aCallback); }; } else { utils.addListener = function(aElement, aEvent, aCallback) { aElement['on' + aEvent] = aCallback; }; utils.removeListener = function(aElement, aEvent, aCallback) { aElement['on' + aEvent] = null; }; } //stopEvent function definition depending on browser utils.stopEvent = function(aEvent) { if (typeof aEvent.preventDefault === "function" && typeof aEvent.stopPropagation === "function") { aEvent.preventDefault(); aEvent.stopPropagation(); } if (typeof aEvent.returnValue === "boolean" && typeof aEvent.cancelBubble === "boolean") { aEvent.returnValue = false; aEvent.cancelBubble = true; } }; utils.destroyIfExists = function(aObject) { if (aObject !== null && aObject !== undefined && aObject.destroy instanceof Function) { aObject.destroy(); } }; utils.destroyArrayIfExists = function(aArray) { if (aArray !== null && aArray !== undefined && aArray instanceof Array) { var currentArray = aArray; var currentArrayLength = currentArray.length; for (var i = 0; i < currentArrayLength; i++) { var currentObject = currentArray[i]; if (currentObject !== null && currentObject !== undefined && currentObject.destroy instanceof Function) { currentObject.destroy(); } currentArray[i] = null; } } }; /* * ECMAScript 5 Polyfill for Function.bind method */ if (!Function.prototype.bind) { Function.prototype.bind = function(oThis) { if (typeof this !== "function") { // closest thing possible to the ECMAScript 5 internal IsCallable function throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function() {}, fBound = function() { return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } })();
{ "pile_set_name": "Github" }
/***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) * * Copyright (C) 2017 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #include "shape_io.hpp" // mapnik #include <mapnik/debug.hpp> #include <mapnik/make_unique.hpp> #include <mapnik/datasource.hpp> #include <mapnik/util/is_clockwise.hpp> #include <mapnik/geometry/correct.hpp> using mapnik::datasource_exception; const std::string shape_io::SHP = ".shp"; const std::string shape_io::SHX = ".shx"; const std::string shape_io::DBF = ".dbf"; const std::string shape_io::INDEX = ".index"; shape_io::shape_io(std::string const& shape_name, bool open_index) : type_(shape_null), shp_(shape_name + SHP), shx_(shape_name + SHX), dbf_(shape_name + DBF), reclength_(0), id_(0) { bool ok = (shp_.is_open() && dbf_.is_open()); if (!ok) { throw datasource_exception("Shape Plugin: cannot read shape file '" + shape_name + "'"); } if (open_index) { try { index_ = std::make_unique<shape_file>(shape_name + INDEX); } catch (...) { MAPNIK_LOG_WARN(shape) << "shape_io: Could not open index=" << shape_name << INDEX; } } if (!index_ && !shx_.is_open()) { throw datasource_exception("Shape Plugin: cannot read shape index file '" + shape_name + ".shx'"); } } shape_io::~shape_io() {} void shape_io::move_to(std::streampos pos) { shp_.seek(pos); id_ = shp_.read_xdr_integer(); reclength_ = shp_.read_xdr_integer(); } shape_file& shape_io::shp() { return shp_; } shape_file& shape_io::shx() { return shx_; } dbf_file& shape_io::dbf() { return dbf_; } void shape_io::read_bbox(shape_file::record_type & record, mapnik::box2d<double> & bbox) { double lox = record.read_double(); double loy = record.read_double(); double hix = record.read_double(); double hiy = record.read_double(); bbox.init(lox, loy, hix, hiy); } mapnik::geometry::geometry<double> shape_io::read_polyline(shape_file::record_type & record) { mapnik::geometry::geometry<double> geom; // default empty int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); if (num_parts == 1) { mapnik::geometry::line_string<double> line; line.reserve(num_points); record.skip(4); for (int i = 0; i < num_points; ++i) { double x = record.read_double(); double y = record.read_double(); line.emplace_back(x, y); } geom = std::move(line); } else { std::vector<int> parts; parts.resize(num_parts); std::for_each(parts.begin(), parts.end(), [&](int & part) { part = record.read_ndr_integer();}); int start, end; mapnik::geometry::multi_line_string<double> multi_line; multi_line.reserve(num_parts); for (int k = 0; k < num_parts; ++k) { start = parts[k]; if (k == num_parts - 1) { end = num_points; } else { end = parts[k + 1]; } mapnik::geometry::line_string<double> line; line.reserve(end - start); for (int j = start; j < end; ++j) { double x = record.read_double(); double y = record.read_double(); line.emplace_back(x, y); } multi_line.push_back(std::move(line)); } geom = std::move(multi_line); } return geom; } mapnik::geometry::geometry<double> shape_io::read_polyline_parts(shape_file::record_type & record, std::vector<std::pair<int, int>> const& parts) { mapnik::geometry::geometry<double> geom; // default empty int total_num_parts = record.read_ndr_integer(); int num_parts = parts.size(); mapnik::geometry::multi_line_string<double> multi_line; multi_line.reserve(num_parts); for (int k = 0; k < num_parts; ++k) { int start = parts[k].first; int end = parts[k].second; unsigned pos = 4 + 32 + 8 + 4 * total_num_parts + start * 16; record.set_pos(pos); mapnik::geometry::line_string<double> line; line.reserve(end - start); for (int j = start; j < end; ++j) { double x = record.read_double(); double y = record.read_double(); line.emplace_back(x, y); } multi_line.push_back(std::move(line)); } geom = std::move(multi_line); return geom; } mapnik::geometry::geometry<double> shape_io::read_polygon(shape_file::record_type & record) { mapnik::geometry::geometry<double> geom; // default empty int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); std::vector<int> parts; parts.resize(num_parts); std::for_each(parts.begin(), parts.end(), [&](int & part) { part = record.read_ndr_integer();}); mapnik::geometry::polygon<double> poly; mapnik::geometry::multi_polygon<double> multi_poly; for (int k = 0; k < num_parts; ++k) { int start = parts[k]; int end; if (k == num_parts - 1) end = num_points; else end = parts[k + 1]; mapnik::geometry::linear_ring<double> ring; ring.reserve(end - start); for (int j = start; j < end; ++j) { double x = record.read_double(); double y = record.read_double(); ring.emplace_back(x, y); } if (k == 0) { poly.push_back(std::move(ring)); } else if (mapnik::util::is_clockwise(ring)) { multi_poly.emplace_back(std::move(poly)); poly.clear(); poly.push_back(std::move(ring)); } else { poly.push_back(std::move(ring)); } } if (multi_poly.size() > 0) // multi { multi_poly.emplace_back(std::move(poly)); geom = std::move(multi_poly); } else { geom = std::move(poly); } mapnik::geometry::correct(geom); return geom; } mapnik::geometry::geometry<double> shape_io::read_polygon_parts(shape_file::record_type & record, std::vector<std::pair<int,int>> const& parts) { mapnik::geometry::geometry<double> geom; // default empty int total_num_parts = record.read_ndr_integer(); mapnik::geometry::polygon<double> poly; mapnik::geometry::multi_polygon<double> multi_poly; int num_parts = parts.size(); for (int k = 0; k < num_parts; ++k) { int start = parts[k].first; int end = parts[k].second; unsigned pos = 4 + 32 + 8 + 4 * total_num_parts + start * 16; record.set_pos(pos); mapnik::geometry::linear_ring<double> ring; ring.reserve(end - start); for (int j = start; j < end; ++j) { double x = record.read_double(); double y = record.read_double(); ring.emplace_back(x, y); } if (k == 0) { poly.push_back(std::move(ring)); } else if (mapnik::util::is_clockwise(ring)) { multi_poly.emplace_back(std::move(poly)); poly.clear(); poly.push_back(std::move(ring)); } else { poly.push_back(std::move(ring)); } } if (multi_poly.size() > 0) // multi { multi_poly.emplace_back(std::move(poly)); geom = std::move(multi_poly); } else { geom = std::move(poly); } mapnik::geometry::correct(geom); return geom; }
{ "pile_set_name": "Github" }
package pongo2 import ( "fmt" "math" ) type Expression struct { // TODO: Add location token? expr1 IEvaluator expr2 IEvaluator opToken *Token } type relationalExpression struct { // TODO: Add location token? expr1 IEvaluator expr2 IEvaluator opToken *Token } type simpleExpression struct { negate bool negativeSign bool term1 IEvaluator term2 IEvaluator opToken *Token } type term struct { // TODO: Add location token? factor1 IEvaluator factor2 IEvaluator opToken *Token } type power struct { // TODO: Add location token? power1 IEvaluator power2 IEvaluator } func (expr *Expression) FilterApplied(name string) bool { return expr.expr1.FilterApplied(name) && (expr.expr2 == nil || (expr.expr2 != nil && expr.expr2.FilterApplied(name))) } func (expr *relationalExpression) FilterApplied(name string) bool { return expr.expr1.FilterApplied(name) && (expr.expr2 == nil || (expr.expr2 != nil && expr.expr2.FilterApplied(name))) } func (expr *simpleExpression) FilterApplied(name string) bool { return expr.term1.FilterApplied(name) && (expr.term2 == nil || (expr.term2 != nil && expr.term2.FilterApplied(name))) } func (expr *term) FilterApplied(name string) bool { return expr.factor1.FilterApplied(name) && (expr.factor2 == nil || (expr.factor2 != nil && expr.factor2.FilterApplied(name))) } func (expr *power) FilterApplied(name string) bool { return expr.power1.FilterApplied(name) && (expr.power2 == nil || (expr.power2 != nil && expr.power2.FilterApplied(name))) } func (expr *Expression) GetPositionToken() *Token { return expr.expr1.GetPositionToken() } func (expr *relationalExpression) GetPositionToken() *Token { return expr.expr1.GetPositionToken() } func (expr *simpleExpression) GetPositionToken() *Token { return expr.term1.GetPositionToken() } func (expr *term) GetPositionToken() *Token { return expr.factor1.GetPositionToken() } func (expr *power) GetPositionToken() *Token { return expr.power1.GetPositionToken() } func (expr *Expression) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error { value, err := expr.Evaluate(ctx) if err != nil { return err } writer.WriteString(value.String()) return nil } func (expr *relationalExpression) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error { value, err := expr.Evaluate(ctx) if err != nil { return err } writer.WriteString(value.String()) return nil } func (expr *simpleExpression) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error { value, err := expr.Evaluate(ctx) if err != nil { return err } writer.WriteString(value.String()) return nil } func (expr *term) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error { value, err := expr.Evaluate(ctx) if err != nil { return err } writer.WriteString(value.String()) return nil } func (expr *power) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error { value, err := expr.Evaluate(ctx) if err != nil { return err } writer.WriteString(value.String()) return nil } func (expr *Expression) Evaluate(ctx *ExecutionContext) (*Value, *Error) { v1, err := expr.expr1.Evaluate(ctx) if err != nil { return nil, err } if expr.expr2 != nil { v2, err := expr.expr2.Evaluate(ctx) if err != nil { return nil, err } switch expr.opToken.Val { case "and", "&&": return AsValue(v1.IsTrue() && v2.IsTrue()), nil case "or", "||": return AsValue(v1.IsTrue() || v2.IsTrue()), nil default: panic(fmt.Sprintf("unimplemented: %s", expr.opToken.Val)) } } else { return v1, nil } } func (expr *relationalExpression) Evaluate(ctx *ExecutionContext) (*Value, *Error) { v1, err := expr.expr1.Evaluate(ctx) if err != nil { return nil, err } if expr.expr2 != nil { v2, err := expr.expr2.Evaluate(ctx) if err != nil { return nil, err } switch expr.opToken.Val { case "<=": if v1.IsFloat() || v2.IsFloat() { return AsValue(v1.Float() <= v2.Float()), nil } return AsValue(v1.Integer() <= v2.Integer()), nil case ">=": if v1.IsFloat() || v2.IsFloat() { return AsValue(v1.Float() >= v2.Float()), nil } return AsValue(v1.Integer() >= v2.Integer()), nil case "==": return AsValue(v1.EqualValueTo(v2)), nil case ">": if v1.IsFloat() || v2.IsFloat() { return AsValue(v1.Float() > v2.Float()), nil } return AsValue(v1.Integer() > v2.Integer()), nil case "<": if v1.IsFloat() || v2.IsFloat() { return AsValue(v1.Float() < v2.Float()), nil } return AsValue(v1.Integer() < v2.Integer()), nil case "!=", "<>": return AsValue(!v1.EqualValueTo(v2)), nil case "in": return AsValue(v2.Contains(v1)), nil default: panic(fmt.Sprintf("unimplemented: %s", expr.opToken.Val)) } } else { return v1, nil } } func (expr *simpleExpression) Evaluate(ctx *ExecutionContext) (*Value, *Error) { t1, err := expr.term1.Evaluate(ctx) if err != nil { return nil, err } result := t1 if expr.negate { result = result.Negate() } if expr.negativeSign { if result.IsNumber() { switch { case result.IsFloat(): result = AsValue(-1 * result.Float()) case result.IsInteger(): result = AsValue(-1 * result.Integer()) default: panic("not possible") } } else { return nil, ctx.Error("Negative sign on a non-number expression", expr.GetPositionToken()) } } if expr.term2 != nil { t2, err := expr.term2.Evaluate(ctx) if err != nil { return nil, err } switch expr.opToken.Val { case "+": if result.IsFloat() || t2.IsFloat() { // Result will be a float return AsValue(result.Float() + t2.Float()), nil } // Result will be an integer return AsValue(result.Integer() + t2.Integer()), nil case "-": if result.IsFloat() || t2.IsFloat() { // Result will be a float return AsValue(result.Float() - t2.Float()), nil } // Result will be an integer return AsValue(result.Integer() - t2.Integer()), nil default: panic("unimplemented") } } return result, nil } func (expr *term) Evaluate(ctx *ExecutionContext) (*Value, *Error) { f1, err := expr.factor1.Evaluate(ctx) if err != nil { return nil, err } if expr.factor2 != nil { f2, err := expr.factor2.Evaluate(ctx) if err != nil { return nil, err } switch expr.opToken.Val { case "*": if f1.IsFloat() || f2.IsFloat() { // Result will be float return AsValue(f1.Float() * f2.Float()), nil } // Result will be int return AsValue(f1.Integer() * f2.Integer()), nil case "/": if f1.IsFloat() || f2.IsFloat() { // Result will be float return AsValue(f1.Float() / f2.Float()), nil } // Result will be int return AsValue(f1.Integer() / f2.Integer()), nil case "%": // Result will be int return AsValue(f1.Integer() % f2.Integer()), nil default: panic("unimplemented") } } else { return f1, nil } } func (expr *power) Evaluate(ctx *ExecutionContext) (*Value, *Error) { p1, err := expr.power1.Evaluate(ctx) if err != nil { return nil, err } if expr.power2 != nil { p2, err := expr.power2.Evaluate(ctx) if err != nil { return nil, err } return AsValue(math.Pow(p1.Float(), p2.Float())), nil } return p1, nil } func (p *Parser) parseFactor() (IEvaluator, *Error) { if p.Match(TokenSymbol, "(") != nil { expr, err := p.ParseExpression() if err != nil { return nil, err } if p.Match(TokenSymbol, ")") == nil { return nil, p.Error("Closing bracket expected after expression", nil) } return expr, nil } return p.parseVariableOrLiteralWithFilter() } func (p *Parser) parsePower() (IEvaluator, *Error) { pw := new(power) power1, err := p.parseFactor() if err != nil { return nil, err } pw.power1 = power1 if p.Match(TokenSymbol, "^") != nil { power2, err := p.parsePower() if err != nil { return nil, err } pw.power2 = power2 } if pw.power2 == nil { // Shortcut for faster evaluation return pw.power1, nil } return pw, nil } func (p *Parser) parseTerm() (IEvaluator, *Error) { returnTerm := new(term) factor1, err := p.parsePower() if err != nil { return nil, err } returnTerm.factor1 = factor1 for p.PeekOne(TokenSymbol, "*", "/", "%") != nil { if returnTerm.opToken != nil { // Create new sub-term returnTerm = &term{ factor1: returnTerm, } } op := p.Current() p.Consume() factor2, err := p.parsePower() if err != nil { return nil, err } returnTerm.opToken = op returnTerm.factor2 = factor2 } if returnTerm.opToken == nil { // Shortcut for faster evaluation return returnTerm.factor1, nil } return returnTerm, nil } func (p *Parser) parseSimpleExpression() (IEvaluator, *Error) { expr := new(simpleExpression) if sign := p.MatchOne(TokenSymbol, "+", "-"); sign != nil { if sign.Val == "-" { expr.negativeSign = true } } if p.Match(TokenSymbol, "!") != nil || p.Match(TokenKeyword, "not") != nil { expr.negate = true } term1, err := p.parseTerm() if err != nil { return nil, err } expr.term1 = term1 for p.PeekOne(TokenSymbol, "+", "-") != nil { if expr.opToken != nil { // New sub expr expr = &simpleExpression{ term1: expr, } } op := p.Current() p.Consume() term2, err := p.parseTerm() if err != nil { return nil, err } expr.term2 = term2 expr.opToken = op } if expr.negate == false && expr.negativeSign == false && expr.term2 == nil { // Shortcut for faster evaluation return expr.term1, nil } return expr, nil } func (p *Parser) parseRelationalExpression() (IEvaluator, *Error) { expr1, err := p.parseSimpleExpression() if err != nil { return nil, err } expr := &relationalExpression{ expr1: expr1, } if t := p.MatchOne(TokenSymbol, "==", "<=", ">=", "!=", "<>", ">", "<"); t != nil { expr2, err := p.parseRelationalExpression() if err != nil { return nil, err } expr.opToken = t expr.expr2 = expr2 } else if t := p.MatchOne(TokenKeyword, "in"); t != nil { expr2, err := p.parseSimpleExpression() if err != nil { return nil, err } expr.opToken = t expr.expr2 = expr2 } if expr.expr2 == nil { // Shortcut for faster evaluation return expr.expr1, nil } return expr, nil } func (p *Parser) ParseExpression() (IEvaluator, *Error) { rexpr1, err := p.parseRelationalExpression() if err != nil { return nil, err } exp := &Expression{ expr1: rexpr1, } if p.PeekOne(TokenSymbol, "&&", "||") != nil || p.PeekOne(TokenKeyword, "and", "or") != nil { op := p.Current() p.Consume() expr2, err := p.ParseExpression() if err != nil { return nil, err } exp.expr2 = expr2 exp.opToken = op } if exp.expr2 == nil { // Shortcut for faster evaluation return exp.expr1, nil } return exp, nil }
{ "pile_set_name": "Github" }
open Core.Std open Async.Std open Cohttp open Cohttp_async let handle_put uri body = let path = Uri.path uri in try_with (fun () -> let filename = Filename.concat "." path in Writer.with_file filename ~f:(fun w -> Pipe.transfer_id (Body.to_pipe body) (Writer.pipe w))) >>= function | Ok _ -> Server.respond `Created | Error _ -> Server.respond `Internal_server_error let serve_client ~body _sock req = let uri = Request.uri req in match Request.meth req with | `PUT -> handle_put uri body | _ -> Server.respond `Method_not_allowed let start_server ~host ~port () = eprintf "Listening for HTTP on port %d\n" port; Unix.Inet_addr.of_string_or_getbyname host >>= fun host -> let listen_on = Tcp.Where_to_listen.create ~socket_type:Socket.Type.tcp ~address:(`Inet (host, port)) ~listening_on:(fun _ -> port) in Server.create ~on_handler_error:`Raise listen_on (serve_client) >>= fun _ -> Deferred.never () let () = every (Time.Span.create ~sec:3 ()) (fun () -> Gc.full_major (); let stat = Gc.stat () in let used = stat.live_words in eprintf "(Used %d) (Alloc %f)\n" used (Gc.allocated_bytes ()) ); ignore (start_server ~host:"localhost" ~port:8080 ()); never_returns (Scheduler.go ())
{ "pile_set_name": "Github" }
/* * Copyright 2017-2020 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.lettuce.core.resource; import io.netty.bootstrap.Bootstrap; import io.netty.channel.Channel; /** * Strategy interface to customize netty {@link io.netty.bootstrap.Bootstrap} and {@link io.netty.channel.Channel} via callback * hooks. <br/> * <b>Extending the NettyCustomizer API</b> * <p> * Contrary to other driver options, the options available in this class should be considered as advanced feature and as such, * they should only be modified by expert users. A misconfiguration introduced by the means of this API can have unexpected * results and cause the driver to completely fail to connect. * * @author Mark Paluch * @since 4.4 */ public interface NettyCustomizer { /** * Hook invoked each time the driver creates a new Connection and configures a new instance of Bootstrap for it. This hook * is called after the driver has applied all {@link java.net.SocketOption}s. This is a good place to add extra * {@link io.netty.channel.ChannelOption}s to the {@link Bootstrap}. * * @param bootstrap must not be {@code null}. */ default void afterBootstrapInitialized(Bootstrap bootstrap) { } /** * Hook invoked each time the driver initializes the channel. This hook is called after the driver has registered all its * internal channel handlers, and applied the configured options. * * @param channel must not be {@code null}. */ default void afterChannelInitialized(Channel channel) { } }
{ "pile_set_name": "Github" }
--- blog: http://articles.fortawesome.com/ font: myfonts: http://www.myfonts.com/fonts/exljbris/museo-slab/ name: Museo Slab url: http://www.exljbris.com/museoslab.html github: FortAwesome/Font-Awesome images: - font-awesome-ar21.svg - font-awesome-icon.svg layout: default logohandle: font-awesome sort: font awesome tags: - font title: Font Awesome twitter: fontawesome website: http://fontawesome.io/ ---
{ "pile_set_name": "Github" }
/* */ "use strict"; exports.__esModule = true; exports.default = typeof global === "undefined" ? self : global;
{ "pile_set_name": "Github" }
<?php namespace Drupal\field\Tests\Number; use Drupal\Component\Utility\Unicode; use Drupal\field\Entity\FieldConfig; use Drupal\node\Entity\Node; use Drupal\simpletest\WebTestBase; use Drupal\field\Entity\FieldStorageConfig; /** * Tests the creation of numeric fields. * * @group field */ class NumberFieldTest extends WebTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['node', 'entity_test', 'field_ui']; protected function setUp() { parent::setUp(); $this->drupalLogin($this->drupalCreateUser([ 'view test entity', 'administer entity_test content', 'administer content types', 'administer node fields', 'administer node display', 'bypass node access', 'administer entity_test fields', ])); } /** * Test decimal field. */ public function testNumberDecimalField() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'decimal', 'settings' => [ 'precision' => 8, 'scale' => 4, ] ])->save(); FieldConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ])->save(); entity_get_form_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number', 'settings' => [ 'placeholder' => '0.00' ], ]) ->save(); entity_get_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number_decimal', ]) ->save(); // Display creation form. $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertRaw('placeholder="0.00"'); // Submit a signed decimal value within the allowed precision and scale. $value = '-1234.5678'; $edit = [ "{$field_name}[0][value]" => $value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->url, $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); $this->assertRaw($value, 'Value is displayed.'); // Try to create entries with more than one decimal separator; assert fail. $wrong_entries = [ '3.14.159', '0..45469', '..4589', '6.459.52', '6.3..25', ]; foreach ($wrong_entries as $wrong_entry) { $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save decimal value with more than one decimal point.'); } // Try to create entries with minus sign not in the first position. $wrong_entries = [ '3-3', '4-', '1.3-', '1.2-4', '-10-10', ]; foreach ($wrong_entries as $wrong_entry) { $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save decimal value with minus sign in the wrong position.'); } } /** * Test integer field. */ public function testNumberIntegerField() { $minimum = rand(-4000, -2000); $maximum = rand(2000, 4000); // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); $storage = FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'integer', ]); $storage->save(); FieldConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', 'settings' => [ 'min' => $minimum, 'max' => $maximum, 'prefix' => 'ThePrefix', ] ])->save(); entity_get_form_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number', 'settings' => [ 'placeholder' => '4' ], ]) ->save(); entity_get_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number_integer', 'settings' => [ 'prefix_suffix' => FALSE, ], ]) ->save(); // Check the storage schema. $expected = [ 'columns' => [ 'value' => [ 'type' => 'int', 'unsigned' => '', 'size' => 'normal' ], ], 'unique keys' => [], 'indexes' => [], 'foreign keys' => [] ]; $this->assertEqual($storage->getSchema(), $expected); // Display creation form. $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertRaw('placeholder="4"'); // Submit a valid integer $value = rand($minimum, $maximum); $edit = [ "{$field_name}[0][value]" => $value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->url, $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); // Try to set a value below the minimum value $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $minimum - 1, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be higher than or equal to %minimum.', ['%name' => $field_name, '%minimum' => $minimum]), 'Correctly failed to save integer value less than minimum allowed value.'); // Try to set a decimal value $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => 1.5, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name is not a valid number.', ['%name' => $field_name]), 'Correctly failed to save decimal value to integer field.'); // Try to set a value above the maximum value $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $maximum + 1, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be lower than or equal to %maximum.', ['%name' => $field_name, '%maximum' => $maximum]), 'Correctly failed to save integer value greater than maximum allowed value.'); // Try to set a wrong integer value. $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => '20-40', ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save wrong integer value.'); // Test with valid entries. $valid_entries = [ '-1234', '0', '1234', ]; foreach ($valid_entries as $valid_entry) { $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $valid_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->url, $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); $this->assertRaw($valid_entry, 'Value is displayed.'); $this->assertNoFieldByXpath('//div[@content="' . $valid_entry . '"]', NULL, 'The "content" attribute is not present since the Prefix is not being displayed'); } // Test for the content attribute when a Prefix is displayed. Presumably this also tests for the attribute when a Suffix is displayed. entity_get_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number_integer', 'settings' => [ 'prefix_suffix' => TRUE, ], ]) ->save(); $integer_value = '123'; $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $integer_value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->url, $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); $this->drupalGet('entity_test/' . $id); $this->assertFieldByXPath('//div[@content="' . $integer_value . '"]', 'ThePrefix' . $integer_value, 'The "content" attribute has been set to the value of the field, and the prefix is being displayed.'); } /** * Test float field. */ public function testNumberFloatField() { // Create a field with settings to validate. $field_name = Unicode::strtolower($this->randomMachineName()); FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'float', ])->save(); FieldConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ])->save(); entity_get_form_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number', 'settings' => [ 'placeholder' => '0.00' ], ]) ->save(); entity_get_display('entity_test', 'entity_test', 'default') ->setComponent($field_name, [ 'type' => 'number_decimal', ]) ->save(); // Display creation form. $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertRaw('placeholder="0.00"'); // Submit a signed decimal value within the allowed precision and scale. $value = '-1234.5678'; $edit = [ "{$field_name}[0][value]" => $value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->url, $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); // Ensure that the 'number_decimal' formatter displays the number with the // expected rounding. $this->drupalGet('entity_test/' . $id); $this->assertRaw(round($value, 2)); // Try to create entries with more than one decimal separator; assert fail. $wrong_entries = [ '3.14.159', '0..45469', '..4589', '6.459.52', '6.3..25', ]; foreach ($wrong_entries as $wrong_entry) { $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save float value with more than one decimal point.'); } // Try to create entries with minus sign not in the first position. $wrong_entries = [ '3-3', '4-', '1.3-', '1.2-4', '-10-10', ]; foreach ($wrong_entries as $wrong_entry) { $this->drupalGet('entity_test/add'); $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save float value with minus sign in the wrong position.'); } } /** * Test default formatter behavior */ public function testNumberFormatter() { $type = Unicode::strtolower($this->randomMachineName()); $float_field = Unicode::strtolower($this->randomMachineName()); $integer_field = Unicode::strtolower($this->randomMachineName()); $thousand_separators = ['', '.', ',', ' ', chr(8201), "'"]; $decimal_separators = ['.', ',']; $prefix = $this->randomMachineName(); $suffix = $this->randomMachineName(); $random_float = rand(0, pow(10, 6)); $random_integer = rand(0, pow(10, 6)); // Create a content type containing float and integer fields. $this->drupalCreateContentType(['type' => $type]); FieldStorageConfig::create([ 'field_name' => $float_field, 'entity_type' => 'node', 'type' => 'float', ])->save(); FieldStorageConfig::create([ 'field_name' => $integer_field, 'entity_type' => 'node', 'type' => 'integer', ])->save(); FieldConfig::create([ 'field_name' => $float_field, 'entity_type' => 'node', 'bundle' => $type, 'settings' => [ 'prefix' => $prefix, 'suffix' => $suffix ], ])->save(); FieldConfig::create([ 'field_name' => $integer_field, 'entity_type' => 'node', 'bundle' => $type, 'settings' => [ 'prefix' => $prefix, 'suffix' => $suffix ], ])->save(); entity_get_form_display('node', $type, 'default') ->setComponent($float_field, [ 'type' => 'number', 'settings' => [ 'placeholder' => '0.00' ], ]) ->setComponent($integer_field, [ 'type' => 'number', 'settings' => [ 'placeholder' => '0.00' ], ]) ->save(); entity_get_display('node', $type, 'default') ->setComponent($float_field, [ 'type' => 'number_decimal', ]) ->setComponent($integer_field, [ 'type' => 'number_unformatted', ]) ->save(); // Create a node to test formatters. $node = Node::create([ 'type' => $type, 'title' => $this->randomMachineName(), $float_field => ['value' => $random_float], $integer_field => ['value' => $random_integer], ]); $node->save(); // Go to manage display page. $this->drupalGet("admin/structure/types/manage/$type/display"); // Configure number_decimal formatter for the 'float' field type. $thousand_separator = $thousand_separators[array_rand($thousand_separators)]; $decimal_separator = $decimal_separators[array_rand($decimal_separators)]; $scale = rand(0, 10); $this->drupalPostAjaxForm(NULL, [], "${float_field}_settings_edit"); $edit = [ "fields[${float_field}][settings_edit_form][settings][prefix_suffix]" => TRUE, "fields[${float_field}][settings_edit_form][settings][scale]" => $scale, "fields[${float_field}][settings_edit_form][settings][decimal_separator]" => $decimal_separator, "fields[${float_field}][settings_edit_form][settings][thousand_separator]" => $thousand_separator, ]; $this->drupalPostAjaxForm(NULL, $edit, "${float_field}_plugin_settings_update"); $this->drupalPostForm(NULL, [], t('Save')); // Check number_decimal and number_unformatted formatters behavior. $this->drupalGet('node/' . $node->id()); $float_formatted = number_format($random_float, $scale, $decimal_separator, $thousand_separator); $this->assertRaw("$prefix$float_formatted$suffix", 'Prefix and suffix added'); $this->assertRaw((string) $random_integer); // Configure the number_decimal formatter. entity_get_display('node', $type, 'default') ->setComponent($integer_field, [ 'type' => 'number_integer', ]) ->save(); $this->drupalGet("admin/structure/types/manage/$type/display"); $thousand_separator = $thousand_separators[array_rand($thousand_separators)]; $this->drupalPostAjaxForm(NULL, [], "${integer_field}_settings_edit"); $edit = [ "fields[${integer_field}][settings_edit_form][settings][prefix_suffix]" => FALSE, "fields[${integer_field}][settings_edit_form][settings][thousand_separator]" => $thousand_separator, ]; $this->drupalPostAjaxForm(NULL, $edit, "${integer_field}_plugin_settings_update"); $this->drupalPostForm(NULL, [], t('Save')); // Check number_integer formatter behavior. $this->drupalGet('node/' . $node->id()); $integer_formatted = number_format($random_integer, 0, '', $thousand_separator); $this->assertRaw($integer_formatted, 'Random integer formatted'); } /** * Tests setting the minimum value of a float field through the interface. */ public function testCreateNumberFloatField() { // Create a float field. $field_name = Unicode::strtolower($this->randomMachineName()); FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'float', ])->save(); $field = FieldConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ]); $field->save(); // Set the minimum value to a float value. $this->assertSetMinimumValue($field, 0.0001); // Set the minimum value to an integer value. $this->assertSetMinimumValue($field, 1); } /** * Tests setting the minimum value of a decimal field through the interface. */ public function testCreateNumberDecimalField() { // Create a decimal field. $field_name = Unicode::strtolower($this->randomMachineName()); FieldStorageConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'decimal', ])->save(); $field = FieldConfig::create([ 'field_name' => $field_name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ]); $field->save(); // Set the minimum value to a decimal value. $this->assertSetMinimumValue($field, 0.1); // Set the minimum value to an integer value. $this->assertSetMinimumValue($field, 1); } /** * Helper function to set the minimum value of a field. */ public function assertSetMinimumValue($field, $minimum_value) { $field_configuration_url = 'entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field->getName(); // Set the minimum value. $edit = [ 'settings[min]' => $minimum_value, ]; $this->drupalPostForm($field_configuration_url, $edit, t('Save settings')); // Check if an error message is shown. $this->assertNoRaw(t('%name is not a valid number.', ['%name' => t('Minimum')]), 'Saved ' . gettype($minimum_value) . ' value as minimal value on a ' . $field->getType() . ' field'); // Check if a success message is shown. $this->assertRaw(t('Saved %label configuration.', ['%label' => $field->getLabel()])); // Check if the minimum value was actually set. $this->drupalGet($field_configuration_url); $this->assertFieldById('edit-settings-min', $minimum_value, 'Minimal ' . gettype($minimum_value) . ' value was set on a ' . $field->getType() . ' field.'); } }
{ "pile_set_name": "Github" }
#!/usr/bin/env ruby require_relative '../example' example %q{ require 'monitor' class Account attr_reader :balance def initialize @balance=0 @monitor = Monitor.new end def transaction(amount) @monitor.synchronize do # Only one thread at a time here @balance += amount end end end account = Account.new t2=Thread.new do 100000.times { account.transaction(-10)} end t1=Thread.new do 100000.times { account.transaction(10) } end t1.join t2.join puts account.balance }
{ "pile_set_name": "Github" }
function alpha = circ_vmrnd(theta, kappa, n) % alpha = circ_vmrnd(theta, kappa, n) % Simulates n random angles from a von Mises distribution, with preferred % direction thetahat and concentration parameter kappa. % % Input: % [theta preferred direction, default is 0] % [kappa width, default is 1] % [n number of samples, default is 10] % % If n is a vector with two entries (e.g. [2 10]), the function creates % a matrix output with the respective dimensionality. % % Output: % alpha samples from von Mises distribution % % % References: % Statistical analysis of circular data, Fisher, sec. 3.3.6, p. 49 % % Circular Statistics Toolbox for Matlab % By Philipp Berens and Marc J. Velasco, 2009 % [email protected] % default parameter if nargin < 3 n = 10; end if nargin < 2 kappa = 1; end if nargin < 1 theta = 0; end if numel(n) > 2 error('n must be a scalar or two-entry vector!') elseif numel(n) == 2 m = n; n = n(1) * n(2); end % if kappa is small, treat as uniform distribution if kappa < 1e-6 alpha = 2*pi*rand(n,1); return end % other cases a = 1 + sqrt((1+4*kappa.^2)); b = (a - sqrt(2*a))/(2*kappa); r = (1 + b^2)/(2*b); alpha = zeros(n,1); for j = 1:n while true u = rand(3,1); z = cos(pi*u(1)); f = (1+r*z)/(r+z); c = kappa*(r-f); if u(2) < c * (2-c) || ~(log(c)-log(u(2)) + 1 -c < 0) break end end alpha(j) = theta + sign(u(3) - 0.5) * acos(f); alpha(j) = angle(exp(1i*alpha(j))); end if exist('m','var') alpha = reshape(alpha,m(1),m(2)); end
{ "pile_set_name": "Github" }
abgr 0a932e831efd4ec22f68b25278bac402 argb 4f575be3cd02799389f581df99c4de38 bgr24 fa43e3b2abfde8d9e60e157a9acc553d bgra 4e2e689897ee7a8e42b16234597bab35 gbrap 0d1eb2c39e291c53c57302cdc653c2fc gbrp e572d53183f3f2ed3951aa9940d440a1 gbrp10le a8fd1ebbc36a477e2b134241fed91687 gbrp12le c5a4b89571f7095eb737ad9fd6b1ee08 gbrp14le bdfdfd6f36c60497d1cdae791f3cc117 gbrp9le a8c4e29f4cb627db81ba053e0853e702 rgb24 a356171207723a580e7d277078072005 rgb48le 5c7dd8575836d18c91e09f1915cf9aa9 rgba 7bc854c2698b78af3e9159a19c2d9d21 rgba64le 3a087ecab583d1930220592731f282b4 yuv410p 51b39a0e33f108e652457a26667319ea yuv411p 9204c5af92aef4922a05f58c1f6c095e yuv420p 7c43bb0cae8dee633375c89295598508 yuv420p10le 1352712dd31cce78bd5441294004cf85 yuv420p12le c66f82da9fda458ba3abda057c58e591 yuv420p14le e45cb5e2a75bf6143da0b55004767f78 yuv420p16le eff54782c51770edfd6b84c958ac7120 yuv420p9le 4a6776b3379f12ad45caee8072a13695 yuv422p 67df35da0c35e54882492b2365438254 yuv422p10le 0158371a800294015def7f0ef66c78ea yuv422p12le bc49d3863ffb89658a17bf8c4fe773b0 yuv422p14le b55cb791d286b0b3391fe7481785e5b3 yuv422p16le fc3b2ba889ffaf1633000fc774307c33 yuv422p9le 6e2a42ae36ed5e8b5112987639728af5 yuv440p 5e41adcfc27be4369afd217b61b2ffe3 yuv440p10le 8b49714bba268fb4a79b5a84223ad17a yuv440p12le 15ab4f453238bd9c13b18af81e22f060 yuv444p a2b58590aef88db2c1f14a1a3a3b0359 yuv444p10le c076c20fc808f95b34adb88aca442f48 yuv444p12le af8d4dd88169d5cffc2f3fce6333a94c yuv444p14le 93367133e25d088d4535199ed1f1ed58 yuv444p16le 800940feec14365ccd9b4863e38f6991 yuv444p9le c120044350852c4cd16a302dd1ceda79 yuva420p 518a380bf1af60ef2ecf4754eec088e9 yuva420p16le 72ad4fa535b007d122666ce103ef9c8b yuva422p 7110ac2e37377b05b6fc5ad967dfabb5 yuva422p16le e2867210660ada5784a60b4339ac52c0 yuva444p 642f3958f141dece9e99407945e2ef43 yuva444p16le ab04ba8acbe38085b0df650d82065eb0 yuvj420p 65bc88887c7f06a6221155ca7f9cfca4 yuvj422p ff5baffefc8ffe4547653092fd7da200 yuvj440p ef3f27270e60ac06582e3ac7c2f3e6fa yuvj444p 29378d3fd132c760522c51c3378067b8
{ "pile_set_name": "Github" }
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py # RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -instruction-tables < %s | FileCheck %s kaddd %k0, %k1, %k2 kaddq %k0, %k1, %k2 kandd %k0, %k1, %k2 kandq %k0, %k1, %k2 kandnd %k0, %k1, %k2 kandnq %k0, %k1, %k2 kord %k0, %k1, %k2 korq %k0, %k1, %k2 kxnord %k0, %k1, %k2 kxnorq %k0, %k1, %k2 kxord %k0, %k1, %k2 kxorq %k0, %k1, %k2 kshiftld $2, %k1, %k2 kshiftlq $2, %k1, %k2 kshiftrd $2, %k1, %k2 kshiftrq $2, %k1, %k2 kunpckdq %k0, %k1, %k2 kunpckwd %k0, %k1, %k2 vpabsb %zmm16, %zmm19 vpabsb (%rax), %zmm19 vpabsb %zmm16, %zmm19 {k1} vpabsb (%rax), %zmm19 {k1} vpabsb %zmm16, %zmm19 {z}{k1} vpabsb (%rax), %zmm19 {z}{k1} vpabsw %zmm16, %zmm19 vpabsw (%rax), %zmm19 vpabsw %zmm16, %zmm19 {k1} vpabsw (%rax), %zmm19 {k1} vpabsw %zmm16, %zmm19 {z}{k1} vpabsw (%rax), %zmm19 {z}{k1} vpaddb %zmm16, %zmm17, %zmm19 vpaddb (%rax), %zmm17, %zmm19 vpaddb %zmm16, %zmm17, %zmm19 {k1} vpaddb (%rax), %zmm17, %zmm19 {k1} vpaddb %zmm16, %zmm17, %zmm19 {z}{k1} vpaddb (%rax), %zmm17, %zmm19 {z}{k1} vpaddw %zmm16, %zmm17, %zmm19 vpaddw (%rax), %zmm17, %zmm19 vpaddw %zmm16, %zmm17, %zmm19 {k1} vpaddw (%rax), %zmm17, %zmm19 {k1} vpaddw %zmm16, %zmm17, %zmm19 {z}{k1} vpaddw (%rax), %zmm17, %zmm19 {z}{k1} vpcmpb $0, %zmm0, %zmm1, %k2 vpcmpb $0, (%rax), %zmm1, %k2 vpcmpb $0, %zmm0, %zmm1, %k2 {k3} vpcmpb $0, (%rax), %zmm1, %k2 {k3} vpcmpeqb %zmm0, %zmm1, %k2 vpcmpeqb (%rax), %zmm1, %k2 vpcmpeqb %zmm0, %zmm1, %k2 {k3} vpcmpeqb (%rax), %zmm1, %k2 {k3} vpcmpeqw %zmm0, %zmm1, %k2 vpcmpeqw (%rax), %zmm1, %k2 vpcmpeqw %zmm0, %zmm1, %k2 {k3} vpcmpeqw (%rax), %zmm1, %k2 {k3} vpcmpgtb %zmm0, %zmm1, %k2 vpcmpgtb (%rax), %zmm1, %k2 vpcmpgtb %zmm0, %zmm1, %k2 {k3} vpcmpgtb (%rax), %zmm1, %k2 {k3} vpcmpgtw %zmm0, %zmm1, %k2 vpcmpgtw (%rax), %zmm1, %k2 vpcmpgtw %zmm0, %zmm1, %k2 {k3} vpcmpgtw (%rax), %zmm1, %k2 {k3} vpcmpub $0, %zmm0, %zmm1, %k2 vpcmpub $0, (%rax), %zmm1, %k2 vpcmpub $0, %zmm0, %zmm1, %k2 {k3} vpcmpub $0, (%rax), %zmm1, %k2 {k3} vpcmpuw $0, %zmm0, %zmm1, %k2 vpcmpuw $0, (%rax), %zmm1, %k2 vpcmpuw $0, %zmm0, %zmm1, %k2 {k3} vpcmpuw $0, (%rax), %zmm1, %k2 {k3} vpcmpw $0, %zmm0, %zmm1, %k2 vpcmpw $0, (%rax), %zmm1, %k2 vpcmpw $0, %zmm0, %zmm1, %k2 {k3} vpcmpw $0, (%rax), %zmm1, %k2 {k3} vpermw %zmm16, %zmm17, %zmm19 vpermw (%rax), %zmm17, %zmm19 vpermw %zmm16, %zmm17, %zmm19 {k1} vpermw (%rax), %zmm17, %zmm19 {k1} vpermw %zmm16, %zmm17, %zmm19 {z}{k1} vpermw (%rax), %zmm17, %zmm19 {z}{k1} vpshufb %zmm16, %zmm17, %zmm19 vpshufb (%rax), %zmm17, %zmm19 vpshufb %zmm16, %zmm17, %zmm19 {k1} vpshufb (%rax), %zmm17, %zmm19 {k1} vpshufb %zmm16, %zmm17, %zmm19 {z}{k1} vpshufb (%rax), %zmm17, %zmm19 {z}{k1} vpshufhw $0, %zmm16, %zmm19 vpshufhw $0, (%rax), %zmm19 vpshufhw $0, %zmm16, %zmm19 {k1} vpshufhw $0, (%rax), %zmm19 {k1} vpshufhw $0, %zmm16, %zmm19 {z}{k1} vpshufhw $0, (%rax), %zmm19 {z}{k1} vpshuflw $0, %zmm16, %zmm19 vpshuflw $0, (%rax), %zmm19 vpshuflw $0, %zmm16, %zmm19 {k1} vpshuflw $0, (%rax), %zmm19 {k1} vpshuflw $0, %zmm16, %zmm19 {z}{k1} vpshuflw $0, (%rax), %zmm19 {z}{k1} vpsubb %zmm16, %zmm17, %zmm19 vpsubb (%rax), %zmm17, %zmm19 vpsubb %zmm16, %zmm17, %zmm19 {k1} vpsubb (%rax), %zmm17, %zmm19 {k1} vpsubb %zmm16, %zmm17, %zmm19 {z}{k1} vpsubb (%rax), %zmm17, %zmm19 {z}{k1} vpsubw %zmm16, %zmm17, %zmm19 vpsubw (%rax), %zmm17, %zmm19 vpsubw %zmm16, %zmm17, %zmm19 {k1} vpsubw (%rax), %zmm17, %zmm19 {k1} vpsubw %zmm16, %zmm17, %zmm19 {z}{k1} vpsubw (%rax), %zmm17, %zmm19 {z}{k1} vptestmb %zmm0, %zmm1, %k2 vptestmb (%rax), %zmm1, %k2 vptestmb %zmm0, %zmm1, %k2 {k3} vptestmb (%rax), %zmm1, %k2 {k3} vptestmw %zmm0, %zmm1, %k2 vptestmw (%rax), %zmm1, %k2 vptestmw %zmm0, %zmm1, %k2 {k3} vptestmw (%rax), %zmm1, %k2 {k3} vptestnmb %zmm0, %zmm1, %k2 vptestnmb (%rax), %zmm1, %k2 vptestnmb %zmm0, %zmm1, %k2 {k3} vptestnmb (%rax), %zmm1, %k2 {k3} vptestnmw %zmm0, %zmm1, %k2 vptestnmw (%rax), %zmm1, %k2 vptestnmw %zmm0, %zmm1, %k2 {k3} vptestnmw (%rax), %zmm1, %k2 {k3} vpunpckhbw %zmm16, %zmm17, %zmm19 vpunpckhbw (%rax), %zmm17, %zmm19 vpunpckhbw %zmm16, %zmm17, %zmm19 {k1} vpunpckhbw (%rax), %zmm17, %zmm19 {k1} vpunpckhbw %zmm16, %zmm17, %zmm19 {z}{k1} vpunpckhbw (%rax), %zmm17, %zmm19 {z}{k1} vpunpckhwd %zmm16, %zmm17, %zmm19 vpunpckhwd (%rax), %zmm17, %zmm19 vpunpckhwd %zmm16, %zmm17, %zmm19 {k1} vpunpckhwd (%rax), %zmm17, %zmm19 {k1} vpunpckhwd %zmm16, %zmm17, %zmm19 {z}{k1} vpunpckhwd (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklbw %zmm16, %zmm17, %zmm19 vpunpcklbw (%rax), %zmm17, %zmm19 vpunpcklbw %zmm16, %zmm17, %zmm19 {k1} vpunpcklbw (%rax), %zmm17, %zmm19 {k1} vpunpcklbw %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklbw (%rax), %zmm17, %zmm19 {z}{k1} vpunpcklwd %zmm16, %zmm17, %zmm19 vpunpcklwd (%rax), %zmm17, %zmm19 vpunpcklwd %zmm16, %zmm17, %zmm19 {k1} vpunpcklwd (%rax), %zmm17, %zmm19 {k1} vpunpcklwd %zmm16, %zmm17, %zmm19 {z}{k1} vpunpcklwd (%rax), %zmm17, %zmm19 {z}{k1} # CHECK: Instruction Info: # CHECK-NEXT: [1]: #uOps # CHECK-NEXT: [2]: Latency # CHECK-NEXT: [3]: RThroughput # CHECK-NEXT: [4]: MayLoad # CHECK-NEXT: [5]: MayStore # CHECK-NEXT: [6]: HasSideEffects (U) # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 1 0.33 kaddd %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kaddq %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kandd %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kandq %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kandnd %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kandnq %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kord %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 korq %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kxnord %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kxnorq %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kxord %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.33 kxorq %k0, %k1, %k2 # CHECK-NEXT: 1 1 1.00 kshiftld $2, %k1, %k2 # CHECK-NEXT: 1 1 1.00 kshiftlq $2, %k1, %k2 # CHECK-NEXT: 1 1 1.00 kshiftrd $2, %k1, %k2 # CHECK-NEXT: 1 1 1.00 kshiftrq $2, %k1, %k2 # CHECK-NEXT: 1 1 1.00 kunpckdq %k0, %k1, %k2 # CHECK-NEXT: 1 1 1.00 kunpckwd %k0, %k1, %k2 # CHECK-NEXT: 1 1 0.50 vpabsb %zmm16, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpabsb (%rax), %zmm19 # CHECK-NEXT: 1 1 0.50 vpabsb %zmm16, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpabsb (%rax), %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpabsb %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpabsb (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpabsw %zmm16, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpabsw (%rax), %zmm19 # CHECK-NEXT: 1 1 0.50 vpabsw %zmm16, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpabsw (%rax), %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpabsw %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpabsw (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpaddb %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpaddb (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 0.50 vpaddb %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpaddb (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpaddb %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpaddb (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpaddw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpaddw (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 0.50 vpaddw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpaddw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpaddw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpaddw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpcmpeqb %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpeqb (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpeqb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpeqb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpeqb %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpeqb (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpeqb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpeqb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpeqw %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpeqw (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpeqw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpeqw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpgtb %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpgtb (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpgtb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpgtb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpgtw %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpgtw (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpgtw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpgtw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpequb %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpequb (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpequb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpequb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpequw %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpequw (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpequw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpequw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.50 vpcmpeqw %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vpcmpeqw (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.50 vpcmpeqw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vpcmpeqw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 1.00 vpermw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpermw (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 1.00 vpermw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpermw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpermw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpermw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpshufb %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpshufb (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 0.50 vpshufb %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpshufb (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpshufb %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpshufb (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 1.00 vpshufhw $0, %zmm16, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshufhw $0, (%rax), %zmm19 # CHECK-NEXT: 1 1 1.00 vpshufhw $0, %zmm16, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpshufhw $0, (%rax), %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpshufhw $0, %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpshufhw $0, (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 1.00 vpshuflw $0, %zmm16, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpshuflw $0, (%rax), %zmm19 # CHECK-NEXT: 1 1 1.00 vpshuflw $0, %zmm16, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpshuflw $0, (%rax), %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpshuflw $0, %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpshuflw $0, (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpsubb %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpsubb (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 0.50 vpsubb %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpsubb (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpsubb %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpsubb (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.50 vpsubw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 0.50 * vpsubw (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 0.50 vpsubw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 0.50 * vpsubw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 0.50 vpsubw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 0.50 * vpsubw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 0.33 vptestmb %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vptestmb (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.33 vptestmb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vptestmb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.33 vptestmw %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vptestmw (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.33 vptestmw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vptestmw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.33 vptestnmb %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vptestnmb (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.33 vptestnmb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vptestnmb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 0.33 vptestnmw %zmm0, %zmm1, %k2 # CHECK-NEXT: 2 8 0.50 * vptestnmw (%rax), %zmm1, %k2 # CHECK-NEXT: 1 1 0.33 vptestnmw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: 2 8 0.50 * vptestnmw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: 1 1 1.00 vpunpckhbw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpunpckhbw (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 1.00 vpunpckhbw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpunpckhbw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpunpckhbw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpckhbw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 1.00 vpunpckhwd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpunpckhwd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 1.00 vpunpckhwd %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpunpckhwd (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpunpckhwd %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpckhwd (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 1.00 vpunpcklbw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpunpcklbw (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 1.00 vpunpcklbw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpunpcklbw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpunpcklbw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklbw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 1 1 1.00 vpunpcklwd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: 2 8 1.00 * vpunpcklwd (%rax), %zmm17, %zmm19 # CHECK-NEXT: 1 1 1.00 vpunpcklwd %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: 2 8 1.00 * vpunpcklwd (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: 1 1 1.00 vpunpcklwd %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: 2 8 1.00 * vpunpcklwd (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK: Resources: # CHECK-NEXT: [0] - SBDivider # CHECK-NEXT: [1] - SBFPDivider # CHECK-NEXT: [2] - SBPort0 # CHECK-NEXT: [3] - SBPort1 # CHECK-NEXT: [4] - SBPort4 # CHECK-NEXT: [5] - SBPort5 # CHECK-NEXT: [6.0] - SBPort23 # CHECK-NEXT: [6.1] - SBPort23 # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] # CHECK-NEXT: - - 9.33 46.33 - 94.33 33.00 33.00 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions: # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kaddd %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kaddq %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kandd %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kandq %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kandnd %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kandnq %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kord %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - korq %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kxnord %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kxnorq %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kxord %k0, %k1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - kxorq %k0, %k1, %k2 # CHECK-NEXT: - - - - - 1.00 - - kshiftld $2, %k1, %k2 # CHECK-NEXT: - - - - - 1.00 - - kshiftlq $2, %k1, %k2 # CHECK-NEXT: - - - - - 1.00 - - kshiftrd $2, %k1, %k2 # CHECK-NEXT: - - - - - 1.00 - - kshiftrq $2, %k1, %k2 # CHECK-NEXT: - - - - - 1.00 - - kunpckdq %k0, %k1, %k2 # CHECK-NEXT: - - - - - 1.00 - - kunpckwd %k0, %k1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpabsb %zmm16, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpabsb (%rax), %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpabsb %zmm16, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpabsb (%rax), %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpabsb %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpabsb (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpabsw %zmm16, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpabsw (%rax), %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpabsw %zmm16, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpabsw (%rax), %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpabsw %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpabsw (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpaddb %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpaddb (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpaddb %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpaddb (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpaddb %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpaddb (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpaddw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpaddw (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpaddw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpaddw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpaddw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpaddw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqb %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqb (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqb %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqb (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqw %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqw (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpgtb %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpgtb (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpgtb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpgtb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpgtw %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpgtw (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpgtw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpgtw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpequb %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpequb (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpequb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpequb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpequw %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpequw (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpequw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpequw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqw %zmm0, %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqw (%rax), %zmm1, %k2 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpcmpeqw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpcmpeqw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - - - 1.00 - - vpermw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpermw (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpermw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpermw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpermw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpermw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpshufb %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpshufb (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpshufb %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpshufb (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpshufb %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpshufb (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 - - vpshufhw $0, %zmm16, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshufhw $0, (%rax), %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpshufhw $0, %zmm16, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshufhw $0, (%rax), %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpshufhw $0, %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshufhw $0, (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 - - vpshuflw $0, %zmm16, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshuflw $0, (%rax), %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpshuflw $0, %zmm16, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshuflw $0, (%rax), %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpshuflw $0, %zmm16, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpshuflw $0, (%rax), %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpsubb %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpsubb (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpsubb %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpsubb (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpsubb %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpsubb (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpsubw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpsubw (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - 0.50 - 0.50 - - vpsubw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpsubw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - 0.50 - 0.50 - - vpsubw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - 0.50 - 0.50 0.50 0.50 vpsubw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestmb %zmm0, %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestmb (%rax), %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestmb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestmb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestmw %zmm0, %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestmw (%rax), %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestmw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestmw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestnmb %zmm0, %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestnmb (%rax), %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestnmb %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestnmb (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestnmw %zmm0, %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestnmw (%rax), %zmm1, %k2 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - vptestnmw %zmm0, %zmm1, %k2 {%k3} # CHECK-NEXT: - - 0.33 0.33 - 0.33 0.50 0.50 vptestnmw (%rax), %zmm1, %k2 {%k3} # CHECK-NEXT: - - - - - 1.00 - - vpunpckhbw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckhbw (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpunpckhbw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckhbw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpunpckhbw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckhbw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 - - vpunpckhwd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckhwd (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpunpckhwd %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckhwd (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpunpckhwd %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpckhwd (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 - - vpunpcklbw %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklbw (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpunpcklbw %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklbw (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpunpcklbw %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklbw (%rax), %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 - - vpunpcklwd %zmm16, %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklwd (%rax), %zmm17, %zmm19 # CHECK-NEXT: - - - - - 1.00 - - vpunpcklwd %zmm16, %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklwd (%rax), %zmm17, %zmm19 {%k1} # CHECK-NEXT: - - - - - 1.00 - - vpunpcklwd %zmm16, %zmm17, %zmm19 {%k1} {z} # CHECK-NEXT: - - - - - 1.00 0.50 0.50 vpunpcklwd (%rax), %zmm17, %zmm19 {%k1} {z}
{ "pile_set_name": "Github" }
#!/usr/bin/env python """ inkex.py A helper module for creating Inkscape extensions Copyright (C) 2005,2007 Aaron Spike, [email protected] This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ import sys, copy, optparse, random, re import gettext from math import * _ = gettext.gettext #a dictionary of all of the xmlns prefixes in a standard inkscape doc NSS = { u'sodipodi' :u'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd', u'cc' :u'http://creativecommons.org/ns#', u'ccOLD' :u'http://web.resource.org/cc/', u'svg' :u'http://www.w3.org/2000/svg', u'dc' :u'http://purl.org/dc/elements/1.1/', u'rdf' :u'http://www.w3.org/1999/02/22-rdf-syntax-ns#', u'inkscape' :u'http://www.inkscape.org/namespaces/inkscape', u'xlink' :u'http://www.w3.org/1999/xlink', u'xml' :u'http://www.w3.org/XML/1998/namespace' } #a dictionary of unit to user unit conversion factors uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0} def unittouu(string): '''Returns userunits given a string representation of units in another system''' unit = re.compile('(%s)$' % '|'.join(uuconv.keys())) param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)') p = param.match(string) u = unit.search(string) if p: retval = float(p.string[p.start():p.end()]) else: retval = 0.0 if u: try: return retval * uuconv[u.string[u.start():u.end()]] except KeyError: pass return retval def uutounit(val, unit): return val/uuconv[unit] try: from lxml import etree except: sys.exit(_('The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml')) def debug(what): sys.stderr.write(str(what) + "\n") return what def errormsg(msg): """Intended for end-user-visible error messages. (Currently just writes to stderr with an appended newline, but could do something better in future: e.g. could add markup to distinguish error messages from status messages or debugging output.) Note that this should always be combined with translation: import gettext _ = gettext.gettext ... inkex.errormsg(_("This extension requires two selected paths.")) """ sys.stderr.write((str(msg) + "\n").encode("UTF-8")) def check_inkbool(option, opt, value): if str(value).capitalize() == 'True': return True elif str(value).capitalize() == 'False': return False else: raise optparse.OptionValueError("option %s: invalid inkbool value: %s" % (opt, value)) def addNS(tag, ns=None): val = tag if ns!=None and len(ns)>0 and NSS.has_key(ns) and len(tag)>0 and tag[0]!='{': val = "{%s}%s" % (NSS[ns], tag) return val class InkOption(optparse.Option): TYPES = optparse.Option.TYPES + ("inkbool",) TYPE_CHECKER = copy.copy(optparse.Option.TYPE_CHECKER) TYPE_CHECKER["inkbool"] = check_inkbool class Effect: """A class for creating Inkscape SVG Effects""" def __init__(self, *args, **kwargs): self.document=None self.ctx=None self.selected={} self.doc_ids={} self.options=None self.args=None self.OptionParser = optparse.OptionParser(usage="usage: %prog [options] SVGfile",option_class=InkOption) self.OptionParser.add_option("--id", action="append", type="string", dest="ids", default=[], help="id attribute of object to manipulate") def effect(self): pass def getoptions(self,args=sys.argv[1:]): """Collect command line arguments""" self.options, self.args = self.OptionParser.parse_args(args) def parse(self,file=None): """Parse document in specified file or on stdin""" try: try: stream = open(file,'r') except: stream = open(self.svg_file,'r') except: stream = sys.stdin self.document = etree.parse(stream) stream.close() def getposinlayer(self): #defaults self.current_layer = self.document.getroot() self.view_center = (0.0,0.0) layerattr = self.document.xpath('//sodipodi:namedview/@inkscape:current-layer', namespaces=NSS) if layerattr: layername = layerattr[0] layer = self.document.xpath('//svg:g[@id="%s"]' % layername, namespaces=NSS) if layer: self.current_layer = layer[0] xattr = self.document.xpath('//sodipodi:namedview/@inkscape:cx', namespaces=NSS) yattr = self.document.xpath('//sodipodi:namedview/@inkscape:cy', namespaces=NSS) doc_height = unittouu(self.document.getroot().get('height')) if xattr and yattr: x = xattr[0] y = yattr[0] if x and y: self.view_center = (float(x), doc_height - float(y)) # FIXME: y-coordinate flip, eliminate it when it's gone in Inkscape def getselected(self): """Collect selected nodes""" for i in self.options.ids: path = '//*[@id="%s"]' % i for node in self.document.xpath(path, namespaces=NSS): self.selected[i] = node def getElementById(self, id): path = '//*[@id="%s"]' % id el_list = self.document.xpath(path, namespaces=NSS) if el_list: return el_list[0] else: return None def getdocids(self): docIdNodes = self.document.xpath('//@id', namespaces=NSS) for m in docIdNodes: self.doc_ids[m] = 1 def getNamedView(self): return self.document.xpath('//sodipodi:namedview', namespaces=NSS)[0] def createGuide(self, posX, posY, angle): atts = { 'position': str(posX)+','+str(posY), 'orientation': str(sin(radians(angle)))+','+str(-cos(radians(angle))) } guide = etree.SubElement( self.getNamedView(), addNS('guide','sodipodi'), atts ) return guide def output(self): """Serialize document into XML on stdout""" self.document.write(sys.stdout) def affect(self, args=sys.argv[1:], output=True): """Affect an SVG document with a callback effect""" self.svg_file = args[-1] self.getoptions(args) self.parse() self.getposinlayer() self.getselected() self.getdocids() self.effect() if output: self.output() def uniqueId(self, old_id, make_new_id = True): new_id = old_id if make_new_id: while new_id in self.doc_ids: new_id += random.choice('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') self.doc_ids[new_id] = 1 return new_id def xpathSingle(self, path): try: retval = self.document.xpath(path, namespaces=NSS)[0] except: errormsg(_("No matching node for expression: %s") % path) retval = None return retval # vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
{ "pile_set_name": "Github" }
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Contributors: // Justin Palmer (http://encytemedia.com/) // Mark Pilgrim (http://diveintomark.org/) // Martin Bialasinki // // script.aculo.us is freely distributable under the terms of an MIT-style license. // For details, see the script.aculo.us web site: http://script.aculo.us/ // converts rgb() and #xxx to #xxxxxx format, // returns self (or first argument) if not convertable String.prototype.parseColor = function() { var color = '#'; if (this.slice(0,4) == 'rgb(') { var cols = this.slice(4,this.length-1).split(','); var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); } else { if (this.slice(0,1) == '#') { if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); if (this.length==7) color = this.toLowerCase(); } } return (color.length==7 ? color : (arguments[0] || this)); }; /*--------------------------------------------------------------------------*/ Element.collectTextNodes = function(element) { return $A($(element).childNodes).collect( function(node) { return (node.nodeType==3 ? node.nodeValue : (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); }).flatten().join(''); }; Element.collectTextNodesIgnoreClass = function(element, className) { return $A($(element).childNodes).collect( function(node) { return (node.nodeType==3 ? node.nodeValue : ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? Element.collectTextNodesIgnoreClass(node, className) : '')); }).flatten().join(''); }; Element.setContentZoom = function(element, percent) { element = $(element); element.setStyle({fontSize: (percent/100) + 'em'}); if (Prototype.Browser.WebKit) window.scrollBy(0,0); return element; }; Element.getInlineOpacity = function(element){ return $(element).style.opacity || ''; }; Element.forceRerendering = function(element) { try { element = $(element); var n = document.createTextNode(' '); element.appendChild(n); element.removeChild(n); } catch(e) { } }; /*--------------------------------------------------------------------------*/ var Effect = { _elementDoesNotExistError: { name: 'ElementDoesNotExistError', message: 'The specified DOM element does not exist, but is required for this effect to operate' }, Transitions: { linear: Prototype.K, sinoidal: function(pos) { return (-Math.cos(pos*Math.PI)/2) + 0.5; }, reverse: function(pos) { return 1-pos; }, flicker: function(pos) { var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; return pos > 1 ? 1 : pos; }, wobble: function(pos) { return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; }, pulse: function(pos, pulses) { pulses = pulses || 5; return ( ((pos % (1/pulses)) * pulses).round() == 0 ? ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor()) ); }, spring: function(pos) { return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); }, none: function(pos) { return 0; }, full: function(pos) { return 1; } }, DefaultOptions: { duration: 1.0, // seconds fps: 100, // 100= assume 66fps max. sync: false, // true for combining from: 0.0, to: 1.0, delay: 0.0, queue: 'parallel' }, tagifyText: function(element) { var tagifyStyle = 'position:relative'; if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; element = $(element); $A(element.childNodes).each( function(child) { if (child.nodeType==3) { child.nodeValue.toArray().each( function(character) { element.insertBefore( new Element('span', {style: tagifyStyle}).update( character == ' ' ? String.fromCharCode(160) : character), child); }); Element.remove(child); } }); }, multiple: function(element, effect) { var elements; if (((typeof element == 'object') || Object.isFunction(element)) && (element.length)) elements = element; else elements = $(element).childNodes; var options = Object.extend({ speed: 0.1, delay: 0.0 }, arguments[2] || { }); var masterDelay = options.delay; $A(elements).each( function(element, index) { new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); }); }, PAIRS: { 'slide': ['SlideDown','SlideUp'], 'blind': ['BlindDown','BlindUp'], 'appear': ['Appear','Fade'] }, toggle: function(element, effect) { element = $(element); effect = (effect || 'appear').toLowerCase(); var options = Object.extend({ queue: { position:'end', scope:(element.id || 'global'), limit: 1 } }, arguments[2] || { }); Effect[element.visible() ? Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options); } }; Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; /* ------------- core effects ------------- */ Effect.ScopedQueue = Class.create(Enumerable, { initialize: function() { this.effects = []; this.interval = null; }, _each: function(iterator) { this.effects._each(iterator); }, add: function(effect) { var timestamp = new Date().getTime(); var position = Object.isString(effect.options.queue) ? effect.options.queue : effect.options.queue.position; switch(position) { case 'front': // move unstarted effects after this effect this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { e.startOn += effect.finishOn; e.finishOn += effect.finishOn; }); break; case 'with-last': timestamp = this.effects.pluck('startOn').max() || timestamp; break; case 'end': // start effect after last queued effect has finished timestamp = this.effects.pluck('finishOn').max() || timestamp; break; } effect.startOn += timestamp; effect.finishOn += timestamp; if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) this.effects.push(effect); if (!this.interval) this.interval = setInterval(this.loop.bind(this), 15); }, remove: function(effect) { this.effects = this.effects.reject(function(e) { return e==effect }); if (this.effects.length == 0) { clearInterval(this.interval); this.interval = null; } }, loop: function() { var timePos = new Date().getTime(); for(var i=0, len=this.effects.length;i<len;i++) this.effects[i] && this.effects[i].loop(timePos); } }); Effect.Queues = { instances: $H(), get: function(queueName) { if (!Object.isString(queueName)) return queueName; return this.instances.get(queueName) || this.instances.set(queueName, new Effect.ScopedQueue()); } }; Effect.Queue = Effect.Queues.get('global'); Effect.Base = Class.create({ position: null, start: function(options) { function codeForEvent(options,eventName){ return ( (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') + (options[eventName] ? 'this.options.'+eventName+'(this);' : '') ); } if (options && options.transition === false) options.transition = Effect.Transitions.linear; this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { }); this.currentFrame = 0; this.state = 'idle'; this.startOn = this.options.delay*1000; this.finishOn = this.startOn+(this.options.duration*1000); this.fromToDelta = this.options.to-this.options.from; this.totalTime = this.finishOn-this.startOn; this.totalFrames = this.options.fps*this.options.duration; eval('this.render = function(pos){ '+ 'if (this.state=="idle"){this.state="running";'+ codeForEvent(this.options,'beforeSetup')+ (this.setup ? 'this.setup();':'')+ codeForEvent(this.options,'afterSetup')+ '};if (this.state=="running"){'+ 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+ 'this.position=pos;'+ codeForEvent(this.options,'beforeUpdate')+ (this.update ? 'this.update(pos);':'')+ codeForEvent(this.options,'afterUpdate')+ '}}'); this.event('beforeStart'); if (!this.options.sync) Effect.Queues.get(Object.isString(this.options.queue) ? 'global' : this.options.queue.scope).add(this); }, loop: function(timePos) { if (timePos >= this.startOn) { if (timePos >= this.finishOn) { this.render(1.0); this.cancel(); this.event('beforeFinish'); if (this.finish) this.finish(); this.event('afterFinish'); return; } var pos = (timePos - this.startOn) / this.totalTime, frame = (pos * this.totalFrames).round(); if (frame > this.currentFrame) { this.render(pos); this.currentFrame = frame; } } }, cancel: function() { if (!this.options.sync) Effect.Queues.get(Object.isString(this.options.queue) ? 'global' : this.options.queue.scope).remove(this); this.state = 'finished'; }, event: function(eventName) { if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); if (this.options[eventName]) this.options[eventName](this); }, inspect: function() { var data = $H(); for(property in this) if (!Object.isFunction(this[property])) data.set(property, this[property]); return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>'; } }); Effect.Parallel = Class.create(Effect.Base, { initialize: function(effects) { this.effects = effects || []; this.start(arguments[1]); }, update: function(position) { this.effects.invoke('render', position); }, finish: function(position) { this.effects.each( function(effect) { effect.render(1.0); effect.cancel(); effect.event('beforeFinish'); if (effect.finish) effect.finish(position); effect.event('afterFinish'); }); } }); Effect.Tween = Class.create(Effect.Base, { initialize: function(object, from, to) { object = Object.isString(object) ? $(object) : object; var args = $A(arguments), method = args.last(), options = args.length == 5 ? args[3] : null; this.method = Object.isFunction(method) ? method.bind(object) : Object.isFunction(object[method]) ? object[method].bind(object) : function(value) { object[method] = value }; this.start(Object.extend({ from: from, to: to }, options || { })); }, update: function(position) { this.method(position); } }); Effect.Event = Class.create(Effect.Base, { initialize: function() { this.start(Object.extend({ duration: 0 }, arguments[0] || { })); }, update: Prototype.emptyFunction }); Effect.Opacity = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); if (!this.element) throw(Effect._elementDoesNotExistError); // make this work on IE on elements without 'layout' if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom: 1}); var options = Object.extend({ from: this.element.getOpacity() || 0.0, to: 1.0 }, arguments[1] || { }); this.start(options); }, update: function(position) { this.element.setOpacity(position); } }); Effect.Move = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ x: 0, y: 0, mode: 'relative' }, arguments[1] || { }); this.start(options); }, setup: function() { this.element.makePositioned(); this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); this.originalTop = parseFloat(this.element.getStyle('top') || '0'); if (this.options.mode == 'absolute') { this.options.x = this.options.x - this.originalLeft; this.options.y = this.options.y - this.originalTop; } }, update: function(position) { this.element.setStyle({ left: (this.options.x * position + this.originalLeft).round() + 'px', top: (this.options.y * position + this.originalTop).round() + 'px' }); } }); // for backwards compatibility Effect.MoveBy = function(element, toTop, toLeft) { return new Effect.Move(element, Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); }; Effect.Scale = Class.create(Effect.Base, { initialize: function(element, percent) { this.element = $(element); if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ scaleX: true, scaleY: true, scaleContent: true, scaleFromCenter: false, scaleMode: 'box', // 'box' or 'contents' or { } with provided values scaleFrom: 100.0, scaleTo: percent }, arguments[2] || { }); this.start(options); }, setup: function() { this.restoreAfterFinish = this.options.restoreAfterFinish || false; this.elementPositioning = this.element.getStyle('position'); this.originalStyle = { }; ['top','left','width','height','fontSize'].each( function(k) { this.originalStyle[k] = this.element.style[k]; }.bind(this)); this.originalTop = this.element.offsetTop; this.originalLeft = this.element.offsetLeft; var fontSize = this.element.getStyle('font-size') || '100%'; ['em','px','%','pt'].each( function(fontSizeType) { if (fontSize.indexOf(fontSizeType)>0) { this.fontSize = parseFloat(fontSize); this.fontSizeType = fontSizeType; } }.bind(this)); this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; this.dims = null; if (this.options.scaleMode=='box') this.dims = [this.element.offsetHeight, this.element.offsetWidth]; if (/^content/.test(this.options.scaleMode)) this.dims = [this.element.scrollHeight, this.element.scrollWidth]; if (!this.dims) this.dims = [this.options.scaleMode.originalHeight, this.options.scaleMode.originalWidth]; }, update: function(position) { var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); if (this.options.scaleContent && this.fontSize) this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); }, finish: function(position) { if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); }, setDimensions: function(height, width) { var d = { }; if (this.options.scaleX) d.width = width.round() + 'px'; if (this.options.scaleY) d.height = height.round() + 'px'; if (this.options.scaleFromCenter) { var topd = (height - this.dims[0])/2; var leftd = (width - this.dims[1])/2; if (this.elementPositioning == 'absolute') { if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; } else { if (this.options.scaleY) d.top = -topd + 'px'; if (this.options.scaleX) d.left = -leftd + 'px'; } } this.element.setStyle(d); } }); Effect.Highlight = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); this.start(options); }, setup: function() { // Prevent executing on elements not in the layout flow if (this.element.getStyle('display')=='none') { this.cancel(); return; } // Disable background image during the effect this.oldStyle = { }; if (!this.options.keepBackgroundImage) { this.oldStyle.backgroundImage = this.element.getStyle('background-image'); this.element.setStyle({backgroundImage: 'none'}); } if (!this.options.endcolor) this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); if (!this.options.restorecolor) this.options.restorecolor = this.element.getStyle('background-color'); // init color calculations this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); }, update: function(position) { this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); }, finish: function() { this.element.setStyle(Object.extend(this.oldStyle, { backgroundColor: this.options.restorecolor })); } }); Effect.ScrollTo = function(element) { var options = arguments[1] || { }, scrollOffsets = document.viewport.getScrollOffsets(), elementOffsets = $(element).cumulativeOffset(), max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); if (options.offset) elementOffsets[1] += options.offset; return new Effect.Tween(null, scrollOffsets.top, elementOffsets[1] > max ? max : elementOffsets[1], options, function(p){ scrollTo(scrollOffsets.left, p.round()) } ); }; /* ------------- combination effects ------------- */ Effect.Fade = function(element) { element = $(element); var oldOpacity = element.getInlineOpacity(); var options = Object.extend({ from: element.getOpacity() || 1.0, to: 0.0, afterFinishInternal: function(effect) { if (effect.options.to!=0) return; effect.element.hide().setStyle({opacity: oldOpacity}); } }, arguments[1] || { }); return new Effect.Opacity(element,options); }; Effect.Appear = function(element) { element = $(element); var options = Object.extend({ from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), to: 1.0, // force Safari to render floated elements properly afterFinishInternal: function(effect) { effect.element.forceRerendering(); }, beforeSetup: function(effect) { effect.element.setOpacity(effect.options.from).show(); }}, arguments[1] || { }); return new Effect.Opacity(element,options); }; Effect.Puff = function(element) { element = $(element); var oldStyle = { opacity: element.getInlineOpacity(), position: element.getStyle('position'), top: element.style.top, left: element.style.left, width: element.style.width, height: element.style.height }; return new Effect.Parallel( [ new Effect.Scale(element, 200, { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], Object.extend({ duration: 1.0, beforeSetupInternal: function(effect) { Position.absolutize(effect.effects[0].element) }, afterFinishInternal: function(effect) { effect.effects[0].element.hide().setStyle(oldStyle); } }, arguments[1] || { }) ); }; Effect.BlindUp = function(element) { element = $(element); element.makeClipping(); return new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, restoreAfterFinish: true, afterFinishInternal: function(effect) { effect.element.hide().undoClipping(); } }, arguments[1] || { }) ); }; Effect.BlindDown = function(element) { element = $(element); var elementDimensions = element.getDimensions(); return new Effect.Scale(element, 100, Object.extend({ scaleContent: false, scaleX: false, scaleFrom: 0, scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, restoreAfterFinish: true, afterSetup: function(effect) { effect.element.makeClipping().setStyle({height: '0px'}).show(); }, afterFinishInternal: function(effect) { effect.element.undoClipping(); } }, arguments[1] || { })); }; Effect.SwitchOff = function(element) { element = $(element); var oldOpacity = element.getInlineOpacity(); return new Effect.Appear(element, Object.extend({ duration: 0.4, from: 0, transition: Effect.Transitions.flicker, afterFinishInternal: function(effect) { new Effect.Scale(effect.element, 1, { duration: 0.3, scaleFromCenter: true, scaleX: false, scaleContent: false, restoreAfterFinish: true, beforeSetup: function(effect) { effect.element.makePositioned().makeClipping(); }, afterFinishInternal: function(effect) { effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); } }) } }, arguments[1] || { })); }; Effect.DropOut = function(element) { element = $(element); var oldStyle = { top: element.getStyle('top'), left: element.getStyle('left'), opacity: element.getInlineOpacity() }; return new Effect.Parallel( [ new Effect.Move(element, {x: 0, y: 100, sync: true }), new Effect.Opacity(element, { sync: true, to: 0.0 }) ], Object.extend( { duration: 0.5, beforeSetup: function(effect) { effect.effects[0].element.makePositioned(); }, afterFinishInternal: function(effect) { effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); } }, arguments[1] || { })); }; Effect.Shake = function(element) { element = $(element); var options = Object.extend({ distance: 20, duration: 0.5 }, arguments[1] || {}); var distance = parseFloat(options.distance); var split = parseFloat(options.duration) / 10.0; var oldStyle = { top: element.getStyle('top'), left: element.getStyle('left') }; return new Effect.Move(element, { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { new Effect.Move(effect.element, { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { new Effect.Move(effect.element, { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { effect.element.undoPositioned().setStyle(oldStyle); }}) }}) }}) }}) }}) }}); }; Effect.SlideDown = function(element) { element = $(element).cleanWhitespace(); // SlideDown need to have the content of the element wrapped in a container element with fixed height! var oldInnerBottom = element.down().getStyle('bottom'); var elementDimensions = element.getDimensions(); return new Effect.Scale(element, 100, Object.extend({ scaleContent: false, scaleX: false, scaleFrom: window.opera ? 0 : 1, scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, restoreAfterFinish: true, afterSetup: function(effect) { effect.element.makePositioned(); effect.element.down().makePositioned(); if (window.opera) effect.element.setStyle({top: ''}); effect.element.makeClipping().setStyle({height: '0px'}).show(); }, afterUpdateInternal: function(effect) { effect.element.down().setStyle({bottom: (effect.dims[0] - effect.element.clientHeight) + 'px' }); }, afterFinishInternal: function(effect) { effect.element.undoClipping().undoPositioned(); effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } }, arguments[1] || { }) ); }; Effect.SlideUp = function(element) { element = $(element).cleanWhitespace(); var oldInnerBottom = element.down().getStyle('bottom'); var elementDimensions = element.getDimensions(); return new Effect.Scale(element, window.opera ? 0 : 1, Object.extend({ scaleContent: false, scaleX: false, scaleMode: 'box', scaleFrom: 100, scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, restoreAfterFinish: true, afterSetup: function(effect) { effect.element.makePositioned(); effect.element.down().makePositioned(); if (window.opera) effect.element.setStyle({top: ''}); effect.element.makeClipping().show(); }, afterUpdateInternal: function(effect) { effect.element.down().setStyle({bottom: (effect.dims[0] - effect.element.clientHeight) + 'px' }); }, afterFinishInternal: function(effect) { effect.element.hide().undoClipping().undoPositioned(); effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } }, arguments[1] || { }) ); }; // Bug in opera makes the TD containing this element expand for a instance after finish Effect.Squish = function(element) { return new Effect.Scale(element, window.opera ? 1 : 0, { restoreAfterFinish: true, beforeSetup: function(effect) { effect.element.makeClipping(); }, afterFinishInternal: function(effect) { effect.element.hide().undoClipping(); } }); }; Effect.Grow = function(element) { element = $(element); var options = Object.extend({ direction: 'center', moveTransition: Effect.Transitions.sinoidal, scaleTransition: Effect.Transitions.sinoidal, opacityTransition: Effect.Transitions.full }, arguments[1] || { }); var oldStyle = { top: element.style.top, left: element.style.left, height: element.style.height, width: element.style.width, opacity: element.getInlineOpacity() }; var dims = element.getDimensions(); var initialMoveX, initialMoveY; var moveX, moveY; switch (options.direction) { case 'top-left': initialMoveX = initialMoveY = moveX = moveY = 0; break; case 'top-right': initialMoveX = dims.width; initialMoveY = moveY = 0; moveX = -dims.width; break; case 'bottom-left': initialMoveX = moveX = 0; initialMoveY = dims.height; moveY = -dims.height; break; case 'bottom-right': initialMoveX = dims.width; initialMoveY = dims.height; moveX = -dims.width; moveY = -dims.height; break; case 'center': initialMoveX = dims.width / 2; initialMoveY = dims.height / 2; moveX = -dims.width / 2; moveY = -dims.height / 2; break; } return new Effect.Move(element, { x: initialMoveX, y: initialMoveY, duration: 0.01, beforeSetup: function(effect) { effect.element.hide().makeClipping().makePositioned(); }, afterFinishInternal: function(effect) { new Effect.Parallel( [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), new Effect.Scale(effect.element, 100, { scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) ], Object.extend({ beforeSetup: function(effect) { effect.effects[0].element.setStyle({height: '0px'}).show(); }, afterFinishInternal: function(effect) { effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); } }, options) ) } }); }; Effect.Shrink = function(element) { element = $(element); var options = Object.extend({ direction: 'center', moveTransition: Effect.Transitions.sinoidal, scaleTransition: Effect.Transitions.sinoidal, opacityTransition: Effect.Transitions.none }, arguments[1] || { }); var oldStyle = { top: element.style.top, left: element.style.left, height: element.style.height, width: element.style.width, opacity: element.getInlineOpacity() }; var dims = element.getDimensions(); var moveX, moveY; switch (options.direction) { case 'top-left': moveX = moveY = 0; break; case 'top-right': moveX = dims.width; moveY = 0; break; case 'bottom-left': moveX = 0; moveY = dims.height; break; case 'bottom-right': moveX = dims.width; moveY = dims.height; break; case 'center': moveX = dims.width / 2; moveY = dims.height / 2; break; } return new Effect.Parallel( [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) ], Object.extend({ beforeStartInternal: function(effect) { effect.effects[0].element.makePositioned().makeClipping(); }, afterFinishInternal: function(effect) { effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } }, options) ); }; Effect.Pulsate = function(element) { element = $(element); var options = arguments[1] || { }; var oldOpacity = element.getInlineOpacity(); var transition = options.transition || Effect.Transitions.sinoidal; var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) }; reverser.bind(transition); return new Effect.Opacity(element, Object.extend(Object.extend({ duration: 2.0, from: 0, afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } }, options), {transition: reverser})); }; Effect.Fold = function(element) { element = $(element); var oldStyle = { top: element.style.top, left: element.style.left, width: element.style.width, height: element.style.height }; element.makeClipping(); return new Effect.Scale(element, 5, Object.extend({ scaleContent: false, scaleX: false, afterFinishInternal: function(effect) { new Effect.Scale(element, 1, { scaleContent: false, scaleY: false, afterFinishInternal: function(effect) { effect.element.hide().undoClipping().setStyle(oldStyle); } }); }}, arguments[1] || { })); }; Effect.Morph = Class.create(Effect.Base, { initialize: function(element) { this.element = $(element); if (!this.element) throw(Effect._elementDoesNotExistError); var options = Object.extend({ style: { } }, arguments[1] || { }); if (!Object.isString(options.style)) this.style = $H(options.style); else { if (options.style.include(':')) this.style = options.style.parseStyle(); else { this.element.addClassName(options.style); this.style = $H(this.element.getStyles()); this.element.removeClassName(options.style); var css = this.element.getStyles(); this.style = this.style.reject(function(style) { return style.value == css[style.key]; }); options.afterFinishInternal = function(effect) { effect.element.addClassName(effect.options.style); effect.transforms.each(function(transform) { effect.element.style[transform.style] = ''; }); } } } this.start(options); }, setup: function(){ function parseColor(color){ if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; color = color.parseColor(); return $R(0,2).map(function(i){ return parseInt( color.slice(i*2+1,i*2+3), 16 ) }); } this.transforms = this.style.map(function(pair){ var property = pair[0], value = pair[1], unit = null; if (value.parseColor('#zzzzzz') != '#zzzzzz') { value = value.parseColor(); unit = 'color'; } else if (property == 'opacity') { value = parseFloat(value); if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) this.element.setStyle({zoom: 1}); } else if (Element.CSS_LENGTH.test(value)) { var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); value = parseFloat(components[1]); unit = (components.length == 3) ? components[2] : null; } var originalValue = this.element.getStyle(property); return { style: property.camelize(), originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), targetValue: unit=='color' ? parseColor(value) : value, unit: unit }; }.bind(this)).reject(function(transform){ return ( (transform.originalValue == transform.targetValue) || ( transform.unit != 'color' && (isNaN(transform.originalValue) || isNaN(transform.targetValue)) ) ) }); }, update: function(position) { var style = { }, transform, i = this.transforms.length; while(i--) style[(transform = this.transforms[i]).style] = transform.unit=='color' ? '#'+ (Math.round(transform.originalValue[0]+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + (Math.round(transform.originalValue[1]+ (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + (Math.round(transform.originalValue[2]+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : (transform.originalValue + (transform.targetValue - transform.originalValue) * position).toFixed(3) + (transform.unit === null ? '' : transform.unit); this.element.setStyle(style, true); } }); Effect.Transform = Class.create({ initialize: function(tracks){ this.tracks = []; this.options = arguments[1] || { }; this.addTracks(tracks); }, addTracks: function(tracks){ tracks.each(function(track){ track = $H(track); var data = track.values().first(); this.tracks.push($H({ ids: track.keys().first(), effect: Effect.Morph, options: { style: data } })); }.bind(this)); return this; }, play: function(){ return new Effect.Parallel( this.tracks.map(function(track){ var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); var elements = [$(ids) || $$(ids)].flatten(); return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); }).flatten(), this.options ); } }); Element.CSS_PROPERTIES = $w( 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + 'fontSize fontWeight height left letterSpacing lineHeight ' + 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + 'right textIndent top width wordSpacing zIndex'); Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; String.__parseStyleElement = document.createElement('div'); String.prototype.parseStyle = function(){ var style, styleRules = $H(); if (Prototype.Browser.WebKit) style = new Element('div',{style:this}).style; else { String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>'; style = String.__parseStyleElement.childNodes[0].style; } Element.CSS_PROPERTIES.each(function(property){ if (style[property]) styleRules.set(property, style[property]); }); if (Prototype.Browser.IE && this.include('opacity')) styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); return styleRules; }; if (document.defaultView && document.defaultView.getComputedStyle) { Element.getStyles = function(element) { var css = document.defaultView.getComputedStyle($(element), null); return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { styles[property] = css[property]; return styles; }); }; } else { Element.getStyles = function(element) { element = $(element); var css = element.currentStyle, styles; styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) { hash.set(property, css[property]); return hash; }); if (!styles.opacity) styles.set('opacity', element.getOpacity()); return styles; }; }; Effect.Methods = { morph: function(element, style) { element = $(element); new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); return element; }, visualEffect: function(element, effect, options) { element = $(element) var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); new Effect[klass](element, options); return element; }, highlight: function(element, options) { element = $(element); new Effect.Highlight(element, options); return element; } }; $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ 'pulsate shake puff squish switchOff dropOut').each( function(effect) { Effect.Methods[effect] = function(element, options){ element = $(element); Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); return element; } } ); $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( function(f) { Effect.Methods[f] = Element[f]; } ); Element.addMethods(Effect.Methods);
{ "pile_set_name": "Github" }
{ "pip": [ "dcos==0.1.13", "git+https://github.com/mesosphere/dcos-cassandra.git#dcos-cassandra=0.1.0" ] }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 8860c86740da55b47a675eef13647a09 ScriptedImporter: fileIDToRecycleName: 4800000: MainAsset externalObjects: {} userData: assetBundleName: assetBundleVariant: script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
{ "pile_set_name": "Github" }
#!/usr/local/bin/dumb-init /bin/bash # Load the .env file into the environment. if [ "$ENV" == 'staging' ]; then # shellcheck disable=SC2046 export $(grep -v '^#' app/app/.env | xargs) fi # Settings # Web GC_WEB_WORKER=${GC_WEB_WORKER_TYPE:-runserver_plus} # General / Overrides FORCE_PROVISION=${FORCE_PROVISION:-'off'} FORCE_GET_PRICES=${FORCE_GET_PRICES:-'off'} cd app || exit 1 # Check whether or not the .env file exists. If not, create it. if [ ! -f app/.env ]; then cp app/local.env app/.env fi # Enable Python dependency installation on container start/restart. if [ ! -z "${INSTALL_REQS}" ]; then echo "Installing Python packages..." pip3 install -r ../requirements/test.txt echo "Python package installation completed!" fi GC_WEB_OPTS="${GC_WEB_WORKER} ${GC_WEB_INTERFACE:-0.0.0.0}:${GC_WEB_PORT:-8000}" if [ "$VSCODE_DEBUGGER_ENABLED" = "on" ]; then pip3 install ptvsd GC_WEB_OPTS="${GC_WEB_OPTS} --nothreading" echo "VSCode remote debugger enabled! This has disabled threading!" fi if [ "$GC_WEB_WORKER" = "runserver_plus" ]; then GC_WEB_OPTS="${GC_WEB_OPTS} --extra-file /code/app/app/.env --nopin --verbosity 0" fi # Provision the Django test environment. if [ ! -f /provisioned ] || [ "$FORCE_PROVISION" = "on" ]; then echo "First run - Provisioning the local development environment..." if [ "$DISABLE_INITIAL_CACHETABLE" != "on" ]; then python3 manage.py createcachetable fi if [ "$DISABLE_INITIAL_COLLECTSTATIC" != "on" ]; then python3 manage.py collectstatic --noinput -i other & fi if [ "$DISABLE_INITIAL_MIGRATE" != "on" ]; then python3 manage.py migrate fi if [ "$DISABLE_INITIAL_LOADDATA" != "on" ]; then python3 manage.py loaddata app/fixtures/oauth_application.json python3 manage.py loaddata app/fixtures/users.json python3 manage.py loaddata app/fixtures/economy.json python3 manage.py loaddata app/fixtures/profiles.json python3 manage.py loaddata app/fixtures/kudos.json python3 manage.py loaddata app/fixtures/grants.json python3 manage.py loaddata app/fixtures/dashboard.json python3 manage.py loaddata app/fixtures/avatar.json python3 manage.py loaddata app/fixtures/marketing.json fi date >> /provisioned echo "Provisioning completed!" fi if [ "$FORCE_GET_PRICES" = "on" ]; then python3 manage.py get_prices fi if [ "$KUDOS_LOCAL_SYNC" = "on" ]; then bash /code/scripts/sync_kudos_listener_local.bash & bash /code/scripts/sync_kudos_local.bash & fi exec python3 manage.py $GC_WEB_OPTS
{ "pile_set_name": "Github" }
/** * Copyright (c) Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ // Copyright (c) 2012 Jakob Progsch, Vaclav Zeman #pragma once #include <condition_variable> #include <functional> #include <future> #include <memory> #include <mutex> #include <queue> #include <stdexcept> #include <thread> #include <vector> namespace w2l { namespace streaming { namespace example { /** * A simple C++11 Thread Pool implementation. * Source - https://github.com/progschj/ThreadPool * * Basic usage: \code // create thread pool with 4 worker threads ThreadPool pool(4); // enqueue and store future auto result = pool.enqueue([](int answer) { return answer; }, 42); // get result from future std::cout << result.get() << std::endl; \endcode */ class ThreadPool { public: /** * the constructor just launches given amount of workers * \param [in] threads number of threads * \param [in] initFn initialization code (if any) that will be run on all the * threads */ ThreadPool( size_t threads, const std::function<void(size_t)>& initFn = nullptr); /** * add new work item to the pool * \param [in] f function to be executed in threadpool * \param [in] args varadic arguments for the function */ template <class F, class... Args> auto enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type>; /// destructor joins all threads. ~ThreadPool(); private: // need to keep track of threads so we can join them std::vector<std::thread> workers; // the task queue std::queue<std::function<void()>> tasks; // synchronization std::mutex queue_mutex; std::condition_variable condition; bool stop; }; // namespace flclassThreadPool inline ThreadPool::ThreadPool( size_t threads, const std::function<void(size_t)>& initFn /* = nullptr */) : stop(false) { for (size_t id = 0; id < threads; ++id) workers.emplace_back([this, initFn, id] { if (initFn) { initFn(id); } for (;;) { std::function<void()> task; { std::unique_lock<std::mutex> lock(this->queue_mutex); this->condition.wait( lock, [this] { return this->stop || !this->tasks.empty(); }); if (this->stop && this->tasks.empty()) return; task = std::move(this->tasks.front()); this->tasks.pop(); } task(); } }); } template <class F, class... Args> auto ThreadPool::enqueue(F&& f, Args&&... args) -> std::future<typename std::result_of<F(Args...)>::type> { using return_type = typename std::result_of<F(Args...)>::type; auto task = std::make_shared<std::packaged_task<return_type()>>( std::bind(std::forward<F>(f), std::forward<Args>(args)...)); std::future<return_type> res = task->get_future(); { std::unique_lock<std::mutex> lock(queue_mutex); // don't allow enqueueing after stopping the pool if (stop) throw std::runtime_error("enqueue on stopped ThreadPool"); tasks.emplace([task]() { (*task)(); }); } condition.notify_one(); return res; } inline ThreadPool::~ThreadPool() { { std::unique_lock<std::mutex> lock(queue_mutex); stop = true; } condition.notify_all(); for (std::thread& worker : workers) worker.join(); std::cout << "exit ThreadPool::~ThreadPool()\n"; } } // namespace example } // namespace streaming } // namespace w2l
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * If the argument len is not a Number, then the length property of * the newly constructed object is set to 1 and the 0 property of * the newly constructed object is set to len * * @path ch15/15.4/15.4.2/15.4.2.2/S15.4.2.2_A2.3_T5.js * @description Checking for Number object */ var obj = new Number(-1); var x = new Array(obj); //CHECK#1 if (x.length !== 1) { $ERROR('#1: var obj = new Number(-1); var x = new Array(obj); x.length === 1. Actual: ' + (x.length)); } //CHECK#2 if (x[0] !== obj) { $ERROR('#2: var obj = new Number(-1); var x = new Array(obj); x[0] === obj. Actual: ' + (x[0])); } var obj = new Number(4294967296); var x = new Array(obj); //CHECK#3 if (x.length !== 1) { $ERROR('#3: var obj = new Number(4294967296); var x = new Array(obj); x.length === 1. Actual: ' + (x.length)); } //CHECK#4 if (x[0] !== obj) { $ERROR('#4: var obj = new Number(4294967296); var x = new Array(obj); x[0] === obj. Actual: ' + (x[0])); } var obj = new Number(4294967297); var x = new Array(obj); //CHECK#5 if (x.length !== 1) { $ERROR('#5: var obj = new Number(4294967297); var x = new Array(obj); x.length === 1. Actual: ' + (x.length)); } //CHECK#6 if (x[0] !== obj) { $ERROR('#6: var obj = new Number(4294967297); var x = new Array(obj); x[0] === obj. Actual: ' + (x[0])); }
{ "pile_set_name": "Github" }
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TupleSections #-} -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html module Stratosphere.ResourceProperties.AutoScalingScalingPolicyStepAdjustment where import Stratosphere.ResourceImports -- | Full data type definition for AutoScalingScalingPolicyStepAdjustment. See -- 'autoScalingScalingPolicyStepAdjustment' for a more convenient -- constructor. data AutoScalingScalingPolicyStepAdjustment = AutoScalingScalingPolicyStepAdjustment { _autoScalingScalingPolicyStepAdjustmentMetricIntervalLowerBound :: Maybe (Val Double) , _autoScalingScalingPolicyStepAdjustmentMetricIntervalUpperBound :: Maybe (Val Double) , _autoScalingScalingPolicyStepAdjustmentScalingAdjustment :: Val Integer } deriving (Show, Eq) instance ToJSON AutoScalingScalingPolicyStepAdjustment where toJSON AutoScalingScalingPolicyStepAdjustment{..} = object $ catMaybes [ fmap (("MetricIntervalLowerBound",) . toJSON) _autoScalingScalingPolicyStepAdjustmentMetricIntervalLowerBound , fmap (("MetricIntervalUpperBound",) . toJSON) _autoScalingScalingPolicyStepAdjustmentMetricIntervalUpperBound , (Just . ("ScalingAdjustment",) . toJSON) _autoScalingScalingPolicyStepAdjustmentScalingAdjustment ] -- | Constructor for 'AutoScalingScalingPolicyStepAdjustment' containing -- required fields as arguments. autoScalingScalingPolicyStepAdjustment :: Val Integer -- ^ 'asspsaScalingAdjustment' -> AutoScalingScalingPolicyStepAdjustment autoScalingScalingPolicyStepAdjustment scalingAdjustmentarg = AutoScalingScalingPolicyStepAdjustment { _autoScalingScalingPolicyStepAdjustmentMetricIntervalLowerBound = Nothing , _autoScalingScalingPolicyStepAdjustmentMetricIntervalUpperBound = Nothing , _autoScalingScalingPolicyStepAdjustmentScalingAdjustment = scalingAdjustmentarg } -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-metricintervallowerbound asspsaMetricIntervalLowerBound :: Lens' AutoScalingScalingPolicyStepAdjustment (Maybe (Val Double)) asspsaMetricIntervalLowerBound = lens _autoScalingScalingPolicyStepAdjustmentMetricIntervalLowerBound (\s a -> s { _autoScalingScalingPolicyStepAdjustmentMetricIntervalLowerBound = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-metricintervalupperbound asspsaMetricIntervalUpperBound :: Lens' AutoScalingScalingPolicyStepAdjustment (Maybe (Val Double)) asspsaMetricIntervalUpperBound = lens _autoScalingScalingPolicyStepAdjustmentMetricIntervalUpperBound (\s a -> s { _autoScalingScalingPolicyStepAdjustmentMetricIntervalUpperBound = a }) -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-stepadjustments.html#cfn-autoscaling-scalingpolicy-stepadjustment-scalingadjustment asspsaScalingAdjustment :: Lens' AutoScalingScalingPolicyStepAdjustment (Val Integer) asspsaScalingAdjustment = lens _autoScalingScalingPolicyStepAdjustmentScalingAdjustment (\s a -> s { _autoScalingScalingPolicyStepAdjustmentScalingAdjustment = a })
{ "pile_set_name": "Github" }
using FluentAssertions; using FunctionalTests.Base; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; using System; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using Xunit; namespace FunctionalTests.HealthChecks.System { [Collection("execution")] public class disk_storage_healthcheck_should { private readonly ExecutionFixture _fixture; private DriveInfo[] _drives = DriveInfo.GetDrives(); public disk_storage_healthcheck_should(ExecutionFixture fixture) { _fixture = fixture ?? throw new ArgumentNullException(nameof(fixture)); } [Fact] public async Task be_healthy_when_disks_have_more_free_space_than_configured() { var testDrive = _drives.FirstOrDefault(d => d.DriveType == DriveType.Fixed); var testDriveActualFreeMegabytes = testDrive.AvailableFreeSpace / 1024 / 1024; var targetFreeSpace = testDriveActualFreeMegabytes - 50; var webHostBuilder = new WebHostBuilder() .UseStartup<DefaultStartup>() .ConfigureServices(services => { services.AddHealthChecks() .AddDiskStorageHealthCheck(setup => { setup.AddDrive(testDrive.Name, targetFreeSpace); }, tags: new string[] { "diskstorage" }); }) .Configure(app => { app.UseHealthChecks("/health", new HealthCheckOptions() { Predicate = r => r.Tags.Contains("diskstorage") }); }); var server = new TestServer(webHostBuilder); var response = await server.CreateRequest("/health") .GetAsync(); response.EnsureSuccessStatusCode(); } [Fact] public async Task be_unhealthy_when_a_disk_has_less_free_space_than_configured() { var testDrive = _drives.FirstOrDefault(d => d.DriveType == DriveType.Fixed); var testDriveActualFreeMegabytes = testDrive.AvailableFreeSpace / 1024 / 1024; var targetFreeSpace = testDriveActualFreeMegabytes + 50; var webHostBuilder = new WebHostBuilder() .UseStartup<DefaultStartup>() .ConfigureServices(services => { services.AddHealthChecks() .AddDiskStorageHealthCheck(setup => { setup.AddDrive(testDrive.Name, targetFreeSpace); }, tags: new string[] { "diskstorage" }); }) .Configure(app => { app.UseHealthChecks("/health", new HealthCheckOptions() { Predicate = r => r.Tags.Contains("diskstorage") }); }); var server = new TestServer(webHostBuilder); var response = await server.CreateRequest("/health") .GetAsync(); response.StatusCode.Should().Be(HttpStatusCode.ServiceUnavailable); } [Fact] public async Task be_unhealthy_when_a_configured_disk_does_not_exist() { var webHostBuilder = new WebHostBuilder() .UseStartup<DefaultStartup>() .ConfigureServices(services => { services.AddHealthChecks() .AddDiskStorageHealthCheck(setup => { setup.AddDrive("nonexistingdisk", 104857600); }, tags: new string[] { "diskstorage" }); }) .Configure(app => { app.UseHealthChecks("/health", new HealthCheckOptions() { Predicate = r => r.Tags.Contains("diskstorage") }); }); var server = new TestServer(webHostBuilder); var response = await server.CreateRequest("/health") .GetAsync(); response.StatusCode.Should().Be(HttpStatusCode.ServiceUnavailable); } } }
{ "pile_set_name": "Github" }
// ================================================================================================= // Copyright 2011 Twitter, Inc. // ------------------------------------------------------------------------------------------------- // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this work except in compliance with the License. // You may obtain a copy of the License in the LICENSE file, or 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.twitter.common.thrift.text; import java.util.Iterator; import java.util.Map; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; /** * A map parsing context that tracks if we are parsing a key, which * is on the left hand side of the ":" operator, or a value. * Json mandates that keys are strings * e.g. * { * "1" : 1, * "2" : 2, * } * Note the required quotes on the lhs. * We maintain an iterator over all of our child name/value pairs, and * a pointer to the current one being parsed. * * @author Alex Roetter */ class PairContext extends BaseContext { private boolean lhs; private final Iterator<Map.Entry<String, JsonElement>> children; private Map.Entry<String, JsonElement> currentChild; /** * Create an iterator over this object's children */ protected PairContext(JsonObject json) { children = (null != json) ? json.entrySet().iterator() : null; } @Override protected void write() { lhs = !lhs; } @Override protected void read() { lhs = !lhs; // every other time, do a read, since the read gets the name & value // at once. if (isLhs()) { if (!children.hasNext()) { throw new RuntimeException( "Called PairContext.read() too many times!"); } currentChild = children.next(); } } @Override protected JsonElement getCurrentChild() { if (lhs) { return new JsonPrimitive(currentChild.getKey()); } return currentChild.getValue(); } @Override protected boolean hasMoreChildren() { return children.hasNext(); } protected boolean isLhs() { return lhs; } }
{ "pile_set_name": "Github" }
//! A type for working one-dimensional ranges. use super::Scalar; /// Some start and end position along a single axis. /// /// As an example, a **Rect** is made up of two **Range**s; one along the *x* axis, and one along /// the *y* axis. #[derive(Copy, Clone, Debug, PartialEq)] pub struct Range { /// The start of some `Range` along an axis. pub start: Scalar, /// The end of some `Range` along an axis. pub end: Scalar, } /// Represents either the **Start** or **End** **Edge** of a **Range**. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Edge { /// The beginning of a **Range**. Start, /// The end of a **Range**. End, } impl Range { /// Construct a new `Range` from a given range, i.e. `Range::new(start, end)`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range { start: 0.0, end: 10.0 }, Range::new(0.0, 10.0)); /// ``` pub fn new(start: Scalar, end: Scalar) -> Range { Range { start: start, end: end, } } /// Construct a new `Range` from a given length and its centered position. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 10.0), Range::from_pos_and_len(5.0, 10.0)); /// assert_eq!(Range::new(-5.0, 1.0), Range::from_pos_and_len(-2.0, 6.0)); /// assert_eq!(Range::new(-100.0, 200.0), Range::from_pos_and_len(50.0, 300.0)); /// ``` pub fn from_pos_and_len(pos: Scalar, len: Scalar) -> Range { let half_len = len / 2.0; let start = pos - half_len; let end = pos + half_len; Range::new(start, end) } /// The `start` value subtracted from the `end` value. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(-5.0, 5.0).magnitude(), 10.0); /// assert_eq!(Range::new(5.0, -5.0).magnitude(), -10.0); /// assert_eq!(Range::new(15.0, 10.0).magnitude(), -5.0); /// ``` pub fn magnitude(&self) -> Scalar { self.end - self.start } /// The absolute length of the Range aka the absolute magnitude. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(-5.0, 5.0).len(), 10.0); /// assert_eq!(Range::new(5.0, -5.0).len(), 10.0); /// assert_eq!(Range::new(15.0, 10.0).len(), 5.0); /// ``` pub fn len(&self) -> Scalar { self.magnitude().abs() } /// Return the value directly between the start and end values. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(-5.0, 5.0).middle(), 0.0); /// assert_eq!(Range::new(5.0, -5.0).middle(), 0.0); /// assert_eq!(Range::new(10.0, 15.0).middle(), 12.5); /// assert_eq!(Range::new(20.0, 40.0).middle(), 30.0); /// assert_eq!(Range::new(20.0, -40.0).middle(), -10.0); /// ``` pub fn middle(&self) -> Scalar { (self.end + self.start) / 2.0 } /// The current range with its start and end values swapped. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(-5.0, 5.0).invert(), Range::new(5.0, -5.0)); /// assert_eq!(Range::new(-10.0, 10.0).invert(), Range::new(10.0, -10.0)); /// assert_eq!(Range::new(0.0, 7.25).invert(), Range::new(7.25, 0.0)); /// assert_eq!(Range::new(5.0, 1.0).invert(), Range::new(1.0, 5.0)); /// ``` pub fn invert(self) -> Range { Range { start: self.end, end: self.start } } /// Map the given Scalar from `Self` to some other given `Range`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(0.0, 5.0); /// /// let b = Range::new(0.0, 10.0); /// assert_eq!(a.map_value_to(2.5, &b), 5.0); /// assert_eq!(a.map_value_to(0.0, &b), 0.0); /// assert_eq!(a.map_value_to(5.0, &b), 10.0); /// assert_eq!(a.map_value_to(-5.0, &b), -10.0); /// assert_eq!(a.map_value_to(10.0, &b), 20.0); /// /// let c = Range::new(10.0, -10.0); /// assert_eq!(a.map_value_to(2.5, &c), 0.0); /// assert_eq!(a.map_value_to(0.0, &c), 10.0); /// assert_eq!(a.map_value_to(5.0, &c), -10.0); /// assert_eq!(a.map_value_to(-5.0, &c), 30.0); /// assert_eq!(a.map_value_to(10.0, &c), -30.0); /// ``` pub fn map_value_to(&self, value: Scalar, other: &Range) -> Scalar { ::utils::map_range(value, self.start, self.end, other.start, other.end) } /// Shift the `Range` start and end points by a given `Scalar`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 5.0).shift(5.0), Range::new(5.0, 10.0)); /// assert_eq!(Range::new(0.0, 5.0).shift(-5.0), Range::new(-5.0, 0.0)); /// assert_eq!(Range::new(5.0, -5.0).shift(-5.0), Range::new(0.0, -10.0)); /// ``` pub fn shift(self, amount: Scalar) -> Range { Range { start: self.start + amount, end: self.end + amount } } /// The direction of the Range represented as a normalised scalar. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 5.0).direction(), 1.0); /// assert_eq!(Range::new(0.0, 0.0).direction(), 0.0); /// assert_eq!(Range::new(0.0, -5.0).direction(), -1.0); /// ``` pub fn direction(&self) -> Scalar { if self.start < self.end { 1.0 } else if self.start > self.end { -1.0 } else { 0.0 } } /// Converts the Range to an undirected Range. By ensuring that `start` <= `end`. /// /// If `start` > `end`, then the start and end points will be swapped. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 5.0).undirected(), Range::new(0.0, 5.0)); /// assert_eq!(Range::new(5.0, 1.0).undirected(), Range::new(1.0, 5.0)); /// assert_eq!(Range::new(10.0, -10.0).undirected(), Range::new(-10.0, 10.0)); /// ``` pub fn undirected(self) -> Range { if self.start > self.end { self.invert() } else { self } } /// The Range that encompasses both self and the given Range. /// /// The returned Range's `start` will always be <= its `end`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(0.0, 3.0); /// let b = Range::new(7.0, 10.0); /// assert_eq!(a.max(b), Range::new(0.0, 10.0)); /// /// let c = Range::new(-20.0, -30.0); /// let d = Range::new(5.0, -7.5); /// assert_eq!(c.max(d), Range::new(-30.0, 5.0)); /// ``` pub fn max(self, other: Self) -> Range { let start = self.start.min(self.end).min(other.start).min(other.end); let end = self.start.max(self.end).max(other.start).max(other.end); Range::new(start, end) } /// The Range that represents the range of the overlap between two Ranges if there is some. /// /// Note that If one end of `self` aligns exactly with the opposite end of `other`, `Some` /// `Range` will be returned with a magnitude of `0.0`. This is useful for algorithms that /// involve calculating the visibility of widgets, as it allows for including widgets whose /// bounding box may be a one dimensional straight line. /// /// The returned `Range`'s `start` will always be <= its `end`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(0.0, 6.0); /// let b = Range::new(4.0, 10.0); /// assert_eq!(a.overlap(b), Some(Range::new(4.0, 6.0))); /// /// let c = Range::new(10.0, -30.0); /// let d = Range::new(-5.0, 20.0); /// assert_eq!(c.overlap(d), Some(Range::new(-5.0, 10.0))); /// /// let e = Range::new(0.0, 2.5); /// let f = Range::new(50.0, 100.0); /// assert_eq!(e.overlap(f), None); /// ``` pub fn overlap(mut self, mut other: Self) -> Option<Range> { self = self.undirected(); other = other.undirected(); let start = ::utils::partial_max(self.start, other.start); let end = ::utils::partial_min(self.end, other.end); let magnitude = end - start; if magnitude >= 0.0 { Some(Range::new(start, end)) } else { None } } /// The Range that encompasses both self and the given Range. /// /// The same as [**Range::max**](./struct.Range#method.max) but retains `self`'s original /// direction. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(0.0, 3.0); /// let b = Range::new(7.0, 10.0); /// assert_eq!(a.max_directed(b), Range::new(0.0, 10.0)); /// /// let c = Range::new(-20.0, -30.0); /// let d = Range::new(5.0, -7.5); /// assert_eq!(c.max_directed(d), Range::new(5.0, -30.0)); /// ``` pub fn max_directed(self, other: Self) -> Range { if self.start <= self.end { self.max(other) } else { self.max(other).invert() } } /// Is the given scalar within our range. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let range = Range::new(0.0, 10.0); /// assert!(range.is_over(5.0)); /// assert!(!range.is_over(12.0)); /// assert!(!range.is_over(-1.0)); /// assert!(range.is_over(0.0)); /// assert!(range.is_over(10.0)); /// ``` pub fn is_over(&self, pos: Scalar) -> bool { let Range { start, end } = self.undirected(); pos >= start && pos <= end } /// Round the values at both ends of the Range and return the result. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.25, 9.5).round(), Range::new(0.0, 10.0)); /// assert_eq!(Range::new(4.95, -5.3).round(), Range::new(5.0, -5.0)); /// ``` pub fn round(self) -> Range { Range::new(self.start.round(), self.end.round()) } /// Floor the values at both ends of the Range and return the result. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.25, 9.5).floor(), Range::new(0.0, 9.0)); /// assert_eq!(Range::new(4.95, -5.3).floor(), Range::new(4.0, -6.0)); /// ``` pub fn floor(self) -> Range { Range::new(self.start.floor(), self.end.floor()) } /// The Range with some padding given to the `start` value. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 10.0).pad_start(2.0), Range::new(2.0, 10.0)); /// assert_eq!(Range::new(10.0, 0.0).pad_start(2.0), Range::new(8.0, 0.0)); /// ``` pub fn pad_start(mut self, pad: Scalar) -> Range { self.start += if self.start <= self.end { pad } else { -pad }; self } /// The Range with some padding given to the `end` value. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 10.0).pad_end(2.0), Range::new(0.0, 8.0)); /// assert_eq!(Range::new(10.0, 0.0).pad_end(2.0), Range::new(10.0, 2.0)); /// ``` pub fn pad_end(mut self, pad: Scalar) -> Range { self.end += if self.start <= self.end { -pad } else { pad }; self } /// The Range with some given padding to be applied to each end. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 10.0).pad(2.0), Range::new(2.0, 8.0)); /// assert_eq!(Range::new(10.0, 0.0).pad(2.0), Range::new(8.0, 2.0)); /// ``` pub fn pad(self, pad: Scalar) -> Range { self.pad_start(pad).pad_end(pad) } /// The Range with some padding given for each end. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 10.0).pad_ends(1.0, 2.0), Range::new(1.0, 8.0)); /// assert_eq!(Range::new(10.0, 0.0).pad_ends(4.0, 3.0), Range::new(6.0, 3.0)); /// ``` pub fn pad_ends(self, start: Scalar, end: Scalar) -> Range { self.pad_start(start).pad_end(end) } /// Clamp the given value to the range. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert_eq!(Range::new(0.0, 5.0).clamp_value(7.0), 5.0); /// assert_eq!(Range::new(5.0, -2.5).clamp_value(-3.0), -2.5); /// assert_eq!(Range::new(5.0, 10.0).clamp_value(0.0), 5.0); /// ``` pub fn clamp_value(&self, value: Scalar) -> Scalar { ::utils::clamp(value, self.start, self.end) } /// Stretch the end that is closest to the given value only if it lies outside the Range. /// /// The resulting Range will retain the direction of the original range. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(2.5, 5.0); /// assert_eq!(a.stretch_to_value(10.0), Range::new(2.5, 10.0)); /// assert_eq!(a.stretch_to_value(0.0), Range::new(0.0, 5.0)); /// /// let b = Range::new(0.0, -5.0); /// assert_eq!(b.stretch_to_value(10.0), Range::new(10.0, -5.0)); /// assert_eq!(b.stretch_to_value(-10.0), Range::new(0.0, -10.0)); /// ``` pub fn stretch_to_value(self, value: Scalar) -> Range { let Range { start, end } = self; if start <= end { if value < start { Range { start: value, end: end } } else if value > end { Range { start: start, end: value } } else { self } } else { if value < end { Range { start: start, end: value } } else if value > start { Range { start: value, end: end } } else { self } } } /// Does `self` have the same direction as `other`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// assert!(Range::new(0.0, 1.0).has_same_direction(Range::new(100.0, 200.0))); /// assert!(Range::new(0.0, -5.0).has_same_direction(Range::new(-2.5, -6.0))); /// assert!(!Range::new(0.0, 5.0).has_same_direction(Range::new(2.5, -2.5))); /// ``` pub fn has_same_direction(self, other: Self) -> bool { let self_direction = self.start <= self.end; let other_direction = other.start <= other.end; self_direction == other_direction } /// Align the `start` of `self` to the `start` of the `other` **Range**. /// /// If the direction of `other` is different to `self`, `self`'s `end` will be aligned to the /// `start` of `other` instead. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(2.5, 7.5); /// let b = Range::new(0.0, 10.0); /// assert_eq!(a.align_start_of(b), Range::new(0.0, 5.0)); /// assert_eq!(b.align_start_of(a), Range::new(2.5, 12.5)); /// /// let c = Range::new(2.5, -2.5); /// let d = Range::new(-5.0, 5.0); /// assert_eq!(c.align_start_of(d), Range::new(0.0, -5.0)); /// assert_eq!(d.align_start_of(c), Range::new(-7.5, 2.5)); /// ``` pub fn align_start_of(self, other: Self) -> Self { let diff = if self.has_same_direction(other) { other.start - self.start } else { other.start - self.end }; self.shift(diff) } /// Align the `end` of `self` to the `end` of the `other` **Range**. /// /// If the direction of `other` is different to `self`, `self`'s `start` will be aligned to the /// `end` of `other` instead. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(2.5, 7.5); /// let b = Range::new(0.0, 10.0); /// assert_eq!(a.align_end_of(b), Range::new(5.0, 10.0)); /// assert_eq!(b.align_end_of(a), Range::new(-2.5, 7.5)); /// /// let c = Range::new(2.5, -2.5); /// let d = Range::new(-5.0, 5.0); /// assert_eq!(c.align_end_of(d), Range::new(5.0, 0.0)); /// assert_eq!(d.align_end_of(c), Range::new(-2.5, 7.5)); /// ``` pub fn align_end_of(self, other: Self) -> Self { let diff = if self.has_same_direction(other) { other.end - self.end } else { other.end - self.start }; self.shift(diff) } /// Align the middle of `self` to the middle of the `other` **Range**. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(0.0, 5.0); /// let b = Range::new(0.0, 10.0); /// assert_eq!(a.align_middle_of(b), Range::new(2.5, 7.5)); /// assert_eq!(b.align_middle_of(a), Range::new(-2.5, 7.5)); /// /// let c = Range::new(2.5, -2.5); /// let d = Range::new(-10.0, 0.0); /// assert_eq!(c.align_middle_of(d), Range::new(-2.5, -7.5)); /// assert_eq!(d.align_middle_of(c), Range::new(-5.0, 5.0)); /// ``` pub fn align_middle_of(self, other: Self) -> Self { let diff = other.middle() - self.middle(); self.shift(diff) } /// Aligns the `start` of `self` with the `end` of `other`. /// /// If the directions are opposite, aligns the `end` of self with the `end` of `other`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(2.5, 7.5); /// let b = Range::new(0.0, 10.0); /// assert_eq!(a.align_after(b), Range::new(10.0, 15.0)); /// assert_eq!(b.align_after(a), Range::new(7.5, 17.5)); /// /// let c = Range::new(2.5, -2.5); /// let d = Range::new(-5.0, 5.0); /// assert_eq!(c.align_after(d), Range::new(10.0, 5.0)); /// assert_eq!(d.align_after(c), Range::new(-12.5, -2.5)); /// ``` pub fn align_after(self, other: Self) -> Self { let diff = if self.has_same_direction(other) { other.end - self.start } else { other.end - self.end }; self.shift(diff) } /// Aligns the `end` of `self` with the `start` of `other`. /// /// If the directions are opposite, aligns the `start` of self with the `start` of `other`. /// /// # Examples /// /// ``` /// use conrod_core::Range; /// /// let a = Range::new(2.5, 7.5); /// let b = Range::new(0.0, 10.0); /// assert_eq!(a.align_before(b), Range::new(-5.0, 0.0)); /// assert_eq!(b.align_before(a), Range::new(-7.5, 2.5)); /// /// let c = Range::new(2.5, -2.5); /// let d = Range::new(-5.0, 5.0); /// assert_eq!(c.align_before(d), Range::new(-5.0, -10.0)); /// assert_eq!(d.align_before(c), Range::new(2.5, 12.5)); /// ``` pub fn align_before(self, other: Self) -> Self { let diff = if self.has_same_direction(other) { other.start - self.end } else { other.start - self.start }; self.shift(diff) } /// Align `self` to `other` along the *x* axis in accordance with the given `Align` variant. pub fn align_to(self, align: super::Align, other: Self) -> Self { match align { super::Align::Start => self.align_start_of(other), super::Align::Middle => self.align_middle_of(other), super::Align::End => self.align_end_of(other), } } /// The closest **Edge** of `self` to the given `scalar`. /// /// Returns **Start** if the distance between both **Edge**s is equal. /// /// # Examples /// /// ``` /// use conrod_core::position::{Edge, Range}; /// /// assert_eq!(Range::new(0.0, 10.0).closest_edge(4.0), Edge::Start); /// assert_eq!(Range::new(0.0, 10.0).closest_edge(7.0), Edge::End); /// assert_eq!(Range::new(0.0, 10.0).closest_edge(5.0), Edge::Start); /// ``` pub fn closest_edge(&self, scalar: Scalar) -> Edge { let Range { start, end } = *self; let start_diff = if scalar < start { start - scalar } else { scalar - start }; let end_diff = if scalar < end { end - scalar } else { scalar - end }; if start_diff <= end_diff { Edge::Start } else { Edge::End } } }
{ "pile_set_name": "Github" }
import Link from 'next/link' export default function Home() { return ( <> <ul> <li> <Link href="/b" as="/a"> <a>a</a> </Link> </li> <li> <Link href="/a" as="/b"> <a>b</a> </Link> </li> </ul> <img src="/logo.svg" width="200" /> </> ) }
{ "pile_set_name": "Github" }
<?php /** * Yaf.app Framework * * @author xudianyang<[email protected]> * @copyright Copyright (c) 2014 (http://www.phpboy.net) */ namespace Db\Sql\Predicate; class IsNotNull extends IsNull { protected $specification = '%1$s IS NOT NULL'; }
{ "pile_set_name": "Github" }
const chai = require( 'chai' ); const chaiAsPromised = require( 'chai-as-promised' ); const { Then, When, Before } = require( 'cucumber' ); const { expect } = require( 'chai' ); const { isShould } = require( '../../util/index.js' ); const BASE_SEL = '.m-global-search'; const TRIGGER_SEL = BASE_SEL + ' [data-js-hook="behavior_flyout-menu_trigger"]'; const CONTENT_SEL = BASE_SEL + ' [data-js-hook="behavior_flyout-menu_content"]'; const INPUT_SEL = BASE_SEL + ' input#m-global-search_query'; const SEARCH_SEL = BASE_SEL + ' [data-js-hook="behavior_flyout-menu_content"] .a-btn'; const SUGGEST_SEL = BASE_SEL + ' .m-global-search_content-suggestions'; const EC = protractor.ExpectedConditions; let _dom; let _nonLinkDom; chai.use( chaiAsPromised ); Before( function() { _nonLinkDom = element( by.css( '.o-footer .a-tagline' ) ); _dom = { trigger: element( by.css( TRIGGER_SEL ) ), content: element( by.css( CONTENT_SEL ) ), input: element( by.css( INPUT_SEL ) ), searchBtn: element( by.css( SEARCH_SEL ) ), suggest: element( by.css( SUGGEST_SEL ) ) }; } ); When( 'I click on the search molecule', function() { return _dom.trigger.click(); } ); When( /I enter "(.*)" in the search molecule/, async function( searchText ) { await _dom.trigger.click(); return _dom.input.sendKeys( searchText ); } ); When( 'I click off the search molecule', async function() { await _dom.trigger.click(); await browser.wait( EC.visibilityOf( _dom.input ) ); return _nonLinkDom.click(); } ); When( 'I focus on the search molecule trigger', function() { return _dom.trigger.sendKeys( protractor.Key.SPACE ); } ); When( 'I perform tab actions on the search molecule', async function() { let activeElement = await browser.driver.switchTo().activeElement(); await activeElement.sendKeys( protractor.Key.TAB ); activeElement = await browser.driver.switchTo().activeElement(); return activeElement.sendKeys( protractor.Key.TAB ); } ); Then( 'it should focus the search input field', async function() { const attributeId = await browser .driver .switchTo() .activeElement() .getAttribute( 'id' ); return expect( _dom.input.getAttribute( 'id' ) ) .to.eventually.equal( attributeId ); } ); Then( /the search molecule (should|shouldn't) have a search trigger/, async function( haveTrigger ) { let expectedCondition; if ( isShould( haveTrigger ) ) { expectedCondition = await EC.elementToBeClickable( _dom.trigger ); } else { expectedCondition = await EC.not( EC.elementToBeClickable( _dom.trigger ) ); } await browser.wait( expectedCondition ); return expect( _dom.trigger.isDisplayed() ) .to.eventually .equal( isShould( haveTrigger ) ); } ); Then( /it (should|shouldn't) have search input content/, async function( haveInput ) { await browser.sleep( 300 ); return expect( _dom.content.isDisplayed() ) .to.eventually .equal( isShould( haveInput ) ); } ); Then( 'I should navigate to search portal', async function() { const portalUrl = 'https://search.consumerfinance.gov/' + 'search?utf8=%E2%9C%93&affiliate=cfpb&query=test'; await browser.wait( EC.visibilityOf( _dom.searchBtn ) ); await _dom.searchBtn.click(); return expect( browser.getCurrentUrl() ) .to.eventually .equal( portalUrl ); } ); Then( /it (should|shouldn't) have suggested search terms/, function( haveTerms ) { return expect( _dom.suggest.isDisplayed() ) .to.eventually .equal( isShould( haveTerms ) ); } ); Then( 'should have suggested search terms', function() { return expect( _dom.suggest.isDisplayed() ) .to.eventually .equal( true ); } );
{ "pile_set_name": "Github" }
#ifndef HEADER_CURL_TELNET_H #define HEADER_CURL_TELNET_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2007, Daniel Stenberg, <[email protected]>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #ifndef CURL_DISABLE_TELNET extern const struct Curl_handler Curl_handler_telnet; #endif #endif /* HEADER_CURL_TELNET_H */
{ "pile_set_name": "Github" }
-----BEGIN RSA PRIVATE KEY----- MIIJKQIBAAKCAgEA5F2mqEsdntPAEij6HfCYnKiLMGnm6PcfsaFYeFYO1EufOjN5 ZJP90cr3CrCnN9JOAdpBbTpzA0RcIcAdWBzvNNAtIMvSfi22WJYVjzD0Bvs2rCYH 76Yc6vfx7y9zXZcanh8S/2t7B64xmxOWL4RE+f8HWTijAWlyUFDk+DuJWpQK2o0b hE4S8mX+uUl3afNW5CiPsRky1N1v4a7/J2b7cG+7pDWUcjnvmNCN84v+gSucXfKg /LiAnZgY7xih2ePEhkkIqn6kU0cVBQj1cZ7hXGRaZ/MnqZ2y+KjiuFot2saNk/v0 vjjW+xOx76qJV99LtN/1qvCYnO1RqMv2EM8WhErLcgiRrihzaz3a2GaumL30CcNi xrEXRyEjFaO/klqkpuZRHTtyUnkvhUkPUHuHn45XPxZ7a2XRyrSbFyyS0amTjQwQ CveSRiJFjK5TZ56CVGKF/DmuLSHeTY3vwi+WXVdKMYQ6Zi9jwFJo/S4TRpzp+DTS H68FrFRqE1+qIVyWQjmhWxuvPhqVkG0IT7CZ0M8lWesysyI759f5D8DhEp/KbWLD eXWCzcNSbgWGHW5JA+fCV7+8m0PqodIy5D8Lhwm2tI5dA6Qcro8X127RWVaVsN8L Izdf1THXfnZIm1fDBNUfhXapKfnFV8EvALFX2Gy8M3kZQ3slaGegILfqRKcCAwEA AQKCAgBg8z1gr1so5b7iNtFQyqcPwyIscJleiCPFdrknhWmQSXaU7+t2frnASkmt GSg0s6z4bl9ebvULCweOMJCEquwG4OZ3yPBZLzD91OHcQ60mFZq1ZQPzgvM98fud TujMb+0V+h1HoKq/rP1UV/FnxOC/vbyx7TCO1eR5Io7CsAv1D2q4NDXdaoPyssh8 gysWKP/Xpzyxs//3jPcFuhSK9taCen0QDssx31TP7KKHJgTrc8dTv0EHaZD41uym /S8hYOg7FmB+eXtr+355/76r+Qa2Aci73ugUw2WK2bA/EdHr0mWi0NGrvFfQiiD9 ncnnK15psLcMVk6EOOB1J/oUUsa8n6/lQiTJYRfFlf0hr+mbMEgdfImM2Xn4wF8Y Ovapp8Gj/XO7FVVaWW8dIVUrgyrCuOz5SW11Pb0/KFebzOQytST0S3z1j55bUl5L mDxR0rJU+fMvbdJvMgHgi6YYI1MBbSFmK7/Ue9HZaGxfUPBqXJetOgAJnuoWUqO4 AtpYbLaIiqvdIDi1xF4jDMGIoOl7CnFzU9B3PjCkX4aGdARpXqRABwFT9bpf1lWe DsEhbIg4/qTWKcA6DxIXaDhgP9eH6NDWS6WKb8L1SZ3mMytjaCxKsV6p7p9DjJR1 dwOmY0Hv7eBYhjVYUj3ybZs6dfFlIg+M5RtarlOsFhZJ9nVhEQKCAQEA/l0FHos6 k5c1726blx7zlRm9mOt+rV1nbEOSZUny++oXGyXrUYvX5NX+p8soF0Im9dCuiguQ sdKNK6DZCIayennwwEncjKWH+O9VahXxMS9RwtaRDNWJRx3SP6b2s4T1W6PVZdTd K7MlMB182ckvs67WQ2hMHNcKrTHuTddpAYSD5Lh/QYD6IdWqs6lwLAtmL7/WTkN7 XdPhzVfCXLjeBBqr7PakNM9qI7duw29QpSfnArshDmvwiuVOGVGCcm4qB1RV0sQg KQJ5nt9X5VoK2SMDR2IzYbq5I/wexiHIbr4kThaGok55lGiCNRjkane+/rSOirZX Yo0sJ3RTUrBLyQKCAQEA5dXPAYF7lAo3Xpwo0Qou9IFc0qtiFK9pAp0q81DSbDJC lkZOMm/ofzE6vF6jxja2skXccbEhIDu876m9370uRUAAmfimAdmRhUk+JzrlHXxO tFSxbyG0iCmwtCSZmiBcMfvFJ/5HepBhxbUDBIc6Pi8EOgjcQdnJYr60KJxbovK0 wr9mnwwaK7SrE+mX5vN2aOwGpG9n61ibUT1aELR9alOZ8H4SlhLtZvgP02YoOCSW BKKe44fbOk/qUlZG1D6O6/H/OMT4TMyYgaswy0QuMHTjOBXrkAmVSch5dwo0eoxx dFhn31nF9S5rBZt/PdBPR3imz7U6MoBh6/8olHFk7wKCAQEAxbOTGQxqOPDccP7t W+YouQjKvqK7URA6JIHYtXVmsLpfvzAX2Mfyw+A4ED7tKDa4hXLvVkhq7GuUYgag 6emXq24/25UNIRw/tRKAtvXbA7mduOyAzRLjoizhj6u8MAf1lIaghIeQaDjTfLRO qA+hTe1kh/v2vKu/lqIqcMIu0Ykn4owsDMOspsOl7AKUNwedIxvd+/KjXmgjJzFA 1kSx+0qnuoRxWMKl4qDeLHTGn7eF7C96H/VxfuN/clpSI5LQg+Xe1vStcnKECSHa 9V6o8+As2jzPZvR0li2N1b3IRZrwKOmFN337LYiVO6PfVYlBIENCTzoubWEAoqHd aXWxUQKCAQEAuMDYuLMnbeeQfuM1BGUVPcNHpKnUHCCtX0aMIi+UFxmH4Vj+vxiq YqRmPMovCMUus7vo6xOiN1EOHfHrChH/QfejBCKW/+GvUt9/sPVs+/jTI675OwZz IwmwW/8X4oek1SE4aV/EgcfScKWDmX5C2X3d/fDlbaHuewwlsoeOOjy0BeDqU2vd FckTxNwAGc0YIFurMz/C37LIl9OjtM4CCxjNJD+UHUN1x1IdFqiGKCtw1KUM6IZr OkLHcAyevzrSlORhb3cWylWlOocsoBlcr+MmTA2C4LRzZ25aBdEUQnbnNMlkJmz5 7o+zxDwtWrk7IY7hORLLh5EgJh9ktX85zQKCAQAZILSp21azS3KzKdAvq5u2KVAV GumDf1douO5o+5HjV2Kcf5tkzj4A1ffVZKt7auZCNURAG4jaNIccScZBz33EtCuB wvRQp5f8DN9EQH4yjaNIbPkFrKzgz5AY08n10PBm+X3cY48P27oR/IDfr2wVtCAE UufjLZCkuUjdCFD1wJSCj7LNwjZURuCTocvtaa7HEqnjW9VB4aAbdtf53WRsbYwt ZFEWVp8sYc917I6OUJFQcT7jxbv4kbUAXICLaLtaLW2bWfdRtFQSo08pmZAKxxCv 6Vu5VLZ8LGLVkpie8FEaYd/89gEsHh6HgY9LsJN7WxoaJn1sLmEtmyw9xRSW -----END RSA PRIVATE KEY-----
{ "pile_set_name": "Github" }
#if __cplusplus >= 201103L /************************************************************************ *Description: * *Author: realfan * *Date of Created: * *Date of Modified Purpose of Modify Person Name of Modify * *------------------ ---------------------- ------------------------- * * 2016-12-07 * * ************************************************************************/ #ifndef TIANCHI_TCDBPROCESS_H #define TIANCHI_TCDBPROCESS_H #include <tianchi/tcglobal.h> #include <QString> #include <QVariant> #include <QDateTime> #include <QSqlQuery> QT_BEGIN_NAMESPACE class QSqlDatabase; class QSqlQuery; QT_END_NAMESPACE class TIANCHI_API TcDBProcess { public: TcDBProcess(const QString strType = "sqlite"); //sqlite mysql access sqlserver virtual ~TcDBProcess(); bool openDB(const QString strSvrName, const QString strDBname, const QString strUserID = "", const QString strUserPwd = ""); bool openDB(const QString strDBname); void closeDB(); bool excuteSQL(const QString); void *openRecordsetBySql(const QString strSql); void closeRecordset(void *); bool isOpen() const; bool recEOF(void *p) const; bool recBOF(void *p) const; bool isTableExist(const QString strTable); bool dropTable(const QString); //QStringList GetTableNames(); //========¶ÁÈ¡================================== long getRecordCount(void *p) const; bool moveFirst(void *p) const; bool movePrevious(void *p) const; bool moveNext(void *p) const; bool moveLast(void *p) const; bool moveTo(int n, void *p) const; //bool execStoreProcOfArgList(int idx, const QString strStoreProc, const char *szFldsInfo, ...); //bool exexProc(const QString strStoreProc, QString str1, QString &str2); bool transaction(); bool commit(); bool rollback(); QString getDbName() const { return __strDbName; } public: template <typename T> bool readFieldsValueFromRec(const void *p, const QString str, T& t) const { const QSqlQuery *pQry = static_cast<const QSqlQuery *>(p); if (nullptr == pQry || false == pQry->isValid()) { return false; } t = pQry->value(str).value<T>(); return true; } template <typename T, typename ... Args> bool readFieldsValueFromRec(const void *p, const QString str, T & t, Args& ... args) const { const QSqlQuery *pQry = static_cast<const QSqlQuery *>(p); if (nullptr == pQry || false == pQry->isValid()) { return false; } t = pQry->value(str).value<T>(); bool bRet = readFieldsValueFromRec(p, args...); return bRet; } //--------------------------- private: template <typename T> void extractArg1(QStringList &lstFlds, QList<QVariant> &lstVars, const T &t) const { const QVariant var(t); if (lstFlds.size() == lstVars.size()) { lstFlds << var.toString(); } else { lstVars << var; } } public: template<typename T, typename ... Args> bool addFieldsValueToTbl(const QString &strTbl, const QString &strFld, const T &t, const Args &... args) { QStringList lstFlds; QList<QVariant> lstVars; lstFlds << strFld; lstVars.push_back(t); std::initializer_list<int> {(extractArg1(lstFlds, lstVars, args), 0)...}; //-------------------------------------- QString strFlds; QString strPlaceholders; for (const QString &str : lstFlds) { strFlds += "," + str; strPlaceholders += ",:" + str; } QString strSql = QString("INSERT INTO %1(%2) VALUES (%3)").arg(strTbl).arg(strFlds.mid(1)).arg(strPlaceholders.mid(1)); QSqlQuery qry(*m_pDB); qry.prepare(strSql); const int iCount = lstFlds.size(); for(int i = 0; i < iCount; ++i) { qry.bindValue(":" + lstFlds.at(i), lstVars.at(i)); } const bool bRet = qry.exec(); //QSqlError lastError = qry.lastError(); //QString strErr = lastError.driverText(); return bRet; } //======================================== template<typename T, typename ... Args> bool updateTblFieldsValue(const QString &strTbl, const QString &strWhere, const QString &strFld, const T &t, const Args &... args) { QStringList lstFlds; QList<QVariant> lstVars; lstFlds << strFld; lstVars << t; std::initializer_list<int> {(extractArg1(lstFlds, lstVars, args), 0)...}; //--------------------------- QString strFlds; for (const QString &str : lstFlds) { strFlds += "," + str + "=:" + str; } QString strSql = QString("UPDATE %1 SET %2 %3").arg(strTbl).arg(strFlds.mid(1)).arg(strWhere); QSqlQuery qry(*m_pDB); qry.prepare(strSql); //qDebug() << strSql; const int iCount = lstFlds.size(); for(int i = 0; i < iCount; ++i) { qry.bindValue(":" + lstFlds.at(i), lstVars.at(i)); } const bool bRet = qry.exec(); //QSqlError lastError = qry.lastError(); //QString strErr = lastError.driverText(); return bRet; } //================================================= QSqlDatabase *m_pDB; protected: bool __openMDB(const QString strMDBname, QString strUserID = "sa", const QString strPassword = ""); bool __openMDBByUDL(const QString strUDL); bool __connectSqlServer(const QString strSvrName, const QString strDBname, const QString strUserID, const QString strUserPwd); bool __openSqlite(const QString &strDbName); bool __openMySql(QString strSvrName, const QString strDBname, QString strUserID, const QString strUserPwd); private: QString __strConnName; QString __strDbType; QString __strDbName; QList<QSqlQuery *> __lstQrys; }; #endif #endif // __cplusplus >= 201103L
{ "pile_set_name": "Github" }
--- archs: [ armv7, armv7s, arm64, i386, x86_64 ] platform: ios install-name: /System/Library/PrivateFrameworks/RemoteUI.framework/RemoteUI current-version: 1 compatibility-version: 1 exports: - archs: [ armv7, armv7s, arm64, i386, x86_64 ] symbols: [ _RUIAlertCancelButtonIndex, _RUIErrorDomain, _RUIHTTPRequestErrorDomain, _RUIHTTPRequestLoadingStatusDidChangeNotification, _RUIImageLoaderDidLoadImageNotification, _RUIImageLoaderLoadingStatusDidChangeNotification, _RUIIsDebug, _RUIIsLoggingEnabled, _RUIJSObjectModel_class, _RUILog, _RUISetLoggingEnabled, _RUIWebViewDidFinishLoadNotification, _RemoteUIDefaultLeftTableMargin, _RemoteUIDetailHeaderTextColor, _RemoteUIFooterFont, _RemoteUIFooterTextColor, _RemoteUIHeaderFont, _RemoteUIHeaderTextColor, _RemoteUISubheaderFont, _buttonClass, _datePickerClass, _editableTextClass, _htmlButtonClass, _htmlClassPrefix, _htmlLabelClass, _htmlLinkClass, _labelClass, _linkClass, _linkedOptionClass, _numberPickerClass, _photoPickerClass, _selectClass, _selectPageClass, _switchClass ] objc-classes: [ _RUIAlertButton, _RUIAlertView, _RUIBarButtonItem, _RUIBarButtonSpinnerView, _RUIElement, _RUIFooterElement, _RUIFrontRowStyle, _RUIHTMLFooterElement, _RUIHTMLFooterView, _RUIHTMLHeaderElement, _RUIHTMLHeaderView, _RUIHTTPRequest, _RUIHeaderElement, _RUIHeaderView, _RUIImageLoad, _RUIImageLoader, _RUILoader, _RUINavBarSpinnerManager, _RUINavigationController, _RUIObjectModel, _RUIPage, _RUIParser, _RUIPasscodeView, _RUIPhotoPicker, _RUIPlatform, _RUISelectOption, _RUISetupAssistantModalStyle, _RUISetupAssistantStyle, _RUISpinnerRecord, _RUISpinnerView, _RUIStyle, _RUITableView, _RUITableViewRow, _RUITableViewSection, _RUIVariableHeightCell, _RUIWebContainerView, _RUIWebView, _RemoteUIController, _RemoteUILinkFooter, _RemoteUISectionFooter, _RemoteUITableViewCell, _RemoteUITableViewSubtitleAndValueCell, _RemoteUITableViewSubtitleAndValueLayoutManager, _RemoteUIWebViewController ] objc-ivars: [ _RUIAlertView._alertController, _RUIAlertView._buttonIndex, _RUIAlertView._completion, _RUIAlertView._message, _RUIAlertView._objectModel, _RUIAlertView._title, _RUIBarButtonSpinnerView._spinner, _RUIElement._attributes, _RUIElement._enabled, _RUIElement._identifier, _RUIElement._parent, _RUIElement._style, _RUIFooterElement._linkURL, _RUIFooterElement._text, _RUIHTMLFooterElement._HTMLContent, _RUIHTMLFooterView._baseURL, _RUIHTMLFooterView._delegate, _RUIHTMLFooterView._webContainerView, _RUIHTMLHeaderElement._HTMLContent, _RUIHTMLHeaderView._baseURL, _RUIHTMLHeaderView._delegate, _RUIHTMLHeaderView._isFirstSection, _RUIHTMLHeaderView._webContainerView, _RUIHTTPRequest._dataTask, _RUIHTTPRequest._delegate, _RUIHTTPRequest._request, _RUIHTTPRequest._urlSession, _RUIHeaderElement._text, _RUIHeaderView._customIconSize, _RUIHeaderView._detailHeaderLabel, _RUIHeaderView._headerLabel, _RUIHeaderView._headerLabelBottomPadding, _RUIHeaderView._iconView, _RUIHeaderView._imageAlignment, _RUIHeaderView._isFirstSection, _RUIHeaderView._margins, _RUIHeaderView._subHeaderLabel, _RUIImageLoad._URL, _RUIImageLoad._dataTask, _RUIImageLoad._urlSession, _RUIImageLoader._cacheLock, _RUIImageLoader._imageCache, _RUIImageLoader._imageCacheLRU, _RUIImageLoader._loadCompletions, _RUIImageLoader._loadQueue, _RUIImageLoader._loadStatusNotificationTimer, _RUIImageLoader._loaderRunLoop, _RUIImageLoader._loaderSource, _RUIImageLoader._loadsInProgress, _RUIImageLoader._notificationCenter, _RUIImageLoader._queueLock, _RUIImageLoader._startupCondition, _RUIImageLoader._startupLock, _RUILoader._allowNonSecureHTTP, _RUILoader._parser, _RUILoader._parserDelegate, _RUILoader._style, _RUILoader._url, _RUINavBarSpinnerManager._activityIndicatorViewStyle, _RUINavBarSpinnerManager._savedRecords, _RUINavigationController._menuDismissalHandler, _RUINavigationController._ruiSupportedInterfaceOrientations, _RUIObjectModel._alert, _RUIObjectModel._authPasswordEquivalent, _RUIObjectModel._authPasswordFieldID, _RUIObjectModel._clientInfo, _RUIObjectModel._ctx, _RUIObjectModel._currentPage, _RUIObjectModel._defaultPages, _RUIObjectModel._delegate, _RUIObjectModel._displayedPages, _RUIObjectModel._httpHeaders, _RUIObjectModel._identifier, _RUIObjectModel._identifierMarkingStackRemovalAfterPush, _RUIObjectModel._inlineScript, _RUIObjectModel._name, _RUIObjectModel._namedAlerts, _RUIObjectModel._namedPages, _RUIObjectModel._nextButtonStyle, _RUIObjectModel._primaryAlert, _RUIObjectModel._refreshDelay, _RUIObjectModel._refreshTimer, _RUIObjectModel._refreshURL, _RUIObjectModel._scriptURL, _RUIObjectModel._serverInfo, _RUIObjectModel._sourceURL, _RUIObjectModel._style, _RUIObjectModel._updateInfo, _RUIObjectModel._validationFunction, _RUIPage._backButtonTitle, _RUIPage._childPages, _RUIPage._containerView, _RUIPage._customEdgeInsets, _RUIPage._customMargin, _RUIPage._didAppearCallbacks, _RUIPage._hidesBackButton, _RUIPage._leftFlexSpace, _RUIPage._leftNavigationBarButtonItem, _RUIPage._leftToolbarButtonItem, _RUIPage._leftToolbarItem, _RUIPage._loading, _RUIPage._loadingIndicatorStyle, _RUIPage._loadingTitle, _RUIPage._middleFlexSpace, _RUIPage._middleToolbarButtonItem, _RUIPage._middleToolbarItem, _RUIPage._navTitle, _RUIPage._objectModel, _RUIPage._pageID, _RUIPage._parentPage, _RUIPage._passcodeViewOM, _RUIPage._primaryElement, _RUIPage._rightNavigationBarButtonItem, _RUIPage._rightToolbarButtonItem, _RUIPage._rightToolbarItem, _RUIPage._showsTitlesAsHeaderViews, _RUIPage._spinnerViewOM, _RUIPage._style, _RUIPage._tableViewOM, _RUIPage._titleLabelPadding, _RUIPage._toolbar, _RUIPage._validationFunction, _RUIPage._webViewOM, _RUIParser._accumulator, _RUIParser._actionSignal, _RUIParser._baseURL, _RUIParser._currentAlert, _RUIParser._currentElementAttributes, _RUIParser._currentPageStack, _RUIParser._delegate, _RUIParser._elementStack, _RUIParser._pages, _RUIParser._parser, _RUIParser._parserState, _RUIParser._succeeded, _RUIParser._uiObjectModel, _RUIParser._xmlData, _RUIPasscodeView._appeared, _RUIPasscodeView._complexPasscodeField, _RUIPasscodeView._containerView, _RUIPasscodeView._footer, _RUIPasscodeView._footerView, _RUIPasscodeView._foregroundColor, _RUIPasscodeView._header, _RUIPasscodeView._headerTitle, _RUIPasscodeView._headerView, _RUIPasscodeView._keyboardAppearance, _RUIPasscodeView._numberOfEntryFields, _RUIPasscodeView._objectModel, _RUIPasscodeView._page, _RUIPasscodeView._passcodeField, _RUIPasscodeView._passcodeValidationAttempts, _RUIPasscodeView._pendingAutoFillToken, _RUIPasscodeView._submittedPIN, _RUIPasscodeView._titleLabel, _RUIPhotoPicker._imagePickerController, _RUIPhotoPicker._pickedImage, _RUIPhotoPicker._pickerCompletion, _RUISelectOption._label, _RUISelectOption._value, _RUISpinnerRecord._leftItems, _RUISpinnerRecord._navigationItem, _RUISpinnerRecord._rightItems, _RUISpinnerRecord._title, _RUISpinnerView._label, _RUISpinnerView._objectModel, _RUISpinnerView._spinner, _RUISpinnerView._spinnerColor, _RUISpinnerView._view, _RUIStyle._backgroundColor, _RUIStyle._buttonRowTextColor, _RUIStyle._radioGroupSelectedColor, _RUIStyle._selectPageDetailTextColor, _RUITableView._datePicker, _RUITableView._defaultFirstResponderRow, _RUITableView._embeddedPickerRowIndexPath, _RUITableView._footerViewAttributes, _RUITableView._fullscreenCellHeight, _RUITableView._headerAttributes, _RUITableView._headerText, _RUITableView._lastLayoutWidth, _RUITableView._objectModel, _RUITableView._oldLeftBarButtonItemForPicker, _RUITableView._oldPickerDate, _RUITableView._oldRightBarButtonItemForPicker, _RUITableView._photoPicker, _RUITableView._pickerBackdrop, _RUITableView._pickerRowIndexPath, _RUITableView._registeredForNotifications, _RUITableView._sections, _RUITableView._selectPicker, _RUITableView._showDatePicker, _RUITableView._showSelectPicker, _RUITableView._showingPickerNavBarButtons, _RUITableView._subHeaderAttributes, _RUITableView._subHeaderText, _RUITableView._tableView, _RUITableViewRow._alignment, _RUITableViewRow._cachedHeight, _RUITableViewRow._configured, _RUITableViewRow._data, _RUITableViewRow._date, _RUITableViewRow._dateMax, _RUITableViewRow._dateMin, _RUITableViewRow._datePickerMode, _RUITableViewRow._delegate, _RUITableViewRow._deleteAction, _RUITableViewRow._height, _RUITableViewRow._pickerView, _RUITableViewRow._rowInvalid, _RUITableViewRow._selectOptions, _RUITableViewRow._selected, _RUITableViewRow._selectedRow, _RUITableViewRow._switchControl, _RUITableViewRow._switchValue, _RUITableViewRow._tableCell, _RUITableViewRow._textFieldChangeObserver, _RUITableViewRow._webContainerView, _RUITableViewSection._HTMLFooterContent, _RUITableViewSection._HTMLHeaderContent, _RUITableViewSection._configured, _RUITableViewSection._delegate, _RUITableViewSection._detailHeaderText, _RUITableViewSection._disclosureLimit, _RUITableViewSection._drawsTopSeparator, _RUITableViewSection._footerAttributes, _RUITableViewSection._footerHeight, _RUITableViewSection._footerText, _RUITableViewSection._footerView, _RUITableViewSection._headerAttributes, _RUITableViewSection._headerHeight, _RUITableViewSection._headerText, _RUITableViewSection._headerView, _RUITableViewSection._rows, _RUITableViewSection._showAllRow, _RUITableViewSection._subHeaderAttributes, _RUITableViewSection._subHeaderText, _RUIVariableHeightCell._supportsAccessory, _RUIWebContainerView._delegate, _RUIWebContainerView._highlighted, _RUIWebContainerView._reallyHighlighted, _RUIWebContainerView._webView, _RUIWebView._baseURL, _RUIWebView._delegate, _RUIWebView._html, _RUIWebView._webView, _RemoteUIController._SMSAutoFillToken, _RemoteUIController._delegate, _RemoteUIController._elementChangeHandlers, _RemoteUIController._hostViewController, _RemoteUIController._listeningForSMSIdentifier, _RemoteUIController._loadCompletion, _RemoteUIController._loader, _RemoteUIController._modalNavigationController, _RemoteUIController._modalObjectModels, _RemoteUIController._objectModels, _RemoteUIController._pageOriginatingLoad, _RemoteUIController._sessionConfiguration, _RemoteUIController._style, _RemoteUIController._userAgentString, _RemoteUISectionFooter._delegate, _RemoteUISectionFooter._linkButton, _RemoteUISectionFooter._linkURL, _RemoteUISectionFooter._textAlignment, _RemoteUISectionFooter._textLabel, _RemoteUISectionFooter._usesCustomTextAlignment, _RemoteUITableViewCell._accessoryColor, _RemoteUITableViewCell._detailLinkButton, _RemoteUITableViewCell._detailLinkHandler, _RemoteUITableViewCell._forceFullSizeDetailLabel, _RemoteUITableViewCell._invalidRowView, _RemoteUITableViewCell._leftAlignDetailLabel, _RemoteUITableViewCell._remoteUIAccessoryType, _RemoteUITableViewCell._remoteUIAccessoryView, _RemoteUITableViewSubtitleAndValueCell._valueLabel, _RemoteUIWebViewController._delegate, _RemoteUIWebViewController._loadCompletion, _RemoteUIWebViewController._scalesPageToFit, _RemoteUIWebViewController._statusBarBackdrop, _RemoteUIWebViewController._toolbar, _RemoteUIWebViewController._webView ] ...
{ "pile_set_name": "Github" }
<h1 style="background-color:#272b34; color: #dee3ec;">Peacocks In Space</h1> <pre style="font-family:Monaco, monospace; padding:2em; background-color: #2b303b; color: #dee3ec;"> &lt;?php <span style="color: #26A6A6;">namespace</span> Illuminate\Container; <span style="color: #26A6A6;">use</span> Closure; <span style="color: #26A6A6;">use</span> ArrayAccess; <span style="color: #6e7a94;">/** * Theme: Peacocks In Space * Peacocks In Space * * Copyright (c) 2014 Dayle Rees */</span> <span style="color: #26A6A6;">class</span> Container <span style="color: #FF5D38;">implements</span> ArrayAccess { <span style="color: #6e7a94;">/** * An array of the types that have been resolved. * * <span style="color: #8998b9;">@var</span> array */</span> <span style="color: #FF5D38;">protected</span> <span style="color: ;">$resolved</span> <span style="color: #26A6A6;">=</span> <span style="color: #FF5D38;">array</span>(); <span style="color: #6e7a94;">/** * Determine if a given type is shared. * * <span style="color: #8998b9;">@param</span> string $abstract * <span style="color: #8998b9;">@return</span> bool */</span> <span style="color: #FF5D38;">public</span> <span style="color: #26A6A6;">function</span> <span style="color: #BCD42A;">isShared</span>(<span style="color: ;">$abstract</span>) { <span style="color: #26A6A6;">if</span> (<span style="color: #FF5D38;">isset</span>(<span style="color: ;">$this</span><span style="color: #26A6A6;">-></span><span style="color: ;">bindings</span>[<span style="color: ;">$abstract</span>][<span style="color: #BCD42A;">'shared'</span>])) { <span style="color: ;">$shared</span> <span style="color: #26A6A6;">=</span> <span style="color: ;">$this</span><span style="color: #26A6A6;">-></span><span style="color: ;">bindings</span>[<span style="color: ;">$abstract</span>][<span style="color: #BCD42A;">'shared'</span>]; } <span style="color: #26A6A6;">else</span> { <span style="color: ;">$shared</span> <span style="color: #26A6A6;">=</span> <span style="color: #FF5D38;">false</span>; } <span style="color: #26A6A6;">return</span> <span style="color: #FF5D38;">isset</span>(<span style="color: ;">$this</span><span style="color: #26A6A6;">-></span><span style="color: ;">instances</span>[<span style="color: ;">$abstract</span>]) <span style="color: #26A6A6;">||</span> <span style="color: ;">$shared</span> <span style="color: #26A6A6;">===</span> <span style="color: #FF5D38;">true</span>; } } </pre>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> <head> <title>Page 1005</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> <!-- p {margin: 0; padding: 0;} .ft00{font-size:9px;font-family:Times;color:#000000;} .ft01{font-size:11px;font-family:Times;color:#0860a8;} .ft02{font-size:16px;font-family:Times;color:#0860a8;} .ft03{font-size:12px;font-family:Times;color:#0860a8;} .ft04{font-size:11px;font-family:Times;color:#000000;} .ft05{font-size:11px;line-height:16px;font-family:Times;color:#000000;} .ft06{font-size:11px;line-height:22px;font-family:Times;color:#000000;} --> </style> </head> <body bgcolor="#A0A0A0" vlink="blue" link="blue"> <div id="page1005-div" style="position:relative;width:918px;height:1188px;"> <img width="918" height="1188" src="o_b5573232dd8f14811005.png" alt="background image"/> <p style="position:absolute;top:1103px;left:68px;white-space:nowrap" class="ft00">PMINSD/PMINSQ—Minimum of&#160;Packed&#160;Signed&#160;Integers</p> <p style="position:absolute;top:47px;left:635px;white-space:nowrap" class="ft01">INSTRUCTION SET REFERENCE,&#160;M-U</p> <p style="position:absolute;top:1103px;left:763px;white-space:nowrap" class="ft00">Vol. 2B&#160;4-325</p> <p style="position:absolute;top:98px;left:69px;white-space:nowrap" class="ft02">PMINSD/PMINSQ—Minimum of&#160;Packed Signed Integers</p> <p style="position:absolute;top:788px;left:354px;white-space:nowrap" class="ft03">Instruction Operand&#160;Encoding</p> <p style="position:absolute;top:921px;left:69px;white-space:nowrap" class="ft01">Description</p> <p style="position:absolute;top:943px;left:69px;white-space:nowrap" class="ft05">Performs a&#160;SIMD compare&#160;of the packed&#160;signed&#160;dword or qword&#160;integers&#160;in&#160;the second source operand and the first&#160;<br/>source operand&#160;and returns&#160;the minimum&#160;value&#160;for each&#160;pair of integers to&#160;the destination operand.&#160;<br/>128-bit Legacy&#160;SSE version: The&#160;first source&#160;and destination&#160;operands are&#160;XMM registers. The second source&#160;<br/>operand&#160;is&#160;an XMM&#160;register&#160;or a&#160;128-bit&#160;memory location.&#160;Bits (MAX_VL-1:128) of&#160;the corresponding destination&#160;<br/>register remain unchanged.</p> <p style="position:absolute;top:123px;left:78px;white-space:nowrap" class="ft04">Opcode/</p> <p style="position:absolute;top:137px;left:78px;white-space:nowrap" class="ft04">Instruction</p> <p style="position:absolute;top:123px;left:314px;white-space:nowrap" class="ft04">Op/</p> <p style="position:absolute;top:137px;left:314px;white-space:nowrap" class="ft04">En</p> <p style="position:absolute;top:123px;left:359px;white-space:nowrap" class="ft04">64/32&#160;</p> <p style="position:absolute;top:137px;left:359px;white-space:nowrap" class="ft04">bit Mode&#160;</p> <p style="position:absolute;top:153px;left:359px;white-space:nowrap" class="ft04">Support</p> <p style="position:absolute;top:123px;left:430px;white-space:nowrap" class="ft04">CPUID&#160;</p> <p style="position:absolute;top:137px;left:430px;white-space:nowrap" class="ft04">Feature&#160;</p> <p style="position:absolute;top:153px;left:430px;white-space:nowrap" class="ft04">Flag</p> <p style="position:absolute;top:123px;left:513px;white-space:nowrap" class="ft04">Description</p> <p style="position:absolute;top:172px;left:78px;white-space:nowrap" class="ft04">66&#160;0F&#160;38 39&#160;/r</p> <p style="position:absolute;top:172px;left:314px;white-space:nowrap" class="ft04">RM</p> <p style="position:absolute;top:172px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:172px;left:430px;white-space:nowrap" class="ft04">SSE4_1</p> <p style="position:absolute;top:172px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;dword integers&#160;in&#160;xmm1&#160;and&#160;</p> <p style="position:absolute;top:189px;left:513px;white-space:nowrap" class="ft04">xmm2/m128 and&#160;store packed&#160;minimum values&#160;in&#160;</p> <p style="position:absolute;top:205px;left:513px;white-space:nowrap" class="ft04">xmm1.</p> <p style="position:absolute;top:191px;left:78px;white-space:nowrap" class="ft04">PMINSD&#160;xmm1, xmm2/m128</p> <p style="position:absolute;top:227px;left:78px;white-space:nowrap" class="ft04">VEX.NDS.128.66.0F38.WIG&#160;39 /r</p> <p style="position:absolute;top:227px;left:314px;white-space:nowrap" class="ft04">RVM</p> <p style="position:absolute;top:227px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:227px;left:430px;white-space:nowrap" class="ft04">AVX</p> <p style="position:absolute;top:227px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;dword integers&#160;in&#160;xmm2&#160;and&#160;</p> <p style="position:absolute;top:244px;left:513px;white-space:nowrap" class="ft04">xmm3/m128 and&#160;store packed&#160;minimum values&#160;in&#160;</p> <p style="position:absolute;top:261px;left:513px;white-space:nowrap" class="ft04">xmm1.</p> <p style="position:absolute;top:247px;left:78px;white-space:nowrap" class="ft04">VPMINSD xmm1, xmm2, xmm3/m128</p> <p style="position:absolute;top:283px;left:78px;white-space:nowrap" class="ft04">VEX.NDS.256.66.0F38.WIG&#160;39 /r</p> <p style="position:absolute;top:283px;left:314px;white-space:nowrap" class="ft04">RVM</p> <p style="position:absolute;top:283px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:283px;left:430px;white-space:nowrap" class="ft04">AVX2</p> <p style="position:absolute;top:283px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;dword integers&#160;in&#160;ymm2&#160;and&#160;</p> <p style="position:absolute;top:299px;left:513px;white-space:nowrap" class="ft04">ymm3/m128&#160;and store packed&#160;minimum&#160;values&#160;in&#160;</p> <p style="position:absolute;top:316px;left:513px;white-space:nowrap" class="ft04">ymm1.</p> <p style="position:absolute;top:303px;left:78px;white-space:nowrap" class="ft04">VPMINSD ymm1, ymm2, ymm3/m256</p> <p style="position:absolute;top:339px;left:78px;white-space:nowrap" class="ft04">EVEX.NDS.128.66.0F38.W0&#160;39&#160;/r</p> <p style="position:absolute;top:339px;left:314px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:339px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:339px;left:430px;white-space:nowrap" class="ft04">AVX512VL</p> <p style="position:absolute;top:339px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;dword&#160;integers&#160;in&#160;xmm2&#160;and&#160;</p> <p style="position:absolute;top:355px;left:513px;white-space:nowrap" class="ft04">xmm3/m128 and&#160;store packed&#160;minimum values&#160;in&#160;</p> <p style="position:absolute;top:371px;left:513px;white-space:nowrap" class="ft04">xmm1&#160;under writemask k1.</p> <p style="position:absolute;top:358px;left:78px;white-space:nowrap" class="ft04">VPMINSD xmm1 {k1}{z}, xmm2,&#160;</p> <p style="position:absolute;top:375px;left:78px;white-space:nowrap" class="ft04">xmm3/m128/m32bcst</p> <p style="position:absolute;top:358px;left:430px;white-space:nowrap" class="ft04">AVX512F</p> <p style="position:absolute;top:411px;left:78px;white-space:nowrap" class="ft04">EVEX.NDS.256.66.0F38.W0&#160;39&#160;/r</p> <p style="position:absolute;top:411px;left:314px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:411px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:411px;left:430px;white-space:nowrap" class="ft04">AVX512VL</p> <p style="position:absolute;top:411px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;dword&#160;integers&#160;in&#160;ymm2&#160;and&#160;</p> <p style="position:absolute;top:427px;left:513px;white-space:nowrap" class="ft04">ymm3/m256&#160;and store packed&#160;minimum&#160;values&#160;in&#160;</p> <p style="position:absolute;top:444px;left:513px;white-space:nowrap" class="ft04">ymm1&#160;under&#160;writemask k1.</p> <p style="position:absolute;top:430px;left:78px;white-space:nowrap" class="ft04">VPMINSD ymm1 {k1}{z}, ymm2,&#160;</p> <p style="position:absolute;top:447px;left:78px;white-space:nowrap" class="ft04">ymm3/m256/m32bcst</p> <p style="position:absolute;top:430px;left:430px;white-space:nowrap" class="ft04">AVX512F</p> <p style="position:absolute;top:483px;left:78px;white-space:nowrap" class="ft04">EVEX.NDS.512.66.0F38.W0&#160;39&#160;/r</p> <p style="position:absolute;top:483px;left:314px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:483px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:483px;left:430px;white-space:nowrap" class="ft04">AVX512F</p> <p style="position:absolute;top:483px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;dword&#160;integers&#160;in&#160;zmm2&#160;and&#160;</p> <p style="position:absolute;top:499px;left:513px;white-space:nowrap" class="ft04">zmm3/m512/m32bcst and store packed&#160;minimum&#160;</p> <p style="position:absolute;top:516px;left:513px;white-space:nowrap" class="ft04">values&#160;in&#160;zmm1 under writemask k1.</p> <p style="position:absolute;top:502px;left:78px;white-space:nowrap" class="ft04">VPMINSD zmm1 {k1}{z},&#160;zmm2,&#160;</p> <p style="position:absolute;top:519px;left:78px;white-space:nowrap" class="ft04">zmm3/m512/m32bcst</p> <p style="position:absolute;top:555px;left:78px;white-space:nowrap" class="ft04">EVEX.NDS.128.66.0F38.W1&#160;39&#160;/r</p> <p style="position:absolute;top:555px;left:314px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:555px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:555px;left:430px;white-space:nowrap" class="ft04">AVX512VL</p> <p style="position:absolute;top:555px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;qword&#160;integers&#160;in&#160;xmm2&#160;and&#160;</p> <p style="position:absolute;top:571px;left:513px;white-space:nowrap" class="ft04">xmm3/m128 and&#160;store packed&#160;minimum values&#160;in&#160;</p> <p style="position:absolute;top:588px;left:513px;white-space:nowrap" class="ft04">xmm1&#160;under writemask k1.</p> <p style="position:absolute;top:574px;left:78px;white-space:nowrap" class="ft04">VPMINSQ xmm1 {k1}{z},&#160;xmm2,&#160;</p> <p style="position:absolute;top:591px;left:78px;white-space:nowrap" class="ft04">xmm3/m128/m64bcst</p> <p style="position:absolute;top:574px;left:430px;white-space:nowrap" class="ft04">AVX512F</p> <p style="position:absolute;top:627px;left:78px;white-space:nowrap" class="ft04">EVEX.NDS.256.66.0F38.W1&#160;39&#160;/r</p> <p style="position:absolute;top:627px;left:314px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:627px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:627px;left:430px;white-space:nowrap" class="ft04">AVX512VL</p> <p style="position:absolute;top:627px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;qword&#160;integers&#160;in&#160;ymm2&#160;and&#160;</p> <p style="position:absolute;top:643px;left:513px;white-space:nowrap" class="ft04">ymm3/m256&#160;and store packed&#160;minimum&#160;values&#160;in&#160;</p> <p style="position:absolute;top:660px;left:513px;white-space:nowrap" class="ft04">ymm1&#160;under&#160;writemask k1.</p> <p style="position:absolute;top:646px;left:78px;white-space:nowrap" class="ft04">VPMINSQ ymm1&#160;{k1}{z},&#160;ymm2,&#160;</p> <p style="position:absolute;top:663px;left:78px;white-space:nowrap" class="ft04">ymm3/m256/m64bcst</p> <p style="position:absolute;top:646px;left:430px;white-space:nowrap" class="ft04">AVX512F</p> <p style="position:absolute;top:699px;left:78px;white-space:nowrap" class="ft04">EVEX.NDS.512.66.0F38.W1&#160;39&#160;/r</p> <p style="position:absolute;top:699px;left:314px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:699px;left:359px;white-space:nowrap" class="ft04">V/V</p> <p style="position:absolute;top:699px;left:430px;white-space:nowrap" class="ft04">AVX512F</p> <p style="position:absolute;top:699px;left:513px;white-space:nowrap" class="ft04">Compare&#160;packed&#160;signed&#160;qword&#160;integers&#160;in&#160;zmm2&#160;and&#160;</p> <p style="position:absolute;top:715px;left:513px;white-space:nowrap" class="ft04">zmm3/m512/m64bcst and store packed&#160;minimum&#160;</p> <p style="position:absolute;top:732px;left:513px;white-space:nowrap" class="ft04">values&#160;in&#160;zmm1 under writemask k1.</p> <p style="position:absolute;top:718px;left:78px;white-space:nowrap" class="ft04">VPMINSQ zmm1 {k1}{z},&#160;zmm2,&#160;</p> <p style="position:absolute;top:735px;left:78px;white-space:nowrap" class="ft04">zmm3/m512/m64bcst</p> <p style="position:absolute;top:811px;left:105px;white-space:nowrap" class="ft04">Op/En</p> <p style="position:absolute;top:811px;left:222px;white-space:nowrap" class="ft04">Operand&#160;1</p> <p style="position:absolute;top:811px;left:388px;white-space:nowrap" class="ft04">Operand&#160;2</p> <p style="position:absolute;top:811px;left:557px;white-space:nowrap" class="ft04">Operand&#160;3</p> <p style="position:absolute;top:811px;left:722px;white-space:nowrap" class="ft04">Operand&#160;4</p> <p style="position:absolute;top:835px;left:113px;white-space:nowrap" class="ft04">RM</p> <p style="position:absolute;top:835px;left:204px;white-space:nowrap" class="ft04">ModRM:reg (r, w)</p> <p style="position:absolute;top:835px;left:377px;white-space:nowrap" class="ft04">ModRM:r/m (r)</p> <p style="position:absolute;top:835px;left:578px;white-space:nowrap" class="ft04">NA</p> <p style="position:absolute;top:835px;left:744px;white-space:nowrap" class="ft04">NA</p> <p style="position:absolute;top:859px;left:109px;white-space:nowrap" class="ft04">RVM</p> <p style="position:absolute;top:859px;left:209px;white-space:nowrap" class="ft04">ModRM:reg (w)</p> <p style="position:absolute;top:859px;left:382px;white-space:nowrap" class="ft04">VEX.vvvv (r)</p> <p style="position:absolute;top:859px;left:547px;white-space:nowrap" class="ft04">ModRM:r/m (r)</p> <p style="position:absolute;top:859px;left:744px;white-space:nowrap" class="ft04">NA</p> <p style="position:absolute;top:883px;left:114px;white-space:nowrap" class="ft04">FV</p> <p style="position:absolute;top:883px;left:209px;white-space:nowrap" class="ft04">ModRM:reg (w)</p> <p style="position:absolute;top:883px;left:379px;white-space:nowrap" class="ft04">EVEX.vvvv&#160;(r)</p> <p style="position:absolute;top:883px;left:547px;white-space:nowrap" class="ft04">ModRM:r/m&#160;(r)</p> <p style="position:absolute;top:883px;left:743px;white-space:nowrap" class="ft04">NA</p> </div> </body> </html>
{ "pile_set_name": "Github" }
(**************************************************************************) (* Lablgtk - Examples *) (* *) (* There is no specific licensing policy, but you may freely *) (* take inspiration from the code, and copy parts of it in your *) (* application. *) (* *) (**************************************************************************) (* $Id: radiobuttons.ml 1347 2007-06-20 07:40:34Z guesdon $ *) open GMain let main () = let window = GWindow.window ~title: "radio buttons" ~border_width: 0 () in window#connect#destroy ~callback:Main.quit; let box1 = GPack.vbox ~packing: window#add () in let box2 = GPack.vbox ~spacing:10 ~border_width: 10 ~packing: box1#add () in let button1 = GButton.radio_button ~label:"button1" ~packing: box2#add () in button1#connect#clicked ~callback:(fun () -> prerr_endline "button1"); let button2 = GButton.radio_button ~group:button1#group ~label:"button2" ~active:true ~packing: box2#add () in button2#connect#clicked ~callback:(fun () -> prerr_endline "button2"); let button3 = GButton.radio_button ~group:button1#group ~label:"button3" ~packing: box2#add () in button3#connect#clicked ~callback:(fun () -> prerr_endline "button3"); let separator = GMisc.separator `HORIZONTAL ~packing: box1#pack () in let box3 = GPack.vbox ~spacing: 10 ~border_width: 10 ~packing: box1#pack () in let button = GButton.button ~label: "close" ~packing: box3#add () in button#connect#clicked ~callback:Main.quit; button#grab_default (); window#show (); Main.main () let _ = main ()
{ "pile_set_name": "Github" }
#include "parent_header.h" #include "cycling_header_1.h" int main() { return 0; }
{ "pile_set_name": "Github" }
var baseSortedIndex = require('./_baseSortedIndex'); /** * Uses a binary search to determine the lowest index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); } module.exports = sortedIndex;
{ "pile_set_name": "Github" }
import Reflux from 'reflux'; import { CheckListStoreMixin, StoreLoadingMixin, WaitForStoreMixin } from '../../mixins'; import Actions from './AdminsActions'; import SessionStore from '../Session/SessionStore'; import SessionActions from '../Session/SessionActions'; import AdminsInvitationsStore from './AdminsInvitationsStore'; import AdminsInvitationsActions from './AdminsInvitationsActions'; export default Reflux.createStore({ listenables: Actions, mixins: [ Reflux.connect(AdminsInvitationsStore), CheckListStoreMixin, StoreLoadingMixin, WaitForStoreMixin ], getInitialState() { return { items: [], isLoading: true }; }, init() { this.data = this.getInitialState(); this.waitFor( SessionActions.setUser, SessionActions.setInstance, this.refreshData ); this.setLoadingStates(); }, refreshData() { Actions.fetchAdmins(); AdminsInvitationsActions.fetchInvitations(); }, setAdmins(items) { this.data.items = items; this.trigger(this.data); }, onSelectAll() { this.data.items.forEach((item) => { const instanceOwnerId = SessionStore.getInstance().owner.id; if (item.id !== instanceOwnerId) { item.checked = true; } this.trigger(this.data); }); }, onFetchAdminsCompleted(items) { Actions.setAdmins(items); }, onRemoveAdminsCompleted() { this.refreshData(); } });
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2007 Tobias Schwinger Use modification and distribution are subject to 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). ==============================================================================*/ #ifndef BOOST_FUNCTIONAL_FACTORY_HPP_INCLUDED # ifndef BOOST_PP_IS_ITERATING # include <boost/preprocessor/iteration/iterate.hpp> # include <boost/preprocessor/repetition/enum_params.hpp> # include <boost/preprocessor/repetition/enum_binary_params.hpp> # include <new> # include <boost/pointee.hpp> # include <boost/none_t.hpp> # include <boost/get_pointer.hpp> # include <boost/non_type.hpp> # include <boost/type_traits/remove_cv.hpp> # ifndef BOOST_FUNCTIONAL_FACTORY_MAX_ARITY # define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 10 # elif BOOST_FUNCTIONAL_FACTORY_MAX_ARITY < 3 # undef BOOST_FUNCTIONAL_FACTORY_MAX_ARITY # define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 3 # endif namespace boost { enum factory_alloc_propagation { factory_alloc_for_pointee_and_deleter, factory_passes_alloc_to_smart_pointer }; template< typename Pointer, class Allocator = boost::none_t, factory_alloc_propagation AP = factory_alloc_for_pointee_and_deleter > class factory; //----- ---- --- -- - - - - template< typename Pointer, factory_alloc_propagation AP > class factory<Pointer, boost::none_t, AP> { public: typedef typename boost::remove_cv<Pointer>::type result_type; typedef typename boost::pointee<result_type>::type value_type; factory() { } # define BOOST_PP_FILENAME_1 <boost/functional/factory.hpp> # define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_FACTORY_MAX_ARITY) # include BOOST_PP_ITERATE() }; template< class Pointer, class Allocator, factory_alloc_propagation AP > class factory : private Allocator::template rebind< typename boost::pointee< typename boost::remove_cv<Pointer>::type >::type >::other { public: typedef typename boost::remove_cv<Pointer>::type result_type; typedef typename boost::pointee<result_type>::type value_type; typedef typename Allocator::template rebind<value_type>::other allocator_type; explicit factory(allocator_type const & a = allocator_type()) : allocator_type(a) { } private: struct deleter : allocator_type { inline deleter(allocator_type const& that) : allocator_type(that) { } allocator_type& get_allocator() const { return *const_cast<allocator_type*>( static_cast<allocator_type const*>(this)); } void operator()(value_type* ptr) const { if (!! ptr) ptr->~value_type(); const_cast<allocator_type*>(static_cast<allocator_type const*>( this))->deallocate(ptr,1); } }; inline allocator_type& get_allocator() const { return *const_cast<allocator_type*>( static_cast<allocator_type const*>(this)); } inline result_type make_pointer(value_type* ptr, boost::non_type< factory_alloc_propagation,factory_passes_alloc_to_smart_pointer>) const { return result_type(ptr,deleter(this->get_allocator())); } inline result_type make_pointer(value_type* ptr, boost::non_type< factory_alloc_propagation,factory_alloc_for_pointee_and_deleter>) const { return result_type(ptr,deleter(this->get_allocator()), this->get_allocator()); } public: # define BOOST_TMP_MACRO # define BOOST_PP_FILENAME_1 <boost/functional/factory.hpp> # define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_FACTORY_MAX_ARITY) # include BOOST_PP_ITERATE() # undef BOOST_TMP_MACRO }; template< typename Pointer, class Allocator, factory_alloc_propagation AP > class factory<Pointer&, Allocator, AP>; // forbidden, would create a dangling reference } # define BOOST_FUNCTIONAL_FACTORY_HPP_INCLUDED # else // defined(BOOST_PP_IS_ITERATING) # define N BOOST_PP_ITERATION() # if !defined(BOOST_TMP_MACRO) # if N > 0 template< BOOST_PP_ENUM_PARAMS(N, typename T) > # endif inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const { return result_type( new value_type(BOOST_PP_ENUM_PARAMS(N,a)) ); } # else // defined(BOOST_TMP_MACRO) # if N > 0 template< BOOST_PP_ENUM_PARAMS(N, typename T) > # endif inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const { value_type* memory = this->get_allocator().allocate(1); try { return make_pointer( new(memory) value_type(BOOST_PP_ENUM_PARAMS(N,a)), boost::non_type<factory_alloc_propagation,AP>() ); } catch (...) { this->get_allocator().deallocate(memory,1); throw; } } # endif # undef N # endif // defined(BOOST_PP_IS_ITERATING) #endif // include guard
{ "pile_set_name": "Github" }
// Copyright 2014 Wouter van Oortmerssen. 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. #include "lobster/stdafx.h" #include "lobster/disasm.h" #include "lobster/vmops.h" namespace lobster { enum { // *8 bytes each INITSTACKSIZE = 32 * 1024, // *8 bytes each, modest on smallest handheld we support (iPhone 3GS has 256MB). DEFMAXSTACKSIZE = 512 * 1024, // *8 bytes each, max by which the stack could possibly grow in a single call. STACKMARGIN = 8 * 1024 }; VM::VM(VMArgs &&vmargs, const bytecode::BytecodeFile *bcf) : VMArgs(std::move(vmargs)), maxstacksize(DEFMAXSTACKSIZE), bcf(bcf) { codelen = bcf->bytecode()->Length(); if (FLATBUFFERS_LITTLEENDIAN) { // We can use the buffer directly. codestart = (const int *)bcf->bytecode()->Data(); typetable = (const type_elem_t *)bcf->typetable()->Data(); } else { for (uint32_t i = 0; i < codelen; i++) codebigendian.push_back(bcf->bytecode()->Get(i)); codestart = codebigendian.data(); for (uint32_t i = 0; i < bcf->typetable()->Length(); i++) typetablebigendian.push_back((type_elem_t)bcf->typetable()->Get(i)); typetable = typetablebigendian.data(); } stack = new Value[stacksize = INITSTACKSIZE]; constant_strings.resize(bcf->stringtable()->size()); assert(native_vtables); } VM::~VM() { TerminateWorkers(); if (stack) delete[] stack; if (byteprofilecounts) delete[] byteprofilecounts; } VMAllocator::VMAllocator(VMArgs &&args) { // Verify the bytecode. flatbuffers::Verifier verifier(args.static_bytecode, args.static_size); auto ok = bytecode::VerifyBytecodeFileBuffer(verifier); if (!ok) THROW_OR_ABORT("bytecode file failed to verify"); auto bcf = bytecode::GetBytecodeFile(args.static_bytecode); if (bcf->bytecode_version() != LOBSTER_BYTECODE_FORMAT_VERSION) THROW_OR_ABORT("bytecode is from a different version of Lobster"); // Allocate enough memory to fit the "vars" array inline. auto size = sizeof(VM) + sizeof(Value) * bcf->specidents()->size(); auto mem = malloc(size); assert(mem); memset(mem, 0, size); // FIXME: this shouldn't be necessary. #undef new vm = new (mem) VM(std::move(args), bcf); #ifdef _WIN32 #ifndef NDEBUG #define new DEBUG_NEW #endif #endif } VMAllocator::~VMAllocator() { if (!vm) return; vm->~VM(); free(vm); } const TypeInfo &VM::GetVarTypeInfo(int varidx) { return GetTypeInfo((type_elem_t)bcf->specidents()->Get(varidx)->typeidx()); } type_elem_t VM::GetIntVectorType(int which) { auto i = bcf->default_int_vector_types()->Get(which); return type_elem_t(i < 0 ? -1 : i); } type_elem_t VM::GetFloatVectorType(int which) { auto i = bcf->default_float_vector_types()->Get(which); return type_elem_t(i < 0 ? -1 : i); } static bool _LeakSorter(void *va, void *vb) { auto a = (RefObj *)va; auto b = (RefObj *)vb; return a->refc != b->refc ? a->refc > b->refc : (a->tti != b->tti ? a->tti > b->tti : false); } void VM::DumpVal(RefObj *ro, const char *prefix) { string sd; append(sd, prefix, ": "); RefToString(*this, sd, ro, debugpp); append(sd, " (", ro->refc, "): ", (size_t)ro); LOG_DEBUG(sd); } void VM::DumpFileLine(const int *fip, string &sd) { // error is usually in the byte before the current ip. auto li = LookupLine(fip - 1, codestart, bcf); append(sd, bcf->filenames()->Get(li->fileidx())->string_view(), "(", li->line(), ")"); } void VM::DumpLeaks() { vector<void *> leaks = pool.findleaks(); auto filename = "leaks.txt"; if (leaks.empty()) { if (FileExists(filename)) FileDelete(filename); } else { LOG_ERROR("LEAKS FOUND (this indicates cycles in your object graph, or a bug in" " Lobster)"); sort(leaks.begin(), leaks.end(), _LeakSorter); PrintPrefs leakpp = debugpp; leakpp.cycles = 0; string sd; for (auto p : leaks) { auto ro = (RefObj *)p; switch(ro->ti(*this).t) { case V_VALUEBUF: case V_STACKFRAMEBUF: break; case V_STRING: case V_RESOURCE: case V_VECTOR: case V_CLASS: { ro->CycleStr(sd); sd += " = "; RefToString(*this, sd, ro, leakpp); #if DELETE_DELAY sd += " "; DumpFileLine(ro->alloc_ip, sd); append(sd, " ", (size_t)ro); #endif sd += "\n"; break; } default: assert(false); } } #ifndef NDEBUG LOG_ERROR(sd); #else if (leaks.size() < 50) { LOG_ERROR(sd); } else { LOG_ERROR(leaks.size(), " leaks, details in ", filename); WriteFile(filename, false, sd); } #endif } pool.printstats(false); } void VM::OnAlloc(RefObj *ro) { #if DELETE_DELAY LOG_DEBUG("alloc: ", (size_t)ro, " - ", ro->refc); ro->alloc_ip = ip; #else (void)ro; #endif } #undef new LVector *VM::NewVec(iint initial, iint max, type_elem_t tti) { assert(GetTypeInfo(tti).t == V_VECTOR); auto v = new (pool.alloc_small(sizeof(LVector))) LVector(*this, initial, max, tti); OnAlloc(v); return v; } LObject *VM::NewObject(iint max, type_elem_t tti) { assert(IsUDT(GetTypeInfo(tti).t)); auto s = new (pool.alloc(ssizeof<LObject>() + ssizeof<Value>() * max)) LObject(tti); OnAlloc(s); return s; } LString *VM::NewString(iint l) { auto s = new (pool.alloc(ssizeof<LString>() + l + 1)) LString(l); OnAlloc(s); return s;\ } LResource *VM::NewResource(void *v, const ResourceType *t) { auto r = new (pool.alloc(sizeof(LResource))) LResource(v, t); OnAlloc(r); return r; } #ifdef _WIN32 #ifndef NDEBUG #define new DEBUG_NEW #endif #endif LString *VM::NewString(string_view s) { auto r = NewString(s.size()); auto dest = (char *)r->data(); memcpy(dest, s.data(), s.size()); #if DELETE_DELAY LOG_DEBUG("string: \"", s, "\" - ", (size_t)r); #endif return r; } LString *VM::NewString(string_view s1, string_view s2) { auto s = NewString(s1.size() + s2.size()); auto dest = (char *)s->data(); memcpy(dest, s1.data(), s1.size()); memcpy(dest + s1.size(), s2.data(), s2.size()); return s; } LString *VM::ResizeString(LString *s, iint size, int c, bool back) { auto ns = NewString(size); auto sdest = (char *)ns->data(); auto cdest = sdest; auto remain = size - s->len; if (back) sdest += remain; else cdest += s->len; memcpy(sdest, s->data(), (size_t)s->len); memset(cdest, c, (size_t)remain); s->Dec(*this); return ns; } void VM::ErrorBase(const string &err) { if (error_has_occured) { // We're calling this function recursively, not good. Try to get back to a reasonable // state by throwing an exception to be caught by the original error. errmsg = err; UnwindOnError(); } error_has_occured = true; if (trace == TraceMode::TAIL && trace_output.size()) { for (size_t i = trace_ring_idx; i < trace_output.size(); i++) errmsg += trace_output[i]; for (size_t i = 0; i < trace_ring_idx; i++) errmsg += trace_output[i]; errmsg += err; UnwindOnError(); } append(errmsg, "VM error: ", err); } // This function is now way less important than it was when the language was still dynamically // typed. But ok to leave it as-is for "index out of range" and other errors that are still dynamic. Value VM::Error(StackPtr sp, string err) { ErrorBase(err); #ifdef USE_EXCEPTION_HANDLING try { #endif while (sp >= stack && (!stackframes.size() || sp - stack != stackframes.back().spstart)) { // Sadly can't print this properly. errmsg += "\n stack: "; to_string_hex(errmsg, (size_t)Top(sp).any()); if (pool.pointer_is_in_allocator(Top(sp).any())) { errmsg += ", maybe: "; RefToString(*this, errmsg, Top(sp).ref(), debugpp); } Pop(sp); // We don't DEC here, as we can't know what type it is. // This is ok, as we ignore leaks in case of an error anyway. } for (;;) { if (!stackframes.size()) break; int deffun = *(stackframes.back().funstart); if (deffun >= 0) { append(errmsg, "\nin function: ", bcf->functions()->Get(deffun)->name()->string_view()); } else { errmsg += "\nin block"; } auto &stf = stackframes.back(); auto fip = stf.funstart; fip++; // function id. auto nargs = *fip++; auto freevars = fip + nargs; fip += nargs; auto ndef = *fip++; fip += ndef; auto defvars = fip; auto nkeepvars = *fip++; if (errmsg.size() < 10000) { // FIXME: merge with loops below. for (int j = 0; j < ndef; ) { auto i = *(defvars - j - 1); j += DumpVar(errmsg, vars[i], i); } for (int j = 0; j < nargs; ) { auto i = *(freevars - j - 1); j += DumpVar(errmsg, vars[i], i); } } sp -= nkeepvars; fip++; // Owned vars. while (ndef--) { auto i = *--defvars; vars[i] = Pop(sp); } while (nargs--) { auto i = *--freevars; vars[i] = Pop(sp); } stackframes.pop_back(); sp = (stackframes.size() ? stackframes.back().spstart : -1) + stack; } #ifdef USE_EXCEPTION_HANDLING } catch (string &s) { // Error happened while we were building this stack trace. append(errmsg, "\nRECURSIVE ERROR:\n", s); } #endif UnwindOnError(); return Value(); } // Unlike Error above, this one does not attempt any variable dumping since the VM may already be // in an inconsistent state. Value VM::SeriousError(string err) { ErrorBase(err); UnwindOnError(); return Value(); } void VM::VMAssert(const char *what) { SeriousError(string("VM internal assertion failure: ") + what); } int VM::DumpVar(string &sd, const Value &x, int idx) { auto sid = bcf->specidents()->Get((uint32_t)idx); auto id = bcf->idents()->Get(sid->ididx()); // FIXME: this is not ideal, it filters global "let" declared vars. // It should probably instead filter global let vars whose values are entirely // constructors, and which are never written to. if (id->readonly() && id->global()) return 1; auto name = id->name()->string_view(); auto &ti = GetVarTypeInfo(idx); #if RTT_ENABLED if (ti.t != x.type) return 1; // Likely uninitialized. #endif append(sd, "\n ", name, " = "); if (IsStruct(ti.t)) { StructToString(sd, debugpp, ti, &x); return ti.len; } else { x.ToString(*this, sd, ti, debugpp); return 1; } } void VM::FinalStackVarsCleanup(StackPtr &sp) { VMASSERT((*this), sp == stack - 1 && !stackframes.size()); #ifndef NDEBUG LOG_INFO("stack at its highest was: ", maxsp); #else (void)sp; #endif } // Only valid to be called right after StartStackFrame, with no bytecode in-between. void VM::FunIntro(StackPtr &sp, const int *ip) { stackframes.push_back(StackFrame()); auto funstart = ip; ip++; // definedfunction if (sp - stack > stacksize - STACKMARGIN) { // per function call increment should be small // FIXME: not safe for untrusted scripts, could simply add lots of locals // could record max number of locals? not allow more than N locals? if (stacksize >= maxstacksize) SeriousError("stack overflow! (use set_max_stack_size() if needed)"); auto nstack = new Value[stacksize *= 2]; t_memcpy(nstack, stack, sp - stack + 1); sp = sp - stack + nstack; delete[] stack; stack = nstack; LOG_DEBUG("stack grew to: ", stacksize); } auto nargs_fun = *ip++; for (int i = 0; i < nargs_fun; i++) swap(vars[ip[i]], *(sp - nargs_fun + i + 1)); ip += nargs_fun; auto ndef = *ip++; for (int i = 0; i < ndef; i++) { // for most locals, this just saves an nil, only in recursive cases it has an actual value. auto varidx = *ip++; Push(sp, vars[varidx]); vars[varidx] = Value(); } auto nkeepvars = *ip++; for (int i = 0; i < nkeepvars; i++) Push(sp, Value()); auto nownedvars = *ip++; ip += nownedvars; auto &stf = stackframes.back(); stf.funstart = funstart; stf.spstart = sp - stack; #ifndef NDEBUG if (sp - stack > maxsp) maxsp = sp - stack; #endif } void VM::FunOut(StackPtr &sp, int nrv) { sp -= nrv; // This is ok, since we don't push any values below. auto rets = TopPtr(sp); // This is guaranteed by the typechecker. assert(stackframes.size()); auto &stf = stackframes.back(); auto depth = sp - stack; if (depth != stf.spstart) { VMASSERT((*this), false); } auto fip = stf.funstart; fip++; // function id. auto nargs = *fip++; auto freevars = fip + nargs; fip += nargs; auto ndef = *fip++; fip += ndef; auto defvars = fip; auto nkeepvars = *fip++; for (int i = 0; i < nkeepvars; i++) Pop(sp).LTDECRTNIL(*this); auto ownedvars = *fip++; for (int i = 0; i < ownedvars; i++) vars[*fip++].LTDECRTNIL(*this); while (ndef--) { auto i = *--defvars; vars[i] = Pop(sp); } while (nargs--) { auto i = *--freevars; vars[i] = Pop(sp); } stackframes.pop_back(); ts_memcpy(TopPtr(sp), rets, nrv); sp += nrv; } void VM::EndEval(StackPtr &sp, const Value &ret, const TypeInfo &ti) { TerminateWorkers(); ret.ToString(*this, evalret, ti, programprintprefs); ret.LTDECTYPE(*this, ti.t); #ifndef NDEBUG if (sp != stack - 1) { LOG_ERROR("stack diff: ", sp - stack - 1); while (sp >= stack - 1) { auto v = Pop(sp); LOG_ERROR("left on the stack: ", (size_t)v.any(), ", type: ", v.type); } assert(false); } #endif FinalStackVarsCleanup(sp); for (auto s : constant_strings) { if (s) s->Dec(*this); } while (!delete_delay.empty()) { auto ro = delete_delay.back(); delete_delay.pop_back(); ro->DECDELETENOW(*this); } DumpLeaks(); } void VM::UnwindOnError() { // This is the single location from which we unwind the execution stack from within the VM. // This requires special care, because there may be jitted code on the stack, and depending // on the platform we can use exception handling, or not. // This code is only needed upon error, the regular execution path uses normal returns. #if VM_USE_LONGJMP // We are in JIT mode, and on a platform that cannot throw exceptions "thru" C code, // e.g. Linux. // To retain modularity (allow the VM to be used in an environment where a VM error // shouldn't terminate the whole app) we try to work around this with setjmp/longjmp. // This does NOT call destructors on the way, so code calling into here should make sure // to not require these. // Though even if there are some, a small memory leak upon a VM error is probably // preferable to aborting when modularity is needed. // FIXME: audit calling code for destructors. Can we automatically enforce this? longjmp(jump_buffer, 1); // The corresponding setjmp is right below here. #else // Use the standard error mechanism, which uses exceptions (on Windows, or other platforms // when not JIT-ing) or aborts (Wasm). THROW_OR_ABORT(errmsg); #endif } void VM::EvalProgram() { #if VM_USE_LONGJMP // See longjmp above for why this is needed. if (setjmp(jump_buffer)) { // Resume normal error now that we've jumped past the C/JIT-ted code. THROW_OR_ABORT(errmsg); } #endif auto sp = stack - 1; #if VM_JIT_MODE jit_entry(*this, sp); #else compiled_entry_point(*this, sp); #endif } string &VM::TraceStream() { size_t trace_size = trace == TraceMode::TAIL ? 50 : 1; if (trace_output.size() < trace_size) trace_output.resize(trace_size); if (trace_ring_idx == trace_size) trace_ring_idx = 0; auto &sd = trace_output[trace_ring_idx++]; sd.clear(); return sd; } string VM::ProperTypeName(const TypeInfo &ti) { switch (ti.t) { case V_STRUCT_R: case V_STRUCT_S: case V_CLASS: return string(ReverseLookupType(ti.structidx)); case V_NIL: return ProperTypeName(GetTypeInfo(ti.subt)) + "?"; case V_VECTOR: return "[" + ProperTypeName(GetTypeInfo(ti.subt)) + "]"; case V_INT: return ti.enumidx >= 0 ? string(EnumName(ti.enumidx)) : "int"; default: return string(BaseTypeName(ti.t)); } } void VM::BCallRetCheck(StackPtr sp, const NativeFun *nf) { #if RTT_ENABLED // See if any builtin function is lying about what type it returns // other function types return intermediary values that don't correspond to final return // values. if (!nf->cont1) { for (size_t i = 0; i < nf->retvals.size(); i++) { #ifndef NDEBUG auto t = (TopPtr(sp) - nf->retvals.size() + i)->type; auto u = nf->retvals[i].type->t; assert(t == u || u == V_ANY || u == V_NIL || (u == V_VECTOR && IsUDT(t))); #endif } } #else (void)nf; (void)sp; #endif } iint VM::GrabIndex(StackPtr &sp, int len) { auto &v = TopM(sp, len); for (len--; ; len--) { auto sidx = Pop(sp).ival(); if (!len) return sidx; RANGECHECK((*this), sidx, v.vval()->len, v.vval()); v = v.vval()->At(sidx); } } void VM::IDXErr(StackPtr sp, iint i, iint n, const RefObj *v) { string sd; append(sd, "index ", i, " out of range ", n, " of: "); RefToString(*this, sd, v, debugpp); Error(sp, sd); } string_view VM::StructName(const TypeInfo &ti) { return bcf->udts()->Get(ti.structidx)->name()->string_view(); } string_view VM::ReverseLookupType(int v) { return bcf->udts()->Get((flatbuffers::uoffset_t)v)->name()->string_view(); } bool VM::EnumName(string &sd, iint enum_val, int enumidx) { auto enum_def = bcf->enums()->Get(enumidx); auto &vals = *enum_def->vals(); auto lookup = [&](iint val) -> bool { // FIXME: can store a bool that says wether this enum is contiguous, so we just index instead. for (auto v : vals) if (v->val() == val) { sd += v->name()->string_view(); return true; } return false; }; if (!enum_def->flags() || !enum_val) return lookup(enum_val); auto start = sd.size(); auto upto = 64 - HighZeroBits(enum_val); for (int i = 0; i < upto; i++) { auto bit = enum_val & (1LL << i); if (bit) { if (sd.size() != start) sd += "|"; if (!lookup(bit)) { // enum contains unknown bits, so can't display this properly. sd.resize(start); return false; } } } return true; } string_view VM::EnumName(int enumidx) { return bcf->enums()->Get(enumidx)->name()->string_view(); } optional<int64_t> VM::LookupEnum(string_view name, int enumidx) { auto &vals = *bcf->enums()->Get(enumidx)->vals(); for (auto v : vals) if (v->name()->string_view() == name) return v->val(); return {}; } void VM::StartWorkers(StackPtr &sp, iint numthreads) { if (is_worker) Error(sp, "workers can\'t start more worker threads"); if (tuple_space) Error(sp, "workers already running"); // Stop bad values from locking up the machine :) numthreads = min(numthreads, 256_L); tuple_space = new TupleSpace(bcf->udts()->size()); for (iint i = 0; i < numthreads; i++) { // Create a new VM that should own all its own memory and be completely independent // from this one. // We share nfr and programname for now since they're fully read-only. // FIXME: have to copy bytecode buffer even though it is read-only. auto vmargs = *(VMArgs *)this; vmargs.program_args.resize(0); vmargs.trace = TraceMode::OFF; auto vma = new VMAllocator(std::move(vmargs)); vma->vm->is_worker = true; vma->vm->tuple_space = tuple_space; workers.emplace_back([vma] { string err; #ifdef USE_EXCEPTION_HANDLING try #endif { vma->vm->EvalProgram(); } #ifdef USE_EXCEPTION_HANDLING catch (string &s) { err = s; } #endif delete vma; // FIXME: instead return err to main thread? if (!err.empty()) LOG_ERROR("worker error: ", err); }); } } void VM::TerminateWorkers() { if (is_worker || !tuple_space) return; tuple_space->alive = false; for (auto &tt : tuple_space->tupletypes) tt.condition.notify_all(); for (auto &worker : workers) worker.join(); workers.clear(); delete tuple_space; tuple_space = nullptr; } void VM::WorkerWrite(StackPtr &sp, RefObj *ref) { if (!tuple_space) return; if (!ref) Error(sp, "thread write: nil reference"); auto &ti = ref->ti(*this); if (ti.t != V_CLASS) Error(sp, "thread write: must be a class"); auto st = (LObject *)ref; auto buf = new Value[ti.len]; for (int i = 0; i < ti.len; i++) { // FIXME: lift this restriction. if (IsRefNil(GetTypeInfo(ti.elemtypes[i]).t)) Error(sp, "thread write: only scalar class members supported for now"); buf[i] = st->AtS(i); } auto &tt = tuple_space->tupletypes[ti.structidx]; { unique_lock<mutex> lock(tt.mtx); tt.tuples.push_back(buf); } tt.condition.notify_one(); } LObject *VM::WorkerRead(StackPtr &sp, type_elem_t tti) { auto &ti = GetTypeInfo(tti); if (ti.t != V_CLASS) Error(sp, "thread read: must be a class type"); Value *buf = nullptr; auto &tt = tuple_space->tupletypes[ti.structidx]; { unique_lock<mutex> lock(tt.mtx); tt.condition.wait(lock, [&] { return !tuple_space->alive || !tt.tuples.empty(); }); if (!tt.tuples.empty()) { buf = tt.tuples.front(); tt.tuples.pop_front(); } } if (!buf) return nullptr; auto ns = NewObject(ti.len, tti); ns->Init(*this, buf, ti.len, false); delete[] buf; return ns; } } // namespace lobster // Make VM ops available as C functions for linking purposes: extern "C" { using namespace lobster; void TraceIP(VM *vm, StackPtr sp, const int *ip) { auto &sd = vm->TraceStream(); DisAsmIns(vm->nfr, sd, ip, vm->bcf->bytecode()->data(), (type_elem_t *)vm->bcf->typetable()->data(), vm->bcf, false); #if RTT_ENABLED if (sp >= vm->stack) { sd += " - "; Top(sp).ToStringBase(*vm, sd, Top(sp).type, vm->debugpp); if (sp > vm->stack) { sd += " - "; TopM(sp, 1).ToStringBase(*vm, sd, TopM(sp, 1).type, vm->debugpp); } } #else (void)sp; #endif // append(sd, " / ", (size_t)Top(sp).any()); // for (int _i = 0; _i < 7; _i++) { append(sd, " #", (size_t)vm->vars[_i].any()); } if (vm->trace == TraceMode::TAIL) sd += "\n"; else LOG_PROGRAM(sd); } void TraceIL(VM *vm, StackPtr sp, initializer_list<int> ip) { TraceIP(vm, sp, ip.begin()); } #ifndef NDEBUG #define CHECK(B) if (vm->trace != TraceMode::OFF) TraceIL(vm, sp, {B}); #define CHECKVA(B) if (vm->trace != TraceMode::OFF) TraceIP(vm, sp, B - 1); #else #define CHECK(B) #define CHECKVA(B) #endif fun_base_t CVM_GetNextCallTarget(VM *vm) { return vm->next_call_target; } // Only here because in compiled code we don't know sizeof(Value) (!) StackPtr CVM_Drop(StackPtr sp) { return --sp; } #define F(N, A, USE, DEF) \ StackPtr CVM_##N(VM *vm, StackPtr sp VM_COMMA_IF(A) VM_OP_ARGSN(A)) { \ CHECK(IL_##N VM_COMMA_IF(A) VM_OP_PASSN(A)); return U_##N(*vm, sp VM_COMMA_IF(A) VM_OP_PASSN(A)); } ILBASENAMES #undef F #define F(N, A, USE, DEF) \ StackPtr CVM_##N(VM *vm, StackPtr sp VM_COMMA_IF(A) VM_OP_ARGSN(A), fun_base_t fcont) { \ /*LOG_ERROR("INS: ", #N, A, ", ", (size_t)vm, ", ", (size_t)sp, ", ", _a, ", ", (size_t)fcont);*/ \ CHECK(IL_##N VM_COMMA_IF(A) VM_OP_PASSN(A)); return U_##N(*vm, sp, VM_OP_PASSN(A) VM_COMMA_IF(A) fcont); } ILCALLNAMES #undef F #define F(N, A, USE, DEF) \ StackPtr CVM_##N(VM *vm, StackPtr sp VM_COMMA_IF(A) VM_OP_ARGSN(A)) { \ CHECKVA(ip); return U_##N(*vm, sp VM_COMMA_IF(A) VM_OP_PASSN(A)); } ILVARARGNAMES #undef F #define F(N, A, USE, DEF) \ StackPtr CVM_##N(VM *vm, StackPtr sp) { CHECK(IL_##N VM_COMMA_1 0 /*FIXME*/); return U_##N(*vm, sp); } ILJUMPNAMES1 #undef F #define F(N, A, USE, DEF) \ StackPtr CVM_##N(VM *vm, StackPtr sp, int df) { CHECK(IL_##N VM_COMMA_1 df VM_COMMA_1 0 /*FIXME*/); return U_##N(*vm, sp, df); } ILJUMPNAMES2 #undef F #if VM_JIT_MODE #if LOBSTER_ENGINE extern "C" StackPtr GLFrame(StackPtr sp, VM & vm); #endif const void *vm_ops_jit_table[] = { #define F(N, A, USE, DEF) "U_" #N, (void *)&CVM_##N, ILNAMES #undef F "GetNextCallTarget", (void *)CVM_GetNextCallTarget, "Drop", (void *)CVM_Drop, #if LOBSTER_ENGINE "GLFrame", (void *)GLFrame, #endif 0, 0 }; #endif } // extern "C"
{ "pile_set_name": "Github" }
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2016 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package proto import ( "errors" "fmt" "io" "math" "reflect" "strconv" "strings" "sync" "sync/atomic" "unicode/utf8" ) // Unmarshal is the entry point from the generated .pb.go files. // This function is not intended to be used by non-generated code. // This function is not subject to any compatibility guarantee. // msg contains a pointer to a protocol buffer struct. // b is the data to be unmarshaled into the protocol buffer. // a is a pointer to a place to store cached unmarshal information. func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { // Load the unmarshal information for this message type. // The atomic load ensures memory consistency. u := atomicLoadUnmarshalInfo(&a.unmarshal) if u == nil { // Slow path: find unmarshal info for msg, update a with it. u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) atomicStoreUnmarshalInfo(&a.unmarshal, u) } // Then do the unmarshaling. err := u.unmarshal(toPointer(&msg), b) return err } type unmarshalInfo struct { typ reflect.Type // type of the protobuf struct // 0 = only typ field is initialized // 1 = completely initialized initialized int32 lock sync.Mutex // prevents double initialization dense []unmarshalFieldInfo // fields indexed by tag # sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # reqFields []string // names of required fields reqMask uint64 // 1<<len(reqFields)-1 unrecognized field // offset of []byte to put unrecognized data (or invalidField if we should throw it away) extensions field // offset of extensions field (of type proto.XXX_InternalExtensions), or invalidField if it does not exist oldExtensions field // offset of old-form extensions field (of type map[int]Extension) extensionRanges []ExtensionRange // if non-nil, implies extensions field is valid isMessageSet bool // if true, implies extensions field is valid } // An unmarshaler takes a stream of bytes and a pointer to a field of a message. // It decodes the field, stores it at f, and returns the unused bytes. // w is the wire encoding. // b is the data after the tag and wire encoding have been read. type unmarshaler func(b []byte, f pointer, w int) ([]byte, error) type unmarshalFieldInfo struct { // location of the field in the proto message structure. field field // function to unmarshal the data for the field. unmarshal unmarshaler // if a required field, contains a single set bit at this field's index in the required field list. reqMask uint64 name string // name of the field, for error reporting } var ( unmarshalInfoMap = map[reflect.Type]*unmarshalInfo{} unmarshalInfoLock sync.Mutex ) // getUnmarshalInfo returns the data structure which can be // subsequently used to unmarshal a message of the given type. // t is the type of the message (note: not pointer to message). func getUnmarshalInfo(t reflect.Type) *unmarshalInfo { // It would be correct to return a new unmarshalInfo // unconditionally. We would end up allocating one // per occurrence of that type as a message or submessage. // We use a cache here just to reduce memory usage. unmarshalInfoLock.Lock() defer unmarshalInfoLock.Unlock() u := unmarshalInfoMap[t] if u == nil { u = &unmarshalInfo{typ: t} // Note: we just set the type here. The rest of the fields // will be initialized on first use. unmarshalInfoMap[t] = u } return u } // unmarshal does the main work of unmarshaling a message. // u provides type information used to unmarshal the message. // m is a pointer to a protocol buffer message. // b is a byte stream to unmarshal into m. // This is top routine used when recursively unmarshaling submessages. func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { if atomic.LoadInt32(&u.initialized) == 0 { u.computeUnmarshalInfo() } if u.isMessageSet { return unmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) } var reqMask uint64 // bitmask of required fields we've seen. var errLater error for len(b) > 0 { // Read tag and wire type. // Special case 1 and 2 byte varints. var x uint64 if b[0] < 128 { x = uint64(b[0]) b = b[1:] } else if len(b) >= 2 && b[1] < 128 { x = uint64(b[0]&0x7f) + uint64(b[1])<<7 b = b[2:] } else { var n int x, n = decodeVarint(b) if n == 0 { return io.ErrUnexpectedEOF } b = b[n:] } tag := x >> 3 wire := int(x) & 7 // Dispatch on the tag to one of the unmarshal* functions below. var f unmarshalFieldInfo if tag < uint64(len(u.dense)) { f = u.dense[tag] } else { f = u.sparse[tag] } if fn := f.unmarshal; fn != nil { var err error b, err = fn(b, m.offset(f.field), wire) if err == nil { reqMask |= f.reqMask continue } if r, ok := err.(*RequiredNotSetError); ok { // Remember this error, but keep parsing. We need to produce // a full parse even if a required field is missing. if errLater == nil { errLater = r } reqMask |= f.reqMask continue } if err != errInternalBadWireType { if err == errInvalidUTF8 { if errLater == nil { fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name errLater = &invalidUTF8Error{fullName} } continue } return err } // Fragments with bad wire type are treated as unknown fields. } // Unknown tag. if !u.unrecognized.IsValid() { // Don't keep unrecognized data; just skip it. var err error b, err = skipField(b, wire) if err != nil { return err } continue } // Keep unrecognized data around. // maybe in extensions, maybe in the unrecognized field. z := m.offset(u.unrecognized).toBytes() var emap map[int32]Extension var e Extension for _, r := range u.extensionRanges { if uint64(r.Start) <= tag && tag <= uint64(r.End) { if u.extensions.IsValid() { mp := m.offset(u.extensions).toExtensions() emap = mp.extensionsWrite() e = emap[int32(tag)] z = &e.enc break } if u.oldExtensions.IsValid() { p := m.offset(u.oldExtensions).toOldExtensions() emap = *p if emap == nil { emap = map[int32]Extension{} *p = emap } e = emap[int32(tag)] z = &e.enc break } panic("no extensions field available") } } // Use wire type to skip data. var err error b0 := b b, err = skipField(b, wire) if err != nil { return err } *z = encodeVarint(*z, tag<<3|uint64(wire)) *z = append(*z, b0[:len(b0)-len(b)]...) if emap != nil { emap[int32(tag)] = e } } if reqMask != u.reqMask && errLater == nil { // A required field of this message is missing. for _, n := range u.reqFields { if reqMask&1 == 0 { errLater = &RequiredNotSetError{n} } reqMask >>= 1 } } return errLater } // computeUnmarshalInfo fills in u with information for use // in unmarshaling protocol buffers of type u.typ. func (u *unmarshalInfo) computeUnmarshalInfo() { u.lock.Lock() defer u.lock.Unlock() if u.initialized != 0 { return } t := u.typ n := t.NumField() // Set up the "not found" value for the unrecognized byte buffer. // This is the default for proto3. u.unrecognized = invalidField u.extensions = invalidField u.oldExtensions = invalidField // List of the generated type and offset for each oneof field. type oneofField struct { ityp reflect.Type // interface type of oneof field field field // offset in containing message } var oneofFields []oneofField for i := 0; i < n; i++ { f := t.Field(i) if f.Name == "XXX_unrecognized" { // The byte slice used to hold unrecognized input is special. if f.Type != reflect.TypeOf(([]byte)(nil)) { panic("bad type for XXX_unrecognized field: " + f.Type.Name()) } u.unrecognized = toField(&f) continue } if f.Name == "XXX_InternalExtensions" { // Ditto here. if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) } u.extensions = toField(&f) if f.Tag.Get("protobuf_messageset") == "1" { u.isMessageSet = true } continue } if f.Name == "XXX_extensions" { // An older form of the extensions field. if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) { panic("bad type for XXX_extensions field: " + f.Type.Name()) } u.oldExtensions = toField(&f) continue } if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { continue } oneof := f.Tag.Get("protobuf_oneof") if oneof != "" { oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) // The rest of oneof processing happens below. continue } tags := f.Tag.Get("protobuf") tagArray := strings.Split(tags, ",") if len(tagArray) < 2 { panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) } tag, err := strconv.Atoi(tagArray[1]) if err != nil { panic("protobuf tag field not an integer: " + tagArray[1]) } name := "" for _, tag := range tagArray[3:] { if strings.HasPrefix(tag, "name=") { name = tag[5:] } } // Extract unmarshaling function from the field (its type and tags). unmarshal := fieldUnmarshaler(&f) // Required field? var reqMask uint64 if tagArray[2] == "req" { bit := len(u.reqFields) u.reqFields = append(u.reqFields, name) reqMask = uint64(1) << uint(bit) // TODO: if we have more than 64 required fields, we end up // not verifying that all required fields are present. // Fix this, perhaps using a count of required fields? } // Store the info in the correct slot in the message. u.setTag(tag, toField(&f), unmarshal, reqMask, name) } // Find any types associated with oneof fields. var oneofImplementers []interface{} switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { case oneofFuncsIface: _, _, _, oneofImplementers = m.XXX_OneofFuncs() case oneofWrappersIface: oneofImplementers = m.XXX_OneofWrappers() } for _, v := range oneofImplementers { tptr := reflect.TypeOf(v) // *Msg_X typ := tptr.Elem() // Msg_X f := typ.Field(0) // oneof implementers have one field baseUnmarshal := fieldUnmarshaler(&f) tags := strings.Split(f.Tag.Get("protobuf"), ",") fieldNum, err := strconv.Atoi(tags[1]) if err != nil { panic("protobuf tag field not an integer: " + tags[1]) } var name string for _, tag := range tags { if strings.HasPrefix(tag, "name=") { name = strings.TrimPrefix(tag, "name=") break } } // Find the oneof field that this struct implements. // Might take O(n^2) to process all of the oneofs, but who cares. for _, of := range oneofFields { if tptr.Implements(of.ityp) { // We have found the corresponding interface for this struct. // That lets us know where this struct should be stored // when we encounter it during unmarshaling. unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) u.setTag(fieldNum, of.field, unmarshal, 0, name) } } } // Get extension ranges, if any. fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") if fn.IsValid() { if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { panic("a message with extensions, but no extensions field in " + t.Name()) } u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) } // Explicitly disallow tag 0. This will ensure we flag an error // when decoding a buffer of all zeros. Without this code, we // would decode and skip an all-zero buffer of even length. // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) }, 0, "") // Set mask for required field check. u.reqMask = uint64(1)<<uint(len(u.reqFields)) - 1 atomic.StoreInt32(&u.initialized, 1) } // setTag stores the unmarshal information for the given tag. // tag = tag # for field // field/unmarshal = unmarshal info for that field. // reqMask = if required, bitmask for field position in required field list. 0 otherwise. // name = short name of the field. func (u *unmarshalInfo) setTag(tag int, field field, unmarshal unmarshaler, reqMask uint64, name string) { i := unmarshalFieldInfo{field: field, unmarshal: unmarshal, reqMask: reqMask, name: name} n := u.typ.NumField() if tag >= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? for len(u.dense) <= tag { u.dense = append(u.dense, unmarshalFieldInfo{}) } u.dense[tag] = i return } if u.sparse == nil { u.sparse = map[uint64]unmarshalFieldInfo{} } u.sparse[uint64(tag)] = i } // fieldUnmarshaler returns an unmarshaler for the given field. func fieldUnmarshaler(f *reflect.StructField) unmarshaler { if f.Type.Kind() == reflect.Map { return makeUnmarshalMap(f) } return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) } // typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { tagArray := strings.Split(tags, ",") encoding := tagArray[0] name := "unknown" proto3 := false validateUTF8 := true for _, tag := range tagArray[3:] { if strings.HasPrefix(tag, "name=") { name = tag[5:] } if tag == "proto3" { proto3 = true } } validateUTF8 = validateUTF8 && proto3 // Figure out packaging (pointer, slice, or both) slice := false pointer := false if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { slice = true t = t.Elem() } if t.Kind() == reflect.Ptr { pointer = true t = t.Elem() } // We'll never have both pointer and slice for basic types. if pointer && slice && t.Kind() != reflect.Struct { panic("both pointer and slice for basic type in " + t.Name()) } switch t.Kind() { case reflect.Bool: if pointer { return unmarshalBoolPtr } if slice { return unmarshalBoolSlice } return unmarshalBoolValue case reflect.Int32: switch encoding { case "fixed32": if pointer { return unmarshalFixedS32Ptr } if slice { return unmarshalFixedS32Slice } return unmarshalFixedS32Value case "varint": // this could be int32 or enum if pointer { return unmarshalInt32Ptr } if slice { return unmarshalInt32Slice } return unmarshalInt32Value case "zigzag32": if pointer { return unmarshalSint32Ptr } if slice { return unmarshalSint32Slice } return unmarshalSint32Value } case reflect.Int64: switch encoding { case "fixed64": if pointer { return unmarshalFixedS64Ptr } if slice { return unmarshalFixedS64Slice } return unmarshalFixedS64Value case "varint": if pointer { return unmarshalInt64Ptr } if slice { return unmarshalInt64Slice } return unmarshalInt64Value case "zigzag64": if pointer { return unmarshalSint64Ptr } if slice { return unmarshalSint64Slice } return unmarshalSint64Value } case reflect.Uint32: switch encoding { case "fixed32": if pointer { return unmarshalFixed32Ptr } if slice { return unmarshalFixed32Slice } return unmarshalFixed32Value case "varint": if pointer { return unmarshalUint32Ptr } if slice { return unmarshalUint32Slice } return unmarshalUint32Value } case reflect.Uint64: switch encoding { case "fixed64": if pointer { return unmarshalFixed64Ptr } if slice { return unmarshalFixed64Slice } return unmarshalFixed64Value case "varint": if pointer { return unmarshalUint64Ptr } if slice { return unmarshalUint64Slice } return unmarshalUint64Value } case reflect.Float32: if pointer { return unmarshalFloat32Ptr } if slice { return unmarshalFloat32Slice } return unmarshalFloat32Value case reflect.Float64: if pointer { return unmarshalFloat64Ptr } if slice { return unmarshalFloat64Slice } return unmarshalFloat64Value case reflect.Map: panic("map type in typeUnmarshaler in " + t.Name()) case reflect.Slice: if pointer { panic("bad pointer in slice case in " + t.Name()) } if slice { return unmarshalBytesSlice } return unmarshalBytesValue case reflect.String: if validateUTF8 { if pointer { return unmarshalUTF8StringPtr } if slice { return unmarshalUTF8StringSlice } return unmarshalUTF8StringValue } if pointer { return unmarshalStringPtr } if slice { return unmarshalStringSlice } return unmarshalStringValue case reflect.Struct: // message or group field if !pointer { panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding)) } switch encoding { case "bytes": if slice { return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) } return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) case "group": if slice { return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) } return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) } } panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) } // Below are all the unmarshalers for individual fields of various types. func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x) *f.toInt64() = v return b, nil } func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x) *f.toInt64Ptr() = &v return b, nil } func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x) s := f.toInt64Slice() *s = append(*s, v) } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x) s := f.toInt64Slice() *s = append(*s, v) return b, nil } func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x>>1) ^ int64(x)<<63>>63 *f.toInt64() = v return b, nil } func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x>>1) ^ int64(x)<<63>>63 *f.toInt64Ptr() = &v return b, nil } func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x>>1) ^ int64(x)<<63>>63 s := f.toInt64Slice() *s = append(*s, v) } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int64(x>>1) ^ int64(x)<<63>>63 s := f.toInt64Slice() *s = append(*s, v) return b, nil } func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint64(x) *f.toUint64() = v return b, nil } func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint64(x) *f.toUint64Ptr() = &v return b, nil } func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint64(x) s := f.toUint64Slice() *s = append(*s, v) } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint64(x) s := f.toUint64Slice() *s = append(*s, v) return b, nil } func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x) *f.toInt32() = v return b, nil } func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x) f.setInt32Ptr(v) return b, nil } func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x) f.appendInt32Slice(v) } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x) f.appendInt32Slice(v) return b, nil } func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x>>1) ^ int32(x)<<31>>31 *f.toInt32() = v return b, nil } func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x>>1) ^ int32(x)<<31>>31 f.setInt32Ptr(v) return b, nil } func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x>>1) ^ int32(x)<<31>>31 f.appendInt32Slice(v) } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := int32(x>>1) ^ int32(x)<<31>>31 f.appendInt32Slice(v) return b, nil } func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint32(x) *f.toUint32() = v return b, nil } func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint32(x) *f.toUint32Ptr() = &v return b, nil } func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint32(x) s := f.toUint32Slice() *s = append(*s, v) } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] v := uint32(x) s := f.toUint32Slice() *s = append(*s, v) return b, nil } func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 *f.toUint64() = v return b[8:], nil } func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 *f.toUint64Ptr() = &v return b[8:], nil } func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 s := f.toUint64Slice() *s = append(*s, v) b = b[8:] } return res, nil } if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 s := f.toUint64Slice() *s = append(*s, v) return b[8:], nil } func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 *f.toInt64() = v return b[8:], nil } func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 *f.toInt64Ptr() = &v return b[8:], nil } func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 s := f.toInt64Slice() *s = append(*s, v) b = b[8:] } return res, nil } if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 s := f.toInt64Slice() *s = append(*s, v) return b[8:], nil } func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 *f.toUint32() = v return b[4:], nil } func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 *f.toUint32Ptr() = &v return b[4:], nil } func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 s := f.toUint32Slice() *s = append(*s, v) b = b[4:] } return res, nil } if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 s := f.toUint32Slice() *s = append(*s, v) return b[4:], nil } func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 *f.toInt32() = v return b[4:], nil } func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 f.setInt32Ptr(v) return b[4:], nil } func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 f.appendInt32Slice(v) b = b[4:] } return res, nil } if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 f.appendInt32Slice(v) return b[4:], nil } func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } // Note: any length varint is allowed, even though any sane // encoder will use one byte. // See https://github.com/golang/protobuf/issues/76 x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } // TODO: check if x>1? Tests seem to indicate no. v := x != 0 *f.toBool() = v return b[n:], nil } func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } v := x != 0 *f.toBoolPtr() = &v return b[n:], nil } func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { x, n = decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } v := x != 0 s := f.toBoolSlice() *s = append(*s, v) b = b[n:] } return res, nil } if w != WireVarint { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } v := x != 0 s := f.toBoolSlice() *s = append(*s, v) return b[n:], nil } func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) *f.toFloat64() = v return b[8:], nil } func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) *f.toFloat64Ptr() = &v return b[8:], nil } func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) s := f.toFloat64Slice() *s = append(*s, v) b = b[8:] } return res, nil } if w != WireFixed64 { return b, errInternalBadWireType } if len(b) < 8 { return nil, io.ErrUnexpectedEOF } v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) s := f.toFloat64Slice() *s = append(*s, v) return b[8:], nil } func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) *f.toFloat32() = v return b[4:], nil } func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) *f.toFloat32Ptr() = &v return b[4:], nil } func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { if w == WireBytes { // packed x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } res := b[x:] b = b[:x] for len(b) > 0 { if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) s := f.toFloat32Slice() *s = append(*s, v) b = b[4:] } return res, nil } if w != WireFixed32 { return b, errInternalBadWireType } if len(b) < 4 { return nil, io.ErrUnexpectedEOF } v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) s := f.toFloat32Slice() *s = append(*s, v) return b[4:], nil } func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := string(b[:x]) *f.toString() = v return b[x:], nil } func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := string(b[:x]) *f.toStringPtr() = &v return b[x:], nil } func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := string(b[:x]) s := f.toStringSlice() *s = append(*s, v) return b[x:], nil } func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := string(b[:x]) *f.toString() = v if !utf8.ValidString(v) { return b[x:], errInvalidUTF8 } return b[x:], nil } func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := string(b[:x]) *f.toStringPtr() = &v if !utf8.ValidString(v) { return b[x:], errInvalidUTF8 } return b[x:], nil } func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := string(b[:x]) s := f.toStringSlice() *s = append(*s, v) if !utf8.ValidString(v) { return b[x:], errInvalidUTF8 } return b[x:], nil } var emptyBuf [0]byte func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } // The use of append here is a trick which avoids the zeroing // that would be required if we used a make/copy pair. // We append to emptyBuf instead of nil because we want // a non-nil result even when the length is 0. v := append(emptyBuf[:], b[:x]...) *f.toBytes() = v return b[x:], nil } func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := append(emptyBuf[:], b[:x]...) s := f.toBytesSlice() *s = append(*s, v) return b[x:], nil } func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { return func(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } // First read the message field to see if something is there. // The semantics of multiple submessages are weird. Instead of // the last one winning (as it is for all other fields), multiple // submessages are merged. v := f.getPointer() if v.isNil() { v = valToPointer(reflect.New(sub.typ)) f.setPointer(v) } err := sub.unmarshal(v, b[:x]) if err != nil { if r, ok := err.(*RequiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err } } return b[x:], err } } func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { return func(b []byte, f pointer, w int) ([]byte, error) { if w != WireBytes { return b, errInternalBadWireType } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } v := valToPointer(reflect.New(sub.typ)) err := sub.unmarshal(v, b[:x]) if err != nil { if r, ok := err.(*RequiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err } } f.appendPointer(v) return b[x:], err } } func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { return func(b []byte, f pointer, w int) ([]byte, error) { if w != WireStartGroup { return b, errInternalBadWireType } x, y := findEndGroup(b) if x < 0 { return nil, io.ErrUnexpectedEOF } v := f.getPointer() if v.isNil() { v = valToPointer(reflect.New(sub.typ)) f.setPointer(v) } err := sub.unmarshal(v, b[:x]) if err != nil { if r, ok := err.(*RequiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err } } return b[y:], err } } func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { return func(b []byte, f pointer, w int) ([]byte, error) { if w != WireStartGroup { return b, errInternalBadWireType } x, y := findEndGroup(b) if x < 0 { return nil, io.ErrUnexpectedEOF } v := valToPointer(reflect.New(sub.typ)) err := sub.unmarshal(v, b[:x]) if err != nil { if r, ok := err.(*RequiredNotSetError); ok { r.field = name + "." + r.field } else { return nil, err } } f.appendPointer(v) return b[y:], err } } func makeUnmarshalMap(f *reflect.StructField) unmarshaler { t := f.Type kt := t.Key() vt := t.Elem() unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val")) return func(b []byte, f pointer, w int) ([]byte, error) { // The map entry is a submessage. Figure out how big it is. if w != WireBytes { return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) } x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } b = b[n:] if x > uint64(len(b)) { return nil, io.ErrUnexpectedEOF } r := b[x:] // unused data to return b = b[:x] // data for map entry // Note: we could use #keys * #values ~= 200 functions // to do map decoding without reflection. Probably not worth it. // Maps will be somewhat slow. Oh well. // Read key and value from data. var nerr nonFatal k := reflect.New(kt) v := reflect.New(vt) for len(b) > 0 { x, n := decodeVarint(b) if n == 0 { return nil, io.ErrUnexpectedEOF } wire := int(x) & 7 b = b[n:] var err error switch x >> 3 { case 1: b, err = unmarshalKey(b, valToPointer(k), wire) case 2: b, err = unmarshalVal(b, valToPointer(v), wire) default: err = errInternalBadWireType // skip unknown tag } if nerr.Merge(err) { continue } if err != errInternalBadWireType { return nil, err } // Skip past unknown fields. b, err = skipField(b, wire) if err != nil { return nil, err } } // Get map, allocate if needed. m := f.asPointerTo(t).Elem() // an addressable map[K]T if m.IsNil() { m.Set(reflect.MakeMap(t)) } // Insert into map. m.SetMapIndex(k.Elem(), v.Elem()) return r, nerr.E } } // makeUnmarshalOneof makes an unmarshaler for oneof fields. // for: // message Msg { // oneof F { // int64 X = 1; // float64 Y = 2; // } // } // typ is the type of the concrete entry for a oneof case (e.g. Msg_X). // ityp is the interface type of the oneof field (e.g. isMsg_F). // unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). // Note that this function will be called once for each case in the oneof. func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { sf := typ.Field(0) field0 := toField(&sf) return func(b []byte, f pointer, w int) ([]byte, error) { // Allocate holder for value. v := reflect.New(typ) // Unmarshal data into holder. // We unmarshal into the first field of the holder object. var err error var nerr nonFatal b, err = unmarshal(b, valToPointer(v).offset(field0), w) if !nerr.Merge(err) { return nil, err } // Write pointer to holder into target field. f.asPointerTo(ityp).Elem().Set(v) return b, nerr.E } } // Error used by decode internally. var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") // skipField skips past a field of type wire and returns the remaining bytes. func skipField(b []byte, wire int) ([]byte, error) { switch wire { case WireVarint: _, k := decodeVarint(b) if k == 0 { return b, io.ErrUnexpectedEOF } b = b[k:] case WireFixed32: if len(b) < 4 { return b, io.ErrUnexpectedEOF } b = b[4:] case WireFixed64: if len(b) < 8 { return b, io.ErrUnexpectedEOF } b = b[8:] case WireBytes: m, k := decodeVarint(b) if k == 0 || uint64(len(b)-k) < m { return b, io.ErrUnexpectedEOF } b = b[uint64(k)+m:] case WireStartGroup: _, i := findEndGroup(b) if i == -1 { return b, io.ErrUnexpectedEOF } b = b[i:] default: return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) } return b, nil } // findEndGroup finds the index of the next EndGroup tag. // Groups may be nested, so the "next" EndGroup tag is the first // unpaired EndGroup. // findEndGroup returns the indexes of the start and end of the EndGroup tag. // Returns (-1,-1) if it can't find one. func findEndGroup(b []byte) (int, int) { depth := 1 i := 0 for { x, n := decodeVarint(b[i:]) if n == 0 { return -1, -1 } j := i i += n switch x & 7 { case WireVarint: _, k := decodeVarint(b[i:]) if k == 0 { return -1, -1 } i += k case WireFixed32: if len(b)-4 < i { return -1, -1 } i += 4 case WireFixed64: if len(b)-8 < i { return -1, -1 } i += 8 case WireBytes: m, k := decodeVarint(b[i:]) if k == 0 { return -1, -1 } i += k if uint64(len(b)-i) < m { return -1, -1 } i += int(m) case WireStartGroup: depth++ case WireEndGroup: depth-- if depth == 0 { return j, i } default: return -1, -1 } } } // encodeVarint appends a varint-encoded integer to b and returns the result. func encodeVarint(b []byte, x uint64) []byte { for x >= 1<<7 { b = append(b, byte(x&0x7f|0x80)) x >>= 7 } return append(b, byte(x)) } // decodeVarint reads a varint-encoded integer from b. // Returns the decoded integer and the number of bytes read. // If there is an error, it returns 0,0. func decodeVarint(b []byte) (uint64, int) { var x, y uint64 if len(b) == 0 { goto bad } x = uint64(b[0]) if x < 0x80 { return x, 1 } x -= 0x80 if len(b) <= 1 { goto bad } y = uint64(b[1]) x += y << 7 if y < 0x80 { return x, 2 } x -= 0x80 << 7 if len(b) <= 2 { goto bad } y = uint64(b[2]) x += y << 14 if y < 0x80 { return x, 3 } x -= 0x80 << 14 if len(b) <= 3 { goto bad } y = uint64(b[3]) x += y << 21 if y < 0x80 { return x, 4 } x -= 0x80 << 21 if len(b) <= 4 { goto bad } y = uint64(b[4]) x += y << 28 if y < 0x80 { return x, 5 } x -= 0x80 << 28 if len(b) <= 5 { goto bad } y = uint64(b[5]) x += y << 35 if y < 0x80 { return x, 6 } x -= 0x80 << 35 if len(b) <= 6 { goto bad } y = uint64(b[6]) x += y << 42 if y < 0x80 { return x, 7 } x -= 0x80 << 42 if len(b) <= 7 { goto bad } y = uint64(b[7]) x += y << 49 if y < 0x80 { return x, 8 } x -= 0x80 << 49 if len(b) <= 8 { goto bad } y = uint64(b[8]) x += y << 56 if y < 0x80 { return x, 9 } x -= 0x80 << 56 if len(b) <= 9 { goto bad } y = uint64(b[9]) x += y << 63 if y < 2 { return x, 10 } bad: return 0, 0 }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <!-- Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. This code 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 version 2 for more details (a copy is included in the LICENSE file that accompanied this code). You should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. --> <!DOCTYPE processcode [ <!ELEMENT processcode ANY> ]> <processcode> </processcode>
{ "pile_set_name": "Github" }
.class public final Lcom/facebook/places/model/PlaceSearchRequestParams; .super Ljava/lang/Object; # instance fields .field private final categories:Ljava/util/Set; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Set", "<", "Ljava/lang/String;", ">;" } .end annotation .end field .field private final distance:I .field private final fields:Ljava/util/Set; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/Set", "<", "Ljava/lang/String;", ">;" } .end annotation .end field .field private final limit:I .field private final searchText:Ljava/lang/String; # direct methods .method private constructor <init>(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)V .locals 2 invoke-direct {p0}, Ljava/lang/Object;-><init>()V new-instance v0, Ljava/util/HashSet; invoke-direct {v0}, Ljava/util/HashSet;-><init>()V iput-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->categories:Ljava/util/Set; new-instance v0, Ljava/util/HashSet; invoke-direct {v0}, Ljava/util/HashSet;-><init>()V iput-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->fields:Ljava/util/Set; invoke-static {p1}, Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;->access$000(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)I move-result v0 iput v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->distance:I invoke-static {p1}, Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;->access$100(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)I move-result v0 iput v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->limit:I invoke-static {p1}, Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;->access$200(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)Ljava/lang/String; move-result-object v0 iput-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->searchText:Ljava/lang/String; iget-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->categories:Ljava/util/Set; invoke-static {p1}, Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;->access$300(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)Ljava/util/Set; move-result-object v1 invoke-interface {v0, v1}, Ljava/util/Set;->addAll(Ljava/util/Collection;)Z iget-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->fields:Ljava/util/Set; invoke-static {p1}, Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;->access$400(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)Ljava/util/Set; move-result-object v1 invoke-interface {v0, v1}, Ljava/util/Set;->addAll(Ljava/util/Collection;)Z return-void .end method .method synthetic constructor <init>(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;Lcom/facebook/places/model/PlaceSearchRequestParams$1;)V .locals 0 invoke-direct {p0, p1}, Lcom/facebook/places/model/PlaceSearchRequestParams;-><init>(Lcom/facebook/places/model/PlaceSearchRequestParams$Builder;)V return-void .end method # virtual methods .method public final getCategories()Ljava/util/Set; .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "()", "Ljava/util/Set", "<", "Ljava/lang/String;", ">;" } .end annotation iget-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->categories:Ljava/util/Set; return-object v0 .end method .method public final getDistance()I .locals 1 iget v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->distance:I return v0 .end method .method public final getFields()Ljava/util/Set; .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "()", "Ljava/util/Set", "<", "Ljava/lang/String;", ">;" } .end annotation iget-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->fields:Ljava/util/Set; return-object v0 .end method .method public final getLimit()I .locals 1 iget v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->limit:I return v0 .end method .method public final getSearchText()Ljava/lang/String; .locals 1 iget-object v0, p0, Lcom/facebook/places/model/PlaceSearchRequestParams;->searchText:Ljava/lang/String; return-object v0 .end method
{ "pile_set_name": "Github" }
IF EXISTS ( SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.RunLoanAccountingClosure') AND type = N'P' ) DROP PROCEDURE [dbo].[RunLoanAccountingClosure] GO IF EXISTS ( SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.RunSavingAccountingClosure') AND type = N'P' ) DROP PROCEDURE [dbo].[RunSavingAccountingClosure] GO INSERT INTO [GeneralParameters]([key], [value]) VALUES('MODIFY_ENTRY_FEE', 0) GO ALTER TABLE dbo.Contracts ADD activity_id INT NULL GO UPDATE c SET c.activity_id = p.activity_id FROM Contracts c INNER JOIN Projects pr ON c.project_id = pr.id INNER JOIN Tiers t ON pr.tiers_id = t.id INNER JOIN Persons p ON p.id = t.id GO UPDATE c SET c.activity_id = cr.activity_id FROM Contracts c INNER JOIN Projects pr ON c.project_id = pr.id INNER JOIN Tiers t ON pr.tiers_id = t.id INNER JOIN Corporates cr ON cr.id = t.id GO UPDATE c SET c.activity_id = p.activity_id FROM Contracts c INNER JOIN Projects pr ON c.project_id = pr.id INNER JOIN Tiers t ON pr.tiers_id = t.id INNER JOIN Groups g ON g.id = t.id INNER JOIN PersonGroupBelonging pgb ON pgb.group_id = g.id AND pgb.is_leader = 1 INNER JOIN Persons p ON pgb.person_id = p.id GO DECLARE @activityId INT SELECT @activityId = MIN(id) FROM EconomicActivities UPDATE Contracts SET activity_id = @activityId WHERE activity_id IS NULL GO ALTER TABLE dbo.Contracts ALTER COLUMN activity_id INT NOT NULL GO ALTER TABLE dbo.Contracts ADD CONSTRAINT FK_Contracts_EconomicActivities FOREIGN KEY(activity_id) REFERENCES dbo.EconomicActivities (id) ON UPDATE NO ACTION ON DELETE NO ACTION GO UPDATE dbo.ActionItems SET method_name = 'CanUserModifyEntryFees' WHERE method_name = 'CanUserDisableEntryFees' GO ALTER TABLE dbo.Tellers DROP CONSTRAINT [FK_Tellers_Users] GO SET IDENTITY_INSERT [MenuItems] ON INSERT INTO [dbo].[MenuItems]([id], [component_name]) VALUES (61, 'tellerManagementToolStripMenuItem') INSERT INTO [dbo].[MenuItems]([id], [component_name]) VALUES (74, 'tellerOperationsToolStripMenuItem') SET IDENTITY_INSERT [MenuItems] OFF GO ALTER TABLE dbo.TellerEvents ADD [description] NVARCHAR(100) GO UPDATE [TechnicalParameters] SET [value] = 'v4.7.0' WHERE [name] = 'VERSION' GO
{ "pile_set_name": "Github" }
// Run: %dxc -T vs_6_0 -E main // CHECK: OpDecorate %specConst SpecId 10 [[vk::constant_id(10)]] // CHECK: %specConst = OpSpecConstant %int 12 const int specConst = 12; // TODO: The frontend parsing hits assertion failures saying cannot evaluating // as constant int for the following usages. /* cbuffer Data { float4 pos[specConst]; float4 tex[specConst + 5]; }; */ // CHECK: [[add:%\d+]] = OpSpecConstantOp %int IAdd %specConst %int_3 static const int val = specConst + 3; // CHECK-LABEL: %main = OpFunction // CHECK: OpStore %val [[add]] void main() { }
{ "pile_set_name": "Github" }
#=============================================================================== # POLLER (S1_Poller) #=============================================================================== # Description: The poller is responsible for: # - Active data acquisition # - Local passive data acquisition # https://shinken.readthedocs.org/en/latest/08_configobjects/poller.html #=============================================================================== define poller { poller_name poller-master address localhost port 7771 ## Optional spare 0 ; 1 = is a spare, 0 = is not a spare manage_sub_realms 0 ; Does it take jobs from schedulers of sub-Realms? min_workers 0 ; Starts with N processes (0 = 1 per CPU) max_workers 0 ; No more than N processes (0 = 1 per CPU) processes_by_worker 256 ; Each worker manages N checks polling_interval 1 ; Get jobs from schedulers each N seconds timeout 3 ; Ping timeout data_timeout 120 ; Data send timeout max_check_attempts 3 ; If ping fails N or more, then the node is dead check_interval 60 ; Ping node every N seconds ## Interesting modules that can be used: # - booster-nrpe = Replaces the check_nrpe binary. Therefore it # enhances performances when there are lot of NRPE # calls. # - named-pipe = Allow the poller to read a nagios.cmd named pipe. # This permits the use of distributed check_mk checks # should you desire it. # - snmp-booster = Snmp bulk polling module # Comma separated list of modules modules ## Advanced Features #passive 0 ; For DMZ monitoring, set to 1 so the connections ; will be from scheduler -> poller. # Poller tags are the tag that the poller will manage. Use None as tag name to manage # untaggued checks #poller_tags None # Enable https or not use_ssl 0 # enable certificate/hostname check, will avoid man in the middle attacks hard_ssl_name_check 0 realm All }
{ "pile_set_name": "Github" }