text
stringlengths
2
100k
meta
dict
+ ++ += - -- -= * *= / /= ! != = == && || < <= > >= % ^ ---------------------------------------------------- [ ["operator", "+"], ["operator", "++"], ["operator", "+="], ["operator", "-"], ["operator", "--"], ["operator", "-="], ["operator", "*"], ["operator", "*="], ["operator", "/"], ["operator", "/="], ["operator", "!"], ["operator", "!="], ["operator", "="], ["operator", "=="], ["operator", "&&"], ["operator", "||"], ["operator", "<"], ["operator", "<="], ["operator", ">"], ["operator", ">="], ["operator", "%"], ["operator", "^"] ] ---------------------------------------------------- Checks for operators.
{ "pile_set_name": "Github" }
import java.io.File import java.nio.file.{ Files, Path, Paths } import java.util.regex.Pattern import sbt._ import Keys._ import Def.Initialize import sbt.complete.{ Parser, DefaultParsers }, DefaultParsers.{ EOF, Space } import Running.makeMainTask object ModelsLibrary { val modelsDirectory = settingKey[File]("models directory") val resaveModel = InputKey[Unit]("resaveModel", "resave a single model") val resaveModels = TaskKey[Unit]("resaveModels", "resave all library models") val modelIndex = TaskKey[Seq[File]]( "modelIndex", "builds models/index.txt for use in Models Library dialog") val modelParser: Initialize[Parser[Option[Path]]] = { import Parser._ Def.setting { val modelDir = modelsDirectory.value val allModels = modelFiles(modelDir) if (allModels.isEmpty) EOF ^^^ None else (Space ~> allModels .map(d => (modelDir.getName + File.separator + modelDir.toPath.relativize(d).toString ^^^ Some(d))) .reduce(_ | _)) } } def modelFiles(directory: File): Seq[Path] = { val dirPath = directory.toPath FileActions.enumeratePaths(dirPath) .filter(p => p.getFileName.toString.endsWith(".nlogo") || p.getFileName.toString.endsWith(".nlogo3d")) } lazy val settings = Seq( modelIndex := { streams.value.log.info("creating models/index.conf") val path = modelsDirectory.value / "index.conf" IO.write(path, generateIndex(modelsDirectory.value, streams.value.log)) Seq(path) }, javaOptions += "-Dnetlogo.models.dir=" + modelsDirectory.value.getAbsolutePath.toString, resaveModels := { makeMainTask("org.nlogo.tools.ModelResaver", classpath = (fullClasspath in Test), workingDirectory = baseDirectory(_.getParentFile)).toTask("").value }, resaveModel := { makeMainTask("org.nlogo.tools.ModelResaver", classpath = (fullClasspath in Test), workingDirectory = baseDirectory(_.getParentFile)) } ) private def generateIndex(modelsPath: File, logger: Logger): String = { import scala.collection.JavaConverters._ val buf = new StringBuilder def println(s: String) { buf ++= s + "\n" } val paths = FileActions .enumeratePaths(modelsPath.toPath) .filterNot(p => p.toString.contains("test")) .filterNot(p => Files.isDirectory(p)) .filter(p => p.getFileName.toString.endsWith("nlogo") || p.getFileName.toString.endsWith("nlogo3d")) def infoTab(path: Path) = try { Files.readAllLines(path).asScala.mkString("\n").split("\\@\\#\\$\\#\\@\\#\\$\\#\\@\n")(2) } catch { case e: Exception => logger.error(s"while generating index, encountered error on file $path : ${e.getMessage}") throw e } println("models.indexes = [") for(path <- paths) { val info = infoTab(path) // The (?s) part allows . to match line endings val whatIsItPattern = "(?s).*## WHAT IS IT\\?\\s*\\n" if (info.matches(whatIsItPattern + ".*") ) { val firstParagraph = info.replaceFirst(whatIsItPattern, "").split('\n').head val formattedFirstParagraph = Markdown(firstParagraph, "", false) val q3 = "\"\"\"" println(s" { path: ${q3}models/${modelsPath.toPath.relativize(path)}${q3}, info: ${q3}${formattedFirstParagraph}${q3} },") } else { System.err.println("WHAT IS IT not found: " + path) } } println("]") buf.toString } }
{ "pile_set_name": "Github" }
import { extend, trim } from "lodash"; import React from "react"; import PropTypes from "prop-types"; import { useDebouncedCallback } from "use-debounce"; import { Section, Input, Checkbox, ContextHelp } from "@/components/visualizations/editor"; import { formatSimpleTemplate } from "@/lib/value-format"; function Editor({ column, onChange }) { const [onChangeDebounced] = useDebouncedCallback(onChange, 200); return ( <React.Fragment> <Section> <Input label="URL template" data-test="Table.ColumnEditor.Link.UrlTemplate" defaultValue={column.linkUrlTemplate} onChange={event => onChangeDebounced({ linkUrlTemplate: event.target.value })} /> </Section> <Section> <Input label="Text template" data-test="Table.ColumnEditor.Link.TextTemplate" defaultValue={column.linkTextTemplate} onChange={event => onChangeDebounced({ linkTextTemplate: event.target.value })} /> </Section> <Section> <Input label="Title template" data-test="Table.ColumnEditor.Link.TitleTemplate" defaultValue={column.linkTitleTemplate} onChange={event => onChangeDebounced({ linkTitleTemplate: event.target.value })} /> </Section> <Section> <Checkbox data-test="Table.ColumnEditor.Link.OpenInNewTab" checked={column.linkOpenInNewTab} onChange={event => onChange({ linkOpenInNewTab: event.target.checked })}> Open in new tab </Checkbox> </Section> <Section> <ContextHelp placement="topLeft" arrowPointAtCenter icon={<span style={{ cursor: "default" }}>Format specs {ContextHelp.defaultIcon}</span>}> <div> All columns can be referenced using <code>{"{{ column_name }}"}</code> syntax. </div> <div> Use <code>{"{{ @ }}"}</code> to reference current (this) column. </div> <div>This syntax is applicable to URL, Text and Title options.</div> </ContextHelp> </Section> </React.Fragment> ); } Editor.propTypes = { column: PropTypes.shape({ name: PropTypes.string.isRequired, linkUrlTemplate: PropTypes.string, linkTextTemplate: PropTypes.string, linkTitleTemplate: PropTypes.string, linkOpenInNewTab: PropTypes.bool, }).isRequired, onChange: PropTypes.func.isRequired, }; export default function initLinkColumn(column) { function prepareData(row) { row = extend({ "@": row[column.name] }, row); const href = trim(formatSimpleTemplate(column.linkUrlTemplate, row)); if (href === "") { return {}; } const title = trim(formatSimpleTemplate(column.linkTitleTemplate, row)); const text = trim(formatSimpleTemplate(column.linkTextTemplate, row)); const result = { href, text: text !== "" ? text : href, }; if (title !== "") { result.title = title; } if (column.linkOpenInNewTab) { result.target = "_blank"; } return result; } function LinkColumn({ row }) { // eslint-disable-line react/prop-types const { text, ...props } = prepareData(row); return <a {...props}>{text}</a>; } LinkColumn.prepareData = prepareData; return LinkColumn; } initLinkColumn.friendlyName = "Link"; initLinkColumn.Editor = Editor;
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: cdf0c6a69131b44f5bdb35de994fcea1 timeCreated: 1499380179 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true"> <f:if condition="{hasAccess}"> <f:then> <f:form action="" name="editForm" id="NewContentElementController"> <f:form.hidden name="defValues" value="" /> <f:if condition="{hasClickEvent}"> <f:then> <script> {onClickEvent -> f:format.raw()} </script> <f:render section="Filter" /> {renderedTabs -> f:format.raw()} <f:render section="FilterNothingFound" /> </f:then> <f:else> <div id="new-content-element-wizard-carousel" class="carousel slide" data-ride="carousel" data-interval="false"> <div class="carousel-inner" role="listbox"> <div class="item active" data-slide="next"> <div class="t3-new-content-element-wizard-title"> <h2>{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:1_selectType')}</h2> </div> <f:render section="Filter" /> {renderedTabs -> f:format.raw()} <f:render section="FilterNothingFound" /> </div> <div class="item"> <div class="t3-new-content-element-wizard-title"> <h2>{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:2_selectPosition') -> f:format.htmlspecialchars()}</h2> </div> <div class="t3-new-content-element-wizard-body"> {posMap -> f:format.raw()} </div> </div> </div> </div> </f:else> </f:if> </f:form> </f:then> <f:else> <h1>{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:newContentElement')}</h1> </f:else> </f:if> <f:section name="Filter"> <br> <div class="container-fluid"> <div class="navbar-header"> <div class="form-group"> <div class="input-group"> <span class="input-group-addon">{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:newContentElement.filter.label')}</span> <input type="search" autocomplete="off" class="form-control t3js-contentWizard-search" placeholder="{f:translate(key: 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:newContentElement.filter.placeholder')}"> </div> </div> </div> </div> </f:section> <f:section name="FilterNothingFound"> <div class="container-fluid"> <div class="alert alert-danger hidden t3js-filter-noresult" role="alert"> <f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:newContentElement.filter.noResults" /> </div> </div> </f:section> </html>
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using Quaver.API.Maps.Processors.Difficulty; using Quaver.API.Maps.Processors.Difficulty.Rulesets.Keys; using Quaver.API.Maps.Processors.Rating; using Quaver.API.Maps.Processors.Scoring; using Quaver.Server.Client.Structures; namespace Quaver.Shared.Screens.Tournament.Overlay { public class TournamentPlayer { /// <summary> /// </summary> public User User { get; } /// <summary> /// </summary> public ScoreProcessor Scoring { get; } /// <summary> /// </summary> public RatingProcessorKeys Rating { get; } /// <summary> /// </summary> /// <param name="user"></param> /// <param name="scoring"></param> /// <param name="difficultyRating"></param> public TournamentPlayer(User user, ScoreProcessor scoring, float difficultyRating) { User = user; Scoring = scoring; Rating = new RatingProcessorKeys(difficultyRating); } /// <summary> /// Returns if the player is winning /// </summary> /// <param name="player"></param> /// <returns></returns> public bool IsWinning(TournamentPlayer player) { var ourRating = Rating.CalculateRating(Scoring); var otherRating = player.Rating.CalculateRating(player.Scoring); if (ourRating > otherRating) return true; if (ourRating < otherRating) return false; // ReSharper disable once CompareOfFloatsByEqualityOperator if (ourRating == otherRating) return true; return true; } } }
{ "pile_set_name": "Github" }
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs defs_linux.go package ipv6 const ( sysIPV6_ADDRFORM = 0x1 sysIPV6_2292PKTINFO = 0x2 sysIPV6_2292HOPOPTS = 0x3 sysIPV6_2292DSTOPTS = 0x4 sysIPV6_2292RTHDR = 0x5 sysIPV6_2292PKTOPTIONS = 0x6 sysIPV6_CHECKSUM = 0x7 sysIPV6_2292HOPLIMIT = 0x8 sysIPV6_NEXTHOP = 0x9 sysIPV6_FLOWINFO = 0xb sysIPV6_UNICAST_HOPS = 0x10 sysIPV6_MULTICAST_IF = 0x11 sysIPV6_MULTICAST_HOPS = 0x12 sysIPV6_MULTICAST_LOOP = 0x13 sysIPV6_ADD_MEMBERSHIP = 0x14 sysIPV6_DROP_MEMBERSHIP = 0x15 sysMCAST_JOIN_GROUP = 0x2a sysMCAST_LEAVE_GROUP = 0x2d sysMCAST_JOIN_SOURCE_GROUP = 0x2e sysMCAST_LEAVE_SOURCE_GROUP = 0x2f sysMCAST_BLOCK_SOURCE = 0x2b sysMCAST_UNBLOCK_SOURCE = 0x2c sysMCAST_MSFILTER = 0x30 sysIPV6_ROUTER_ALERT = 0x16 sysIPV6_MTU_DISCOVER = 0x17 sysIPV6_MTU = 0x18 sysIPV6_RECVERR = 0x19 sysIPV6_V6ONLY = 0x1a sysIPV6_JOIN_ANYCAST = 0x1b sysIPV6_LEAVE_ANYCAST = 0x1c sysIPV6_FLOWLABEL_MGR = 0x20 sysIPV6_FLOWINFO_SEND = 0x21 sysIPV6_IPSEC_POLICY = 0x22 sysIPV6_XFRM_POLICY = 0x23 sysIPV6_RECVPKTINFO = 0x31 sysIPV6_PKTINFO = 0x32 sysIPV6_RECVHOPLIMIT = 0x33 sysIPV6_HOPLIMIT = 0x34 sysIPV6_RECVHOPOPTS = 0x35 sysIPV6_HOPOPTS = 0x36 sysIPV6_RTHDRDSTOPTS = 0x37 sysIPV6_RECVRTHDR = 0x38 sysIPV6_RTHDR = 0x39 sysIPV6_RECVDSTOPTS = 0x3a sysIPV6_DSTOPTS = 0x3b sysIPV6_RECVPATHMTU = 0x3c sysIPV6_PATHMTU = 0x3d sysIPV6_DONTFRAG = 0x3e sysIPV6_RECVTCLASS = 0x42 sysIPV6_TCLASS = 0x43 sysIPV6_ADDR_PREFERENCES = 0x48 sysIPV6_PREFER_SRC_TMP = 0x1 sysIPV6_PREFER_SRC_PUBLIC = 0x2 sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100 sysIPV6_PREFER_SRC_COA = 0x4 sysIPV6_PREFER_SRC_HOME = 0x400 sysIPV6_PREFER_SRC_CGA = 0x8 sysIPV6_PREFER_SRC_NONCGA = 0x800 sysIPV6_MINHOPCOUNT = 0x49 sysIPV6_ORIGDSTADDR = 0x4a sysIPV6_RECVORIGDSTADDR = 0x4a sysIPV6_TRANSPARENT = 0x4b sysIPV6_UNICAST_IF = 0x4c sysICMPV6_FILTER = 0x1 sysICMPV6_FILTER_BLOCK = 0x1 sysICMPV6_FILTER_PASS = 0x2 sysICMPV6_FILTER_BLOCKOTHERS = 0x3 sysICMPV6_FILTER_PASSONLY = 0x4 sizeofKernelSockaddrStorage = 0x80 sizeofSockaddrInet6 = 0x1c sizeofInet6Pktinfo = 0x14 sizeofIPv6Mtuinfo = 0x20 sizeofIPv6FlowlabelReq = 0x20 sizeofIPv6Mreq = 0x14 sizeofGroupReq = 0x88 sizeofGroupSourceReq = 0x108 sizeofICMPv6Filter = 0x20 ) type kernelSockaddrStorage struct { Family uint16 X__data [126]int8 } type sockaddrInet6 struct { Family uint16 Port uint16 Flowinfo uint32 Addr [16]byte /* in6_addr */ Scope_id uint32 } type inet6Pktinfo struct { Addr [16]byte /* in6_addr */ Ifindex int32 } type ipv6Mtuinfo struct { Addr sockaddrInet6 Mtu uint32 } type ipv6FlowlabelReq struct { Dst [16]byte /* in6_addr */ Label uint32 Action uint8 Share uint8 Flags uint16 Expires uint16 Linger uint16 X__flr_pad uint32 } type ipv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Ifindex int32 } type groupReq struct { Interface uint32 Pad_cgo_0 [4]byte Group kernelSockaddrStorage } type groupSourceReq struct { Interface uint32 Pad_cgo_0 [4]byte Group kernelSockaddrStorage Source kernelSockaddrStorage } type icmpv6Filter struct { Data [8]uint32 }
{ "pile_set_name": "Github" }
Marks: суда & ошибки smdID: 0000001811376056505653-65535 U-labels: суда---ошибки, суда--ошибки, суда-и-ошибки, суда-иошибки, суда-ошибки, судаи-ошибки, судаиошибки, судаошибки notBefore: 2013-08-09 15:55:05 notAfter: 2017-07-24 00:00:00 -----BEGIN ENCODED SMD----- PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHNtZDpzaWduZWRNYXJrIHht bG5zOnNtZD0idXJuOmlldGY6cGFyYW1zOnhtbDpuczpzaWduZWRNYXJrLTEuMCIgaWQ9Il83OGUy MmEyNy04YjA4LTQ0YjItYTg2Yi04MjI3ZTYxOThjNmQiPgogIDxzbWQ6aWQ+MDAwMDAwMTgxMTM3 NjA1NjUwNTY1My02NTUzNTwvc21kOmlkPgogIDxzbWQ6aXNzdWVySW5mbyBpc3N1ZXJJRD0iNjU1 MzUiPgogICAgPHNtZDpvcmc+SUNBTk4gVE1DSCBURVNUSU5HIFRNVjwvc21kOm9yZz4KICAgIDxz bWQ6ZW1haWw+bm90YXZhaWxhYmxlQGV4YW1wbGUuY29tPC9zbWQ6ZW1haWw+CiAgICA8c21kOnVy bD5odHRwOi8vd3d3LmV4YW1wbGUuY29tPC9zbWQ6dXJsPgogICAgPHNtZDp2b2ljZT4rMzIuMDAw MDAwPC9zbWQ6dm9pY2U+CiAgPC9zbWQ6aXNzdWVySW5mbz4KICA8c21kOm5vdEJlZm9yZT4yMDEz LTA4LTA5VDEzOjU1OjA1LjY1M1o8L3NtZDpub3RCZWZvcmU+CiAgPHNtZDpub3RBZnRlcj4yMDE3 LTA3LTIzVDIyOjAwOjAwLjAwMFo8L3NtZDpub3RBZnRlcj4KICA8bWFyazptYXJrIHhtbG5zOm1h cms9InVybjppZXRmOnBhcmFtczp4bWw6bnM6bWFyay0xLjAiPgogICAgPG1hcms6dHJhZGVtYXJr PgogICAgICA8bWFyazppZD4wMDA1MjQxMzczNDcwNDE5MTM3MzQ3MDQxOS02NTUzNTwvbWFyazpp ZD4KICAgICAgPG1hcms6bWFya05hbWU+0YHRg9C00LAgJmFtcDsg0L7RiNC40LHQutC4PC9tYXJr Om1hcmtOYW1lPgogICAgICA8bWFyazpob2xkZXIgZW50aXRsZW1lbnQ9Im93bmVyIj4KICAgICAg ICA8bWFyazpvcmc+0JDQs9C10L3RgtGB0YLQstC+PC9tYXJrOm9yZz4KICAgICAgICA8bWFyazph ZGRyPgogICAgICAgICAgPG1hcms6c3RyZWV0PtCf0YDQvtGB0L/QtdC60YIg0JLQtdGA0L3QsNC0 0YHQutC+0LPQviAxNTwvbWFyazpzdHJlZXQ+CiAgICAgICAgICA8bWFyazpjaXR5PtCc0L7RgdC6 0LLQsDwvbWFyazpjaXR5PgogICAgICAgICAgPG1hcms6cGM+MTE3NDg1PC9tYXJrOnBjPgogICAg ICAgICAgPG1hcms6Y2M+UlU8L21hcms6Y2M+CiAgICAgICAgPC9tYXJrOmFkZHI+CiAgICAgIDwv bWFyazpob2xkZXI+CiAgICAgIDxtYXJrOmNvbnRhY3QgdHlwZT0iYWdlbnQiPgogICAgICAgIDxt YXJrOm5hbWU+0J3QsNGC0LDQu9GM0Y8g0JDQvdGC0L7QvdC+0LLQsDwvbWFyazpuYW1lPgogICAg ICAgIDxtYXJrOm9yZz7QkNCz0LXQvdGC0YHRgtCy0L48L21hcms6b3JnPgogICAgICAgIDxtYXJr OmFkZHI+CiAgICAgICAgICA8bWFyazpzdHJlZXQ+0J/RgNC+0YHQv9C10LrRgiDQktC10YDQvdCw 0LTRgdC60L7Qs9C+IDE1PC9tYXJrOnN0cmVldD4KICAgICAgICAgIDxtYXJrOmNpdHk+0JzQvtGB 0LrQstCwPC9tYXJrOmNpdHk+CiAgICAgICAgICA8bWFyazpwYz4xMTc0ODU8L21hcms6cGM+CiAg ICAgICAgICA8bWFyazpjYz5SVTwvbWFyazpjYz4KICAgICAgICA8L21hcms6YWRkcj4KICAgICAg ICA8bWFyazp2b2ljZT4rNy45MTg4MjIxNjc0PC9tYXJrOnZvaWNlPgogICAgICAgIDxtYXJrOmZh eD4rNy45MTg4MjIxNjczPC9tYXJrOmZheD4KICAgICAgICA8bWFyazplbWFpbD5pbmZvQGFnZW5j eS5ydTwvbWFyazplbWFpbD4KICAgICAgPC9tYXJrOmNvbnRhY3Q+CiAgICAgIDxtYXJrOmp1cmlz ZGljdGlvbj5SVTwvbWFyazpqdXJpc2RpY3Rpb24+CiAgICAgIDxtYXJrOmNsYXNzPjE1PC9tYXJr OmNsYXNzPgogICAgICA8bWFyazpsYWJlbD54bi0tLS03c2JlandibjNheHUzZDwvbWFyazpsYWJl bD4KICAgICAgPG1hcms6bGFiZWw+eG4tLS0tN3NiZWp3YWJwN2F6YXc5ZDwvbWFyazpsYWJlbD4K ICAgICAgPG1hcms6bGFiZWw+eG4tLS0tN3NiZWp2YmJwN2F6YXc5ZDwvbWFyazpsYWJlbD4KICAg ICAgPG1hcms6bGFiZWw+eG4tLS0tLTZrY2dsMWFicDdhemF3OWQ8L21hcms6bGFiZWw+CiAgICAg IDxtYXJrOmxhYmVsPnhuLS0tLS0tNWNkaW42YWJyMWIxYXk1ZTwvbWFyazpsYWJlbD4KICAgICAg PG1hcms6bGFiZWw+eG4tLTgwYWNocmFibjNheHUzZDwvbWFyazpsYWJlbD4KICAgICAgPG1hcms6 bGFiZWw+eG4tLTgwYWNocmJsenZzN2M8L21hcms6bGFiZWw+CiAgICAgIDxtYXJrOmxhYmVsPnhu LS0tLS02a2NnbDBhYmJyMWIxYXk1ZTwvbWFyazpsYWJlbD4KICAgICAgPG1hcms6Z29vZHNBbmRT ZXJ2aWNlcz7Qs9C40YLQsNGA0LA8L21hcms6Z29vZHNBbmRTZXJ2aWNlcz4KICAgICAgPG1hcms6 cmVnTnVtPjEyMzQ8L21hcms6cmVnTnVtPgogICAgICA8bWFyazpyZWdEYXRlPjIwMTItMTItMzFU MjM6MDA6MDAuMDAwWjwvbWFyazpyZWdEYXRlPgogICAgPC9tYXJrOnRyYWRlbWFyaz4KICA8L21h cms6bWFyaz4KPGRzOlNpZ25hdHVyZSB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8w OS94bWxkc2lnIyIgSWQ9Il83MTc1MjQ5OS1jYTE4LTRhNTAtOTQ1Ni1iYjBmMTU0MTJiMjAiPjxk czpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDov L3d3dy53My5vcmcvMjAwMS8xMC94bWwtZXhjLWMxNG4jIi8+PGRzOlNpZ25hdHVyZU1ldGhvZCBB bGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvMDQveG1sZHNpZy1tb3JlI3JzYS1zaGEy NTYiLz48ZHM6UmVmZXJlbmNlIFVSST0iI19jNDU2NmI1My01MGM5LTQyNTktOTkxMC03OWNlNjU1 MGU3YTQiPjxkczpUcmFuc2Zvcm1zPjxkczpUcmFuc2Zvcm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3 LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjZW52ZWxvcGVkLXNpZ25hdHVyZSIvPjxkczpUcmFuc2Zv cm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzEwL3htbC1leGMtYzE0biMiLz48 L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMu b3JnLzIwMDEvMDQveG1sZW5jI3NoYTI1NiIvPjxkczpEaWdlc3RWYWx1ZT5ORjRBN2toNzZDUVNY Sjh5MGU5SzhvTnNsQ1Z0QldGaEtwbGh3bEM4T0JNPTwvZHM6RGlnZXN0VmFsdWU+PC9kczpSZWZl cmVuY2U+PGRzOlJlZmVyZW5jZSBVUkk9IiNfZGExMzFmNjktYWZmMC00M2NmLTg5NjItYjNkMjgx N2Q5YmFlIj48ZHM6VHJhbnNmb3Jtcz48ZHM6VHJhbnNmb3JtIEFsZ29yaXRobT0iaHR0cDovL3d3 dy53My5vcmcvMjAwMS8xMC94bWwtZXhjLWMxNG4jIi8+PC9kczpUcmFuc2Zvcm1zPjxkczpEaWdl c3RNZXRob2QgQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGVuYyNzaGEy NTYiLz48ZHM6RGlnZXN0VmFsdWU+RVFaQ3RRdy93UG96aFZhRlVUaitsVEZxa0JjOHBZQ3VQdFcv ZEhIVUNQOD08L2RzOkRpZ2VzdFZhbHVlPjwvZHM6UmVmZXJlbmNlPjwvZHM6U2lnbmVkSW5mbz48 ZHM6U2lnbmF0dXJlVmFsdWUgSWQ9Il81N2U4ZjU4Yi0xMTVhLTQ2N2UtYTkwMC0yZWRmN2U3MjA4 MzAiPmtaZEYyV1VRYlg2aENQQzd3NktnRkxtR1UrTktjbVgvSVZuQlR2SEo3Z0J2MFlIbi82NkFl N1NkTUZYRE9XUHJLeXdHdSt2VFQ3ZkYKSCttdGlFSWtZanJVdlNyNExXK1lGajIyS2lVcmxHd2hQ ZTcxN2dKRkY0ZUxaWUNOcnhCbldIT0kxL0YyQkl4THY4UkhaMlpRZGZ0ZgpkQUdiUGo5ZXBOQVFR Ni9uYXF4VmRQNGlDOUtRRFZXMlRoaHNsTlJIc0ZwZGtGK3RmdmUrYStySWdzVGdtTGJTZDZGVUNp NCs4dmMzCjJod3BkaWNPQnpOalBqTmYzOTBFWG1FdHRkNmplalNUK0JWSzBmb1B3dDBkb3FPMzhG bWVOWG41WGxGWWhneEd5UU5iaXZDbmFlaXEKSWJxano1ZU1MZWp3ZmQrN2NGMUhRQnczQzFrSUlM K0xYenBOK1E9PTwvZHM6U2lnbmF0dXJlVmFsdWU+PGRzOktleUluZm8gSWQ9Il9kYTEzMWY2OS1h ZmYwLTQzY2YtODk2Mi1iM2QyODE3ZDliYWUiPjxkczpYNTA5RGF0YT48ZHM6WDUwOUNlcnRpZmlj YXRlPk1JSUZMekNDQkJlZ0F3SUJBZ0lnTHJBYmV2b2FlNTJ5M2Y2QzJ0QjBTbjNwN1hKbTBUMDJG b2d4S0NmTmhYb3dEUVlKS29aSWh2Y04KQVFFTEJRQXdmREVMTUFrR0ExVUVCaE1DVlZNeFBEQTZC Z05WQkFvVE0wbHVkR1Z5Ym1WMElFTnZjbkJ2Y21GMGFXOXVJR1p2Y2lCQgpjM05wWjI1bFpDQk9Z VzFsY3lCaGJtUWdUblZ0WW1WeWN6RXZNQzBHQTFVRUF4TW1TVU5CVGs0Z1ZISmhaR1Z0WVhKcklF TnNaV0Z5CmFXNW5hRzkxYzJVZ1VHbHNiM1FnUTBFd0hoY05NVE13TmpJMk1EQXdNREF3V2hjTk1U Z3dOakkxTWpNMU9UVTVXakNCanpFTE1Ba0cKQTFVRUJoTUNRa1V4SURBZUJnTlZCQWdURjBKeWRY TnpaV3h6TFVOaGNHbDBZV3dnVW1WbmFXOXVNUkV3RHdZRFZRUUhFd2hDY25WegpjMlZzY3pFUk1B OEdBMVVFQ2hNSVJHVnNiMmwwZEdVeE9EQTJCZ05WQkFNVEwwbERRVTVPSUZSTlEwZ2dRWFYwYUc5 eWFYcGxaQ0JVCmNtRmtaVzFoY21zZ1VHbHNiM1FnVm1Gc2FXUmhkRzl5TUlJQklqQU5CZ2txaGtp Rzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUEKeGxwM0twWUhYM1d5QXNGaFNrM0x3V2ZuR2x4 blVERnFGWkEzVW91TVlqL1hpZ2JNa05lRVhJamxrUk9LVDRPUEdmUngvTEF5UmxRUQpqQ012NHFo YmtjWDFwN2FyNjNmbHE0U1pOVmNsMTVsN2gwdVQ1OEZ6U2ZubHowdTVya0hmSkltRDQzK21hUC84 Z3YzNkZSMjdqVzhSCjl3WTRoaytXczRJQjBpRlNkOFNYdjFLcjh3L0ptTVFTRGtpdUcrUmZJaXVi d1EvZnk3RWtqNVFXaFBadyttTXhOS25IVUx5M3hZejIKTHdWZmZ0andVdWVhY3ZxTlJDa01YbENs T0FEcWZUOG9TWm9lRFhlaEh2bFBzTENlbUdCb1RLdXJza0lTNjlGMHlQRUg1Z3plMEgrZgo4RlJP c0lvS1NzVlEzNEI0Uy9qb0U2N25wc0pQVGRLc05QSlR5UUlEQVFBQm80SUJoekNDQVlNd0RBWURW UjBUQVFIL0JBSXdBREFkCkJnTlZIUTRFRmdRVW9GcFk3NnA1eW9ORFJHdFFwelZ1UjgxVVdRMHdn Y1lHQTFVZEl3U0J2akNCdTRBVXc2MCtwdFlSQUVXQVhEcFgKU29wdDNERU5ubkdoZ1lDa2ZqQjhN UXN3Q1FZRFZRUUdFd0pWVXpFOE1Eb0dBMVVFQ2hNelNXNTBaWEp1WlhRZ1EyOXljRzl5WVhScApi MjRnWm05eUlFRnpjMmxuYm1Wa0lFNWhiV1Z6SUdGdVpDQk9kVzFpWlhKek1TOHdMUVlEVlFRREV5 WkpRMEZPVGlCVWNtRmtaVzFoCmNtc2dRMnhsWVhKcGJtZG9iM1Z6WlNCUWFXeHZkQ0JEUVlJZ0xy QWJldm9hZTUyeTNmNkMydEIwU24zcDdYSm0wVDAyRm9neEtDZk4KaFhrd0RnWURWUjBQQVFIL0JB UURBZ2VBTURRR0ExVWRId1F0TUNzd0thQW5vQ1dHSTJoMGRIQTZMeTlqY213dWFXTmhibTR1YjNK bgpMM1J0WTJoZmNHbHNiM1F1WTNKc01FVUdBMVVkSUFRK01Ed3dPZ1lES2dNRU1ETXdNUVlJS3dZ QkJRVUhBZ0VXSldoMGRIQTZMeTkzCmQzY3VhV05oYm00dWIzSm5MM0JwYkc5MFgzSmxjRzl6YVhS dmNua3dEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSWVEWVlKcjYwVzMKeTlRcyszelJWSTlrZWtL b201dmtIT2FsQjN3SGFaSWFBRllwSTk4dFkwYVZOOWFHT04wdjZXUUYrbnZ6MUtSWlFiQXowMUJY dGFSSgo0bVBrYXJoaHVMbjlOa0J4cDhIUjVxY2MrS0g3Z3Y2ci9jMGlHM2JDTkorUVNyN1FmKzVN bE1vNnpMNVVkZFUvVDJqaWJNWENqL2YyCjFRdzN4OVFnb3lYTEZKOW96YUxnUTlSTWtMbE9temtD QWlYTjVBYjQzYUo5ZjdOMmdFMk5uUmpOS21tQzlBQlEwVFJ3RUtWTGhWbDEKVUdxQ0hKM0FsQlhX SVhONXNqUFFjRC8rbkhlRVhNeFl2bEF5cXhYb0QzTVd0UVZqN2oyb3FsYWtPQk1nRzgrcTJxWWxt QnRzNEZOaQp3NzQ4SWw1ODZIS0JScXhIdFpkUktXMlZxYVE9PC9kczpYNTA5Q2VydGlmaWNhdGU+ PC9kczpYNTA5RGF0YT48L2RzOktleUluZm8+PC9kczpTaWduYXR1cmU+PC9zbWQ6c2lnbmVkTWFy az4K -----END ENCODED SMD-----
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="iso-8859-1"?> <project> <fileVersion>2</fileVersion> <configuration> <name>Debug</name> <toolchain> <name>ARM</name> </toolchain> <debug>1</debug> <settings> <name>General</name> <archiveVersion>3</archiveVersion> <data> <version>22</version> <wantNonLocal>1</wantNonLocal> <debug>1</debug> <option> <name>ExePath</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt\Debug\Exe</state> </option> <option> <name>ObjPath</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt\Debug\Obj</state> </option> <option> <name>ListPath</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt\Debug\List</state> </option> <option> <name>Variant</name> <version>20</version> <state>40</state> </option> <option> <name>GEndianMode</name> <state>0</state> </option> <option> <name>Input variant</name> <version>3</version> <state>1</state> </option> <option> <name>Input description</name> <state>Full formatting.</state> </option> <option> <name>Output variant</name> <version>2</version> <state>1</state> </option> <option> <name>Output description</name> <state>Full formatting.</state> </option> <option> <name>GOutputBinary</name> <state>0</state> </option> <option> <name>FPU</name> <version>2</version> <state>5</state> </option> <option> <name>OGCoreOrChip</name> <state>1</state> </option> <option> <name>GRuntimeLibSelect</name> <version>0</version> <state>1</state> </option> <option> <name>GRuntimeLibSelectSlave</name> <version>0</version> <state>1</state> </option> <option> <name>RTDescription</name> <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state> </option> <option> <name>OGProductVersion</name> <state>5.10.0.159</state> </option> <option> <name>OGLastSavedByProductVersion</name> <state>6.70.1.5793</state> </option> <option> <name>GeneralEnableMisra</name> <state>0</state> </option> <option> <name>GeneralMisraVerbose</name> <state>0</state> </option> <option> <name>OGChipSelectEditMenu</name> <state>EFR32MG12P432F1024GL125 SiliconLaboratories EFR32MG12P432F1024GL125</state> </option> <option> <name>GenLowLevelInterface</name> <state>0</state> </option> <option> <name>GEndianModeBE</name> <state>1</state> </option> <option> <name>OGBufferedTerminalOutput</name> <state>0</state> </option> <option> <name>GenStdoutInterface</name> <state>0</state> </option> <option> <name>GeneralMisraRules98</name> <version>0</version> <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state> </option> <option> <name>GeneralMisraVer</name> <state>0</state> </option> <option> <name>GeneralMisraRules04</name> <version>0</version> <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state> </option> <option> <name>RTConfigPath2</name> <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state> </option> <option> <name>GFPUCoreSlave</name> <version>20</version> <state>40</state> </option> <option> <name>GBECoreSlave</name> <version>20</version> <state>40</state> </option> <option> <name>OGUseCmsis</name> <state>0</state> </option> <option> <name>OGUseCmsisDspLib</name> <state>0</state> </option> <option> <name>GRuntimeLibThreads</name> <state>0</state> </option> </data> </settings> <settings> <name>ICCARM</name> <archiveVersion>2</archiveVersion> <data> <version>29</version> <wantNonLocal>1</wantNonLocal> <debug>1</debug> <option> <name>CCDefines</name> <state>EFR32MG12P432F1024GL125</state> </option> <option> <name>CCPreprocFile</name> <state>0</state> </option> <option> <name>CCPreprocComments</name> <state>0</state> </option> <option> <name>CCPreprocLine</name> <state>0</state> </option> <option> <name>CCListCFile</name> <state>0</state> </option> <option> <name>CCListCMnemonics</name> <state>0</state> </option> <option> <name>CCListCMessages</name> <state>0</state> </option> <option> <name>CCListAssFile</name> <state>0</state> </option> <option> <name>CCListAssSource</name> <state>0</state> </option> <option> <name>CCEnableRemarks</name> <state>0</state> </option> <option> <name>CCDiagSuppress</name> <state></state> </option> <option> <name>CCDiagRemark</name> <state></state> </option> <option> <name>CCDiagWarning</name> <state></state> </option> <option> <name>CCDiagError</name> <state></state> </option> <option> <name>CCObjPrefix</name> <state>1</state> </option> <option> <name>CCAllowList</name> <version>1</version> <state>0000000</state> </option> <option> <name>CCDebugInfo</name> <state>1</state> </option> <option> <name>IEndianMode</name> <state>1</state> </option> <option> <name>IProcessor</name> <state>1</state> </option> <option> <name>IExtraOptionsCheck</name> <state>0</state> </option> <option> <name>IExtraOptions</name> </option> <option> <name>CCLangConformance</name> <state>0</state> </option> <option> <name>CCSignedPlainChar</name> <state>1</state> </option> <option> <name>CCRequirePrototypes</name> <state>0</state> </option> <option> <name>CCMultibyteSupport</name> <state>0</state> </option> <option> <name>CCDiagWarnAreErr</name> <state></state> </option> <option> <name>CCCompilerRuntimeInfo</name> <state>0</state> </option> <option> <name>IFpuProcessor</name> <state>1</state> </option> <option> <name>OutputFile</name> <state>$FILE_BNAME$.o</state> </option> <option> <name>CCLibConfigHeader</name> <state>1</state> </option> <option> <name>PreInclude</name> <state></state> </option> <option> <name>CompilerMisraOverride</name> <state>0</state> </option> <option> <name>CCIncludePath2</name> <state>$PROJ_DIR$\..\..\..\..\..\platform\CMSIS\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs\EFR32MG12P\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\emlib\inc</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\EFR32MG12_BRD4161A\config</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\bsp</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\drivers</state> </option> <option> <name>CCStdIncCheck</name> <state>0</state> </option> <option> <name>CCCodeSection</name> <state>.text</state> </option> <option> <name>IInterwork2</name> <state>0</state> </option> <option> <name>IProcessorMode2</name> <state>1</state> </option> <option> <name>CCOptLevel</name> <state>0</state> </option> <option> <name>CCOptStrategy</name> <version>0</version> <state>0</state> </option> <option> <name>CCOptLevelSlave</name> <state>0</state> </option> <option> <name>CompilerMisraRules98</name> <version>0</version> <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state> </option> <option> <name>CompilerMisraRules04</name> <version>0</version> <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state> </option> <option> <name>CCPosIndRopi</name> <state>0</state> </option> <option> <name>CCPosIndRwpi</name> <state>0</state> </option> <option> <name>CCPosIndNoDynInit</name> <state>0</state> </option> <option> <name>IccLang</name> <state>0</state> </option> <option> <name>IccCDialect</name> <state>1</state> </option> <option> <name>IccAllowVLA</name> <state>0</state> </option> <option> <name>IccCppDialect</name> <state>1</state> </option> <option> <name>IccExceptions</name> <state>1</state> </option> <option> <name>IccRTTI</name> <state>1</state> </option> <option> <name>IccStaticDestr</name> <state>1</state> </option> <option> <name>IccCppInlineSemantics</name> <state>0</state> </option> <option> <name>IccCmsis</name> <state>1</state> </option> <option> <name>IccFloatSemantics</name> <state>0</state> </option> <option> <name>CCOptimizationNoSizeConstraints</name> <state>0</state> </option> <option> <name>CCNoLiteralPool</name> <state>0</state> </option> </data> </settings> <settings> <name>AARM</name> <archiveVersion>2</archiveVersion> <data> <version>9</version> <wantNonLocal>1</wantNonLocal> <debug>1</debug> <option> <name>AObjPrefix</name> <state>1</state> </option> <option> <name>AEndian</name> <state>1</state> </option> <option> <name>ACaseSensitivity</name> <state>1</state> </option> <option> <name>MacroChars</name> <version>0</version> <state>0</state> </option> <option> <name>AWarnEnable</name> <state>0</state> </option> <option> <name>AWarnWhat</name> <state>0</state> </option> <option> <name>AWarnOne</name> <state></state> </option> <option> <name>AWarnRange1</name> <state></state> </option> <option> <name>AWarnRange2</name> <state></state> </option> <option> <name>ADebug</name> <state>1</state> </option> <option> <name>AltRegisterNames</name> <state>0</state> </option> <option> <name>ADefines</name> <state>EFR32MG12P432F1024GL125</state> </option> <option> <name>AList</name> <state>0</state> </option> <option> <name>AListHeader</name> <state>1</state> </option> <option> <name>AListing</name> <state>1</state> </option> <option> <name>Includes</name> <state>0</state> </option> <option> <name>MacDefs</name> <state>0</state> </option> <option> <name>MacExps</name> <state>1</state> </option> <option> <name>MacExec</name> <state>0</state> </option> <option> <name>OnlyAssed</name> <state>0</state> </option> <option> <name>MultiLine</name> <state>0</state> </option> <option> <name>PageLengthCheck</name> <state>0</state> </option> <option> <name>PageLength</name> <state>80</state> </option> <option> <name>TabSpacing</name> <state>8</state> </option> <option> <name>AXRef</name> <state>0</state> </option> <option> <name>AXRefDefines</name> <state>0</state> </option> <option> <name>AXRefInternal</name> <state>0</state> </option> <option> <name>AXRefDual</name> <state>0</state> </option> <option> <name>AProcessor</name> <state>1</state> </option> <option> <name>AFpuProcessor</name> <state>1</state> </option> <option> <name>AOutputFile</name> <state>$FILE_BNAME$.o</state> </option> <option> <name>AMultibyteSupport</name> <state>0</state> </option> <option> <name>ALimitErrorsCheck</name> <state>0</state> </option> <option> <name>ALimitErrorsEdit</name> <state>100</state> </option> <option> <name>AIgnoreStdInclude</name> <state>0</state> </option> <option> <name>AUserIncludes</name> <state>$PROJ_DIR$\..\..\..\..\..\platform\CMSIS\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs\EFR32MG12P\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\emlib\inc</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\EFR32MG12_BRD4161A\config</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\bsp</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\drivers</state> </option> <option> <name>AExtraOptionsCheckV2</name> <state>0</state> </option> <option> <name>AExtraOptionsV2</name> <state></state> </option> </data> </settings> <settings> <name>OBJCOPY</name> <archiveVersion>0</archiveVersion> <data> <version>1</version> <wantNonLocal>1</wantNonLocal> <debug>1</debug> <option> <name>OOCOutputFormat</name> <version>2</version> <state>2</state> </option> <option> <name>OCOutputOverride</name> <state>1</state> </option> <option> <name>OOCOutputFile</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt.bin</state> </option> <option> <name>OOCCommandLineProducer</name> <state>1</state> </option> <option> <name>OOCObjCopyEnable</name> <state>1</state> </option> </data> </settings> <settings> <name>CUSTOM</name> <archiveVersion>3</archiveVersion> <data> <extensions></extensions> <cmdline></cmdline> </data> </settings> <settings> <name>BICOMP</name> <archiveVersion>0</archiveVersion> <data/> </settings> <settings> <name>BUILDACTION</name> <archiveVersion>1</archiveVersion> <data> <prebuild></prebuild> <postbuild></postbuild> </data> </settings> <settings> <name>ILINK</name> <archiveVersion>0</archiveVersion> <data> <version>16</version> <wantNonLocal>1</wantNonLocal> <debug>1</debug> <option> <name>IlinkLibIOConfig</name> <state>1</state> </option> <option> <name>XLinkMisraHandler</name> <state>0</state> </option> <option> <name>IlinkInputFileSlave</name> <state>0</state> </option> <option> <name>IlinkOutputFile</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt.out</state> </option> <option> <name>IlinkDebugInfoEnable</name> <state>1</state> </option> <option> <name>IlinkKeepSymbols</name> <state></state> </option> <option> <name>IlinkRawBinaryFile</name> <state></state> </option> <option> <name>IlinkRawBinarySymbol</name> <state></state> </option> <option> <name>IlinkRawBinarySegment</name> <state></state> </option> <option> <name>IlinkRawBinaryAlign</name> <state></state> </option> <option> <name>IlinkDefines</name> <state></state> </option> <option> <name>IlinkConfigDefines</name> <state></state> </option> <option> <name>IlinkMapFile</name> <state>1</state> </option> <option> <name>IlinkLogFile</name> <state>0</state> </option> <option> <name>IlinkLogInitialization</name> <state>0</state> </option> <option> <name>IlinkLogModule</name> <state>0</state> </option> <option> <name>IlinkLogSection</name> <state>0</state> </option> <option> <name>IlinkLogVeneer</name> <state>0</state> </option> <option> <name>IlinkIcfOverride</name> <state>0</state> </option> <option> <name>IlinkIcfFile</name> <state></state> </option> <option> <name>IlinkIcfFileSlave</name> <state></state> </option> <option> <name>IlinkEnableRemarks</name> <state>0</state> </option> <option> <name>IlinkSuppressDiags</name> <state></state> </option> <option> <name>IlinkTreatAsRem</name> <state></state> </option> <option> <name>IlinkTreatAsWarn</name> <state></state> </option> <option> <name>IlinkTreatAsErr</name> <state></state> </option> <option> <name>IlinkWarningsAreErrors</name> <state></state> </option> <option> <name>IlinkUseExtraOptions</name> <state>0</state> </option> <option> <name>IlinkExtraOptions</name> </option> <option> <name>IlinkLowLevelInterfaceSlave</name> <state>1</state> </option> <option> <name>IlinkAutoLibEnable</name> <state>1</state> </option> <option> <name>IlinkAdditionalLibs</name> <state></state> </option> <option> <name>IlinkOverrideProgramEntryLabel</name> <state>0</state> </option> <option> <name>IlinkProgramEntryLabelSelect</name> <state>0</state> </option> <option> <name>IlinkProgramEntryLabel</name> <state>__iar_program_start</state> </option> <option> <name>DoFill</name> <state>0</state> </option> <option> <name>FillerByte</name> <state>0xFF</state> </option> <option> <name>FillerStart</name> <state>0x0</state> </option> <option> <name>FillerEnd</name> <state>0x0</state> </option> <option> <name>CrcSize</name> <version>0</version> <state>1</state> </option> <option> <name>CrcAlign</name> <state>1</state> </option> <option> <name>CrcPoly</name> <state>0x11021</state> </option> <option> <name>CrcCompl</name> <version>0</version> <state>0</state> </option> <option> <name>CrcBitOrder</name> <version>0</version> <state>0</state> </option> <option> <name>CrcInitialValue</name> <state>0x0</state> </option> <option> <name>DoCrc</name> <state>0</state> </option> <option> <name>IlinkBE8Slave</name> <state>1</state> </option> <option> <name>IlinkBufferedTerminalOutput</name> <state>1</state> </option> <option> <name>IlinkStdoutInterfaceSlave</name> <state>1</state> </option> <option> <name>CrcFullSize</name> <state>0</state> </option> <option> <name>IlinkIElfToolPostProcess</name> <state>0</state> </option> <option> <name>IlinkLogAutoLibSelect</name> <state>0</state> </option> <option> <name>IlinkLogRedirSymbols</name> <state>0</state> </option> <option> <name>IlinkLogUnusedFragments</name> <state>0</state> </option> <option> <name>IlinkCrcReverseByteOrder</name> <state>0</state> </option> <option> <name>IlinkCrcUseAsInput</name> <state>1</state> </option> <option> <name>IlinkOptInline</name> <state>0</state> </option> <option> <name>IlinkOptExceptionsAllow</name> <state>1</state> </option> <option> <name>IlinkOptExceptionsForce</name> <state>0</state> </option> <option> <name>IlinkCmsis</name> <state>1</state> </option> <option> <name>IlinkOptMergeDuplSections</name> <state>0</state> </option> <option> <name>IlinkOptUseVfe</name> <state>1</state> </option> <option> <name>IlinkOptForceVfe</name> <state>0</state> </option> <option> <name>IlinkStackAnalysisEnable</name> <state>0</state> </option> <option> <name>IlinkStackControlFile</name> <state></state> </option> <option> <name>IlinkStackCallGraphFile</name> <state></state> </option> <option> <name>CrcAlgorithm</name> <version>0</version> <state>1</state> </option> <option> <name>CrcUnitSize</name> <version>0</version> <state>0</state> </option> <option> <name>IlinkThreadsSlave</name> <state>1</state> </option> </data> </settings> <settings> <name>IARCHIVE</name> <archiveVersion>0</archiveVersion> <data> <version>0</version> <wantNonLocal>1</wantNonLocal> <debug>1</debug> <option> <name>IarchiveInputs</name> <state></state> </option> <option> <name>IarchiveOverride</name> <state>0</state> </option> <option> <name>IarchiveOutput</name> <state>###Unitialized###</state> </option> </data> </settings> <settings> <name>BILINK</name> <archiveVersion>0</archiveVersion> <data/> </settings> </configuration> <configuration> <name>Release</name> <toolchain> <name>ARM</name> </toolchain> <debug>0</debug> <settings> <name>General</name> <archiveVersion>3</archiveVersion> <data> <version>22</version> <wantNonLocal>1</wantNonLocal> <debug>0</debug> <option> <name>ExePath</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt\Release\Exe</state> </option> <option> <name>ObjPath</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt\Release\Obj</state> </option> <option> <name>ListPath</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt\Release\List</state> </option> <option> <name>Variant</name> <version>20</version> <state>0</state> </option> <option> <name>GEndianMode</name> <state>0</state> </option> <option> <name>Input variant</name> <version>3</version> <state>1</state> </option> <option> <name>Input description</name> <state>Full formatting.</state> </option> <option> <name>Output variant</name> <version>2</version> <state>1</state> </option> <option> <name>Output description</name> <state>Full formatting.</state> </option> <option> <name>GOutputBinary</name> <state>0</state> </option> <option> <name>FPU</name> <version>2</version> <state>5</state> </option> <option> <name>OGCoreOrChip</name> <state>1</state> </option> <option> <name>GRuntimeLibSelect</name> <version>0</version> <state>1</state> </option> <option> <name>GRuntimeLibSelectSlave</name> <version>0</version> <state>1</state> </option> <option> <name>RTDescription</name> <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state> </option> <option> <name>OGProductVersion</name> <state>5.10.0.159</state> </option> <option> <name>OGLastSavedByProductVersion</name> <state>6.70.1.5793</state> </option> <option> <name>GeneralEnableMisra</name> <state>0</state> </option> <option> <name>GeneralMisraVerbose</name> <state>0</state> </option> <option> <name>OGChipSelectEditMenu</name> <state>EFR32MG12P432F1024GL125 SiliconLaboratories EFR32MG12P432F1024GL125</state> </option> <option> <name>GenLowLevelInterface</name> <state>0</state> </option> <option> <name>GEndianModeBE</name> <state>1</state> </option> <option> <name>OGBufferedTerminalOutput</name> <state>0</state> </option> <option> <name>GenStdoutInterface</name> <state>0</state> </option> <option> <name>GeneralMisraRules98</name> <version>0</version> <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state> </option> <option> <name>GeneralMisraVer</name> <state>0</state> </option> <option> <name>GeneralMisraRules04</name> <version>0</version> <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state> </option> <option> <name>RTConfigPath2</name> <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state> </option> <option> <name>GFPUCoreSlave</name> <version>20</version> <state>40</state> </option> <option> <name>GBECoreSlave</name> <version>20</version> <state>40</state> </option> <option> <name>OGUseCmsis</name> <state>0</state> </option> <option> <name>OGUseCmsisDspLib</name> <state>0</state> </option> <option> <name>GRuntimeLibThreads</name> <state>0</state> </option> </data> </settings> <settings> <name>ICCARM</name> <archiveVersion>2</archiveVersion> <data> <version>29</version> <wantNonLocal>1</wantNonLocal> <debug>0</debug> <option> <name>CCOptimizationNoSizeConstraints</name> <state>0</state> </option> <option> <name>CCDefines</name> <state>NDEBUG</state> <state>EFR32MG12P432F1024GL125</state> </option> <option> <name>CCPreprocFile</name> <state>0</state> </option> <option> <name>CCPreprocComments</name> <state>0</state> </option> <option> <name>CCPreprocLine</name> <state>0</state> </option> <option> <name>CCListCFile</name> <state>0</state> </option> <option> <name>CCListCMnemonics</name> <state>0</state> </option> <option> <name>CCListCMessages</name> <state>0</state> </option> <option> <name>CCListAssFile</name> <state>0</state> </option> <option> <name>CCListAssSource</name> <state>0</state> </option> <option> <name>CCEnableRemarks</name> <state>0</state> </option> <option> <name>CCDiagSuppress</name> <state></state> </option> <option> <name>CCDiagRemark</name> <state></state> </option> <option> <name>CCDiagWarning</name> <state></state> </option> <option> <name>CCDiagError</name> <state></state> </option> <option> <name>CCObjPrefix</name> <state>1</state> </option> <option> <name>CCAllowList</name> <version>1</version> <state>1111111</state> </option> <option> <name>CCDebugInfo</name> <state>1</state> </option> <option> <name>IEndianMode</name> <state>1</state> </option> <option> <name>IProcessor</name> <state>1</state> </option> <option> <name>IExtraOptionsCheck</name> <state>0</state> </option> <option> <name>IExtraOptions</name> </option> <option> <name>CCLangConformance</name> <state>0</state> </option> <option> <name>CCSignedPlainChar</name> <state>1</state> </option> <option> <name>CCRequirePrototypes</name> <state>0</state> </option> <option> <name>CCMultibyteSupport</name> <state>0</state> </option> <option> <name>CCDiagWarnAreErr</name> <state></state> </option> <option> <name>CCCompilerRuntimeInfo</name> <state>0</state> </option> <option> <name>IFpuProcessor</name> <state>1</state> </option> <option> <name>OutputFile</name> <state>$FILE_BNAME$.o</state> </option> <option> <name>CCLibConfigHeader</name> <state>1</state> </option> <option> <name>PreInclude</name> <state></state> </option> <option> <name>CompilerMisraOverride</name> <state>0</state> </option> <option> <name>CCIncludePath2</name> <state>$PROJ_DIR$\..\..\..\..\..\platform\CMSIS\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs\EFR32MG12P\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\emlib\inc</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\EFR32MG12_BRD4161A\config</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\bsp</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\drivers</state> </option> <option> <name>CCStdIncCheck</name> <state>0</state> </option> <option> <name>CCCodeSection</name> <state>.text</state> </option> <option> <name>IInterwork2</name> <state>0</state> </option> <option> <name>IProcessorMode2</name> <state>1</state> </option> <option> <name>CCOptLevel</name> <state>3</state> </option> <option> <name>CCOptStrategy</name> <version>0</version> <state>1</state> </option> <option> <name>CCOptLevelSlave</name> <state>0</state> </option> <option> <name>CompilerMisraRules98</name> <version>0</version> <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state> </option> <option> <name>CompilerMisraRules04</name> <version>0</version> <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state> </option> <option> <name>CCPosIndRopi</name> <state>0</state> </option> <option> <name>CCPosIndRwpi</name> <state>0</state> </option> <option> <name>CCPosIndNoDynInit</name> <state>0</state> </option> <option> <name>IccLang</name> <state>0</state> </option> <option> <name>IccCDialect</name> <state>1</state> </option> <option> <name>IccAllowVLA</name> <state>0</state> </option> <option> <name>IccCppDialect</name> <state>1</state> </option> <option> <name>IccExceptions</name> <state>1</state> </option> <option> <name>IccRTTI</name> <state>1</state> </option> <option> <name>IccStaticDestr</name> <state>1</state> </option> <option> <name>IccCppInlineSemantics</name> <state>1</state> </option> <option> <name>IccCmsis</name> <state>1</state> </option> <option> <name>IccFloatSemantics</name> <state>0</state> </option> <option> <name>CCNoLiteralPool</name> <state>0</state> </option> </data> </settings> <settings> <name>AARM</name> <archiveVersion>2</archiveVersion> <data> <version>7</version> <wantNonLocal>1</wantNonLocal> <debug>0</debug> <option> <name>AObjPrefix</name> <state>1</state> </option> <option> <name>AEndian</name> <state>1</state> </option> <option> <name>ACaseSensitivity</name> <state>1</state> </option> <option> <name>MacroChars</name> <version>0</version> <state>0</state> </option> <option> <name>AWarnEnable</name> <state>0</state> </option> <option> <name>AWarnWhat</name> <state>0</state> </option> <option> <name>AWarnOne</name> <state></state> </option> <option> <name>AWarnRange1</name> <state></state> </option> <option> <name>AWarnRange2</name> <state></state> </option> <option> <name>ADebug</name> <state>0</state> </option> <option> <name>AltRegisterNames</name> <state>0</state> </option> <option> <name>ADefines</name> <state>EFR32MG12P432F1024GL125</state> </option> <option> <name>AList</name> <state>0</state> </option> <option> <name>AListHeader</name> <state>1</state> </option> <option> <name>AListing</name> <state>1</state> </option> <option> <name>Includes</name> <state>0</state> </option> <option> <name>MacDefs</name> <state>0</state> </option> <option> <name>MacExps</name> <state>1</state> </option> <option> <name>MacExec</name> <state>0</state> </option> <option> <name>OnlyAssed</name> <state>0</state> </option> <option> <name>MultiLine</name> <state>0</state> </option> <option> <name>PageLengthCheck</name> <state>0</state> </option> <option> <name>PageLength</name> <state>80</state> </option> <option> <name>TabSpacing</name> <state>8</state> </option> <option> <name>AXRef</name> <state>0</state> </option> <option> <name>AXRefDefines</name> <state>0</state> </option> <option> <name>AXRefInternal</name> <state>0</state> </option> <option> <name>AXRefDual</name> <state>0</state> </option> <option> <name>AProcessor</name> <state>1</state> </option> <option> <name>AFpuProcessor</name> <state>1</state> </option> <option> <name>AOutputFile</name> <state>$FILE_BNAME$.o</state> </option> <option> <name>AMultibyteSupport</name> <state>0</state> </option> <option> <name>ALimitErrorsCheck</name> <state>0</state> </option> <option> <name>ALimitErrorsEdit</name> <state>100</state> </option> <option> <name>AIgnoreStdInclude</name> <state>0</state> </option> <option> <name>AUserIncludes</name> <state>$PROJ_DIR$\..\..\..\..\..\platform\CMSIS\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs\EFR32MG12P\Include</state> <state>$PROJ_DIR$\..\..\..\..\..\platform\emlib\inc</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\EFR32MG12_BRD4161A\config</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\bsp</state> <state>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\drivers</state> </option> <option> <name>AExtraOptionsCheckV2</name> <state>0</state> </option> <option> <name>AExtraOptionsV2</name> <state></state> </option> </data> </settings> <settings> <name>OBJCOPY</name> <archiveVersion>0</archiveVersion> <data> <version>1</version> <wantNonLocal>1</wantNonLocal> <debug>0</debug> <option> <name>OOCOutputFormat</name> <version>2</version> <state>2</state> </option> <option> <name>OCOutputOverride</name> <state>1</state> </option> <option> <name>OOCOutputFile</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt.bin</state> </option> <option> <name>OOCCommandLineProducer</name> <state>1</state> </option> <option> <name>OOCObjCopyEnable</name> <state>1</state> </option> </data> </settings> <settings> <name>CUSTOM</name> <archiveVersion>3</archiveVersion> <data> <extensions></extensions> <cmdline></cmdline> </data> </settings> <settings> <name>BICOMP</name> <archiveVersion>0</archiveVersion> <data/> </settings> <settings> <name>BUILDACTION</name> <archiveVersion>1</archiveVersion> <data> <prebuild></prebuild> <postbuild></postbuild> </data> </settings> <settings> <name>ILINK</name> <archiveVersion>0</archiveVersion> <data> <version>16</version> <wantNonLocal>1</wantNonLocal> <debug>0</debug> <option> <name>IlinkLibIOConfig</name> <state>1</state> </option> <option> <name>XLinkMisraHandler</name> <state>0</state> </option> <option> <name>IlinkInputFileSlave</name> <state>0</state> </option> <option> <name>IlinkOutputFile</name> <state>EFR32MG12P_timer_single_pulse_generation_interrupt.out</state> </option> <option> <name>IlinkDebugInfoEnable</name> <state>1</state> </option> <option> <name>IlinkKeepSymbols</name> <state></state> </option> <option> <name>IlinkRawBinaryFile</name> <state></state> </option> <option> <name>IlinkRawBinarySymbol</name> <state></state> </option> <option> <name>IlinkRawBinarySegment</name> <state></state> </option> <option> <name>IlinkRawBinaryAlign</name> <state></state> </option> <option> <name>IlinkDefines</name> <state></state> </option> <option> <name>IlinkConfigDefines</name> <state></state> </option> <option> <name>IlinkMapFile</name> <state>1</state> </option> <option> <name>IlinkLogFile</name> <state>0</state> </option> <option> <name>IlinkLogInitialization</name> <state>0</state> </option> <option> <name>IlinkLogModule</name> <state>0</state> </option> <option> <name>IlinkLogSection</name> <state>0</state> </option> <option> <name>IlinkLogVeneer</name> <state>0</state> </option> <option> <name>IlinkIcfOverride</name> <state>0</state> </option> <option> <name>IlinkIcfFile</name> <state></state> </option> <option> <name>IlinkIcfFileSlave</name> <state></state> </option> <option> <name>IlinkEnableRemarks</name> <state>0</state> </option> <option> <name>IlinkSuppressDiags</name> <state></state> </option> <option> <name>IlinkTreatAsRem</name> <state></state> </option> <option> <name>IlinkTreatAsWarn</name> <state></state> </option> <option> <name>IlinkTreatAsErr</name> <state></state> </option> <option> <name>IlinkWarningsAreErrors</name> <state></state> </option> <option> <name>IlinkUseExtraOptions</name> <state>0</state> </option> <option> <name>IlinkExtraOptions</name> </option> <option> <name>IlinkLowLevelInterfaceSlave</name> <state>1</state> </option> <option> <name>IlinkAutoLibEnable</name> <state>1</state> </option> <option> <name>IlinkAdditionalLibs</name> <state></state> </option> <option> <name>IlinkOverrideProgramEntryLabel</name> <state>0</state> </option> <option> <name>IlinkProgramEntryLabelSelect</name> <state>0</state> </option> <option> <name>IlinkProgramEntryLabel</name> <state>__iar_program_start</state> </option> <option> <name>DoFill</name> <state>0</state> </option> <option> <name>FillerByte</name> <state>0xFF</state> </option> <option> <name>FillerStart</name> <state>0x0</state> </option> <option> <name>FillerEnd</name> <state>0x0</state> </option> <option> <name>CrcSize</name> <version>0</version> <state>1</state> </option> <option> <name>CrcAlign</name> <state>1</state> </option> <option> <name>CrcPoly</name> <state>0x11021</state> </option> <option> <name>CrcCompl</name> <version>0</version> <state>0</state> </option> <option> <name>CrcBitOrder</name> <version>0</version> <state>0</state> </option> <option> <name>CrcInitialValue</name> <state>0x0</state> </option> <option> <name>DoCrc</name> <state>0</state> </option> <option> <name>IlinkBE8Slave</name> <state>1</state> </option> <option> <name>IlinkBufferedTerminalOutput</name> <state>1</state> </option> <option> <name>IlinkStdoutInterfaceSlave</name> <state>1</state> </option> <option> <name>CrcFullSize</name> <state>0</state> </option> <option> <name>IlinkIElfToolPostProcess</name> <state>0</state> </option> <option> <name>IlinkLogAutoLibSelect</name> <state>0</state> </option> <option> <name>IlinkLogRedirSymbols</name> <state>0</state> </option> <option> <name>IlinkLogUnusedFragments</name> <state>0</state> </option> <option> <name>IlinkCrcReverseByteOrder</name> <state>0</state> </option> <option> <name>IlinkCrcUseAsInput</name> <state>1</state> </option> <option> <name>IlinkOptInline</name> <state>1</state> </option> <option> <name>IlinkOptExceptionsAllow</name> <state>1</state> </option> <option> <name>IlinkOptExceptionsForce</name> <state>0</state> </option> <option> <name>IlinkCmsis</name> <state>1</state> </option> <option> <name>IlinkOptMergeDuplSections</name> <state>0</state> </option> <option> <name>IlinkOptUseVfe</name> <state>1</state> </option> <option> <name>IlinkOptForceVfe</name> <state>0</state> </option> <option> <name>IlinkStackAnalysisEnable</name> <state>0</state> </option> <option> <name>IlinkStackControlFile</name> <state></state> </option> <option> <name>IlinkStackCallGraphFile</name> <state></state> </option> <option> <name>CrcAlgorithm</name> <version>0</version> <state>1</state> </option> <option> <name>CrcUnitSize</name> <version>0</version> <state>0</state> </option> <option> <name>IlinkThreadsSlave</name> <state>1</state> </option> </data> </settings> <settings> <name>IARCHIVE</name> <archiveVersion>0</archiveVersion> <data> <version>0</version> <wantNonLocal>1</wantNonLocal> <debug>0</debug> <option> <name>IarchiveInputs</name> <state></state> </option> <option> <name>IarchiveOverride</name> <state>0</state> </option> <option> <name>IarchiveOutput</name> <state>###Unitialized###</state> </option> </data> </settings> <settings> <name>BILINK</name> <archiveVersion>0</archiveVersion> <data/> </settings> </configuration> <group> <name>CMSIS</name> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs\EFR32MG12P\Source\IAR\startup_efr32mg12p.s</name> </file> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs\EFR32MG12P\Source\system_efr32mg12p.c</name> </file> </group> <group> <name>emlib</name> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\emlib\src\em_system.c</name> </file> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\emlib\src\em_core.c</name> </file> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\emlib\src\em_cmu.c</name> </file> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\emlib\src\em_emu.c</name> </file> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\emlib\src\em_gpio.c</name> </file> <file> <name>$PROJ_DIR$\..\..\..\..\..\platform\emlib\src\em_timer.c</name> </file> </group> <group> <name>Source</name> <file> <name>$PROJ_DIR$\..\src\main_s1.c</name> </file> <file> <name>$PROJ_DIR$\..\readme.txt</name> </file> </group> </project>
{ "pile_set_name": "Github" }
/* Generated by RuntimeBrowser. */ @protocol CUTWiFiManagerDelegate <NSObject> @optional - (void)cutWiFiManager:(CUTWiFiManager *)arg1 generatedPowerReading:(NSDictionary *)arg2; - (void)cutWiFiManagerDeviceAttached:(CUTWiFiManager *)arg1; - (void)cutWiFiManagerLinkDidChange:(CUTWiFiManager *)arg1 context:(NSDictionary *)arg2; @end
{ "pile_set_name": "Github" }
title: Xcode Test for iOS summary: Runs Xcode's `test` action on an iOS project. description: |- Runs Xcode's `test` action on an iOS project. Write the tests and run them on every build just to make sure those tiny code goblins didn't put something in the code that shouldn't be there while you were at the daily Scrum meeting. website: https://github.com/bitrise-steplib/steps-xcode-test source_code_url: https://github.com/bitrise-steplib/steps-xcode-test support_url: https://github.com/bitrise-steplib/steps-xcode-test/issues published_at: 2019-05-10T14:07:00.505401961Z source: git: https://github.com/bitrise-steplib/steps-xcode-test.git commit: 4f55fd573bc53b2c355baaeabc116cd5bf294d5a host_os_tags: - osx-10.10 project_type_tags: - ios type_tags: - test toolkit: go: package_name: github.com/bitrise-steplib/steps-xcode-test deps: brew: - name: go check_only: - name: xcode is_requires_admin_user: false is_always_run: false is_skippable: false inputs: - opts: description: |- A `.xcodeproj` or `.xcworkspace` path, relative to the Working directory (if specified). is_required: true title: Project (or Workspace) path project_path: $BITRISE_PROJECT_PATH - opts: description: |- The Scheme to use. **IMPORTANT**: The Scheme has to be marked as __shared__ in Xcode! is_required: true title: Scheme name scheme: $BITRISE_SCHEME - opts: description: |- Set it as it is shown in Xcode's device selection dropdown UI. A couple of examples (the actual available options depend on which versions are installed): * iPhone 6 * iPhone 6 Plus * iPad * iPad Air * Apple TV 1080p (don't forget to set the platform to `tvOS Simulator` to use this option!) is_required: true title: Device simulator_device: iPhone 6s Plus - opts: description: |- Set it as it is shown in Xcode's device selection dropdown UI. A couple of format examples (the actual available options depend on which versions are installed): * 8.4 * latest is_required: true title: OS version simulator_os_version: latest - opts: description: |- Set it as it is shown in Xcode's device selection dropdown UI. A couple of examples (the actual available options depend on which versions are installed): * iOS Simulator * tvOS Simulator is_required: true title: Platform value_options: - iOS Simulator - tvOS Simulator simulator_platform: iOS Simulator - export_uitest_artifacts: "false" opts: description: |- If enabled, the attachments of the UITest will be exported into the BITRISE_DEPLOY_DIR, as a compressed ZIP file. Attachments include screenshots taken during the UI test, and other artifacts. title: Export UITest Artifacts value_options: - "true" - "false" - generate_code_coverage_files: "no" opts: description: |- In case of `generate_code_coverage_files: "yes"` `xcodebuild` gets two additional flags: * GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES * GCC_GENERATE_TEST_COVERAGE_FILES=YES is_required: true title: Generate code coverage files? value_options: - "yes" - "no" - disable_index_while_building: "yes" opts: description: |- Could make the build faster by adding `COMPILER_INDEX_STORE_ENABLE=NO` flag to the `xcodebuild` command which will disable the indexing during the build. Indexing is needed for * Autocomplete * Ability to quickly jump to definition * Get class and method help by alt clicking. Which are not needed in CI environment. **Note:** In Xcode you can turn off the `Index-WhileBuilding` feature by disabling the `Enable Index-WhileBuilding Functionality` in the `Build Settings`.<br/> In CI environment you can disable it by adding `COMPILER_INDEX_STORE_ENABLE=NO` flag to the `xcodebuild` command. is_required: true summary: Could make the build faster by disabling the indexing during the build run. title: Disable indexing during the build value_options: - "yes" - "no" - opts: category: Debug description: You can enable the verbose log for easier debugging. title: Enable verbose log? value_options: - "yes" - "no" verbose: "no" - headless_mode: "yes" opts: category: Debug description: |- If you run your tests in headless mode the xcodebuild will start a simulator in a background. In headless mode the simulator will not be visible but your tests (even the screenshots) will run just like if you run a simulator in foreground. **NOTE:** Headless mode is available with Xcode 9.x or newer. summary: In headless mode the simulator is not launched in the foreground. title: Run the test in headless mode? value_options: - "yes" - "no" - opts: category: Debug description: |- Working directory of the step. You can leave it empty to leave the working directory unchanged. title: Working directory workdir: $BITRISE_SOURCE_DIR - is_clean_build: "no" opts: category: Debug is_required: true title: Do a clean Xcode build before testing? value_options: - "yes" - "no" - opts: category: Debug description: |- If output_tool is set to xcpretty, the xcodebuild output will be prettified by xcpretty. If output_tool is set to xcodebuild, the raw xcodebuild output will be printed. is_required: true title: Output tool value_options: - xcpretty - xcodebuild output_tool: xcpretty - opts: category: Debug description: |- Options added to the end of the `xcodebuild build test` call. If you leave empty this input, xcodebuild will be called as: `xcodebuild -project\-workspace PROJECT.xcodeproj\WORKSPACE.xcworkspace -scheme SCHEME build test -destination platform=PLATFORM Simulator,name=NAME,OS=VERSION` In case of `generate_code_coverage_files: "yes"` `xcodebuild` gets two additional flags: * GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES * GCC_GENERATE_TEST_COVERAGE_FILES=YES If you want to add more options, list that separated by space character. Example: `-xcconfig PATH -verbose` title: Additional options for `xcodebuild build test` call xcodebuild_test_options: "" - opts: category: Debug description: "If `single_build` is set to false, the step runs `xcodebuild OPTIONS build OPTIONS` before the test \nto generate the project derived data. After that comes `xcodebuild OPTIONS build test OPTIONS`. This command's log is presented in the step's log.\n\nIf `single_build` is set to true, then the step calls only `xcodebuild OPTIONS build test OPTIONS`." title: Run xcodebuild test only value_options: - "true" - "false" single_build: "true" - opts: category: Debug description: |- Previous Xcode versions and configurations may throw the error `iPhoneSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.` when the compilation before performing the tests takes too long. This is fixed by running `xcodebuild OPTIONS build test OPTIONS` instead of `xcodebuild OPTIONS test OPTIONS`. Calling an explicit build before the test results in the code being compiled twice, thus creating an overhead. Unless you are sure that your configuration is not prone to this error, it is recommended to leave this option turned on. is_required: true title: (Experimental) Explicitly perform a build before testing? value_options: - "yes" - "no" should_build_before_test: "yes" - opts: category: Debug description: 'If `should_retry_test_on_fail: yes` step will retry the test if first attempt failed.' is_required: true title: (Experimental) Rerun test, when it fails? value_options: - "yes" - "no" should_retry_test_on_fail: "no" - opts: category: Debug description: |- Options added to the end of the `xcpretty` test call. If you leave empty this input, xcpretty will be called as: `set -o pipefail && XCODEBUILD_TEST_COMMAND | xcpretty` In case of leaving this input on default value: `set -o pipefail && XCODEBUILD_TEST_COMMAND | xcpretty --color --report html --color --report html --output "${BITRISE_DEPLOY_DIR}/xcode-test-results-${BITRISE_SCHEME}.html" If you want to add more options, list that separated by space character. title: Additional options for `xcpretty` test call xcpretty_test_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/xcode-test-results-${BITRISE_SCHEME}.html" outputs: - BITRISE_XCODE_TEST_RESULT: null opts: title: Result of the tests. 'succeeded' or 'failed'. value_options: - succeeded - failed - BITRISE_XCODE_RAW_TEST_RESULT_TEXT_PATH: null opts: description: |- This is the path of the raw test results log file. If the compilation fails this log will contain the compilation output, if the tests can be started it'll only include the test output. title: The full, raw test output file path - BITRISE_XCRESULT_PATH: null opts: description: The path of the generated `.xcresult`. title: The path of the generated `.xcresult` - BITRISE_XCODE_TEST_ATTACHMENTS_PATH: null opts: description: This is the path of the test attachments zip. title: The full, test attachments zip path
{ "pile_set_name": "Github" }
// // This source file is part of appleseed. // Visit https://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2018 Francois Beaune, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once // appleseed.renderer headers. #include "renderer/global/globaltypes.h" #include "renderer/modeling/entity/connectableentity.h" // appleseed.foundation headers. #include "foundation/utility/uid.h" // appleseed.main headers. #include "main/dllsymbol.h" // Standard headers. #include <cstddef> // Forward declarations. namespace foundation { class IAbortSwitch; } namespace renderer { class BaseGroup; } namespace renderer { class ObjectRasterizer; } namespace renderer { class OnFrameBeginRecorder; } namespace renderer { class ParamArray; } namespace renderer { class Project; } namespace renderer { class Source; } namespace renderer { // // Object. // class APPLESEED_DLLSYMBOL Object : public ConnectableEntity { public: // Return the unique ID of this class of entities. static foundation::UniqueID get_class_uid(); // Constructor. Object( const char* name, const ParamArray& params); // Return a string identifying the model of this entity. // Model here is synonymous with which "kind" of Object this entity is, // not an identifier for its actual mesh or curve representation. virtual const char* get_model() const = 0; // Compute the local space bounding box of the object over the shutter interval. virtual GAABB3 compute_local_bbox() const = 0; // Access materials slots. virtual size_t get_material_slot_count() const = 0; virtual const char* get_material_slot(const size_t index) const = 0; // Return the source bound to the alpha map input, or nullptr if the object doesn't have an alpha map. virtual const Source* get_uncached_alpha_map() const; // Return true if this object has an alpha map. bool has_alpha_map() const; // Return true if this object has an uniform alpha value equals to 1.0f. bool has_opaque_uniform_alpha_map() const; bool on_frame_begin( const Project& project, const BaseGroup* parent, OnFrameBeginRecorder& recorder, foundation::IAbortSwitch* abort_switch = nullptr) override; void on_frame_end( const Project& project, const BaseGroup* parent) override; struct APPLESEED_DLLSYMBOL RenderData { const Source* m_alpha_map; RenderData(); void clear(); }; // Return render-time data of this entity. // Render-time data are available between on_frame_begin() and on_frame_end() calls. const RenderData& get_render_data() const; // Send this object to an object rasterizer. virtual void rasterize(ObjectRasterizer& rasterizer) const; private: RenderData m_render_data; }; // // Object class implementation. // inline const Object::RenderData& Object::get_render_data() const { return m_render_data; } } // namespace renderer
{ "pile_set_name": "Github" }
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georg Maaß <[email protected]> * Bob Clary <[email protected]> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 167658; var summary = 'Do not crash due to js_NewRegExp initialization'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var UBOUND=100; for (var j=0; j<UBOUND; j++) { 'Apfelkiste, Apfelschale'.replace('Apfel', function() { for (var i = 0; i < arguments.length; i++) printStatus(i+': '+arguments[i]); return 'Bananen'; }); printStatus(j); } reportCompare(expect, actual, summary);
{ "pile_set_name": "Github" }
package autorest // Copyright 2017 Microsoft Corporation // // 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. import ( "fmt" "net/http" ) const ( // UndefinedStatusCode is used when HTTP status code is not available for an error. UndefinedStatusCode = 0 ) // DetailedError encloses a error with details of the package, method, and associated HTTP // status code (if any). type DetailedError struct { Original error // PackageType is the package type of the object emitting the error. For types, the value // matches that produced the the '%T' format specifier of the fmt package. For other elements, // such as functions, it is just the package name (e.g., "autorest"). PackageType string // Method is the name of the method raising the error. Method string // StatusCode is the HTTP Response StatusCode (if non-zero) that led to the error. StatusCode interface{} // Message is the error message. Message string // Service Error is the response body of failed API in bytes ServiceError []byte // Response is the response object that was returned during failure if applicable. Response *http.Response } // NewError creates a new Error conforming object from the passed packageType, method, and // message. message is treated as a format string to which the optional args apply. func NewError(packageType string, method string, message string, args ...interface{}) DetailedError { return NewErrorWithError(nil, packageType, method, nil, message, args...) } // NewErrorWithResponse creates a new Error conforming object from the passed // packageType, method, statusCode of the given resp (UndefinedStatusCode if // resp is nil), and message. message is treated as a format string to which the // optional args apply. func NewErrorWithResponse(packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { return NewErrorWithError(nil, packageType, method, resp, message, args...) } // NewErrorWithError creates a new Error conforming object from the // passed packageType, method, statusCode of the given resp (UndefinedStatusCode // if resp is nil), message, and original error. message is treated as a format // string to which the optional args apply. func NewErrorWithError(original error, packageType string, method string, resp *http.Response, message string, args ...interface{}) DetailedError { if v, ok := original.(DetailedError); ok { return v } statusCode := UndefinedStatusCode if resp != nil { statusCode = resp.StatusCode } return DetailedError{ Original: original, PackageType: packageType, Method: method, StatusCode: statusCode, Message: fmt.Sprintf(message, args...), Response: resp, } } // Error returns a formatted containing all available details (i.e., PackageType, Method, // StatusCode, Message, and original error (if any)). func (e DetailedError) Error() string { if e.Original == nil { return fmt.Sprintf("%s#%s: %s: StatusCode=%d", e.PackageType, e.Method, e.Message, e.StatusCode) } return fmt.Sprintf("%s#%s: %s: StatusCode=%d -- Original Error: %v", e.PackageType, e.Method, e.Message, e.StatusCode, e.Original) }
{ "pile_set_name": "Github" }
# Be sure to restart your server when you modify this file. Dawn::Application.config.session_store :cookie_store, key: '_dawn_session', :domain => :all
{ "pile_set_name": "Github" }
/* * mclock.c - graphical clock for Plan 9 using draw(2) API * * Graphical image is based on a clock program for Tektronix vector * graphics displays written in PDP-11 BASIC by Dave Robinson at the * University of Delaware in the 1970s. * * 071218 - initial release * 071223 - fix window label, fix redraw after hide, add tongue */ #include <u.h> #include <libc.h> #include <draw.h> #include <event.h> int anghr, angmin, dia, offx, offy; Image *dots, *back, *blk, *wht, *red, *org, *flesh; Tm *mtime; enum {DBIG=600, XDarkOrange=0xff8c0000, Xwheat=0xf5deb300}; /* hair is head[0..41*2], face is head[27*2..56*2] */ int head[] = {286,386,263,410,243,417,230,415,234,426,227,443,210,450,190,448, 172,435,168,418,175,400,190,398,201,400,188,390,180,375,178,363, 172,383,157,390,143,388,130,370,125,350,130,330,140,318,154,318, 165,325,176,341,182,320,195,305,200,317,212,322,224,319,218,334, 217,350,221,370,232,382,250,389,264,387,271,380,275,372,276,381, 279,388,286,386,300,360,297,337,294,327,284,320,300,301,297,297, 282,286,267,284,257,287,254,280,249,273,236,274,225,290,195,305}; int mouth[] = {235,305,233,297,235,285,243,280,250,282,252,288,248,290,235,305}; int mouth1[] = {240,310,235,305,226,306}; int mouth2[] = {257,287,248,290}; int tongue[] = {235,285,243,280,246,281,247,286,245,289,241,291,237,294,233,294, 235,285}; int tongue1[] = {241,291,241,286}; int shirt[] = {200,302,192,280,176,256,170,247,186,230,210,222,225,226,237,235, 222,291,200,302}; int pants[] = {199,164,203,159,202,143,189,138,172,135,160,137,160,166,151,170, 145,180,142,200,156,230,170,247,186,230,210,222,225,226,237,235, 245,205,242,190,236,176,229,182,243,153,240,150,228,142,217,145, 212,162,199,164}; int eyel[] = {294,327,296,335,293,345,285,345,280,337,281,325,284,320,294,327}; int eyer[] = {275,320,278,337,275,345,268,344,260,333,260,323,264,316,275,320}; int pupill[] = {284,320,294,327,293,329,291,333,289,333,286,331,284,325,284,320}; int pupilr[] = {265,316,275,320,275,325,273,330,271,332,269,333,267,331,265,327, 265,316}; int nose[] = {285,308,288,302,294,301,298,301,302,303,305,305,308,308,309,310, 310,312,310,316,308,320,305,323,302,324,297,324,294,322,288,317, 286,312,285,308}; int nose1[] = {275,313,280,317,286,319}; int buttonl[] = {201,210,194,208,190,196,191,187,199,188,208,200,201,210}; int buttonr[] = {224,213,221,209,221,197,228,191,232,200,230,211,224,213}; int tail[] = {40,80,50,76,66,79,90,102,106,151,128,173,145,180}; int cuffl[] = {202,143,197,148,188,150,160,137}; int cuffr[] = {243,153,233,154,217,145}; int legl[] = {239,153,244,134,243,96,229,98,231,130,226,150,233,154,239,153}; int legr[] = {188,150,187,122,182,92,168,91,172,122,173,143,188,150}; int shoel[] = {230,109,223,107,223,98,228,90,231,76,252,70,278,73,288,82, 284,97,271,99,251,100,244,106,230,109}; int shoel1[] = {223,98,229,98,243,96,251,100}; int shoel2[] = {271,99,248,89}; int shoer[] = {170,102,160,100,160,92,163,85,157,82,160,73,178,66,215,63, 231,76,228,90,213,97,195,93,186,93,187,100,184,102,170,102}; int shoer1[] = {160,92,168,91,182,92,186,93}; int shoer2[] = {195,93,182,83}; int tick1[] = {302,432,310,446}; int tick2[] = {370,365,384,371}; int tick3[] = {395,270,410,270}; int tick4[] = {370,180,384,173}; int tick5[] = {302,113,310,100}; int tick7[] = {119,113,110,100}; int tick8[] = {40,173,52,180}; int tick9[] = {10,270,25,270}; int tick10[] = {40,371,52,365}; int tick11[] = {110,446,119,432}; int tick12[] = {210,455,210,470}; int armh[] = {-8,0,9,30,10,70,8,100,20,101,23,80,22,30,4,-5}; int armm[] = {-8,0,10,80,8,130,22,134,25,80,4,-5}; int handm[] = {8,140,5,129,8,130,22,134,30,137,27,143,33,163,30,168, 21,166,18,170,12,168,10,170,5,167,4,195,-4,195,-6,170, 0,154,8,140}; int handm1[] = {0,154,5,167}; int handm2[] = {14,167,12,158,10,152}; int handm3[] = {12,158,18,152,21,166}; int handm4[] = {20,156,29,151}; int handh[] = {20,130,15,135,6,129,4,155,-4,155,-6,127,-8,121,4,108, 3,100,8,100,20,101,23,102,21,108,28,126,24,132,20,130}; int handh1[] = {20,130,16,118}; void xlate(int* in, Point* out, int np) { int i; for (i = 0; i < np; i++) { out[i].x = offx + (dia * (in[2*i]) + 210) / 420; out[i].y = offy + (dia * (480 - in[2*i+1]) + 210) / 420; } } void myfill(int* p, int np, Image* color) { Point* out; out = (Point *)malloc(sizeof(Point) * np); xlate(p, out, np); fillpoly(screen, out, np, ~0, color, ZP); free(out); } void mypoly(int* p, int np, Image* color) { Point* out; out = (Point *)malloc(sizeof(Point) * np); xlate(p, out, np); poly(screen, out, np, Enddisc, Enddisc, dia>DBIG?1:0, color, ZP); free(out); } void arm(int* p, Point* out, int np, double angle) { int i; double cosp, sinp; for (i = 0; i < np; i++) { cosp = cos(PI * angle / 180.0); sinp = sin(PI * angle / 180.0); out[i].x = p[2*i] * cosp + p[2*i+1] * sinp + 210.5; out[i].y = p[2*i+1] * cosp - p[2*i] * sinp + 270.5; } } void polyarm(int *p, int np, Image *color, double angle) { Point *tmp, *out; tmp = (Point *)malloc(sizeof(Point) * np); out = (Point *)malloc(sizeof(Point) * np); arm(p, tmp, np, angle); xlate((int*)tmp, out, np); poly(screen, out, np, Enddisc, Enddisc, dia>DBIG?1:0, color, ZP); free(out); free(tmp); } void fillarm(int *p, int np, Image *color, double angle) { Point *tmp, *out; tmp = (Point *)malloc(sizeof(Point) * np); out = (Point *)malloc(sizeof(Point) * np); arm(p, tmp, np, angle); xlate((int*)tmp, out, np); fillpoly(screen, out, np, ~0, color, ZP); free(out); free(tmp); } void arms(void) { /* arms */ fillarm(armh, 8, blk, anghr); fillarm(armm, 6, blk, angmin); /* hour hand */ fillarm(handh, 16, wht, anghr); polyarm(handh, 16, blk, anghr); polyarm(handh1, 2, blk, anghr); /* minute hand */ fillarm(handm, 18, wht, angmin); polyarm(handm, 18, blk, angmin); polyarm(handm1, 2, blk, angmin); polyarm(handm2, 3, blk, angmin); polyarm(handm3, 3, blk, angmin); polyarm(handm4, 2, blk, angmin); } void redraw(Image *screen) { anghr = mtime->hour*30 + mtime->min/2; angmin = mtime->min*6; dia = Dx(screen->r) < Dy(screen->r) ? Dx(screen->r) : Dy(screen->r); offx = screen->r.min.x + (Dx(screen->r) - dia) / 2; offy = screen->r.min.y + (Dy(screen->r) - dia) / 2; draw(screen, screen->r, back, nil, ZP); /* first draw the filled areas */ myfill(head, 42, blk); /* hair */ myfill(&head[27*2], 29, flesh); /* face */ myfill(mouth, 8, blk); myfill(tongue, 9, red); myfill(shirt, 10, blk); myfill(pants, 26, red); myfill(buttonl, 7, wht); myfill(buttonr, 7, wht); myfill(eyel, 8, wht); myfill(eyer, 8, wht); myfill(pupill, 8, blk); myfill(pupilr, 9, blk); myfill(nose, 18, blk); myfill(shoel, 13, org); myfill(shoer, 16, org); myfill(legl, 8, blk); myfill(legr, 7, blk); /* outline the color-filled areas */ mypoly(&head[27*2], 29, blk); /* face */ mypoly(tongue, 9, blk); mypoly(pants, 26, blk); mypoly(buttonl, 7, blk); mypoly(buttonr, 7, blk); mypoly(eyel, 8, blk); mypoly(eyer, 8, blk); mypoly(shoel, 13, blk); mypoly(shoer, 16, blk); /* draw the details */ mypoly(nose1, 3, blk); mypoly(mouth1, 3, blk); mypoly(mouth2, 2, blk); mypoly(tongue1, 2, blk); mypoly(tail, 7, blk); mypoly(cuffl, 4, blk); mypoly(cuffr, 3, blk); mypoly(shoel1, 4, blk); mypoly(shoel2, 2, blk); mypoly(shoer1, 4, blk); mypoly(shoer2, 2, blk); mypoly(tick1, 2, dots); mypoly(tick2, 2, dots); mypoly(tick3, 2, dots); mypoly(tick4, 2, dots); mypoly(tick5, 2, dots); mypoly(tick7, 2, dots); mypoly(tick8, 2, dots); mypoly(tick9, 2, dots); mypoly(tick10, 2, dots); mypoly(tick11, 2, dots); mypoly(tick12, 2, dots); arms(); flushimage(display, 1); return; } void eresized(int new) { if(new && getwindow(display, Refnone) < 0) fprint(2,"can't reattach to window"); redraw(screen); } void main(void) { Event e; Mouse m; Menu menu; char *mstr[] = {"exit", 0}; int key, timer, oldmin; initdraw(0,0,"mclock"); back = allocimagemix(display, DPalebluegreen, DWhite); dots = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DBlue); blk = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DBlack); wht = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DWhite); red = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DRed); org = allocimage(display, Rect(0,0,1,1), CMAP8, 1, XDarkOrange); flesh = allocimage(display, Rect(0,0,1,1), CMAP8, 1, Xwheat); mtime = localtime(time(0)); redraw(screen); einit(Emouse); timer = etimer(0, 30*1000); menu.item = mstr; menu.lasthit = 0; for(;;) { key = event(&e); if(key == Emouse) { m = e.mouse; if(m.buttons & 4) { if(emenuhit(3, &m, &menu) == 0) exits(0); } } else if(key == timer) { oldmin = mtime->min; mtime = localtime(time(0)); if(mtime->min != oldmin) redraw(screen); } } }
{ "pile_set_name": "Github" }
var test = require('tap').test; var burrito = require('../'); var vm = require('vm'); test('preserve ternary parentheses', function (t) { var originalSource = '"anything" + (x ? y : z) + "anything"'; var burritoSource = burrito(originalSource, function (node) { // do nothing. we just want to check that ternary parens are persisted }); var ctxt = { x : false, y : 'y_'+~~(Math.random()*10), z : 'z_'+~~(Math.random()*10) }; var expectedOutput = vm.runInNewContext(originalSource, ctxt); var burritoOutput = vm.runInNewContext(burritoSource, ctxt); t.equal(burritoOutput, expectedOutput); ctxt.x = true; expectedOutput = vm.runInNewContext(originalSource, ctxt); burritoOutput = vm.runInNewContext(burritoSource, ctxt); t.equal(burritoOutput, expectedOutput); t.end(); }); test('wrap calls', function (t) { t.plan(20); var src = burrito('f() && g(h())\nfoo()', function (node) { if (node.name === 'call') node.wrap('qqq(%s)'); if (node.name === 'binary') node.wrap('bbb(%s)'); t.ok(node.state); t.equal(this, node.state); }); var times = { bbb : 0, qqq : 0 }; var res = []; vm.runInNewContext(src, { bbb : function (x) { times.bbb ++; res.push(x); return x; }, qqq : function (x) { times.qqq ++; res.push(x); return x; }, f : function () { return true }, g : function (h) { t.equal(h, 7); return h !== 7 }, h : function () { return 7 }, foo : function () { return 'foo!' }, }); t.same(res, [ true, // f() 7, // h() false, // g(h()) false, // f() && g(h()) 'foo!', // foo() ]); t.equal(times.bbb, 1); t.equal(times.qqq, 4); t.end(); }); test('wrap fn', function (t) { var src = burrito('f(g(h(5)))', function (node) { if (node.name === 'call') { node.wrap(function (s) { return 'z(' + s + ')'; }); } }); var times = 0; t.equal( vm.runInNewContext(src, { f : function (x) { return x + 1 }, g : function (x) { return x + 2 }, h : function (x) { return x + 3 }, z : function (x) { times ++; return x * 10; }, }), (((((5 + 3) * 10) + 2) * 10) + 1) * 10 ); t.equal(times, 3); t.end(); }); test('binary string', function (t) { var src = 'z(x + y)'; var context = { x : 3, y : 4, z : function (n) { return n * 10 }, }; var res = burrito.microwave(src, context, function (node) { if (node.name === 'binary') { node.wrap('%a*2 - %b*2'); } }); t.equal(res, 10 * (3*2 - 4*2)); t.end(); }); test('binary fn', function (t) { var src = 'z(x + y)'; var context = { x : 3, y : 4, z : function (n) { return n * 10 }, }; var res = burrito.microwave(src, context, function (node) { if (node.name === 'binary') { node.wrap(function (expr, a, b) { return '(' + a + ')*2 - ' + '(' + b + ')*2'; }); } }); t.equal(res, 10 * (3*2 - 4*2)); t.end(); }); test('intersperse', function (t) { var src = '(' + (function () { f(); g(); }).toString() + ')()'; var times = { f : 0, g : 0, zzz : 0 }; var context = { f : function () { times.f ++ }, g : function () { times.g ++ }, zzz : function () { times.zzz ++ }, }; burrito.microwave(src, context, function (node) { if (node.name === 'stat') node.wrap('{ zzz(); %s }'); }); t.same(times, { f : 1, g : 1, zzz : 3 }); t.end(); });
{ "pile_set_name": "Github" }
don't do any paramter conversion (double to float, etc) Why? Security. Portability. It may be more aproachable. can still use regular dlls for development purposes lcc q3asm
{ "pile_set_name": "Github" }
# DO NOT MODIFY. This file was generated by # github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go. # The ServerTimestamp sentinel must be the value of a field. Firestore transforms # don't support array indexing. description: "create: ServerTimestamp cannot be in an array value" create: < doc_ref_path: "projects/projectID/databases/(default)/documents/C/d" json_data: "{\"a\": [1, 2, \"ServerTimestamp\"]}" is_error: true >
{ "pile_set_name": "Github" }
2 3 2 2 1 1 copy32p168_x1y1.c "R. Clint Whaley" 1 2 2 0 0 copy1_x0y0.c "R. Clint Whaley"
{ "pile_set_name": "Github" }
# DO NOT EDIT; generated by go run testdata/gen.go # #name: optionals in open structs #evalFull -- in.cue -- A: { [=~"^[a-s]*$"]: int } B: { [=~"^[m-z]*$"]: int } #C: {A & B} c: #C & {aaa: 3} -- out/def -- A: { [=~"^[a-s]*$"]: int } B: { [=~"^[m-z]*$"]: int } #C: { A & B } c: #C & { aaa: 3 } -- out/export -- A: {} B: {} c: { aaa: 3 } -- out/yaml -- A: {} B: {} c: aaa: 3 -- out/json -- {"A":{},"B":{},"c":{"aaa":3}} -- out/legacy-debug -- <0>{A: <1>{[=~"^[a-s]*$"]: <2>(_: string)->int, }, B: <3>{[=~"^[m-z]*$"]: <4>(_: string)->int, }, #C: <5>C{[=~"^[a-s]*$"]: <6>(_: string)->int, [=~"^[m-z]*$"]: <7>(_: string)->int, }, c: <8>C{[=~"^[a-s]*$"]: <9>(_: string)->int, [=~"^[m-z]*$"]: <10>(_: string)->int, aaa: 3}} -- out/compile -- --- in.cue { A: { [=~"^[a-s]*$"]: int } B: { [=~"^[m-z]*$"]: int } #C: { (〈1;A〉 & 〈1;B〉) } c: (〈0;#C〉 & { aaa: 3 }) } -- out/eval -- (struct){ A: (struct){ } B: (struct){ } #C: (#struct){ } c: (#struct){ aaa: (int){ 3 } } }
{ "pile_set_name": "Github" }
drpcli contexts meta get ------------------------ Get a specific metadata item from context Synopsis ~~~~~~~~ Get a specific metadata item from context :: drpcli contexts meta get [id] [key] [flags] Options ~~~~~~~ :: -h, --help help for get Options inherited from parent commands ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: -c, --catalog string The catalog file to use to get product information (default "https://repo.rackn.io") -d, --debug Whether the CLI should run in debug mode -D, --download-proxy string HTTP Proxy to use for downloading catalog and content -E, --endpoint string The Digital Rebar Provision API endpoint to talk to (default "https://127.0.0.1:8092") -f, --force When needed, attempt to force the operation - used on some update/patch calls -F, --format string The serialization we expect for output. Can be "json" or "yaml" or "text" or "table" (default "json") -H, --no-header Should header be shown in "text" or "table" mode -x, --noToken Do not use token auth or token cache -P, --password string password of the Digital Rebar Provision user (default "r0cketsk8ts") -J, --print-fields string The fields of the object to display in "text" or "table" mode. Comma separated -r, --ref string A reference object for update commands that can be a file name, yaml, or json blob -T, --token string token of the Digital Rebar Provision access -t, --trace string The log level API requests should be logged at on the server side -Z, --traceToken string A token that individual traced requests should report in the server logs -j, --truncate-length int Truncate columns at this length (default 40) -u, --url-proxy string URL Proxy for passing actions through another DRP -U, --username string Name of the Digital Rebar Provision user to talk to (default "rocketskates") SEE ALSO ~~~~~~~~ - `drpcli contexts meta <drpcli_contexts_meta.html>`__ - Gets metadata for the context
{ "pile_set_name": "Github" }
package com.mrpowergamerbr.loritta.tables import com.mrpowergamerbr.loritta.utils.exposed.array import org.jetbrains.exposed.dao.id.LongIdTable import org.jetbrains.exposed.sql.LongColumnType object BirthdayConfigs : LongIdTable() { val enabled = bool("enabled").default(false) val channelId = long("channel").nullable().index() val roles = array<Long>("roles", LongColumnType()).nullable() }
{ "pile_set_name": "Github" }
StdPeriph_Driver/src/stm32f10x_pwr.o: \ ../StdPeriph_Driver/src/stm32f10x_pwr.c \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_pwr.h \ /home/andre/workspace/Example_BLDC_Sensorless/CMSIS/device/stm32f10x.h \ /home/andre/workspace/Example_BLDC_Sensorless/CMSIS/core/core_cm3.h \ /home/andre/workspace/Example_BLDC_Sensorless/CMSIS/device/system_stm32f10x.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_conf.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_adc.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_bkp.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_can.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_cec.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_crc.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_dac.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_dbgmcu.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_dma.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_exti.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_flash.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_fsmc.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_gpio.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_i2c.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_iwdg.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_pwr.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_rcc.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_rtc.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_sdio.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_spi.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_tim.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_usart.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_wwdg.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/misc.h \ /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_rcc.h /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_pwr.h: /home/andre/workspace/Example_BLDC_Sensorless/CMSIS/device/stm32f10x.h: /home/andre/workspace/Example_BLDC_Sensorless/CMSIS/core/core_cm3.h: /home/andre/workspace/Example_BLDC_Sensorless/CMSIS/device/system_stm32f10x.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_conf.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_adc.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_bkp.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_can.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_cec.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_crc.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_dac.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_dbgmcu.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_dma.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_exti.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_flash.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_fsmc.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_gpio.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_i2c.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_iwdg.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_pwr.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_rcc.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_rtc.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_sdio.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_spi.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_tim.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_usart.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_wwdg.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/misc.h: /home/andre/workspace/Example_BLDC_Sensorless/StdPeriph_Driver/inc/stm32f10x_rcc.h:
{ "pile_set_name": "Github" }
/* * ARC PGU DRM driver. * * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/clk.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_atomic_helper.h> #include <linux/of_reserved_mem.h> #include "arcpgu.h" #include "arcpgu_regs.h" static void arcpgu_fb_output_poll_changed(struct drm_device *dev) { struct arcpgu_drm_private *arcpgu = dev->dev_private; drm_fbdev_cma_hotplug_event(arcpgu->fbdev); } static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = { .fb_create = drm_gem_fb_create, .output_poll_changed = arcpgu_fb_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; static void arcpgu_setup_mode_config(struct drm_device *drm) { drm_mode_config_init(drm); drm->mode_config.min_width = 0; drm->mode_config.min_height = 0; drm->mode_config.max_width = 1920; drm->mode_config.max_height = 1080; drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs; } DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops); static void arcpgu_lastclose(struct drm_device *drm) { struct arcpgu_drm_private *arcpgu = drm->dev_private; drm_fbdev_cma_restore_mode(arcpgu->fbdev); } static int arcpgu_load(struct drm_device *drm) { struct platform_device *pdev = to_platform_device(drm->dev); struct arcpgu_drm_private *arcpgu; struct device_node *encoder_node; struct resource *res; int ret; arcpgu = devm_kzalloc(&pdev->dev, sizeof(*arcpgu), GFP_KERNEL); if (arcpgu == NULL) return -ENOMEM; drm->dev_private = arcpgu; arcpgu->clk = devm_clk_get(drm->dev, "pxlclk"); if (IS_ERR(arcpgu->clk)) return PTR_ERR(arcpgu->clk); arcpgu_setup_mode_config(drm); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); arcpgu->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(arcpgu->regs)) return PTR_ERR(arcpgu->regs); dev_info(drm->dev, "arc_pgu ID: 0x%x\n", arc_pgu_read(arcpgu, ARCPGU_REG_ID)); /* Get the optional framebuffer memory resource */ ret = of_reserved_mem_device_init(drm->dev); if (ret && ret != -ENODEV) return ret; if (dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32))) return -ENODEV; if (arc_pgu_setup_crtc(drm) < 0) return -ENODEV; /* find the encoder node and initialize it */ encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0); if (encoder_node) { ret = arcpgu_drm_hdmi_init(drm, encoder_node); of_node_put(encoder_node); if (ret < 0) return ret; } else { ret = arcpgu_drm_sim_init(drm, NULL); if (ret < 0) return ret; } drm_mode_config_reset(drm); drm_kms_helper_poll_init(drm); arcpgu->fbdev = drm_fbdev_cma_init(drm, 16, drm->mode_config.num_connector); if (IS_ERR(arcpgu->fbdev)) { ret = PTR_ERR(arcpgu->fbdev); arcpgu->fbdev = NULL; return -ENODEV; } platform_set_drvdata(pdev, drm); return 0; } static int arcpgu_unload(struct drm_device *drm) { struct arcpgu_drm_private *arcpgu = drm->dev_private; if (arcpgu->fbdev) { drm_fbdev_cma_fini(arcpgu->fbdev); arcpgu->fbdev = NULL; } drm_kms_helper_poll_fini(drm); drm_mode_config_cleanup(drm); return 0; } #ifdef CONFIG_DEBUG_FS static int arcpgu_show_pxlclock(struct seq_file *m, void *arg) { struct drm_info_node *node = (struct drm_info_node *)m->private; struct drm_device *drm = node->minor->dev; struct arcpgu_drm_private *arcpgu = drm->dev_private; unsigned long clkrate = clk_get_rate(arcpgu->clk); unsigned long mode_clock = arcpgu->crtc.mode.crtc_clock * 1000; seq_printf(m, "hw : %lu\n", clkrate); seq_printf(m, "mode: %lu\n", mode_clock); return 0; } static struct drm_info_list arcpgu_debugfs_list[] = { { "clocks", arcpgu_show_pxlclock, 0 }, }; static int arcpgu_debugfs_init(struct drm_minor *minor) { return drm_debugfs_create_files(arcpgu_debugfs_list, ARRAY_SIZE(arcpgu_debugfs_list), minor->debugfs_root, minor); } #endif static struct drm_driver arcpgu_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, .lastclose = arcpgu_lastclose, .name = "arcpgu", .desc = "ARC PGU Controller", .date = "20160219", .major = 1, .minor = 0, .patchlevel = 0, .fops = &arcpgu_drm_ops, .dumb_create = drm_gem_cma_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_print_info = drm_gem_cma_print_info, .gem_vm_ops = &drm_gem_cma_vm_ops, .gem_prime_export = drm_gem_prime_export, .gem_prime_import = drm_gem_prime_import, .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, .gem_prime_vmap = drm_gem_cma_prime_vmap, .gem_prime_vunmap = drm_gem_cma_prime_vunmap, .gem_prime_mmap = drm_gem_cma_prime_mmap, #ifdef CONFIG_DEBUG_FS .debugfs_init = arcpgu_debugfs_init, #endif }; static int arcpgu_probe(struct platform_device *pdev) { struct drm_device *drm; int ret; drm = drm_dev_alloc(&arcpgu_drm_driver, &pdev->dev); if (IS_ERR(drm)) return PTR_ERR(drm); ret = arcpgu_load(drm); if (ret) goto err_unref; ret = drm_dev_register(drm, 0); if (ret) goto err_unload; return 0; err_unload: arcpgu_unload(drm); err_unref: drm_dev_unref(drm); return ret; } static int arcpgu_remove(struct platform_device *pdev) { struct drm_device *drm = platform_get_drvdata(pdev); drm_dev_unregister(drm); arcpgu_unload(drm); drm_dev_unref(drm); return 0; } static const struct of_device_id arcpgu_of_table[] = { {.compatible = "snps,arcpgu"}, {} }; MODULE_DEVICE_TABLE(of, arcpgu_of_table); static struct platform_driver arcpgu_platform_driver = { .probe = arcpgu_probe, .remove = arcpgu_remove, .driver = { .name = "arcpgu", .of_match_table = arcpgu_of_table, }, }; module_platform_driver(arcpgu_platform_driver); MODULE_AUTHOR("Carlos Palminha <[email protected]>"); MODULE_DESCRIPTION("ARC PGU DRM driver"); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
<?php if( ! class_exists('acf_field_button_group') ) : class acf_field_button_group extends acf_field { /** * initialize() * * This function will setup the field type data * * @date 18/9/17 * @since 5.6.3 * * @param n/a * @return n/a */ function initialize() { // vars $this->name = 'button_group'; $this->label = __("Button Group",'acf'); $this->category = 'choice'; $this->defaults = array( 'choices' => array(), 'default_value' => '', 'allow_null' => 0, 'return_format' => 'value', 'layout' => 'horizontal', ); } /** * render_field() * * Creates the field's input HTML * * @date 18/9/17 * @since 5.6.3 * * @param array $field The field settings array * @return n/a */ function render_field( $field ) { // vars $html = ''; $selected = null; $buttons = array(); $value = esc_attr( $field['value'] ); // bail ealrly if no choices if( empty($field['choices']) ) return; // buttons foreach( $field['choices'] as $_value => $_label ) { // checked $checked = ( $value === esc_attr($_value) ); if( $checked ) $selected = true; // append $buttons[] = array( 'name' => $field['name'], 'value' => $_value, 'label' => $_label, 'checked' => $checked ); } // maybe select initial value if( !$field['allow_null'] && $selected === null ) { $buttons[0]['checked'] = true; } // div $div = array( 'class' => 'acf-button-group' ); if( $field['layout'] == 'vertical' ) { $div['class'] .= ' -vertical'; } if( $field['class'] ) { $div['class'] .= ' ' . $field['class']; } if( $field['allow_null'] ) { $div['data-allow_null'] = 1; } // hdden input $html .= acf_get_hidden_input( array('name' => $field['name']) ); // open $html .= '<div ' . acf_esc_attr($div) . '>'; // loop foreach( $buttons as $button ) { // checked if( $button['checked'] ) { $button['checked'] = 'checked'; } else { unset($button['checked']); } // append $html .= acf_get_radio_input( $button ); } // close $html .= '</div>'; // return echo $html; } /** * render_field_settings() * * Creates the field's settings HTML * * @date 18/9/17 * @since 5.6.3 * * @param array $field The field settings array * @return n/a */ function render_field_settings( $field ) { // encode choices (convert from array) $field['choices'] = acf_encode_choices($field['choices']); // choices acf_render_field_setting( $field, array( 'label' => __('Choices','acf'), 'instructions' => __('Enter each choice on a new line.','acf') . '<br /><br />' . __('For more control, you may specify both a value and label like this:','acf'). '<br /><br />' . __('red : Red','acf'), 'type' => 'textarea', 'name' => 'choices', )); // allow_null acf_render_field_setting( $field, array( 'label' => __('Allow Null?','acf'), 'instructions' => '', 'name' => 'allow_null', 'type' => 'true_false', 'ui' => 1, )); // default_value acf_render_field_setting( $field, array( 'label' => __('Default Value','acf'), 'instructions' => __('Appears when creating a new post','acf'), 'type' => 'text', 'name' => 'default_value', )); // layout acf_render_field_setting( $field, array( 'label' => __('Layout','acf'), 'instructions' => '', 'type' => 'radio', 'name' => 'layout', 'layout' => 'horizontal', 'choices' => array( 'horizontal' => __("Horizontal",'acf'), 'vertical' => __("Vertical",'acf'), ) )); // return_format acf_render_field_setting( $field, array( 'label' => __('Return Value','acf'), 'instructions' => __('Specify the returned value on front end','acf'), 'type' => 'radio', 'name' => 'return_format', 'layout' => 'horizontal', 'choices' => array( 'value' => __('Value','acf'), 'label' => __('Label','acf'), 'array' => __('Both (Array)','acf') ) )); } /* * update_field() * * This filter is appied to the $field before it is saved to the database * * @date 18/9/17 * @since 5.6.3 * * @param array $field The field array holding all the field options * @return $field */ function update_field( $field ) { return acf_get_field_type('radio')->update_field( $field ); } /* * load_value() * * This filter is appied to the $value after it is loaded from the db * * @date 18/9/17 * @since 5.6.3 * * @param mixed $value The value found in the database * @param mixed $post_id The post ID from which the value was loaded from * @param array $field The field array holding all the field options * @return $value */ function load_value( $value, $post_id, $field ) { return acf_get_field_type('radio')->load_value( $value, $post_id, $field ); } /* * translate_field * * This function will translate field settings * * @date 18/9/17 * @since 5.6.3 * * @param array $field The field array holding all the field options * @return $field */ function translate_field( $field ) { return acf_get_field_type('radio')->translate_field( $field ); } /* * format_value() * * This filter is appied to the $value after it is loaded from the db and before it is returned to the template * * @date 18/9/17 * @since 5.6.3 * * @param mixed $value The value found in the database * @param mixed $post_id The post ID from which the value was loaded from * @param array $field The field array holding all the field options * @return $value */ function format_value( $value, $post_id, $field ) { return acf_get_field_type('radio')->format_value( $value, $post_id, $field ); } } // initialize acf_register_field_type( 'acf_field_button_group' ); endif; // class_exists check ?>
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_55) on Wed Apr 01 22:58:20 PDT 2015 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class com.ctc.wstx.cfg.ErrorConsts (Woodstox 5.0.0 API)</title> <meta name="date" content="2015-04-01"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.ctc.wstx.cfg.ErrorConsts (Woodstox 5.0.0 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/ctc/wstx/cfg/ErrorConsts.html" title="class in com.ctc.wstx.cfg">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/ctc/wstx/cfg/class-use/ErrorConsts.html" target="_top">Frames</a></li> <li><a href="ErrorConsts.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.ctc.wstx.cfg.ErrorConsts" class="title">Uses of Class<br>com.ctc.wstx.cfg.ErrorConsts</h2> </div> <div class="classUseContainer">No usage of com.ctc.wstx.cfg.ErrorConsts</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/ctc/wstx/cfg/ErrorConsts.html" title="class in com.ctc.wstx.cfg">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/ctc/wstx/cfg/class-use/ErrorConsts.html" target="_top">Frames</a></li> <li><a href="ErrorConsts.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2012&#x2013;2015 <a href="http://fasterxml.com">FasterXML</a>. All rights reserved.</small></p> </body> </html>
{ "pile_set_name": "Github" }
// // Copyright (C) 2008 Maciej Sobczak with contributions from Artyom Tonkikh // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // #ifndef SOCI_BACKEND_LOADER_H_INCLUDED #define SOCI_BACKEND_LOADER_H_INCLUDED #include "soci/soci-backend.h" // std #include <string> #include <vector> namespace soci { namespace dynamic_backends { // used internally by session backend_factory const & get(std::string const & name); // provided for advanced user-level management SOCI_DECL std::vector<std::string> & search_paths(); SOCI_DECL void register_backend(std::string const & name, std::string const & shared_object = std::string()); SOCI_DECL void register_backend(std::string const & name, backend_factory const & factory); SOCI_DECL std::vector<std::string> list_all(); SOCI_DECL void unload(std::string const & name); SOCI_DECL void unload_all(); } // namespace dynamic_backends } // namespace soci #endif // SOCI_BACKEND_LOADER_H_INCLUDED
{ "pile_set_name": "Github" }
// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include "Common/CommonTypes.h" class PointerWrap; namespace DSP { class Accelerator { public: virtual ~Accelerator() = default; u16 Read(const s16* coefs); // Zelda ucode reads ARAM through 0xffd3. u16 ReadD3(); void WriteD3(u16 value); u32 GetStartAddress() const { return m_start_address; } u32 GetEndAddress() const { return m_end_address; } u32 GetCurrentAddress() const { return m_current_address; } u16 GetSampleFormat() const { return m_sample_format; } s16 GetYn1() const { return m_yn1; } s16 GetYn2() const { return m_yn2; } u16 GetPredScale() const { return m_pred_scale; } void SetStartAddress(u32 address); void SetEndAddress(u32 address); void SetCurrentAddress(u32 address); void SetSampleFormat(u16 format); void SetYn1(s16 yn1); void SetYn2(s16 yn2); void SetPredScale(u16 pred_scale); void DoState(PointerWrap& p); protected: virtual void OnEndException() = 0; virtual u8 ReadMemory(u32 address) = 0; virtual void WriteMemory(u32 address, u8 value) = 0; // DSP accelerator registers. u32 m_start_address = 0; u32 m_end_address = 0; u32 m_current_address = 0; u16 m_sample_format = 0; s16 m_yn1 = 0; s16 m_yn2 = 0; u16 m_pred_scale = 0; // When an ACCOV is triggered, the accelerator stops reading back anything // and updating the current address register, unless the YN2 register is written to. // This is kept track of internally; this state is not exposed via any register. bool m_reads_stopped = false; }; } // namespace DSP
{ "pile_set_name": "Github" }
config = { "interfaces": { "google.ads.googleads.v2.services.KeywordPlanCampaignService": { "retry_codes": { "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" ], "non_idempotent": [] }, "retry_params": { "default": { "initial_retry_delay_millis": 5000, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 3600000, "rpc_timeout_multiplier": 1.0, "max_rpc_timeout_millis": 3600000, "total_timeout_millis": 3600000 } }, "methods": { "GetKeywordPlanCampaign": { "timeout_millis": 60000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "MutateKeywordPlanCampaigns": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } } } } }
{ "pile_set_name": "Github" }
package com.tinyspeck.engine.view.renderer.commands { import com.tinyspeck.core.control.ICommand; import com.tinyspeck.debug.Benchmark; import com.tinyspeck.engine.control.TSFrontController; import com.tinyspeck.engine.model.TSModelLocator; import com.tinyspeck.engine.view.TSMainView; import com.tinyspeck.engine.view.gameoverlay.GrowlView; import com.tinyspeck.engine.view.renderer.RenderMode; /** * Changes location rendering mode and rebuilds location to * use the newly specified mode. */ public class ChangeRenderModeCmd implements ICommand { private var newRenderMode:RenderMode; private var model:TSModelLocator; private var mainView:TSMainView; private var frontController:TSFrontController; public function ChangeRenderModeCmd(newRenderMode:RenderMode) { this.newRenderMode = newRenderMode; model = TSModelLocator.instance; mainView = TSFrontController.instance.getMainView(); frontController = TSFrontController.instance; } public function execute():void { Benchmark.addCheck("CHANGING RENDER MODE FROM " + model.stateModel.render_mode.name + ' to ' + newRenderMode.name); if (newRenderMode == model.stateModel.render_mode) { return; } mainView.gameRenderer.setAvatarView(null); model.stateModel.render_mode = newRenderMode; model.stateModel.triggerCBProp(true, false, "render_mode"); CONFIG::god { GrowlView.instance.addNormalNotification("CHANGING RENDER MODE: " + newRenderMode.name); } LocationCommands.rebuildLocation(); } } }
{ "pile_set_name": "Github" }
/********************************************************************* * * msnd.c - Driver Base * * Turtle Beach MultiSound Sound Card Driver for Linux * * Copyright (C) 1998 Andrew Veliath * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ********************************************************************/ #include <linux/module.h> #include <linux/kernel.h> #include <linux/vmalloc.h> #include <linux/types.h> #include <linux/delay.h> #include <linux/mm.h> #include <linux/init.h> #include <linux/interrupt.h> #include <asm/io.h> #include <asm/uaccess.h> #include <linux/spinlock.h> #include <asm/irq.h> #include "msnd.h" #define LOGNAME "msnd" #define MSND_MAX_DEVS 4 static multisound_dev_t *devs[MSND_MAX_DEVS]; static int num_devs; int msnd_register(multisound_dev_t *dev) { int i; for (i = 0; i < MSND_MAX_DEVS; ++i) if (devs[i] == NULL) break; if (i == MSND_MAX_DEVS) return -ENOMEM; devs[i] = dev; ++num_devs; return 0; } void msnd_unregister(multisound_dev_t *dev) { int i; for (i = 0; i < MSND_MAX_DEVS; ++i) if (devs[i] == dev) break; if (i == MSND_MAX_DEVS) { printk(KERN_WARNING LOGNAME ": Unregistering unknown device\n"); return; } devs[i] = NULL; --num_devs; } void msnd_init_queue(void __iomem *base, int start, int size) { writew(PCTODSP_BASED(start), base + JQS_wStart); writew(PCTODSP_OFFSET(size) - 1, base + JQS_wSize); writew(0, base + JQS_wHead); writew(0, base + JQS_wTail); } void msnd_fifo_init(msnd_fifo *f) { f->data = NULL; } void msnd_fifo_free(msnd_fifo *f) { vfree(f->data); f->data = NULL; } int msnd_fifo_alloc(msnd_fifo *f, size_t n) { msnd_fifo_free(f); f->data = vmalloc(n); f->n = n; f->tail = 0; f->head = 0; f->len = 0; if (!f->data) return -ENOMEM; return 0; } void msnd_fifo_make_empty(msnd_fifo *f) { f->len = f->tail = f->head = 0; } int msnd_fifo_write_io(msnd_fifo *f, char __iomem *buf, size_t len) { int count = 0; while ((count < len) && (f->len != f->n)) { int nwritten; if (f->head <= f->tail) { nwritten = len - count; if (nwritten > f->n - f->tail) nwritten = f->n - f->tail; } else { nwritten = f->head - f->tail; if (nwritten > len - count) nwritten = len - count; } memcpy_fromio(f->data + f->tail, buf, nwritten); count += nwritten; buf += nwritten; f->len += nwritten; f->tail += nwritten; f->tail %= f->n; } return count; } int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) { int count = 0; while ((count < len) && (f->len != f->n)) { int nwritten; if (f->head <= f->tail) { nwritten = len - count; if (nwritten > f->n - f->tail) nwritten = f->n - f->tail; } else { nwritten = f->head - f->tail; if (nwritten > len - count) nwritten = len - count; } memcpy(f->data + f->tail, buf, nwritten); count += nwritten; buf += nwritten; f->len += nwritten; f->tail += nwritten; f->tail %= f->n; } return count; } int msnd_fifo_read_io(msnd_fifo *f, char __iomem *buf, size_t len) { int count = 0; while ((count < len) && (f->len > 0)) { int nread; if (f->tail <= f->head) { nread = len - count; if (nread > f->n - f->head) nread = f->n - f->head; } else { nread = f->tail - f->head; if (nread > len - count) nread = len - count; } memcpy_toio(buf, f->data + f->head, nread); count += nread; buf += nread; f->len -= nread; f->head += nread; f->head %= f->n; } return count; } int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len) { int count = 0; while ((count < len) && (f->len > 0)) { int nread; if (f->tail <= f->head) { nread = len - count; if (nread > f->n - f->head) nread = f->n - f->head; } else { nread = f->tail - f->head; if (nread > len - count) nread = len - count; } memcpy(buf, f->data + f->head, nread); count += nread; buf += nread; f->len -= nread; f->head += nread; f->head %= f->n; } return count; } static int msnd_wait_TXDE(multisound_dev_t *dev) { register unsigned int io = dev->io; register int timeout = 1000; while(timeout-- > 0) if (msnd_inb(io + HP_ISR) & HPISR_TXDE) return 0; return -EIO; } static int msnd_wait_HC0(multisound_dev_t *dev) { register unsigned int io = dev->io; register int timeout = 1000; while(timeout-- > 0) if (!(msnd_inb(io + HP_CVR) & HPCVR_HC)) return 0; return -EIO; } int msnd_send_dsp_cmd(multisound_dev_t *dev, BYTE cmd) { unsigned long flags; spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_HC0(dev) == 0) { msnd_outb(cmd, dev->io + HP_CVR); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); printk(KERN_DEBUG LOGNAME ": Send DSP command timeout\n"); return -EIO; } int msnd_send_word(multisound_dev_t *dev, unsigned char high, unsigned char mid, unsigned char low) { register unsigned int io = dev->io; if (msnd_wait_TXDE(dev) == 0) { msnd_outb(high, io + HP_TXH); msnd_outb(mid, io + HP_TXM); msnd_outb(low, io + HP_TXL); return 0; } printk(KERN_DEBUG LOGNAME ": Send host word timeout\n"); return -EIO; } int msnd_upload_host(multisound_dev_t *dev, char *bin, int len) { int i; if (len % 3 != 0) { printk(KERN_WARNING LOGNAME ": Upload host data not multiple of 3!\n"); return -EINVAL; } for (i = 0; i < len; i += 3) if (msnd_send_word(dev, bin[i], bin[i + 1], bin[i + 2]) != 0) return -EIO; msnd_inb(dev->io + HP_RXL); msnd_inb(dev->io + HP_CVR); return 0; } int msnd_enable_irq(multisound_dev_t *dev) { unsigned long flags; if (dev->irq_ref++) return 0; printk(KERN_DEBUG LOGNAME ": Enabling IRQ\n"); spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_TXDE(dev) == 0) { msnd_outb(msnd_inb(dev->io + HP_ICR) | HPICR_TREQ, dev->io + HP_ICR); if (dev->type == msndClassic) msnd_outb(dev->irqid, dev->io + HP_IRQM); msnd_outb(msnd_inb(dev->io + HP_ICR) & ~HPICR_TREQ, dev->io + HP_ICR); msnd_outb(msnd_inb(dev->io + HP_ICR) | HPICR_RREQ, dev->io + HP_ICR); enable_irq(dev->irq); msnd_init_queue(dev->DSPQ, dev->dspq_data_buff, dev->dspq_buff_size); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); printk(KERN_DEBUG LOGNAME ": Enable IRQ failed\n"); return -EIO; } int msnd_disable_irq(multisound_dev_t *dev) { unsigned long flags; if (--dev->irq_ref > 0) return 0; if (dev->irq_ref < 0) printk(KERN_DEBUG LOGNAME ": IRQ ref count is %d\n", dev->irq_ref); printk(KERN_DEBUG LOGNAME ": Disabling IRQ\n"); spin_lock_irqsave(&dev->lock, flags); if (msnd_wait_TXDE(dev) == 0) { msnd_outb(msnd_inb(dev->io + HP_ICR) & ~HPICR_RREQ, dev->io + HP_ICR); if (dev->type == msndClassic) msnd_outb(HPIRQ_NONE, dev->io + HP_IRQM); disable_irq(dev->irq); spin_unlock_irqrestore(&dev->lock, flags); return 0; } spin_unlock_irqrestore(&dev->lock, flags); printk(KERN_DEBUG LOGNAME ": Disable IRQ failed\n"); return -EIO; } #ifndef LINUX20 EXPORT_SYMBOL(msnd_register); EXPORT_SYMBOL(msnd_unregister); EXPORT_SYMBOL(msnd_init_queue); EXPORT_SYMBOL(msnd_fifo_init); EXPORT_SYMBOL(msnd_fifo_free); EXPORT_SYMBOL(msnd_fifo_alloc); EXPORT_SYMBOL(msnd_fifo_make_empty); EXPORT_SYMBOL(msnd_fifo_write_io); EXPORT_SYMBOL(msnd_fifo_read_io); EXPORT_SYMBOL(msnd_fifo_write); EXPORT_SYMBOL(msnd_fifo_read); EXPORT_SYMBOL(msnd_send_dsp_cmd); EXPORT_SYMBOL(msnd_send_word); EXPORT_SYMBOL(msnd_upload_host); EXPORT_SYMBOL(msnd_enable_irq); EXPORT_SYMBOL(msnd_disable_irq); #endif #ifdef MODULE MODULE_AUTHOR ("Andrew Veliath <[email protected]>"); MODULE_DESCRIPTION ("Turtle Beach MultiSound Driver Base"); MODULE_LICENSE("GPL"); int init_module(void) { return 0; } void cleanup_module(void) { } #endif
{ "pile_set_name": "Github" }
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. source_set("physical_web") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ "physical_web_device.h", "physical_web_device.mm", "physical_web_request.h", "physical_web_request.mm", "physical_web_scanner.h", "physical_web_scanner.mm", "physical_web_types.h", "physical_web_types.mm", ] deps = [ "//base", "//components/physical_web/data_source", "//components/version_info", "//device/bluetooth/uribeacon", "//google_apis", "//ios/web:user_agent", ] libs = [ "CoreBluetooth.framework", "Foundation.framework", ] }
{ "pile_set_name": "Github" }
use super::SockAddr; use libc::{sockaddr, c_void, c_char, c_uchar, c_short, c_ushort, c_int, c_uint, c_ulong}; use std::ptr; use std::mem; use std::ffi::{CStr, CString}; use std::net::Ipv4Addr; use std::io::{self, Error, ErrorKind}; use std::os::unix::io::{RawFd, AsRawFd, IntoRawFd}; pub const IFNAMSIZ: usize = 16; pub const IFF_UP: c_short = 0x1; pub const IFF_RUNNING: c_short = 0x40; pub const IFF_TUN: c_short = 0x0001; pub const IFF_NO_PI: c_short = 0x1000; #[repr(C)] #[derive(Copy, Clone)] pub struct ifmap { pub mem_start: c_ulong, pub mem_end: c_ulong, pub base_addr: c_ushort, pub irq: c_uchar, pub dma: c_uchar, pub port: c_uchar, } #[repr(C)] #[derive(Copy, Clone)] pub union ifsu { pub raw_hdlc_proto: *mut c_void, pub cisco: *mut c_void, pub fr: *mut c_void, pub fr_pvc: *mut c_void, pub fr_pvc_info: *mut c_void, pub sync: *mut c_void, pub te1: *mut c_void, } #[repr(C)] #[derive(Copy, Clone)] pub struct if_settings { pub type_: c_uint, pub size: c_uint, pub ifsu: ifsu, } #[repr(C)] #[derive(Copy, Clone)] pub union ifrn { pub name: [c_char; IFNAMSIZ], } #[repr(C)] #[derive(Copy, Clone)] pub union ifru { pub addr: sockaddr, pub dstaddr: sockaddr, pub broadaddr: sockaddr, pub netmask: sockaddr, pub hwaddr: sockaddr, pub flags: c_short, pub ivalue: c_int, pub mtu: c_int, pub map: ifmap, pub slave: [c_char; IFNAMSIZ], pub newname: [c_char; IFNAMSIZ], pub data: *mut c_void, pub settings: if_settings, } #[repr(C)] #[derive(Copy, Clone)] pub struct ifreq { pub ifrn: ifrn, pub ifru: ifru, } ioctl!(bad read siocgifflags with 0x8913; ifreq); ioctl!(bad write siocsifflags with 0x8914; ifreq); ioctl!(bad read siocgifaddr with 0x8915; ifreq); ioctl!(bad write siocsifaddr with 0x8916; ifreq); ioctl!(bad read siocgifdstaddr with 0x8917; ifreq); ioctl!(bad write siocsifdstaddr with 0x8918; ifreq); ioctl!(bad read siocgifbrdaddr with 0x8919; ifreq); ioctl!(bad write siocsifbrdaddr with 0x891a; ifreq); ioctl!(bad read siocgifnetmask with 0x891b; ifreq); ioctl!(bad write siocsifnetmask with 0x891c; ifreq); ioctl!(bad read siocgifmtu with 0x8921; ifreq); ioctl!(bad write siocsifmtu with 0x8922; ifreq); ioctl!(bad write siocsifname with 0x8923; ifreq); ioctl!(write tunsetiff with b'T', 202; c_int); ioctl!(write tunsetpersist with b'T', 203; c_int); ioctl!(write tunsetowner with b'T', 204; c_int); ioctl!(write tunsetgroup with b'T', 206; c_int); #[derive(Debug)] pub struct Device { name: String, tun: RawFd, ctl: RawFd, } impl Device { pub fn new(name: &str) -> Result<Self, Error> { let name = CString::new(name.clone()).unwrap(); if name.as_bytes_with_nul().len() > IFNAMSIZ { return Err(Error::new(ErrorKind::InvalidInput, "name too long")); } let (tun, ctl, name) = unsafe { let tun = libc::open(b"/dev/net/tun\0".as_ptr() as *const _, libc::O_RDWR); if tun < 0 { return Err(io::Error::last_os_error()); } let mut req: ifreq = mem::zeroed(); ptr::copy_nonoverlapping(name.as_ptr() as *const c_char, req.ifrn.name.as_mut_ptr(), name.as_bytes().len()); req.ifru.flags = IFF_TUN | IFF_NO_PI; if tunsetiff(tun, &mut req as *mut _ as *mut _) < 0 { return Err(io::Error::last_os_error()); } let ctl = libc::socket(libc::AF_INET, libc::SOCK_DGRAM, 0); if ctl < 0 { return Err(io::Error::last_os_error()); } (tun, ctl, CStr::from_ptr(req.ifrn.name.as_ptr()).to_string_lossy().into()) }; Ok(Device { name: name, tun: tun, ctl: ctl, }) } /// Set the owner of the device. pub fn user(&mut self, value: i32) -> Result<(), Error> { unsafe { if tunsetowner(self.tun, &value) < 0 { return Err(io::Error::last_os_error()) } } Ok(()) } /// Set the group of the device. pub fn group(&mut self, value: i32) -> Result<(), Error> { unsafe { if tunsetgroup(self.tun, &value) < 0 { return Err(io::Error::last_os_error()); } } Ok(()) } #[inline] pub fn name(&self) -> &str { &self.name } /// Prepare a new request. #[inline] unsafe fn request(&self) -> ifreq { let mut req: ifreq = mem::zeroed(); ptr::copy_nonoverlapping(self.name.as_ptr() as *const c_char, req.ifrn.name.as_mut_ptr(), self.name.len()); req } pub fn set_name(&mut self, value: &str) -> Result<(), Error> { unsafe { let name = CString::new(value)?; if name.as_bytes_with_nul().len() > IFNAMSIZ { return Err(Error::new(ErrorKind::InvalidInput, "name too long")); } let mut req = self.request(); ptr::copy_nonoverlapping(name.as_ptr() as *const c_char, req.ifru.newname.as_mut_ptr(), value.len()); if siocsifname(self.ctl, &req) < 0 { return Err(io::Error::last_os_error()); } self.name = value.into(); Ok(()) } } pub fn address(&self) -> Result<Ipv4Addr, Error> { unsafe { let mut req = self.request(); if siocgifaddr(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } SockAddr::new(&req.ifru.addr).map(Into::into) } } pub fn set_address<T: Into<Ipv4Addr>>(&mut self, value: T) -> Result<(), Error> { unsafe { let mut req = self.request(); req.ifru.addr = SockAddr::from(value.into()).into(); if siocsifaddr(self.ctl, &req) < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } pub fn destination(&self) -> Result<Ipv4Addr, Error> { unsafe { let mut req = self.request(); if siocgifdstaddr(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } SockAddr::new(&req.ifru.dstaddr).map(Into::into) } } pub fn set_destination<T: Into<Ipv4Addr>>(&mut self, value: T) -> Result<(), Error> { unsafe { let mut req = self.request(); req.ifru.dstaddr = SockAddr::from(value.into()).into(); if siocsifdstaddr(self.ctl, &req) < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } pub fn broadcast(&self) -> Result<Ipv4Addr, Error> { unsafe { let mut req = self.request(); if siocgifbrdaddr(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } SockAddr::new(&req.ifru.broadaddr).map(Into::into) } } pub fn set_broadcast<T: Into<Ipv4Addr>>(&mut self, value: T) -> Result<(), Error> { unsafe { let mut req = self.request(); req.ifru.broadaddr = SockAddr::from(value.into()).into(); if siocsifbrdaddr(self.ctl, &req) < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } pub fn netmask(&self) -> Result<Ipv4Addr, Error> { unsafe { let mut req = self.request(); if siocgifnetmask(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } SockAddr::new(&req.ifru.netmask).map(Into::into) } } pub fn set_netmask<T: Into<Ipv4Addr>>(&mut self, value: T) -> Result<(), Error> { unsafe { let mut req = self.request(); req.ifru.netmask = SockAddr::from(value.into()).into(); if siocsifnetmask(self.ctl, &req) < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } pub fn mtu(&self) -> Result<i32, Error> { unsafe { let mut req = self.request(); if siocgifmtu(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } Ok(req.ifru.mtu) } } pub fn set_mtu(&mut self, value: i32) -> Result<(), Error> { // Minimum MTU required of all links supporting IPv4. See RFC 791 § 3.1. pub const IPV4_MIN_MTU: i32 = 576; // Minimum MTU required of all links supporting IPv6. See RFC 8200 § 5. // pub const IPV6_MIN_MTU: i32 = 1280; if value < IPV4_MIN_MTU { return Err(Error::new(ErrorKind::InvalidInput, "MTU is too small")); } unsafe { let mut req = self.request(); req.ifru.mtu = value; if siocsifmtu(self.ctl, &req) < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } pub fn enabled(&mut self, value: bool) -> Result<(), Error> { unsafe { let mut req = self.request(); if siocgifflags(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } if value { req.ifru.flags |= IFF_UP | IFF_RUNNING; } else { req.ifru.flags &= !IFF_UP; } if siocsifflags(self.ctl, &mut req) < 0 { return Err(io::Error::last_os_error()); } Ok(()) } } } impl AsRawFd for Device { fn as_raw_fd(&self) -> RawFd { self.tun } } impl IntoRawFd for Device { fn into_raw_fd(self) -> RawFd { self.tun } } impl Drop for Device { fn drop(&mut self) { unsafe { if self.ctl >= 0 { libc::close(self.ctl); } if self.tun >= 0 { libc::close(self.tun); } } } }
{ "pile_set_name": "Github" }
package me.mdbell.noexs.io; import java.io.Closeable; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.util.AbstractList; import java.util.ArrayList; import java.util.List; public abstract class MappedList<T> extends AbstractList<T> implements Closeable { private static final long BUFFER_SIZE = 1024 * 1024 * 50; //50MB private RandomAccessFile raf; private List<MappedByteBuffer> buffers = new ArrayList<>(); private int size; private final long dataSize; private ThreadLocal<Integer> cachedIdx = ThreadLocal.withInitial(() -> -1); private ThreadLocal<MappedByteBuffer> cachedBuffer = ThreadLocal.withInitial(() -> null); protected abstract long dataSize(); protected abstract T read(ByteBuffer from, int pos); protected abstract boolean write(ByteBuffer to, int pos, T value); public MappedList(RandomAccessFile raf) { this(raf, 0); } public MappedList(RandomAccessFile raf, int size) { this.raf = raf; this.size = size; this.dataSize = dataSize(); } private int wrapIndex(int index) { return (int) ((index * dataSize) % BUFFER_SIZE); } private synchronized void checkSize(int index) { try { while (index >= buffers.size()) { MappedByteBuffer buffer = raf.getChannel().map(FileChannel.MapMode.READ_WRITE, index * BUFFER_SIZE, BUFFER_SIZE); buffers.add(buffer); } } catch (IOException e) { throw new RuntimeException(e); } } private MappedByteBuffer getBuffer(int idx) { long pos = idx * dataSize; int bufferIndex = (int) (pos / BUFFER_SIZE); int cachedIdx = this.cachedIdx.get(); if (bufferIndex == cachedIdx) { return cachedBuffer.get(); } if (bufferIndex >= buffers.size()) { checkSize(bufferIndex); } this.cachedIdx.set(bufferIndex); MappedByteBuffer buffer = buffers.get(bufferIndex); this.cachedBuffer.set(buffer); return buffer; } @Override public T get(int index) { return read(getBuffer(index), wrapIndex(index)); } @Override public T set(int index, T element) { write(getBuffer(index), wrapIndex(index), element); return element; } @Override public boolean add(T value) { int index = size++; set(index, value); return true; } @Override public void close() throws IOException { cachedBuffer = null; buffers.clear(); System.gc(); raf.close(); } @Override public int size() { return size; } public static MappedList<Long> createLongList(RandomAccessFile raf) { return new MappedList<>(raf) { @Override protected long dataSize() { return Long.BYTES; } @Override protected Long read(ByteBuffer from, int pos) { return from.getLong(pos); } @Override protected boolean write(ByteBuffer to, int pos, Long value) { to.putLong(value); return true; } }; } }
{ "pile_set_name": "Github" }
classdef FooTest < TestCase methods function object = FooTest(name) object = object@TestCase(name); end function test_sanity(object) assertEqual(0, 0) end end end
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Hartmut Kaiser http://spirit.sourceforge.net/ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef BOOST_SPIRIT_INCLUDE_PHOENIX_VERSION #define BOOST_SPIRIT_INCLUDE_PHOENIX_VERSION #include <boost/spirit/home/phoenix/version.hpp> #endif
{ "pile_set_name": "Github" }
/* github.com style (c) Vasily Polovnyov <[email protected]> */ .h2w-light .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .h2w-light .hljs-comment, .h2w-light .hljs-quote { color: #998; font-style: italic; } .h2w-light .hljs-keyword, .h2w-light .hljs-selector-tag, .h2w-light .hljs-subst { color: #333; font-weight: bold; } .h2w-light .hljs-number, .h2w-light .hljs-literal, .h2w-light .hljs-variable, .h2w-light .hljs-template-variable, .h2w-light .hljs-tag .hljs-attr { color: #008080; } .h2w-light .hljs-string, .h2w-light .hljs-doctag { color: #d14; } .h2w-light .hljs-title, .h2w-light .hljs-section, .h2w-light .hljs-selector-id { color: #900; font-weight: bold; } .h2w-light .hljs-subst { font-weight: normal; } .h2w-light .hljs-type, .h2w-light .hljs-class .hljs-title { color: #458; font-weight: bold; } .h2w-light .hljs-tag, .h2w-light .hljs-name, .h2w-light .hljs-attribute { color: #000080; font-weight: normal; } .h2w-light .hljs-regexp, .h2w-light .hljs-link { color: #009926; } .h2w-light .hljs-symbol, .h2w-light .hljs-bullet { color: #990073; } .h2w-light .hljs-built_in, .h2w-light .hljs-builtin-name { color: #0086b3; } .h2w-light .hljs-meta { color: #999; font-weight: bold; } .h2w-light .hljs-deletion { background: #fdd; } .h2w-light .hljs-addition { background: #dfd; } .h2w-light .hljs-emphasis { font-style: italic; } .h2w-light .hljs-strong { font-weight: bold; }
{ "pile_set_name": "Github" }
implicit none character(len=12), parameter:: hello_world='Hello World!' contains subroutine print_hello_world() implicit none print "(A)",hello_world return endsubroutine print_hello_world
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="ISO-8859-1" /> <xsl:template match="node()|@*"> <xsl:copy><xsl:apply-templates select="@* | node()" /></xsl:copy> </xsl:template> <xsl:template match="surface"> <xsl:choose> <xsl:when test="@array"> <sprite name="{@name}"> <image file="{@file}"> <grid pos="{@x},{@y}" size="{@width},{@height}" array="{@array}" /> </image> </sprite> </xsl:when> <xsl:otherwise> <sprite name="{@name}"> <image file="{@file}" /> </sprite> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>
{ "pile_set_name": "Github" }
/* openssl/engine.h */ /* * Written by Geoff Thorpe ([email protected]) for the OpenSSL project * 2000. */ /* ==================================================================== * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * [email protected]. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED 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 OpenSSL PROJECT OR * ITS 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 product includes cryptographic software written by Eric Young * ([email protected]). This product includes software written by Tim * Hudson ([email protected]). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECDH support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #ifndef HEADER_ENGINE_H # define HEADER_ENGINE_H # include <openssl/opensslconf.h> # ifdef OPENSSL_NO_ENGINE # error ENGINE is disabled. # endif # ifndef OPENSSL_NO_DEPRECATED # include <openssl/bn.h> # ifndef OPENSSL_NO_RSA # include <openssl/rsa.h> # endif # ifndef OPENSSL_NO_DSA # include <openssl/dsa.h> # endif # ifndef OPENSSL_NO_DH # include <openssl/dh.h> # endif # ifndef OPENSSL_NO_ECDH # include <openssl/ecdh.h> # endif # ifndef OPENSSL_NO_ECDSA # include <openssl/ecdsa.h> # endif # include <openssl/rand.h> # include <openssl/ui.h> # include <openssl/err.h> # endif # include <openssl/ossl_typ.h> # include <openssl/symhacks.h> # include <openssl/x509.h> #ifdef __cplusplus extern "C" { #endif /* * These flags are used to control combinations of algorithm (methods) by * bitwise "OR"ing. */ # define ENGINE_METHOD_RSA (unsigned int)0x0001 # define ENGINE_METHOD_DSA (unsigned int)0x0002 # define ENGINE_METHOD_DH (unsigned int)0x0004 # define ENGINE_METHOD_RAND (unsigned int)0x0008 # define ENGINE_METHOD_ECDH (unsigned int)0x0010 # define ENGINE_METHOD_ECDSA (unsigned int)0x0020 # define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 # define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 # define ENGINE_METHOD_STORE (unsigned int)0x0100 # define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 # define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 /* Obvious all-or-nothing cases. */ # define ENGINE_METHOD_ALL (unsigned int)0xFFFF # define ENGINE_METHOD_NONE (unsigned int)0x0000 /* * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used * internally to control registration of ENGINE implementations, and can be * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to * initialise registered ENGINEs if they are not already initialised. */ # define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 /* ENGINE flags that can be set by ENGINE_set_flags(). */ /* Not used */ /* #define ENGINE_FLAGS_MALLOCED 0x0001 */ /* * This flag is for ENGINEs that wish to handle the various 'CMD'-related * control commands on their own. Without this flag, ENGINE_ctrl() handles * these control commands on behalf of the ENGINE using their "cmd_defns" * data. */ # define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 /* * This flag is for ENGINEs who return new duplicate structures when found * via "ENGINE_by_id()". When an ENGINE must store state (eg. if * ENGINE_ctrl() commands are called in sequence as part of some stateful * process like key-generation setup and execution), it can set this flag - * then each attempt to obtain the ENGINE will result in it being copied into * a new structure. Normally, ENGINEs don't declare this flag so * ENGINE_by_id() just increments the existing ENGINE's structural reference * count. */ # define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 /* * This flag if for an ENGINE that does not want its methods registered as * part of ENGINE_register_all_complete() for example if the methods are not * usable as default methods. */ # define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 /* * ENGINEs can support their own command types, and these flags are used in * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input * each command expects. Currently only numeric and string input is * supported. If a control command supports none of the _NUMERIC, _STRING, or * _NO_INPUT options, then it is regarded as an "internal" control command - * and not for use in config setting situations. As such, they're not * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() * access. Changes to this list of 'command types' should be reflected * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */ /* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ # define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 /* * accepts string input (cast from 'void*' to 'const char *', 4th parameter * to ENGINE_ctrl) */ # define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 /* * Indicates that the control command takes *no* input. Ie. the control * command is unparameterised. */ # define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 /* * Indicates that the control command is internal. This control command won't * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() * function. */ # define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 /* * NB: These 3 control commands are deprecated and should not be used. * ENGINEs relying on these commands should compile conditional support for * compatibility (eg. if these symbols are defined) but should also migrate * the same functionality to their own ENGINE-specific control functions that * can be "discovered" by calling applications. The fact these control * commands wouldn't be "executable" (ie. usable by text-based config) * doesn't change the fact that application code can find and use them * without requiring per-ENGINE hacking. */ /* * These flags are used to tell the ctrl function what should be done. All * command numbers are shared between all engines, even if some don't make * sense to some engines. In such a case, they do nothing but return the * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */ # define ENGINE_CTRL_SET_LOGSTREAM 1 # define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 # define ENGINE_CTRL_HUP 3/* Close and reinitialise * any handles/connections * etc. */ # define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ # define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used * when calling the password * callback and the user * interface */ # define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, * given a string that * represents a file name * or so */ # define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given * section in the already * loaded configuration */ /* * These control commands allow an application to deal with an arbitrary * engine in a dynamic way. Warn: Negative return values indicate errors FOR * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other * commands, including ENGINE-specific command types, return zero for an * error. An ENGINE can choose to implement these ctrl functions, and can * internally manage things however it chooses - it does so by setting the * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's * ctrl() handler need only implement its own commands - the above "meta" * commands will be taken care of. */ /* * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", * then all the remaining control commands will return failure, so it is * worth checking this first if the caller is trying to "discover" the * engine's capabilities and doesn't want errors generated unnecessarily. */ # define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 /* * Returns a positive command number for the first command supported by the * engine. Returns zero if no ctrl commands are supported. */ # define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 /* * The 'long' argument specifies a command implemented by the engine, and the * return value is the next command supported, or zero if there are no more. */ # define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 /* * The 'void*' argument is a command name (cast from 'const char *'), and the * return value is the command that corresponds to it. */ # define ENGINE_CTRL_GET_CMD_FROM_NAME 13 /* * The next two allow a command to be converted into its corresponding string * form. In each case, the 'long' argument supplies the command. In the * NAME_LEN case, the return value is the length of the command name (not * counting a trailing EOL). In the NAME case, the 'void*' argument must be a * string buffer large enough, and it will be populated with the name of the * command (WITH a trailing EOL). */ # define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 # define ENGINE_CTRL_GET_NAME_FROM_CMD 15 /* The next two are similar but give a "short description" of a command. */ # define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 # define ENGINE_CTRL_GET_DESC_FROM_CMD 17 /* * With this command, the return value is the OR'd combination of * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given * engine-specific ctrl command expects. */ # define ENGINE_CTRL_GET_CMD_FLAGS 18 /* * ENGINE implementations should start the numbering of their own control * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ # define ENGINE_CMD_BASE 200 /* * NB: These 2 nCipher "chil" control commands are deprecated, and their * functionality is now available through ENGINE-specific control commands * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 * commands should be migrated to the more general command handling before * these are removed. */ /* Flags specific to the nCipher "chil" engine */ # define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 /* * Depending on the value of the (long)i argument, this sets or * unsets the SimpleForkCheck flag in the CHIL API to enable or * disable checking and workarounds for applications that fork(). */ # define ENGINE_CTRL_CHIL_NO_LOCKING 101 /* * This prevents the initialisation function from providing mutex * callbacks to the nCipher library. */ /* * If an ENGINE supports its own specific control commands and wishes the * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() * handler that supports the stated commands (ie. the "cmd_num" entries as * described by the array). NB: The array must be ordered in increasing order * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element * has cmd_num set to zero and/or cmd_name set to NULL. */ typedef struct ENGINE_CMD_DEFN_st { unsigned int cmd_num; /* The command number */ const char *cmd_name; /* The command name itself */ const char *cmd_desc; /* A short description of the command */ unsigned int cmd_flags; /* The input the command expects */ } ENGINE_CMD_DEFN; /* Generic function pointer */ typedef int (*ENGINE_GEN_FUNC_PTR) (void); /* Generic function pointer taking no arguments */ typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); /* Specific control function pointer */ typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, void (*f) (void)); /* Generic load_key function pointer */ typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, UI_METHOD *ui_method, void *callback_data); typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); /*- * These callback types are for an ENGINE's handler for cipher and digest logic. * These handlers have these prototypes; * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); * Looking at how to implement these handlers in the case of cipher support, if * the framework wants the EVP_CIPHER for 'nid', it will call; * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) * If the framework wants a list of supported 'nid's, it will call; * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) */ /* * Returns to a pointer to the array of supported cipher 'nid's. If the * second parameter is non-NULL it is set to the size of the returned array. */ typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, const int **, int); typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, int); typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, const int **, int); typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int); /* * STRUCTURE functions ... all of these functions deal with pointers to * ENGINE structures where the pointers have a "structural reference". This * means that their reference is to allowed access to the structure but it * does not imply that the structure is functional. To simply increment or * decrement the structural reference count, use ENGINE_by_id and * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next * as it will automatically decrement the structural reference count of the * "current" ENGINE and increment the structural reference count of the * ENGINE it returns (unless it is NULL). */ /* Get the first/last "ENGINE" type available. */ ENGINE *ENGINE_get_first(void); ENGINE *ENGINE_get_last(void); /* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ ENGINE *ENGINE_get_next(ENGINE *e); ENGINE *ENGINE_get_prev(ENGINE *e); /* Add another "ENGINE" type into the array. */ int ENGINE_add(ENGINE *e); /* Remove an existing "ENGINE" type from the array. */ int ENGINE_remove(ENGINE *e); /* Retrieve an engine from the list by its unique "id" value. */ ENGINE *ENGINE_by_id(const char *id); /* Add all the built-in engines. */ void ENGINE_load_openssl(void); void ENGINE_load_dynamic(void); # ifndef OPENSSL_NO_STATIC_ENGINE void ENGINE_load_4758cca(void); void ENGINE_load_aep(void); void ENGINE_load_atalla(void); void ENGINE_load_chil(void); void ENGINE_load_cswift(void); void ENGINE_load_nuron(void); void ENGINE_load_sureware(void); void ENGINE_load_ubsec(void); void ENGINE_load_padlock(void); void ENGINE_load_capi(void); # ifndef OPENSSL_NO_GMP void ENGINE_load_gmp(void); # endif # ifndef OPENSSL_NO_GOST void ENGINE_load_gost(void); # endif # endif void ENGINE_load_cryptodev(void); void ENGINE_load_rdrand(void); void ENGINE_load_builtin_engines(void); /* * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation * "registry" handling. */ unsigned int ENGINE_get_table_flags(void); void ENGINE_set_table_flags(unsigned int flags); /*- Manage registration of ENGINEs per "table". For each type, there are 3 * functions; * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) * ENGINE_unregister_***(e) - unregister the implementation from 'e' * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list * Cleanup is automatically registered from each table when required, so * ENGINE_cleanup() will reverse any "register" operations. */ int ENGINE_register_RSA(ENGINE *e); void ENGINE_unregister_RSA(ENGINE *e); void ENGINE_register_all_RSA(void); int ENGINE_register_DSA(ENGINE *e); void ENGINE_unregister_DSA(ENGINE *e); void ENGINE_register_all_DSA(void); int ENGINE_register_ECDH(ENGINE *e); void ENGINE_unregister_ECDH(ENGINE *e); void ENGINE_register_all_ECDH(void); int ENGINE_register_ECDSA(ENGINE *e); void ENGINE_unregister_ECDSA(ENGINE *e); void ENGINE_register_all_ECDSA(void); int ENGINE_register_DH(ENGINE *e); void ENGINE_unregister_DH(ENGINE *e); void ENGINE_register_all_DH(void); int ENGINE_register_RAND(ENGINE *e); void ENGINE_unregister_RAND(ENGINE *e); void ENGINE_register_all_RAND(void); int ENGINE_register_STORE(ENGINE *e); void ENGINE_unregister_STORE(ENGINE *e); void ENGINE_register_all_STORE(void); int ENGINE_register_ciphers(ENGINE *e); void ENGINE_unregister_ciphers(ENGINE *e); void ENGINE_register_all_ciphers(void); int ENGINE_register_digests(ENGINE *e); void ENGINE_unregister_digests(ENGINE *e); void ENGINE_register_all_digests(void); int ENGINE_register_pkey_meths(ENGINE *e); void ENGINE_unregister_pkey_meths(ENGINE *e); void ENGINE_register_all_pkey_meths(void); int ENGINE_register_pkey_asn1_meths(ENGINE *e); void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); void ENGINE_register_all_pkey_asn1_meths(void); /* * These functions register all support from the above categories. Note, use * of these functions can result in static linkage of code your application * may not need. If you only need a subset of functionality, consider using * more selective initialisation. */ int ENGINE_register_complete(ENGINE *e); int ENGINE_register_all_complete(void); /* * Send parametrised control commands to the engine. The possibilities to * send down an integer, a pointer to data or a function pointer are * provided. Any of the parameters may or may not be NULL, depending on the * command number. In actuality, this function only requires a structural * (rather than functional) reference to an engine, but many control commands * may require the engine be functional. The caller should be aware of trying * commands that require an operational ENGINE, and only use functional * references in such situations. */ int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); /* * This function tests if an ENGINE-specific command is usable as a * "setting". Eg. in an application's config file that gets processed through * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */ int ENGINE_cmd_is_executable(ENGINE *e, int cmd); /* * This function works like ENGINE_ctrl() with the exception of taking a * command name instead of a command number, and can handle optional * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation * on how to use the cmd_name and cmd_optional. */ int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p, void (*f) (void), int cmd_optional); /* * This function passes a command-name and argument to an ENGINE. The * cmd_name is converted to a command number and the control command is * called using 'arg' as an argument (unless the ENGINE doesn't support such * a command, in which case no control command is called). The command is * checked for input flags, and if necessary the argument will be converted * to a numeric value. If cmd_optional is non-zero, then if the ENGINE * doesn't support the given cmd_name the return value will be success * anyway. This function is intended for applications to use so that users * (or config files) can supply engine-specific config data to the ENGINE at * run-time to control behaviour of specific engines. As such, it shouldn't * be used for calling ENGINE_ctrl() functions that return data, deal with * binary data, or that are otherwise supposed to be used directly through * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() * operation in this function will be lost - the return value is interpreted * as failure if the return value is zero, success otherwise, and this * function returns a boolean value as a result. In other words, vendors of * 'ENGINE'-enabled devices should write ENGINE implementations with * parameterisations that work in this scheme, so that compliant ENGINE-based * applications can work consistently with the same configuration for the * same ENGINE-enabled devices, across applications. */ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, int cmd_optional); /* * These functions are useful for manufacturing new ENGINE structures. They * don't address reference counting at all - one uses them to populate an * ENGINE structure with personalised implementations of things prior to * using it directly or adding it to the builtin ENGINE list in OpenSSL. * These are also here so that the ENGINE structure doesn't have to be * exposed and break binary compatibility! */ ENGINE *ENGINE_new(void); int ENGINE_free(ENGINE *e); int ENGINE_up_ref(ENGINE *e); int ENGINE_set_id(ENGINE *e, const char *id); int ENGINE_set_name(ENGINE *e, const char *name); int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth); int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth); int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth); int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); int ENGINE_set_flags(ENGINE *e, int flags); int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); /* These functions allow control over any per-structure ENGINE data. */ int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); void *ENGINE_get_ex_data(const ENGINE *e, int idx); /* * This function cleans up anything that needs it. Eg. the ENGINE_add() * function automatically ensures the list cleanup function is registered to * be called from ENGINE_cleanup(). Similarly, all ENGINE_register_*** * functions ensure ENGINE_cleanup() will clean up after them. */ void ENGINE_cleanup(void); /* * These return values from within the ENGINE structure. These can be useful * with functional references as well as structural references - it depends * which you obtained. Using the result for functional purposes if you only * obtained a structural reference may be problematic! */ const char *ENGINE_get_id(const ENGINE *e); const char *ENGINE_get_name(const ENGINE *e); const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); const DH_METHOD *ENGINE_get_DH(const ENGINE *e); const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, const char *str, int len); const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, const char *str, int len); const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); int ENGINE_get_flags(const ENGINE *e); /* * FUNCTIONAL functions. These functions deal with ENGINE structures that * have (or will) be initialised for use. Broadly speaking, the structural * functions are useful for iterating the list of available engine types, * creating new engine types, and other "list" operations. These functions * actually deal with ENGINEs that are to be used. As such these functions * can fail (if applicable) when particular engines are unavailable - eg. if * a hardware accelerator is not attached or not functioning correctly. Each * ENGINE has 2 reference counts; structural and functional. Every time a * functional reference is obtained or released, a corresponding structural * reference is automatically obtained or released too. */ /* * Initialise a engine type for use (or up its reference count if it's * already in use). This will fail if the engine is not currently operational * and cannot initialise. */ int ENGINE_init(ENGINE *e); /* * Free a functional reference to a engine type. This does not require a * corresponding call to ENGINE_free as it also releases a structural * reference. */ int ENGINE_finish(ENGINE *e); /* * The following functions handle keys that are stored in some secondary * location, handled by the engine. The storage may be on a card or * whatever. */ EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data); EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data); int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); /* * This returns a pointer for the current ENGINE structure that is (by * default) performing any RSA operations. The value returned is an * incremented reference, so it should be free'd (ENGINE_finish) before it is * discarded. */ ENGINE *ENGINE_get_default_RSA(void); /* Same for the other "methods" */ ENGINE *ENGINE_get_default_DSA(void); ENGINE *ENGINE_get_default_ECDH(void); ENGINE *ENGINE_get_default_ECDSA(void); ENGINE *ENGINE_get_default_DH(void); ENGINE *ENGINE_get_default_RAND(void); /* * These functions can be used to get a functional reference to perform * ciphering or digesting corresponding to "nid". */ ENGINE *ENGINE_get_cipher_engine(int nid); ENGINE *ENGINE_get_digest_engine(int nid); ENGINE *ENGINE_get_pkey_meth_engine(int nid); ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); /* * This sets a new default ENGINE structure for performing RSA operations. If * the result is non-zero (success) then the ENGINE structure will have had * its reference count up'd so the caller should still free their own * reference 'e'. */ int ENGINE_set_default_RSA(ENGINE *e); int ENGINE_set_default_string(ENGINE *e, const char *def_list); /* Same for the other "methods" */ int ENGINE_set_default_DSA(ENGINE *e); int ENGINE_set_default_ECDH(ENGINE *e); int ENGINE_set_default_ECDSA(ENGINE *e); int ENGINE_set_default_DH(ENGINE *e); int ENGINE_set_default_RAND(ENGINE *e); int ENGINE_set_default_ciphers(ENGINE *e); int ENGINE_set_default_digests(ENGINE *e); int ENGINE_set_default_pkey_meths(ENGINE *e); int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); /* * The combination "set" - the flags are bitwise "OR"d from the * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" * function, this function can result in unnecessary static linkage. If your * application requires only specific functionality, consider using more * selective functions. */ int ENGINE_set_default(ENGINE *e, unsigned int flags); void ENGINE_add_conf_module(void); /* Deprecated functions ... */ /* int ENGINE_clear_defaults(void); */ /**************************/ /* DYNAMIC ENGINE SUPPORT */ /**************************/ /* Binary/behaviour compatibility levels */ # define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 /* * Binary versions older than this are too old for us (whether we're a loader * or a loadee) */ # define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 /* * When compiling an ENGINE entirely as an external shared library, loadable * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' * structure type provides the calling application's (or library's) error * functionality and memory management function pointers to the loaded * library. These should be used/set in the loaded library code so that the * loading application's 'state' will be used/changed in all operations. The * 'static_state' pointer allows the loaded library to know if it shares the * same static data as the calling application (or library), and thus whether * these callbacks need to be set or not. */ typedef void *(*dyn_MEM_malloc_cb) (size_t); typedef void *(*dyn_MEM_realloc_cb) (void *, size_t); typedef void (*dyn_MEM_free_cb) (void *); typedef struct st_dynamic_MEM_fns { dyn_MEM_malloc_cb malloc_cb; dyn_MEM_realloc_cb realloc_cb; dyn_MEM_free_cb free_cb; } dynamic_MEM_fns; /* * FIXME: Perhaps the memory and locking code (crypto.h) should declare and * use these types so we (and any other dependant code) can simplify a bit?? */ typedef void (*dyn_lock_locking_cb) (int, int, const char *, int); typedef int (*dyn_lock_add_lock_cb) (int *, int, int, const char *, int); typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb) (const char *, int); typedef void (*dyn_dynlock_lock_cb) (int, struct CRYPTO_dynlock_value *, const char *, int); typedef void (*dyn_dynlock_destroy_cb) (struct CRYPTO_dynlock_value *, const char *, int); typedef struct st_dynamic_LOCK_fns { dyn_lock_locking_cb lock_locking_cb; dyn_lock_add_lock_cb lock_add_lock_cb; dyn_dynlock_create_cb dynlock_create_cb; dyn_dynlock_lock_cb dynlock_lock_cb; dyn_dynlock_destroy_cb dynlock_destroy_cb; } dynamic_LOCK_fns; /* The top-level structure */ typedef struct st_dynamic_fns { void *static_state; const ERR_FNS *err_fns; const CRYPTO_EX_DATA_IMPL *ex_data_fns; dynamic_MEM_fns mem_fns; dynamic_LOCK_fns lock_fns; } dynamic_fns; /* * The version checking function should be of this prototype. NB: The * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading * code. If this function returns zero, it indicates a (potential) version * incompatibility and the loaded library doesn't believe it can proceed. * Otherwise, the returned value is the (latest) version supported by the * loading library. The loader may still decide that the loaded code's * version is unsatisfactory and could veto the load. The function is * expected to be implemented with the symbol name "v_check", and a default * implementation can be fully instantiated with * IMPLEMENT_DYNAMIC_CHECK_FN(). */ typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); # define IMPLEMENT_DYNAMIC_CHECK_FN() \ OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ return 0; } /* * This function is passed the ENGINE structure to initialise with its own * function and command settings. It should not adjust the structural or * functional reference counts. If this function returns zero, (a) the load * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto * the structure, and (c) the shared library will be unloaded. So * implementations should do their own internal cleanup in failure * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, * represents the ENGINE id that the loader is looking for. If this is NULL, * the shared library can choose to return failure or to initialise a * 'default' ENGINE. If non-NULL, the shared library must initialise only an * ENGINE matching the passed 'id'. The function is expected to be * implemented with the symbol name "bind_engine". A standard implementation * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter * 'fn' is a callback function that populates the ENGINE structure and * returns an int value (zero for failure). 'fn' should have prototype; * [static] int fn(ENGINE *e, const char *id); */ typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, const dynamic_fns *fns); # define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \ return 0; \ CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ return 0; \ if(!ERR_set_implementation(fns->err_fns)) return 0; \ skip_cbs: \ if(!fn(e,id)) return 0; \ return 1; } /* * If the loading application (or library) and the loaded ENGINE library * share the same static data (eg. they're both dynamically linked to the * same libcrypto.so) we need a way to avoid trying to set system callbacks - * this would fail, and for the same reason that it's unnecessary to try. If * the loaded ENGINE has (or gets from through the loader) its own copy of * the libcrypto static data, we will need to set the callbacks. The easiest * way to detect this is to have a function that returns a pointer to some * static data and let the loading application and loaded ENGINE compare * their respective values. */ void *ENGINE_get_static_state(void); # if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) void ENGINE_setup_bsd_cryptodev(void); # endif /* BEGIN ERROR CODES */ /* * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_ENGINE_strings(void); /* Error codes for the ENGINE functions. */ /* Function codes. */ # define ENGINE_F_DYNAMIC_CTRL 180 # define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 # define ENGINE_F_DYNAMIC_LOAD 182 # define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 # define ENGINE_F_ENGINE_ADD 105 # define ENGINE_F_ENGINE_BY_ID 106 # define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 # define ENGINE_F_ENGINE_CTRL 142 # define ENGINE_F_ENGINE_CTRL_CMD 178 # define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 # define ENGINE_F_ENGINE_FINISH 107 # define ENGINE_F_ENGINE_FREE_UTIL 108 # define ENGINE_F_ENGINE_GET_CIPHER 185 # define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 # define ENGINE_F_ENGINE_GET_DIGEST 186 # define ENGINE_F_ENGINE_GET_NEXT 115 # define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 # define ENGINE_F_ENGINE_GET_PKEY_METH 192 # define ENGINE_F_ENGINE_GET_PREV 116 # define ENGINE_F_ENGINE_INIT 119 # define ENGINE_F_ENGINE_LIST_ADD 120 # define ENGINE_F_ENGINE_LIST_REMOVE 121 # define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 # define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 # define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 # define ENGINE_F_ENGINE_NEW 122 # define ENGINE_F_ENGINE_REMOVE 123 # define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 # define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 # define ENGINE_F_ENGINE_SET_ID 129 # define ENGINE_F_ENGINE_SET_NAME 130 # define ENGINE_F_ENGINE_TABLE_REGISTER 184 # define ENGINE_F_ENGINE_UNLOAD_KEY 152 # define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 # define ENGINE_F_ENGINE_UP_REF 190 # define ENGINE_F_INT_CTRL_HELPER 172 # define ENGINE_F_INT_ENGINE_CONFIGURE 188 # define ENGINE_F_INT_ENGINE_MODULE_INIT 187 # define ENGINE_F_LOG_MESSAGE 141 /* Reason codes. */ # define ENGINE_R_ALREADY_LOADED 100 # define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 # define ENGINE_R_CMD_NOT_EXECUTABLE 134 # define ENGINE_R_COMMAND_TAKES_INPUT 135 # define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 # define ENGINE_R_CONFLICTING_ENGINE_ID 103 # define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 # define ENGINE_R_DH_NOT_IMPLEMENTED 139 # define ENGINE_R_DSA_NOT_IMPLEMENTED 140 # define ENGINE_R_DSO_FAILURE 104 # define ENGINE_R_DSO_NOT_FOUND 132 # define ENGINE_R_ENGINES_SECTION_ERROR 148 # define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 # define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 # define ENGINE_R_ENGINE_SECTION_ERROR 149 # define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 # define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 # define ENGINE_R_FINISH_FAILED 106 # define ENGINE_R_GET_HANDLE_FAILED 107 # define ENGINE_R_ID_OR_NAME_MISSING 108 # define ENGINE_R_INIT_FAILED 109 # define ENGINE_R_INTERNAL_LIST_ERROR 110 # define ENGINE_R_INVALID_ARGUMENT 143 # define ENGINE_R_INVALID_CMD_NAME 137 # define ENGINE_R_INVALID_CMD_NUMBER 138 # define ENGINE_R_INVALID_INIT_VALUE 151 # define ENGINE_R_INVALID_STRING 150 # define ENGINE_R_NOT_INITIALISED 117 # define ENGINE_R_NOT_LOADED 112 # define ENGINE_R_NO_CONTROL_FUNCTION 120 # define ENGINE_R_NO_INDEX 144 # define ENGINE_R_NO_LOAD_FUNCTION 125 # define ENGINE_R_NO_REFERENCE 130 # define ENGINE_R_NO_SUCH_ENGINE 116 # define ENGINE_R_NO_UNLOAD_FUNCTION 126 # define ENGINE_R_PROVIDE_PARAMETERS 113 # define ENGINE_R_RSA_NOT_IMPLEMENTED 141 # define ENGINE_R_UNIMPLEMENTED_CIPHER 146 # define ENGINE_R_UNIMPLEMENTED_DIGEST 147 # define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 # define ENGINE_R_VERSION_INCOMPATIBILITY 145 #ifdef __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
<?xml version='1.0' encoding='utf-8'?> <section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code"> <num>7-1304.07</num> <heading>Standard of proof.</heading> <para> <num>(a)</num> <text>If the petition was filed pursuant to <cite path="§7-1303.04|(a)">§ 7-1303.04(a)</cite>, the parent or guardian, or his or her counsel if so represented, shall present evidence which shows beyond a reasonable doubt that the respondent is not competent to refuse commitment.</text> </para> <para> <num>(b)</num> <text>If the petition was filed pursuant to <cite path="§7-1303.04|(b-1)">§ 7-1303.04(b-1)</cite>, the District shall present clear and convincing evidence that shows that the respondent is likely to cause injury to others as a result of an intellectual disability if allowed to remain at liberty.</text> </para> <annotations> <annotation doc="D.C. Law 2-137" type="History" path="§407">Mar. 3, 1979, D.C. Law 2-137, § 407, 25 DCR 5094</annotation> <annotation doc="D.C. Law 14-199" type="History">Oct. 17, 2002, D.C. Law 14-199, § 2(m), 49 DCR 7647</annotation> <annotation doc="D.C. Law 19-169" type="History">Sept. 26, 2012, D.C. Law 19-169, § 17(x), 59 DCR 5567</annotation> <annotation type="Editor's Notes">Section 35 of <cite doc="D.C. Law 19-169">D.C. Law 19-169</cite> provided that no provision of the act shall impair any right or obligation existing under law.</annotation> <annotation type="Emergency Legislation">For temporary (90 day) amendment of section, see § 2(m) of Civil Commitment of Citizens with Mental Retardation Legislative Review Emergency Amendment Act of 2002 (D.C. Act 14-454, July 23, 2002, 49 DCR 8096).</annotation> <annotation type="Emergency Legislation">For temporary (90 day) amendment of section, see § 2(m) of Civil Commitment of Citizens with Mental Retardation Emergency Amendment Act of 2002 (D.C. Act 14-383, June 12, 2002, 49 DCR 5701).</annotation> <annotation type="Effect of Amendments">The 2012 amendment by <cite doc="D.C. Law 19-169">D.C. Law 19-169</cite> substituted “an intellectual disability” for “mental retardation” in (b).</annotation> <annotation type="Effect of Amendments"><cite doc="D.C. Law 14-199">D.C. Law 14-199</cite> designated subsec. (a), and in that subsection, substituted “<cite path="§7-1303.04|(a)">§ 7-1303.04(a)</cite>” for “<cite path="§7-1303.04">§ 7-1303.04</cite>”; and added subsec. (b).</annotation> <annotation type="Prior Codifications">1973 Ed., § 6-1674.</annotation> <annotation type="Prior Codifications">1981 Ed., § 6-1947.</annotation> </annotations> </section>
{ "pile_set_name": "Github" }
cheats = 1 cheat0_desc = "Infinite Lives" cheat0_code = "Z 8 30609 0 0" cheat0_enable = false
{ "pile_set_name": "Github" }
-- fkey2.test -- -- execsql { -- CREATE TABLE t1(x REFERENCES v); -- CREATE VIEW v AS SELECT * FROM t1; -- } CREATE TABLE t1(x REFERENCES v); CREATE VIEW v AS SELECT * FROM t1;
{ "pile_set_name": "Github" }
@charset "utf-8"; .module_category_title { border:1px solid #DDDDDD; margin:10px 5px 5px 0; padding:3px 3px 3px 9px; } .module_list { margin:0 0 5px 10px; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Hibernate Validator, declare and validate application constraints ~ ~ License: Apache License, Version 2.0 ~ See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. --> <validation-config xmlns="https://jakarta.ee/xml/ns/validation/configuration" xsi:schemaLocation="https://jakarta.ee/xml/ns/validation/configuration https://jakarta.ee/xml/ns/validation/validation-configuration-3.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0"> </validation-confi>
{ "pile_set_name": "Github" }
package aws import ( "fmt" "log" "reflect" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceAwsNetworkInterfaceSGAttachment() *schema.Resource { return &schema.Resource{ Create: resourceAwsNetworkInterfaceSGAttachmentCreate, Read: resourceAwsNetworkInterfaceSGAttachmentRead, Delete: resourceAwsNetworkInterfaceSGAttachmentDelete, Schema: map[string]*schema.Schema{ "security_group_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, "network_interface_id": { Type: schema.TypeString, Required: true, ForceNew: true, }, }, } } func resourceAwsNetworkInterfaceSGAttachmentCreate(d *schema.ResourceData, meta interface{}) error { mk := "network_interface_sg_attachment_" + d.Get("network_interface_id").(string) awsMutexKV.Lock(mk) defer awsMutexKV.Unlock(mk) sgID := d.Get("security_group_id").(string) interfaceID := d.Get("network_interface_id").(string) conn := meta.(*AWSClient).ec2conn // Fetch the network interface we will be working with. iface, err := fetchNetworkInterface(conn, interfaceID) if err != nil { return err } // Add the security group to the network interface. log.Printf("[DEBUG] Attaching security group %s to network interface ID %s", sgID, interfaceID) if sgExistsInENI(sgID, iface) { return fmt.Errorf("security group %s already attached to interface ID %s", sgID, *iface.NetworkInterfaceId) } var groupIDs []string for _, v := range iface.Groups { groupIDs = append(groupIDs, *v.GroupId) } groupIDs = append(groupIDs, sgID) params := &ec2.ModifyNetworkInterfaceAttributeInput{ NetworkInterfaceId: iface.NetworkInterfaceId, Groups: aws.StringSlice(groupIDs), } _, err = conn.ModifyNetworkInterfaceAttribute(params) if err != nil { return err } log.Printf("[DEBUG] Successful attachment of security group %s to network interface ID %s", sgID, interfaceID) return resourceAwsNetworkInterfaceSGAttachmentRead(d, meta) } func resourceAwsNetworkInterfaceSGAttachmentRead(d *schema.ResourceData, meta interface{}) error { sgID := d.Get("security_group_id").(string) interfaceID := d.Get("network_interface_id").(string) log.Printf("[DEBUG] Checking association of security group %s to network interface ID %s", sgID, interfaceID) conn := meta.(*AWSClient).ec2conn iface, err := fetchNetworkInterface(conn, interfaceID) if isAWSErr(err, "InvalidNetworkInterfaceID.NotFound", "") { log.Printf("[WARN] EC2 Network Interface (%s) not found, removing from state", interfaceID) d.SetId("") return nil } if err != nil { return err } if sgExistsInENI(sgID, iface) { d.SetId(fmt.Sprintf("%s_%s", sgID, interfaceID)) } else { // The association does not exist when it should, taint this resource. log.Printf("[WARN] Security group %s not associated with network interface ID %s, tainting", sgID, interfaceID) d.SetId("") } return nil } func resourceAwsNetworkInterfaceSGAttachmentDelete(d *schema.ResourceData, meta interface{}) error { mk := "network_interface_sg_attachment_" + d.Get("network_interface_id").(string) awsMutexKV.Lock(mk) defer awsMutexKV.Unlock(mk) sgID := d.Get("security_group_id").(string) interfaceID := d.Get("network_interface_id").(string) log.Printf("[DEBUG] Removing security group %s from interface ID %s", sgID, interfaceID) conn := meta.(*AWSClient).ec2conn iface, err := fetchNetworkInterface(conn, interfaceID) if isAWSErr(err, "InvalidNetworkInterfaceID.NotFound", "") { return nil } if err != nil { return err } return delSGFromENI(conn, sgID, iface) } // fetchNetworkInterface is a utility function used by Read and Delete to fetch // the full ENI details for a specific interface ID. func fetchNetworkInterface(conn *ec2.EC2, ifaceID string) (*ec2.NetworkInterface, error) { log.Printf("[DEBUG] Fetching information for interface ID %s", ifaceID) dniParams := &ec2.DescribeNetworkInterfacesInput{ NetworkInterfaceIds: aws.StringSlice([]string{ifaceID}), } dniResp, err := conn.DescribeNetworkInterfaces(dniParams) if err != nil { return nil, err } return dniResp.NetworkInterfaces[0], nil } func delSGFromENI(conn *ec2.EC2, sgID string, iface *ec2.NetworkInterface) error { old := iface.Groups var new []*string for _, v := range iface.Groups { if *v.GroupId == sgID { continue } new = append(new, v.GroupId) } if reflect.DeepEqual(old, new) { // The interface already didn't have the security group, nothing to do return nil } params := &ec2.ModifyNetworkInterfaceAttributeInput{ NetworkInterfaceId: iface.NetworkInterfaceId, Groups: new, } _, err := conn.ModifyNetworkInterfaceAttribute(params) if isAWSErr(err, "InvalidNetworkInterfaceID.NotFound", "") { return nil } return err } // sgExistsInENI is a utility function that can be used to quickly check to // see if a security group exists in an *ec2.NetworkInterface. func sgExistsInENI(sgID string, iface *ec2.NetworkInterface) bool { for _, v := range iface.Groups { if *v.GroupId == sgID { return true } } return false }
{ "pile_set_name": "Github" }
import { Background } from './index' export const flipY: Background.Definition = function (img) { // d d // q q const canvas = document.createElement('canvas') const width = img.width const height = img.height canvas.width = width canvas.height = height * 2 const ctx = canvas.getContext('2d')! // top image ctx.drawImage(img, 0, 0, width, height) // flipped bottom image ctx.translate(0, 2 * height) ctx.scale(1, -1) ctx.drawImage(img, 0, 0, width, height) return canvas }
{ "pile_set_name": "Github" }
<?php /** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ namespace Twilio\Rest\Preview\TrustedComms\Business; use Twilio\Exceptions\TwilioException; use Twilio\InstanceResource; use Twilio\Values; use Twilio\Version; /** * PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected]. */ class InsightsInstance extends InstanceResource { /** * Initialize the InsightsInstance * * @param Version $version Version that contains the resource * @param mixed[] $payload The response payload * @param string $businessSid A string that uniquely identifies this Business. */ public function __construct(Version $version, array $payload, string $businessSid) { parent::__construct($version); $this->solution = ['businessSid' => $businessSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $name) { if (\array_key_exists($name, $this->properties)) { return $this->properties[$name]; } if (\property_exists($this, '_' . $name)) { $method = 'get' . \ucfirst($name); return $this->$method(); } throw new TwilioException('Unknown property: ' . $name); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.InsightsInstance]'; } }
{ "pile_set_name": "Github" }
package formatter import ( "fmt" "sync" units "github.com/docker/go-units" ) const ( winOSType = "windows" defaultStatsTableFormat = "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}" winDefaultStatsTableFormat = "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}" containerHeader = "CONTAINER" cpuPercHeader = "CPU %" netIOHeader = "NET I/O" blockIOHeader = "BLOCK I/O" memPercHeader = "MEM %" // Used only on Linux winMemUseHeader = "PRIV WORKING SET" // Used only on Windows memUseHeader = "MEM USAGE / LIMIT" // Used only on Linux pidsHeader = "PIDS" // Used only on Linux ) // StatsEntry represents represents the statistics data collected from a container type StatsEntry struct { Container string Name string ID string CPUPercentage float64 Memory float64 // On Windows this is the private working set MemoryLimit float64 // Not used on Windows MemoryPercentage float64 // Not used on Windows NetworkRx float64 NetworkTx float64 BlockRead float64 BlockWrite float64 PidsCurrent uint64 // Not used on Windows IsInvalid bool } // ContainerStats represents an entity to store containers statistics synchronously type ContainerStats struct { mutex sync.Mutex StatsEntry err error } // GetError returns the container statistics error. // This is used to determine whether the statistics are valid or not func (cs *ContainerStats) GetError() error { cs.mutex.Lock() defer cs.mutex.Unlock() return cs.err } // SetErrorAndReset zeroes all the container statistics and store the error. // It is used when receiving time out error during statistics collecting to reduce lock overhead func (cs *ContainerStats) SetErrorAndReset(err error) { cs.mutex.Lock() defer cs.mutex.Unlock() cs.CPUPercentage = 0 cs.Memory = 0 cs.MemoryPercentage = 0 cs.MemoryLimit = 0 cs.NetworkRx = 0 cs.NetworkTx = 0 cs.BlockRead = 0 cs.BlockWrite = 0 cs.PidsCurrent = 0 cs.err = err cs.IsInvalid = true } // SetError sets container statistics error func (cs *ContainerStats) SetError(err error) { cs.mutex.Lock() defer cs.mutex.Unlock() cs.err = err if err != nil { cs.IsInvalid = true } } // SetStatistics set the container statistics func (cs *ContainerStats) SetStatistics(s StatsEntry) { cs.mutex.Lock() defer cs.mutex.Unlock() s.Container = cs.Container cs.StatsEntry = s } // GetStatistics returns container statistics with other meta data such as the container name func (cs *ContainerStats) GetStatistics() StatsEntry { cs.mutex.Lock() defer cs.mutex.Unlock() return cs.StatsEntry } // NewStatsFormat returns a format for rendering an CStatsContext func NewStatsFormat(source, osType string) Format { if source == TableFormatKey { if osType == winOSType { return Format(winDefaultStatsTableFormat) } return Format(defaultStatsTableFormat) } return Format(source) } // NewContainerStats returns a new ContainerStats entity and sets in it the given name func NewContainerStats(container, osType string) *ContainerStats { return &ContainerStats{ StatsEntry: StatsEntry{Container: container}, } } // ContainerStatsWrite renders the context for a list of containers statistics func ContainerStatsWrite(ctx Context, containerStats []StatsEntry, osType string) error { render := func(format func(subContext subContext) error) error { for _, cstats := range containerStats { containerStatsCtx := &containerStatsContext{ s: cstats, os: osType, } if err := format(containerStatsCtx); err != nil { return err } } return nil } memUsage := memUseHeader if osType == winOSType { memUsage = winMemUseHeader } containerStatsCtx := containerStatsContext{} containerStatsCtx.header = map[string]string{ "Container": containerHeader, "Name": nameHeader, "ID": containerIDHeader, "CPUPerc": cpuPercHeader, "MemUsage": memUsage, "MemPerc": memPercHeader, "NetIO": netIOHeader, "BlockIO": blockIOHeader, "PIDs": pidsHeader, } containerStatsCtx.os = osType return ctx.Write(&containerStatsCtx, render) } type containerStatsContext struct { HeaderContext s StatsEntry os string } func (c *containerStatsContext) MarshalJSON() ([]byte, error) { return marshalJSON(c) } func (c *containerStatsContext) Container() string { return c.s.Container } func (c *containerStatsContext) Name() string { if len(c.s.Name) > 1 { return c.s.Name[1:] } return "--" } func (c *containerStatsContext) ID() string { return c.s.ID } func (c *containerStatsContext) CPUPerc() string { if c.s.IsInvalid { return fmt.Sprintf("--") } return fmt.Sprintf("%.2f%%", c.s.CPUPercentage) } func (c *containerStatsContext) MemUsage() string { if c.s.IsInvalid { return fmt.Sprintf("-- / --") } if c.os == winOSType { return fmt.Sprintf("%s", units.BytesSize(c.s.Memory)) } return fmt.Sprintf("%s / %s", units.BytesSize(c.s.Memory), units.BytesSize(c.s.MemoryLimit)) } func (c *containerStatsContext) MemPerc() string { if c.s.IsInvalid || c.os == winOSType { return fmt.Sprintf("--") } return fmt.Sprintf("%.2f%%", c.s.MemoryPercentage) } func (c *containerStatsContext) NetIO() string { if c.s.IsInvalid { return fmt.Sprintf("--") } return fmt.Sprintf("%s / %s", units.HumanSizeWithPrecision(c.s.NetworkRx, 3), units.HumanSizeWithPrecision(c.s.NetworkTx, 3)) } func (c *containerStatsContext) BlockIO() string { if c.s.IsInvalid { return fmt.Sprintf("--") } return fmt.Sprintf("%s / %s", units.HumanSizeWithPrecision(c.s.BlockRead, 3), units.HumanSizeWithPrecision(c.s.BlockWrite, 3)) } func (c *containerStatsContext) PIDs() string { if c.s.IsInvalid || c.os == winOSType { return fmt.Sprintf("--") } return fmt.Sprintf("%d", c.s.PidsCurrent) }
{ "pile_set_name": "Github" }
66ca063b9b7ffb1e36db3fb71de7ef0a0b22782dabafa1b7f6ba89dd7931bcb4491920cf77970c3ebc2f14741ce21c3c28e7c8ae57ad14d6c2dc54676f853177
{ "pile_set_name": "Github" }
/* * Driver for NXP PN533 NFC Chip - I2C transport layer * * Copyright (C) 2011 Instituto Nokia de Tecnologia * Copyright (C) 2012-2013 Tieto Poland * Copyright (C) 2016 HALE electronic * * * 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, see <http://www.gnu.org/licenses/>. */ #include <linux/device.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/i2c.h> #include <linux/nfc.h> #include <linux/netdevice.h> #include <linux/interrupt.h> #include <net/nfc/nfc.h> #include "pn533.h" #define VERSION "0.1" #define PN533_I2C_DRIVER_NAME "pn533_i2c" struct pn533_i2c_phy { struct i2c_client *i2c_dev; struct pn533 *priv; bool aborted; int hard_fault; /* * < 0 if hardware error occurred (e.g. i2c err) * and prevents normal operation. */ }; static int pn533_i2c_send_ack(struct pn533 *dev, gfp_t flags) { struct pn533_i2c_phy *phy = dev->phy; struct i2c_client *client = phy->i2c_dev; static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00}; /* spec 6.2.1.3: Preamble, SoPC (2), ACK Code (2), Postamble */ int rc; rc = i2c_master_send(client, ack, 6); return rc; } static int pn533_i2c_send_frame(struct pn533 *dev, struct sk_buff *out) { struct pn533_i2c_phy *phy = dev->phy; struct i2c_client *client = phy->i2c_dev; int rc; if (phy->hard_fault != 0) return phy->hard_fault; if (phy->priv == NULL) phy->priv = dev; phy->aborted = false; print_hex_dump_debug("PN533_i2c TX: ", DUMP_PREFIX_NONE, 16, 1, out->data, out->len, false); rc = i2c_master_send(client, out->data, out->len); if (rc == -EREMOTEIO) { /* Retry, chip was in power down */ usleep_range(6000, 10000); rc = i2c_master_send(client, out->data, out->len); } if (rc >= 0) { if (rc != out->len) rc = -EREMOTEIO; else rc = 0; } return rc; } static void pn533_i2c_abort_cmd(struct pn533 *dev, gfp_t flags) { struct pn533_i2c_phy *phy = dev->phy; phy->aborted = true; /* An ack will cancel the last issued command */ pn533_i2c_send_ack(dev, flags); /* schedule cmd_complete_work to finish current command execution */ pn533_recv_frame(phy->priv, NULL, -ENOENT); } static int pn533_i2c_read(struct pn533_i2c_phy *phy, struct sk_buff **skb) { struct i2c_client *client = phy->i2c_dev; int len = PN533_EXT_FRAME_HEADER_LEN + PN533_STD_FRAME_MAX_PAYLOAD_LEN + PN533_STD_FRAME_TAIL_LEN + 1; int r; *skb = alloc_skb(len, GFP_KERNEL); if (*skb == NULL) return -ENOMEM; r = i2c_master_recv(client, skb_put(*skb, len), len); if (r != len) { nfc_err(&client->dev, "cannot read. r=%d len=%d\n", r, len); kfree_skb(*skb); return -EREMOTEIO; } if (!((*skb)->data[0] & 0x01)) { nfc_err(&client->dev, "READY flag not set"); kfree_skb(*skb); return -EBUSY; } /* remove READY byte */ skb_pull(*skb, 1); /* trim to frame size */ skb_trim(*skb, phy->priv->ops->rx_frame_size((*skb)->data)); return 0; } static irqreturn_t pn533_i2c_irq_thread_fn(int irq, void *data) { struct pn533_i2c_phy *phy = data; struct i2c_client *client; struct sk_buff *skb = NULL; int r; if (!phy || irq != phy->i2c_dev->irq) { WARN_ON_ONCE(1); return IRQ_NONE; } client = phy->i2c_dev; dev_dbg(&client->dev, "IRQ\n"); if (phy->hard_fault != 0) return IRQ_HANDLED; r = pn533_i2c_read(phy, &skb); if (r == -EREMOTEIO) { phy->hard_fault = r; pn533_recv_frame(phy->priv, NULL, -EREMOTEIO); return IRQ_HANDLED; } else if ((r == -ENOMEM) || (r == -EBADMSG) || (r == -EBUSY)) { return IRQ_HANDLED; } if (!phy->aborted) pn533_recv_frame(phy->priv, skb, 0); return IRQ_HANDLED; } static struct pn533_phy_ops i2c_phy_ops = { .send_frame = pn533_i2c_send_frame, .send_ack = pn533_i2c_send_ack, .abort_cmd = pn533_i2c_abort_cmd, }; static int pn533_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pn533_i2c_phy *phy; struct pn533 *priv; int r = 0; dev_dbg(&client->dev, "%s\n", __func__); dev_dbg(&client->dev, "IRQ: %d\n", client->irq); if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { nfc_err(&client->dev, "Need I2C_FUNC_I2C\n"); return -ENODEV; } phy = devm_kzalloc(&client->dev, sizeof(struct pn533_i2c_phy), GFP_KERNEL); if (!phy) return -ENOMEM; phy->i2c_dev = client; i2c_set_clientdata(client, phy); priv = pn533_register_device(PN533_DEVICE_PN532, PN533_NO_TYPE_B_PROTOCOLS, PN533_PROTO_REQ_ACK_RESP, phy, &i2c_phy_ops, NULL, &phy->i2c_dev->dev, &client->dev); if (IS_ERR(priv)) { r = PTR_ERR(priv); return r; } phy->priv = priv; r = request_threaded_irq(client->irq, NULL, pn533_i2c_irq_thread_fn, IRQF_TRIGGER_FALLING | IRQF_SHARED | IRQF_ONESHOT, PN533_I2C_DRIVER_NAME, phy); if (r < 0) { nfc_err(&client->dev, "Unable to register IRQ handler\n"); goto irq_rqst_err; } r = pn533_finalize_setup(priv); if (r) goto fn_setup_err; return 0; fn_setup_err: free_irq(client->irq, phy); irq_rqst_err: pn533_unregister_device(phy->priv); return r; } static int pn533_i2c_remove(struct i2c_client *client) { struct pn533_i2c_phy *phy = i2c_get_clientdata(client); dev_dbg(&client->dev, "%s\n", __func__); free_irq(client->irq, phy); pn533_unregister_device(phy->priv); return 0; } static const struct of_device_id of_pn533_i2c_match[] = { { .compatible = "nxp,pn533-i2c", }, { .compatible = "nxp,pn532-i2c", }, {}, }; MODULE_DEVICE_TABLE(of, of_pn533_i2c_match); static const struct i2c_device_id pn533_i2c_id_table[] = { { PN533_I2C_DRIVER_NAME, 0 }, {} }; MODULE_DEVICE_TABLE(i2c, pn533_i2c_id_table); static struct i2c_driver pn533_i2c_driver = { .driver = { .name = PN533_I2C_DRIVER_NAME, .owner = THIS_MODULE, .of_match_table = of_match_ptr(of_pn533_i2c_match), }, .probe = pn533_i2c_probe, .id_table = pn533_i2c_id_table, .remove = pn533_i2c_remove, }; module_i2c_driver(pn533_i2c_driver); MODULE_AUTHOR("Michael Thalmeier <[email protected]>"); MODULE_DESCRIPTION("PN533 I2C driver ver " VERSION); MODULE_VERSION(VERSION); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
# - Find SDL2 # Find the SDL2 headers and libraries # # SDL2::SDL2 - Imported target to use for building a library # SDL2::SDL2main - Imported interface target to use if you want SDL and SDLmain. # SDL2_FOUND - True if SDL2 was found. # SDL2_DYNAMIC - If we found a DLL version of SDL (meaning you might want to copy a DLL from SDL2::SDL2) # # Original Author: # 2015 Ryan Pavlik <[email protected]> <[email protected]> # # Copyright Sensics, Inc. 2015. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) # Set up architectures (for windows) and prefixes (for mingw builds) if(WIN32) if(MINGW) include(MinGWSearchPathExtras OPTIONAL) if(MINGWSEARCH_TARGET_TRIPLE) set(SDL2_PREFIX ${MINGWSEARCH_TARGET_TRIPLE}) endif() endif() if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(SDL2_LIB_PATH_SUFFIX lib/x64) if(NOT MSVC AND NOT SDL2_PREFIX) set(SDL2_PREFIX x86_64-w64-mingw32) endif() else() set(SDL2_LIB_PATH_SUFFIX lib/x86) if(NOT MSVC AND NOT SDL2_PREFIX) set(SDL2_PREFIX i686-w64-mingw32) endif() endif() endif() if(SDL2_PREFIX) set(SDL2_ORIGPREFIXPATH ${CMAKE_PREFIX_PATH}) if(SDL2_ROOT_DIR) list(APPEND CMAKE_PREFIX_PATH "${SDL2_ROOT_DIR}") endif() if(CMAKE_PREFIX_PATH) foreach(_prefix ${CMAKE_PREFIX_PATH}) list(APPEND CMAKE_PREFIX_PATH "${_prefix}/${SDL2_PREFIX}") endforeach() endif() if(MINGWSEARCH_PREFIXES) list(APPEND CMAKE_PREFIX_PATH ${MINGWSEARCH_PREFIXES}) endif() endif() # Invoke pkgconfig for hints find_package(PkgConfig QUIET) set(SDL2_INCLUDE_HINTS) set(SDL2_LIB_HINTS) if(PKG_CONFIG_FOUND) pkg_search_module(SDL2PC QUIET sdl2) if(SDL2PC_INCLUDE_DIRS) set(SDL2_INCLUDE_HINTS ${SDL2PC_INCLUDE_DIRS}) endif() if(SDL2PC_LIBRARY_DIRS) set(SDL2_LIB_HINTS ${SDL2PC_LIBRARY_DIRS}) endif() endif() include(FindPackageHandleStandardArgs) find_library(SDL2_LIBRARY NAMES SDL2 HINTS ${SDL2_LIB_HINTS} PATHS ${SDL2_ROOT_DIR} ENV SDL2DIR PATH_SUFFIXES lib SDL2 ${SDL2_LIB_PATH_SUFFIX}) set(_sdl2_framework FALSE) # Some special-casing if we've found/been given a framework. # Handles whether we're given the library inside the framework or the framework itself. if(APPLE AND "${SDL2_LIBRARY}" MATCHES "(/[^/]+)*.framework(/.*)?$") set(_sdl2_framework TRUE) set(SDL2_FRAMEWORK "${SDL2_LIBRARY}") # Move up in the directory tree as required to get the framework directory. while("${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework(/.*)$" AND NOT "${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") get_filename_component(SDL2_FRAMEWORK "${SDL2_FRAMEWORK}" DIRECTORY) endwhile() if("${SDL2_FRAMEWORK}" MATCHES "(/[^/]+)*.framework$") set(SDL2_FRAMEWORK_NAME ${CMAKE_MATCH_1}) # If we found a framework, do a search for the header ahead of time that will be more likely to get the framework header. find_path(SDL2_INCLUDE_DIR NAMES SDL_haptic.h # this file was introduced with SDL2 HINTS "${SDL2_FRAMEWORK}/Headers/") else() # For some reason we couldn't get the framework directory itself. # Shouldn't happen, but might if something is weird. unset(SDL2_FRAMEWORK) endif() endif() find_path(SDL2_INCLUDE_DIR NAMES SDL_haptic.h # this file was introduced with SDL2 HINTS ${SDL2_INCLUDE_HINTS} PATHS ${SDL2_ROOT_DIR} ENV SDL2DIR PATH_SUFFIXES include include/sdl2 include/SDL2 SDL2) if(WIN32 AND SDL2_LIBRARY) find_file(SDL2_RUNTIME_LIBRARY NAMES SDL2.dll libSDL2.dll HINTS ${SDL2_LIB_HINTS} PATHS ${SDL2_ROOT_DIR} ENV SDL2DIR PATH_SUFFIXES bin lib ${SDL2_LIB_PATH_SUFFIX}) endif() if(WIN32 OR ANDROID OR IOS OR (APPLE AND NOT _sdl2_framework)) set(SDL2_EXTRA_REQUIRED SDL2_SDLMAIN_LIBRARY) find_library(SDL2_SDLMAIN_LIBRARY NAMES SDL2main PATHS ${SDL2_ROOT_DIR} ENV SDL2DIR PATH_SUFFIXES lib ${SDL2_LIB_PATH_SUFFIX}) endif() if(MINGW AND NOT SDL2PC_FOUND) find_library(SDL2_MINGW_LIBRARY mingw32) find_library(SDL2_MWINDOWS_LIBRARY mwindows) endif() if(SDL2_PREFIX) # Restore things the way they used to be. set(CMAKE_PREFIX_PATH ${SDL2_ORIGPREFIXPATH}) endif() # handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SDL2 DEFAULT_MSG SDL2_LIBRARY SDL2_INCLUDE_DIR ${SDL2_EXTRA_REQUIRED}) if(SDL2_FOUND) if(NOT TARGET SDL2::SDL2) # Create SDL2::SDL2 if(WIN32 AND SDL2_RUNTIME_LIBRARY) set(SDL2_DYNAMIC TRUE) add_library(SDL2::SDL2 SHARED IMPORTED) set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "${SDL2_LIBRARY}" IMPORTED_LOCATION "${SDL2_RUNTIME_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" ) else() add_library(SDL2::SDL2 UNKNOWN IMPORTED) if(SDL2_FRAMEWORK AND SDL2_FRAMEWORK_NAME) # Handle the case that SDL2 is a framework and we were able to decompose it above. set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LOCATION "${SDL2_FRAMEWORK}/${SDL2_FRAMEWORK_NAME}") elseif(_sdl2_framework AND SDL2_LIBRARY MATCHES "(/[^/]+)*.framework$") # Handle the case that SDL2 is a framework and SDL_LIBRARY is just the framework itself. # This takes the basename of the framework, without the extension, # and sets it (as a child of the framework) as the imported location for the target. # This is the library symlink inside of the framework. set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LOCATION "${SDL2_LIBRARY}/${CMAKE_MATCH_1}") else() # Handle non-frameworks (including non-Mac), as well as the case that we're given the library inside of the framework set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LOCATION "${SDL2_LIBRARY}") endif() set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" ) endif() if(APPLE) # Need Cocoa here, is always a framework find_library(SDL2_COCOA_LIBRARY Cocoa) list(APPEND SDL2_EXTRA_REQUIRED SDL2_COCOA_LIBRARY) if(SDL2_COCOA_LIBRARY) set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES ${SDL2_COCOA_LIBRARY}) endif() endif() # Compute what to do with SDL2main set(SDL2MAIN_LIBRARIES SDL2::SDL2) add_library(SDL2::SDL2main INTERFACE IMPORTED) if(SDL2_SDLMAIN_LIBRARY) add_library(SDL2::SDL2main_real STATIC IMPORTED) set_target_properties(SDL2::SDL2main_real PROPERTIES IMPORTED_LOCATION "${SDL2_SDLMAIN_LIBRARY}") set(SDL2MAIN_LIBRARIES SDL2::SDL2main_real ${SDL2MAIN_LIBRARIES}) endif() if(MINGW) # MinGW requires some additional libraries to appear earlier in the link line. if(SDL2PC_LIBRARIES) # Use pkgconfig-suggested extra libraries if available. list(REMOVE_ITEM SDL2PC_LIBRARIES SDL2main SDL2) set(SDL2MAIN_LIBRARIES ${SDL2PC_LIBRARIES} ${SDL2MAIN_LIBRARIES}) else() # fall back to extra libraries specified in pkg-config in # an official binary distro of SDL2 for MinGW I downloaded if(SDL2_MINGW_LIBRARY) set(SDL2MAIN_LIBRARIES ${SDL2_MINGW_LIBRARY} ${SDL2MAIN_LIBRARIES}) endif() if(SDL2_MWINDOWS_LIBRARY) set(SDL2MAIN_LIBRARIES ${SDL2_MWINDOWS_LIBRARY} ${SDL2MAIN_LIBRARIES}) endif() endif() set_target_properties(SDL2::SDL2main PROPERTIES INTERFACE_COMPILE_DEFINITIONS "main=SDL_main") endif() set_target_properties(SDL2::SDL2main PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2MAIN_LIBRARIES}") endif() mark_as_advanced(SDL2_ROOT_DIR) endif() mark_as_advanced(SDL2_LIBRARY SDL2_RUNTIME_LIBRARY SDL2_INCLUDE_DIR SDL2_SDLMAIN_LIBRARY SDL2_COCOA_LIBRARY SDL2_MINGW_LIBRARY SDL2_MWINDOWS_LIBRARY)
{ "pile_set_name": "Github" }
import React from 'react'; import TestRenderer from 'react-test-renderer'; import 'jest-styled-components'; import { shallow, mount } from 'enzyme'; import OptionsHelper from '../../utils/helpers/options-helper/options-helper'; import MessageStyle from './message.style'; import Message from './message.component'; import { assertStyleMatch, carbonThemesJestTable } from '../../__spec_helper__/test-utils'; import { baseTheme, classicTheme } from '../../style/themes'; import IconButton from '../icon-button'; function render(props) { return TestRenderer.create(<MessageStyle { ...props }>Message</MessageStyle>); } describe('Message', () => { describe.each(carbonThemesJestTable)( 'rendered', (themeName, theme) => { let wrapper; beforeEach(() => { wrapper = shallow(<Message theme={ theme }>Message</Message>); }); it(`should have the expected style for ${themeName}`, () => { assertStyleMatch({ position: 'relative', display: 'flex', justifyContent: 'flex-start', alignContent: 'center' }, mount(<Message theme={ theme }>Message</Message>)); }); it('does not render the close icon when onDismiss prop is not provided', () => { const closeIcon = wrapper.find(IconButton); expect(closeIcon.exists()).toEqual(false); }); it('renders the close icon when onDismiss function is provided', () => { const onDismiss = jest.fn(); wrapper = mount( <Message onDismiss={ onDismiss } theme={ theme } > Message </Message> ); const closeIcon = wrapper.find(IconButton).first(); expect(closeIcon.exists()).toEqual(true); }); it('passes the id prop to the root component', () => { wrapper.setProps({ id: 'message-id' }); expect(wrapper.find(MessageStyle).props().id).toEqual('message-id'); }); } ); describe('when transparent prop is set to true', () => { it('should render the message without the border', () => { const wrapper = render({ transparent: true, type: 'info' }); assertStyleMatch( { border: 'none' }, wrapper.toJSON() ); }); }); describe('when transparent prop is not passed', () => { it('should render the message with border in a proper color and a white background', () => { OptionsHelper.messages.forEach((messageType) => { assertStyleMatch({ border: `1px solid ${baseTheme.colors[messageType]}` }, mount(<Message variant={ messageType }>Message</Message>)); }); }); }); describe('when in classic mode', () => { describe('when rendered', () => { it('should match the snapshot', () => { OptionsHelper.colors.forEach((variant) => { const wrapper = render({ theme: classicTheme, variant }); expect(wrapper).toMatchSnapshot(); }); }); }); describe('when transparent prop is set to true', () => { it('should render the message without the border and with background transparent', () => { const wrapper = render({ transparent: true, theme: classicTheme, variant: 'info' }); assertStyleMatch( { border: 'none', backgroundColor: 'transparent' }, wrapper.toJSON() ); }); }); describe('when border prop is set to false', () => { it('should render the message without a border', () => { const wrapper = render({ border: false, theme: classicTheme, variant: 'info' }); assertStyleMatch( { border: 'none' }, wrapper.toJSON() ); }); }); describe('when roundedCorners prop is set to false', () => { it('should apply no border-radius style', () => { const wrapper = render({ roundedCorners: false, theme: classicTheme, variant: 'info' }); assertStyleMatch( { borderRadius: '0px' }, wrapper.toJSON() ); }); }); describe('when roundedCorners prop is not passed', () => { it('should apply proper border-radius style', () => { const wrapper = render({ theme: classicTheme, type: 'info' }); assertStyleMatch( { borderRadius: '3px' }, wrapper.toJSON() ); }); }); }); describe('when closeIcon is not provided', () => { let wrapper, onDismissCallback; beforeEach(() => { onDismissCallback = jest.fn(); wrapper = shallow( <Message theme={ classicTheme } roundedCorners={ false } variant='info' onDismiss={ onDismissCallback } > Message </Message> ); }); describe('does not render', () => { it('when onDismiss prop is not provided', () => { wrapper.setProps({ onDismiss: null }); expect(wrapper.find(IconButton).exists()).toBeFalsy(); }); it('when showCloseIcon is false', () => { wrapper.setProps({ showCloseIcon: false }); expect(wrapper.find(IconButton).exists()).toBeFalsy(); }); }); describe('does render', () => { it('when onDismiss and showCloseIcon props are provided', () => { expect(wrapper.find(IconButton).exists()).toBeTruthy(); expect(onDismissCallback).toBeCalledTimes(0); }); }); }); describe('when closeIcon is provided', () => { let wrapper, onDismissCallback; beforeEach(() => { onDismissCallback = jest.fn(); wrapper = shallow( <Message theme={ classicTheme } roundedCorners={ false } variant='info' onDismiss={ onDismissCallback } showCloseIcon > Message </Message> ); }); describe('does not render', () => { it('when onDismiss prop is not provided', () => { wrapper.setProps({ onDismiss: null }); expect(wrapper.find(IconButton).exists()).toBeFalsy(); }); it('when showCloseIcon is false', () => { wrapper.setProps({ showCloseIcon: false }); expect(wrapper.find(IconButton).exists()).toBeFalsy(); }); }); describe('does render', () => { it('when onDismiss and showCloseIcon props are provided', () => { expect(wrapper.find(IconButton).exists()).toBeTruthy(); expect(onDismissCallback).toBeCalledTimes(0); }); }); }); });
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.net; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; import java.net.UnknownHostException; /** * This abstract class defines methods to create sockets. It can be subclassed * to create specific socket types with additional socket-level functionality. */ public abstract class SocketFactory { private static SocketFactory defaultFactory; /** * Gets the default socket factory of the system which can be used to create * new sockets without creating a subclass of this factory. * * @return the system default socket factory. */ public static synchronized SocketFactory getDefault() { if (defaultFactory == null) { defaultFactory = new DefaultSocketFactory(); } return defaultFactory; } /** * Creates a new {@code SocketFactory} instance. */ protected SocketFactory() { } /** * Creates a new socket which is not connected to any remote host. This * method has to be overridden by a subclass otherwise a {@code * SocketException} is thrown. * * @return the created unconnected socket. * @throws IOException * if an error occurs while creating a new socket. */ public Socket createSocket() throws IOException { // follow RI's behavior throw new SocketException("Unconnected sockets not implemented"); } /** * Creates a new socket which is connected to the remote host specified by * the parameters {@code host} and {@code port}. The socket is bound to any * available local address and port. * * @param host * the remote host address the socket has to be connected to. * @param port * the port number of the remote host at which the socket is * connected. * @return the created connected socket. * @throws IOException * if an error occurs while creating a new socket. * @throws UnknownHostException * if the specified host is unknown or the IP address could not * be resolved. */ public abstract Socket createSocket(String host, int port) throws IOException, UnknownHostException; /** * Creates a new socket which is connected to the remote host specified by * the parameters {@code host} and {@code port}. The socket is bound to the * local network interface specified by the InetAddress {@code localHost} on * port {@code localPort}. * * @param host * the remote host address the socket has to be connected to. * @param port * the port number of the remote host at which the socket is * connected. * @param localHost * the local host address the socket is bound to. * @param localPort * the port number of the local host at which the socket is * bound. * @return the created connected socket. * @throws IOException * if an error occurs while creating a new socket. * @throws UnknownHostException * if the specified host is unknown or the IP address could not * be resolved. */ public abstract Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException; /** * Creates a new socket which is connected to the remote host specified by * the InetAddress {@code host}. The socket is bound to any available local * address and port. * * @param host * the host address the socket has to be connected to. * @param port * the port number of the remote host at which the socket is * connected. * @return the created connected socket. * @throws IOException * if an error occurs while creating a new socket. */ public abstract Socket createSocket(InetAddress host, int port) throws IOException; /** * Creates a new socket which is connected to the remote host specified by * the InetAddress {@code address}. The socket is bound to the local network * interface specified by the InetAddress {@code localHost} on port {@code * localPort}. * * @param address * the remote host address the socket has to be connected to. * @param port * the port number of the remote host at which the socket is * connected. * @param localAddress * the local host address the socket is bound to. * @param localPort * the port number of the local host at which the socket is * bound. * @return the created connected socket. * @throws IOException * if an error occurs while creating a new socket. */ public abstract Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException; }
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright (c) 2013, Salesforce.com, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 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 Salesforce.com nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ package com.salesforce.phoenix.parse; import java.sql.SQLException; import java.text.Format; import java.util.List; import com.salesforce.phoenix.compile.StatementContext; import com.salesforce.phoenix.expression.Expression; import com.salesforce.phoenix.expression.LiteralExpression; import com.salesforce.phoenix.expression.function.FunctionArgumentType; import com.salesforce.phoenix.expression.function.FunctionExpression; import com.salesforce.phoenix.expression.function.ToCharFunction; import com.salesforce.phoenix.schema.PDataType; public class ToCharParseNode extends FunctionParseNode { public ToCharParseNode(String name, List<ParseNode> children, BuiltInFunctionInfo info) { super(name, children, info); } @Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter; FunctionArgumentType type; if (dataType.isCoercibleTo(PDataType.TIMESTAMP)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PDataType.DECIMAL)) { if (formatString == null) formatString = context.getNumberFormat(); formatter = FunctionArgumentType.NUMERIC.getFormatter(formatString); type = FunctionArgumentType.NUMERIC; } else { throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Numeric and temporal types are supported."); } return new ToCharFunction(children, type, formatString, formatter); } }
{ "pile_set_name": "Github" }
# Copyright (C) 2015-2018 Regents of the University of California # # 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. """ The leader script (of the leader/worker pair) for running jobs. """ from __future__ import absolute_import from __future__ import division from future import standard_library standard_library.install_aliases() from builtins import str from builtins import object from builtins import super import base64 import logging import time import os import pickle import sys import glob from toil.lib.humanize import bytes2human from toil import resolveEntryPoint try: from toil.cwl.cwltoil import CWL_INTERNAL_JOBS except ImportError: # CWL extra not installed CWL_INTERNAL_JOBS = () from toil.batchSystems.abstractBatchSystem import BatchJobExitReason from toil.jobStores.abstractJobStore import NoSuchJobException from toil.batchSystems import DeadlockException from toil.lib.throttle import LocalThrottle from toil.provisioners.clusterScaler import ScalerThread from toil.serviceManager import ServiceManager from toil.statsAndLogging import StatsAndLogging from toil.job import JobNode, ServiceJobNode from toil.toilState import ToilState from toil.common import Toil, ToilMetrics import enlighten logger = logging.getLogger( __name__ ) ############################################################################### # Implementation Notes # # Multiple predecessors: # There is special-case handling for jobs with multiple predecessors as a # performance optimization. This minimize number of expensive loads of # jobGraphs from jobStores. However, this special case could be unnecessary. # The jobGraph is loaded to update predecessorsFinished, in # _checkSuccessorReadyToRunMultiplePredecessors, however it doesn't appear to # write the jobGraph back the jobStore. Thus predecessorsFinished may really # be leader state and could moved out of the jobGraph. This would make this # special-cases handling unnecessary and simplify the leader. # Issue #2136 ############################################################################### #################################################### # Exception thrown by the Leader class when one or more jobs fails #################################################### class FailedJobsException(Exception): def __init__(self, jobStoreLocator, failedJobs, jobStore): self.msg = "The job store '%s' contains %i failed jobs" % (jobStoreLocator, len(failedJobs)) try: self.msg += ": %s" % ", ".join((str(failedJob) for failedJob in failedJobs)) for jobNode in failedJobs: job = jobStore.load(jobNode.jobStoreID) if job.logJobStoreFileID: with job.getLogFileHandle(jobStore) as fH: self.msg += "\n" + StatsAndLogging.formatLogStream(fH, jobNode) # catch failures to prepare more complex details and only return the basics except: logger.exception('Exception when compiling information about failed jobs') self.msg = self.msg.rstrip('\n') super().__init__() self.jobStoreLocator = jobStoreLocator self.numberOfFailedJobs = len(failedJobs) def __str__(self): """ Stringify the exception, including the message. """ return self.msg #################################################### ##Following class represents the leader #################################################### class Leader(object): """ Class that encapsulates the logic of the leader. """ def __init__(self, config, batchSystem, provisioner, jobStore, rootJob, jobCache=None): """ :param toil.common.Config config: :param toil.batchSystems.abstractBatchSystem.AbstractBatchSystem batchSystem: :param toil.provisioners.abstractProvisioner.AbstractProvisioner provisioner :param toil.jobStores.abstractJobStore.AbstractJobStore jobStore: :param toil.jobGraph.JobGraph rootJob If jobCache is passed, it must be a dict from job ID to pre-existing JobGraph objects. Jobs will be loaded from the cache (which can be downloaded from the jobStore in a batch) during the construction of the ToilState object. """ # Object containing parameters for the run self.config = config # The job store self.jobStore = jobStore self.jobStoreLocator = config.jobStore # Get a snap shot of the current state of the jobs in the jobStore self.toilState = ToilState(jobStore, rootJob, jobCache=jobCache) logger.debug("Found %s jobs to start and %i jobs with successors to run", len(self.toilState.updatedJobs), len(self.toilState.successorCounts)) # Batch system self.batchSystem = batchSystem assert len(self.batchSystem.getIssuedBatchJobIDs()) == 0 # Batch system must start with no active jobs! logger.debug("Checked batch system has no running jobs and no updated jobs") # Map of batch system IDs to IssuedJob tuples self.jobBatchSystemIDToIssuedJob = {} # Number of preemptible jobs currently being run by batch system self.preemptableJobsIssued = 0 # Tracking the number service jobs issued, # this is used limit the number of services issued to the batch system self.serviceJobsIssued = 0 self.serviceJobsToBeIssued = [] # A queue of service jobs that await scheduling #Equivalents for service jobs to be run on preemptible nodes self.preemptableServiceJobsIssued = 0 self.preemptableServiceJobsToBeIssued = [] # Timing of the jobGraph rescuing method self.timeSinceJobsLastRescued = None # Hash to store number of times a job is lost by the batch system, # used to decide if to reissue an apparently missing job self.reissueMissingJobs_missingHash = {} # Class used to create/destroy nodes in the cluster, may be None if # using a statically defined cluster self.provisioner = provisioner # Create cluster scaling thread if the provisioner is not None self.clusterScaler = None if self.provisioner is not None and len(self.provisioner.nodeTypes) > 0: self.clusterScaler = ScalerThread(self.provisioner, self, self.config) # A service manager thread to start and terminate services self.serviceManager = ServiceManager(jobStore, self.toilState) # A thread to manage the aggregation of statistics and logging from the run self.statsAndLogging = StatsAndLogging(self.jobStore, self.config) # Set used to monitor deadlocked jobs self.potentialDeadlockedJobs = set() self.potentialDeadlockTime = 0 # A dashboard that runs on the leader node in AWS clusters to track the state # of the cluster self.toilMetrics = None # internal jobs we should not expose at top level debugging self.debugJobNames = ("CWLJob", "CWLWorkflow", "CWLScatter", "CWLGather", "ResolveIndirect") self.deadlockThrottler = LocalThrottle(self.config.deadlockCheckInterval) self.statusThrottler = LocalThrottle(self.config.statusWait) # For fancy console UI, we use an Enlighten counter that displays running / queued jobs # This gets filled in in run() and updated periodically. self.progress_overall = None # Also count failed/killed jobs self.progress_failed = None # Assign colors for them self.GOOD_COLOR = (0, 60, 108) self.BAD_COLOR = (253, 199, 0) # And set a format that shows failures self.PROGRESS_BAR_FORMAT = ('{desc}{desc_pad}{percentage:3.0f}%|{bar}| {count:{len_total}d}/{total:d} ' '({count_1:d} failures) [{elapsed}<{eta}, {rate:.2f}{unit_pad}{unit}/s]') # TODO: No way to set background color on the terminal for the bar. def run(self): """ This runs the leader process to issue and manage jobs. :raises: toil.leader.FailedJobsException if failed jobs remain after running. :return: The return value of the root job's run function. :rtype: Any """ with enlighten.get_manager(stream=sys.stderr, enabled=not self.config.disableProgress) as manager: # Set up the fancy console UI if desirable self.progress_overall = manager.counter(total=0, desc='Workflow Progress', unit='jobs', color=self.GOOD_COLOR, bar_format=self.PROGRESS_BAR_FORMAT) self.progress_failed = self.progress_overall.add_subcounter(self.BAD_COLOR) # Start the stats/logging aggregation thread self.statsAndLogging.start() if self.config.metrics: self.toilMetrics = ToilMetrics(provisioner=self.provisioner) try: # Start service manager thread self.serviceManager.start() try: # Create cluster scaling processes if not None if self.clusterScaler is not None: self.clusterScaler.start() try: # Run the main loop self.innerLoop() finally: if self.clusterScaler is not None: logger.debug('Waiting for workers to shutdown.') startTime = time.time() self.clusterScaler.shutdown() logger.debug('Worker shutdown complete in %s seconds.', time.time() - startTime) finally: # Ensure service manager thread is properly shutdown self.serviceManager.shutdown() finally: # Ensure the stats and logging thread is properly shutdown self.statsAndLogging.shutdown() if self.toilMetrics: self.toilMetrics.shutdown() # Filter the failed jobs self.toilState.totalFailedJobs = [j for j in self.toilState.totalFailedJobs if self.jobStore.exists(j.jobStoreID)] try: self.create_status_sentinel_file(self.toilState.totalFailedJobs) except IOError as e: logger.debug('Error from importFile with hardlink=True: {}'.format(e)) logger.info("Finished toil run %s" % ("successfully." if not self.toilState.totalFailedJobs \ else ("with %s failed jobs." % len(self.toilState.totalFailedJobs)))) if len(self.toilState.totalFailedJobs): logger.info("Failed jobs at end of the run: %s", ' '.join(str(job) for job in self.toilState.totalFailedJobs)) # Cleanup if len(self.toilState.totalFailedJobs) > 0: raise FailedJobsException(self.config.jobStore, self.toilState.totalFailedJobs, self.jobStore) return self.jobStore.getRootJobReturnValue() def create_status_sentinel_file(self, fail): """Create a file in the jobstore indicating failure or success.""" logName = 'failed.log' if fail else 'succeeded.log' localLog = os.path.join(os.getcwd(), logName) open(localLog, 'w').close() self.jobStore.importFile('file://' + localLog, logName, hardlink=True) if os.path.exists(localLog): # Bandaid for Jenkins tests failing stochastically and unexplainably. os.remove(localLog) def _handledFailedSuccessor(self, jobNode, jobGraph, successorJobStoreID): """Deal with the successor having failed. Return True if there are still active successors. Return False if all successors have failed and the job is queued to run to handle the failed successors.""" logger.debug("Successor job: %s of job: %s has failed """ "predecessors", jobNode, jobGraph) # Add the job to the set having failed successors self.toilState.hasFailedSuccessors.add(jobGraph.jobStoreID) # Reduce active successor count and remove the successor as an active successor of the job self.toilState.successorCounts[jobGraph.jobStoreID] -= 1 assert self.toilState.successorCounts[jobGraph.jobStoreID] >= 0 self.toilState.successorJobStoreIDToPredecessorJobs[successorJobStoreID].remove(jobGraph) if len(self.toilState.successorJobStoreIDToPredecessorJobs[successorJobStoreID]) == 0: self.toilState.successorJobStoreIDToPredecessorJobs.pop(successorJobStoreID) # If the job now has no active successors add to active jobs # so it can be processed as a job with failed successors if self.toilState.successorCounts[jobGraph.jobStoreID] == 0: logger.debug("Job: %s has no successors to run " "and some are failed, adding to list of jobs " "with failed successors", jobGraph) self.toilState.successorCounts.pop(jobGraph.jobStoreID) if jobGraph.jobStoreID not in self.toilState.updatedJobs: self.toilState.updatedJobs[jobGraph.jobStoreID] = (jobGraph, 0) return False def _checkSuccessorReadyToRunMultiplePredecessors(self, jobGraph, jobNode, successorJobStoreID): """Handle the special cases of checking if a successor job is ready to run when there are multiple predecessors""" # See implementation note at the top of this file for discussion of multiple predecessors logger.debug("Successor job: %s of job: %s has multiple " "predecessors", jobNode, jobGraph) # Get the successor job graph, which is caches if successorJobStoreID not in self.toilState.jobsToBeScheduledWithMultiplePredecessors: self.toilState.jobsToBeScheduledWithMultiplePredecessors[successorJobStoreID] = self.jobStore.load(successorJobStoreID) successorJobGraph = self.toilState.jobsToBeScheduledWithMultiplePredecessors[successorJobStoreID] # Add the jobGraph as a finished predecessor to the successor successorJobGraph.predecessorsFinished.add(jobGraph.jobStoreID) # If the successor is in the set of successors of failed jobs if successorJobStoreID in self.toilState.failedSuccessors: if not self._handledFailedSuccessor(jobNode, jobGraph, successorJobStoreID): return False # If the successor job's predecessors have all not all completed then # ignore the jobGraph as is not yet ready to run assert len(successorJobGraph.predecessorsFinished) <= successorJobGraph.predecessorNumber if len(successorJobGraph.predecessorsFinished) < successorJobGraph.predecessorNumber: return False else: # Remove the successor job from the cache self.toilState.jobsToBeScheduledWithMultiplePredecessors.pop(successorJobStoreID) return True def _makeJobSuccessorReadyToRun(self, jobGraph, jobNode): """make a successor job ready to run, returning False if they should not yet be run""" successorJobStoreID = jobNode.jobStoreID #Build map from successor to predecessors. if successorJobStoreID not in self.toilState.successorJobStoreIDToPredecessorJobs: self.toilState.successorJobStoreIDToPredecessorJobs[successorJobStoreID] = [] self.toilState.successorJobStoreIDToPredecessorJobs[successorJobStoreID].append(jobGraph) if jobNode.predecessorNumber > 1: return self._checkSuccessorReadyToRunMultiplePredecessors(jobGraph, jobNode, successorJobStoreID) else: return True def _runJobSuccessors(self, jobGraph): assert len(jobGraph.stack[-1]) > 0 logger.debug("Job: %s has %i successors to schedule", jobGraph.jobStoreID, len(jobGraph.stack[-1])) #Record the number of successors that must be completed before #the jobGraph can be considered again assert jobGraph.jobStoreID not in self.toilState.successorCounts, 'Attempted to schedule successors of the same job twice!' self.toilState.successorCounts[jobGraph.jobStoreID] = len(jobGraph.stack[-1]) # For each successor schedule if all predecessors have been completed successors = [] for jobNode in jobGraph.stack[-1]: if self._makeJobSuccessorReadyToRun(jobGraph, jobNode): successors.append(jobNode) self.issueJobs(successors) def _processFailedSuccessors(self, jobGraph): """Some of the jobs successors failed then either fail the job or restart it if it has retries left and is a checkpoint job""" if jobGraph.jobStoreID in self.toilState.servicesIssued: # The job has services running, signal for them to be killed # once they are killed then the jobGraph will be re-added to # the updatedJobs dict and then scheduled to be removed logger.debug("Telling job: %s to terminate its services due to successor failure", jobGraph.jobStoreID) self.serviceManager.killServices(self.toilState.servicesIssued[jobGraph.jobStoreID], error=True) elif jobGraph.jobStoreID in self.toilState.successorCounts: # The job has non-service jobs running wait for them to finish # the job will be re-added to the updated jobs when these jobs # are done logger.debug("Job %s with ID: %s with failed successors still has successor jobs running", jobGraph, jobGraph.jobStoreID) elif jobGraph.checkpoint is not None and jobGraph.remainingRetryCount > 1: # If the job is a checkpoint and has remaining retries then reissue it. # The logic behind using > 1 rather than > 0 here: Since this job has # been tried once (without decreasing its retry count as the job # itself was successful), and its subtree failed, it shouldn't be retried # unless it has more than 1 try. logger.warning('Job: %s is being restarted as a checkpoint after the total ' 'failure of jobs in its subtree.', jobGraph.jobStoreID) self.issueJob(JobNode.fromJobGraph(jobGraph)) else: # Mark it totally failed logger.debug("Job %s is being processed as completely failed", jobGraph.jobStoreID) self.processTotallyFailedJob(jobGraph) def _processReadyJob(self, jobGraph, resultStatus): logger.debug('Updating status of job %s with ID %s: with result status: %s', jobGraph, jobGraph.jobStoreID, resultStatus) if jobGraph in self.serviceManager.jobGraphsWithServicesBeingStarted: # This stops a job with services being issued by the serviceManager from # being considered further in this loop. This catch is necessary because # the job's service's can fail while being issued, causing the job to be # added to updated jobs. logger.debug("Got a job to update which is still owned by the service " "manager: %s", jobGraph.jobStoreID) elif jobGraph.jobStoreID in self.toilState.hasFailedSuccessors: self._processFailedSuccessors(jobGraph) elif jobGraph.command is not None or resultStatus != 0: # The jobGraph has a command it must be run before any successors. # Similarly, if the job previously failed we rerun it, even if it doesn't have a # command to run, to eliminate any parts of the stack now completed. isServiceJob = jobGraph.jobStoreID in self.toilState.serviceJobStoreIDToPredecessorJob # If the job has run out of retries or is a service job whose error flag has # been indicated, fail the job. if (jobGraph.remainingRetryCount == 0 or isServiceJob and not self.jobStore.fileExists(jobGraph.errorJobStoreID)): self.processTotallyFailedJob(jobGraph) logger.warning("Job %s with ID %s is completely failed", jobGraph, jobGraph.jobStoreID) else: # Otherwise try the job again self.issueJob(JobNode.fromJobGraph(jobGraph)) elif len(jobGraph.services) > 0: # the job has services to run, which have not been started, start them # Build a map from the service jobs to the job and a map # of the services created for the job assert jobGraph.jobStoreID not in self.toilState.servicesIssued self.toilState.servicesIssued[jobGraph.jobStoreID] = {} for serviceJobList in jobGraph.services: for serviceTuple in serviceJobList: serviceID = serviceTuple.jobStoreID assert serviceID not in self.toilState.serviceJobStoreIDToPredecessorJob self.toilState.serviceJobStoreIDToPredecessorJob[serviceID] = jobGraph self.toilState.servicesIssued[jobGraph.jobStoreID][serviceID] = serviceTuple # Use the service manager to start the services self.serviceManager.scheduleServices(jobGraph) logger.debug("Giving job: %s to service manager to schedule its jobs", jobGraph.jobStoreID) elif len(jobGraph.stack) > 0: # There are exist successors to run self._runJobSuccessors(jobGraph) elif jobGraph.jobStoreID in self.toilState.servicesIssued: logger.debug("Telling job: %s to terminate its services due to the " "successful completion of its successor jobs", jobGraph) self.serviceManager.killServices(self.toilState.servicesIssued[jobGraph.jobStoreID], error=False) else: #There are no remaining tasks to schedule within the jobGraph, but #we schedule it anyway to allow it to be deleted. Remove the job #TODO: An alternative would be simple delete it here and add it to the #list of jobs to process, or (better) to create an asynchronous #process that deletes jobs and then feeds them back into the set #of jobs to be processed if jobGraph.remainingRetryCount > 0: self.issueJob(JobNode.fromJobGraph(jobGraph)) logger.debug("Job: %s is empty, we are scheduling to clean it up", jobGraph.jobStoreID) else: self.processTotallyFailedJob(jobGraph) logger.warning("Job: %s is empty but completely failed - something is very wrong", jobGraph.jobStoreID) def _processReadyJobs(self): """Process jobs that are ready to be scheduled/have successors to schedule""" logger.debug('Built the jobs list, currently have %i jobs to update and %i jobs issued', len(self.toilState.updatedJobs), self.getNumberOfJobsIssued()) updatedJobs = self.toilState.updatedJobs # The updated jobs to consider below self.toilState.updatedJobs = {} # Resetting the collection for the next group of updated jobs for jobGraph, resultStatus in updatedJobs.values(): self._processReadyJob(jobGraph, resultStatus) def _startServiceJobs(self): """Start any service jobs available from the service manager""" self.issueQueingServiceJobs() while True: serviceJob = self.serviceManager.getServiceJobsToStart(0) # Stop trying to get jobs when function returns None if serviceJob is None: break logger.debug('Launching service job: %s', serviceJob) self.issueServiceJob(serviceJob) def _processJobsWithRunningServices(self): """Get jobs whose services have started""" while True: jobGraph = self.serviceManager.getJobGraphWhoseServicesAreRunning(0) if jobGraph is None: # Stop trying to get jobs when function returns None break logger.debug('Job: %s has established its services.', jobGraph.jobStoreID) jobGraph.services = [] if jobGraph.jobStoreID not in self.toilState.updatedJobs: self.toilState.updatedJobs[jobGraph.jobStoreID] = (jobGraph, 0) def _gatherUpdatedJobs(self, updatedJobTuple): """Gather any new, updated jobGraph from the batch system""" jobID, exitStatus, exitReason, wallTime = ( updatedJobTuple.jobID, updatedJobTuple.exitStatus, updatedJobTuple.exitReason, updatedJobTuple.wallTime) # easy, track different state try: updatedJob = self.jobBatchSystemIDToIssuedJob[jobID] except KeyError: logger.warning("A result seems to already have been processed " "for job %s", jobID) else: if exitStatus == 0: cur_logger = (logger.debug if str(updatedJob.jobName).startswith(CWL_INTERNAL_JOBS) else logger.info) cur_logger('Job ended: %s', updatedJob) else: logger.warning('Job failed with exit value %i: %s', exitStatus, updatedJob) if self.toilMetrics: self.toilMetrics.logCompletedJob(updatedJob) self.processFinishedJob(jobID, exitStatus, wallTime=wallTime, exitReason=exitReason) def _processLostJobs(self): """Process jobs that have gone awry""" # In the case that there is nothing happening (no updated jobs to # gather for rescueJobsFrequency seconds) check if there are any jobs # that have run too long (see self.reissueOverLongJobs) or which have # gone missing from the batch system (see self.reissueMissingJobs) if ((time.time() - self.timeSinceJobsLastRescued) >= self.config.rescueJobsFrequency): # We only rescue jobs every N seconds, and when we have apparently # exhausted the current jobGraph supply self.reissueOverLongJobs() hasNoMissingJobs = self.reissueMissingJobs() if hasNoMissingJobs: self.timeSinceJobsLastRescued = time.time() else: # This means we'll try again in a minute, providing things are quiet self.timeSinceJobsLastRescued += 60 def innerLoop(self): """ The main loop for processing jobs by the leader. """ self.timeSinceJobsLastRescued = time.time() while self.toilState.updatedJobs or \ self.getNumberOfJobsIssued() or \ self.serviceManager.jobsIssuedToServiceManager: if self.toilState.updatedJobs: self._processReadyJobs() # deal with service-related jobs self._startServiceJobs() self._processJobsWithRunningServices() # check in with the batch system updatedJobTuple = self.batchSystem.getUpdatedBatchJob(maxWait=2) if updatedJobTuple is not None: self._gatherUpdatedJobs(updatedJobTuple) else: # If nothing is happening, see if any jobs have wandered off self._processLostJobs() if self.deadlockThrottler.throttle(wait=False): # Nothing happened this round and it's been long # enough since we last checked. Check for deadlocks. self.checkForDeadlocks() # Check on the associated threads and exit if a failure is detected self.statsAndLogging.check() self.serviceManager.check() # the cluster scaler object will only be instantiated if autoscaling is enabled if self.clusterScaler is not None: self.clusterScaler.check() if self.statusThrottler.throttle(wait=False): # Time to tell the user how things are going self._reportWorkflowStatus() # Make sure to keep elapsed time and ETA up to date even when no jobs come in self.progress_overall.update(incr=0) logger.debug("Finished the main loop: no jobs left to run.") # Consistency check the toil state assert self.toilState.updatedJobs == {} assert self.toilState.successorCounts == {} assert self.toilState.successorJobStoreIDToPredecessorJobs == {} assert self.toilState.serviceJobStoreIDToPredecessorJob == {} assert self.toilState.servicesIssued == {} # assert self.toilState.jobsToBeScheduledWithMultiplePredecessors # These are not properly emptied yet # assert self.toilState.hasFailedSuccessors == set() # These are not properly emptied yet def checkForDeadlocks(self): """ Checks if the system is deadlocked running service jobs. """ totalRunningJobs = len(self.batchSystem.getRunningBatchJobIDs()) totalServicesIssued = self.serviceJobsIssued + self.preemptableServiceJobsIssued # If there are no updated jobs and at least some jobs running if totalServicesIssued >= totalRunningJobs and totalRunningJobs > 0: serviceJobs = [x for x in list(self.jobBatchSystemIDToIssuedJob.keys()) if isinstance(self.jobBatchSystemIDToIssuedJob[x], ServiceJobNode)] runningServiceJobs = set([x for x in serviceJobs if self.serviceManager.isRunning(self.jobBatchSystemIDToIssuedJob[x])]) assert len(runningServiceJobs) <= totalRunningJobs # If all the running jobs are active services then we have a potential deadlock if len(runningServiceJobs) == totalRunningJobs: # There could be trouble; we are 100% services. # See if the batch system has anything to say for itself about its failure to run our jobs. message = self.batchSystem.getSchedulingStatusMessage() if message is not None: # Prepend something explaining the message message = "The batch system reports: {}".format(message) else: # Use a generic message if none is available message = "Cluster may be too small." # See if this is a new potential deadlock if self.potentialDeadlockedJobs != runningServiceJobs: logger.warning(("Potential deadlock detected! All %s running jobs are service jobs, " "with no normal jobs to use them! %s"), totalRunningJobs, message) self.potentialDeadlockedJobs = runningServiceJobs self.potentialDeadlockTime = time.time() else: # We wait self.config.deadlockWait seconds before declaring the system deadlocked stuckFor = time.time() - self.potentialDeadlockTime if stuckFor >= self.config.deadlockWait: logger.error("We have been deadlocked since %s on these service jobs: %s", self.potentialDeadlockTime, self.potentialDeadlockedJobs) raise DeadlockException(("The workflow is service deadlocked - all %d running jobs " "have been the same active services for at least %s seconds") % (totalRunningJobs, self.config.deadlockWait)) else: # Complain that we are still stuck. waitingNormalJobs = self.getNumberOfJobsIssued() - totalServicesIssued logger.warning(("Potentially deadlocked for %.0f seconds. Waiting at most %.0f more seconds " "for any of %d issued non-service jobs to schedule and start. %s"), stuckFor, self.config.deadlockWait - stuckFor, waitingNormalJobs, message) else: # We have observed non-service jobs running, so reset the potential deadlock if len(self.potentialDeadlockedJobs) > 0: # We thought we had a deadlock. Tell the user it is fixed. logger.warning("Potential deadlock has been resolved; non-service jobs are now running.") self.potentialDeadlockedJobs = set() self.potentialDeadlockTime = 0 else: # We have observed non-service jobs running, so reset the potential deadlock. # TODO: deduplicate with above if len(self.potentialDeadlockedJobs) > 0: # We thought we had a deadlock. Tell the user it is fixed. logger.warning("Potential deadlock has been resolved; non-service jobs are now running.") self.potentialDeadlockedJobs = set() self.potentialDeadlockTime = 0 def issueJob(self, jobNode): """Add a job to the queue of jobs.""" workerCommand = [resolveEntryPoint('_toil_worker'), jobNode.jobName, self.jobStoreLocator, jobNode.jobStoreID] for context in self.batchSystem.getWorkerContexts(): # For each context manager hook the batch system wants to run in # the worker, serialize and send it. workerCommand.append('--context') workerCommand.append(base64.b64encode(pickle.dumps(context)).decode('utf-8')) jobNode.command = ' '.join(workerCommand) # jobBatchSystemID is an int that is an incremented counter for each job jobBatchSystemID = self.batchSystem.issueBatchJob(jobNode) self.jobBatchSystemIDToIssuedJob[jobBatchSystemID] = jobNode if jobNode.preemptable: # len(jobBatchSystemIDToIssuedJob) should always be greater than or equal to preemptableJobsIssued, # so increment this value after the job is added to the issuedJob dict self.preemptableJobsIssued += 1 cur_logger = logger.debug if jobNode.jobName.startswith(CWL_INTERNAL_JOBS) else logger.info cur_logger("Issued job %s with job batch system ID: " "%s and cores: %s, disk: %s, and memory: %s", jobNode, str(jobBatchSystemID), int(jobNode.cores), bytes2human(jobNode.disk), bytes2human(jobNode.memory)) if self.toilMetrics: self.toilMetrics.logIssuedJob(jobNode) self.toilMetrics.logQueueSize(self.getNumberOfJobsIssued()) # Tell the user there's another job to do self.progress_overall.total += 1 self.progress_overall.update(incr=0) def issueJobs(self, jobs): """Add a list of jobs, each represented as a jobNode object.""" for job in jobs: self.issueJob(job) def issueServiceJob(self, jobNode): """ Issue a service job, putting it on a queue if the maximum number of service jobs to be scheduled has been reached. """ if jobNode.preemptable: self.preemptableServiceJobsToBeIssued.append(jobNode) else: self.serviceJobsToBeIssued.append(jobNode) self.issueQueingServiceJobs() def issueQueingServiceJobs(self): """Issues any queuing service jobs up to the limit of the maximum allowed.""" while len(self.serviceJobsToBeIssued) > 0 and self.serviceJobsIssued < self.config.maxServiceJobs: self.issueJob(self.serviceJobsToBeIssued.pop()) self.serviceJobsIssued += 1 while len(self.preemptableServiceJobsToBeIssued) > 0 and self.preemptableServiceJobsIssued < self.config.maxPreemptableServiceJobs: self.issueJob(self.preemptableServiceJobsToBeIssued.pop()) self.preemptableServiceJobsIssued += 1 def getNumberOfJobsIssued(self, preemptable=None): """ Gets number of jobs that have been added by issueJob(s) and not removed by removeJob :param None or boolean preemptable: If none, return all types of jobs. If true, return just the number of preemptable jobs. If false, return just the number of non-preemptable jobs. """ if preemptable is None: return len(self.jobBatchSystemIDToIssuedJob) elif preemptable: return self.preemptableJobsIssued else: assert len(self.jobBatchSystemIDToIssuedJob) >= self.preemptableJobsIssued return len(self.jobBatchSystemIDToIssuedJob) - self.preemptableJobsIssued def _getStatusHint(self): """ Get a short string describing the current state of the workflow for a human. Should include number of currently running jobs, number of issued jobs, etc. Don't call this too often; it will talk to the batch system, which may make queries of the backing scheduler. :return: A one-line description of the current status of the workflow. :rtype: str """ issuedJobCount = self.getNumberOfJobsIssued() runningJobCount = len(self.batchSystem.getRunningBatchJobIDs()) return "%d jobs are running, %d jobs are issued and waiting to run" % (runningJobCount, issuedJobCount - runningJobCount) def _reportWorkflowStatus(self): """ Report the current status of the workflow to the user. """ # For now just log our scheduling status message to the log. # TODO: make this update fast enought to put it in the progress # bar/status line. logger.info(self._getStatusHint()) def removeJob(self, jobBatchSystemID): """Removes a job from the system.""" assert jobBatchSystemID in self.jobBatchSystemIDToIssuedJob jobNode = self.jobBatchSystemIDToIssuedJob[jobBatchSystemID] if jobNode.preemptable: # len(jobBatchSystemIDToIssuedJob) should always be greater than or equal to preemptableJobsIssued, # so decrement this value before removing the job from the issuedJob map assert self.preemptableJobsIssued > 0 self.preemptableJobsIssued -= 1 del self.jobBatchSystemIDToIssuedJob[jobBatchSystemID] # If service job if jobNode.jobStoreID in self.toilState.serviceJobStoreIDToPredecessorJob: # Decrement the number of services if jobNode.preemptable: self.preemptableServiceJobsIssued -= 1 else: self.serviceJobsIssued -= 1 # Tell the user that job is done, for progress purposes. self.progress_overall.update(incr=1) return jobNode def getJobs(self, preemptable=None): jobs = self.jobBatchSystemIDToIssuedJob.values() if preemptable is not None: jobs = [job for job in jobs if job.preemptable == preemptable] return jobs def killJobs(self, jobsToKill): """ Kills the given set of jobs and then sends them for processing. Returns the jobs that, upon processing, were reissued. """ # If we are rerunning a job we put the ID in this list. jobsRerunning = [] if len(jobsToKill) > 0: # Kill the jobs with the batch system. They will now no longer come in as updated. self.batchSystem.killBatchJobs(jobsToKill) for jobBatchSystemID in jobsToKill: # Reissue immediately, noting that we killed the job willRerun = self.processFinishedJob(jobBatchSystemID, 1, exitReason=BatchJobExitReason.KILLED) if willRerun: # Compose a list of all the jobs that will run again jobsRerunning.append(jobBatchSystemID) return jobsRerunning #Following functions handle error cases for when jobs have gone awry with the batch system. def reissueOverLongJobs(self): """ Check each issued job - if it is running for longer than desirable issue a kill instruction. Wait for the job to die then we pass the job to processFinishedJob. """ maxJobDuration = self.config.maxJobDuration jobsToKill = [] if maxJobDuration < 10000000: # We won't bother doing anything if rescue time > 16 weeks. runningJobs = self.batchSystem.getRunningBatchJobIDs() for jobBatchSystemID in list(runningJobs.keys()): if runningJobs[jobBatchSystemID] > maxJobDuration: logger.warning("The job: %s has been running for: %s seconds, more than the " "max job duration: %s, we'll kill it", str(self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID), str(runningJobs[jobBatchSystemID]), str(maxJobDuration)) jobsToKill.append(jobBatchSystemID) reissued = self.killJobs(jobsToKill) if len(jobsToKill) > 0: # Summarize our actions logger.info("Killed %d over long jobs and reissued %d of them", len(jobsToKill), len(reissued)) def reissueMissingJobs(self, killAfterNTimesMissing=3): """ Check all the current job ids are in the list of currently issued batch system jobs. If a job is missing, we mark it as so, if it is missing for a number of runs of this function (say 10).. then we try deleting the job (though its probably lost), we wait then we pass the job to processFinishedJob. """ issuedJobs = set(self.batchSystem.getIssuedBatchJobIDs()) jobBatchSystemIDsSet = set(list(self.jobBatchSystemIDToIssuedJob.keys())) #Clean up the reissueMissingJobs_missingHash hash, getting rid of jobs that have turned up missingJobIDsSet = set(list(self.reissueMissingJobs_missingHash.keys())) for jobBatchSystemID in missingJobIDsSet.difference(jobBatchSystemIDsSet): self.reissueMissingJobs_missingHash.pop(jobBatchSystemID) logger.warning("Batch system id: %s is no longer missing", str(jobBatchSystemID)) assert issuedJobs.issubset(jobBatchSystemIDsSet) #Assert checks we have #no unexpected jobs running jobsToKill = [] for jobBatchSystemID in set(jobBatchSystemIDsSet.difference(issuedJobs)): jobStoreID = self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID if jobBatchSystemID in self.reissueMissingJobs_missingHash: self.reissueMissingJobs_missingHash[jobBatchSystemID] += 1 else: self.reissueMissingJobs_missingHash[jobBatchSystemID] = 1 timesMissing = self.reissueMissingJobs_missingHash[jobBatchSystemID] logger.warning("Job store ID %s with batch system id %s is missing for the %i time", jobStoreID, str(jobBatchSystemID), timesMissing) if self.toilMetrics: self.toilMetrics.logMissingJob() if timesMissing == killAfterNTimesMissing: self.reissueMissingJobs_missingHash.pop(jobBatchSystemID) jobsToKill.append(jobBatchSystemID) self.killJobs(jobsToKill) return len( self.reissueMissingJobs_missingHash ) == 0 #We use this to inform #if there are missing jobs def processRemovedJob(self, issuedJob, resultStatus): if resultStatus != 0: logger.warning("Despite the batch system claiming failure the " "job %s seems to have finished and been removed", issuedJob) self._updatePredecessorStatus(issuedJob.jobStoreID) def processFinishedJob(self, batchSystemID, resultStatus, wallTime=None, exitReason=None): """ Function reads a processed jobGraph file and updates its state. Return True if the job is going to run again, and False if the job is fully done or completely failed. """ jobNode = self.removeJob(batchSystemID) jobStoreID = jobNode.jobStoreID if wallTime is not None and self.clusterScaler is not None: self.clusterScaler.addCompletedJob(jobNode, wallTime) if self.jobStore.exists(jobStoreID): logger.debug("Job %s continues to exist (i.e. has more to do)", jobNode) try: jobGraph = self.jobStore.load(jobStoreID) except NoSuchJobException: # Avoid importing AWSJobStore as the corresponding extra might be missing if self.jobStore.__class__.__name__ == 'AWSJobStore': # We have a ghost job - the job has been deleted but a stale read from # SDB gave us a false positive when we checked for its existence. # Process the job from here as any other job removed from the job store. # This is a temporary work around until https://github.com/BD2KGenomics/toil/issues/1091 # is completed logger.warning('Got a stale read from SDB for job %s', jobNode) self.processRemovedJob(jobNode, resultStatus) return else: raise if jobGraph.logJobStoreFileID is not None: with jobGraph.getLogFileHandle(self.jobStore) as logFileStream: # more memory efficient than read().striplines() while leaving off the # trailing \n left when using readlines() # http://stackoverflow.com/a/15233739 StatsAndLogging.logWithFormatting(jobStoreID, logFileStream, method=logger.warning, message='The job seems to have left a log file, indicating failure: %s' % jobGraph) if self.config.writeLogs or self.config.writeLogsGzip: with jobGraph.getLogFileHandle(self.jobStore) as logFileStream: StatsAndLogging.writeLogFiles(jobGraph.chainedJobs, logFileStream, self.config, failed=True) if resultStatus != 0: # If the batch system returned a non-zero exit code then the worker # is assumed not to have captured the failure of the job, so we # reduce the retry count here. if jobGraph.logJobStoreFileID is None: logger.warning("No log file is present, despite job failing: %s", jobNode) # Look for any standard output/error files created by the batch system. # They will only appear if the batch system actually supports # returning logs to the machine that submitted jobs, or if # --workDir / TOIL_WORKDIR is on a shared file system. # They live directly in the Toil work directory because that is # guaranteed to exist on the leader and workers. workDir = Toil.getToilWorkDir(self.config.workDir) # This must match the format in AbstractBatchSystem.formatStdOutErrPath() batchSystemFilePrefix = 'toil_workflow_{}_job_{}_batch_'.format(self.config.workflowID, batchSystemID) batchSystemFileGlob = os.path.join(workDir, batchSystemFilePrefix + '*.log') batchSystemFiles = glob.glob(batchSystemFileGlob) for batchSystemFile in batchSystemFiles: try: batchSystemFileStream = open(batchSystemFile, 'rb') except: logger.warning('The batch system left a file %s, but it could not be opened' % batchSystemFile) else: with batchSystemFileStream: if os.path.getsize(batchSystemFile) > 0: StatsAndLogging.logWithFormatting(jobStoreID, batchSystemFileStream, method=logger.warning, message='The batch system left a non-empty file %s:' % batchSystemFile) if self.config.writeLogs or self.config.writeLogsGzip: batchSystemFileRoot, _ = os.path.splitext(os.path.basename(batchSystemFile)) jobNames = jobGraph.chainedJobs if jobNames is None: # For jobs that fail this way, jobGraph.chainedJobs is not guaranteed to be set jobNames = [str(jobGraph)] jobNames = [jobName + '_' + batchSystemFileRoot for jobName in jobNames] batchSystemFileStream.seek(0) StatsAndLogging.writeLogFiles(jobNames, batchSystemFileStream, self.config, failed=True) else: logger.warning('The batch system left an empty file %s' % batchSystemFile) jobGraph.setupJobAfterFailure(self.config, exitReason=exitReason) self.jobStore.update(jobGraph) # Show job as failed in progress (and take it from completed) self.progress_overall.update(incr=-1) self.progress_failed.update(incr=1) elif jobStoreID in self.toilState.hasFailedSuccessors: # If the job has completed okay, we can remove it from the list of jobs with failed successors self.toilState.hasFailedSuccessors.remove(jobStoreID) if jobGraph.jobStoreID not in self.toilState.updatedJobs: #Now we know the #jobGraph is done we can add it to the list of updated jobGraph files self.toilState.updatedJobs[jobGraph.jobStoreID] = (jobGraph, resultStatus) logger.debug("Added job: %s to active jobs", jobGraph) # Return True if it will rerun (still has retries) and false if it # is completely failed. return jobGraph.remainingRetryCount > 0 else: #The jobGraph is done self.processRemovedJob(jobNode, resultStatus) # Being done, it won't run again. return False @staticmethod def getSuccessors(jobGraph, alreadySeenSuccessors, jobStore): """ Gets successors of the given job by walking the job graph recursively. Any successor in alreadySeenSuccessors is ignored and not traversed. Returns the set of found successors. This set is added to alreadySeenSuccessors. """ successors = set() def successorRecursion(jobGraph): # For lists of successors for successorList in jobGraph.stack: # For each successor in list of successors for successorJobNode in successorList: # If successor not already visited if successorJobNode.jobStoreID not in alreadySeenSuccessors: # Add to set of successors successors.add(successorJobNode.jobStoreID) alreadySeenSuccessors.add(successorJobNode.jobStoreID) # Recurse if job exists # (job may not exist if already completed) if jobStore.exists(successorJobNode.jobStoreID): successorRecursion(jobStore.load(successorJobNode.jobStoreID)) successorRecursion(jobGraph) # Recurse from jobGraph return successors def processTotallyFailedJob(self, jobGraph): """ Processes a totally failed job. """ # Mark job as a totally failed job self.toilState.totalFailedJobs.add(JobNode.fromJobGraph(jobGraph)) if self.toilMetrics: self.toilMetrics.logFailedJob(jobGraph) if jobGraph.jobStoreID in self.toilState.serviceJobStoreIDToPredecessorJob: # Is # a service job logger.debug("Service job is being processed as a totally failed job: %s", jobGraph) predecesssorJobGraph = self.toilState.serviceJobStoreIDToPredecessorJob[jobGraph.jobStoreID] # This removes the service job as a service of the predecessor # and potentially makes the predecessor active self._updatePredecessorStatus(jobGraph.jobStoreID) # Remove the start flag, if it still exists. This indicates # to the service manager that the job has "started", this prevents # the service manager from deadlocking while waiting self.jobStore.deleteFile(jobGraph.startJobStoreID) # Signal to any other services in the group that they should # terminate. We do this to prevent other services in the set # of services from deadlocking waiting for this service to start properly if predecesssorJobGraph.jobStoreID in self.toilState.servicesIssued: self.serviceManager.killServices(self.toilState.servicesIssued[predecesssorJobGraph.jobStoreID], error=True) logger.debug("Job: %s is instructing all the services of its parent job to quit", jobGraph) self.toilState.hasFailedSuccessors.add(predecesssorJobGraph.jobStoreID) # This ensures that the # job will not attempt to run any of it's successors on the stack else: # Is a non-service job assert jobGraph.jobStoreID not in self.toilState.servicesIssued # Traverse failed job's successor graph and get the jobStoreID of new successors. # Any successor already in toilState.failedSuccessors will not be traversed # All successors traversed will be added to toilState.failedSuccessors and returned # as a set (unseenSuccessors). unseenSuccessors = self.getSuccessors(jobGraph, self.toilState.failedSuccessors, self.jobStore) logger.debug("Found new failed successors: %s of job: %s", " ".join( unseenSuccessors), jobGraph) # For each newly found successor for successorJobStoreID in unseenSuccessors: # If the successor is a successor of other jobs that have already tried to schedule it if successorJobStoreID in self.toilState.successorJobStoreIDToPredecessorJobs: # For each such predecessor job # (we remove the successor from toilState.successorJobStoreIDToPredecessorJobs to avoid doing # this multiple times for each failed predecessor) for predecessorJob in self.toilState.successorJobStoreIDToPredecessorJobs.pop(successorJobStoreID): # Reduce the predecessor job's successor count. self.toilState.successorCounts[predecessorJob.jobStoreID] -= 1 # Indicate that it has failed jobs. self.toilState.hasFailedSuccessors.add(predecessorJob.jobStoreID) logger.debug("Marking job: %s as having failed successors (found by " "reading successors failed job)", predecessorJob) # If the predecessor has no remaining successors, add to list of active jobs assert self.toilState.successorCounts[predecessorJob.jobStoreID] >= 0 if self.toilState.successorCounts[predecessorJob.jobStoreID] == 0: if predecessorJob.jobStoreID not in self.toilState.updatedJobs: self.toilState.updatedJobs[predecessorJob.jobStoreID] = (predecessorJob, 0) # Remove the predecessor job from the set of jobs with successors. self.toilState.successorCounts.pop(predecessorJob.jobStoreID) # If the job has predecessor(s) if jobGraph.jobStoreID in self.toilState.successorJobStoreIDToPredecessorJobs: # For each predecessor of the job for predecessorJobGraph in self.toilState.successorJobStoreIDToPredecessorJobs[jobGraph.jobStoreID]: # Mark the predecessor as failed self.toilState.hasFailedSuccessors.add(predecessorJobGraph.jobStoreID) logger.debug("Totally failed job: %s is marking direct predecessor: %s " "as having failed jobs", jobGraph, predecessorJobGraph) self._updatePredecessorStatus(jobGraph.jobStoreID) def _updatePredecessorStatus(self, jobStoreID): """ Update status of predecessors for finished successor job. """ if jobStoreID in self.toilState.serviceJobStoreIDToPredecessorJob: # Is a service job predecessorJob = self.toilState.serviceJobStoreIDToPredecessorJob.pop(jobStoreID) self.toilState.servicesIssued[predecessorJob.jobStoreID].pop(jobStoreID) if len(self.toilState.servicesIssued[predecessorJob.jobStoreID]) == 0: # Predecessor job has # all its services terminated self.toilState.servicesIssued.pop(predecessorJob.jobStoreID) # The job has no running services if predecessorJob.jobStoreID not in self.toilState.updatedJobs: # Now we know # the job is done we can add it to the list of updated job files self.toilState.updatedJobs[predecessorJob.jobStoreID] = (predecessorJob, 0) elif jobStoreID not in self.toilState.successorJobStoreIDToPredecessorJobs: #We have reach the root job assert len(self.toilState.updatedJobs) == 0 assert len(self.toilState.successorJobStoreIDToPredecessorJobs) == 0 assert len(self.toilState.successorCounts) == 0 logger.debug("Reached root job %s so no predecessors to clean up" % jobStoreID) else: # Is a non-root, non-service job logger.debug("Cleaning the predecessors of %s" % jobStoreID) # For each predecessor for predecessorJob in self.toilState.successorJobStoreIDToPredecessorJobs.pop(jobStoreID): # Reduce the predecessor's number of successors by one to indicate the # completion of the jobStoreID job self.toilState.successorCounts[predecessorJob.jobStoreID] -= 1 # If the predecessor job is done and all the successors are complete if self.toilState.successorCounts[predecessorJob.jobStoreID] == 0: # Remove it from the set of jobs with active successors self.toilState.successorCounts.pop(predecessorJob.jobStoreID) if predecessorJob.jobStoreID not in self.toilState.hasFailedSuccessors: # Pop stack at this point, as we can get rid of its successors predecessorJob.stack.pop() # Now we know the job is done we can add it to the list of updated job files assert predecessorJob.jobStoreID not in self.toilState.updatedJobs self.toilState.updatedJobs[predecessorJob.jobStoreID] = (predecessorJob, 0)
{ "pile_set_name": "Github" }
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // This file was automatically generated by informer-gen package v1 import ( core_v1 "k8s.io/api/core/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" v1 "k8s.io/client-go/listers/core/v1" cache "k8s.io/client-go/tools/cache" time "time" ) // ServiceAccountInformer provides access to a shared informer and lister for // ServiceAccounts. type ServiceAccountInformer interface { Informer() cache.SharedIndexInformer Lister() v1.ServiceAccountLister } type serviceAccountInformer struct { factory internalinterfaces.SharedInformerFactory } // NewServiceAccountInformer constructs a new informer for ServiceAccount type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) { return client.CoreV1().ServiceAccounts(namespace).List(options) }, WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) { return client.CoreV1().ServiceAccounts(namespace).Watch(options) }, }, &core_v1.ServiceAccount{}, resyncPeriod, indexers, ) } func defaultServiceAccountInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { return NewServiceAccountInformer(client, meta_v1.NamespaceAll, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}) } func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { return f.factory.InformerFor(&core_v1.ServiceAccount{}, defaultServiceAccountInformer) } func (f *serviceAccountInformer) Lister() v1.ServiceAccountLister { return v1.NewServiceAccountLister(f.Informer().GetIndexer()) }
{ "pile_set_name": "Github" }
`XCUIElementQuery` extension contains additional methods for identifying and searching elements. `element(withLabelMatching:comparisonOperator:)` returns element with label matching provided string. String matching is customizable with operators available in `NSPredicate` specification. **Example:** ```swift let text = app.staticTexts.element(withLabelMatching: "John*", comparisonOperator: .like) XCTAssertTrue(text.exists) ``` `elements(withLabelsMatching:comparisonOperator:)` is a similar method but can be used when looking for an element which label can match one of many texts. **Example:** ```swift let texts = ["OK", "Done", "Go"] let elements = app.buttons.elements(withLabelsMatching: texts, comparisonOperator: .equals) ``` `element(withIdentifier:label:labelComparisonOperator:)` can be used to find element with given identifier and label. Useful to find a cell which `UILabel`, with provided `identifier`, contains text provided by `label`. **Example:** ```swift let cell = app.cells.element(withIdentifier: "title", label: "Made with love") ``` `element(withIdentifier:labels:labelComparisonOperator:)` can be used to find localized element with given identifier. E.g. to find label with identifier `state` and label which can by localized with texts: "open", "otwarty", "öffnen": **Example:** ```swift let label = app.staticTexts.element(withIdentifier: "state", labels: ["open", "otwarty", "öffnen"]) ``` `element(containingLabels:labelsComparisonOperator:)` is an extension to previous method. Searches for element that has sub-elements matching provided "identifier:label" pairs. Especially useful for table views and collection views where cells will have the same identifier. **Example:** ```swift let tableView = app.tables.element let cell = tableView.cells.element(containingLabels: ["name": "John*", "email": "*.com"], labelsComparisonOperator: .like) XCTAssertTrue(cell.exists) ``` In addition shorted variants are available: - `element(withLabelPrefixed:)` - `element(withLabelContaining:)` - `elements(withLabelsContaining:)` - `elements(withLabelsLike:)` Modifications for `Locator` protocol are also available: - `element(withLabelMatchingLocator:comparisonOperator:)` - `element(withLocator:label:labelComparisonOperator:)` - `element(containingLabels:labelsComparisonOperator:)`
{ "pile_set_name": "Github" }
package io; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class SerializationUser { public static void main( String[] args ) throws FileNotFoundException, IOException { User user = new User( 1, "Harry" ); File file = new File( "D:\\user.txt" ); FileOutputStream fos = new FileOutputStream( file ); ObjectOutputStream out = new ObjectOutputStream( fos ); out.writeObject( user ); out.flush( ); out.close( ); System.out.println( "User object is saved in file " + file.getAbsolutePath( ) ); } }
{ "pile_set_name": "Github" }
/* * Copyright 2013-2020 Automatak, LLC * * Licensed to Green Energy Corp (www.greenenergycorp.com) and Automatak * LLC (www.automatak.com) under one or more contributor license agreements. * See the NOTICE file distributed with this work for additional information * regarding copyright ownership. Green Energy Corp and Automatak LLC license * 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. */ #ifndef OPENDNP3_CHANNELLISTENERADAPTER_H #define OPENDNP3_CHANNELLISTENERADAPTER_H #include <opendnp3/channel/IChannelListener.h> #include "GlobalRef.h" #include "../jni/JCache.h" #include "../jni/JNIWrappers.h" class ChannelListenerAdapter final : public opendnp3::IChannelListener { public: ChannelListenerAdapter(jni::JChannelListener proxy) : proxy(proxy) {} void OnStateChange(opendnp3::ChannelState state) override { const auto env = JNI::GetEnv(); auto jstate = jni::JCache::ChannelState.fromType(env, static_cast<jint>(state)); jni::JCache::ChannelListener.onStateChange(env, proxy, jstate); } private: GlobalRef<jni::JChannelListener> proxy; }; #endif
{ "pile_set_name": "Github" }
/* openssl/engine.h */ /* Written by Geoff Thorpe ([email protected]) for the OpenSSL * project 2000. */ /* ==================================================================== * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * [email protected]. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED 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 OpenSSL PROJECT OR * ITS 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 product includes cryptographic software written by Eric Young * ([email protected]). This product includes software written by Tim * Hudson ([email protected]). * */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * ECDH support in OpenSSL originally developed by * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. */ #ifndef HEADER_ENGINE_H #define HEADER_ENGINE_H #include <openssl/opensslconf.h> #ifdef OPENSSL_NO_ENGINE #error ENGINE is disabled. #endif #ifndef OPENSSL_NO_DEPRECATED #include <openssl/bn.h> #ifndef OPENSSL_NO_RSA #include <openssl/rsa.h> #endif #ifndef OPENSSL_NO_DSA #include <openssl/dsa.h> #endif #ifndef OPENSSL_NO_DH #include <openssl/dh.h> #endif #ifndef OPENSSL_NO_ECDH #include <openssl/ecdh.h> #endif #ifndef OPENSSL_NO_ECDSA #include <openssl/ecdsa.h> #endif #include <openssl/rand.h> #include <openssl/ui.h> #include <openssl/err.h> #endif #include <openssl/ossl_typ.h> #include <openssl/symhacks.h> #include <openssl/x509.h> #ifdef __cplusplus extern "C" { #endif /* These flags are used to control combinations of algorithm (methods) * by bitwise "OR"ing. */ #define ENGINE_METHOD_RSA (unsigned int)0x0001 #define ENGINE_METHOD_DSA (unsigned int)0x0002 #define ENGINE_METHOD_DH (unsigned int)0x0004 #define ENGINE_METHOD_RAND (unsigned int)0x0008 #define ENGINE_METHOD_ECDH (unsigned int)0x0010 #define ENGINE_METHOD_ECDSA (unsigned int)0x0020 #define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 #define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 #define ENGINE_METHOD_STORE (unsigned int)0x0100 #define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 #define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 /* Obvious all-or-nothing cases. */ #define ENGINE_METHOD_ALL (unsigned int)0xFFFF #define ENGINE_METHOD_NONE (unsigned int)0x0000 /* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used * internally to control registration of ENGINE implementations, and can be set * by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to * initialise registered ENGINEs if they are not already initialised. */ #define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 /* ENGINE flags that can be set by ENGINE_set_flags(). */ /* #define ENGINE_FLAGS_MALLOCED 0x0001 */ /* Not used */ /* This flag is for ENGINEs that wish to handle the various 'CMD'-related * control commands on their own. Without this flag, ENGINE_ctrl() handles these * control commands on behalf of the ENGINE using their "cmd_defns" data. */ #define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 /* This flag is for ENGINEs who return new duplicate structures when found via * "ENGINE_by_id()". When an ENGINE must store state (eg. if ENGINE_ctrl() * commands are called in sequence as part of some stateful process like * key-generation setup and execution), it can set this flag - then each attempt * to obtain the ENGINE will result in it being copied into a new structure. * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments * the existing ENGINE's structural reference count. */ #define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 /* ENGINEs can support their own command types, and these flags are used in * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each * command expects. Currently only numeric and string input is supported. If a * control command supports none of the _NUMERIC, _STRING, or _NO_INPUT options, * then it is regarded as an "internal" control command - and not for use in * config setting situations. As such, they're not available to the * ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() access. Changes to * this list of 'command types' should be reflected carefully in * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */ /* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ #define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 /* accepts string input (cast from 'void*' to 'const char *', 4th parameter to * ENGINE_ctrl) */ #define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 /* Indicates that the control command takes *no* input. Ie. the control command * is unparameterised. */ #define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 /* Indicates that the control command is internal. This control command won't * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() * function. */ #define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 /* NB: These 3 control commands are deprecated and should not be used. ENGINEs * relying on these commands should compile conditional support for * compatibility (eg. if these symbols are defined) but should also migrate the * same functionality to their own ENGINE-specific control functions that can be * "discovered" by calling applications. The fact these control commands * wouldn't be "executable" (ie. usable by text-based config) doesn't change the * fact that application code can find and use them without requiring per-ENGINE * hacking. */ /* These flags are used to tell the ctrl function what should be done. * All command numbers are shared between all engines, even if some don't * make sense to some engines. In such a case, they do nothing but return * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */ #define ENGINE_CTRL_SET_LOGSTREAM 1 #define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 #define ENGINE_CTRL_HUP 3 /* Close and reinitialise any handles/connections etc. */ #define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */ #define ENGINE_CTRL_SET_CALLBACK_DATA 5 /* User-specific data, used when calling the password callback and the user interface */ #define ENGINE_CTRL_LOAD_CONFIGURATION 6 /* Load a configuration, given a string that represents a file name or so */ #define ENGINE_CTRL_LOAD_SECTION 7 /* Load data from a given section in the already loaded configuration */ /* These control commands allow an application to deal with an arbitrary engine * in a dynamic way. Warn: Negative return values indicate errors FOR THESE * COMMANDS because zero is used to indicate 'end-of-list'. Other commands, * including ENGINE-specific command types, return zero for an error. * * An ENGINE can choose to implement these ctrl functions, and can internally * manage things however it chooses - it does so by setting the * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise the * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl() * handler need only implement its own commands - the above "meta" commands will * be taken care of. */ /* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", then * all the remaining control commands will return failure, so it is worth * checking this first if the caller is trying to "discover" the engine's * capabilities and doesn't want errors generated unnecessarily. */ #define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 /* Returns a positive command number for the first command supported by the * engine. Returns zero if no ctrl commands are supported. */ #define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 /* The 'long' argument specifies a command implemented by the engine, and the * return value is the next command supported, or zero if there are no more. */ #define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 /* The 'void*' argument is a command name (cast from 'const char *'), and the * return value is the command that corresponds to it. */ #define ENGINE_CTRL_GET_CMD_FROM_NAME 13 /* The next two allow a command to be converted into its corresponding string * form. In each case, the 'long' argument supplies the command. In the NAME_LEN * case, the return value is the length of the command name (not counting a * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer * large enough, and it will be populated with the name of the command (WITH a * trailing EOL). */ #define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 #define ENGINE_CTRL_GET_NAME_FROM_CMD 15 /* The next two are similar but give a "short description" of a command. */ #define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 #define ENGINE_CTRL_GET_DESC_FROM_CMD 17 /* With this command, the return value is the OR'd combination of * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given * engine-specific ctrl command expects. */ #define ENGINE_CTRL_GET_CMD_FLAGS 18 /* ENGINE implementations should start the numbering of their own control * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */ #define ENGINE_CMD_BASE 200 /* NB: These 2 nCipher "chil" control commands are deprecated, and their * functionality is now available through ENGINE-specific control commands * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 * commands should be migrated to the more general command handling before these * are removed. */ /* Flags specific to the nCipher "chil" engine */ #define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 /* Depending on the value of the (long)i argument, this sets or * unsets the SimpleForkCheck flag in the CHIL API to enable or * disable checking and workarounds for applications that fork(). */ #define ENGINE_CTRL_CHIL_NO_LOCKING 101 /* This prevents the initialisation function from providing mutex * callbacks to the nCipher library. */ /* If an ENGINE supports its own specific control commands and wishes the * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that * supports the stated commands (ie. the "cmd_num" entries as described by the * array). NB: The array must be ordered in increasing order of cmd_num. * "null-terminated" means that the last ENGINE_CMD_DEFN element has cmd_num set * to zero and/or cmd_name set to NULL. */ typedef struct ENGINE_CMD_DEFN_st { unsigned int cmd_num; /* The command number */ const char *cmd_name; /* The command name itself */ const char *cmd_desc; /* A short description of the command */ unsigned int cmd_flags; /* The input the command expects */ } ENGINE_CMD_DEFN; /* Generic function pointer */ typedef int (*ENGINE_GEN_FUNC_PTR)(void); /* Generic function pointer taking no arguments */ typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *); /* Specific control function pointer */ typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void)); /* Generic load_key function pointer */ typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, UI_METHOD *ui_method, void *callback_data); typedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl, STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey, STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); /* These callback types are for an ENGINE's handler for cipher and digest logic. * These handlers have these prototypes; * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); * Looking at how to implement these handlers in the case of cipher support, if * the framework wants the EVP_CIPHER for 'nid', it will call; * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) * If the framework wants a list of supported 'nid's, it will call; * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) */ /* Returns to a pointer to the array of supported cipher 'nid's. If the second * parameter is non-NULL it is set to the size of the returned array. */ typedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int); typedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int); typedef int (*ENGINE_PKEY_METHS_PTR)(ENGINE *, EVP_PKEY_METHOD **, const int **, int); typedef int (*ENGINE_PKEY_ASN1_METHS_PTR)(ENGINE *, EVP_PKEY_ASN1_METHOD **, const int **, int); /* STRUCTURE functions ... all of these functions deal with pointers to ENGINE * structures where the pointers have a "structural reference". This means that * their reference is to allowed access to the structure but it does not imply * that the structure is functional. To simply increment or decrement the * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not * required when iterating using ENGINE_get_next as it will automatically * decrement the structural reference count of the "current" ENGINE and * increment the structural reference count of the ENGINE it returns (unless it * is NULL). */ /* Get the first/last "ENGINE" type available. */ ENGINE *ENGINE_get_first(void); ENGINE *ENGINE_get_last(void); /* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ ENGINE *ENGINE_get_next(ENGINE *e); ENGINE *ENGINE_get_prev(ENGINE *e); /* Add another "ENGINE" type into the array. */ int ENGINE_add(ENGINE *e); /* Remove an existing "ENGINE" type from the array. */ int ENGINE_remove(ENGINE *e); /* Retrieve an engine from the list by its unique "id" value. */ ENGINE *ENGINE_by_id(const char *id); /* Add all the built-in engines. */ void ENGINE_load_openssl(void); void ENGINE_load_dynamic(void); #ifndef OPENSSL_NO_STATIC_ENGINE void ENGINE_load_4758cca(void); void ENGINE_load_aep(void); void ENGINE_load_atalla(void); void ENGINE_load_chil(void); void ENGINE_load_cswift(void); void ENGINE_load_nuron(void); void ENGINE_load_sureware(void); void ENGINE_load_ubsec(void); void ENGINE_load_padlock(void); void ENGINE_load_capi(void); #ifndef OPENSSL_NO_GMP void ENGINE_load_gmp(void); #endif #ifndef OPENSSL_NO_GOST void ENGINE_load_gost(void); #endif #endif void ENGINE_load_cryptodev(void); void ENGINE_load_builtin_engines(void); /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation * "registry" handling. */ unsigned int ENGINE_get_table_flags(void); void ENGINE_set_table_flags(unsigned int flags); /* Manage registration of ENGINEs per "table". For each type, there are 3 * functions; * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) * ENGINE_unregister_***(e) - unregister the implementation from 'e' * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list * Cleanup is automatically registered from each table when required, so * ENGINE_cleanup() will reverse any "register" operations. */ int ENGINE_register_RSA(ENGINE *e); void ENGINE_unregister_RSA(ENGINE *e); void ENGINE_register_all_RSA(void); int ENGINE_register_DSA(ENGINE *e); void ENGINE_unregister_DSA(ENGINE *e); void ENGINE_register_all_DSA(void); int ENGINE_register_ECDH(ENGINE *e); void ENGINE_unregister_ECDH(ENGINE *e); void ENGINE_register_all_ECDH(void); int ENGINE_register_ECDSA(ENGINE *e); void ENGINE_unregister_ECDSA(ENGINE *e); void ENGINE_register_all_ECDSA(void); int ENGINE_register_DH(ENGINE *e); void ENGINE_unregister_DH(ENGINE *e); void ENGINE_register_all_DH(void); int ENGINE_register_RAND(ENGINE *e); void ENGINE_unregister_RAND(ENGINE *e); void ENGINE_register_all_RAND(void); int ENGINE_register_STORE(ENGINE *e); void ENGINE_unregister_STORE(ENGINE *e); void ENGINE_register_all_STORE(void); int ENGINE_register_ciphers(ENGINE *e); void ENGINE_unregister_ciphers(ENGINE *e); void ENGINE_register_all_ciphers(void); int ENGINE_register_digests(ENGINE *e); void ENGINE_unregister_digests(ENGINE *e); void ENGINE_register_all_digests(void); int ENGINE_register_pkey_meths(ENGINE *e); void ENGINE_unregister_pkey_meths(ENGINE *e); void ENGINE_register_all_pkey_meths(void); int ENGINE_register_pkey_asn1_meths(ENGINE *e); void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); void ENGINE_register_all_pkey_asn1_meths(void); /* These functions register all support from the above categories. Note, use of * these functions can result in static linkage of code your application may not * need. If you only need a subset of functionality, consider using more * selective initialisation. */ int ENGINE_register_complete(ENGINE *e); int ENGINE_register_all_complete(void); /* Send parametrised control commands to the engine. The possibilities to send * down an integer, a pointer to data or a function pointer are provided. Any of * the parameters may or may not be NULL, depending on the command number. In * actuality, this function only requires a structural (rather than functional) * reference to an engine, but many control commands may require the engine be * functional. The caller should be aware of trying commands that require an * operational ENGINE, and only use functional references in such situations. */ int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)); /* This function tests if an ENGINE-specific command is usable as a "setting". * Eg. in an application's config file that gets processed through * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */ int ENGINE_cmd_is_executable(ENGINE *e, int cmd); /* This function works like ENGINE_ctrl() with the exception of taking a * command name instead of a command number, and can handle optional commands. * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to * use the cmd_name and cmd_optional. */ int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, long i, void *p, void (*f)(void), int cmd_optional); /* This function passes a command-name and argument to an ENGINE. The cmd_name * is converted to a command number and the control command is called using * 'arg' as an argument (unless the ENGINE doesn't support such a command, in * which case no control command is called). The command is checked for input * flags, and if necessary the argument will be converted to a numeric value. If * cmd_optional is non-zero, then if the ENGINE doesn't support the given * cmd_name the return value will be success anyway. This function is intended * for applications to use so that users (or config files) can supply * engine-specific config data to the ENGINE at run-time to control behaviour of * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl() * functions that return data, deal with binary data, or that are otherwise * supposed to be used directly through ENGINE_ctrl() in application code. Any * "return" data from an ENGINE_ctrl() operation in this function will be lost - * the return value is interpreted as failure if the return value is zero, * success otherwise, and this function returns a boolean value as a result. In * other words, vendors of 'ENGINE'-enabled devices should write ENGINE * implementations with parameterisations that work in this scheme, so that * compliant ENGINE-based applications can work consistently with the same * configuration for the same ENGINE-enabled devices, across applications. */ int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, int cmd_optional); /* These functions are useful for manufacturing new ENGINE structures. They * don't address reference counting at all - one uses them to populate an ENGINE * structure with personalised implementations of things prior to using it * directly or adding it to the builtin ENGINE list in OpenSSL. These are also * here so that the ENGINE structure doesn't have to be exposed and break binary * compatibility! */ ENGINE *ENGINE_new(void); int ENGINE_free(ENGINE *e); int ENGINE_up_ref(ENGINE *e); int ENGINE_set_id(ENGINE *e, const char *id); int ENGINE_set_name(ENGINE *e, const char *name); int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth); int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth); int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth); int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f); int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, ENGINE_SSL_CLIENT_CERT_PTR loadssl_f); int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); int ENGINE_set_flags(ENGINE *e, int flags); int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); /* These functions allow control over any per-structure ENGINE data. */ int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); void *ENGINE_get_ex_data(const ENGINE *e, int idx); /* This function cleans up anything that needs it. Eg. the ENGINE_add() function * automatically ensures the list cleanup function is registered to be called * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure * ENGINE_cleanup() will clean up after them. */ void ENGINE_cleanup(void); /* These return values from within the ENGINE structure. These can be useful * with functional references as well as structural references - it depends * which you obtained. Using the result for functional purposes if you only * obtained a structural reference may be problematic! */ const char *ENGINE_get_id(const ENGINE *e); const char *ENGINE_get_name(const ENGINE *e); const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); const DH_METHOD *ENGINE_get_DH(const ENGINE *e); const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e); ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, const char *str, int len); const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, const char *str, int len); const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); int ENGINE_get_flags(const ENGINE *e); /* FUNCTIONAL functions. These functions deal with ENGINE structures * that have (or will) be initialised for use. Broadly speaking, the * structural functions are useful for iterating the list of available * engine types, creating new engine types, and other "list" operations. * These functions actually deal with ENGINEs that are to be used. As * such these functions can fail (if applicable) when particular * engines are unavailable - eg. if a hardware accelerator is not * attached or not functioning correctly. Each ENGINE has 2 reference * counts; structural and functional. Every time a functional reference * is obtained or released, a corresponding structural reference is * automatically obtained or released too. */ /* Initialise a engine type for use (or up its reference count if it's * already in use). This will fail if the engine is not currently * operational and cannot initialise. */ int ENGINE_init(ENGINE *e); /* Free a functional reference to a engine type. This does not require * a corresponding call to ENGINE_free as it also releases a structural * reference. */ int ENGINE_finish(ENGINE *e); /* The following functions handle keys that are stored in some secondary * location, handled by the engine. The storage may be on a card or * whatever. */ EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data); EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data); int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, STACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey, STACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data); /* This returns a pointer for the current ENGINE structure that * is (by default) performing any RSA operations. The value returned * is an incremented reference, so it should be free'd (ENGINE_finish) * before it is discarded. */ ENGINE *ENGINE_get_default_RSA(void); /* Same for the other "methods" */ ENGINE *ENGINE_get_default_DSA(void); ENGINE *ENGINE_get_default_ECDH(void); ENGINE *ENGINE_get_default_ECDSA(void); ENGINE *ENGINE_get_default_DH(void); ENGINE *ENGINE_get_default_RAND(void); /* These functions can be used to get a functional reference to perform * ciphering or digesting corresponding to "nid". */ ENGINE *ENGINE_get_cipher_engine(int nid); ENGINE *ENGINE_get_digest_engine(int nid); ENGINE *ENGINE_get_pkey_meth_engine(int nid); ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); /* This sets a new default ENGINE structure for performing RSA * operations. If the result is non-zero (success) then the ENGINE * structure will have had its reference count up'd so the caller * should still free their own reference 'e'. */ int ENGINE_set_default_RSA(ENGINE *e); int ENGINE_set_default_string(ENGINE *e, const char *def_list); /* Same for the other "methods" */ int ENGINE_set_default_DSA(ENGINE *e); int ENGINE_set_default_ECDH(ENGINE *e); int ENGINE_set_default_ECDSA(ENGINE *e); int ENGINE_set_default_DH(ENGINE *e); int ENGINE_set_default_RAND(ENGINE *e); int ENGINE_set_default_ciphers(ENGINE *e); int ENGINE_set_default_digests(ENGINE *e); int ENGINE_set_default_pkey_meths(ENGINE *e); int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); /* The combination "set" - the flags are bitwise "OR"d from the * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" * function, this function can result in unnecessary static linkage. If your * application requires only specific functionality, consider using more * selective functions. */ int ENGINE_set_default(ENGINE *e, unsigned int flags); void ENGINE_add_conf_module(void); /* Deprecated functions ... */ /* int ENGINE_clear_defaults(void); */ /**************************/ /* DYNAMIC ENGINE SUPPORT */ /**************************/ /* Binary/behaviour compatibility levels */ #define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000 /* Binary versions older than this are too old for us (whether we're a loader or * a loadee) */ #define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000 /* When compiling an ENGINE entirely as an external shared library, loadable by * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure * type provides the calling application's (or library's) error functionality * and memory management function pointers to the loaded library. These should * be used/set in the loaded library code so that the loading application's * 'state' will be used/changed in all operations. The 'static_state' pointer * allows the loaded library to know if it shares the same static data as the * calling application (or library), and thus whether these callbacks need to be * set or not. */ typedef void *(*dyn_MEM_malloc_cb)(size_t); typedef void *(*dyn_MEM_realloc_cb)(void *, size_t); typedef void (*dyn_MEM_free_cb)(void *); typedef struct st_dynamic_MEM_fns { dyn_MEM_malloc_cb malloc_cb; dyn_MEM_realloc_cb realloc_cb; dyn_MEM_free_cb free_cb; } dynamic_MEM_fns; /* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use * these types so we (and any other dependant code) can simplify a bit?? */ typedef void (*dyn_lock_locking_cb)(int,int,const char *,int); typedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int); typedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)( const char *,int); typedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *, const char *,int); typedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *, const char *,int); typedef struct st_dynamic_LOCK_fns { dyn_lock_locking_cb lock_locking_cb; dyn_lock_add_lock_cb lock_add_lock_cb; dyn_dynlock_create_cb dynlock_create_cb; dyn_dynlock_lock_cb dynlock_lock_cb; dyn_dynlock_destroy_cb dynlock_destroy_cb; } dynamic_LOCK_fns; /* The top-level structure */ typedef struct st_dynamic_fns { void *static_state; const ERR_FNS *err_fns; const CRYPTO_EX_DATA_IMPL *ex_data_fns; dynamic_MEM_fns mem_fns; dynamic_LOCK_fns lock_fns; } dynamic_fns; /* The version checking function should be of this prototype. NB: The * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code. * If this function returns zero, it indicates a (potential) version * incompatibility and the loaded library doesn't believe it can proceed. * Otherwise, the returned value is the (latest) version supported by the * loading library. The loader may still decide that the loaded code's version * is unsatisfactory and could veto the load. The function is expected to * be implemented with the symbol name "v_check", and a default implementation * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */ typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); #define IMPLEMENT_DYNAMIC_CHECK_FN() \ OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ return 0; } /* This function is passed the ENGINE structure to initialise with its own * function and command settings. It should not adjust the structural or * functional reference counts. If this function returns zero, (a) the load will * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the * structure, and (c) the shared library will be unloaded. So implementations * should do their own internal cleanup in failure circumstances otherwise they * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that * the loader is looking for. If this is NULL, the shared library can choose to * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared * library must initialise only an ENGINE matching the passed 'id'. The function * is expected to be implemented with the symbol name "bind_engine". A standard * implementation can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where * the parameter 'fn' is a callback function that populates the ENGINE structure * and returns an int value (zero for failure). 'fn' should have prototype; * [static] int fn(ENGINE *e, const char *id); */ typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, const dynamic_fns *fns); #define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ OPENSSL_EXPORT \ int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \ return 0; \ CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \ CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \ CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \ CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \ CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \ if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \ return 0; \ if(!ERR_set_implementation(fns->err_fns)) return 0; \ skip_cbs: \ if(!fn(e,id)) return 0; \ return 1; } /* If the loading application (or library) and the loaded ENGINE library share * the same static data (eg. they're both dynamically linked to the same * libcrypto.so) we need a way to avoid trying to set system callbacks - this * would fail, and for the same reason that it's unnecessary to try. If the * loaded ENGINE has (or gets from through the loader) its own copy of the * libcrypto static data, we will need to set the callbacks. The easiest way to * detect this is to have a function that returns a pointer to some static data * and let the loading application and loaded ENGINE compare their respective * values. */ void *ENGINE_get_static_state(void); #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV) void ENGINE_setup_bsd_cryptodev(void); #endif /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ void ERR_load_ENGINE_strings(void); /* Error codes for the ENGINE functions. */ /* Function codes. */ #define ENGINE_F_DYNAMIC_CTRL 180 #define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 #define ENGINE_F_DYNAMIC_LOAD 182 #define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 #define ENGINE_F_ENGINE_ADD 105 #define ENGINE_F_ENGINE_BY_ID 106 #define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 #define ENGINE_F_ENGINE_CTRL 142 #define ENGINE_F_ENGINE_CTRL_CMD 178 #define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 #define ENGINE_F_ENGINE_FINISH 107 #define ENGINE_F_ENGINE_FREE_UTIL 108 #define ENGINE_F_ENGINE_GET_CIPHER 185 #define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177 #define ENGINE_F_ENGINE_GET_DIGEST 186 #define ENGINE_F_ENGINE_GET_NEXT 115 #define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 #define ENGINE_F_ENGINE_GET_PKEY_METH 192 #define ENGINE_F_ENGINE_GET_PREV 116 #define ENGINE_F_ENGINE_INIT 119 #define ENGINE_F_ENGINE_LIST_ADD 120 #define ENGINE_F_ENGINE_LIST_REMOVE 121 #define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 #define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 #define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 #define ENGINE_F_ENGINE_NEW 122 #define ENGINE_F_ENGINE_REMOVE 123 #define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 #define ENGINE_F_ENGINE_SET_DEFAULT_TYPE 126 #define ENGINE_F_ENGINE_SET_ID 129 #define ENGINE_F_ENGINE_SET_NAME 130 #define ENGINE_F_ENGINE_TABLE_REGISTER 184 #define ENGINE_F_ENGINE_UNLOAD_KEY 152 #define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 #define ENGINE_F_ENGINE_UP_REF 190 #define ENGINE_F_INT_CTRL_HELPER 172 #define ENGINE_F_INT_ENGINE_CONFIGURE 188 #define ENGINE_F_INT_ENGINE_MODULE_INIT 187 #define ENGINE_F_LOG_MESSAGE 141 /* Reason codes. */ #define ENGINE_R_ALREADY_LOADED 100 #define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 #define ENGINE_R_CMD_NOT_EXECUTABLE 134 #define ENGINE_R_COMMAND_TAKES_INPUT 135 #define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 #define ENGINE_R_CONFLICTING_ENGINE_ID 103 #define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 #define ENGINE_R_DH_NOT_IMPLEMENTED 139 #define ENGINE_R_DSA_NOT_IMPLEMENTED 140 #define ENGINE_R_DSO_FAILURE 104 #define ENGINE_R_DSO_NOT_FOUND 132 #define ENGINE_R_ENGINES_SECTION_ERROR 148 #define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 #define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 #define ENGINE_R_ENGINE_SECTION_ERROR 149 #define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 #define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 #define ENGINE_R_FINISH_FAILED 106 #define ENGINE_R_GET_HANDLE_FAILED 107 #define ENGINE_R_ID_OR_NAME_MISSING 108 #define ENGINE_R_INIT_FAILED 109 #define ENGINE_R_INTERNAL_LIST_ERROR 110 #define ENGINE_R_INVALID_ARGUMENT 143 #define ENGINE_R_INVALID_CMD_NAME 137 #define ENGINE_R_INVALID_CMD_NUMBER 138 #define ENGINE_R_INVALID_INIT_VALUE 151 #define ENGINE_R_INVALID_STRING 150 #define ENGINE_R_NOT_INITIALISED 117 #define ENGINE_R_NOT_LOADED 112 #define ENGINE_R_NO_CONTROL_FUNCTION 120 #define ENGINE_R_NO_INDEX 144 #define ENGINE_R_NO_LOAD_FUNCTION 125 #define ENGINE_R_NO_REFERENCE 130 #define ENGINE_R_NO_SUCH_ENGINE 116 #define ENGINE_R_NO_UNLOAD_FUNCTION 126 #define ENGINE_R_PROVIDE_PARAMETERS 113 #define ENGINE_R_RSA_NOT_IMPLEMENTED 141 #define ENGINE_R_UNIMPLEMENTED_CIPHER 146 #define ENGINE_R_UNIMPLEMENTED_DIGEST 147 #define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 #define ENGINE_R_VERSION_INCOMPATIBILITY 145 #ifdef __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
/* * Copyright (C) 2015-2018 Alibaba Group Holding Limited */ #ifndef NGHTTP2_HTTP_H #define NGHTTP2_HTTP_H #ifdef HAVE_CONFIG_H #include <config.h> #endif /* HAVE_CONFIG_H */ #include "nghttp2.h" #include "nghttp2_session.h" #include "nghttp2_stream.h" /* * This function is called when HTTP header field |nv| in |frame| is * received for |stream|. This function will validate |nv| against * the current state of stream. * * This function returns 0 if it succeeds, or one of the following * negative error codes: * * NGHTTP2_ERR_HTTP_HEADER * Invalid HTTP header field was received. * NGHTTP2_ERR_IGN_HTTP_HEADER * Invalid HTTP header field was received but it can be treated as * if it was not received because of compatibility reasons. */ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream, nghttp2_frame *frame, nghttp2_hd_nv *nv, int trailer); /* * This function is called when request header is received. This * function performs validation and returns 0 if it succeeds, or -1. */ int nghttp2_http_on_request_headers(nghttp2_stream *stream, nghttp2_frame *frame); /* * This function is called when response header is received. This * function performs validation and returns 0 if it succeeds, or -1. */ int nghttp2_http_on_response_headers(nghttp2_stream *stream); /* * This function is called trailer header (for both request and * response) is received. This function performs validation and * returns 0 if it succeeds, or -1. */ int nghttp2_http_on_trailer_headers(nghttp2_stream *stream, nghttp2_frame *frame); /* * This function is called when END_STREAM flag is seen in incoming * frame. This function performs validation and returns 0 if it * succeeds, or -1. */ int nghttp2_http_on_remote_end_stream(nghttp2_stream *stream); /* * This function is called when chunk of data is received. This * function performs validation and returns 0 if it succeeds, or -1. */ int nghttp2_http_on_data_chunk(nghttp2_stream *stream, size_t n); /* * This function inspects header field in |frame| and records its * method in stream->http_flags. If frame->hd.type is neither * NGHTTP2_HEADERS nor NGHTTP2_PUSH_PROMISE, this function does * nothing. */ void nghttp2_http_record_request_method(nghttp2_stream *stream, nghttp2_frame *frame); #endif /* NGHTTP2_HTTP_H */
{ "pile_set_name": "Github" }
DEF GETPX X,Y OUT R,G,B PCOL=GSPOIT(X,Y) RGBREAD PCOL OUT R,G,B END
{ "pile_set_name": "Github" }
import { Collection, EntitySchema } from '@mikro-orm/core'; import { IBaseEntity5 } from './BaseEntity5'; import { IBook4 } from './Book4'; export interface IBookTag4 extends IBaseEntity5 { name: string; books: Collection<IBook4>; version: Date; } export const BookTag4 = new EntitySchema<IBookTag4, IBaseEntity5>({ name: 'BookTag4', extends: 'BaseEntity5', properties: { name: { type: 'string' }, books: { reference: 'm:n', entity: 'Book4', mappedBy: 'tags' }, version: { type: 'Date', version: true }, }, });
{ "pile_set_name": "Github" }
#ifndef CPPUNIT_OUTPUTTER_H #define CPPUNIT_OUTPUTTER_H #include <cppunit/Portability.h> CPPUNIT_NS_BEGIN /*! \brief Abstract outputter to print test result summary. * \ingroup WritingTestResult */ class CPPUNIT_API Outputter { public: /// Destructor. virtual ~Outputter() {} virtual void write() =0; }; CPPUNIT_NS_END #endif // CPPUNIT_OUTPUTTER_H
{ "pile_set_name": "Github" }
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package go1 import ( "math/rand" "regexp" "testing" ) // benchmark based on regexp/exec_test.go var regexpText []byte func makeRegexpText(n int) []byte { rand.Seed(0) // For reproducibility. if len(regexpText) >= n { return regexpText[:n] } regexpText = make([]byte, n) for i := range regexpText { if rand.Intn(30) == 0 { regexpText[i] = '\n' } else { regexpText[i] = byte(rand.Intn(0x7E+1-0x20) + 0x20) } } return regexpText } func benchmark(b *testing.B, re string, n int) { r := regexp.MustCompile(re) t := makeRegexpText(n) b.ResetTimer() b.SetBytes(int64(n)) for i := 0; i < b.N; i++ { if r.Match(t) { b.Fatal("match!") } } } const ( easy0 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ$" easy1 = "A[AB]B[BC]C[CD]D[DE]E[EF]F[FG]G[GH]H[HI]I[IJ]J$" medium = "[XYZ]ABCDEFGHIJKLMNOPQRSTUVWXYZ$" hard = "[ -~]*ABCDEFGHIJKLMNOPQRSTUVWXYZ$" ) func BenchmarkRegexpMatchEasy0_32(b *testing.B) { benchmark(b, easy0, 32<<0) } func BenchmarkRegexpMatchEasy0_1K(b *testing.B) { benchmark(b, easy0, 1<<10) } func BenchmarkRegexpMatchEasy1_32(b *testing.B) { benchmark(b, easy1, 32<<0) } func BenchmarkRegexpMatchEasy1_1K(b *testing.B) { benchmark(b, easy1, 1<<10) } func BenchmarkRegexpMatchMedium_32(b *testing.B) { benchmark(b, medium, 1<<0) } func BenchmarkRegexpMatchMedium_1K(b *testing.B) { benchmark(b, medium, 1<<10) } func BenchmarkRegexpMatchHard_32(b *testing.B) { benchmark(b, hard, 32<<0) } func BenchmarkRegexpMatchHard_1K(b *testing.B) { benchmark(b, hard, 1<<10) }
{ "pile_set_name": "Github" }
{test #$ ["lumo" "-c" "src:test" "-c" (clojure.string/join ":" (lumo.classpath/classpath)) "-m" "mach.lumo-test"]}
{ "pile_set_name": "Github" }
package com.googlecode.lanterna.gui2; import com.googlecode.lanterna.TerminalSize; import com.googlecode.lanterna.gui2.Window.Hint; import com.googlecode.lanterna.gui2.table.Table; import com.googlecode.lanterna.gui2.table.TableModel; import com.googlecode.lanterna.screen.TerminalScreen; import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.util.Arrays; import static org.junit.Assert.assertEquals; public class TableUnitTests { private DefaultVirtualTerminal terminal; private MultiWindowTextGUI gui; private BasicWindow window; private Table<String> table; private TableModel<String> model; @Before public void setUp() throws IOException { TerminalSize size = new TerminalSize(30, 24); terminal = new DefaultVirtualTerminal(size); TerminalScreen screen = new TerminalScreen(terminal); screen.startScreen(); DefaultWindowManager windowManager = new DefaultWindowManager(new EmptyWindowDecorationRenderer(), size); gui = new MultiWindowTextGUI(new SeparateTextGUIThread.Factory(), screen, windowManager, null, new EmptySpace()); window = new BasicWindow(); window.setHints(Arrays.asList(Hint.NO_DECORATIONS, Hint.FIT_TERMINAL_WINDOW, Hint.FULL_SCREEN)); table = new Table<>("a", "b"); window.setComponent(new Panel(new LinearLayout().setSpacing(0)).addComponent(table, LinearLayout.createLayoutData(LinearLayout.Alignment.Fill))); gui.addWindow(window); model = table.getTableModel(); } @Test public void testSimpleTable() throws Exception { model.addRow("A1", "B1"); assertScreenEquals("" + "a b\n" + "A1 B1"); } @Test public void testRendersVisibleRowsAndColumns() throws Exception { addRowsWithLongSecondColumn(4); assertScreenEquals("" + "a b\n" + "A1 ▲\n" + "A2 █\n" + "A3 ▼\n" + "◄█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒►"); } @Test public void testRendersVisibleRowsAndColumnsPartially() throws Exception { table.getRenderer().setAllowPartialColumn(true); addRowsWithLongSecondColumn(4); assertScreenEquals("" + "a b\n" + "A1 BBBBBBBBBBBBBBBBBBBBBBBBBB▲\n" + "A2 BBBBBBBBBBBBBBBBBBBBBBBBBB█\n" + "A3 BBBBBBBBBBBBBBBBBBBBBBBBBB▼\n" + "◄█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒►"); } @Test public void testRendersVisibleRowsAndColumnsPartiallyWhenHorizontallyScrolled() throws Exception { model = new TableModel<>("x", "a", "b"); table.setTableModel(this.model); table.getRenderer().setAllowPartialColumn(true); table.getRenderer().setViewLeftColumn(1); addRowsWithLongThirdColumn(4); assertScreenEquals("" + "a b\n" + "A1 BBBBBBBBBBBBBBBBBBBBBBBBBB▲\n" + "A2 BBBBBBBBBBBBBBBBBBBBBBBBBB█\n" + "A3 BBBBBBBBBBBBBBBBBBBBBBBBBB▼\n" + "◄▒▒▒▒▒▒▒▒▒█████████▒▒▒▒▒▒▒▒▒►"); } @Test public void testRendersVisibleRows() throws Exception { table.setVisibleRows(2); addFourRows(); assertScreenEquals("" + "a b\n" + "A1 B1 ▲\n" + "A2 B2 ▼"); } @Test public void testRendersVisibleRowsAndColumnsWithRestrictedVerticalSpace() throws Exception { table.setVisibleRows(3); addRowsWithLongSecondColumn(4); assertScreenEquals("" + "a b\n" + "A1 ▲\n" + "A2 ▼\n" + "◄█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒►"); } @Test public void testRendersVisibleRowsWithoutVerticalScrollBar() throws Exception { table.setVisibleRows(2); table.getRenderer().setScrollBarsHidden(true); addFourRows(); assertScreenEquals("" + "a b\n" + "A1 B1\n" + "A2 B2"); } @Test public void testRendersVisibleColumnsWithoutHorizontalScrollBar() throws Exception { table.setVisibleRows(2); table.getRenderer().setScrollBarsHidden(true); addRowsWithLongSecondColumn(2); assertScreenEquals("" + "a b\n" + "A1\n" + "A2"); } @Test public void testRendersVisibleRowsAndColumnsWithoutHorizontalScrollBar() throws Exception { table.setVisibleRows(2); table.getRenderer().setScrollBarsHidden(true); addRowsWithLongSecondColumn(4); assertScreenEquals("" + "a b\n" + "A1\n" + "A2"); } @Test public void testRendersVisibleRowsWithSelection() throws Exception { table.setVisibleRows(2); addFourRows(); table.setSelectedRow(1); assertScreenEquals("" + "a b\n" + "A1 B1 ▲\n" + "A2 B2 ▼"); table.setSelectedRow(2); assertScreenEquals("" + "a b\n" + "A2 B2 ▲\n" + "A3 B3 ▼"); table.setSelectedRow(3); assertScreenEquals("" + "a b\n" + "A3 B3 ▲\n" + "A4 B4 ▼"); } @Test public void testRendersVisibleRowsWithSelectionOffScreen() throws Exception { table.setVisibleRows(2); addFourRows(); table.setSelectedRow(3); assertScreenEquals("" + "a b\n" + "A3 B3 ▲\n" + "A4 B4 ▼"); } @Test public void testRendersVisibleRowsWithSelectionBeyondRowCount() throws Exception { table.setVisibleRows(2); addFourRows(); table.setSelectedRow(300); assertScreenEquals("" + "a b\n" + "A3 B3 ▲\n" + "A4 B4 ▼"); } @Test public void testRendersVisibleRowsAfterRemovingSelectedRow() throws Exception { table.setVisibleRows(2); addFourRows(); table.setSelectedRow(3); model.removeRow(3); assertScreenEquals("" + "a b\n" + "A2 B2 ▲\n" + "A3 B3 ▼"); } @Test public void testRendersVisibleRowsAfterInsertingBeforeSelectedRow() throws Exception { table.setVisibleRows(2); addFourRows(); table.setSelectedRow(2); assertScreenEquals("" + "a b\n" + "A2 B2 ▲\n" + "A3 B3 ▼"); model.insertRow(0, Arrays.asList("AX", "AX")); assertScreenEquals("" + "a b\n" + "A2 B2 ▲\n" + "A3 B3 ▼"); } @Test public void testRendersVisibleRowsAfterRemovingRowBeforeSelectedRow() throws Exception { table.setVisibleRows(2); addFourRows(); table.setSelectedRow(3); model.removeRow(0); assertScreenEquals("" + "a b\n" + "A3 B3 ▲\n" + "A4 B4 ▼"); } // ---------------- END OF TESTS ---------------- private void addFourRows() { model.addRow("A1", "B1"); model.addRow("A2", "B2"); model.addRow("A3", "B3"); model.addRow("A4", "B4"); } private void addRowsWithLongSecondColumn(int rows) { for (int i = 1; i <= rows; i++) { model.addRow("A" + i, "BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"+i); } } private void addRowsWithLongThirdColumn(int rows) { for (int i = 1; i <= rows; i++) { model.addRow("X", "A" + i, "BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"+i); } } private void assertScreenEquals(String expected) throws IOException { gui.updateScreen(); assertEquals(expected, stripTrailingNewlines(terminal.toString())); } private String stripTrailingNewlines(String s) { return s.replaceAll("(?s)[\\s\n]+$", ""); } }
{ "pile_set_name": "Github" }
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ // ========================================================================== // Print styles. // Inlined to avoid the additional HTTP request: h5bp.com/r // ========================================================================== @media print { *, *:before, *:after { background: transparent !important; color: #000 !important; // Black prints faster: h5bp.com/s box-shadow: none !important; text-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } // Don't show links that are fragment identifiers, // or use the `javascript:` pseudo protocol a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; } pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; // h5bp.com/t } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } // Bootstrap specific changes start // // Chrome (OSX) fix for https://github.com/twbs/bootstrap/issues/11245 // Once fixed, we can just straight up remove this. select { background: #fff !important; } // Bootstrap components .navbar { display: none; } .btn, .dropup > .btn { > .caret { border-top-color: #000 !important; } } .label { border: 1px solid #000; } .table { border-collapse: collapse !important; td, th { background-color: #fff !important; } } .table-bordered { th, td { border: 1px solid #ddd !important; } } // Bootstrap specific changes end }
{ "pile_set_name": "Github" }
#name: File.readlines(...) #key: file # -- File.readlines(${1:path}).each do |line| $0 end
{ "pile_set_name": "Github" }
HTML.TargetNoreferrer TYPE: bool VERSION: 4.8.0 DEFAULT: TRUE --DESCRIPTION-- If enabled, noreferrer rel attributes are added to links which have a target attribute associated with them. This prevents malicious destinations from overwriting the original window. --# vim: et sw=4 sts=4
{ "pile_set_name": "Github" }
re = RegExp('=', '') console.log 'a = b'.match(re)
{ "pile_set_name": "Github" }
class Api{ // 小册 static const String XIAOCE = 'https://xiaoce-timeline-api-ms.juejin.im/v1/getListByLastTime';//?uid=&client_id=&token=&src=web&pageNum=1 static const String BANNER_STORAGE = 'https://banner-storage-ms.juejin.im/v1/web/page/aanner?position=hero&platform=web&page=0&pageSize=20&src=web'; // 首页list static const String RANK_LIST = 'https://timeline-merger-ms.juejin.im/v1/get_entry_by_rank'; // 沸点 static const String PINS_LIST = 'https://short-msg-ms.juejin.im/v1/pinList/recommend'; // 小册导航 static const String BOOK_NAV = 'https://xiaoce-timeline-api-ms.juejin.im/v1/getNavList'; static const String BOOK_LIST = 'https://xiaoce-timeline-api-ms.juejin.im/v1/getListByLastTime'; // 开源库 static const String REPOS_LIST = 'https://repo-ms.juejin.im/v1/getCustomRepos'; // 活动 static const String ACTIVITY_CITY = 'https://event-storage-api-ms.juejin.im/v1/getCityList'; static const String ACTIVITY_LIST = 'https://event-storage-api-ms.juejin.im/v2/getEventList'; //登陆 static const String LOGIN = 'https://juejin.im/auth/type/phoneNumber'; static const PinsListSubscribed = 'https://short-msg-ms.juejin.im/v1/pinList/dynamic?uid=59be059c5188256c6d77cf2e&device_id=1541234434900&token=eyJhY2Nlc3NfdG9rZW4iOiJPb21uZGIySHJVQXU4b2pnIiwicmVmcmVzaF90b2tlbiI6IlJDdFNCVVIzaWw0Vmx0VGoiLCJ0b2tlbl90eXBlIjoibWFjIiwiZXhwaXJlX2luIjoyNTkyMDAwfQ%3D%3D&src=web&before&limit=30'; }
{ "pile_set_name": "Github" }
var httpRequest; var params = "v=<%= Vanity.context.vanity_active_experiments.map{|name, alternative| "#{name}=#{alternative.id}" }.join(',') %>&authenticity_token=<%= CGI.escape(form_authenticity_token) %>"; if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequest = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE try { httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } } if (httpRequest) { httpRequest.open('POST', "<%= Vanity.playground.add_participant_path %>", true); httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); httpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest"); httpRequest.send(params); }
{ "pile_set_name": "Github" }
/* * printer.c -- Printer gadget driver * * Copyright (C) 2003-2005 David Brownell * Copyright (C) 2006 Craig W. Nadler * * 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. */ #include <linux/module.h> #include <linux/kernel.h> #include <asm/byteorder.h> #include <linux/usb/ch9.h> #include <linux/usb/composite.h> #include <linux/usb/gadget.h> #include <linux/usb/g_printer.h> USB_GADGET_COMPOSITE_OPTIONS(); #define DRIVER_DESC "Printer Gadget" #define DRIVER_VERSION "2015 FEB 17" static const char shortname [] = "printer"; static const char driver_desc [] = DRIVER_DESC; #include "u_printer.h" /*-------------------------------------------------------------------------*/ /* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! * Instead: allocate your own, using normal USB-IF procedures. */ /* Thanks to NetChip Technologies for donating this product ID. */ #define PRINTER_VENDOR_NUM 0x0525 /* NetChip */ #define PRINTER_PRODUCT_NUM 0xa4a8 /* Linux-USB Printer Gadget */ /* Some systems will want different product identifiers published in the * device descriptor, either numbers or strings or both. These string * parameters are in UTF-8 (superset of ASCII's 7 bit characters). */ module_param_named(iSerialNum, coverwrite.serial_number, charp, S_IRUGO); MODULE_PARM_DESC(iSerialNum, "1"); static char *iPNPstring; module_param(iPNPstring, charp, S_IRUGO); MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); /* Number of requests to allocate per endpoint, not used for ep0. */ static unsigned qlen = 10; module_param(qlen, uint, S_IRUGO|S_IWUSR); #define QLEN qlen static struct usb_function_instance *fi_printer; static struct usb_function *f_printer; /*-------------------------------------------------------------------------*/ /* * DESCRIPTORS ... most are static, but strings and (full) configuration * descriptors are built on demand. */ static struct usb_device_descriptor device_desc = { .bLength = sizeof device_desc, .bDescriptorType = USB_DT_DEVICE, /* .bcdUSB = DYNAMIC */ .bDeviceClass = USB_CLASS_PER_INTERFACE, .bDeviceSubClass = 0, .bDeviceProtocol = 0, .idVendor = cpu_to_le16(PRINTER_VENDOR_NUM), .idProduct = cpu_to_le16(PRINTER_PRODUCT_NUM), .bNumConfigurations = 1 }; static const struct usb_descriptor_header *otg_desc[2]; /*-------------------------------------------------------------------------*/ /* descriptors that are built on-demand */ static char product_desc [40] = DRIVER_DESC; static char serial_num [40] = "1"; static char *pnp_string = "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"; /* static strings, in UTF-8 */ static struct usb_string strings [] = { [USB_GADGET_MANUFACTURER_IDX].s = "", [USB_GADGET_PRODUCT_IDX].s = product_desc, [USB_GADGET_SERIAL_IDX].s = serial_num, { } /* end of list */ }; static struct usb_gadget_strings stringtab_dev = { .language = 0x0409, /* en-us */ .strings = strings, }; static struct usb_gadget_strings *dev_strings[] = { &stringtab_dev, NULL, }; static struct usb_configuration printer_cfg_driver = { .label = "printer", .bConfigurationValue = 1, .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, }; static int printer_do_config(struct usb_configuration *c) { struct usb_gadget *gadget = c->cdev->gadget; int status = 0; usb_ep_autoconfig_reset(gadget); usb_gadget_set_selfpowered(gadget); if (gadget_is_otg(gadget)) { printer_cfg_driver.descriptors = otg_desc; printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; } f_printer = usb_get_function(fi_printer); if (IS_ERR(f_printer)) return PTR_ERR(f_printer); status = usb_add_function(c, f_printer); if (status < 0) usb_put_function(f_printer); return status; } static int printer_bind(struct usb_composite_dev *cdev) { struct f_printer_opts *opts; int ret; fi_printer = usb_get_function_instance("printer"); if (IS_ERR(fi_printer)) return PTR_ERR(fi_printer); opts = container_of(fi_printer, struct f_printer_opts, func_inst); opts->minor = 0; opts->q_len = QLEN; if (iPNPstring) { opts->pnp_string = kstrdup(iPNPstring, GFP_KERNEL); if (!opts->pnp_string) { ret = -ENOMEM; goto fail_put_func_inst; } opts->pnp_string_allocated = true; /* * we don't free this memory in case of error * as printer cleanup func will do this for us */ } else { opts->pnp_string = pnp_string; } ret = usb_string_ids_tab(cdev, strings); if (ret < 0) goto fail_put_func_inst; device_desc.iManufacturer = strings[USB_GADGET_MANUFACTURER_IDX].id; device_desc.iProduct = strings[USB_GADGET_PRODUCT_IDX].id; device_desc.iSerialNumber = strings[USB_GADGET_SERIAL_IDX].id; if (gadget_is_otg(cdev->gadget) && !otg_desc[0]) { struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(cdev->gadget); if (!usb_desc) { ret = -ENOMEM; goto fail_put_func_inst; } usb_otg_descriptor_init(cdev->gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; } ret = usb_add_config(cdev, &printer_cfg_driver, printer_do_config); if (ret) goto fail_free_otg_desc; usb_composite_overwrite_options(cdev, &coverwrite); return ret; fail_free_otg_desc: kfree(otg_desc[0]); otg_desc[0] = NULL; fail_put_func_inst: usb_put_function_instance(fi_printer); return ret; } static int printer_unbind(struct usb_composite_dev *cdev) { usb_put_function(f_printer); usb_put_function_instance(fi_printer); kfree(otg_desc[0]); otg_desc[0] = NULL; return 0; } static struct usb_composite_driver printer_driver = { .name = shortname, .dev = &device_desc, .strings = dev_strings, .max_speed = USB_SPEED_SUPER, .bind = printer_bind, .unbind = printer_unbind, }; module_usb_composite_driver(printer_driver); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR("Craig Nadler"); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_201) on Fri Jul 05 16:27:10 PDT 2019 --> <title>ProjectionDatumReader (iceberg master API)</title> <meta name="date" content="2019-07-05"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="ProjectionDatumReader (iceberg master API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/iceberg/avro/LogicalMap.html" title="class in org.apache.iceberg.avro"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/apache/iceberg/avro/UUIDConversion.html" title="class in org.apache.iceberg.avro"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/iceberg/avro/ProjectionDatumReader.html" target="_top">Frames</a></li> <li><a href="ProjectionDatumReader.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.iceberg.avro</div> <h2 title="Class ProjectionDatumReader" class="title">Class ProjectionDatumReader&lt;D&gt;</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>org.apache.iceberg.avro.ProjectionDatumReader&lt;D&gt;</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>org.apache.avro.io.DatumReader&lt;D&gt;</dd> </dl> <hr> <br> <pre>public class <span class="typeNameLabel">ProjectionDatumReader&lt;D&gt;</span> extends java.lang.Object implements org.apache.avro.io.DatumReader&lt;D&gt;</pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html#ProjectionDatumReader-java.util.function.Function-org.apache.iceberg.Schema-java.util.Map-">ProjectionDatumReader</a></span>(java.util.function.Function&lt;org.apache.avro.Schema,org.apache.avro.io.DatumReader&lt;?&gt;&gt;&nbsp;getReader, <a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;expectedSchema, java.util.Map&lt;java.lang.String,java.lang.String&gt;&nbsp;renames)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html" title="type parameter in ProjectionDatumReader">D</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html#read-D-org.apache.avro.io.Decoder-">read</a></span>(<a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html" title="type parameter in ProjectionDatumReader">D</a>&nbsp;reuse, org.apache.avro.io.Decoder&nbsp;in)</code>&nbsp;</td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html#setSchema-org.apache.avro.Schema-">setSchema</a></span>(org.apache.avro.Schema&nbsp;newFileSchema)</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="ProjectionDatumReader-java.util.function.Function-org.apache.iceberg.Schema-java.util.Map-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>ProjectionDatumReader</h4> <pre>public&nbsp;ProjectionDatumReader(java.util.function.Function&lt;org.apache.avro.Schema,org.apache.avro.io.DatumReader&lt;?&gt;&gt;&nbsp;getReader, <a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;expectedSchema, java.util.Map&lt;java.lang.String,java.lang.String&gt;&nbsp;renames)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="setSchema-org.apache.avro.Schema-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setSchema</h4> <pre>public&nbsp;void&nbsp;setSchema(org.apache.avro.Schema&nbsp;newFileSchema)</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>setSchema</code>&nbsp;in interface&nbsp;<code>org.apache.avro.io.DatumReader&lt;<a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html" title="type parameter in ProjectionDatumReader">D</a>&gt;</code></dd> </dl> </li> </ul> <a name="read-java.lang.Object-org.apache.avro.io.Decoder-"> <!-- --> </a><a name="read-D-org.apache.avro.io.Decoder-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>read</h4> <pre>public&nbsp;<a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html" title="type parameter in ProjectionDatumReader">D</a>&nbsp;read(<a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html" title="type parameter in ProjectionDatumReader">D</a>&nbsp;reuse, org.apache.avro.io.Decoder&nbsp;in) throws java.io.IOException</pre> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>read</code>&nbsp;in interface&nbsp;<code>org.apache.avro.io.DatumReader&lt;<a href="../../../../org/apache/iceberg/avro/ProjectionDatumReader.html" title="type parameter in ProjectionDatumReader">D</a>&gt;</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code>java.io.IOException</code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/iceberg/avro/LogicalMap.html" title="class in org.apache.iceberg.avro"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/apache/iceberg/avro/UUIDConversion.html" title="class in org.apache.iceberg.avro"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/iceberg/avro/ProjectionDatumReader.html" target="_top">Frames</a></li> <li><a href="ProjectionDatumReader.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
-----BEGIN CERTIFICATE----- MIICSjCCAdSgAwIBAgIBAjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdSb290 IENBMCAXDTE2MDMyMDA2MjcyN1oYDzIxMTYwMzIxMDYyNzI3WjANMQswCQYDVQQD DAJDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJadpD0ASxxfxsvd j9IxsogVzMSGLFziaYuE9KejU9+R479RifvwfBANO62sNWJ19X//9G5UjwWmkiOz n1k50DkYsBBA3mJzik6wjt/c58lBIlSEgAgpvDU8ht8w3t20JP9+YqXAeugqFj/W l9rFQtsvaWSRywjXVlp5fxuEQelNnXcJEKhsKTNExsBUZebo4/J1BWpklWzA9P0l YW5INvDAAwcF1nzlEf0Y6Eot03IMNyg2MTE4hehxjdgCSci8GYnFirE/ojXqqpAc ZGh7r2dqWgZUD1Dh+bT2vjrUzj8eTH3GdzI+oljt29102JIUaqj3yzRYkah8FLF9 CLNNsUcCAwEAAaNQME4wHQYDVR0OBBYEFLQRM/HX4l73U54gIhBPhga/H8leMB8G A1UdIwQYMBaAFFjzE/eu8wvKwzb2aODw52C+0gLVMAwGA1UdEwQFMAMBAf8wDQYJ KoZIhvcNAQELBQADYQCZM1sSpIyjyuGirBYvezFryUq5EyZiME3HIHJ7AbmquPtE LcoE8lwxEYXl7OTbLZHxIKkt6+WX2TL/0yshJLq/42nh5DZwyug7fIITmkzmzidF rbnl7fIop7OJX/kELbY= -----END CERTIFICATE-----
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.modules.db.metadata.model.api; import java.util.Collection; import org.netbeans.modules.db.metadata.model.spi.SchemaImplementation; /** * Encapsulates a database schema. * * @author Andrei Badea */ public class Schema extends MetadataElement { final SchemaImplementation impl; Schema(SchemaImplementation impl) { this.impl = impl; } /** * Returns the catalog containing this schema. * * @return the parent catalog. */ public Catalog getParent() { return impl.getParent(); } /** * Returns the name of this schema or {@code null} if the name is not known. * * @return the name or {@code null}. */ public String getName() { return impl.getName(); } /** * Returns {@code true} if this schema is the default one in the parent catalog. * * @return {@code true} if this is the default schema, {@false} otherwise. */ public boolean isDefault() { return impl.isDefault(); } /** * Returns {@code true} if this schema is synthetic. * * @return {@code true} if this is a synthetic schema, {@false} otherwise. */ public boolean isSynthetic() { return impl.isSynthetic(); } /** * Returns the tables in this schema. * * @return the tables. * @throws MetadataException if an error occurs while retrieving the metadata. */ public Collection<Table> getTables() { return impl.getTables(); } /** * Returns the table with the given name. * * @param name a table name. * @return a table named {@code name} or {@code null} if there is no such table. * @throws MetadataException if an error occurs while retrieving the metadata. */ public Table getTable(String name) { return impl.getTable(name); } /** * Returns the views in this schema. * * @return the views. * @throws MetadataException if an error occurs while retrieving the metadata. */ public Collection<View> getViews() { return impl.getViews(); } /** * Returns the view with the given name. * * @param name a view name. * @return a view named {@code view} or {@code null} if there is no such view. * @throws MetadataException if an error occurs while retrieving the metadata. */ public View getView(String name) { return impl.getView(name); } /** * Get the list of procedures for this schema * * @return the procedures * @throws MetadataException if an error occurs while retrieving the metadata */ public Collection<Procedure> getProcedures() { return impl.getProcedures(); } /** * Return a procedure with the given name * * @param name a procedure name * @return a procedure named {@code name} or {@code null} if there is no such procedure. * @throws MetadataException if an error occurs while retrieving the metadata */ public Procedure getProcedure(String name) { return impl.getProcedure(name); } /** * Get the list of functions for this schema * * @return the functions * @throws MetadataException if an error occurs while retrieving the * metadata * @since db.metadata.model/1.0 */ public Collection<Function> getFunctions() { return impl.getFunctions(); } /** * Return a function with the given name * * @param name a function name * @return a function named {@code name} or {@code null} if there is no such * function. * @throws MetadataException if an error occurs while retrieving the * metadata * @since db.metadata.model/1.0 */ public Function getFunction(String name) { return impl.getFunction(name); } /** * Refresh the metadata for this schema */ public void refresh() { impl.refresh(); } @Override public String toString() { return "Schema[name='" + impl.getName() + "',default=" + isDefault() + ",synthetic=" + isSynthetic() + "]"; // NOI18N } }
{ "pile_set_name": "Github" }
//===- llvm/unittest/ADT/FoldingSetTest.cpp -------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // FoldingSet unit tests. // //===----------------------------------------------------------------------===// #include "gtest/gtest.h" #include "llvm/ADT/FoldingSet.h" #include <string> using namespace llvm; namespace { // Unaligned string test. TEST(FoldingSetTest, UnalignedStringTest) { SCOPED_TRACE("UnalignedStringTest"); FoldingSetNodeID a, b; // An aligned string. std::string str1= "a test string"; a.AddString(str1); // An unaligned string. std::string str2 = ">" + str1; b.AddString(str2.c_str() + 1); EXPECT_EQ(a.ComputeHash(), b.ComputeHash()); } struct TrivialPair : public FoldingSetNode { unsigned Key = 0; unsigned Value = 0; TrivialPair(unsigned K, unsigned V) : FoldingSetNode(), Key(K), Value(V) {} void Profile(FoldingSetNodeID &ID) const { ID.AddInteger(Key); ID.AddInteger(Value); } }; TEST(FoldingSetTest, IDComparison) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); Trivial.InsertNode(&T); void *InsertPos = nullptr; FoldingSetNodeID ID; T.Profile(ID); TrivialPair *N = Trivial.FindNodeOrInsertPos(ID, InsertPos); EXPECT_EQ(&T, N); EXPECT_EQ(nullptr, InsertPos); } TEST(FoldingSetTest, MissedIDComparison) { FoldingSet<TrivialPair> Trivial; TrivialPair S(100, 42); TrivialPair T(99, 42); Trivial.InsertNode(&T); void *InsertPos = nullptr; FoldingSetNodeID ID; S.Profile(ID); TrivialPair *N = Trivial.FindNodeOrInsertPos(ID, InsertPos); EXPECT_EQ(nullptr, N); EXPECT_NE(nullptr, InsertPos); } TEST(FoldingSetTest, RemoveNodeThatIsPresent) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); Trivial.InsertNode(&T); EXPECT_EQ(Trivial.size(), 1U); bool WasThere = Trivial.RemoveNode(&T); EXPECT_TRUE(WasThere); EXPECT_EQ(0U, Trivial.size()); } TEST(FoldingSetTest, RemoveNodeThatIsAbsent) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); bool WasThere = Trivial.RemoveNode(&T); EXPECT_FALSE(WasThere); EXPECT_EQ(0U, Trivial.size()); } TEST(FoldingSetTest, GetOrInsertInserting) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); TrivialPair *N = Trivial.GetOrInsertNode(&T); EXPECT_EQ(&T, N); } TEST(FoldingSetTest, GetOrInsertGetting) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); TrivialPair T2(99, 42); Trivial.InsertNode(&T); TrivialPair *N = Trivial.GetOrInsertNode(&T2); EXPECT_EQ(&T, N); } TEST(FoldingSetTest, InsertAtPos) { FoldingSet<TrivialPair> Trivial; void *InsertPos = nullptr; TrivialPair Finder(99, 42); FoldingSetNodeID ID; Finder.Profile(ID); Trivial.FindNodeOrInsertPos(ID, InsertPos); TrivialPair T(99, 42); Trivial.InsertNode(&T, InsertPos); EXPECT_EQ(1U, Trivial.size()); } TEST(FoldingSetTest, EmptyIsTrue) { FoldingSet<TrivialPair> Trivial; EXPECT_TRUE(Trivial.empty()); } TEST(FoldingSetTest, EmptyIsFalse) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); Trivial.InsertNode(&T); EXPECT_FALSE(Trivial.empty()); } TEST(FoldingSetTest, ClearOnEmpty) { FoldingSet<TrivialPair> Trivial; Trivial.clear(); EXPECT_TRUE(Trivial.empty()); } TEST(FoldingSetTest, ClearOnNonEmpty) { FoldingSet<TrivialPair> Trivial; TrivialPair T(99, 42); Trivial.InsertNode(&T); Trivial.clear(); EXPECT_TRUE(Trivial.empty()); } TEST(FoldingSetTest, CapacityLargerThanReserve) { FoldingSet<TrivialPair> Trivial; auto OldCapacity = Trivial.capacity(); Trivial.reserve(OldCapacity + 1); EXPECT_GE(Trivial.capacity(), OldCapacity + 1); } TEST(FoldingSetTest, SmallReserveChangesNothing) { FoldingSet<TrivialPair> Trivial; auto OldCapacity = Trivial.capacity(); Trivial.reserve(OldCapacity - 1); EXPECT_EQ(Trivial.capacity(), OldCapacity); } }
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2014 Eric Niebler Copyright (c) 2014 Kohei Takahashi Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_SUPPORT_CONFIG_01092014_1718) #define FUSION_SUPPORT_CONFIG_01092014_1718 #include <boost/config.hpp> #include <boost/detail/workaround.hpp> #include <utility> #ifndef BOOST_FUSION_GPU_ENABLED #define BOOST_FUSION_GPU_ENABLED BOOST_GPU_ENABLED #endif // Enclose with inline namespace because unqualified lookup of GCC < 4.5 is broken. // // namespace detail { // struct foo; // struct X { }; // } // // template <typename T> void foo(T) { } // // int main() // { // foo(detail::X()); // // prog.cc: In function 'int main()': // // prog.cc:2: error: 'struct detail::foo' is not a function, // // prog.cc:6: error: conflict with 'template<class T> void foo(T)' // // prog.cc:10: error: in call to 'foo' // } namespace boost { namespace fusion { namespace detail { namespace barrier { } using namespace barrier; }}} #define BOOST_FUSION_BARRIER_BEGIN namespace barrier { #define BOOST_FUSION_BARRIER_END } #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900)) // All of rvalue-reference ready MSVC don't perform implicit conversion from // fundamental type to rvalue-reference of another fundamental type [1]. // // Following example doesn't compile // // int i; // long &&l = i; // sigh..., std::forward<long&&>(i) also fail. // // however, following one will work. // // int i; // long &&l = static_cast<long &&>(i); // // OK, now can we replace all usage of std::forward to static_cast? -- I say NO! // All of rvalue-reference ready Clang doesn't compile above static_cast usage [2], sigh... // // References: // 1. https://connect.microsoft.com/VisualStudio/feedback/details/1037806/implicit-conversion-doesnt-perform-for-fund // 2. http://llvm.org/bugs/show_bug.cgi?id=19917 // // Tentatively, we use static_cast to forward if run under MSVC. # define BOOST_FUSION_FWD_ELEM(type, value) static_cast<type&&>(value) #else # define BOOST_FUSION_FWD_ELEM(type, value) std::forward<type>(value) #endif // Workaround for LWG 2408: C++17 SFINAE-friendly std::iterator_traits. // http://cplusplus.github.io/LWG/lwg-defects.html#2408 // // - GCC 4.5 enables the feature under C++11. // https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01105.html // // - MSVC 10.0 implements iterator intrinsics; MSVC 13.0 implements LWG2408. #if (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 40500) && \ defined(BOOST_LIBSTDCXX11)) || \ (defined(BOOST_MSVC) && (1600 <= BOOST_MSVC && BOOST_MSVC < 1900)) # define BOOST_FUSION_WORKAROUND_FOR_LWG_2408 namespace std { template <typename> struct iterator_traits; } #endif // Workaround for older GCC that doesn't accept `this` in constexpr. #if BOOST_WORKAROUND(BOOST_GCC, < 40700) #define BOOST_FUSION_CONSTEXPR_THIS #else #define BOOST_FUSION_CONSTEXPR_THIS BOOST_CONSTEXPR #endif #endif
{ "pile_set_name": "Github" }
package org.ovirt.engine.ui.common.widget; import org.ovirt.engine.ui.common.widget.dialog.InfoIcon; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.user.client.ui.Widget; public class WidgetWithInfo extends WidgetWithTooltippedIcon { public WidgetWithInfo(Widget contentWidget) { this(contentWidget, SafeHtmlUtils.EMPTY_SAFE_HTML); } public WidgetWithInfo(Widget contentWidget, String infoText) { this(contentWidget, SafeHtmlUtils.fromString(infoText)); } public WidgetWithInfo(Widget contentWidget, SafeHtml infoText) { super(contentWidget, new InfoIcon(infoText)); } }
{ "pile_set_name": "Github" }
package com.github.dreamhead.moco; import com.github.dreamhead.moco.helper.MocoTestHelper; import org.junit.Before; import org.junit.Test; import static com.github.dreamhead.moco.Moco.by; import static com.github.dreamhead.moco.Moco.context; import static com.github.dreamhead.moco.Moco.httpsServer; import static com.github.dreamhead.moco.Moco.pathResource; import static com.github.dreamhead.moco.Moco.uri; import static com.github.dreamhead.moco.MocoRequestHit.once; import static com.github.dreamhead.moco.MocoRequestHit.requestHit; import static com.github.dreamhead.moco.Runner.running; import static com.github.dreamhead.moco.HttpsCertificate.certificate; import static com.github.dreamhead.moco.helper.RemoteTestUtils.httpsRoot; import static com.github.dreamhead.moco.helper.RemoteTestUtils.port; import static com.github.dreamhead.moco.helper.RemoteTestUtils.remoteHttpsUrl; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; public class MocoHttpsTest { private static final HttpsCertificate DEFAULT_CERTIFICATE = certificate(pathResource("cert.jks"), "mocohttps", "mocohttps"); private MocoTestHelper helper; @Before public void setUp() throws Exception { helper = new MocoTestHelper(); } @Test public void should_return_expected_result() throws Exception { HttpsServer server = httpsServer(port(), DEFAULT_CERTIFICATE); server.response("foo"); running(server, new Runnable() { @Override public void run() throws Exception { assertThat(helper.get(httpsRoot()), is("foo")); } }); } @Test public void should_return_expected_result_for_specified_request() throws Exception { HttpsServer server = httpsServer(port(), DEFAULT_CERTIFICATE); server.request(by("foo")).response("bar"); running(server, new Runnable() { @Override public void run() throws Exception { assertThat(helper.postContent(httpsRoot(), "foo"), is("bar")); } }); } @Test public void should_return_expected_result_with_monitor() throws Exception { RequestHit hit = requestHit(); HttpsServer server = httpsServer(port(), DEFAULT_CERTIFICATE, hit); server.request(by("foo")).response("bar"); running(server, new Runnable() { @Override public void run() throws Exception { assertThat(helper.postContent(httpsRoot(), "foo"), is("bar")); } }); hit.verify(by("foo"), once()); } @Test public void should_return_expected_result_without_port() throws Exception { final HttpsServer server = httpsServer(DEFAULT_CERTIFICATE); server.request(by("foo")).response("bar"); running(server, new Runnable() { @Override public void run() throws Exception { assertThat(helper.postContent(httpsRoot(server.port()), "foo"), is("bar")); } }); } @Test public void should_return_expected_result_with_monitor_without_port() throws Exception { RequestHit hit = requestHit(); final HttpsServer server = httpsServer(DEFAULT_CERTIFICATE, hit); server.request(by("foo")).response("bar"); running(server, new Runnable() { @Override public void run() throws Exception { assertThat(helper.postContent(httpsRoot(server.port()), "foo"), is("bar")); } }); hit.verify(by("foo"), once()); } @Test public void should_return_expected_result_with_global_config() throws Exception { HttpsServer server = httpsServer(port(), DEFAULT_CERTIFICATE, context("/foo")); server.request(by(uri("/bar"))).response("foo"); running(server, new Runnable() { @Override public void run() throws Exception { assertThat(helper.get(remoteHttpsUrl("/foo/bar")), is("foo")); } }); } }
{ "pile_set_name": "Github" }
<h2>What is Resource-Tree?</h2> <p>Simply put, Resource-Tree is a file resource management system. Resource-Tree simplifies the process of turning data into a usable form. It creates an easy to access tree from files and directories; and also provides a convenient means for "freeing" data after use.</p> <h2>Code Example</h2> <p>Where <code>/path/to/file/or/dir/</code> has the directory structure:</p> <pre><code>dir |- branch | |- sub-branch | | |- leaf.png | | |- acorn.png | | | |- other-sub-branch | |- ... | |- other-branch |- ... </code></pre> <p>The following code creates a tree of readily usable images by recursively iterating through directories to find files. For each file found, the <code>LOAD-FUNCTION</code> is called. In this case it's <code>LOAD-IMAGE</code>. If the <code>LOAD-FUNCTION</code> returns anything other than <code>NIL</code> the value returned is bound in a hash-table to a key which is a keyword corresponding to <code>FILE-NAME</code> with everything after the first full-stop truncated and all spaces and underscores replaced with a hyphen. All directories turn into branches when <code>LOAD-PATH</code> is called with the recursive flag set to <code>T</code> (set by default). The same "path-name to keyword" methodology is applied to directories.</p> <pre><code>(defun load-image (file-name) (unless (string= "png" (pathname-type file-name)) (return-from load-image)) (let ((image (il:gen-image))) (il:bind-image image) (il:load-image file-name) image)) (with-resource-tree (tree :load-function #'load-image :free-function #'il:delete-images) (load-path tree "/path/to/file/or/dir/") (with-nodes (leaf acorn) (node tree :branch :sub-branch) (il:bind-image leaf) (il:flip-image) ...)) </code></pre> <p><code>WITH-RESOURCE-TREE</code> creates an instance of <code>RESOURCE-TREE</code> and assigns it to <code>TREE</code> with the remaining arguments being initialisation arguments for the instance. <code>LOAD-PATH</code> loads a file or directory into the tree. The optional <code>:PARENT-NODE-PATH</code> key specifies the path to the parent node using a list. <code>LOAD-PATH</code> may be called more than once. <code>WITH-NODES</code> creates variables bound to the specified leaves of the provided node. <code>NODE</code> is used to retrieve a single node (a leaf or branch) from the tree path given to it. After the code is run, <code>FREE</code> is called on <code>TREE</code> which frees all nodes in tree using <code>FREE-FUNCTION</code> <em>if</em> <code>FREE-FUNCTION</code> was set.</p> <h2>Dependencies</h2> <p>Prerequisites:</p> <ul> <li>None</li> </ul> <p>Optional:</p> <ul> <li>xlUnit (for unit tests)</li> </ul> <h2>Installation</h2> <h3>On Unix-like Systems</h3> <p>Extract the source to the desired directory. Then, while in the appropriate ASDF systems directory execute the following command, where <code>../path/to/resource-tree</code> is obviously replaced as suitable:</p> <pre><code>find ../path/to/resource-tree -name '*.asd' -exec ln -s '{}' \; </code></pre>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2015 The Jupiter Project * * Licensed under the Apache License, version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jupiter.example.cluster.service; import org.jupiter.rpc.ServiceProviderImpl; /** * jupiter * org.jupiter.example.cluster.service * * @author jiachun.fjc */ @ServiceProviderImpl public class ClusterFailServiceImpl implements ClusterService { @Override public String helloString() { throw new RuntimeException(); } @Override public int helloInt() { throw new RuntimeException(); } @Override public void helloVoid() { throw new RuntimeException(); } }
{ "pile_set_name": "Github" }
username=foobar password=password
{ "pile_set_name": "Github" }
<form id="win_form_pack" method="post" action="{:url('Develop/appAddPack')}"> <input type="hidden" name="objid" value="{$objid}" /> <div class="form-group"> <label>名称</label> <input type="text" name="pack[name]" class="form-control" autocomplete="off" /> </div> <div class="form-group"> <label>类型</label> <select name="pack[type]" class="form-control"> <option value="">请选择</option> {foreach $packTypes as $k=>$v} <option value="{$k}">{$v}</option> {/foreach} </select> <p class="help-block type-nav" style="display:none;">显示在应用的管理界面中</p> </div> <div class="form-group"> <label>新窗口</label> <div class="input-group"> <label class="radio-inline"><input type="radio" name="pack[target]" value="1">是</label> <label class="radio-inline"><input type="radio" name="pack[target]" value="0">否</label> </div> <p class="help-block">是否在新窗口打开连接</p> </div> <div class="form-group"> <label>链接</label> <input type="text" name="pack[nav_link]" class="form-control" autocomplete="off" placeholder="默认补全为应用绝对链接" /> <div class="help-block"> 可使用参数:&#123;app&#125;当前应用的根网址,&#123;apps&#125;所有应用的根网址<br> </div> </div> <div class="form-group form-group-sm"> <button type="submit" class="btn btn-primary btn-block">确定</button> </div> </form> <script type="text/javascript"> developClass.init_app_pack(); {if condition="!empty($pack)"} developClass.load_app_pack({$pack|json_encode}); {/if} </script>
{ "pile_set_name": "Github" }
typedef double xdouble3x3[3][3]; int x;
{ "pile_set_name": "Github" }
// Copyright (c) 2000-2012 Bluespec, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // $Revision$ // $Date$ `ifdef BSV_ASSIGNMENT_DELAY `else `define BSV_ASSIGNMENT_DELAY `endif `ifdef BSV_POSITIVE_RESET `define BSV_RESET_VALUE 1'b1 `define BSV_RESET_EDGE posedge `else `define BSV_RESET_VALUE 1'b0 `define BSV_RESET_EDGE negedge `endif `ifdef BSV_ASYNC_RESET `define BSV_ARESET_EDGE_META or `BSV_RESET_EDGE RST `else `define BSV_ARESET_EDGE_META `endif `ifdef BSV_RESET_FIFO_HEAD `define BSV_ARESET_EDGE_HEAD `BSV_ARESET_EDGE_META `else `define BSV_ARESET_EDGE_HEAD `endif // Depth 1 FIFO module FIFO1(CLK, RST, D_IN, ENQ, FULL_N, D_OUT, DEQ, EMPTY_N, CLR ); parameter width = 1; parameter guarded = 1; input CLK; input RST; input [width - 1 : 0] D_IN; input ENQ; input DEQ; input CLR ; output FULL_N; output [width - 1 : 0] D_OUT; output EMPTY_N; reg [width - 1 : 0] D_OUT; reg empty_reg ; assign EMPTY_N = empty_reg ; `ifdef BSV_NO_INITIAL_BLOCKS `else // not BSV_NO_INITIAL_BLOCKS // synopsys translate_off initial begin D_OUT = {((width + 1)/2) {2'b10}} ; empty_reg = 1'b0 ; end // initial begin // synopsys translate_on `endif // BSV_NO_INITIAL_BLOCKS assign FULL_N = !empty_reg; always@(posedge CLK `BSV_ARESET_EDGE_META) begin if (RST == `BSV_RESET_VALUE) begin empty_reg <= `BSV_ASSIGNMENT_DELAY 1'b0; end // if (RST == `BSV_RESET_VALUE) else begin if (CLR) begin empty_reg <= `BSV_ASSIGNMENT_DELAY 1'b0; end // if (CLR) else if (ENQ) begin empty_reg <= `BSV_ASSIGNMENT_DELAY 1'b1; end // if (ENQ) else if (DEQ) begin empty_reg <= `BSV_ASSIGNMENT_DELAY 1'b0; end // if (DEQ) end // else: !if(RST == `BSV_RESET_VALUE) end // always@ (posedge CLK or `BSV_RESET_EDGE RST) always@(posedge CLK `BSV_ARESET_EDGE_HEAD) begin `ifdef BSV_RESET_FIFO_HEAD if (RST == `BSV_RESET_VALUE) begin D_OUT <= `BSV_ASSIGNMENT_DELAY {width {1'b0}} ; end else `endif begin if (ENQ) D_OUT <= `BSV_ASSIGNMENT_DELAY D_IN; end // else: !if(RST == `BSV_RESET_VALUE) end // always@ (posedge CLK or `BSV_RESET_EDGE RST) // synopsys translate_off always@(posedge CLK) begin: error_checks reg deqerror, enqerror ; deqerror = 0; enqerror = 0; if (RST == ! `BSV_RESET_VALUE) begin if ( ! empty_reg && DEQ ) begin deqerror = 1 ; $display( "Warning: FIFO1: %m -- Dequeuing from empty fifo" ) ; end if ( ! FULL_N && ENQ && (!DEQ || guarded) ) begin enqerror = 1 ; $display( "Warning: FIFO1: %m -- Enqueuing to a full fifo" ) ; end end // if (RST == ! `BSV_RESET_VALUE) end // synopsys translate_on endmodule
{ "pile_set_name": "Github" }
script: | zq "*" good.tzng bad.tzng > res.tzng inputs: - name: good.tzng data: | #0:record[_path:string,ts:time] 0:[conn;1;] - name: bad.tzng data: | #0:record[_path:string,ts:time] 1:[conn;1;] 0:[conn;1;] outputs: - name: stderr regexp: | bad.tzng: format detection error.*
{ "pile_set_name": "Github" }
--source ndb_waiter.inc --echo Waiting for not started --exec $_waiter_cmd --not-started > /dev/null
{ "pile_set_name": "Github" }
{ "division": "Maxthon #MAJORVER#.#MINORVER#", "versions": [2], "sortIndex": 945, "lite": false, "standard": true, "userAgents": [ { "userAgent": "Maxthon #MAJORVER#.#MINORVER#", "browser": "maxthon", "platform": "Windows", "engine": "Trident", "device": "Windows Desktop", "properties": { "Parent": "DefaultProperties", "Comment": "Maxthon #MAJORVER#.#MINORVER#", "Version": "#MAJORVER#.#MINORVER#", "Alpha": false, "Beta": false }, "children": [ { "match": "Mozilla/4.0 (compatible; MSIE 6.0;#PLATFORM#Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 7.0;#PLATFORM#Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 8.0;#PLATFORM#; *Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 8.0;#PLATFORM#Trident/4.0*)*Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 8.0;#PLATFORM#Trident/5.0*)*Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 8.0;#PLATFORM#Trident/6.0*)*Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 9.0;#PLATFORM#; *Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 9.0;#PLATFORM#Trident/5.0*)*Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 9.0;#PLATFORM#Trident/6.0*)*Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 10.0;#PLATFORM#; *Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 10.0;#PLATFORM#Trident/6.0*)*Maxthon*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 8.0;#PLATFORM#; *MyIE2*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Win98_2", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 9.0;#PLATFORM#; *MyIE2*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Win98_2", "Windows" ] }, { "match": "Mozilla/4.0 (compatible; MSIE 10.0;#PLATFORM#; *MyIE2*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Win98_2", "Windows" ] }, { "match": "Mozilla/5.0 (compatible; MSIE 10.0;#PLATFORM#; *MyIE2*", "platforms": [ "Win7_64", "Win7_32", "Vista_64", "Vista_32", "WinXPb_32", "WinXPa_32", "Win2000", "Win98_2", "Windows" ] }, { "match": "Mozilla/5.0 (compatible; MSIE 10.0; Trident/6.0; #PLATFORM#; *MyIE2*", "engine": "Trident_6", "platforms": [ "Win7_32", "Win2000", "Windows" ] } ] } ] }
{ "pile_set_name": "Github" }
#region License /* Copyright (c) 2010-2014 Danko Kozar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endregion License using System; namespace eDriven.Core.Events { /// <summary> /// Event /// An event is used for transferring data around /// It also has methods for cancelling or stopping it's propagation /// </summary> /// <remarks>Coded by Danko Kozar</remarks> public class Event : ICloneable { public const string CHANGE = "change"; #region Properties /// <summary> /// Event target (or originator) /// By default, the object that dispatched the event /// It may be set to any object (not necesarily the one that dispatched it) /// If not set explicitelly, the target is set by the system to default /// </summary> public object Target; /// <summary> /// The event type /// Used for notifiying listeners subscribed to specific event type /// </summary> public string Type; /// <summary> /// The flag that indicates if the event could be canceled or default prevented /// Using this flag, the developer can cancel/default prevent some behaviour inside the event dispatcher from the 'outside' /// </summary> public bool Cancelable; /// <summary> /// The flag that indicates if the event has been canceled /// Using this flag, the developer can cancel some default behaviour inside the event dispatcher from the 'outside' /// After the event has been canceled, it won't be dispatched to any of the consequent listeners /// </summary> public bool Canceled; /// <summary> /// The flag that indicates if the event has been default prevented /// Using this flag, the developer can prevent a default action of the event dispatcher /// This mechanism is used to expose a part of the decision making from event dispatcher to the 'outside' /// </summary> public bool DefaultPrevented; /// <summary> /// Current target /// Used by systems that support event bubbling /// to keep track of the current object processing the event /// </summary> public object CurrentTarget; /// <summary> /// The flag used by systems that support event bubbling /// false by default /// </summary> public bool Bubbles; // Changed from true to false on 2011-09-18 /// <summary> /// Event phase (Capture/Target/Bubbling) /// Used by systems that support event bubbling /// to keep track of the current bubbling phase /// </summary> public EventPhase Phase = EventPhase.Target; #endregion #region Constructor /// <summary> /// Constant /// </summary> public Event(string type) { Type = type; } /// <summary> /// Constant /// </summary> public Event(string type, object target) { Type = type; Target = target; } /// <summary> /// Constant /// </summary> public Event(string type, bool bubbles) { Type = type; Bubbles = bubbles; } /// <summary> /// Constant /// </summary> public Event(string type, bool bubbles, bool cancelable) { Type = type; Cancelable = cancelable; Bubbles = bubbles; } /// <summary> /// Constant /// </summary> public Event(string type, object target, bool bubbles, bool cancelable) { Type = type; Target = target; Cancelable = cancelable; Bubbles = bubbles; } #endregion #region Methods /// <summary> /// Prevents the default action of the dispatcher following the dispatching /// </summary> public virtual void PreventDefault() { DefaultPrevented = true; } /// <summary> /// Cancels the event /// e.g. sets Canceled to TRUE /// </summary> public virtual void Cancel() { if (Cancelable) Canceled = true; } /// <summary> /// Stops the propagation /// Used by systems that support event bubbling /// Cancels the further bubbling but does not cancel the event /// </summary> public void StopPropagation() { Bubbles = false; } /// <summary> /// Stops the propagation /// Used by systems that support event bubbling /// Cancels the further bubbling AND cancels the event /// </summary> public void CancelAndStopPropagation() { Bubbles = false; Canceled = true; } /// <summary> /// Makes a shallow copy of the event /// </summary> /// <returns></returns> public virtual object Clone() { return MemberwiseClone(); } /// <summary> /// Formatted string for debugging purposes /// </summary> /// <returns></returns> public override string ToString() { return string.Format("[{0}] Target: {1}, Type: {2}, Canceled: {3}, CurrentTarget: {4}, Bubbles: {5}, EventPhase: {6}", GetType().FullName, Target, Type, Canceled, CurrentTarget, Bubbles, Phase); } #endregion } }
{ "pile_set_name": "Github" }
# 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. import datetime from oslo_utils import timeutils from novaclient.tests.functional import base class TestInstanceUsageAuditLogCLI(base.ClientTestBase): COMPUTE_API_VERSION = '2.1' # NOTE(takashin): By default, 'instance_usage_audit' is False in nova. # So the instance usage audit log is not recoreded. # Therefore an empty result can be got. # But it is tested here to call APIs and get responses normally. @staticmethod def _get_begin_end_time(): current = timeutils.utcnow() end = datetime.datetime(day=1, month=current.month, year=current.year) year = end.year if current.month == 1: year -= 1 month = 12 else: month = current.month - 1 begin = datetime.datetime(day=1, month=month, year=year) return (begin, end) def test_get_os_instance_usage_audit_log(self): (begin, end) = self._get_begin_end_time() expected = { 'hosts_not_run': '[]', 'log': '{}', 'num_hosts': '0', 'num_hosts_done': '0', 'num_hosts_not_run': '0', 'num_hosts_running': '0', 'overall_status': 'ALL hosts done. 0 errors.', 'total_errors': '0', 'total_instances': '0', 'period_beginning': str(begin), 'period_ending': str(end) } output = self.nova('instance-usage-audit-log') for key in expected.keys(): self.assertEqual(expected[key], self._get_value_from_the_table(output, key)) def test_get_os_instance_usage_audit_log_with_before(self): expected = { 'hosts_not_run': '[]', 'log': '{}', 'num_hosts': '0', 'num_hosts_done': '0', 'num_hosts_not_run': '0', 'num_hosts_running': '0', 'overall_status': 'ALL hosts done. 0 errors.', 'total_errors': '0', 'total_instances': '0', 'period_beginning': '2016-11-01 00:00:00', 'period_ending': '2016-12-01 00:00:00' } output = self.nova( 'instance-usage-audit-log --before "2016-12-10 13:59:59.999999"') for key in expected.keys(): self.assertEqual(expected[key], self._get_value_from_the_table(output, key))
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>GObject Reference Manual: Signals</title> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> <link rel="home" href="index.html" title="GObject Reference Manual"> <link rel="up" href="chapter-signal.html" title="The GObject messaging system"> <link rel="prev" href="chapter-signal.html" title="The GObject messaging system"> <link rel="next" href="rn01.html" title="API Reference"> <meta name="generator" content="GTK-Doc V1.21.1 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="chapter-signal.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="chapter-signal.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="rn01.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="sect1"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="signal"></a>Signals</h2></div></div></div> <p> GObject's signals have nothing to do with standard UNIX signals: they connect arbitrary application-specific events with any number of listeners. For example, in GTK+, every user event (keystroke or mouse move) is received from the X server and generates a GTK+ event under the form of a signal emission on a given object instance. </p> <p> Each signal is registered in the type system together with the type on which it can be emitted: users of the type are said to <span class="emphasis"><em>connect</em></span> to the signal on a given type instance when they register a closure to be invoked upon the signal emission. Users can also emit the signal by themselves or stop the emission of the signal from within one of the closures connected to the signal. </p> <p> When a signal is emitted on a given type instance, all the closures connected to this signal on this type instance will be invoked. All the closures connected to such a signal represent callbacks whose signature looks like: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1</pre></td> <td class="listing_code"><pre class="programlisting"><span class="usertype">return_type</span><span class="normal"> </span><span class="function">function_callback</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">...</span><span class="normal"> </span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p> </p> <div class="sect2"> <div class="titlepage"><div><div><h3 class="title"> <a name="signal-registration"></a>Signal registration</h3></div></div></div> <p> To register a new signal on an existing type, we can use any of <code class="function"><a class="link" href="gobject-Signals.html#g-signal-newv" title="g_signal_newv ()">g_signal_newv</a></code>, <code class="function"><a class="link" href="gobject-Signals.html#g-signal-new-valist" title="g_signal_new_valist ()">g_signal_new_valist</a></code> or <code class="function"><a class="link" href="gobject-Signals.html#g-signal-new" title="g_signal_new ()">g_signal_new</a></code> functions: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10</pre></td> <td class="listing_code"><pre class="programlisting"><span class="usertype">guint</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-newv">g_signal_newv</a></span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">signal_name</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GType</span><span class="normal"> itype</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GSignalFlags</span><span class="normal"> signal_flags</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GClosure</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">class_closure</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GSignalAccumulator</span><span class="normal"> accumulator</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> accu_data</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GSignalCMarshaller</span><span class="normal"> c_marshaller</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GType</span><span class="normal"> return_type</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> n_params</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GType</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">param_types</span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p> The number of parameters to these functions is a bit intimidating but they are relatively simple: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p> signal_name: is a string which can be used to uniquely identify a given signal. </p></li> <li class="listitem"><p> itype: is the instance type on which this signal can be emitted. </p></li> <li class="listitem"><p> signal_flags: partly defines the order in which closures which were connected to the signal are invoked. </p></li> <li class="listitem"><p> class_closure: this is the default closure for the signal: if it is not NULL upon the signal emission, it will be invoked upon this emission of the signal. The moment where this closure is invoked compared to other closures connected to that signal depends partly on the signal_flags. </p></li> <li class="listitem"><p> accumulator: this is a function pointer which is invoked after each closure has been invoked. If it returns FALSE, signal emission is stopped. If it returns TRUE, signal emission proceeds normally. It is also used to compute the return value of the signal based on the return value of all the invoked closures. </p></li> <li class="listitem"><p> accumulator_data: this pointer will be passed down to each invocation of the accumulator during emission. </p></li> <li class="listitem"><p> c_marshaller: this is the default C marshaller for any closure which is connected to this signal. </p></li> <li class="listitem"><p> return_type: this is the type of the return value of the signal. </p></li> <li class="listitem"><p> n_params: this is the number of parameters this signal takes. </p></li> <li class="listitem"><p> param_types: this is an array of GTypes which indicate the type of each parameter of the signal. The length of this array is indicated by n_params. </p></li> </ul></div> <p> </p> <p> As you can see from the above definition, a signal is basically a description of the closures which can be connected to this signal and a description of the order in which the closures connected to this signal will be invoked. </p> </div> <div class="sect2"> <div class="titlepage"><div><div><h3 class="title"> <a name="signal-connection"></a>Signal connection</h3></div></div></div> <p> If you want to connect to a signal with a closure, you have three possibilities: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p> You can register a class closure at signal registration: this is a system-wide operation. i.e.: the class_closure will be invoked during each emission of a given signal on all the instances of the type which supports that signal. </p></li> <li class="listitem"><p> You can use <code class="function"><a class="link" href="gobject-Signals.html#g-signal-override-class-closure" title="g_signal_override_class_closure ()">g_signal_override_class_closure</a></code> which overrides the class_closure of a given type. It is possible to call this function only on a derived type of the type on which the signal was registered. This function is of use only to language bindings. </p></li> <li class="listitem"><p> You can register a closure with the <code class="function"><a class="link" href="gobject-Signals.html#g-signal-connect" title="g_signal_connect()">g_signal_connect</a></code> family of functions. This is an instance-specific operation: the closure will be invoked only during emission of a given signal on a given instance. </p></li> </ul></div> <p> It is also possible to connect a different kind of callback on a given signal: emission hooks are invoked whenever a given signal is emitted whatever the instance on which it is emitted. Emission hooks are used for example to get all mouse_clicked emissions in an application to be able to emit the small mouse click sound. Emission hooks are connected with <code class="function"><a class="link" href="gobject-Signals.html#g-signal-add-emission-hook" title="g_signal_add_emission_hook ()">g_signal_add_emission_hook</a></code> and removed with <code class="function"><a class="link" href="gobject-Signals.html#g-signal-remove-emission-hook" title="g_signal_remove_emission_hook ()">g_signal_remove_emission_hook</a></code>. </p> </div> <div class="sect2"> <div class="titlepage"><div><div><h3 class="title"> <a name="signal-emission"></a>Signal emission</h3></div></div></div> <p> Signal emission is done through the use of the <code class="function"><a class="link" href="gobject-Signals.html#g-signal-emit" title="g_signal_emit ()">g_signal_emit</a></code> family of functions. </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4</pre></td> <td class="listing_code"><pre class="programlisting"><span class="type">void</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-emitv">g_signal_emitv</a></span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GValue</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">instance_and_params</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> signal_id</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GQuark</span><span class="normal"> detail</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GValue</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">return_value</span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p> </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p> The instance_and_params array of GValues contains the list of input parameters to the signal. The first element of the array is the instance pointer on which to invoke the signal. The following elements of the array contain the list of parameters to the signal. </p></li> <li class="listitem"><p> signal_id identifies the signal to invoke. </p></li> <li class="listitem"><p> detail identifies the specific detail of the signal to invoke. A detail is a kind of magic token/argument which is passed around during signal emission and which is used by closures connected to the signal to filter out unwanted signal emissions. In most cases, you can safely set this value to zero. See <a class="xref" href="signal.html#signal-detail" title="The detail argument">the section called “The <span class="emphasis"><em>detail</em></span> argument”</a> for more details about this parameter. </p></li> <li class="listitem"><p> return_value holds the return value of the last closure invoked during emission if no accumulator was specified. If an accumulator was specified during signal creation, this accumulator is used to calculate the return_value as a function of the return values of all the closures invoked during emission. <a href="#ftn.id-1.3.5.3.7.2.3.4.1.1" class="footnote" name="id-1.3.5.3.7.2.3.4.1.1"><sup class="footnote">[8]</sup></a> If no closure is invoked during emission, the return_value is nonetheless initialized to zero/null. </p></li> </ul></div> <p> </p> <p> Internally, the GValue array is passed to the emission function proper, <code class="function">signal_emit_unlocked_R</code> (implemented in <code class="filename">gsignal.c</code>). Signal emission can be decomposed in 5 steps: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p> <span class="emphasis"><em>RUN_FIRST</em></span>: if the G_SIGNAL_RUN_FIRST flag was used during signal registration and if there exist a class_closure for this signal, the class_closure is invoked. Jump to <span class="emphasis"><em>EMISSION_HOOK</em></span> state. </p></li> <li class="listitem"><p> <span class="emphasis"><em>EMISSION_HOOK</em></span>: if any emission hook was added to the signal, they are invoked from first to last added. Accumulate return values and jump to <span class="emphasis"><em>HANDLER_RUN_FIRST</em></span> state. </p></li> <li class="listitem"><p> <span class="emphasis"><em>HANDLER_RUN_FIRST</em></span>: if any closure were connected with the <code class="function"><a class="link" href="gobject-Signals.html#g-signal-connect" title="g_signal_connect()">g_signal_connect</a></code> family of functions, and if they are not blocked (with the <code class="function"><a class="link" href="gobject-Signals.html#g-signal-handler-block" title="g_signal_handler_block ()">g_signal_handler_block</a></code> family of functions) they are run here, from first to last connected. Jump to <span class="emphasis"><em>RUN_LAST</em></span> state. </p></li> <li class="listitem"><p> <span class="emphasis"><em>RUN_LAST</em></span>: if the G_SIGNAL_RUN_LAST flag was set during registration and if a class_closure was set, it is invoked here. Jump to <span class="emphasis"><em>HANDLER_RUN_LAST</em></span> state. </p></li> <li class="listitem"><p> <span class="emphasis"><em>HANDLER_RUN_LAST</em></span>: if any closure were connected with the <code class="function">g_signal_connect_after</code> family of functions, if they were not invoked during HANDLER_RUN_FIRST and if they are not blocked, they are run here, from first to last connected. Jump to <span class="emphasis"><em>RUN_CLEANUP</em></span> state. </p></li> <li class="listitem"><p> <span class="emphasis"><em>RUN_CLEANUP</em></span>: if the G_SIGNAL_RUN_CLEANUP flag was set during registration and if a class_closure was set, it is invoked here. Signal emission is completed here. </p></li> </ul></div> <p> </p> <p> If, at any point during emission (except in RUN_CLEANUP state), one of the closures or emission hook stops the signal emission with <code class="function"><a class="link" href="gobject-Signals.html#g-signal-stop-emission" title="g_signal_stop_emission ()">g_signal_stop_emission</a></code>, emission jumps to CLEANUP state. </p> <p> If, at any point during emission, one of the closures or emission hook emits the same signal on the same instance, emission is restarted from the RUN_FIRST state. </p> <p> The accumulator function is invoked in all states, after invocation of each closure (except in EMISSION_HOOK and CLEANUP). It accumulates the closure return value into the signal return value and returns TRUE or FALSE. If, at any point, it does not return TRUE, emission jumps to CLEANUP state. </p> <p> If no accumulator function was provided, the value returned by the last handler run will be returned by <code class="function"><a class="link" href="gobject-Signals.html#g-signal-emit" title="g_signal_emit ()">g_signal_emit</a></code>. </p> </div> <div class="sect2"> <div class="titlepage"><div><div><h3 class="title"> <a name="signal-detail"></a>The <span class="emphasis"><em>detail</em></span> argument</h3></div></div></div> <p>All the functions related to signal emission or signal connection have a parameter named the <span class="emphasis"><em>detail</em></span>. Sometimes, this parameter is hidden by the API but it is always there, under one form or another. </p> <p> Of the three main connection functions, only one has an explicit detail parameter as a <a href="https://developer.gnome.org/glib/unstable/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> <a href="#ftn.id-1.3.5.3.8.3.2" class="footnote" name="id-1.3.5.3.8.3.2"><sup class="footnote">[9]</sup></a>: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5</pre></td> <td class="listing_code"><pre class="programlisting"><span class="usertype">gulong</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-connect-closure-by-id">g_signal_connect_closure_by_id</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> signal_id</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GQuark</span><span class="normal"> detail</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GClosure</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">closure</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">gboolean</span><span class="normal"> after</span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p> The two other functions hide the detail parameter in the signal name identification: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10</pre></td> <td class="listing_code"><pre class="programlisting"><span class="usertype">gulong</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-connect-closure">g_signal_connect_closure</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span> <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">detailed_signal</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GClosure</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">closure</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">gboolean</span><span class="normal"> after</span><span class="symbol">);</span> <span class="usertype">gulong</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-connect-data">g_signal_connect_data</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span> <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">detailed_signal</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GCallback</span><span class="normal"> c_handler</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GClosureNotify</span><span class="normal"> destroy_data</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GConnectFlags</span><span class="normal"> connect_flags</span><span class="symbol">);</span></pre></td> </tr> </tbody> </table> </div> <p> Their detailed_signal parameter is a string which identifies the name of the signal to connect to. However, the format of this string is structured to look like <span class="emphasis"><em>signal_name::detail_name</em></span>. Connecting to the signal named <span class="emphasis"><em>notify::cursor_position</em></span> will actually connect to the signal named <span class="emphasis"><em>notify</em></span> with the <span class="emphasis"><em>cursor_position</em></span> name. Internally, the detail string is transformed to a GQuark if it is present. </p> <p> Of the four main signal emission functions, three have an explicit detail parameter as a <a href="https://developer.gnome.org/glib/unstable/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> again: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3 4 5 6 7 8 9 10 11 12</pre></td> <td class="listing_code"><pre class="programlisting"><span class="type">void</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-emitv">g_signal_emitv</a></span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GValue</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">instance_and_params</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> signal_id</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GQuark</span><span class="normal"> detail</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GValue</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">return_value</span><span class="symbol">);</span> <span class="type">void</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-emit-valist">g_signal_emit_valist</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> signal_id</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GQuark</span><span class="normal"> detail</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">va_list</span><span class="normal"> var_args</span><span class="symbol">);</span> <span class="type">void</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-emit">g_signal_emit</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">guint</span><span class="normal"> signal_id</span><span class="symbol">,</span> <span class="normal"> </span><span class="usertype">GQuark</span><span class="normal"> detail</span><span class="symbol">,</span> <span class="normal"> </span><span class="symbol">...);</span></pre></td> </tr> </tbody> </table> </div> <p> The fourth function hides it in its signal name parameter: </p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3</pre></td> <td class="listing_code"><pre class="programlisting"><span class="type">void</span><span class="normal"> </span><span class="function"><a href="gobject-Signals.html#g-signal-emit-by-name">g_signal_emit_by_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> instance</span><span class="symbol">,</span> <span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">detailed_signal</span><span class="symbol">,</span> <span class="normal"> </span><span class="symbol">...);</span></pre></td> </tr> </tbody> </table> </div> <p> The format of the detailed_signal parameter is exactly the same as the format used by the <code class="function"><a class="link" href="gobject-Signals.html#g-signal-connect" title="g_signal_connect()">g_signal_connect</a></code> functions: <span class="emphasis"><em>signal_name::detail_name</em></span>. </p> <p> If a detail is provided by the user to the emission function, it is used during emission to match against the closures which also provide a detail. If the closures' detail does not match the detail provided by the user, they will not be invoked (even though they are connected to a signal which is being emitted). </p> <p> This completely optional filtering mechanism is mainly used as an optimization for signals which are often emitted for many different reasons: the clients can filter out which events they are interested in before the closure's marshalling code runs. For example, this is used extensively by the <span class="emphasis"><em>notify</em></span> signal of GObject: whenever a property is modified on a GObject, instead of just emitting the <span class="emphasis"><em>notify</em></span> signal, GObject associates as a detail to this signal emission the name of the property modified. This allows clients who wish to be notified of changes to only one property to filter most events before receiving them. </p> <p> As a simple rule, users can and should set the detail parameter to zero: this will disable completely this optional filtering. </p> </div> <div class="footnotes"> <br><hr style="width:100; text-align:left;margin-left: 0"> <div id="ftn.id-1.3.5.3.7.2.3.4.1.1" class="footnote"><p><a href="#id-1.3.5.3.7.2.3.4.1.1" class="para"><sup class="para">[8] </sup></a> James (again!!) gives a few non-trivial examples of accumulators: <span class="quote">“<span class="quote"> For instance, you may have an accumulator that ignores NULL returns from closures, and only accumulates the non-NULL ones. Another accumulator may try to return the list of values returned by the closures. </span>”</span> </p></div> <div id="ftn.id-1.3.5.3.8.3.2" class="footnote"><p><a href="#id-1.3.5.3.8.3.2" class="para"><sup class="para">[9] </sup></a>A GQuark is an integer which uniquely represents a string. It is possible to transform back and forth between the integer and string representations with the functions <code class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Quarks.html#g-quark-from-string">g_quark_from_string</a></code> and <code class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Quarks.html#g-quark-to-string">g_quark_to_string</a></code>. </p></div> </div> </div> <div class="footer"> <hr> Generated by GTK-Doc V1.21.1</div> </body> </html>
{ "pile_set_name": "Github" }
<?php /** Lingua Franca Nova (Lingua Franca Nova) * * @ingroup Language * @file * * @author Cgboeree * @author Kaganer * @author Malafaya * @author Reedy * @author Urhixidur */ $namespaceNames = array( NS_SPECIAL => 'Spesial', NS_TALK => 'Discute', NS_USER => 'Usor', NS_USER_TALK => 'Usor_Discute', NS_PROJECT_TALK => '$1_Discute', NS_FILE => 'Fix', NS_FILE_TALK => 'Fix_Discute', NS_TEMPLATE => 'Model', NS_TEMPLATE_TALK => 'Model_Discute', NS_HELP => 'Aida', NS_HELP_TALK => 'Aida_Discute', NS_CATEGORY => 'Categoria', NS_CATEGORY_TALK => 'Categoria_Discute', ); $specialPageAliases = array( 'Newimages' => array( 'FixesNova' ), 'Newpages' => array( 'PajesNova' ), );
{ "pile_set_name": "Github" }
<_>2.*2 <_>2 <_+>4 <_>2.*3 <_>4 <6> <6+> <_+>2. <_+>4 <6> <6+> <_> <_+>4. <6>8 <_>4 <4> <3> <_>2. <6>8. <6+>16 <_>4 <6+>8 <5> <_+>2 <_>8 <6> <_>4 <4> <3> <_+>2. <_!> <_> <_>2 <6>4 <6>2. <_>2.*2 <_+>2. <6>2 <6+>4 <_>2. <_>4 <6> <6+> <_>2. <_+> <_>2.*2 <_>2 <6>4 <_+>2 <6>4 <_>2 <6+>4 <_+>2. <_>4 <7> <5> <_+>2. <_+> <_+> <_+>4 <6>2 <_>4 <6>2 <4>4 <3>2 <_+>2. <_> <_+> <_>2. <5>4 <6> <_+> <6>4 <4 6>2 <_>2. <2 4>4 <5!>2 <_> <_+>4 <6> <6+>2 <_+>2. <_>2 <6>4 <_>2.*3 <_>2 <4 6>8 <6+> <_>2. <5>8 <6> <_> <6> <6+>4 <_>2. <_+>2 <6>8 <6+> <_>2 <4+ 6>4 %% page 254 <6>8 <6+> <6>4 <4>8 <3> <_>2. <_>4 <6> <4> <3+> <_+>2. <_>4 <6> <5!> <_>2. <_>4 <6>8 <5> <5!>4 <_>4. <6>8 <6>2 <_>2. <_>2 <6+>4 <_>2 <6>4 <_>2 <7>8 <6> <_+>2. <_>2 <6>4 <_>2 <6>8 <_+> <_>2. <_>2 <4 6>8 <6> <6>4 <6>2 <_>4 <6> <5!> <4>2. <_> <_>4 <5!>2 <_> <4 6>4 <_+>4 <6>2 <7>4 <6> <_+> <_> <_+>2 <6>2. <_+>2 <6>8 <6+> <_>2. <_>4 <6>2 <7>4 <6> <_> <_>2. <6> <_>2 <5!>4 <_>2 <4 6>4 <_+> <6>2 <7>4 <6> <_+> <_> <_+>2 <_>1 <_>2 <6> <_> <4>4 <3> <6>1 <_+>2 <6>
{ "pile_set_name": "Github" }
>>> Flow 1 (client to server) 00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| 00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| 00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| 00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| 00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| 00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| 00000080 01 00 00 12 00 00 |......| >>> Flow 2 (server to client) 00000000 16 03 03 00 59 02 00 00 55 03 03 b3 7f 4e e7 11 |....Y...U....N..| 00000010 6d bc 56 ec 9c a8 61 08 d6 5a 2a 42 7b f1 94 0a |m.V...a..Z*B{...| 00000020 29 35 8b 7e 23 a0 6c 59 23 cf 39 20 84 09 b6 5b |)5.~#.lY#.9 ...[| 00000030 2f 46 80 3b 26 92 fd 81 e9 24 8c e2 b8 64 a2 03 |/F.;&....$...d..| 00000040 3a 68 c3 7b 44 f8 28 41 e2 d3 6c 7c c0 09 00 00 |:h.{D.(A..l|....| 00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| 00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| 00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| 00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| 00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| 000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| 000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| 000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| 000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| 000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| 000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| 00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| 00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| 00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| 00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| 00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| 00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| 00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| 00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| 00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| 00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| 000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| 000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| 000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| 000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| 000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| 000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| 00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| 00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| 00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| 00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| 00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| 00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| 00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| 00000270 2a 16 03 03 00 d7 0c 00 00 d3 03 00 17 41 04 0f |*............A..| 00000280 4d b0 41 d4 dc 6b 8a 85 52 eb eb 18 4a 8f a7 e6 |M.A..k..R...J...| 00000290 24 52 e5 86 be 57 d7 0a e7 23 84 a8 a9 6c 96 08 |$R...W...#...l..| 000002a0 4b f7 47 32 79 d9 df 81 f6 05 40 63 3b 14 67 3b |K.G2y.....@c;.g;| 000002b0 ea 01 a0 0d 43 1a 36 29 b3 51 7a e4 af 1b 67 04 |....C.6).Qz...g.| 000002c0 03 00 8a 30 81 87 02 42 01 8e 57 8a b8 b7 5b 2f |...0...B..W...[/| 000002d0 9c 31 74 d8 7d 68 d7 6e 83 73 5f fb d0 cd de 66 |.1t.}h.n.s_....f| 000002e0 60 fa 0a 0a 15 0b 30 3b 08 b6 f1 3e 4f 20 13 62 |`.....0;...>O .b| 000002f0 b5 ff 86 81 dc 42 a1 4c af c8 ff b3 24 81 d8 e1 |.....B.L....$...| 00000300 d1 09 0c 32 11 92 5e dd 3f 87 02 41 76 a7 29 48 |...2..^.?..Av.)H| 00000310 52 68 1c 72 4d d5 39 bf fa 61 ec b2 27 ce 10 4e |Rh.rM.9..a..'..N| 00000320 86 12 3d 1e 04 9c 11 b7 b4 0c cf 98 9d 01 c3 93 |..=.............| 00000330 cf 83 9e 92 9a ca fd 8f b1 9f 1b 20 c4 fb a4 46 |........... ...F| 00000340 60 fc fd d5 33 b0 8f b5 b5 c8 a4 70 c5 16 03 03 |`...3......p....| 00000350 00 2e 0d 00 00 26 03 01 02 40 00 1e 06 01 06 02 |.....&...@......| 00000360 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| 00000370 03 02 03 03 02 01 02 02 02 03 00 00 0e 00 00 00 |................| >>> Flow 3 (client to server) 00000000 16 03 03 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| 00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| 00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| 00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| 00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| 00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| 00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| 00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| 00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| 00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| 000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| 000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| 000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| 000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| 000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| 000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| 00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| 00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| 00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| 00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |[email protected]| 00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| 00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| 00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| 00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| 00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| 00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| 000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| 000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| 000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| 000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| 000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| 000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| 00000200 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| 00000210 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| 00000220 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| 00000230 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| 00000240 a6 b5 68 1a 41 03 56 6b dc 5a 89 16 03 03 00 88 |..h.A.Vk.Z......| 00000250 0f 00 00 84 05 01 00 80 02 19 16 cc 97 ad 70 20 |..............p | 00000260 bd 64 63 dd b6 81 a0 16 b3 46 4b 42 ff 21 58 2c |.dc......FKB.!X,| 00000270 bb 2b 4c e1 4e d7 49 4d 5c 7c 63 32 3e ef e6 ad |.+L.N.IM\|c2>...| 00000280 85 3f ab b4 5c 2a 37 76 8b 28 56 08 4f 08 b9 51 |.?..\*7v.(V.O..Q| 00000290 71 14 07 27 47 45 11 a0 03 cf 72 7d 67 ef 31 8d |q..'GE....r}g.1.| 000002a0 e7 db 36 76 b1 b3 f4 bf aa 6c c4 56 94 35 71 e1 |..6v.....l.V.5q.| 000002b0 dd 88 6d 15 90 c8 70 ad d8 95 55 42 9b c1 45 19 |..m...p...UB..E.| 000002c0 36 ce 87 c6 fd 94 8a d4 98 6e ec 18 d5 da 59 54 |6........n....YT| 000002d0 80 a7 8c 90 ae 55 20 1c 14 03 03 00 01 01 16 03 |.....U .........| 000002e0 03 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| 000002f0 00 00 00 58 fe bc 5c ba b2 a9 96 77 2f 95 c9 10 |...X..\....w/...| 00000300 fd 6d fc 6a 88 8c df 82 c3 a4 3d cc 28 f4 bf 7d |.m.j......=.(..}| 00000310 4a f8 3d 97 36 e5 a0 76 92 94 da dd cc f5 e4 0e |J.=.6..v........| 00000320 7a c4 2c |z.,| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 81 ab 5a 66 a8 |[email protected].| 00000010 0f a5 d3 07 00 66 45 1f 31 a9 ef f7 a0 d9 23 46 |.....fE.1.....#F| 00000020 f0 3e 50 18 99 e3 5a bd eb b7 1d 81 d5 95 d5 ee |.>P...Z.........| 00000030 21 31 41 4b 19 92 b5 95 36 da 21 c0 4a 2a a0 1c |!1AK....6.!.J*..| 00000040 a3 9f 8e a0 6f 9d 37 5e 12 11 03 |....o.7^...| >>> Flow 5 (client to server) 00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| 00000010 00 00 00 00 00 a9 51 94 19 72 ab 9f 3e 97 5e 99 |......Q..r..>.^.| 00000020 2c ec 13 48 3e 10 54 5f 8a 85 88 4d 1a a8 f5 ed |,..H>.T_...M....| 00000030 c3 4f a9 59 a3 15 03 03 00 30 00 00 00 00 00 00 |.O.Y.....0......| 00000040 00 00 00 00 00 00 00 00 00 00 25 00 6d 2f a0 f6 |..........%.m/..| 00000050 ce 8a 30 ba 53 da 97 c6 11 f3 d2 f3 9e 66 d6 dd |..0.S........f..| 00000060 19 f3 ee 07 03 d3 e6 f1 30 32 |........02|
{ "pile_set_name": "Github" }
// Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// <summary> /// Converts the colors of the image recreating Protanopia (Red-Blind) color blindness. /// </summary> public sealed class ProtanopiaProcessor : FilterProcessor { /// <summary> /// Initializes a new instance of the <see cref="ProtanopiaProcessor"/> class. /// </summary> public ProtanopiaProcessor() : base(KnownFilterMatrices.ProtanopiaFilter) { } } }
{ "pile_set_name": "Github" }
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <errno.h> #include "grap.h" #include "y.tab.h" Infile infile[10]; Infile *curfile = infile; #define MAXSRC 50 Src src[MAXSRC]; /* input source stack */ Src *srcp = src; void pushsrc(int type, char *ptr) /* new input source */ { if (++srcp >= src + MAXSRC) ERROR "inputs nested too deep" FATAL; srcp->type = type; srcp->sp = ptr; if (dbg) { printf("\n%3d ", srcp - src); switch (srcp->type) { case File: printf("push file %s\n", ptr); break; case Macro: printf("push macro <%s>\n", ptr); break; case Char: printf("push char <%c>\n", *ptr); break; case Thru: printf("push thru\n"); break; case String: printf("push string <%s>\n", ptr); break; case Free: printf("push free <%s>\n", ptr); break; default: ERROR "pushed bad type %d", srcp->type FATAL; } } } void popsrc(void) /* restore an old one */ { if (srcp <= src) ERROR "too many inputs popped" FATAL; if (dbg) { printf("%3d ", srcp - src); switch (srcp->type) { case File: printf("pop file\n"); break; case Macro: printf("pop macro\n"); break; case Char: printf("pop char <%c>\n", *srcp->sp); break; case Thru: printf("pop thru\n"); break; case String: printf("pop string\n"); break; case Free: printf("pop free\n"); break; default: ERROR "pop weird input %d", srcp->type FATAL; } } srcp--; } void definition(char *s) /* collect definition for s and install */ /* definitions picked up lexically */ { char *p; Obj *stp; p = delimstr("definition"); stp = lookup(s, 0); if (stp != NULL) { /* it's there before */ if (stp->type != DEFNAME) { ERROR "%s used as variable and definition", s WARNING; return; } free(stp->val); } else { stp = lookup(s, 1); stp->type = DEFNAME; } stp->val = p; dprintf("installing %s as `%s'\n", s, p); } char *delimstr(char *s) /* get body of X ... X */ /* message if too big */ { int c, delim, rdelim, n, deep; static char *buf = NULL; static int nbuf = 0; char *p; if (buf == NULL) buf = grow(buf, "buf", nbuf += 1000, sizeof(buf[0])); while ((delim = input()) == ' ' || delim == '\t' || delim == '\n') ; rdelim = baldelim(delim, "{}"); /* could be "(){}[]`'" */ deep = 1; for (p = buf; ; ) { c = input(); if (c == rdelim) if (--deep == 0) break; if (c == delim) deep++; if (p >= buf + nbuf) { n = p - buf; buf = grow(buf, "buf", nbuf += 1000, sizeof(buf[0])); p = buf + n; } if (c == EOF) ERROR "end of file in %s %c %.20s... %c", s, delim, buf, delim FATAL; *p++ = c; } *p = '\0'; dprintf("delimstr %s %c <%s> %c\n", s, delim, buf, delim); return tostring(buf); } baldelim(int c, char *s) /* replace c by balancing entry in s */ { for ( ; *s; s += 2) if (*s == c) return s[1]; return c; } Arg args[10]; /* argument frames */ Arg *argfp = args; /* frame pointer */ int argcnt; /* number of arguments seen so far */ void dodef(Obj *stp) /* collect args and switch input to defn */ { int i, len; char *p; Arg *ap; ap = argfp+1; if (ap >= args+10) ERROR "arguments too deep" FATAL; argcnt = 0; if (input() != '(') ERROR "disaster in dodef" FATAL; if (ap->argval == 0) ap->argval = malloc(1000); for (p = ap->argval; (len = getarg(p)) != -1; p += len) { ap->argstk[argcnt++] = p; if (input() == ')') break; } for (i = argcnt; i < MAXARGS; i++) ap->argstk[i] = ""; if (dbg) for (i = 0; i < argcnt; i++) printf("arg %d.%d = <%s>\n", ap-args, i+1, ap->argstk[i]); argfp = ap; pushsrc(Macro, stp->val); } getarg(char *p) /* pick up single argument, store in p, return length */ { int n, c, npar; n = npar = 0; for ( ;; ) { c = input(); if (c == EOF) ERROR "end of file in getarg!" FATAL; if (npar == 0 && (c == ',' || c == ')')) break; if (c == '"') /* copy quoted stuff intact */ do { *p++ = c; n++; } while ((c = input()) != '"' && c != EOF); else if (c == '(') npar++; else if (c == ')') npar--; n++; *p++ = c; } *p = 0; unput(c); return(n + 1); } #define PBSIZE 2000 char pbuf[PBSIZE]; /* pushback buffer */ char *pb = pbuf-1; /* next pushed back character */ char ebuf[200]; /* collect input here for error reporting */ char *ep = ebuf; int begin = 0; extern int thru; extern Obj *thrudef; extern char *untilstr; input(void) { register int c; if (thru && begin) { do_thru(); begin = 0; } c = nextchar(); dprintf(" <%c>", c); if (ep >= ebuf + sizeof ebuf) ep = ebuf; return *ep++ = c; } nextchar(void) { register int c; loop: switch (srcp->type) { case Free: /* free string */ free(srcp->sp); popsrc(); goto loop; case Thru: /* end of pushed back line */ begin = 1; popsrc(); c = '\n'; break; case Char: if (pb >= pbuf) { c = *pb--; popsrc(); break; } else { /* can't happen? */ popsrc(); goto loop; } case String: c = *srcp->sp++; if (c == '\0') { popsrc(); goto loop; } else { if (*srcp->sp == '\0') /* empty, so pop */ popsrc(); break; } case Macro: c = *srcp->sp++; if (c == '\0') { if (--argfp < args) ERROR "argfp underflow" FATAL; popsrc(); goto loop; } else if (c == '$' && isdigit(*srcp->sp)) { /* $3 */ int n = 0; while (isdigit(*srcp->sp)) n = 10 * n + *srcp->sp++ - '0'; if (n > 0 && n <= MAXARGS) pushsrc(String, argfp->argstk[n-1]); goto loop; } break; case File: c = getc(curfile->fin); if (c == EOF) { if (curfile == infile) ERROR "end of file inside .G1/.G2" FATAL; if (curfile->fin != stdin) { fclose(curfile->fin); free(curfile->fname); /* assumes allocated */ } curfile--; printf(".lf %d %s\n", curfile->lineno, curfile->fname); popsrc(); thru = 0; /* chicken out */ thrudef = 0; if (untilstr) { free(untilstr); untilstr = 0; } goto loop; } if (c == '\n') curfile->lineno++; break; } return c; } void do_thru(void) /* read one line, make into a macro expansion */ { int c, i; char *p; Arg *ap; ap = argfp+1; if (ap >= args+10) ERROR "arguments too deep" FATAL; if (ap->argval == NULL) ap->argval = malloc(1000); p = ap->argval; argcnt = 0; c = nextchar(); if (thru == 0) { /* end of file was seen, so thru is done */ unput(c); return; } for ( ; c != '\n' && c != EOF; ) { if (c == ' ' || c == '\t') { c = nextchar(); continue; } if (argcnt >= MAXARGS) ERROR "too many fields on input line" FATAL; ap->argstk[argcnt++] = p; if (c == '"') { do { *p++ = c; if ((c = nextchar()) == '\\') { *p++ = c; *p++ = nextchar(); c = nextchar(); } } while (c != '"' && c != '\n' && c != EOF); *p++ = '"'; if (c == '"') c = nextchar(); } else { do { *p++ = c; } while ((c = nextchar())!=' ' && c!='\t' && c!='\n' && c!=',' && c!=EOF); if (c == ',') c = nextchar(); } *p++ = '\0'; } if (c == EOF) ERROR "unexpected end of file in do_thru" FATAL; if (argcnt == 0) { /* ignore blank line */ pushsrc(Thru, (char *) 0); return; } for (i = argcnt; i < MAXARGS; i++) ap->argstk[i] = ""; if (dbg) for (i = 0; i < argcnt; i++) printf("arg %d.%d = <%s>\n", ap-args, i+1, ap->argstk[i]); if (strcmp(ap->argstk[0], ".G2") == 0) { thru = 0; thrudef = 0; pushsrc(String, "\n.G2\n"); return; } if (untilstr && strcmp(ap->argstk[0], untilstr) == 0) { thru = 0; thrudef = 0; free(untilstr); untilstr = 0; return; } pushsrc(Thru, (char *) 0); dprintf("do_thru pushing back <%s>\n", thrudef->val); argfp = ap; pushsrc(Macro, thrudef->val); } unput(int c) { if (++pb >= pbuf + sizeof pbuf) ERROR "pushback overflow" FATAL; if (--ep < ebuf) ep = ebuf + sizeof(ebuf) - 1; *pb = c; pushsrc(Char, pb); return c; } void pbstr(char *s) { pushsrc(String, s); } double errcheck(double x, char *s) { extern int errno; if (errno == EDOM) { errno = 0; ERROR "%s argument out of domain", s WARNING; } else if (errno == ERANGE) { errno = 0; ERROR "%s result out of range", s WARNING; } return x; } char errbuf[200]; void yyerror(char *s) { extern char *cmdname; int ern = errno; /* cause some libraries clobber it */ if (synerr) return; fflush(stdout); fprintf(stderr, "%s: %s", cmdname, s); if (ern > 0) { errno = ern; perror("???"); } fprintf(stderr, " near %s:%d\n", curfile->fname, curfile->lineno+1); eprint(); synerr = 1; errno = 0; } void eprint(void) /* try to print context around error */ { char *p, *q; p = ep - 1; if (p > ebuf && *p == '\n') p--; for ( ; p >= ebuf && *p != '\n'; p--) ; while (*p == '\n') p++; fprintf(stderr, " context is\n\t"); for (q=ep-1; q>=p && *q!=' ' && *q!='\t' && *q!='\n'; q--) ; for (; p < q; p++) if (isprint(*p)) putc(*p, stderr); fprintf(stderr, " >>> "); for (; p < ep; p++) if (isprint(*p)) putc(*p, stderr); fprintf(stderr, " <<< "); while (pb >= pbuf) putc(*pb--, stderr); fgets(ebuf, sizeof ebuf, curfile->fin); fprintf(stderr, "%s", ebuf); pbstr("\n.G2\n"); /* safety first */ ep = ebuf; } int yywrap(void) {return 1;} char *newfile = 0; /* filename for file copy */ char *untilstr = 0; /* string that terminates a thru */ int thru = 0; /* 1 if copying thru macro */ Obj *thrudef = 0; /* macro being used */ void copyfile(char *s) /* remember file to start reading from */ { newfile = s; } void copydef(Obj *p) /* remember macro Obj */ { thrudef = p; } Obj *copythru(char *s) /* collect the macro name or body for thru */ { Obj *p; char *q; p = lookup(s, 0); if (p != NULL) { if (p->type == DEFNAME) { p->val = addnewline(p->val); return p; } else ERROR "%s used as define and name", s FATAL; } /* have to collect the definition */ pbstr(s); /* first char is the delimiter */ q = delimstr("thru body"); p = lookup("nameless", 1); if (p != NULL) if (p->val) free(p->val); p->type = DEFNAME; p->val = q; p->val = addnewline(p->val); dprintf("installing nameless as `%s'\n", p->val); return p; } char *addnewline(char *p) /* add newline to end of p */ { int n; n = strlen(p); if (p[n-1] != '\n') { p = realloc(p, n+2); p[n] = '\n'; p[n+1] = '\0'; } return p; } void copyuntil(char *s) /* string that terminates a thru */ { untilstr = s; } void copy(void) /* begin input from file, etc. */ { FILE *fin; if (newfile) { if ((fin = fopen(newfile, "r")) == NULL) ERROR "can't open file %s", newfile FATAL; curfile++; curfile->fin = fin; curfile->fname = tostring(newfile); curfile->lineno = 0; printf(".lf 1 %s\n", curfile->fname); pushsrc(File, curfile->fname); newfile = 0; } if (thrudef) { thru = 1; begin = 1; /* wrong place */ } } char shellbuf[1000], *shellp; void shell_init(void) /* set up to interpret a shell command */ { fprintf(tfd, "# shell cmd...\n"); sprintf(shellbuf, "rc -c '"); shellp = shellbuf + strlen(shellbuf); } void shell_text(char *s) /* add string to command being collected */ { /* fprintf(tfd, "#add <%s> to <%s>\n", s, shellbuf); */ while (*s) { if (*s == '\'') { /* protect interior quotes */ *shellp++ = '\''; *shellp++ = '\\'; *shellp++ = '\''; } *shellp++ = *s++; } } void shell_exec(void) /* do it */ { /* fprintf(tfd, "# run <%s>\n", shellbuf); */ *shellp++ = '\''; *shellp = '\0'; system(shellbuf); }
{ "pile_set_name": "Github" }