text
stringlengths
1
22.8M
The 1922 Louisiana Tech Bulldogs football team was an American football team that represented the Louisiana Polytechnic Institute—now known as Louisiana Tech University—as a member of the Louisiana Intercollegiate Athletic Association (LIAA) during the 1922 college football season. Led by first-year head coach William Henry Dietz, Louisiana Tech compiled an overall record of 5–1–1. The team's captain was Edgar L. Walker. Schedule References Louisiana Tech Louisiana Tech Bulldogs football seasons Louisiana Tech Bulldogs football
Terrace Bay is a township in Thunder Bay District in northern Ontario, Canada, located on the north shore of Lake Superior east of Thunder Bay along Highway 17. The name originates from a series of lake terraces formed as the water level in Lake Superior lowered following the latest ice age. History Terrace Bay originated as a company town in the 1940s when a pulp and paper mill was established there by the Longlac Pulp & Paper Company, later renamed Kimberly-Clark Forest Products. At the same time, the Aguasabon Generating Station was created by the Ontario Hydro water division, to redirect the northward flowing Long Lake south through the Aguasabon River system to Lake Superior. On September 1, 1947, Terrace Bay was granted status as an Improvement District. The pulp mill was the lead developer with construction of the community's basic infrastructure. By the end of 1948, Terrace Bay consisted of about 230 houses serviced with sewer, water and electricity but surrounded only by bush as the highway was still not completed through the town. In 1951, the Lakeview subdivision was started, with sewer, water and electrical services provided for well over 100 houses. By December 31, 33 of the 35 new houses were completed and occupied. Other additions to the community were two new churches, 22-bed modern hospital, post office, bank, liquor store, theatre, clothing store and railway station. Construction of the Memorial Recreation Centre was completed in July 1953. The building consisted of an arena, curling club, restaurant, bowling alley, library, offices, three meeting rooms and public washrooms. In 1958, the mill converted to chlorine dioxide bleaching and had sold 63 houses to employees and another 28 houses were privately built. The next year, Terrace Bay became a municipal township. In 1972, the Kimberly Clark Pulp and Paper Company Ltd. and Kimberly Clark of Canada Ltd. amalgamated. From 1972 to 1977 the population of Terrace Bay increased from 1,755 to 2,299 persons, directly attributed to Kimberly Clark's expansion program. The pulp mill was the lifeblood of the region and in 2005 Kimberly-Clark sold the mill to Neenah Paper Inc, who then sold the mill to Buchanan Forestry Products in 2006. The mill was renamed to Terrace Bay Pulp Inc. It operated until it ran into financial hardship and was shut down in 2009. After financial reorganization, it reopened in October 2010 to strong pulp markets. However, soon thereafter the mill ran into financial trouble again and had to declare bankruptcy and look for a buyer. In July 2012, the Aditya Birla Group agreed to purchase the mill. The municipality carried out a plan for growth in 2010/2011 including the downtown revitalization plan, the cultural centre project, and a rebranding of the township based on Lake Superior and the new Terrace Bay Lighthouse attraction that was built. The community continues to look at new ways to encourage job growth and support the business community. Amenities Terrace Bay's McCausland Hospital is a modern, fully accredited 45-bed community hospital. It serves a population of approximately 4,000 residents from the communities of Terrace Bay, Schreiber, Rossport, Jackfish and Pays Plat. Named for the town's first physician, Michael McCausland, the present structure was built in 1980 and is situated overlooking the shores of Lake Superior. The McCausland Hospital expanded in May 2011 with the creation of the Wilkes Terrace 22-bed long-term care facility. The Aguasabon Medical Clinic is located in the McCausland Hospital and has a full complement of physicians with same-day medical service. Upon moving to Terrace Bay and visiting the clinic, new residents are immediately assigned their own family physician. The town has three elementary schools: Terrace Bay Public School, St. Martin's Catholic School, and École Catholique Franco-Terrace. Lake Superior High School accommodates students from surrounding communities. The town's Recreation Centre holds a hockey arena, outdoor pool, curling rink, fitness centre, bowling alley, and various athletic courts. During the summer months, the Aquasabon Golf Course opens and during the winter months, the Trestle Ridge Ski Hill. The Voyageur Hiking Trail passes through the community. The Terrace Bay Cultural Centre was built in October 2010 which includes the expanded Terrace Bay Public Library, the Terrace Bay Seniors' Activity Centre, and the Michael King Community Hall. The large majority of businesses, including a grocery store, pharmacy, post office, Liquor Control Board of Ontario (LCBO), flower shop, gift shops, outdoor supply store, stationery and print shop, Canadian Imperial Bank of Commerce (CIBC) bank and various restaurants are located on the main street, Simcoe Plaza, which saw a major revitalization effort in 2011. Simcoe Plaza had renovations, landscaping, streetscaping, and the construction of a lighthouse attraction for visitors to climb and take in views of Lake Superior, the nearby Slate Islands, and the rest of the municipality. Terrace Bay boasts a multitude of sandy beaches on the shores of Lake Superior as well as smaller inland lakes. Accessible by vehicle and hiking trails, the Lake Superior beaches boast waves in late summer that bring a variety of water sport lovers to the town, including surfers and body boarders. The inland lakes provide warm sheltered swimming for the many hikers and campers who come to the area. Climate Terrace Bay has a humid continental climate (Koppen: Dfb), bordering on a subarctic climate (Koppen: Dfc) with September having an average of only 1.8°F (1°C) more than the 50 degree isotherm used to determine subarctic climates. Summers are very mild due to the moderation of nearby Lake Superior, with the warmest month, August, only having an average high of 68.4 degrees Fahrenheit (20.2 c). Winters are long, cold, and snowy, averaging of snow per year. Terrace Bay shows signs of seasonal lag, with August being warmer on average than July, likely due to the towns proximity to Lake Superior, which causes towns on the lake influenced by the lake, to take longer to warm up than towns not on or near the lake. Demographics In the 2021 Census of Population conducted by Statistics Canada, Terrace Bay had a population of living in of its total private dwellings, a change of from its 2016 population of . With a land area of , it had a population density of in 2021. Slate Islands The Slate Islands, now a provincial park, are located in Lake Superior within Terrace Bay's municipal limits. The island features the highest lighthouse on Lake Superior, the largest known shatter cone in the world, abandoned gold mines, and wildlife including the largest unthreatened boreal woodland caribou population in Canada. Visitors can book charters to the Slate Islands by local tourist outfitters. Dragfest In 1999, local car enthusiasts' group Superior Classics Car Club began the annual three-day drag racing event known as Terrace Bay's Dragfest. In 1999 it had 187 competitors participating, which grew to over 300 in 2010, with spectators now numbering over 10,000. Most drivers originate from the Thunder Bay area, but the event has also attracted participants from Southern Ontario, Winnipeg, and Minnesota. Over its twenty-year history, the race has been financially successful, allowing continued investment into permanent and improved facilities for competitors and spectators. Money has also been used to support local service clubs and charities, with total donations exceeding $150,000. Major recipients include the Camp Quality, Thunder Bay Regional Health Sciences Centre, Terrace Bay McCausland Hospital, local fire departments, ambulances, food bank, and animal shelters. Notable people Brenda Chapman, writer Rick Jeanneret, broadcaster Aaron MacKenzie, hockey player Danny Schock, hockey player Ron Schock, hockey player Charlie Simmer, hockey player See also List of townships in Ontario List of francophone communities in Ontario References External links Designated places in Ontario Municipalities in Thunder Bay District Single-tier municipalities in Ontario Township municipalities in Ontario Populated places on Lake Superior in Canada
Grace Christian University is a private evangelical Christian university in Wyoming, Michigan. It is accredited by the Higher Learning Commission and the Association for Biblical Higher Education to award associate, baccalaureate, and graduate degrees. The university is affiliated with the Grace Gospel Fellowship. History Grace Christian University began in 1939 as an evening Bible institute, led by Charles F. Baker. It was an outgrowth of the late 19th-century Bible college movement. Initially, the main purpose of Grace was to train Sunday School teachers and church members of the Fundamental Bible Church, which was led by Pastor Charles F. Baker in Milwaukee, Wisconsin. In 1945, the program expanded to a day school called Milwaukee Bible Institute, which was founded by John C. O’Hair, a teacher of ultra-dispensationalism. In 1853, it was then renamed Milwaukee Bible College as curricular options were added. Charles Baker served as president at this time. In 1961, the college moved from Milwaukee, Wisconsin to Wyoming, Michigan, a suburb of Grand Rapids. Its name was changed to Grace Bible College. Grace was granted authority from the State of Michigan to give Associate and Bachelor of Religious Education degrees, as well as a five-year degree for vocational ministers. In 1967, Grace received accreditation from the Association of American Biblical Colleges, now called the Association of Biblical Higher Education. Since then, the degree programs have expanded to include Associate of Arts degrees, Bachelor of Science degrees and Master of Arts degrees. In 2010, Grace began offering online education, allowing students to continue with their education exclusively online. In 2017, the college’s name was officially changed from Grace Bible College to Grace Christian University by a unanimous vote of the Board of Directors. Officially, the change took place on July 1, 2018. Grace Christian University incorporates the study of the Bible as a core value in every degree program. Successive presidents of Grace have been Jack T. Dean, Samuel Vinton, Jr., Bruce Kemper, and Ken B. Kemper, who is the current president. Academics Today, the university has programs across numerous majors such as business, education, exercise science, history, human services, and others. Its most popular majors, by 2021 graduates, were: Lay Ministry (28) Human Services (25) Psychology (12) Business/Commerce (11) Bible/Biblical Studies (10) Grace Christian University offers a variety of degrees both on campus and online. Each degree at Grace integrates a biblical focus, with required Bible credits. Students have the opportunity to earn associate, bachelor, or master’s degrees. On-campus undergraduate degrees: AA Business BS Business BS Business Management BS Business Marketing BS Communication AA General Studies BS Interdisciplinary Studies BS Interdisciplinary Studies (+Dual Degree) BS Biblical Studies BS Leadership & Ministry BS Criminal Justice BS Human Services BS Psychology AA Social Science Online undergraduate degrees: AA Business BS Business BS Communication AA General Studies AA Leadership & Ministry BS Leadership & Ministry BS Criminal Justice BS Human Services BS Psychology AA Social Science Online master’s degrees: MA Higher Education Leadership MA Ministry MA Organizational Leadership MBA Business Administration In 2018, the institution changed its name to Grace Christian University to reflect its broader educational mission. Campus Life Housing Grace Christian University offers dorm rooms, apartments, married housing, and townhomes. The men’s dorm, Preston Hall, houses 40 students with two students per room. Aletheia Hall is a similar dorm that houses 40 women. Grace is also home to eight, double-occupancy apartments, married housing apartments, as well as new townhomes that were built in 2022 and house more than 100 students. References External links Official website Association for Biblical Higher Education Liberal arts colleges in Michigan Bible colleges in the United States Universities and colleges established in 1945 Universities and colleges in Kent County, Michigan 1945 establishments in Michigan Private universities and colleges in Michigan
```javascript /* PrismJS 1.28.0 path_to_url#themes=prism&languages=markup+css+clike+javascript+bash+dart+go+java+kotlin+latex+markup-templating+matlab+mongodb+php+python+ruby+rust+sql+swift+systemd+typoscript+yaml&plugins=line-numbers+toolbar+copy-to-clipboard */ var _self = "undefined" != typeof window ? window : "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope ? self : {}, Prism = function (e) { var n = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, t = 0, r = {}, a = { manual: e.Prism && e.Prism.manual, disableWorkerMessageHandler: e.Prism && e.Prism.disableWorkerMessageHandler, util: { encode: function e(n) { return n instanceof i ? new i(n.type, e(n.content), n.alias) : Array.isArray(n) ? n.map(e) : n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ") }, type: function (e) { return Object.prototype.toString.call(e).slice(8, -1) }, objId: function (e) { return e.__id || Object.defineProperty(e, "__id", { value: ++t }), e.__id }, clone: function e(n, t) { var r, i; switch (t = t || {}, a.util.type(n)) { case "Object": if (i = a.util.objId(n), t[i]) return t[i]; for (var l in r = {}, t[i] = r, n) n.hasOwnProperty(l) && (r[l] = e(n[l], t)); return r; case "Array": return i = a.util.objId(n), t[i] ? t[i] : (r = [], t[i] = r, n.forEach((function (n, a) { r[a] = e(n, t) })), r); default: return n } }, getLanguage: function (e) { for (; e;) { var t = n.exec(e.className); if (t) return t[1].toLowerCase(); e = e.parentElement } return "none" }, setLanguage: function (e, t) { e.className = e.className.replace(RegExp(n, "gi"), ""), e.classList.add("language-" + t) }, currentScript: function () { if ("undefined" == typeof document) return null; if ("currentScript" in document) return document.currentScript; try { throw new Error } catch (r) { var e = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack) || [])[1]; if (e) { var n = document.getElementsByTagName("script"); for (var t in n) if (n[t].src == e) return n[t] } return null } }, isActive: function (e, n, t) { for (var r = "no-" + n; e;) { var a = e.classList; if (a.contains(n)) return !0; if (a.contains(r)) return !1; e = e.parentElement } return !!t } }, languages: { plain: r, plaintext: r, text: r, txt: r, extend: function (e, n) { var t = a.util.clone(a.languages[e]); for (var r in n) t[r] = n[r]; return t }, insertBefore: function (e, n, t, r) { var i = (r = r || a.languages)[e], l = {}; for (var o in i) if (i.hasOwnProperty(o)) { if (o == n) for (var s in t) t.hasOwnProperty(s) && (l[s] = t[s]); t.hasOwnProperty(o) || (l[o] = i[o]) } var u = r[e]; return r[e] = l, a.languages.DFS(a.languages, (function (n, t) { t === u && n != e && (this[n] = l) })), l }, DFS: function e(n, t, r, i) { i = i || {}; var l = a.util.objId; for (var o in n) if (n.hasOwnProperty(o)) { t.call(n, o, n[o], r || o); var s = n[o], u = a.util.type(s); "Object" !== u || i[l(s)] ? "Array" !== u || i[l(s)] || (i[l(s)] = !0, e(s, t, o, i)) : (i[l(s)] = !0, e(s, t, null, i)) } } }, plugins: {}, highlightAll: function (e, n) { a.highlightAllUnder(document, e, n) }, highlightAllUnder: function (e, n, t) { var r = { callback: t, container: e, selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code' }; a.hooks.run("before-highlightall", r), r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)), a.hooks.run("before-all-elements-highlight", r); for (var i, l = 0; i = r.elements[l++];)a.highlightElement(i, !0 === n, r.callback) }, highlightElement: function (n, t, r) { var i = a.util.getLanguage(n), l = a.languages[i]; a.util.setLanguage(n, i); var o = n.parentElement; o && "pre" === o.nodeName.toLowerCase() && a.util.setLanguage(o, i); var s = { element: n, language: i, grammar: l, code: n.textContent }; function u(e) { s.highlightedCode = e, a.hooks.run("before-insert", s), s.element.innerHTML = s.highlightedCode, a.hooks.run("after-highlight", s), a.hooks.run("complete", s), r && r.call(s.element) } if (a.hooks.run("before-sanity-check", s), (o = s.element.parentElement) && "pre" === o.nodeName.toLowerCase() && !o.hasAttribute("tabindex") && o.setAttribute("tabindex", "0"), !s.code) return a.hooks.run("complete", s), void (r && r.call(s.element)); if (a.hooks.run("before-highlight", s), s.grammar) if (t && e.Worker) { var c = new Worker(a.filename); c.onmessage = function (e) { u(e.data) }, c.postMessage(JSON.stringify({ language: s.language, code: s.code, immediateClose: !0 })) } else u(a.highlight(s.code, s.grammar, s.language)); else u(a.util.encode(s.code)) }, highlight: function (e, n, t) { var r = { code: e, grammar: n, language: t }; if (a.hooks.run("before-tokenize", r), !r.grammar) throw new Error('The language "' + r.language + '" has no grammar.'); return r.tokens = a.tokenize(r.code, r.grammar), a.hooks.run("after-tokenize", r), i.stringify(a.util.encode(r.tokens), r.language) }, tokenize: function (e, n) { var t = n.rest; if (t) { for (var r in t) n[r] = t[r]; delete n.rest } var a = new s; return u(a, a.head, e), o(e, a, n, a.head, 0), function (e) { for (var n = [], t = e.head.next; t !== e.tail;)n.push(t.value), t = t.next; return n }(a) }, hooks: { all: {}, add: function (e, n) { var t = a.hooks.all; t[e] = t[e] || [], t[e].push(n) }, run: function (e, n) { var t = a.hooks.all[e]; if (t && t.length) for (var r, i = 0; r = t[i++];)r(n) } }, Token: i }; function i(e, n, t, r) { this.type = e, this.content = n, this.alias = t, this.length = 0 | (r || "").length } function l(e, n, t, r) { e.lastIndex = n; var a = e.exec(t); if (a && r && a[1]) { var i = a[1].length; a.index += i, a[0] = a[0].slice(i) } return a } function o(e, n, t, r, s, g) { for (var f in t) if (t.hasOwnProperty(f) && t[f]) { var h = t[f]; h = Array.isArray(h) ? h : [h]; for (var d = 0; d < h.length; ++d) { if (g && g.cause == f + "," + d) return; var v = h[d], p = v.inside, m = !!v.lookbehind, y = !!v.greedy, k = v.alias; if (y && !v.pattern.global) { var x = v.pattern.toString().match(/[imsuy]*$/)[0]; v.pattern = RegExp(v.pattern.source, x + "g") } for (var b = v.pattern || v, w = r.next, A = s; w !== n.tail && !(g && A >= g.reach); A += w.value.length, w = w.next) { var E = w.value; if (n.length > e.length) return; if (!(E instanceof i)) { var P, L = 1; if (y) { if (!(P = l(b, A, e, m)) || P.index >= e.length) break; var S = P.index, O = P.index + P[0].length, j = A; for (j += w.value.length; S >= j;)j += (w = w.next).value.length; if (A = j -= w.value.length, w.value instanceof i) continue; for (var C = w; C !== n.tail && (j < O || "string" == typeof C.value); C = C.next)L++, j += C.value.length; L--, E = e.slice(A, j), P.index -= A } else if (!(P = l(b, 0, E, m))) continue; S = P.index; var N = P[0], _ = E.slice(0, S), M = E.slice(S + N.length), W = A + E.length; g && W > g.reach && (g.reach = W); var z = w.prev; if (_ && (z = u(n, z, _), A += _.length), c(n, z, L), w = u(n, z, new i(f, p ? a.tokenize(N, p) : N, k, N)), M && u(n, w, M), L > 1) { var I = { cause: f + "," + d, reach: W }; o(e, n, t, w.prev, A, I), g && I.reach > g.reach && (g.reach = I.reach) } } } } } } function s() { var e = { value: null, prev: null, next: null }, n = { value: null, prev: e, next: null }; e.next = n, this.head = e, this.tail = n, this.length = 0 } function u(e, n, t) { var r = n.next, a = { value: t, prev: n, next: r }; return n.next = a, r.prev = a, e.length++, a } function c(e, n, t) { for (var r = n.next, a = 0; a < t && r !== e.tail; a++)r = r.next; n.next = r, r.prev = n, e.length -= a } if (e.Prism = a, i.stringify = function e(n, t) { if ("string" == typeof n) return n; if (Array.isArray(n)) { var r = ""; return n.forEach((function (n) { r += e(n, t) })), r } var i = { type: n.type, content: e(n.content, t), tag: "span", classes: ["token", n.type], attributes: {}, language: t }, l = n.alias; l && (Array.isArray(l) ? Array.prototype.push.apply(i.classes, l) : i.classes.push(l)), a.hooks.run("wrap", i); var o = ""; for (var s in i.attributes) o += " " + s + '="' + (i.attributes[s] || "").replace(/"/g, "&quot;") + '"'; return "<" + i.tag + ' class="' + i.classes.join(" ") + '"' + o + ">" + i.content + "</" + i.tag + ">" }, !e.document) return e.addEventListener ? (a.disableWorkerMessageHandler || e.addEventListener("message", (function (n) { var t = JSON.parse(n.data), r = t.language, i = t.code, l = t.immediateClose; e.postMessage(a.highlight(i, a.languages[r], r)), l && e.close() }), !1), a) : a; var g = a.util.currentScript(); function f() { a.manual || a.highlightAll() } if (g && (a.filename = g.src, g.hasAttribute("data-manual") && (a.manual = !0)), !a.manual) { var h = document.readyState; "loading" === h || "interactive" === h && g && g.defer ? document.addEventListener("DOMContentLoaded", f) : window.requestAnimationFrame ? window.requestAnimationFrame(f) : window.setTimeout(f, 16) } return a }(_self); "undefined" != typeof module && module.exports && (module.exports = Prism), "undefined" != typeof global && (global.Prism = Prism); Prism.languages.markup = { comment: { pattern: /<!--(?:(?!<!--)[\s\S])*?-->/, greedy: !0 }, prolog: { pattern: /<\?[\s\S]+?\?>/, greedy: !0 }, doctype: { pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i, greedy: !0, inside: { "internal-subset": { pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/, lookbehind: !0, greedy: !0, inside: null }, string: { pattern: /"[^"]*"|'[^']*'/, greedy: !0 }, punctuation: /^<!|>$|[[\]]/, "doctype-tag": /^DOCTYPE/i, name: /[^\s<>'"]+/ } }, cdata: { pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i, greedy: !0 }, tag: { pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/, greedy: !0, inside: { tag: { pattern: /^<\/?[^\s>\/]+/, inside: { punctuation: /^<\/?/, namespace: /^[^\s>\/:]+:/ } }, "special-attr": [], "attr-value": { pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/, inside: { punctuation: [{ pattern: /^=/, alias: "attr-equals" }, { pattern: /^(\s*)["']|["']$/, lookbehind: !0 }] } }, punctuation: /\/?>/, "attr-name": { pattern: /[^\s>\/]+/, inside: { namespace: /^[^\s>\/:]+:/ } } } }, entity: [{ pattern: /&[\da-z]{1,8};/i, alias: "named-entity" }, /&#x?[\da-f]{1,8};/i] }, Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity, Prism.languages.markup.doctype.inside["internal-subset"].inside = Prism.languages.markup, Prism.hooks.add("wrap", (function (a) { "entity" === a.type && (a.attributes.title = a.content.replace(/&amp;/, "&")) })), Object.defineProperty(Prism.languages.markup.tag, "addInlined", { value: function (a, e) { var s = {}; s["language-" + e] = { pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i, lookbehind: !0, inside: Prism.languages[e] }, s.cdata = /^<!\[CDATA\[|\]\]>$/i; var t = { "included-cdata": { pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i, inside: s } }; t["language-" + e] = { pattern: /[\s\S]+/, inside: Prism.languages[e] }; var n = {}; n[a] = { pattern: RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g, (function () { return a })), "i"), lookbehind: !0, greedy: !0, inside: t }, Prism.languages.insertBefore("markup", "cdata", n) } }), Object.defineProperty(Prism.languages.markup.tag, "addAttribute", { value: function (a, e) { Prism.languages.markup.tag.inside["special-attr"].push({ pattern: RegExp("(^|[\"'\\s])(?:" + a + ")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))", "i"), lookbehind: !0, inside: { "attr-name": /^[^\s=]+/, "attr-value": { pattern: /=[\s\S]+/, inside: { value: { pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/, lookbehind: !0, alias: [e, "language-" + e], inside: Prism.languages[e] }, punctuation: [{ pattern: /^=/, alias: "attr-equals" }, /"|'/] } } } }) } }), Prism.languages.html = Prism.languages.markup, Prism.languages.mathml = Prism.languages.markup, Prism.languages.svg = Prism.languages.markup, Prism.languages.xml = Prism.languages.extend("markup", {}), Prism.languages.ssml = Prism.languages.xml, Prism.languages.atom = Prism.languages.xml, Prism.languages.rss = Prism.languages.xml; !function (s) { var e = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/; s.languages.css = { comment: /\/\*[\s\S]*?\*\//, atrule: { pattern: RegExp("@[\\w-](?:[^;{\\s\"']|\\s+(?!\\s)|" + e.source + ")*?(?:;|(?=\\s*\\{))"), inside: { rule: /^@[\w-]+/, "selector-function-argument": { pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/, lookbehind: !0, alias: "selector" }, keyword: { pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/, lookbehind: !0 } } }, url: { pattern: RegExp("\\burl\\((?:" + e.source + "|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)", "i"), greedy: !0, inside: { function: /^url/i, punctuation: /^\(|\)$/, string: { pattern: RegExp("^" + e.source + "$"), alias: "url" } } }, selector: { pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + e.source + ")*(?=\\s*\\{)"), lookbehind: !0 }, string: { pattern: e, greedy: !0 }, property: { pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i, lookbehind: !0 }, important: /!important\b/i, function: { pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i, lookbehind: !0 }, punctuation: /[(){};:,]/ }, s.languages.css.atrule.inside.rest = s.languages.css; var t = s.languages.markup; t && (t.tag.addInlined("style", "css"), t.tag.addAttribute("style", "css")) }(Prism); Prism.languages.clike = { comment: [{ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, lookbehind: !0, greedy: !0 }, { pattern: /(^|[^\\:])\/\/.*/, lookbehind: !0, greedy: !0 }], string: { pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, greedy: !0 }, "class-name": { pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i, lookbehind: !0, inside: { punctuation: /[.\\]/ } }, keyword: /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/, boolean: /\b(?:false|true)\b/, function: /\b\w+(?=\()/, number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i, operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/, punctuation: /[{}[\];(),.:]/ }; Prism.languages.javascript = Prism.languages.extend("clike", { "class-name": [Prism.languages.clike["class-name"], { pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/, lookbehind: !0 }], keyword: [{ pattern: /((?:^|\})\s*)catch\b/, lookbehind: !0 }, { pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/, lookbehind: !0 }], function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/, number: { pattern: RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"), lookbehind: !0 }, operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/ }), Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/, Prism.languages.insertBefore("javascript", "keyword", { regex: { pattern: RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"), lookbehind: !0, greedy: !0, inside: { "regex-source": { pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/, lookbehind: !0, alias: "language-regex", inside: Prism.languages.regex }, "regex-delimiter": /^\/|\/$/, "regex-flags": /^[a-z]+$/ } }, "function-variable": { pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/, alias: "function" }, parameter: [{ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/, lookbehind: !0, inside: Prism.languages.javascript }, { pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i, lookbehind: !0, inside: Prism.languages.javascript }, { pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/, lookbehind: !0, inside: Prism.languages.javascript }, { pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/, lookbehind: !0, inside: Prism.languages.javascript }], constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/ }), Prism.languages.insertBefore("javascript", "string", { hashbang: { pattern: /^#!.*/, greedy: !0, alias: "comment" }, "template-string": { pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/, greedy: !0, inside: { "template-punctuation": { pattern: /^`|`$/, alias: "string" }, interpolation: { pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/, lookbehind: !0, inside: { "interpolation-punctuation": { pattern: /^\$\{|\}$/, alias: "punctuation" }, rest: Prism.languages.javascript } }, string: /[\s\S]+/ } }, "string-property": { pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m, lookbehind: !0, greedy: !0, alias: "property" } }), Prism.languages.insertBefore("javascript", "operator", { "literal-property": { pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m, lookbehind: !0, alias: "property" } }), Prism.languages.markup && (Prism.languages.markup.tag.addInlined("script", "javascript"), Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)", "javascript")), Prism.languages.js = Prism.languages.javascript; !function (e) { var t = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b", n = { pattern: /(^(["']?)\w+\2)[ \t]+\S.*/, lookbehind: !0, alias: "punctuation", inside: null }, a = { bash: n, environment: { pattern: RegExp("\\$" + t), alias: "constant" }, variable: [{ pattern: /\$?\(\([\s\S]+?\)\)/, greedy: !0, inside: { variable: [{ pattern: /(^\$\(\([\s\S]+)\)\)/, lookbehind: !0 }, /^\$\(\(/], number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/, operator: /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/, punctuation: /\(\(?|\)\)?|,|;/ } }, { pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/, greedy: !0, inside: { variable: /^\$\(|^`|\)$|`$/ } }, { pattern: /\$\{[^}]+\}/, greedy: !0, inside: { operator: /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/, punctuation: /[\[\]]/, environment: { pattern: RegExp("(\\{)" + t), lookbehind: !0, alias: "constant" } } }, /\$(?:\w+|[#?*!@$])/], entity: /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/ }; e.languages.bash = { shebang: { pattern: /^#!\s*\/.*/, alias: "important" }, comment: { pattern: /(^|[^"{\\$])#.*/, lookbehind: !0 }, "function-name": [{ pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/, lookbehind: !0, alias: "function" }, { pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/, alias: "function" }], "for-or-select": { pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/, alias: "variable", lookbehind: !0 }, "assign-left": { pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/, inside: { environment: { pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + t), lookbehind: !0, alias: "constant" } }, alias: "variable", lookbehind: !0 }, parameter: { pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/, alias: "variable", lookbehind: !0 }, string: [{ pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/, lookbehind: !0, greedy: !0, inside: a }, { pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/, lookbehind: !0, greedy: !0, inside: { bash: n } }, { pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/, lookbehind: !0, greedy: !0, inside: a }, { pattern: /(^|[^$\\])'[^']*'/, lookbehind: !0, greedy: !0 }, { pattern: /\$'(?:[^'\\]|\\[\s\S])*'/, greedy: !0, inside: { entity: a.entity } }], environment: { pattern: RegExp("\\$?" + t), alias: "constant" }, variable: a.variable, function: { pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/, lookbehind: !0 }, keyword: { pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/, lookbehind: !0 }, builtin: { pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/, lookbehind: !0, alias: "class-name" }, boolean: { pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/, lookbehind: !0 }, "file-descriptor": { pattern: /\B&\d\b/, alias: "important" }, operator: { pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/, inside: { "file-descriptor": { pattern: /^\d/, alias: "important" } } }, punctuation: /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/, number: { pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/, lookbehind: !0 } }, n.inside = e.languages.bash; for (var s = ["comment", "function-name", "for-or-select", "assign-left", "parameter", "string", "environment", "function", "keyword", "builtin", "boolean", "file-descriptor", "operator", "punctuation", "number"], o = a.variable[1].inside, i = 0; i < s.length; i++)o[s[i]] = e.languages.bash[s[i]]; e.languages.shell = e.languages.bash }(Prism); !function (e) { var a = [/\b(?:async|sync|yield)\*/, /\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/], n = "(^|[^\\w.])(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", s = { pattern: RegExp(n + "[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b"), lookbehind: !0, inside: { namespace: { pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/, inside: { punctuation: /\./ } } } }; e.languages.dart = e.languages.extend("clike", { "class-name": [s, { pattern: RegExp(n + "[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()])"), lookbehind: !0, inside: s.inside }], keyword: a, operator: /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ }), e.languages.insertBefore("dart", "string", { "string-literal": { pattern: /r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/, greedy: !0, inside: { interpolation: { pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/, lookbehind: !0, inside: { punctuation: /^\$\{?|\}$/, expression: { pattern: /[\s\S]+/, inside: e.languages.dart } } }, string: /[\s\S]+/ } }, string: void 0 }), e.languages.insertBefore("dart", "class-name", { metadata: { pattern: /@\w+/, alias: "function" } }), e.languages.insertBefore("dart", "class-name", { generics: { pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/, inside: { "class-name": s, keyword: a, punctuation: /[<>(),.:]/, operator: /[?&|]/ } } }) }(Prism); Prism.languages.go = Prism.languages.extend("clike", { string: { pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/, lookbehind: !0, greedy: !0 }, keyword: /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/, boolean: /\b(?:_|false|iota|nil|true)\b/, number: [/\b0(?:b[01_]+|o[0-7_]+)i?\b/i, /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i, /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i], operator: /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./, builtin: /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/ }), Prism.languages.insertBefore("go", "string", { char: { pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/, greedy: !0 } }), delete Prism.languages.go["class-name"]; !function (e) { var n = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, t = "(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*", s = { pattern: RegExp("(^|[^\\w.])" + t + "[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b"), lookbehind: !0, inside: { namespace: { pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/, inside: { punctuation: /\./ } }, punctuation: /\./ } }; e.languages.java = e.languages.extend("clike", { string: { pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/, lookbehind: !0, greedy: !0 }, "class-name": [s, { pattern: RegExp("(^|[^\\w.])" + t + "[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)"), lookbehind: !0, inside: s.inside }, { pattern: RegExp("(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)" + t + "[A-Z]\\w*\\b"), lookbehind: !0, inside: s.inside }], keyword: n, function: [e.languages.clike.function, { pattern: /(::\s*)[a-z_]\w*/, lookbehind: !0 }], number: /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i, operator: { pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m, lookbehind: !0 }, constant: /\b[A-Z][A-Z_\d]+\b/ }), e.languages.insertBefore("java", "string", { "triple-quoted-string": { pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/, greedy: !0, alias: "string" }, char: { pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/, greedy: !0 } }), e.languages.insertBefore("java", "class-name", { annotation: { pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/, lookbehind: !0, alias: "punctuation" }, generics: { pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/, inside: { "class-name": s, keyword: n, punctuation: /[<>(),.:]/, operator: /[?&|]/ } }, import: [{ pattern: RegExp("(\\bimport\\s+)" + t + "(?:[A-Z]\\w*|\\*)(?=\\s*;)"), lookbehind: !0, inside: { namespace: s.inside.namespace, punctuation: /\./, operator: /\*/, "class-name": /\w+/ } }, { pattern: RegExp("(\\bimport\\s+static\\s+)" + t + "(?:\\w+|\\*)(?=\\s*;)"), lookbehind: !0, alias: "static", inside: { namespace: s.inside.namespace, static: /\b\w+$/, punctuation: /\./, operator: /\*/, "class-name": /\w+/ } }], namespace: { pattern: RegExp("(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?".replace(/<keyword>/g, (function () { return n.source }))), lookbehind: !0, inside: { punctuation: /\./ } } }) }(Prism); !function (n) { n.languages.kotlin = n.languages.extend("clike", { keyword: { pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/, lookbehind: !0 }, function: [{ pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/, greedy: !0 }, { pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/, lookbehind: !0, greedy: !0 }], number: /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/, operator: /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/ }), delete n.languages.kotlin["class-name"]; var e = { "interpolation-punctuation": { pattern: /^\$\{?|\}$/, alias: "punctuation" }, expression: { pattern: /[\s\S]+/, inside: n.languages.kotlin } }; n.languages.insertBefore("kotlin", "string", { "string-literal": [{ pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/, alias: "multiline", inside: { interpolation: { pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i, inside: e }, string: /[\s\S]+/ } }, { pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/, alias: "singleline", inside: { interpolation: { pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i, lookbehind: !0, inside: e }, string: /[\s\S]+/ } }], char: { pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/, greedy: !0 } }), delete n.languages.kotlin.string, n.languages.insertBefore("kotlin", "keyword", { annotation: { pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/, alias: "builtin" } }), n.languages.insertBefore("kotlin", "function", { label: { pattern: /\b\w+@|@\w+\b/, alias: "symbol" } }), n.languages.kt = n.languages.kotlin, n.languages.kts = n.languages.kotlin }(Prism); !function (a) { var e = /\\(?:[^a-z()[\]]|[a-z*]+)/i, n = { "equation-command": { pattern: e, alias: "regex" } }; a.languages.latex = { comment: /%.*/, cdata: { pattern: /(\\begin\{((?:lstlisting|verbatim)\*?)\})[\s\S]*?(?=\\end\{\2\})/, lookbehind: !0 }, equation: [{ pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/, inside: n, alias: "string" }, { pattern: /(\\begin\{((?:align|eqnarray|equation|gather|math|multline)\*?)\})[\s\S]*?(?=\\end\{\2\})/, lookbehind: !0, inside: n, alias: "string" }], keyword: { pattern: /(\\(?:begin|cite|documentclass|end|label|ref|usepackage)(?:\[[^\]]+\])?\{)[^}]+(?=\})/, lookbehind: !0 }, url: { pattern: /(\\url\{)[^}]+(?=\})/, lookbehind: !0 }, headline: { pattern: /(\\(?:chapter|frametitle|paragraph|part|section|subparagraph|subsection|subsubparagraph|subsubsection|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\})/, lookbehind: !0, alias: "class-name" }, function: { pattern: e, alias: "selector" }, punctuation: /[[\]{}&]/ }, a.languages.tex = a.languages.latex, a.languages.context = a.languages.latex }(Prism); !function (e) { function n(e, n) { return "___" + e.toUpperCase() + n + "___" } Object.defineProperties(e.languages["markup-templating"] = {}, { buildPlaceholders: { value: function (t, a, r, o) { if (t.language === a) { var c = t.tokenStack = []; t.code = t.code.replace(r, (function (e) { if ("function" == typeof o && !o(e)) return e; for (var r, i = c.length; -1 !== t.code.indexOf(r = n(a, i));)++i; return c[i] = e, r })), t.grammar = e.languages.markup } } }, tokenizePlaceholders: { value: function (t, a) { if (t.language === a && t.tokenStack) { t.grammar = e.languages[a]; var r = 0, o = Object.keys(t.tokenStack); !function c(i) { for (var u = 0; u < i.length && !(r >= o.length); u++) { var g = i[u]; if ("string" == typeof g || g.content && "string" == typeof g.content) { var l = o[r], s = t.tokenStack[l], f = "string" == typeof g ? g : g.content, p = n(a, l), k = f.indexOf(p); if (k > -1) { ++r; var m = f.substring(0, k), d = new e.Token(a, e.tokenize(s, t.grammar), "language-" + a, s), h = f.substring(k + p.length), v = []; m && v.push.apply(v, c([m])), v.push(d), h && v.push.apply(v, c([h])), "string" == typeof g ? i.splice.apply(i, [u, 1].concat(v)) : g.content = v } } else g.content && c(g.content) } return i }(t.tokens) } } } }) }(Prism); Prism.languages.matlab = { comment: [/%\{[\s\S]*?\}%/, /%.+/], string: { pattern: /\B'(?:''|[^'\r\n])*'/, greedy: !0 }, number: /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[eE][+-]?\d+)?(?:[ij])?|\b[ij]\b/, keyword: /\b(?:NaN|break|case|catch|continue|else|elseif|end|for|function|if|inf|otherwise|parfor|pause|pi|return|switch|try|while)\b/, function: /\b(?!\d)\w+(?=\s*\()/, operator: /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/, punctuation: /\.{3}|[.,;\[\](){}!]/ }; !function ($) { var e = ["$eq", "$gt", "$gte", "$in", "$lt", "$lte", "$ne", "$nin", "$and", "$not", "$nor", "$or", "$exists", "$type", "$expr", "$jsonSchema", "$mod", "$regex", "$text", "$where", "$geoIntersects", "$geoWithin", "$near", "$nearSphere", "$all", "$elemMatch", "$size", "$bitsAllClear", "$bitsAllSet", "$bitsAnyClear", "$bitsAnySet", "$comment", "$elemMatch", "$meta", "$slice", "$currentDate", "$inc", "$min", "$max", "$mul", "$rename", "$set", "$setOnInsert", "$unset", "$addToSet", "$pop", "$pull", "$push", "$pullAll", "$each", "$position", "$slice", "$sort", "$bit", "$addFields", "$bucket", "$bucketAuto", "$collStats", "$count", "$currentOp", "$facet", "$geoNear", "$graphLookup", "$group", "$indexStats", "$limit", "$listLocalSessions", "$listSessions", "$lookup", "$match", "$merge", "$out", "$planCacheStats", "$project", "$redact", "$replaceRoot", "$replaceWith", "$sample", "$set", "$skip", "$sort", "$sortByCount", "$unionWith", "$unset", "$unwind", "$setWindowFields", "$abs", "$accumulator", "$acos", "$acosh", "$add", "$addToSet", "$allElementsTrue", "$and", "$anyElementTrue", "$arrayElemAt", "$arrayToObject", "$asin", "$asinh", "$atan", "$atan2", "$atanh", "$avg", "$binarySize", "$bsonSize", "$ceil", "$cmp", "$concat", "$concatArrays", "$cond", "$convert", "$cos", "$dateFromParts", "$dateToParts", "$dateFromString", "$dateToString", "$dayOfMonth", "$dayOfWeek", "$dayOfYear", "$degreesToRadians", "$divide", "$eq", "$exp", "$filter", "$first", "$floor", "$function", "$gt", "$gte", "$hour", "$ifNull", "$in", "$indexOfArray", "$indexOfBytes", "$indexOfCP", "$isArray", "$isNumber", "$isoDayOfWeek", "$isoWeek", "$isoWeekYear", "$last", "$last", "$let", "$literal", "$ln", "$log", "$log10", "$lt", "$lte", "$ltrim", "$map", "$max", "$mergeObjects", "$meta", "$min", "$millisecond", "$minute", "$mod", "$month", "$multiply", "$ne", "$not", "$objectToArray", "$or", "$pow", "$push", "$radiansToDegrees", "$range", "$reduce", "$regexFind", "$regexFindAll", "$regexMatch", "$replaceOne", "$replaceAll", "$reverseArray", "$round", "$rtrim", "$second", "$setDifference", "$setEquals", "$setIntersection", "$setIsSubset", "$setUnion", "$size", "$sin", "$slice", "$split", "$sqrt", "$stdDevPop", "$stdDevSamp", "$strcasecmp", "$strLenBytes", "$strLenCP", "$substr", "$substrBytes", "$substrCP", "$subtract", "$sum", "$switch", "$tan", "$toBool", "$toDate", "$toDecimal", "$toDouble", "$toInt", "$toLong", "$toObjectId", "$toString", "$toLower", "$toUpper", "$trim", "$trunc", "$type", "$week", "$year", "$zip", "$count", "$dateAdd", "$dateDiff", "$dateSubtract", "$dateTrunc", "$getField", "$rand", "$sampleRate", "$setField", "$unsetField", "$comment", "$explain", "$hint", "$max", "$maxTimeMS", "$min", "$orderby", "$query", "$returnKey", "$showDiskLoc", "$natural"], t = "(?:" + (e = e.map((function ($) { return $.replace("$", "\\$") }))).join("|") + ")\\b"; $.languages.mongodb = $.languages.extend("javascript", {}), $.languages.insertBefore("mongodb", "string", { property: { pattern: /(?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)(?=\s*:)/, greedy: !0, inside: { keyword: RegExp("^(['\"])?" + t + "(?:\\1)?$") } } }), $.languages.mongodb.string.inside = { url: { pattern: /https?:\/\/[-\w@:%.+~#=]{1,256}\.[a-z0-9()]{1,6}\b[-\w()@:%+.~#?&/=]*/i, greedy: !0 }, entity: { pattern: /\b(?:(?:[01]?\d\d?|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d\d?|2[0-4]\d|25[0-5])\b/, greedy: !0 } }, $.languages.insertBefore("mongodb", "constant", { builtin: { pattern: RegExp("\\b(?:" + ["ObjectId", "Code", "BinData", "DBRef", "Timestamp", "NumberLong", "NumberDecimal", "MaxKey", "MinKey", "RegExp", "ISODate", "UUID"].join("|") + ")\\b"), alias: "keyword" } }) }(Prism); !function (e) { var a = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/, t = [{ pattern: /\b(?:false|true)\b/i, alias: "boolean" }, { pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i, greedy: !0, lookbehind: !0 }, { pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i, greedy: !0, lookbehind: !0 }, /\b(?:null)\b/i, /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/], i = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i, n = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/, s = /[{}\[\](),:;]/; e.languages.php = { delimiter: { pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i, alias: "important" }, comment: a, variable: /\$+(?:\w+\b|(?=\{))/, package: { pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i, lookbehind: !0, inside: { punctuation: /\\/ } }, "class-name-definition": { pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i, lookbehind: !0, alias: "class-name" }, "function-definition": { pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i, lookbehind: !0, alias: "function" }, keyword: [{ pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i, alias: "type-casting", greedy: !0, lookbehind: !0 }, { pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i, alias: "type-hint", greedy: !0, lookbehind: !0 }, { pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i, alias: "return-type", greedy: !0, lookbehind: !0 }, { pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i, alias: "type-declaration", greedy: !0 }, { pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i, alias: "type-declaration", greedy: !0, lookbehind: !0 }, { pattern: /\b(?:parent|self|static)(?=\s*::)/i, alias: "static-context", greedy: !0 }, { pattern: /(\byield\s+)from\b/i, lookbehind: !0 }, /\bclass\b/i, { pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i, lookbehind: !0 }], "argument-name": { pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i, lookbehind: !0 }, "class-name": [{ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i, greedy: !0, lookbehind: !0 }, { pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i, greedy: !0, lookbehind: !0 }, { pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i, greedy: !0 }, { pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i, alias: "class-name-fully-qualified", greedy: !0, lookbehind: !0, inside: { punctuation: /\\/ } }, { pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i, alias: "class-name-fully-qualified", greedy: !0, inside: { punctuation: /\\/ } }, { pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i, alias: "class-name-fully-qualified", greedy: !0, lookbehind: !0, inside: { punctuation: /\\/ } }, { pattern: /\b[a-z_]\w*(?=\s*\$)/i, alias: "type-declaration", greedy: !0 }, { pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i, alias: ["class-name-fully-qualified", "type-declaration"], greedy: !0, inside: { punctuation: /\\/ } }, { pattern: /\b[a-z_]\w*(?=\s*::)/i, alias: "static-context", greedy: !0 }, { pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i, alias: ["class-name-fully-qualified", "static-context"], greedy: !0, inside: { punctuation: /\\/ } }, { pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i, alias: "type-hint", greedy: !0, lookbehind: !0 }, { pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i, alias: ["class-name-fully-qualified", "type-hint"], greedy: !0, lookbehind: !0, inside: { punctuation: /\\/ } }, { pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i, alias: "return-type", greedy: !0, lookbehind: !0 }, { pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i, alias: ["class-name-fully-qualified", "return-type"], greedy: !0, lookbehind: !0, inside: { punctuation: /\\/ } }], constant: t, function: { pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i, lookbehind: !0, inside: { punctuation: /\\/ } }, property: { pattern: /(->\s*)\w+/, lookbehind: !0 }, number: i, operator: n, punctuation: s }; var l = { pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/, lookbehind: !0, inside: e.languages.php }, r = [{ pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/, alias: "nowdoc-string", greedy: !0, inside: { delimiter: { pattern: /^<<<'[^']+'|[a-z_]\w*;$/i, alias: "symbol", inside: { punctuation: /^<<<'?|[';]$/ } } } }, { pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i, alias: "heredoc-string", greedy: !0, inside: { delimiter: { pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i, alias: "symbol", inside: { punctuation: /^<<<"?|[";]$/ } }, interpolation: l } }, { pattern: /`(?:\\[\s\S]|[^\\`])*`/, alias: "backtick-quoted-string", greedy: !0 }, { pattern: /'(?:\\[\s\S]|[^\\'])*'/, alias: "single-quoted-string", greedy: !0 }, { pattern: /"(?:\\[\s\S]|[^\\"])*"/, alias: "double-quoted-string", greedy: !0, inside: { interpolation: l } }]; e.languages.insertBefore("php", "variable", { string: r, attribute: { pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im, greedy: !0, inside: { "attribute-content": { pattern: /^(#\[)[\s\S]+(?=\]$)/, lookbehind: !0, inside: { comment: a, string: r, "attribute-class-name": [{ pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i, alias: "class-name", greedy: !0, lookbehind: !0 }, { pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i, alias: ["class-name", "class-name-fully-qualified"], greedy: !0, lookbehind: !0, inside: { punctuation: /\\/ } }], constant: t, number: i, operator: n, punctuation: s } }, delimiter: { pattern: /^#\[|\]$/, alias: "punctuation" } } } }), e.hooks.add("before-tokenize", (function (a) { /<\?/.test(a.code) && e.languages["markup-templating"].buildPlaceholders(a, "php", /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g) })), e.hooks.add("after-tokenize", (function (a) { e.languages["markup-templating"].tokenizePlaceholders(a, "php") })) }(Prism); Prism.languages.python = { comment: { pattern: /(^|[^\\])#.*/, lookbehind: !0, greedy: !0 }, "string-interpolation": { pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i, greedy: !0, inside: { interpolation: { pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/, lookbehind: !0, inside: { "format-spec": { pattern: /(:)[^:(){}]+(?=\}$)/, lookbehind: !0 }, "conversion-option": { pattern: /![sra](?=[:}]$)/, alias: "punctuation" }, rest: null } }, string: /[\s\S]+/ } }, "triple-quoted-string": { pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i, greedy: !0, alias: "string" }, string: { pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i, greedy: !0 }, function: { pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g, lookbehind: !0 }, "class-name": { pattern: /(\bclass\s+)\w+/i, lookbehind: !0 }, decorator: { pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m, lookbehind: !0, alias: ["annotation", "punctuation"], inside: { punctuation: /\./ } }, keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/, builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/, boolean: /\b(?:False|None|True)\b/, number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i, operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/, punctuation: /[{}[\];(),.:]/ }, Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest = Prism.languages.python, Prism.languages.py = Prism.languages.python; !function (e) { e.languages.ruby = e.languages.extend("clike", { comment: { pattern: /#.*|^=begin\s[\s\S]*?^=end/m, greedy: !0 }, "class-name": { pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/, lookbehind: !0, inside: { punctuation: /[.\\]/ } }, keyword: /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/, operator: /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/, punctuation: /[(){}[\].,;]/ }), e.languages.insertBefore("ruby", "operator", { "double-colon": { pattern: /::/, alias: "punctuation" } }); var n = { pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/, lookbehind: !0, inside: { content: { pattern: /^(#\{)[\s\S]+(?=\}$)/, lookbehind: !0, inside: e.languages.ruby }, delimiter: { pattern: /^#\{|\}$/, alias: "punctuation" } } }; delete e.languages.ruby.function; var t = "(?:" + ["([^a-zA-Z0-9\\s{(\\[<=])(?:(?!\\1)[^\\\\]|\\\\[^])*\\1", "\\((?:[^()\\\\]|\\\\[^]|\\((?:[^()\\\\]|\\\\[^])*\\))*\\)", "\\{(?:[^{}\\\\]|\\\\[^]|\\{(?:[^{}\\\\]|\\\\[^])*\\})*\\}", "\\[(?:[^\\[\\]\\\\]|\\\\[^]|\\[(?:[^\\[\\]\\\\]|\\\\[^])*\\])*\\]", "<(?:[^<>\\\\]|\\\\[^]|<(?:[^<>\\\\]|\\\\[^])*>)*>"].join("|") + ")", i = '(?:"(?:\\\\.|[^"\\\\\r\n])*"|(?:\\b[a-zA-Z_]\\w*|[^\\s\0-\\x7F]+)[?!]?|\\$.)'; e.languages.insertBefore("ruby", "keyword", { "regex-literal": [{ pattern: RegExp("%r" + t + "[egimnosux]{0,6}"), greedy: !0, inside: { interpolation: n, regex: /[\s\S]+/ } }, { pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/, lookbehind: !0, greedy: !0, inside: { interpolation: n, regex: /[\s\S]+/ } }], variable: /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/, symbol: [{ pattern: RegExp("(^|[^:]):" + i), lookbehind: !0, greedy: !0 }, { pattern: RegExp("([\r\n{(,][ \t]*)" + i + "(?=:(?!:))"), lookbehind: !0, greedy: !0 }], "method-definition": { pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/, lookbehind: !0, inside: { function: /\b\w+$/, keyword: /^self\b/, "class-name": /^\w+/, punctuation: /\./ } } }), e.languages.insertBefore("ruby", "string", { "string-literal": [{ pattern: RegExp("%[qQiIwWs]?" + t), greedy: !0, inside: { interpolation: n, string: /[\s\S]+/ } }, { pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/, greedy: !0, inside: { interpolation: n, string: /[\s\S]+/ } }, { pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i, alias: "heredoc-string", greedy: !0, inside: { delimiter: { pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i, inside: { symbol: /\b\w+/, punctuation: /^<<[-~]?/ } }, interpolation: n, string: /[\s\S]+/ } }, { pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i, alias: "heredoc-string", greedy: !0, inside: { delimiter: { pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i, inside: { symbol: /\b\w+/, punctuation: /^<<[-~]?'|'$/ } }, string: /[\s\S]+/ } }], "command-literal": [{ pattern: RegExp("%x" + t), greedy: !0, inside: { interpolation: n, command: { pattern: /[\s\S]+/, alias: "string" } } }, { pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/, greedy: !0, inside: { interpolation: n, command: { pattern: /[\s\S]+/, alias: "string" } } }] }), delete e.languages.ruby.string, e.languages.insertBefore("ruby", "number", { builtin: /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/, constant: /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/ }), e.languages.rb = e.languages.ruby }(Prism); !function (e) { for (var a = "/\\*(?:[^*/]|\\*(?!/)|/(?!\\*)|<self>)*\\*/", t = 0; t < 2; t++)a = a.replace(/<self>/g, (function () { return a })); a = a.replace(/<self>/g, (function () { return "[^\\s\\S]" })), e.languages.rust = { comment: [{ pattern: RegExp("(^|[^\\\\])" + a), lookbehind: !0, greedy: !0 }, { pattern: /(^|[^\\:])\/\/.*/, lookbehind: !0, greedy: !0 }], string: { pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/, greedy: !0 }, char: { pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/, greedy: !0 }, attribute: { pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/, greedy: !0, alias: "attr-name", inside: { string: null } }, "closure-params": { pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/, lookbehind: !0, greedy: !0, inside: { "closure-punctuation": { pattern: /^\||\|$/, alias: "punctuation" }, rest: null } }, "lifetime-annotation": { pattern: /'\w+/, alias: "symbol" }, "fragment-specifier": { pattern: /(\$\w+:)[a-z]+/, lookbehind: !0, alias: "punctuation" }, variable: /\$\w+/, "function-definition": { pattern: /(\bfn\s+)\w+/, lookbehind: !0, alias: "function" }, "type-definition": { pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/, lookbehind: !0, alias: "class-name" }, "module-declaration": [{ pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/, lookbehind: !0, alias: "namespace" }, { pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/, lookbehind: !0, alias: "namespace", inside: { punctuation: /::/ } }], keyword: [/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/, /\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/], function: /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/, macro: { pattern: /\b\w+!/, alias: "property" }, constant: /\b[A-Z_][A-Z_\d]+\b/, "class-name": /\b[A-Z]\w*\b/, namespace: { pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/, inside: { punctuation: /::/ } }, number: /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/, boolean: /\b(?:false|true)\b/, punctuation: /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/, operator: /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/ }, e.languages.rust["closure-params"].inside.rest = e.languages.rust, e.languages.rust.attribute.inside.string = e.languages.rust.string }(Prism); Prism.languages.sql = { comment: { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, lookbehind: !0 }, variable: [{ pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/, greedy: !0 }, /@[\w.$]+/], string: { pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/, greedy: !0, lookbehind: !0 }, identifier: { pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/, greedy: !0, lookbehind: !0, inside: { punctuation: /^`|`$/ } }, function: /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, keyword: /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i, boolean: /\b(?:FALSE|NULL|TRUE)\b/i, number: /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i, operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i, punctuation: /[;[\]()`,.]/ }; Prism.languages.swift = { comment: { pattern: /(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/, lookbehind: !0, greedy: !0 }, "string-literal": [{ pattern: RegExp('(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\r\n|[^(])|[^\\\\\r\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])'), lookbehind: !0, greedy: !0, inside: { interpolation: { pattern: /(\\\()(?:[^()]|\([^()]*\))*(?=\))/, lookbehind: !0, inside: null }, "interpolation-punctuation": { pattern: /^\)|\\\($/, alias: "punctuation" }, punctuation: /\\(?=[\r\n])/, string: /[\s\S]+/ } }, { pattern: RegExp('(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\r\n|[^#])|[^\\\\\r\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2'), lookbehind: !0, greedy: !0, inside: { interpolation: { pattern: /(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/, lookbehind: !0, inside: null }, "interpolation-punctuation": { pattern: /^\)|\\#+\($/, alias: "punctuation" }, string: /[\s\S]+/ } }], directive: { pattern: RegExp("#(?:(?:elseif|if)\\b(?:[ \t]*(?:![ \t]*)?(?:\\b\\w+\\b(?:[ \t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)"), alias: "property", inside: { "directive-name": /^#\w+/, boolean: /\b(?:false|true)\b/, number: /\b\d+(?:\.\d+)*\b/, operator: /!|&&|\|\||[<>]=?/, punctuation: /[(),]/ } }, literal: { pattern: /#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/, alias: "constant" }, "other-directive": { pattern: /#\w+\b/, alias: "property" }, attribute: { pattern: /@\w+/, alias: "atrule" }, "function-definition": { pattern: /(\bfunc\s+)\w+/, lookbehind: !0, alias: "function" }, label: { pattern: /\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/, lookbehind: !0, alias: "important" }, keyword: /\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/, boolean: /\b(?:false|true)\b/, nil: { pattern: /\bnil\b/, alias: "constant" }, "short-argument": /\$\d+\b/, omit: { pattern: /\b_\b/, alias: "keyword" }, number: /\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i, "class-name": /\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/, function: /\b[a-z_]\w*(?=\s*\()/i, constant: /\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/, operator: /[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/, punctuation: /[{}[\]();,.:\\]/ }, Prism.languages.swift["string-literal"].forEach((function (e) { e.inside.interpolation.inside = Prism.languages.swift })); !function (e) { var t = { pattern: /^[;#].*/m, greedy: !0 }, n = '"(?:[^\r\n"\\\\]|\\\\(?:[^\r]|\r\n?))*"(?!\\S)'; e.languages.systemd = { comment: t, section: { pattern: /^\[[^\n\r\[\]]*\](?=[ \t]*$)/m, greedy: !0, inside: { punctuation: /^\[|\]$/, "section-name": { pattern: /[\s\S]+/, alias: "selector" } } }, key: { pattern: /^[^\s=]+(?=[ \t]*=)/m, greedy: !0, alias: "attr-name" }, value: { pattern: RegExp("(=[ \t]*(?!\\s))(?:" + n + '|(?=[^"\r\n]))(?:[^\\s\\\\]|[ \t]+(?:(?![ \t"])|' + n + ")|\\\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;]))*"), lookbehind: !0, greedy: !0, alias: "attr-value", inside: { comment: t, quoted: { pattern: RegExp("(^|\\s)" + n), lookbehind: !0, greedy: !0 }, punctuation: /\\$/m, boolean: { pattern: /^(?:false|no|off|on|true|yes)$/, greedy: !0 } } }, punctuation: /=/ } }(Prism); !function (E) { var n = /\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/; E.languages.typoscript = { comment: [{ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, lookbehind: !0 }, { pattern: /(^|[^\\:= \t]|(?:^|[^= \t])[ \t]+)\/\/.*/, lookbehind: !0, greedy: !0 }, { pattern: /(^|[^"'])#.*/, lookbehind: !0, greedy: !0 }], function: [{ pattern: /<INCLUDE_TYPOSCRIPT:\s*source\s*=\s*(?:"[^"\r\n]*"|'[^'\r\n]*')\s*>/, inside: { string: { pattern: /"[^"\r\n]*"|'[^'\r\n]*'/, inside: { keyword: n } }, keyword: { pattern: /INCLUDE_TYPOSCRIPT/ } } }, { pattern: /@import\s*(?:"[^"\r\n]*"|'[^'\r\n]*')/, inside: { string: /"[^"\r\n]*"|'[^'\r\n]*'/ } }], string: { pattern: /^([^=]*=[< ]?)(?:(?!\]\n).)*/, lookbehind: !0, inside: { function: /\{\$.*\}/, keyword: n, number: /^\d+$/, punctuation: /[,|:]/ } }, keyword: n, number: { pattern: /\b\d+\s*[.{=]/, inside: { operator: /[.{=]/ } }, tag: { pattern: /\.?[-\w\\]+\.?/, inside: { punctuation: /\./ } }, punctuation: /[{}[\];(),.:|]/, operator: /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/ }, E.languages.tsconfig = E.languages.typoscript }(Prism); !function (e) { var n = /[*&][^\s[\]{},]+/, r = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/, t = "(?:" + r.source + "(?:[ \t]+" + n.source + ")?|" + n.source + "(?:[ \t]+" + r.source + ")?)", a = "(?:[^\\s\\x00-\\x08\\x0e-\\x1f!\"#%&'*,\\-:>?@[\\]`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*".replace(/<PLAIN>/g, (function () { return "[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]" })), d = "\"(?:[^\"\\\\\r\n]|\\\\.)*\"|'(?:[^'\\\\\r\n]|\\\\.)*'"; function o(e, n) { n = (n || "").replace(/m/g, "") + "m"; var r = "([:\\-,[{]\\s*(?:\\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\\]|\\}|(?:[\r\n]\\s*)?#))".replace(/<<prop>>/g, (function () { return t })).replace(/<<value>>/g, (function () { return e })); return RegExp(r, n) } e.languages.yaml = { scalar: { pattern: RegExp("([\\-:]\\s*(?:\\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\\S[^\r\n]*(?:\\2[^\r\n]+)*)".replace(/<<prop>>/g, (function () { return t }))), lookbehind: !0, alias: "string" }, comment: /#.*/, key: { pattern: RegExp("((?:^|[:\\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\\s*:\\s)".replace(/<<prop>>/g, (function () { return t })).replace(/<<key>>/g, (function () { return "(?:" + a + "|" + d + ")" }))), lookbehind: !0, greedy: !0, alias: "atrule" }, directive: { pattern: /(^[ \t]*)%.+/m, lookbehind: !0, alias: "important" }, datetime: { pattern: o("\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?"), lookbehind: !0, alias: "number" }, boolean: { pattern: o("false|true", "i"), lookbehind: !0, alias: "important" }, null: { pattern: o("null|~", "i"), lookbehind: !0, alias: "important" }, string: { pattern: o(d), lookbehind: !0, greedy: !0 }, number: { pattern: o("[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)", "i"), lookbehind: !0 }, tag: r, important: n, punctuation: /---|[:[\]{}\-,|>?]|\.\.\./ }, e.languages.yml = e.languages.yaml }(Prism); !function () { if ("undefined" != typeof Prism && "undefined" != typeof document) { var e = "line-numbers", n = /\n(?!$)/g, t = Prism.plugins.lineNumbers = { getLine: function (n, t) { if ("PRE" === n.tagName && n.classList.contains(e)) { var i = n.querySelector(".line-numbers-rows"); if (i) { var r = parseInt(n.getAttribute("data-start"), 10) || 1, s = r + (i.children.length - 1); t < r && (t = r), t > s && (t = s); var l = t - r; return i.children[l] } } }, resize: function (e) { r([e]) }, assumeViewportIndependence: !0 }, i = void 0; window.addEventListener("resize", (function () { t.assumeViewportIndependence && i === window.innerWidth || (i = window.innerWidth, r(Array.prototype.slice.call(document.querySelectorAll("pre.line-numbers")))) })), Prism.hooks.add("complete", (function (t) { if (t.code) { var i = t.element, s = i.parentNode; if (s && /pre/i.test(s.nodeName) && !i.querySelector(".line-numbers-rows") && Prism.util.isActive(i, e)) { i.classList.remove(e), s.classList.add(e); var l, o = t.code.match(n), a = o ? o.length + 1 : 1, u = new Array(a + 1).join("<span></span>"); (l = document.createElement("span")).setAttribute("aria-hidden", "true"), l.className = "line-numbers-rows", l.innerHTML = u, s.hasAttribute("data-start") && (s.style.counterReset = "linenumber " + (parseInt(s.getAttribute("data-start"), 10) - 1)), t.element.appendChild(l), r([s]), Prism.hooks.run("line-numbers", t) } } })), Prism.hooks.add("line-numbers", (function (e) { e.plugins = e.plugins || {}, e.plugins.lineNumbers = !0 })) } function r(e) { if (0 != (e = e.filter((function (e) { var n, t = (n = e, n ? window.getComputedStyle ? getComputedStyle(n) : n.currentStyle || null : null)["white-space"]; return "pre-wrap" === t || "pre-line" === t }))).length) { var t = e.map((function (e) { var t = e.querySelector("code"), i = e.querySelector(".line-numbers-rows"); if (t && i) { var r = e.querySelector(".line-numbers-sizer"), s = t.textContent.split(n); r || ((r = document.createElement("span")).className = "line-numbers-sizer", t.appendChild(r)), r.innerHTML = "0", r.style.display = "block"; var l = r.getBoundingClientRect().height; return r.innerHTML = "", { element: e, lines: s, lineHeights: [], oneLinerHeight: l, sizer: r } } })).filter(Boolean); t.forEach((function (e) { var n = e.sizer, t = e.lines, i = e.lineHeights, r = e.oneLinerHeight; i[t.length - 1] = void 0, t.forEach((function (e, t) { if (e && e.length > 1) { var s = n.appendChild(document.createElement("span")); s.style.display = "block", s.textContent = e } else i[t] = r })) })), t.forEach((function (e) { for (var n = e.sizer, t = e.lineHeights, i = 0, r = 0; r < t.length; r++)void 0 === t[r] && (t[r] = n.children[i++].getBoundingClientRect().height) })), t.forEach((function (e) { var n = e.sizer, t = e.element.querySelector(".line-numbers-rows"); n.style.display = "none", n.innerHTML = "", e.lineHeights.forEach((function (e, n) { t.children[n].style.height = e + "px" })) })) } } }(); !function () { if ("undefined" != typeof Prism && "undefined" != typeof document) { var e = [], t = {}, n = function () { }; Prism.plugins.toolbar = {}; var a = Prism.plugins.toolbar.registerButton = function (n, a) { var r; r = "function" == typeof a ? a : function (e) { var t; return "function" == typeof a.onClick ? ((t = document.createElement("button")).type = "button", t.addEventListener("click", (function () { a.onClick.call(this, e) }))) : "string" == typeof a.url ? (t = document.createElement("a")).href = a.url : t = document.createElement("span"), a.className && t.classList.add(a.className), t.textContent = a.text, t }, n in t ? console.warn('There is a button with the key "' + n + '" registered already.') : e.push(t[n] = r) }, r = Prism.plugins.toolbar.hook = function (a) { var r = a.element.parentNode; if (r && /pre/i.test(r.nodeName) && !r.parentNode.classList.contains("code-toolbar")) { var o = document.createElement("div"); o.classList.add("code-toolbar"), r.parentNode.insertBefore(o, r), o.appendChild(r); var i = document.createElement("div"); i.classList.add("toolbar"); var l = e, d = function (e) { for (; e;) { var t = e.getAttribute("data-toolbar-order"); if (null != t) return (t = t.trim()).length ? t.split(/\s*,\s*/g) : []; e = e.parentElement } }(a.element); d && (l = d.map((function (e) { return t[e] || n }))), l.forEach((function (e) { var t = e(a); if (t) { var n = document.createElement("div"); n.classList.add("toolbar-item"), n.appendChild(t), i.appendChild(n) } })), o.appendChild(i) } }; a("label", (function (e) { var t = e.element.parentNode; if (t && /pre/i.test(t.nodeName) && t.hasAttribute("data-label")) { var n, a, r = t.getAttribute("data-label"); try { a = document.querySelector("template#" + r) } catch (e) { } return a ? n = a.content : (t.hasAttribute("data-url") ? (n = document.createElement("a")).href = t.getAttribute("data-url") : n = document.createElement("span"), n.textContent = r), n } })), Prism.hooks.add("complete", r) } }(); !function () { function t(t) { var e = document.createElement("textarea"); e.value = t.getText(), e.style.top = "0", e.style.left = "0", e.style.position = "fixed", document.body.appendChild(e), e.focus(), e.select(); try { var o = document.execCommand("copy"); setTimeout((function () { o ? t.success() : t.error() }), 1) } catch (e) { setTimeout((function () { t.error(e) }), 1) } document.body.removeChild(e) } "undefined" != typeof Prism && "undefined" != typeof document && (Prism.plugins.toolbar ? Prism.plugins.toolbar.registerButton("copy-to-clipboard", (function (e) { var o = e.element, n = function (t) { var e = { copy: "Copy", "copy-error": "Press Ctrl+C to copy", "copy-success": "Copied!", "copy-timeout": 5e3 }; for (var o in e) { for (var n = "data-prismjs-" + o, c = t; c && !c.hasAttribute(n);)c = c.parentElement; c && (e[o] = c.getAttribute(n)) } return e }(o), c = document.createElement("button"); c.className = "copy-to-clipboard-button", c.setAttribute("type", "button"); var r = document.createElement("span"); return c.appendChild(r), u("copy"), function (e, o) { e.addEventListener("click", (function () { !function (e) { navigator.clipboard ? navigator.clipboard.writeText(e.getText()).then(e.success, (function () { t(e) })) : t(e) }(o) })) }(c, { getText: function () { return o.textContent }, success: function () { u("copy-success"), i() }, error: function () { u("copy-error"), setTimeout((function () { !function (t) { window.getSelection().selectAllChildren(t) }(o) }), 1), i() } }), c; function i() { setTimeout((function () { u("copy") }), n["copy-timeout"]) } function u(t) { r.textContent = n[t], c.setAttribute("data-copy-state", t) } })) : console.warn("Copy to Clipboard plugin loaded before Toolbar plugin.")) }(); ```
```kotlin plugins { java } group = "org.gradle.kotlin.dsl.samples.composite-builds" version = "1.0" ```
The 1899 British Isles tour to Australia was the fourth rugby union tour by a British Isles team and the second to Australia; though the first tour in 1888 was a private venture, making the 1899 tour the first official undertaking of Australia. It is retrospectively classed as one of the British Lions tours, as the Lions naming convention was not adopted until 1950. Negotiations had also taken place for the tour to incorporate matches against New Zealand, either through a visit to New Zealand, or a New Zealand team to play in Australia. No agreeable terms could be found. This tour was the first to truly represent the British Isles, with players from all four Home Nations. Despite this fact, many Australian newspapers, and some British dailies, referred to the tourists as "the English football team". Plan to tour in 1898 After the tour of South Africa in 1896, players in Britain expressed wishes to make a similar tour to Australia. In August 1897, the New South Wales Rugby Football Union (NSWRFU), received a letter from Reverend Matthew Mullineux asking whether a tour beginning in June 1898 would be possible and welcomed by the Union. This request was discussed in depth by the NSWRFU at their 30 September meeting, and it was decided to extend an invitation with the following stipulations. The tour was to be under the auspices of the Rugby Football Union (RFU), with the touring team paying for passage to and from Sydney. The NSWRFU would pay for their internal expenses once in Australia. The British team was to receive a percentage of the profits earned by the attendance at each match, but only up to the cost of their travel. Some debate centred about what level of reimbursement would be allowed, they settled on fifty percent after the initial proposal of twenty percent was deemed too low. They specified that a playing squad be made up of twenty-one players inclusive of the tour manager. They would play two games a week while on tour, in New South Wales, Queensland, and New Zealand. There was also the possibility that the tour would take in Victoria. The proposal was sanctioned by the RFU, with the strict stipulation that the tour would take place on a purely amateur basis. It was the plan of Mullineux to fill the team with players from the Universities, but the timing of the tour meant that players would need to leave Britain in early May, when vacation had not yet begun. Due to a lack of time to make the necessary arrangements, the tour for 1898 was subsequently cancelled. Plan to tour in 1899 A new invitation was sent from the NSWRFU, for a tour to take place in 1899. The RFU at about the same time, received an invitation from the South African Rugby Football Union, to send a team to tour South Africa in 1899. The RFU wanted confirmation from Mullineux, that a team to tour Australia was for certain able to be formed if the invitation from South Africa was to be turned down. After numerous meetings between the RFU and Mullineux a decision was made in February 1899, to turn down the tour to South Africa. A cable message was received in February 1899 by the NSWRFU, that was erroneously construed to mean that the Australian tour had been abandoned, with players preferring to make the tour of South Africa. The NSWRFU having completed all the arrangements for the tour to take place and having rearranged club schedules to accommodate the tour, made enquiries as no official confirmation of the cancellation was received. The misunderstanding was cleared up on 22 February by a message that indicated the tour to Australia was going to proceed. Mullineux stated, there was never any suggestion of abandoning the Australian tour. Touring squad selection The makeup of the touring squad was described in the earliest communication of 1897 from Mullineux, as a team made of University students from his school Cambridge, as well as Oxford University, and also of international representatives. Two problems faced Mullineux, the first was that the timing of the tour meant that players would need to leave Britain in early May, when the university vacations had not yet begun. The second was that a long tour would preclude many of the best players from participating due to other commitments. Consequently, early lists of probable touring players had few players listed that finally made the tour. In the pool of potential players the following were noted: James Byrne, Cecil Boyd, Viv Huzzey, Zimans, Ernest Fookes, Lindsay Watson, M Elliott, Herbert Dudgeon, James Gowans, James Franks, J H Kipling, R Forest, Lawrence Bulger, Timoins, R O Swartz, C B Marston, W Neeks (or Needs), Dr Rowland, J W Gorman, and James Couper. Among these names were several high-profile players that recruitment attempts failed to secure. Byrne declined due to pressure of business, while Ernest Fookes was awaiting a serious medical operation. The final member to join the team was Scottish international Alf Bucher, after failed approaches were made to recruit fellow Scot James Couper and Welsh wing Viv Huzzey. Touring party The team consisted of 21 players, nine had international experience, five had played for England, three for Ireland, and one for Scotland and Wales. Commentators thought that the selected team did not fully represent the strength of British rugby, particularly with the absence of James Byrne. The team played in a kit consisting of a jersey with thick blue bands and thinner red and white bands, representing the colours of the Union Jack; with dark blue shorts and blue stockings finished with red and white tops. The team caps were maroon in colour and bore the motif of a kangaroo. Formal dress comprised a navy blazer, with a breast badge that read "The Anglo-Australian Rugby Football Team". Full Backs Esmond Martelli, was 20 years of age when the team departed England. He played for Dublin Wanderers. On tour he played as a fullback, but was able to play at three-quarters also. He was a skilled place, drop and punt kicker. Charles Thompson, was approximately 25 years old, and played for Lancashire. A versatile player who had played at three-quarter, as well as in the forwards. He was a skilled kicker. Three-Quarters Alec Boswell Timms, was approximately 27 years of age, and had played for Edinburgh University, and trial matches for Scotland, making the Scottish national team in one match in 1896. He excelled as a centre or on the wing. Timms was born in Melbourne, Australia but had been sent to England to study medicine. Elliot Nicholson, was 27 years of age, and played for Birkenhead Park, and for Liverpool. His speed was used typically on the wing. Alf Bucher, was 25 years of age, and played for Edinburgh Academicals and Scotland. Gwyn Nicholls, was 24 years of age, and played for Cardiff. He was a Welsh international, highly regarded as the best three-quarter to have played since Arthur Gould. He was the first Welsh player to represent a British team in a Test match, and was outstanding at centre in all weather conditions. Gerry Doran, was 21 years of age, and played for Lansdowne. He represented Ireland in 1899. He was an excellent tackler. Half backs Matthew Mullineux, was 31 years of age, and played for Blackheath, and Moseley. and represented Kent. He was the only player who toured South Africa in 1896. He was the instigator, planner, and manager of the British team. He served as captain on a number of the tour matches. George Cookson, was 25 years of age, and played for Manchester, and Lancashire. In 1898 for the North of England team. Charlie Adamson, was 24 years of age, and played for Durham, and in 1898 for the North of England team. He had also tried out for the English team on several occasions. He was a versatile player, being able to play at half back, three quarter or as centre. He finished the tour as the test top scorer, with 17 points, including a try in both the second and fourth tests. Forwards Frank Stout, was 22 years of age, and played for Gloucester. He also represented England. Stout was rated among the very best of England's forwards. Wallace Jarman, was 26 years of age, and was the captain of Bristol football club. He also played for Gloucestershire. He had represented England. He consistently put hard work into the scrum, followed kicks down field, and was a difficult player to defend when he dribbled the ball down the field. H.G.S. Gray, played for Cambridge University, and in trial matches for Scotland. He was a past student of Ley's School in Cambridge. George Ralph Gibson, was 21 years of age, and played for Northern, as well as representing England. William Judkins, played for Coventry. He was a past student of Repton School. Frederick Belson, was 25 years of age, and played for Bath, and Somerset. He was a past student of Clifton College. John Francomb, was approximately 26 years of age, and played for Manchester, and represented Lancashire. He was a past student of Oxford. He was physically a very tall player. Blair Swannell, was 23 years of age, and played for Northampton. He represented the East Midlands team. Guy Evers, was 24 years of age, and played for Moseley. He was a past student of Haileybury. Tom McGown, was 23 years of age, and played for North of Ireland. He had relatives living in Dunedin, New Zealand and paid them a visit after the season was done. Alan Ayre-Smith, was 22 years of age, and played for Guy's Hospital, and represented Surrey. He was a hard playing forward. Plan for tour to New Zealand The plan to include New Zealand in the British tour was made in the initial correspondence from the NSWRFU to Mullineux in 1897. Since the New Zealand Rugby Union (NZRU) was not in direct negotiations with Mullinuex, they had to work with the NSWRFU to try to negotiate the New Zealand leg of the proposed tour. The NZRU requested from the NSWRFU that they be able to have direct dealings with Mullineux, however this did not eventuate. An extension of the tour to New Zealand, threatened attempts at fielding a strong British representative team. Consequently, the New Zealand leg of the tour became less likely as the tour for 1899 was negotiated. The NSWRFU limited the length of the tour to eight weeks from June to August, giving the British an option to add two weeks to their playing schedules if they wished to add New Zealand to their tour program. In addition to the lack of time, Mullineux had expressed to the NSWRFU that he had been led to believe that a tour of New Zealand would not be profitable. The NSWRFU reinforced his beliefs by indicating that the New Zealand union had been unwilling to pay for the travel to and from England, but only the travel to and from Auckland. There was some sentiment expressed that, because the team was not an English, but a British team, the expense to have the touring team visit was not warranted. The cost of bringing the British team to New Zealand to play in Otago, Auckland, Wellington, and Canterbury was estimated at £400. In November 1898, it was proposed at a meeting of the NZRU, that the NZRU would pay for the full cost of England's travel to and from New Zealand, and within New Zealand. The sub-unions provided guarantees of a percentage of their gate profits to the NZRU. These terms were subsequently agreed to by the NSWRFU. In April, the lengthening of the tour was refused by the British team. Some hope has still held out for a New Zealand leg of the tour, provided that the NSWRFU cut short the Australian leg of the tour by a week, reducing the number of test matches to three, and cutting country matches, thereby providing time for a short trip to Auckland and Wellington. The NZRU offered only £250 for the two matches, and not the £400 plus all expenses that was requested for the two games. Billy Warbrick in a letter to the Referee highlighted the generosity of the NSWRFU offer, as it stood to lose an estimated £1200 from the loss of two major matches in Australia. The British team decided in mid-July to not make the tour of New Zealand. As an alternative to touring New Zealand, expectations formed that a match would be played against an Australasian team, consisting of Australian and New Zealand players. There was also the proposal that a match against a New Zealand team would be played in Australia if the British decided not to travel on to New Zealand. Subsequently, the NZRU forbade their players from playing in the matches in Australia. The NSWRFU proposed a date for New Zealand to play in Australia, on 5 August, with a combined Australasian match played a week later on 12 August. This plan was declined by the NZRU, citing the resolutions of the local unions to not send players to Australia. During the British tour, proposals were made by players in New Zealand to make a tour of Britain in 1900. This tour did not happen. Voyage and travel The tour party left Charing Cross Station on 9 May 1899; coincidentally the day the Australian cricket team began their 1899 tour of England. There they travelled to France, where they boarded the P&O liner RMS Oceana at the port of Marseilles. The ocean trip to Australia took five weeks travelling via the Red Sea of which the travelling party complained of the heat. The team briefly stopped at Albany, Western Australia in good health, and were met by delegates of the Perth Rugby Union, and the Mayor. From there they completed their voyage, docking at Adelaide on 11 June, where they were met by delegates of the South Australian Football Association, principally J. R. Anderson, and D. T. Lawes, as well as W. A. Rand, the secretary of the New South Wales Rugby Union. Rand acted as host and financier accompanying the British team for the duration of the tour. They travelled overland by the express train to Melbourne on 12 June. From Melbourne they continued their journey to Sydney. For this tour, the Lions wore brought back the white and blue, the blue used in thick hoops and the red and white in thin bands. A modern version of this jersey would be later worn by England in their one-off Test against Australia in Sydney in 1999, played to commemorate the centenary of the Wallabies' first Test, against those early British tourists. For their part, Australia wore a light blue uniform (similar to worn by the Wallabies in that first 1899 Test). Match summary The Australian tour took in 21 matches; four were Test matches against the Australian national team, while the remainder were against regional and invitational teams. The British Isles lost the first Test, but won the last three Tests to take the series 3–1. After the first loss to the Australians, team captain Mullineux dropped himself from the team for the rest of the tour, with Frank Stout taking the captain's role for the remaining Tests. The decision by Mullineux to replace his position with Charles Adamson is seen as the tour's turning point, which saw the British team begin to win matches by more convincing margins and eventually control the Tests. The complete list of matches played by the British Isles in Australia is the following: Test matches Match details Central Southern New South Wales, 1st Match Metropolitan, 1st Match First Test The first Test played by Australia was played at the Sydney Cricket Ground under excellent weather conditions. The temperature on the day of the game reached , and there was almost no breeze. There was a great deal of interest in the match, with the Sydney Morning Herald and Brisbane Courier both reporting 30,000 in attendance, and the United Press Association reporting 27,000 in attendance. The attendance was officially recorded as 28,000. Tickets for the game were one shilling for general admission, and two shillings for grand stand seats, while children were admitted at half price. In all the game grossed £1200. A full program of events had been scheduled with a preliminary rugby match played by local teams, Wallaroo, and Randwick at 1:45pm, as well as heats of a one-mile bicycle race by the League of Wheelmen. The final of the bicycle race was scheduled during the half-time break. Special trams had been arranged for the event, with the Tramway Service reporting that every available tram had been used for the extra traffic on the day; fully 131 carloads were conveyed to the match. It had been noted in the lead up to the Test that the British team was out of condition. The writer Player in the Brisbane Courier, believed that the first Test was Australia's only chance to beat the British team, as he felt that with the British team's condition improving during the tour, they would be impossible to beat. The British team had been dealing with some illness and injury, necessitating the fielding of a team in the Test that was not their first choice, but in the end identical to the team that played New South Wales the previous weekend. Elliot Nicholson, Alec Timms, and Charles Thompson were all listed as playing, but last minute changes were made. While at a swimming bath, Nicholson injured his foot on a protruding nail, and was unable to play. Bucher played in his place. Timms did not recover from an injury received in the match at Goulburn in time to make the field. Adamson, was moved from the halves to the three-quarters to fill his place, and in turn Cookson filled the opening in the halves left by Adamson. Martelli, who had injured his thumb in the match against Goulburn, and had taken the field against New South Wales, but had to retire due to injury, recovered in time to play in place of Thompson. It had been feared on the evening before the match, that Gwyn Nicholls had caught influenza and would be incapacitated, but instead was a severe cold. Rev. Mullineux also took to the field with a cold. The British played field of four players, at three-quarters, and two half-backs, that contrasted with the Australian field of only one half-back, two at five-eighth, and three at three-quarters. The Australian team on the other hand had no such changes, although the inclusion of M'Cowan had been in doubt only a week before the game, due to a strain. The team consisted of six Queensland players, with the balance made up by New South Wales representatives. Selectors chose to keep the New South Wales three-quarter combination of Spragg, Row and White intact. The only noted absences from the team were Tom Pauling and A. J. Lewis, who suffered injuries in the inter-colonial match the week before the Test. Training of the team was supervised by Billy Warbrick. The Australian team wore the blue colours of NSW. In the week preceding the match, Mullineux had requested that a conference be held to review some differences in the interpretation of the rules of the game from how the game was played in Britain. While the two teams played an evenly matched game until the British performance, particularly in defence, dropped off towards the later stages. The poor condition of the British team was noticeable, and was attributed as the reason the British lost the game. The writer for the United Press Association was of the opinion that the British performance was somewhat poorer than in the game played against New South Wales the previous weekend. The British did show some deft ball handling skills in the game: The beautiful series of passes which gained the try for the Englishmen was considered as being an excellent object lesson in backing up. Some of the players, without looking where they were throwing the ball, passed simply because they knew their comrades would be in position to receive it. The British were criticised for the slow rate in which they got the ball from the scrum, an area of play, in which Australia excelled. The writer for the Queanbeyan Age, noted that the Australians forwards played too fast for the British. The United Press Association named White and Ward as the outstanding players for Australia. First half Mullineux having won the coin toss elected to defend the northern end of the field. Gralton opened play with the kick off. Mullineux made a mark in the first minutes of the game, but he kicked poorly. Soon after, a free kick was awarded to the British. The Nicholls kick for touch remained within the field of play and came within five yards of the Australian try line. Doran received and carried the ball in to touch. Another free kick to the British resulted from the line-out. The goal attempt by Martelli was unsuccessful. Play continued with both teams attacking the other strongly. Gralton, Ward and Evans for Australia, made good passing combinations on a number of occasions. Cookson and Stout making notable plays for Britain, with Stout showing in one run: a remarkable feint, having to stop almost dead and then wheel round to hoax his opponent. Britain pressured the Australian line, with play coming to within five yards from the try line. Pressure was applied through passing the ball starting from Mullineux, and on to Cookson, Bucher, Nicholls, and Doran who was tackled well by Spragg. A scrum that was formed close to the Australian try line, was won by Australia, and Gralton cleared the ball to mid-field with a kick. Subsequent play shifted the attack to the British half. Here the Gralton, Ward, Evans combination brought Evans close to the British try line. A subsequent scrum yielded the ball to Gralton who forced his way forward, but he lost the ball. and the British cleared the ball to the western sideline. The relief was short lived, as the attack was once again brought against the British in the center of the field. Evans receiving the ball, made an unsuccessful drop goal attempt sending the ball high and wide of the goal. The ball dropped in front of the British fullback Martelli who overran the ball, having let the ball bounce. Australian players came rushing through and jumped upon the loose ball. The referee awarded the try, against the protests of the British who claimed that Kelly had illegally interfered with Martelli getting to the ball, as well as an off-side by the Australians. The reporter for the Sydney Morning Herald wrote that, From the press table, in the balcony of the members' pavilion, the interference appeared to be simply a jostle but it seemed hard to come to any other conclusion than that Kelly and Colton were off-side. The try scorer is officially recorded as Colton, however Kelly is in other places recorded as the try scorer. The conversion attempt by Spragg was unsuccessful. The restart of play was the scene of some amusement to the spectators, with the Australians returning the British drop-out, with a kick for touch. The touch umpire raised his flag, to signal touch had been found near the British 25. However, play continued, and the ball was kicked downfield into the Australians half. Some of the British players expecting play to be halted for a line-out, stood near the touch umpire who continued to hold his flag aloft. Play continued, with the Australians eventually returning play back upfield, and eventually finding touch a few yards from where the touch umpire was still standing with flag raised. The umpire alerted the referee to the earlier touch, but he was over-ruled. In the following passage of play, the British having been awarded a penalty, kicked for touch, bringing it down into Australians half. Carson who had been performing strongly in the line-outs, won the ball from the British throw-in, allowing Australia to return the ball back to half-way. The British showed some of their strong ball handling skills in the following phases. Ensuing play resulted in a penalty against Australia, which was unsuccessfully kicked for a goal attempt by Martelli. The Australians brought the ball upfield in a strong attack that resulted in the British forcing the ball in goal. The end of the half was called. Second half Stout kicked off for England in the second half and the ball was subsequently returned into touch, near the half way. The first fifteen minutes of the half were characterised as evenly matched, White had a one run, where he successfully fended a couple of tackle attempts and followed on with a kick for touch to bring the ball into the British half. After a number of phases Evans secured the ball, and kicked downfield to Martelli. However, a penalty against Australia allowed the British to relieve. Play progressed in neutral territory for a few phases until Mullineux began a series of passes that were praised for the high level of skill shown. The passes went from Mullineux to Cookson, then Francomb, then Doran and on to Nicholls, who was about to cross the touch line only a couple of yards from the try line. In time he blindly passed back, and Adamson, who was in support, received the ball passed on to Nicholls who making it through numerous Australian defenders crossed the line for the try. Martelli missed the conversion attempt. The British in the next passage of play were successful in bringing the ball back into the Australians 25, and were soon awarded a free kick. The attempt at goal was poor, and the Australians cleared the ball far down field. The British punt attempt to return the ball back to the Australians end was poor and was charged down, and with the Carew and Cookson pressing their attack by kicking the ball along the ground found their way to the British 25, where the ball was put into touch. The Australians lost the ball in one of the following phases, by way of a Bucher intercept, and had to return to their 25 to defend. A penalty was awarded to the English for off-side play but Martelli's kick for goal was again unsuccessful. Francomb followed the goal kick attempt through, and was narrowly beaten to the ball by Row, who forced it in goal. In the resumption of play, the ball was returned to the British try line by way of a deep kick by Evans. Martelli carried the ball into touch only a couple of yards from the British try line. Play continued in the British half, with a temporary relief kick being made by Britain. The match was now within the last seven minutes. After a series of scrums, Australia secured possession, and Spragg almost scored in the corner, but it was ruled that he stepped into touch. In the following passage of play, Spragg received the ball by way of a scrum win and quick passes, and made a dodgy run to break through the British line and score a try about halfway between the corner and the goal posts. In turn he kicked for the conversion and was successful. The Australians received the kick restart, and Carew kicked the ball back into British territory. The Australians forwards coming downfield, overwhelmed Martelli and secured the resulting loose ball. The ball went from Ward, to Evans and on to Spragg, who being blocked by the British Defense, passed the ball back to Evans who crossed the line, running around to score the try under the goal posts. The conversion kick by Spragg, was once again successful. Full-time was called, after the kick was made. Toowoomba Queensland Bundaberg Rockhampton Mount Morgan Central Queensland Maryborough Second Test The second Test was played at the Brisbane Exhibition Ground, in front of 15,000 spectators: a record Queensland crowd for attendance at a rugby match. In addition to the spectators inside the ground, a crowd estimated at approximately 3,000 assembled on the hill overlooking the exhibition grounds on the Fortitude Valley side of Bowen Terrace. Special trains with reduced fairs, and returning in the evening, had been arranged by the Railway Commissioner Gray for the day operating from Maryborough, and Warwick. These trains as well as the regular service trains were filled to capacity. People came hundreds of miles to see the game: from Longreach, Charleville, Gladstone, and Rockhampton. In attendance was Governor Lamington and Lady Lamington, George Le Hunte the Governor of New Guinea, among other socialites of the day. Tickets to the game were one shilling. Additional entertainment was provided by the Headquarters Band, who were criticised by the writer in the Brisbane Courier for playing their usual playlist, which included La mascotte and Dorothy, and not a fresh repertoire of music. The weather was fine, with a strong, north-east breeze blowing across the field. The temperature on the day rose to . The Australian team wore the maroon red of Queensland, with a badge of the Australian Coat of Arms. New England Northern New South Wales, 2nd Match New South Wales: Frank Row captain British Isles: Esmond Martelli, Charles Thompson, Alf Bucher, Alec Timms, Elliot Nicholson, Charlie Adamson, Gwyn Nicholls, Gerry Doran, Matthew Mullineux captain, George Cookson, Frank Stout, William Judkins, Guy Evers, Wallace Jarman, Tom McGown, John Francomb, Blair Swannell, H.G.S. Gray, Frederick Belson, Alan Ayre-Smith, George Gibson |} Metropolitan, 2nd Match Third Test Western Districts Fourth Test Combined Great Public Schools Victoria Notes Bibliography Zavos, Spiro, "'For the love of the game': The story of the first rugby Test against England at the SCG, 24 June 1899", The Roar, 2016. References 1899 rugby union tours 1899 1899–1900 in British rugby union 1899 in Australian rugby union 1899 in Irish sport
```go package server import ( "context" "fmt" "net/http" "github.com/bradleyfalzon/ghinstallation/v2" "github.com/google/go-github/v63/github" ) type NewGitHubClientOption struct { // Required PrivateKey []byte // Required IntegrationID int // RepoOwner is required for installation API. RepoOwner string // Optional Client *http.Client } func NewGitHubClient(ctx context.Context, opt *NewGitHubClientOption) (*github.Client, error) { client := opt.Client if client == nil { client = http.DefaultClient } itr, err := githubAppTransport(ctx, client, opt) if err != nil { return nil, fmt.Errorf("failed to create gh transport: %w", err) } client.Transport = itr return github.NewClient(client), nil } func githubAppTransport(ctx context.Context, client *http.Client, opt *NewGitHubClientOption) (http.RoundTripper, error) { if opt.RepoOwner == "" { return ghinstallation.NewAppsTransport(getTransport(client), int64(opt.IntegrationID), opt.PrivateKey) } installationID, err := findInstallationID(ctx, opt) if err != nil { return nil, err } return ghinstallation.New(getTransport(client), int64(opt.IntegrationID), installationID, opt.PrivateKey) } func getTransport(client *http.Client) http.RoundTripper { if client.Transport != nil { return client.Transport } return http.DefaultTransport } func findInstallationID(ctx context.Context, opt *NewGitHubClientOption) (int64, error) { appCli, err := NewGitHubClient(ctx, &NewGitHubClientOption{ PrivateKey: opt.PrivateKey, IntegrationID: opt.IntegrationID, Client: &http.Client{}, // Use different client to get installation. // Do no set RepoOwner. }) if err != nil { return 0, err } inst, _, err := appCli.Apps.FindUserInstallation(ctx, opt.RepoOwner) if err != nil { return 0, err } return inst.GetID(), nil } ```
Rabid Death's Curse is the first studio album by the black metal band Watain. It was released in 2000 on Drakkar Productions. It is notable as being the first and only album for which the band had two guitarists; from Rabid Death's Curse onwards, the band would be a trio. The song "Rabid Death's Curse" contains an audio sample from the film Friday the 13th. The album is considered a classic and was featured on German Rock Hard magazine's list 250 Black-Metal-Alben, die man kennen sollte ('250 black metal albums you should know'). Musical style and lyrics Ronald Ziegler of the German Horrible Eyes fanzine described the sound of Rabid Death's Curse as "very Swedish, very Death Metalish". According to Eduardo Rivadavia of AllMusic, the album "suggested that Watain were, at best, content to produce intentionally crude facsimiles of inspirational forefathers ranging from Bathory to Mayhem and, at worst, unable to do anything else". Rivadavia described the production as "muddy" and "less-than-ideal". According to the band's vocalist, Erik Danielsson, "[t]here were some minor mistakes regarding the productions which could have been done better, but on the other hand it is stuff that you hear after listening to it through and through far too much. At least it does not sound as whatever cheap fucking 'primitive, cult, limited, true underground Black Metal' shit out there, which is a relief. I like the album, it's one of the better to come from Sweden, it's just my sense of perfection that haunts at times." The lyrics are based upon "Satanism, or—to avoid confusion—Devilworship" and play "a terribly important role in our creations". Danielsson explained the title as "a rather personal attempt of mine to symbolically explain the idea of salvation through spiritual slavery and the will to serve. […] To put it briefly, the Rabid Death's Curse is the curse of life, the disease which we are condemned to suffer from until divine punishment comes upon us." Artwork Davthvs was "responsible for almost the whole layout, as well as the rather successful idea of printing the LP inside out, so that the lustreless side was turned out". Danielsson, who draws artwork for Watain and other bands himself, was "very pleased in working with such a talented man". The gatefold contains a photography "which is a bit hard to at 1st sight—but when the observer looks at it a bit more he witnesses it's a turned upside down photo of a decayed bird surrounded by flying autumn leaves"; the idea came from Danielsson although dead birds are the responsible artist's trademark. Davthvs found a dead bird and scanned it for the artwork. According to Danielsson, "there's much symbolism behind the usage of the bird. A dead, decayed bird represents to me the death of freedom, and the beauty that lies in the silent process of its way into ashes and dirt. It also visualises the idea of the "Rabid Death's Curse" quite well, the molten dead lying in slumber, walking towards the unescapable claws of Satan!" Reviews Rivadavia wrote that although Rabid Death's Curse "suggested that Watain were, at best, content to produce intentionally crude facsimiles of inspirational forefathers ranging from Bathory to Mayhem and, at worst, unable to do anything else", "the Swedes were really just finding their feet" and the album "fulfills an important function in Watain's career arc, one that the casual listener need never pay heed to, but which loyal fans will likely want to explore at some point in order to better comprehend all that followed". Track listing All songs written by Watain, except where noted. The original LP version by End All Life Productions included the Sabbat cover "Curdle the Blood" which is not featured on the CD version by Drakkar Productions. The 2004 CD re-release includes Dødheimsgard cover "When Heavens End". The bonus track "The Essence of Black Purity" from Watain's first official release, the 7" The Essence of Black Purity, put out by the Swedish Grim Rune Productions, was added to the remastered 2008 CD re-release by Season of Mist. Personnel H. (Håkan Jonsson) – drums P. (Pelle Forsberg) – guitars E. (Erik Danielsson) – vocals, bass C. (Crippe Blom) – guitars Additional personnel Davthvs – artwork, layout Tore Stjerna – producer, engineering, mastering References Watain albums 2000 debut albums Season of Mist albums
```objective-c //////////////////////////////////////////////////////////////////////////////////////////////////// // // Project: Embedded Learning Library (ELL) // File: FilterBankNode.h (nodes) // Authors: Chuck Jacobs // //////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include <model/include/CompilableNode.h> #include <model/include/IRMapCompiler.h> #include <model/include/InputPort.h> #include <model/include/MapCompiler.h> #include <model/include/ModelTransformer.h> #include <model/include/Node.h> #include <model/include/OutputPort.h> #include <dsp/include/FilterBank.h> #include <utilities/include/TypeName.h> #include <utilities/include/TypeTraits.h> #include <cmath> #include <string> #include <vector> namespace ell { namespace nodes { /// <summary> /// Base class for nodes that perform elementwise multiply between a set of triangular filters and the input frequency response. /// This can be useful as a way to sample different frequency bands in an FFT output to form a type of spectrogram. /// Each value in the FilterBankNode output is the result of convolving the FFT output with a triangular filter, with some width, /// centered at some location on the FFT output. As an example, imagine we have a 10-element input, and a filter of width 6 centered /// over the 6th input: /// /// | ^ | /// | /|\ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// | / | \ | /// |---|---|-.-|-.-|-.-|-.-|-.-|-.-|---| /// 0 1 2 3 4 5 6 7 8 9 /// /// then the result from this one filter would be the following (where I is the input vector): /// (I[2] * 0) + (I[3] * 0.333...) + (I[4] * 0.666) + (I[5] * 1) + (I[6] * 0.666) + (I[7] * 0.333) + (I[8] * 0) /// /// the idea then is the filters can overlap to create smooth samples of each band in the input, and the output then is sized to /// the number of filters. The implementation is optimized on the assumption that each triangle is a relatively small slice of /// the input such that it is faster to compute each triangle than to do a dot products for each filter against the entire input. /// </summary> template <typename ValueType> class FilterBankNode : public model::CompilableNode { public: /// @name Input and Output Ports /// @{ const model::InputPort<ValueType>& input = _input; const model::OutputPort<ValueType>& output = _output; /// @} protected: /// <summary> Construct a FilterBankeNode from the given filters </summary> FilterBankNode(const dsp::TriangleFilterBank& filters); /// <summary> Construct a FilterBankeNode from an output port, the given filters</summary> FilterBankNode(const model::OutputPort<ValueType>& input, const dsp::TriangleFilterBank& filters); void Compute() const override; void Compile(model::IRMapCompiler& compiler, emitters::IRFunctionEmitter& function) override; void WriteToArchive(utilities::Archiver& archiver) const override; void ReadFromArchive(utilities::Unarchiver& archiver) override; bool HasState() const override { return true; } // Stored state: filters // Inputs model::InputPort<ValueType> _input; // Output model::OutputPort<ValueType> _output; private: // FilterBank const dsp::TriangleFilterBank& _filters; ValueType _offset; }; /// <summary> /// A node that applies a linearly-spaced filter bank to an FFT output /// </summary> template <typename ValueType> class LinearFilterBankNode : public FilterBankNode<ValueType> { public: /// @name Input and Output Ports /// @{ using FilterBankNode<ValueType>::input; using FilterBankNode<ValueType>::output; /// @} /// <summary> Default Constructor </summary> LinearFilterBankNode(); /// <summary> Constructor </summary> /// /// <param name="input"> The signal to process. </param> LinearFilterBankNode(const model::OutputPort<ValueType>& input, const dsp::LinearFilterBank& filters); /// <summary> Gets the name of this type (for serialization). </summary> /// /// <returns> The name of this type. </returns> static std::string GetTypeName() { return utilities::GetCompositeTypeName<ValueType>("LinearFilterBankNode"); } /// <summary> Gets the name of this type (for serialization). </summary> /// /// <returns> The name of this type. </returns> std::string GetRuntimeTypeName() const override { return GetTypeName(); } protected: void WriteToArchive(utilities::Archiver& archiver) const override; void ReadFromArchive(utilities::Unarchiver& archiver) override; private: using FilterBankNode<ValueType>::_input; using FilterBankNode<ValueType>::_output; void Copy(model::ModelTransformer& transformer) const override; // FilterBank dsp::LinearFilterBank _linearFilters; }; /// <summary> /// A node that applies a mel filter bank to an FFT output /// </summary> template <typename ValueType> class MelFilterBankNode : public FilterBankNode<ValueType> { public: /// @name Input and Output Ports /// @{ using FilterBankNode<ValueType>::input; using FilterBankNode<ValueType>::output; /// @} /// <summary> Default Constructor </summary> MelFilterBankNode(); /// <summary> Constructor </summary> /// /// <param name="input"> The signal to process. </param> MelFilterBankNode(const model::OutputPort<ValueType>& input, const dsp::MelFilterBank& filters); /// <summary> Gets the name of this type (for serialization). </summary> /// /// <returns> The name of this type. </returns> static std::string GetTypeName() { return utilities::GetCompositeTypeName<ValueType>("MelFilterBankNode"); } /// <summary> Gets the name of this type (for serialization). </summary> /// /// <returns> The name of this type. </returns> std::string GetRuntimeTypeName() const override { return GetTypeName(); } protected: void WriteToArchive(utilities::Archiver& archiver) const override; void ReadFromArchive(utilities::Unarchiver& archiver) override; private: using FilterBankNode<ValueType>::_input; using FilterBankNode<ValueType>::_output; void Copy(model::ModelTransformer& transformer) const override; // FilterBank dsp::MelFilterBank _melFilters; }; } // namespace nodes } // namespace ell ```
Won Soo-yeon (born January 12, 1961) is a South Korean female manhwa artist who writes in the shoujo (romance) genre. She debuted in 1987 and has published several titles; among her best known serials are Full House (2002) and its sequel Full House 2 (2005). Two of her comics have been adapted into television dramas: Full House (2004) and Mary Stayed Out All Night (2010). She is married to fellow manhwa artist Doha Kang, with whom she has two children. Works Elio and Yvette (1992) Let Dai (1995) Confession (manhwa anthology) (1999) Full House (2002) I Want You (2003) Full House 2 (2005) The Devil's Trill (2006) Mary Stayed Out All Night (2009) Adaptions of work Mary Stayed Out All Night Full House (2004) Awards State honors Notes References External links 1961 births South Korean manhwa artists South Korean manhwa writers Living people South Korean female comics artists South Korean women artists Female comics writers
Western College, in Bristol, England, opened in 1906 as a theological college for the Congregational Union of England and Wales. The building was designed by the Bristol architect Henry Dare Bryan, and given Grade II* listing in 1966. It closed in 1968, and the building was subsequently used as the HQ of the Southern Universities Joint Examination Board, and since 1993 as a medical practice. References Former theological colleges in England Congregationalism in the United Kingdom University and college buildings completed in 1906 Grade II* listed buildings in Bristol
```javascript Create projects with `npm init` Bump package version in npm List binaries for scripting in npm `peerDependencies` Lock down dependency versions by shrinkwrapping ```
```python #!/usr/bin/python # (See accompanying file LICENSE_1_0.txt or path_to_url # This tests the facilities for deleting modules. import BoostBuild t = BoostBuild.Tester(pass_toolset=0) t.write("file.jam", """ module foo { rule bar { } var = x y ; } DELETE_MODULE foo ; if [ RULENAMES foo ] { EXIT DELETE_MODULE failed to kill foo's rules: [ RULENAMES foo ] ; } module foo { if $(var) { EXIT DELETE_MODULE failed to kill foo's variables ; } rule bar { } var = x y ; DELETE_MODULE foo ; if $(var) { EXIT internal DELETE_MODULE failed to kill foo's variables ; } if [ RULENAMES foo ] { EXIT internal DELETE_MODULE failed to kill foo's rules: [ RULENAMES foo ] ; } } DEPENDS all : xx ; NOTFILE xx ; """) t.run_build_system(["-ffile.jam"], status=0) t.cleanup() ```
```php <?php /************************************************************************* Generated via "php artisan localization:missing" at 2018/04/19 17:07:35 *************************************************************************/ return array ( //============================== New strings to translate ==============================// 'scan_another_ticket' => 'Scan Another Ticket', 'scanning' => 'Scanning', 'has_arrived' => 'Has Arrived', 'arrival_time' => 'Arrival Time', //==================================== Translations ====================================// 'attendees' => 'Attendees', 'check_in' => 'Check in: :event', 'email' => 'Email', 'email_address' => 'Email Address', 'event_attendees' => 'Event Attendees', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'name' => 'Name', 'ticket' => 'Ticket', 'reference' => 'Reference', 'search_attendees' => 'Search Attendees...', 'send_invitation_n_ticket_to_attendee' => 'Send invitation & ticket to attendee.', ); ```
Spongia officinalis, better known as a variety of bath sponge, is a commercially used sea sponge. Individuals grow in large lobes with small openings and are formed by a mesh of primary and secondary fibers. It is light grey to black in color. It is found throughout the Mediterranean Sea up to 100 meters deep on rocky or sandy surfaces. Spongia officinalis can reproduce both asexually, through budding or fragmentation, or sexually. Individuals can be dioecious or sequential hermaphrodites. The free-swimming larvae are lecithotrophic and grow slowly after attaching to a benthic surface. Humans use and interact with S. officinalis in a variety of ways. Harvested sponges have been used throughout history for many purposes, including washing and painting. Over-harvesting and sponge disease have led to a decrease in population. Sponge fishing practices have slowly changed over time as new technology has developed and sponge farming is now in use to decrease stress on wild S. officinalis populations. Sponge farming is also recommended as a solution to reducing marine organic pollution, especially from fish farms. Anatomy and morphology Spongia officinalis grows in massive, globular lobes with fine openings which are slightly elevated and have cone-shaped voids (conules). Oscula can either be scattered or at the tip of the lobes. Spongia officinalis have an ectosomal skeleton composed of primary and secondary fibers. Together, they form the conulose openings. The sponge also contains a choanosomal skeleton, which consists of a dense, irregular mesh of polygons formed by secondary fibers and primary fibers rise from it. The primary fibers are 50 to 100 nanometers in diameter and are composed of spongin and inclusions such as sand grains and spicules. The secondary fibers are 20 to 35 nanometers in diameter and are composed of only spongin without inclusions. Spongia officinalis is light grey to black in color. Distribution and habitat Spongia officinalis can be found in the Mediterranean Sea along the coasts of Croatia, Greece, the Aegean islands, Turkey, Cyprus, Syria, Egypt, Libya, Tunisia, Italy, France and Spain. They are distributed in shallow water (1 to 10 meters below the surface) down to 100 meters deep. They will grow on littoral rocky surfaces, sandy bottoms, and vertical walls in well-oxygenated water. Reproduction Spongia officinalis can reproduce asexually via budding or fragmentation. Sexual reproduction is also common in S. officinalis. Individuals can be dioecious, either male or female, or sequential hermaphrodites, meaning they can alternate between male and female. Successive hermaphroditism can take place within one reproductive season. Sperm is formed in spermatic cysts and is free spawned into the surrounding water. Sperm is captured by females and is transported to oocytes within the sponge where fertilization takes place. The occurrence of sexual reproduction peaks from October to November. There is no relationship between age and reproductive ability in S. officinalis. Life cycle After fertilization, S. officinalis embryos develop in choanosomal tissue of the female sponge. Cleavage of cells begins after fertilization, around November, and is total and equal. By May, a stereoblastula, or a blastula without a clear central cavity, forms. From May to July, parenchymella larva, or larva which is a mass of cells enveloped in flagellated cells, develop. These larvae are released from the adult from June to July. Like all sponges, S. officinalis larvae are lecithotrophic, meaning they cannot feed as larva and instead rely on energy reserves provided by the mother. Therefore, they only remain as a free-floating larva for a short period before settling on a benthic surface where they grow into an adult sponge. Taxonomy Spongia officinalis was first described by Carl Linnaeus in 1759. The common names "bath sponge," "Fina Dalmata," and "Matapas" are usually used to refer to this species. Human uses and interactions Uses The use of bath sponges for bathing and other purposes originated in Greece and spread all around Europe during the Middle Ages. From there, the use of sponges spread further, with Mediterranean bath sponges currently being shipped globally. S. officinalis was used by humans in many ways in the past. Aside from using the sponge for washing, some of these uses included padding in Roman soldiers helmets, as absorbent material during surgeries, as medicine to help digestive issues, and as a primitive "contraceptive sponge". Today, sponges are still used for washing and are also used for recreational purposes, like sponge painting. Fishing practices Sponge fishing in the Mediterranean has been in practice since ancient times. Aristotle even wrote of it around 350 BC. Traditionally, sponge fishing was practiced by Greeks who dove underwater to collect specimens. The practice remained this way until the late 19th century. There was a small increase in sponge fishing at the end of the 19th century due to the invention of a new diving suit, but the suit was not very safe so sponge fishing did not grow much in popularity. Around 1910 to 1930, an underwater breathing device was created and, since then, this method of sponge fishing has continually grown in popularity. Sponges can also be collected after they wash up on beaches or they can be fished from a boat. Farming As S. officinalis populations declined due to over-harvest, as discussed below, interest in cultivation increased. Towards the end of the 19th century, the first sponge farming attempts were made in the Mediterranean Sea by fixing sponge fragments onto wooden boxes and setting them into suitable habitats. Although the efforts were successful, sponge farming activity did not increase significantly until the end of the 20th century and currently, it is performed worldwide. Sponge farming not only decreases stress on S. officinalis populations, it also can be used as a sustainable method to reduce marine organic pollution because, sponges being filter feeders, they efficiently remove organic suspended particles from water. For this reason, sponge cultivation in combination with fish farming has been recommended as a method to reduce organic pollution from fish farms. Conservation status Over-harvesting and sponge disease have led to a decrease in Mediterranean S. officinalis populations. People have harvested sponges in the Mediterranean since ancient times. Growing demand has led to overexploitation of these sponges. Beginning in the 1980s, populations of S. officinalis in the Mediterranean have significantly declined. In addition to this, a sponge disease caused by pathogenic bacteria and fungi has further reduced populations. The bacteria and fungi destroy tissues and fibers of the sponges, making them weak. Due to the regenerative abilities of these sponges, they are able to set aside infected tissue and recover. But, when the effects of the disease are compounded by the effects of over-harvesting, populations have struggled to recover and local extinctions have occurred. References Baldacconi, R., et al. "Sexual reproduction, larval development and release in Spongia officinalis L.(Porifera, Demospongiae) from the Apulian coast." Marine Biology 152.4 (2007): 969-979. Baldacconi, Rossella, et al. "Transplantation of Spongia officinalis L.(Porifera, Demospongiae): a technical approach for restocking this endangered species." Marine Ecology 31.2 (2010): 309-317. Cook, S.D.C., and P.R. Bergquist. “Family Spongiidae Gray.” 1867: 1051-1060. In Hooper, J. N. A. and R. W. M. Van Soest. (ed.) “Systema Porifera. A guide to the classification of sponges. 1 (Kluwer Academic/ Plenum Publishers: New York, Boston, Dordrecht, London, Moscow).” 2002. De Laubenfels, Max Walker. "Guide to the sponges of eastern North America." (1953). Díaz, Humberto, and Marina Bevilacqua. Esponjas en manglares del Parque Nacional Morrocoy. Fondo Editorial Acta Científico Venezolana, 1985. Esponjas (Esponjas de baño). Pp: 111. 1980: En; Diccionario Monográfico del Reino Animal. Biblograf, S.A. España. Gaino, Elda, et al. "Mortality of commercial sponges: incidence in two Mediterranean areas." Italian Journal of Zoology 59.1 (1992): 79-85. Gifford, Scott, et al. "Aquatic zooremediation: deploying animals to remediate contaminated aquatic environments." TRENDS in Biotechnology 25.2 (2007): 60-65. Linné, Carl von. Systema naturae per regna tria naturae: secundum classes, ordines, genera, species, cum characteribus, differentiis, synonymis, locis. Vol. 1, pt. 7. Lugduni: Apud JB Delamolliere, 1789. Pronzato, Roberto, and Renata Manconi. "Mediterranean commercial sponges: over 5000 years of natural history and cultural heritage." Marine Ecology 29.2 (2008): 146-166. Pronzato, Roberto. "Sponge‐fishing, disease and farming in the Mediterranean Sea." Aquatic Conservation: Marine and Freshwater Ecosystems 9.5 (1999): 485-493. Riesgo, Ana, et al. "Some like it fat: comparative ultrastructure of the embryo in two Demosponges of the Genus Mycale (Order Poecilosclerida) from Antarctica and the Caribbean." PLOS ONE 10.3 (2015). Rützler, Klaus, Rob WM van Soest, and Carla Piantoni. "Sponges (Porifera) of the Gulf of Mexico." Gulf of Mexico Origins, Waters, and Biota 1 (2009): 285-313. Stabili, Loredana, et al. "Filtering activity of Spongia officinalis var. adriatica (Schmidt)(Porifera, Demospongiae) on bacterioplankton: implications for bioremediation of polluted seawater." Water research 40.16 (2006): 3083-3090. External links Spongia officinalis info World Register of Marine Species Integrated Taxonomic Information System: Spongia officinalis Taxonomic Serial No.: 47545 ZipCodeZoo.com: Spongia officinalis (Dalmatische Spons;badspons) Biodiversity Heritage Library (BHL): Spongia officinalis Spongiidae Animals described in 1759 Taxa named by Carl Linnaeus
The 1951 Bowling Green Falcons football team was an American football team that represented Bowling Green State University as an independent during the 1951 college football season. In their 11th season under head coach Robert Whittaker, the Falcons compiled a 4–4–1 record and were outscored by all opponents by a combined total of 178 to 150. The team's statistical leaders were Rex Simonds with 506 passing yards, fullback Fred Durig with 1,444 rushing yards, and Jim Ladd with 236 receiving yards. Durig's 1,444 rushing yards stood as a Bowling Green single season record until 1974. Ollie Glass and Eugene Aldridge were the team captains. Durig received the team's Most Valuable Player award. Schedule References Bowling Green Bowling Green Falcons football seasons Bowling Green Falcons football
Aberdeen Town House is a municipal facility in Castle Street, Aberdeen, Scotland. The town house, which is the headquarters of Aberdeen City Council, is a Category A listed building. History After rapid population growth in the first half of the 19th century, civic leaders decided that the early 17th-century tolbooth and the early 19th-century courthouse, which had been built adjacent to the tolbooth, were inadequate for their needs. They decided to demolish the old courthouse and to incorporate the remaining part of the tolbooth into a new structure. The new building was designed by Peddie and Kinnear in the Scottish baronial style and was completed in 1874. The design involved an asymmetrical frontage with fifteen bays along Castle Street; the central section of five bays featured segmental-arched arcading on the ground floor and double-height segmental-arched windows on the second and third floors; the western section incorporated a five-stage clock tower with a spire while the eastern section incorporated the southern elevation of the old tolbooth. Internally, the principal room was the double-height council chamber. The new town house served as the headquarters of Aberdeen Town Council until 1895, when that body was replaced by Aberdeen Corporation. King Edward VII and Queen Alexandra inspected a Guard of Honour from the 3rd Battalion of the Gordon Highlanders in front of the new town house on 27 September 1906. The building remained the Corporation's headquarters until it was replaced by Aberdeen District Council under the wider Grampian Regional Council in May 1975. The foundation stone for an extension along Broad Street was laid by the Lord Provost, Robert Lennox, on 17 November 1975. The extension which was designed by the city architects, I. A. Ferguson and T. C. Watson, was built by Taylor Woodrow Construction. The complex then remained the Aberdeen District Council headquarters until the abolition of the Grampian Region led to the formation of Aberdeen City Council in April 1996. The whole complex was extensively refurbished at a cost of £4 million between August 2014 and March 2017. Works of art in the complex include a sculpture of Robert the Bruce by Anne Davidson showing the Scottish king in 14th-century armour carrying his shield and sword. See also List of listed buildings in Aberdeen/4 References Aberdeen Government buildings completed in 1874 1874 establishments in Scotland Category A listed buildings in Aberdeen Listed government buildings in Scotland Politics of Aberdeen Clock towers in the United Kingdom
```javascript 'use strict' const BB = require('bluebird') const andAddParentToErrors = require('./and-add-parent-to-errors.js') const failedDependency = require('./deps.js').failedDependency const isInstallable = BB.promisify(require('./validate-args.js').isInstallable) const moduleName = require('../utils/module-name.js') const npm = require('../npm.js') const reportOptionalFailure = require('./report-optional-failure.js') const validate = require('aproba') const actions = {} actions.fetch = require('./action/fetch.js') actions.extract = require('./action/extract.js') actions.build = require('./action/build.js') actions.preinstall = require('./action/preinstall.js') actions.install = require('./action/install.js') actions.postinstall = require('./action/postinstall.js') actions.prepare = require('./action/prepare.js') actions.finalize = require('./action/finalize.js') actions.remove = require('./action/remove.js') actions.unbuild = require('./action/unbuild.js') actions.move = require('./action/move.js') actions['global-install'] = require('./action/global-install.js') actions['global-link'] = require('./action/global-link.js') actions['refresh-package-json'] = require('./action/refresh-package-json.js') // FIXME: We wrap actions like three ways to sunday here. // Rewrite this to only work one way. Object.keys(actions).forEach(function (actionName) { var action = actions[actionName] actions[actionName] = (staging, pkg, log) => { validate('SOO', [staging, pkg, log]) // refuse to run actions for failed packages if (pkg.failed) return BB.resolve() if (action.rollback) { if (!pkg.rollback) pkg.rollback = [] pkg.rollback.unshift(action.rollback) } if (action.commit) { if (!pkg.commit) pkg.commit = [] pkg.commit.push(action.commit) } let actionP if (pkg.knownInstallable) { actionP = runAction(action, staging, pkg, log) } else { actionP = isInstallable(null, pkg.package).then(() => { pkg.knownInstallable = true return runAction(action, staging, pkg, log) }) } return actionP.then(() => { log.finish() }, (err) => { return BB.fromNode((cb) => { andAddParentToErrors(pkg.parent, cb)(err) }).catch((err) => { return handleOptionalDepErrors(pkg, err) }) }) } actions[actionName].init = action.init || (() => BB.resolve()) actions[actionName].teardown = action.teardown || (() => BB.resolve()) }) exports.actions = actions function runAction (action, staging, pkg, log) { return BB.fromNode((cb) => { const result = action(staging, pkg, log, cb) if (result && result.then) { result.then(() => cb(), cb) } }) } function markAsFailed (pkg) { if (pkg.failed) return pkg.failed = true pkg.requires.forEach((req) => { var requiredBy = req.requiredBy.filter((reqReqBy) => !reqReqBy.failed) if (requiredBy.length === 0 && !req.userRequired) { markAsFailed(req) } }) } function handleOptionalDepErrors (pkg, err) { markAsFailed(pkg) var anyFatal = failedDependency(pkg) if (anyFatal) { throw err } else { reportOptionalFailure(pkg, null, err) } } exports.doOne = doOne function doOne (cmd, staging, pkg, log, next) { validate('SSOOF', arguments) const prepped = prepareAction([cmd, pkg], staging, log) return withInit(actions[cmd], () => { return execAction(prepped) }).nodeify(next) } exports.doParallel = doParallel function doParallel (type, staging, actionsToRun, log, next) { validate('SSAOF', arguments) const acts = actionsToRun.reduce((acc, todo) => { if (todo[0] === type) { acc.push(prepareAction(todo, staging, log)) } return acc }, []) log.silly('doParallel', type + ' ' + acts.length) time(log) if (!acts.length) { return next() } return withInit(actions[type], () => { return BB.map(acts, execAction, { concurrency: npm.limit.action }) }).nodeify((err) => { log.finish() timeEnd(log) next(err) }) } exports.doSerial = doSerial function doSerial (type, staging, actionsToRun, log, next) { validate('SSAOF', arguments) log.silly('doSerial', '%s %d', type, actionsToRun.length) runSerial(type, staging, actionsToRun, log, next) } exports.doReverseSerial = doReverseSerial function doReverseSerial (type, staging, actionsToRun, log, next) { validate('SSAOF', arguments) log.silly('doReverseSerial', '%s %d', type, actionsToRun.length) runSerial(type, staging, [].concat(actionsToRun).reverse(), log, next) } function runSerial (type, staging, actionsToRun, log, next) { const acts = actionsToRun.reduce((acc, todo) => { if (todo[0] === type) { acc.push(prepareAction(todo, staging, log)) } return acc }, []) time(log) if (!acts.length) { return next() } return withInit(actions[type], () => { return BB.each(acts, execAction) }).nodeify((err) => { log.finish() timeEnd(log) next(err) }) } function time (log) { process.emit('time', 'action:' + log.name) } function timeEnd (log) { process.emit('timeEnd', 'action:' + log.name) } function withInit (action, body) { return BB.using( action.init().disposer(() => action.teardown()), body ) } function prepareAction (action, staging, log) { validate('ASO', arguments) validate('SO', action) var cmd = action[0] var pkg = action[1] if (!actions[cmd]) throw new Error('Unknown decomposed command "' + cmd + '" (is it new?)') return [actions[cmd], staging, pkg, log.newGroup(cmd + ':' + moduleName(pkg))] } function execAction (todo) { return todo[0].apply(null, todo.slice(1)) } ```
```c++ // (See accompanying file LICENSE.md or copy at path_to_url #include <boost/hana/all_of.hpp> #include <boost/hana/assert.hpp> #include <boost/hana/config.hpp> #include <boost/hana/ext/std/integral_constant.hpp> #include <boost/hana/integral_constant.hpp> #include <boost/hana/mod.hpp> #include <boost/hana/not.hpp> #include <boost/hana/not_equal.hpp> #include <boost/hana/traits.hpp> #include <boost/hana/tuple.hpp> #include <boost/hana/type.hpp> #include <type_traits> namespace hana = boost::hana; using namespace hana::literals; BOOST_HANA_CONSTEXPR_LAMBDA auto is_odd = [](auto x) { return x % 2_c != 0_c; }; int main() { BOOST_HANA_CONSTEXPR_CHECK(hana::all_of(hana::make_tuple(1, 3), is_odd)); BOOST_HANA_CONSTANT_CHECK(!hana::all_of(hana::make_tuple(3_c, 4_c), is_odd)); BOOST_HANA_CONSTANT_CHECK( !hana::all_of(hana::make_tuple(hana::type<void>{}, hana::type<char&>{}), hana::traits::is_void) ); BOOST_HANA_CONSTANT_CHECK( hana::all_of(hana::make_tuple(hana::type_c<int>, hana::type_c<char>), hana::traits::is_integral) ); } ```
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\ToolResults\Resource; use Google\Service\ToolResults\Environment; use Google\Service\ToolResults\ListEnvironmentsResponse; /** * The "environments" collection of methods. * Typical usage is: * <code> * $toolresultsService = new Google\Service\ToolResults(...); * $environments = $toolresultsService->projects_histories_executions_environments; * </code> */ class ProjectsHistoriesExecutionsEnvironments extends \Google\Service\Resource { /** * Gets an Environment. May return any of the following canonical error codes: - * PERMISSION_DENIED - if the user is not authorized to read project - * INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the * Environment does not exist (environments.get) * * @param string $projectId Required. A Project id. * @param string $historyId Required. A History id. * @param string $executionId Required. An Execution id. * @param string $environmentId Required. An Environment id. * @param array $optParams Optional parameters. * @return Environment * @throws \Google\Service\Exception */ public function get($projectId, $historyId, $executionId, $environmentId, $optParams = []) { $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId, 'environmentId' => $environmentId]; $params = array_merge($params, $optParams); return $this->call('get', [$params], Environment::class); } /** * Lists Environments for a given Execution. The Environments are sorted by * display name. May return any of the following canonical error codes: - * PERMISSION_DENIED - if the user is not authorized to read project - * INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the * containing Execution does not exist * (environments.listProjectsHistoriesExecutionsEnvironments) * * @param string $projectId Required. A Project id. * @param string $historyId Required. A History id. * @param string $executionId Required. An Execution id. * @param array $optParams Optional parameters. * * @opt_param int pageSize The maximum number of Environments to fetch. Default * value: 25. The server will use this default if the field is not set or has a * value of 0. * @opt_param string pageToken A continuation token to resume the query at the * next item. * @return ListEnvironmentsResponse * @throws \Google\Service\Exception */ public function listProjectsHistoriesExecutionsEnvironments($projectId, $historyId, $executionId, $optParams = []) { $params = ['projectId' => $projectId, 'historyId' => $historyId, 'executionId' => $executionId]; $params = array_merge($params, $optParams); return $this->call('list', [$params], ListEnvironmentsResponse::class); } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(ProjectsHistoriesExecutionsEnvironments::class, your_sha256_hashnvironments'); ```
TGV 001 (Train à Grande Vitesse 001) was a high-speed railway train built in France. It was the first TGV prototype and was commissioned in 1969, to begin testing in 1972. The TGV 001 was an experimental gas turbine-electric locomotive-powered trainset built by Alstom to break speed records between . The experimental train was part of a vast research program on high rail speeds. This program covered all technical aspects, principally traction, the behaviour of the vehicles, braking, aerodynamics and signalling. Originally, two trains were to be built, but only one was produced. The second was to be a tilting train equipped with an active tilting system, but was abandoned owing to technical difficulties. Description This turbotrain was built in a radically different fashion than its predecessors (the ETG and the RTG); it was composed of two power cars and three carriages, all with driving axles. This concept as well as the shape of the TGV 001 was kept when designing the future TGV. Each axle was equipped with a traction motor with the advantage of small weight per axle but maximum power. Electric traction permitted dynamic braking, particularly effective at high speeds. Each power car was equipped with two Turbomeca Turmo turbines (TURMO III G then TURMO X), also used in the Super Frelon helicopters. As well as having direct control of the turbines, the power cars were equipped with traction, braking and signalling controls. The TGV 001 was an articulated train; each carriage shared one bogie with the next. This setup ensured greater stability and permitted the suspension to be placed near the centre of gravity of each carriage, thus reducing rolling in curves. Service Despite setting the speed record for a gas turbine-powered locomotive at , this train never saw commercial use. History TGV 001 was finished on 24 March 1972 and began to undergo testing on 4 April 1972. It went on to carry out 5,227 test runs, running and breaking the barrier 175 times. TGV 001 still holds the world speed record for a gas turbine-electric locomotive, having travelled at on 8 December 1972. The 1973 oil crisis caused a sharp increase in the price of oil, after which it was deemed impractical to use oil to power the TGV, and the project turned to electric traction. Tests officially concluded on 19 June 1978. Preservation T 001: Bischheim (Bas-Rhin) T 002: Belfort (Territoire de Belfort) See also Turbotrain Gas turbine locomotive#Gas turbine-electric SNCF British Rail APT-E External links 45 ans de TGV High-speed trains of France Land speed record rail vehicles 001 Gas turbine multiple units of France Gas turbine multiple units with locomotive-like power cars Experimental and prototype high-speed trains
```ruby # frozen_string_literal: true require 'rails_helper' describe Admin::SystemCheck::BaseCheck do subject(:check) { described_class.new(user) } let(:user) { Fabricate(:user) } describe 'skip?' do it 'returns false' do expect(check.skip?).to be false end end describe 'pass?' do it 'raises not implemented error' do expect { check.pass? }.to raise_error(NotImplementedError) end end describe 'message' do it 'raises not implemented error' do expect { check.message }.to raise_error(NotImplementedError) end end end ```
```groff ERLANG PUBLIC LICENSE Version 1.1 1. Definitions. 1.1. ``Contributor'' means each entity that creates or contributes to the creation of Modifications. 1.2. ``Contributor Version'' means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3. ``Covered Code'' means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4. ``Electronic Distribution Mechanism'' means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5. ``Executable'' means Covered Code in any form other than Source Code. 1.6. ``Initial Developer'' means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.9. ``Modifications'' means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.11. ``Source Code'' means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or a list of source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 2.1. The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and (b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell (``Utilize'') the Original Code (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or combinations. 2.2. Contributor Grant. Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code or as part of a Larger Work; and (b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that may be necessary to Utilize further Modifications or combinations. 3. Distribution Obligations. 3.3. Description of Modifications. You must cause all Covered Code to which you contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4. Intellectual Property Matters (b) Contributor APIs. If Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file. 6. CONNECTION TO MOZILLA PUBLIC LICENSE 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 9. DISCLAIMER OF LIABILITY Any utilization of Covered Code shall not cause the Initial Developer or any Contributor to be liable for any damages (neither direct nor indirect). 10. MISCELLANEOUS EXHIBIT A. ```
Thora Patricia Whitehead (27 January 1936 – 30 September 2021) was an Australian scientific collector and malacologist. She collected more than 200,000 shell specimens which are now held in the Queensland Museum. With Kevin Lamprell, Whitehead co-wrote the two-volume Bivalves of Australia. She also edited Lamprell's book, Spondylus: Spiny oyster shells of the world, in 1986. Whitehead spent over 50 years collecting shells, particularly along the coast of Queensland. She found specimens in mangrove forests and on beaches, rocky outcrops and coral reefs. In the process of photographing the specimens prior to acquisition of Whitehead's extensive shell collection by the Queensland Museum, its curator John Healy discovered a new species. He named it Amoria thorae in her honour. Born in Chile in 1936, Whitehead died in Brisbane in 2021 aged 85. She was survived by John, her husband of 56 years, and three children. Legacy A number of species were named in her honour, including Amoria thorae, Callocardia thorae, Conus whiteheadae, Morula whiteheadae, Nassarius whiteheadae and Terebra whiteheadae. References 1936 births 2021 deaths Australian malacologists Australian women scientists
```emacs lisp ;;; srecode.el --- Semantic buffer evaluator. ;; Author: Eric M. Ludlam <zappo@gnu.org> ;; Keywords: codegeneration ;; Version: 1.2 ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; along with GNU Emacs. If not, see <path_to_url ;;; Commentary: ;; ;; Semantic does the job of converting source code into useful tag ;; information. The set of `semantic-format-tag' functions has one ;; function that will create a prototype of a tag, which has severe ;; issues of complexity (in the format tag file itself) and inaccuracy ;; (for the purpose of C++ code.) ;; ;; Contemplation of the simplistic problem within the scope of ;; semantic showed that the solution was more complex than could ;; possibly be handled in semantic/format.el. Semantic Recode, or ;; srecode is a rich API for generating code out of semantic tags, or ;; recoding the tags. ;; ;; See the srecode manual for specific details. (require 'eieio) (require 'mode-local) (load "srecode/loaddefs" nil 'nomessage) (defvar srecode-version "1.2" "Current version of the Semantic Recoder.") ;;; Code: (defgroup srecode nil "Semantic Recoder." :group 'extensions :group 'tools) (provide 'srecode) ;;; srecode.el ends here ```
```c++ // Use, modification and distribution are subject to the // (See accompanying file LICENSE_1_0.txt // or copy at path_to_url #include <boost/math/policies/policy.hpp> #include <boost/type_traits/is_same.hpp> #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> // for test_main #include <iostream> template <class P1, class P2> bool check_same(const P1&, const P2&) { if(!boost::is_same<P1, P2>::value) { std::cout << "P1 = " << typeid(P1).name() << std::endl; std::cout << "P2 = " << typeid(P2).name() << std::endl; } return boost::is_same<P1, P2>::value; } BOOST_AUTO_TEST_CASE( test_main ) { using namespace boost::math::policies; using namespace boost; BOOST_CHECK(is_domain_error<domain_error<ignore_error> >::value); BOOST_CHECK(0 == is_domain_error<pole_error<ignore_error> >::value); BOOST_CHECK(is_pole_error<pole_error<ignore_error> >::value); BOOST_CHECK(0 == is_pole_error<domain_error<ignore_error> >::value); BOOST_CHECK(is_digits10<digits10<ignore_error> >::value); BOOST_CHECK(0 == is_digits10<digits2<ignore_error> >::value); BOOST_CHECK((is_same<policy<>::domain_error_type, domain_error<BOOST_MATH_DOMAIN_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<>::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::domain_error_type, domain_error<ignore_error> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::pole_error_type, pole_error<BOOST_MATH_POLE_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::indeterminate_result_error_type, indeterminate_result_error<BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<domain_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::pole_error_type, pole_error<user_error> >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::overflow_error_type, overflow_error<BOOST_MATH_OVERFLOW_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::indeterminate_result_error_type, indeterminate_result_error<BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<pole_error<user_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::overflow_error_type, overflow_error<errno_on_error> >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::underflow_error_type, underflow_error<BOOST_MATH_UNDERFLOW_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::indeterminate_result_error_type, indeterminate_result_error<BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<overflow_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::underflow_error_type, underflow_error<errno_on_error> >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::denorm_error_type, denorm_error<BOOST_MATH_DENORM_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::indeterminate_result_error_type, indeterminate_result_error<BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<underflow_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::denorm_error_type, denorm_error<errno_on_error> >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::evaluation_error_type, evaluation_error<BOOST_MATH_EVALUATION_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::indeterminate_result_error_type, indeterminate_result_error<BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY> >::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<denorm_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::denorm_error_type, policy<>::denorm_error_type >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::evaluation_error_type, evaluation_error<errno_on_error> >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::indeterminate_result_error_type, policy<>::indeterminate_result_error_type >::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<evaluation_error<errno_on_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::denorm_error_type, policy<>::denorm_error_type >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::evaluation_error_type, policy<>::evaluation_error_type >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::indeterminate_result_error_type, indeterminate_result_error<ignore_error> >::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::precision_type, policy<>::precision_type>::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<indeterminate_result_error<ignore_error> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<digits2<20> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::denorm_error_type, policy<>::denorm_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::evaluation_error_type, policy<>::evaluation_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::indeterminate_result_error_type, policy<>::indeterminate_result_error_type >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::precision_type, digits2<20> >::value)); BOOST_CHECK((is_same<policy<digits2<20> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<digits2<20> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<digits2<20> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::denorm_error_type, policy<>::denorm_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::evaluation_error_type, policy<>::evaluation_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::indeterminate_result_error_type, policy<>::indeterminate_result_error_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::precision_type, policy<>::precision_type >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::promote_float_type, promote_float<false> >::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<promote_float<false> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::denorm_error_type, policy<>::denorm_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::evaluation_error_type, policy<>::evaluation_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::indeterminate_result_error_type, policy<>::indeterminate_result_error_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::precision_type, policy<>::precision_type >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::promote_double_type, promote_double<false> >::value)); BOOST_CHECK((is_same<policy<promote_double<false> >::discrete_quantile_type, policy<>::discrete_quantile_type>::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::domain_error_type, policy<>::domain_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::pole_error_type, policy<>::pole_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::overflow_error_type, policy<>::overflow_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::underflow_error_type, policy<>::underflow_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::denorm_error_type, policy<>::denorm_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::evaluation_error_type, policy<>::evaluation_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::indeterminate_result_error_type, policy<>::indeterminate_result_error_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::precision_type, policy<>::precision_type >::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::promote_float_type, policy<>::promote_float_type>::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::promote_double_type, policy<>::promote_double_type>::value)); BOOST_CHECK((is_same<policy<discrete_quantile<integer_round_up> >::discrete_quantile_type, discrete_quantile<integer_round_up> >::value)); } // BOOST_AUTO_TEST_CASE( test_main ) ```
Toa Payoh Single Member Constituency was a constituency that holds the Toa Payoh area, in the Central Region of Singapore, from 1959 to 1988. The constituency broke away into Boon Teck, Kim Keat and Kuo Chuan in 1972 general elections, and Khe Bong in 1976 general elections. Member of Parliament Candidates and results Elections in 1950s Elections in 1960s Elections in 1970s Elections in 1980s References Singaporean electoral divisions Toa Payoh
```forth *> \brief <b> CGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices</b> * * =========== DOCUMENTATION =========== * * Online html documentation available at * path_to_url * *> \htmlonly *> Download CGGES + dependencies *> <a href="path_to_url"> *> [TGZ]</a> *> <a href="path_to_url"> *> [ZIP]</a> *> <a href="path_to_url"> *> [TXT]</a> *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CGGES( JOBVSL, JOBVSR, SORT, SELCTG, N, A, LDA, B, LDB, * SDIM, ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, WORK, * LWORK, RWORK, BWORK, INFO ) * * .. Scalar Arguments .. * CHARACTER JOBVSL, JOBVSR, SORT * INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LWORK, N, SDIM * .. * .. Array Arguments .. * LOGICAL BWORK( * ) * REAL RWORK( * ) * COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ), * $ BETA( * ), VSL( LDVSL, * ), VSR( LDVSR, * ), * $ WORK( * ) * .. * .. Function Arguments .. * LOGICAL SELCTG * EXTERNAL SELCTG * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CGGES computes for a pair of N-by-N complex nonsymmetric matrices *> (A,B), the generalized eigenvalues, the generalized complex Schur *> form (S, T), and optionally left and/or right Schur vectors (VSL *> and VSR). This gives the generalized Schur factorization *> *> (A,B) = ( (VSL)*S*(VSR)**H, (VSL)*T*(VSR)**H ) *> *> where (VSR)**H is the conjugate-transpose of VSR. *> *> Optionally, it also orders the eigenvalues so that a selected cluster *> of eigenvalues appears in the leading diagonal blocks of the upper *> triangular matrix S and the upper triangular matrix T. The leading *> columns of VSL and VSR then form an unitary basis for the *> corresponding left and right eigenspaces (deflating subspaces). *> *> (If only the generalized eigenvalues are needed, use the driver *> CGGEV instead, which is faster.) *> *> A generalized eigenvalue for a pair of matrices (A,B) is a scalar w *> or a ratio alpha/beta = w, such that A - w*B is singular. It is *> usually represented as the pair (alpha,beta), as there is a *> reasonable interpretation for beta=0, and even for both being zero. *> *> A pair of matrices (S,T) is in generalized complex Schur form if S *> and T are upper triangular and, in addition, the diagonal elements *> of T are non-negative real numbers. *> \endverbatim * * Arguments: * ========== * *> \param[in] JOBVSL *> \verbatim *> JOBVSL is CHARACTER*1 *> = 'N': do not compute the left Schur vectors; *> = 'V': compute the left Schur vectors. *> \endverbatim *> *> \param[in] JOBVSR *> \verbatim *> JOBVSR is CHARACTER*1 *> = 'N': do not compute the right Schur vectors; *> = 'V': compute the right Schur vectors. *> \endverbatim *> *> \param[in] SORT *> \verbatim *> SORT is CHARACTER*1 *> Specifies whether or not to order the eigenvalues on the *> diagonal of the generalized Schur form. *> = 'N': Eigenvalues are not ordered; *> = 'S': Eigenvalues are ordered (see SELCTG). *> \endverbatim *> *> \param[in] SELCTG *> \verbatim *> SELCTG is a LOGICAL FUNCTION of two COMPLEX arguments *> SELCTG must be declared EXTERNAL in the calling subroutine. *> If SORT = 'N', SELCTG is not referenced. *> If SORT = 'S', SELCTG is used to select eigenvalues to sort *> to the top left of the Schur form. *> An eigenvalue ALPHA(j)/BETA(j) is selected if *> SELCTG(ALPHA(j),BETA(j)) is true. *> *> Note that a selected complex eigenvalue may no longer satisfy *> SELCTG(ALPHA(j),BETA(j)) = .TRUE. after ordering, since *> ordering may change the value of complex eigenvalues *> (especially if the eigenvalue is ill-conditioned), in this *> case INFO is set to N+2 (See INFO below). *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the matrices A, B, VSL, and VSR. N >= 0. *> \endverbatim *> *> \param[in,out] A *> \verbatim *> A is COMPLEX array, dimension (LDA, N) *> On entry, the first of the pair of matrices. *> On exit, A has been overwritten by its generalized Schur *> form S. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of A. LDA >= max(1,N). *> \endverbatim *> *> \param[in,out] B *> \verbatim *> B is COMPLEX array, dimension (LDB, N) *> On entry, the second of the pair of matrices. *> On exit, B has been overwritten by its generalized Schur *> form T. *> \endverbatim *> *> \param[in] LDB *> \verbatim *> LDB is INTEGER *> The leading dimension of B. LDB >= max(1,N). *> \endverbatim *> *> \param[out] SDIM *> \verbatim *> SDIM is INTEGER *> If SORT = 'N', SDIM = 0. *> If SORT = 'S', SDIM = number of eigenvalues (after sorting) *> for which SELCTG is true. *> \endverbatim *> *> \param[out] ALPHA *> \verbatim *> ALPHA is COMPLEX array, dimension (N) *> \endverbatim *> *> \param[out] BETA *> \verbatim *> BETA is COMPLEX array, dimension (N) *> On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the *> generalized eigenvalues. ALPHA(j), j=1,...,N and BETA(j), *> j=1,...,N are the diagonals of the complex Schur form (A,B) *> output by CGGES. The BETA(j) will be non-negative real. *> *> Note: the quotients ALPHA(j)/BETA(j) may easily over- or *> underflow, and BETA(j) may even be zero. Thus, the user *> should avoid naively computing the ratio alpha/beta. *> However, ALPHA will be always less than and usually *> comparable with norm(A) in magnitude, and BETA always less *> than and usually comparable with norm(B). *> \endverbatim *> *> \param[out] VSL *> \verbatim *> VSL is COMPLEX array, dimension (LDVSL,N) *> If JOBVSL = 'V', VSL will contain the left Schur vectors. *> Not referenced if JOBVSL = 'N'. *> \endverbatim *> *> \param[in] LDVSL *> \verbatim *> LDVSL is INTEGER *> The leading dimension of the matrix VSL. LDVSL >= 1, and *> if JOBVSL = 'V', LDVSL >= N. *> \endverbatim *> *> \param[out] VSR *> \verbatim *> VSR is COMPLEX array, dimension (LDVSR,N) *> If JOBVSR = 'V', VSR will contain the right Schur vectors. *> Not referenced if JOBVSR = 'N'. *> \endverbatim *> *> \param[in] LDVSR *> \verbatim *> LDVSR is INTEGER *> The leading dimension of the matrix VSR. LDVSR >= 1, and *> if JOBVSR = 'V', LDVSR >= N. *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is COMPLEX array, dimension (MAX(1,LWORK)) *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK. *> \endverbatim *> *> \param[in] LWORK *> \verbatim *> LWORK is INTEGER *> The dimension of the array WORK. LWORK >= max(1,2*N). *> For good performance, LWORK must generally be larger. *> *> If LWORK = -1, then a workspace query is assumed; the routine *> only calculates the optimal size of the WORK array, returns *> this value as the first entry of the WORK array, and no error *> message related to LWORK is issued by XERBLA. *> \endverbatim *> *> \param[out] RWORK *> \verbatim *> RWORK is REAL array, dimension (8*N) *> \endverbatim *> *> \param[out] BWORK *> \verbatim *> BWORK is LOGICAL array, dimension (N) *> Not referenced if SORT = 'N'. *> \endverbatim *> *> \param[out] INFO *> \verbatim *> INFO is INTEGER *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value. *> =1,...,N: *> The QZ iteration failed. (A,B) are not in Schur *> form, but ALPHA(j) and BETA(j) should be correct for *> j=INFO+1,...,N. *> > N: =N+1: other than QZ iteration failed in CHGEQZ *> =N+2: after reordering, roundoff changed values of *> some complex eigenvalues so that leading *> eigenvalues in the Generalized Schur form no *> longer satisfy SELCTG=.TRUE. This could also *> be caused due to scaling. *> =N+3: reordering failed in CTGSEN. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup gges * * ===================================================================== SUBROUTINE CGGES( JOBVSL, JOBVSR, SORT, SELCTG, N, A, LDA, B, $ LDB, $ SDIM, ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, WORK, $ LWORK, RWORK, BWORK, INFO ) * * -- LAPACK driver routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. CHARACTER JOBVSL, JOBVSR, SORT INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LWORK, N, SDIM * .. * .. Array Arguments .. LOGICAL BWORK( * ) REAL RWORK( * ) COMPLEX A( LDA, * ), ALPHA( * ), B( LDB, * ), $ BETA( * ), VSL( LDVSL, * ), VSR( LDVSR, * ), $ WORK( * ) * .. * .. Function Arguments .. LOGICAL SELCTG EXTERNAL SELCTG * .. * * ===================================================================== * * .. Parameters .. REAL ZERO, ONE PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0 ) COMPLEX CZERO, CONE PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ), $ CONE = ( 1.0E0, 0.0E0 ) ) * .. * .. Local Scalars .. LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL, $ LQUERY, WANTST INTEGER I, ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, $ ILO, IRIGHT, IROWS, IRWRK, ITAU, IWRK, LWKMIN, $ LWKOPT REAL ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS, PVSL, $ PVSR, SMLNUM * .. * .. Local Arrays .. INTEGER IDUM( 1 ) REAL DIF( 2 ) * .. * .. External Subroutines .. EXTERNAL CGEQRF, CGGBAK, CGGBAL, CGGHRD, CHGEQZ, $ CLACPY, $ CLASCL, CLASET, CTGSEN, CUNGQR, CUNMQR, XERBLA * .. * .. External Functions .. LOGICAL LSAME INTEGER ILAENV REAL CLANGE, SLAMCH, SROUNDUP_LWORK EXTERNAL LSAME, ILAENV, CLANGE, SLAMCH, $ SROUNDUP_LWORK * .. * .. Intrinsic Functions .. INTRINSIC MAX, SQRT * .. * .. Executable Statements .. * * Decode the input arguments * IF( LSAME( JOBVSL, 'N' ) ) THEN IJOBVL = 1 ILVSL = .FALSE. ELSE IF( LSAME( JOBVSL, 'V' ) ) THEN IJOBVL = 2 ILVSL = .TRUE. ELSE IJOBVL = -1 ILVSL = .FALSE. END IF * IF( LSAME( JOBVSR, 'N' ) ) THEN IJOBVR = 1 ILVSR = .FALSE. ELSE IF( LSAME( JOBVSR, 'V' ) ) THEN IJOBVR = 2 ILVSR = .TRUE. ELSE IJOBVR = -1 ILVSR = .FALSE. END IF * WANTST = LSAME( SORT, 'S' ) * * Test the input arguments * INFO = 0 LQUERY = ( LWORK.EQ.-1 ) IF( IJOBVL.LE.0 ) THEN INFO = -1 ELSE IF( IJOBVR.LE.0 ) THEN INFO = -2 ELSE IF( ( .NOT.WANTST ) .AND. $ ( .NOT.LSAME( SORT, 'N' ) ) ) THEN INFO = -3 ELSE IF( N.LT.0 ) THEN INFO = -5 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN INFO = -7 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN INFO = -9 ELSE IF( LDVSL.LT.1 .OR. ( ILVSL .AND. LDVSL.LT.N ) ) THEN INFO = -14 ELSE IF( LDVSR.LT.1 .OR. ( ILVSR .AND. LDVSR.LT.N ) ) THEN INFO = -16 END IF * * Compute workspace * (Note: Comments in the code beginning "Workspace:" describe the * minimal amount of workspace needed at that point in the code, * as well as the preferred amount for good performance. * NB refers to the optimal block size for the immediately * following subroutine, as returned by ILAENV.) * IF( INFO.EQ.0 ) THEN LWKMIN = MAX( 1, 2*N ) LWKOPT = MAX( 1, N + N*ILAENV( 1, 'CGEQRF', ' ', N, 1, N, $ 0 ) ) LWKOPT = MAX( LWKOPT, N + $ N*ILAENV( 1, 'CUNMQR', ' ', N, 1, N, -1 ) ) IF( ILVSL ) THEN LWKOPT = MAX( LWKOPT, N + $ N*ILAENV( 1, 'CUNGQR', ' ', N, 1, N, -1 ) ) END IF WORK( 1 ) = SROUNDUP_LWORK(LWKOPT) * IF( LWORK.LT.LWKMIN .AND. .NOT.LQUERY ) $ INFO = -18 END IF * IF( INFO.NE.0 ) THEN CALL XERBLA( 'CGGES ', -INFO ) RETURN ELSE IF( LQUERY ) THEN RETURN END IF * * Quick return if possible * IF( N.EQ.0 ) THEN SDIM = 0 RETURN END IF * * Get machine constants * EPS = SLAMCH( 'P' ) SMLNUM = SLAMCH( 'S' ) BIGNUM = ONE / SMLNUM SMLNUM = SQRT( SMLNUM ) / EPS BIGNUM = ONE / SMLNUM * * Scale A if max element outside range [SMLNUM,BIGNUM] * ANRM = CLANGE( 'M', N, N, A, LDA, RWORK ) ILASCL = .FALSE. IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN ANRMTO = SMLNUM ILASCL = .TRUE. ELSE IF( ANRM.GT.BIGNUM ) THEN ANRMTO = BIGNUM ILASCL = .TRUE. END IF * IF( ILASCL ) $ CALL CLASCL( 'G', 0, 0, ANRM, ANRMTO, N, N, A, LDA, IERR ) * * Scale B if max element outside range [SMLNUM,BIGNUM] * BNRM = CLANGE( 'M', N, N, B, LDB, RWORK ) ILBSCL = .FALSE. IF( BNRM.GT.ZERO .AND. BNRM.LT.SMLNUM ) THEN BNRMTO = SMLNUM ILBSCL = .TRUE. ELSE IF( BNRM.GT.BIGNUM ) THEN BNRMTO = BIGNUM ILBSCL = .TRUE. END IF * IF( ILBSCL ) $ CALL CLASCL( 'G', 0, 0, BNRM, BNRMTO, N, N, B, LDB, IERR ) * * Permute the matrix to make it more nearly triangular * (Real Workspace: need 6*N) * ILEFT = 1 IRIGHT = N + 1 IRWRK = IRIGHT + N CALL CGGBAL( 'P', N, A, LDA, B, LDB, ILO, IHI, RWORK( ILEFT ), $ RWORK( IRIGHT ), RWORK( IRWRK ), IERR ) * * Reduce B to triangular form (QR decomposition of B) * (Complex Workspace: need N, prefer N*NB) * IROWS = IHI + 1 - ILO ICOLS = N + 1 - ILO ITAU = 1 IWRK = ITAU + IROWS CALL CGEQRF( IROWS, ICOLS, B( ILO, ILO ), LDB, WORK( ITAU ), $ WORK( IWRK ), LWORK+1-IWRK, IERR ) * * Apply the orthogonal transformation to matrix A * (Complex Workspace: need N, prefer N*NB) * CALL CUNMQR( 'L', 'C', IROWS, ICOLS, IROWS, B( ILO, ILO ), LDB, $ WORK( ITAU ), A( ILO, ILO ), LDA, WORK( IWRK ), $ LWORK+1-IWRK, IERR ) * * Initialize VSL * (Complex Workspace: need N, prefer N*NB) * IF( ILVSL ) THEN CALL CLASET( 'Full', N, N, CZERO, CONE, VSL, LDVSL ) IF( IROWS.GT.1 ) THEN CALL CLACPY( 'L', IROWS-1, IROWS-1, B( ILO+1, ILO ), LDB, $ VSL( ILO+1, ILO ), LDVSL ) END IF CALL CUNGQR( IROWS, IROWS, IROWS, VSL( ILO, ILO ), LDVSL, $ WORK( ITAU ), WORK( IWRK ), LWORK+1-IWRK, IERR ) END IF * * Initialize VSR * IF( ILVSR ) $ CALL CLASET( 'Full', N, N, CZERO, CONE, VSR, LDVSR ) * * Reduce to generalized Hessenberg form * (Workspace: none needed) * CALL CGGHRD( JOBVSL, JOBVSR, N, ILO, IHI, A, LDA, B, LDB, VSL, $ LDVSL, VSR, LDVSR, IERR ) * SDIM = 0 * * Perform QZ algorithm, computing Schur vectors if desired * (Complex Workspace: need N) * (Real Workspace: need N) * IWRK = ITAU CALL CHGEQZ( 'S', JOBVSL, JOBVSR, N, ILO, IHI, A, LDA, B, LDB, $ ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, WORK( IWRK ), $ LWORK+1-IWRK, RWORK( IRWRK ), IERR ) IF( IERR.NE.0 ) THEN IF( IERR.GT.0 .AND. IERR.LE.N ) THEN INFO = IERR ELSE IF( IERR.GT.N .AND. IERR.LE.2*N ) THEN INFO = IERR - N ELSE INFO = N + 1 END IF GO TO 30 END IF * * Sort eigenvalues ALPHA/BETA if desired * (Workspace: none needed) * IF( WANTST ) THEN * * Undo scaling on eigenvalues before selecting * IF( ILASCL ) $ CALL CLASCL( 'G', 0, 0, ANRM, ANRMTO, N, 1, ALPHA, N, $ IERR ) IF( ILBSCL ) $ CALL CLASCL( 'G', 0, 0, BNRM, BNRMTO, N, 1, BETA, N, $ IERR ) * * Select eigenvalues * DO 10 I = 1, N BWORK( I ) = SELCTG( ALPHA( I ), BETA( I ) ) 10 CONTINUE * CALL CTGSEN( 0, ILVSL, ILVSR, BWORK, N, A, LDA, B, LDB, $ ALPHA, $ BETA, VSL, LDVSL, VSR, LDVSR, SDIM, PVSL, PVSR, $ DIF, WORK( IWRK ), LWORK-IWRK+1, IDUM, 1, IERR ) IF( IERR.EQ.1 ) $ INFO = N + 3 * END IF * * Apply back-permutation to VSL and VSR * (Workspace: none needed) * IF( ILVSL ) $ CALL CGGBAK( 'P', 'L', N, ILO, IHI, RWORK( ILEFT ), $ RWORK( IRIGHT ), N, VSL, LDVSL, IERR ) IF( ILVSR ) $ CALL CGGBAK( 'P', 'R', N, ILO, IHI, RWORK( ILEFT ), $ RWORK( IRIGHT ), N, VSR, LDVSR, IERR ) * * Undo scaling * IF( ILASCL ) THEN CALL CLASCL( 'U', 0, 0, ANRMTO, ANRM, N, N, A, LDA, IERR ) CALL CLASCL( 'G', 0, 0, ANRMTO, ANRM, N, 1, ALPHA, N, IERR ) END IF * IF( ILBSCL ) THEN CALL CLASCL( 'U', 0, 0, BNRMTO, BNRM, N, N, B, LDB, IERR ) CALL CLASCL( 'G', 0, 0, BNRMTO, BNRM, N, 1, BETA, N, IERR ) END IF * IF( WANTST ) THEN * * Check if reordering is correct * LASTSL = .TRUE. SDIM = 0 DO 20 I = 1, N CURSL = SELCTG( ALPHA( I ), BETA( I ) ) IF( CURSL ) $ SDIM = SDIM + 1 IF( CURSL .AND. .NOT.LASTSL ) $ INFO = N + 2 LASTSL = CURSL 20 CONTINUE * END IF * 30 CONTINUE * WORK( 1 ) = SROUNDUP_LWORK(LWKOPT) * RETURN * * End of CGGES * END ```
Douglas R. Lowy (born 1940s) is the former Acting Director and current Principal Deputy Director of the U.S. National Cancer Institute (NCI) and Chief of the Laboratory of Cellular Oncology within the Center for Cancer Research at NCI. Lowy served as Acting Director of NCI between April 2015 and October 2017 following the resignation of Harold E. Varmus, M.D., and again between April and November 2019, while Director Norman Sharpless served as the Acting Commissioner of the U.S. Food and Drug Administration. He resumed the role of Acting Director on May 1, 2022, when Sharpless stepped down until October 3, 2022 when Monica Bertagnolli was appointed Director. Lowy has served as Deputy Director of the NCI since 2010, alongside former directors Varmus and Sharpless and current director Bertagnolli. Lowy was co-recipient (along with Dr. John T. Schiller) of the National Medal of Technology and Innovation in 2014 and the Lasker-DeBakey Clinical Medical Research Award in 2017. Biography Lowy received his medical degree from the New York University School of Medicine, and trained in internal medicine at Stanford University and dermatology at Yale. He has directed a research laboratory at NCI since 1975, after receiving training as a Research Associate in the National Institute of Allergy and Infectious Diseases. Lowy is a member of the National Academy of Sciences (NAS) and of its Institute of Medicine. For his joint research with John T. Schiller on technology that enabled the development of preventive human papillomavirus (HPV) vaccines, he and Schiller received the 2007 Samuel J. Heyman Service to America Medal, the 2011 Albert B. Sabin Gold Medal, the 2012 National Medal of Technology and Innovation (awarded in 2014), and the Lasker-DeBakey Clinical Medical Research Award in 2017. He has also received the National Medal of Honor for Basic Research from the American Cancer Society. Research activities Lowy's HPV research, conducted in collaboration with John T. Schiller, has characterized the HPV oncoproteins E6 and E7. Awards Nathan Davis Award, American Medical Association (2007) Service to America Medal, Partnership for Public Service (2007) Humanitarian Award, American Skin Association (2007) Dorothy P. Landon-AACR Prize for Translational Cancer Research (2007) Novartis Prize for Clinical Immunology, Rio de Janeiro (2007) Research and Hope Award for Academic or Public Research, National Cancer Institute (2013) Harrington Prize for Innovation in Medicine (2015) Lasker-DeBakey Clinical Medical Research Award (2017) Szent-Györgyi Prize for Progress in Cancer Research (2018) References External links NCI Principal Deputy Director, Dr. Douglas R. Lowy Profile of Dr. Lowy, NCI Center for Cancer Research 1940s births Year of birth missing (living people) Living people American oncologists New York University Grossman School of Medicine alumni Members of the United States National Academy of Sciences National Institutes of Health people Amherst College alumni Place of birth missing (living people) Members of the National Academy of Medicine
```objective-c // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ #define MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ #include "base/basictypes.h" #include "media/base/media_export.h" #include "media/filters/ffmpeg_bitstream_converter.h" // Forward declarations for FFmpeg datatypes used. struct AVCodecContext; struct AVPacket; namespace media { // Bitstream converter that adds ADTS headers to AAC frames. class MEDIA_EXPORT FFmpegAACBitstreamConverter : public FFmpegBitstreamConverter { public: enum { kAdtsHeaderSize = 7 }; // The |stream_codec_context| will be used during conversion and should be the // AVCodecContext for the stream sourcing these packets. A reference to // |stream_codec_context| is retained, so it must outlive this class. explicit FFmpegAACBitstreamConverter(AVCodecContext* stream_codec_context); ~FFmpegAACBitstreamConverter() override; // FFmpegBitstreamConverter implementation. // Uses FFmpeg allocation methods for buffer allocation to ensure // compatibility with FFmpeg's memory management. bool ConvertPacket(AVPacket* packet) override; private: // Variable to hold a pointer to memory where we can access the global // data from the FFmpeg file format's global headers. AVCodecContext* stream_codec_context_; bool header_generated_; uint8_t hdr_[kAdtsHeaderSize]; int codec_; int audio_profile_; int sample_rate_index_; int channel_configuration_; int frame_length_; DISALLOW_COPY_AND_ASSIGN(FFmpegAACBitstreamConverter); }; } // namespace media #endif // MEDIA_FILTERS_FFMPEG_AAC_BITSTREAM_CONVERTER_H_ ```
```makefile ################################################################################ # # xz # ################################################################################ XZ_VERSION = 5.2.0 XZ_SOURCE = xz-$(XZ_VERSION).tar.bz2 XZ_SITE = path_to_url XZ_INSTALL_STAGING = YES XZ_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' XZ_LICENSE = GPLv2+ GPLv3+ LGPLv2.1+ XZ_LICENSE_FILES = COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) XZ_CONF_OPTS = --enable-threads else XZ_CONF_OPTS = --disable-threads endif $(eval $(autotools-package)) $(eval $(host-autotools-package)) ```
Bouca is a town located in the Central African Republic prefecture of Ouham. It is not far east of Bossangoa at the Fafa river. History On 21 March 2013, the town was overtaken by rebels of the Séléka coalition. On 9 September 2013 armed Anti-balaka fighters attacked the town killing at least three people. On 4 March 2021 Bouca was recaptured by government forces. Climate Köppen-Geiger climate classification system classifies its climate as tropical wet and dry (Aw). See also List of cities in the Central African Republic Prefectures of the Central African Republic Lake Chad replenishment project Waterway References Sub-prefectures of the Central African Republic Populated places in Ouham-Fafa
Duke Henry IV of Brunswick Grubenhagen (1460 – 6 December 1526, Salzderhelden, now part of Einbeck) was a member of the Guelph dynasty and was Prince of Brunswick-Grubenhagen. Life Henry was the son of Henry III of Brunswick-Grubenhagen and Margaret, a daughter of the Duke Jan I of Żagań and Scholastica of Saxe-Wittenberg. After his father's death in 1464, he succeeded him as Prince of Grubenhagen. Since he was a minor, he was under the guardianship of his uncle, Albert II until he came of age in 1479. After 1479, he divided the principality with Albert. Albert received Osterode Castle and Herzberg Castle; Henry received Heldenburg Castle. They ruled Grubenhagen Castle jointly. After Albert II died in 1485, Henry became guardian of his underage cousin Philip I. When Henry died childless in 1526, Philip I inherited his territory and thereby reunited all parts of Grubenhagen. Marriage Henry married on 26 August 1494 in Einbeck with Elisabeth of Saxe-Lauenburg (died: after 7 April 1542), the daughter of Duke John V of Saxe-Lauenburg and Dorothea of Brandenburg. The marriage remained childless. References and sources Princes of Grubenhagen 1460 births 1526 deaths 15th-century German people 16th-century German people Old House of Brunswick
```makefile libavcodec/rv30.o: libavcodec/rv30.c libavcodec/avcodec.h \ libavutil/samplefmt.h libavutil/avutil.h libavutil/common.h \ libavutil/attributes.h libavutil/macros.h libavutil/version.h \ libavutil/avconfig.h config.h libavutil/intmath.h libavutil/mem.h \ libavutil/error.h libavutil/internal.h libavutil/timer.h libavutil/log.h \ libavutil/cpu.h libavutil/dict.h libavutil/pixfmt.h libavutil/libm.h \ libavutil/intfloat.h libavutil/mathematics.h libavutil/rational.h \ libavutil/attributes.h libavutil/avutil.h libavutil/buffer.h \ libavutil/cpu.h libavutil/channel_layout.h libavutil/dict.h \ libavutil/frame.h libavutil/buffer.h libavutil/samplefmt.h \ libavutil/log.h libavutil/pixfmt.h libavutil/rational.h \ libavcodec/version.h libavutil/version.h libavcodec/mpegutils.h \ libavcodec/mpegvideo.h libavcodec/blockdsp.h \ libavcodec/error_resilience.h libavcodec/me_cmp.h libavcodec/thread.h \ libavcodec/fdctdsp.h libavcodec/get_bits.h libavutil/common.h \ libavutil/intreadwrite.h libavutil/bswap.h libavutil/avassert.h \ libavcodec/mathops.h libavcodec/vlc.h libavcodec/h264chroma.h \ libavcodec/h263dsp.h libavcodec/hpeldsp.h libavcodec/idctdsp.h \ libavcodec/internal.h libavutil/mathematics.h libavcodec/motion_est.h \ libavcodec/qpeldsp.h libavcodec/mpegpicture.h libavcodec/mpegvideodsp.h \ libavcodec/mpegvideoencdsp.h libavcodec/pixblockdsp.h \ libavcodec/put_bits.h libavcodec/ratecontrol.h libavutil/eval.h \ libavcodec/parser.h libavcodec/mpeg12data.h libavcodec/rl.h \ libavcodec/videodsp.h libavutil/opt.h libavutil/timecode.h \ libavcodec/golomb.h libavcodec/rv34.h libavcodec/h264pred.h \ libavcodec/rv34dsp.h libavcodec/rv30data.h ```
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\MigrationCenterAPI; class MachineDiskDetails extends \Google\Model { protected $disksType = DiskEntryList::class; protected $disksDataType = ''; /** * @var string */ public $totalCapacityBytes; /** * @var string */ public $totalFreeBytes; /** * @param DiskEntryList */ public function setDisks(DiskEntryList $disks) { $this->disks = $disks; } /** * @return DiskEntryList */ public function getDisks() { return $this->disks; } /** * @param string */ public function setTotalCapacityBytes($totalCapacityBytes) { $this->totalCapacityBytes = $totalCapacityBytes; } /** * @return string */ public function getTotalCapacityBytes() { return $this->totalCapacityBytes; } /** * @param string */ public function setTotalFreeBytes($totalFreeBytes) { $this->totalFreeBytes = $totalFreeBytes; } /** * @return string */ public function getTotalFreeBytes() { return $this->totalFreeBytes; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(MachineDiskDetails::class, 'Google_Service_MigrationCenterAPI_MachineDiskDetails'); ```
The Karate International Council of Kickboxing (KICK) was a sanctioning body that regulates kickboxing matches. It is considered among the more prestigious organizations that sanction professional kickboxing. KICK was organized in 1982 by Frank Babcock, Fred Wren, Larry Caster, Bob Wall and Roy Kurban, with martial arts icon Chuck Norris serving as a goodwill ambassador. It grew into one of the largest kickboxing organizations of the 1980s. See also List of male kickboxers List of female kickboxers References External links KICK International (amateur program) 1982 establishments in the United States Sports organizations established in 1982 Karate in the United States Kickboxing organizations Karate organizations Organizations based in St. Louis
```objective-c /* * internals for BMP codecs * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * * FFmpeg 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 * * You should have received a copy of the GNU Lesser General Public * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_BMP_H #define AVCODEC_BMP_H #include "avcodec.h" typedef enum { BMP_RGB =0, BMP_RLE8 =1, BMP_RLE4 =2, BMP_BITFIELDS =3, } BiCompression; #endif /* AVCODEC_BMP_H */ ```
```smalltalk namespace Ombi.Api.Radarr.Models { public class RadarrRootFolder { public int id { get; set; } public string path { get; set; } public long freespace { get; set; } } } ```
Warsaw Photo-Optical Works (Polish: Warszawskie Zakłady Fotooptyczne or WZFO) was a Polish firm that built optical and photographic equipment. The company was initially founded in 1951 as the Warsaw Cine-Technical Works at the direction of Prime Minister Bolesław Bierut. Oversight of the company was given to the Central Cinematography Committee of Poland, which passed the company to the Heavy Industry Ministry in 1952. The company's name was then changed to the Warsaw Photo-Optical Works, and they began to focus exclusively on producing cameras and related equipment. The WZFO was the first company to mass-produce photographic equipment in Poland, beginning with the Start camera in 1953-1954. Between 1954-1957, WZFO introduced the Fenix, a relatively higher-end viewfinder camera, and the Druh, a simple Bakelite-cased camera popular with young people. When the Druh series ceased production around 1958, the Ami series was introduced as its replacement. In 1962, the firm released the Alfa, a small 35-mm camera that came in unconventional colors such as powder blue. During its years in production, WZFO also produced a range of photographical equipment such as lenses, flash bulbs, magnifiers, and similar items. In 1968, at the direction of the Heavy Industry Ministry, WZFO was merged with Polish Optical Industries. Gallery References Defunct manufacturing companies of Poland Government-owned companies of Poland Defunct photography companies 1951 establishments in Poland Technology companies established in 1951 Technology companies disestablished in 1968 1968 disestablishments in Poland Photography companies of Poland Polish brands
Orlando Tive "Baby Lane" Anderson (August 13, 1974 – May 29, 1998) was an American gang member suspected in the murder of Tupac Shakur. Anderson belonged to the California-based gang known as the South Side Compton Crips. Detective Tim Brennan of the Compton Police Department filed an affidavit naming Anderson as a suspect; he denied involvement and was never charged. Anderson's uncle, Duane Keith Davis, was charged with Shakur's murder on September 29, 2023. Anderson was shot and killed in an unrelated gang shootout at the age of 23 in 1998. Early life and education Orlando Tive Anderson was born on August 13, 1974, into an African-American household in Compton, California. He had a secure childhood with his grandparents after his parents split up. His mother worked 12 hour shifts as a bookkeeper to support her children. He joined the South Side Compton Crips gang at some point in his youth. Anderson attended Taft High School, where he was a conscientious student who passed his exams and received good grades. He returned to Dominguez High School for his senior year and got his diploma. During high school, he met a young woman named Rasheena Smith, whom he started dating. He fathered four children. Murder of Tupac Shakur In July 1996, Anderson was involved in an altercation at Lakewood Mall, where he and his entourage assaulted Trevon Lane, an employee of Death Row Records, and attempted to steal his Death Row medallion. There was rumored to be a bounty placed on Death Row medallions by their rivals, the Compton Crips, of which Anderson was a member. This move infuriated Suge Knight, Tupac Shakur, and the rest of Death Row. On September 7, 1996, after the Bruce Seldon vs. Mike Tyson fight, Trevon Lane coincidentally spotted Anderson by himself in the MGM Grand Las Vegas, and told Tupac and the rest of the Death Row entourage that Anderson was the one responsible for snatching his medallion. Tupac can then be seen on the MGM's security camera running over to Anderson with the rest of his entourage and throwing the first punch. Anderson then suffered a severe beatdown as he was jumped by five men with no one to help him. According to BG Knocc Out in an interview with VladTV, Anderson escaped the worst of the beating by managing to cover his face during the attack. The beating occurred three hours before Shakur's shooting. Later that month, Las Vegas MPD homicide detective Lt. Larry Spinosa told the media, "At this point, Orlando Anderson is not a suspect in the shooting of Tupac Shakur." Anderson was subsequently named a suspect. Rumors circulated that he had bragged about shooting the rapper, a claim he later denied in an interview for VIBE magazine. In September 1997 Anderson told the Los Angeles Times that he was a fan of Shakur and his music but denied being the murderer. Anderson was detained in Compton, California, a month after Shakur was shot, along with twenty-one other alleged gang members. He was not charged. However, the arrest was only tangentially connected to the Tupac shooting, as Compton police said they were investigating local shootings and not the one in Las Vegas. Las Vegas police discounted Anderson as a suspect, according to a Los Angeles Times article, due to the short time between the hotel beating and the murder. Las Vegas police failed to follow up with a member of Shakur's entourage who witnessed the shooting and who told police he could identify one or more of the assailants. That witness, rapper Yaki Kadafi, was killed two months later. The police also failed to follow up on a lead from a witness who had spotted a white Cadillac similar to the car from which the fatal shots were fired and in which the shooters escaped. Soon after the shooting of Tupac Shakur, a gang war broke out in Compton between the Bloods and Crips. BG Knocc Out, who was close friends with Anderson, stated that Anderson was shot in the legs with an AK-47 and was confined to a wheelchair for some time. A year later, Shakur's mother Afeni Shakur filed a wrongful death lawsuit against Anderson in response to a lawsuit he had filed against Death Row Records CEO Suge Knight, Death Row associates, and Shakur's estate. Anderson's lawsuit sought damages for injuries resulting from the MGM Grand scuffle, and for emotional and physical pain. Afeni Shakur's lawsuit was filed just four days after Anderson's. The Associated Press reported in 2000 that Shakur and Anderson's estates settled the competing lawsuits just hours before Anderson's death. Anderson's lawyer claimed the settlement would have netted Anderson $78,000. In October 2011, former LAPD Detective Greg Kading, a former investigator in the murder of Christopher "Biggie Smalls" Wallace, released a book alleging that Sean "Diddy" Combs commissioned Anderson's uncle, Duane "Keefe D" Davis, to kill Shakur, as well as Knight, for $1 million. Kading and Davis claimed that Anderson was present in the vehicle that pulled up next to the BMW in which Tupac was shot. In a recorded conversation with Kading, Davis claimed Anderson fired the shots that killed Tupac. Each account said that four men were in the white Cadillac that pulled up alongside the BMW that Knight and Shakur were riding in on the night of the shooting. The accounts independently reported that Anderson was in the back seat of the Cadillac and shot Shakur by leaning out of the back window. Kading and Philips claimed that the Crips were offered a $1 million bounty to kill Knight and Shakur. However, the two accounts differ on whether the bounty was offered by Combs (as reported by Kading) or by Wallace (as reported by Philips). 2000s investigations In 2002, the Los Angeles Times published a two-part series by reporter Chuck Philips titled "Who Killed Tupac Shakur?" that looked into the events leading to the crime. The series indicated that "the shooting was carried out by a Compton gang called the South Side Crips to avenge the beating of one of its members by Shakur a few hours earlier. Orlando Anderson, the Crip whom Shakur had attacked, fired the fatal shots. Las Vegas police interviewed Anderson only once as a possible suspect. He was later killed in an unrelated gang shooting." The Times series included references to the cooperation of East Coast rappers including Wallace, Shakur's rival at the time, and New York City criminals. Before their deaths, both Wallace and Anderson denied any role in Shakur's murder. In support of this, Wallace's family produced computerized invoices showing that he was working in a New York recording studio the night of the shooting. Wallace's manager Wayne Barrow and fellow rapper Lil' Cease made public announcements denying Wallace had a role in the crime and stating that they were both with him in the recording studio. Times assistant managing editor Mark Duvoisin defended Philips' series, stating they were based on police affidavits and court documents as well as interviews with investigators, witnesses to the crime and members of the South Side Crips. Duvoisin stated: "Philips' story has withstood all challenges to its accuracy...[and] remains the definitive account of the Shakur slaying." The main thrust of the articles, implicating Anderson and the Crips, was later corroborated by Kading's 2011 book Murder Rap and discussed in author Cathy Scott's 2002 book The Killing of Tupac Shakur. Scott refuted the theory in a People magazine article, saying there was no evidence pointing to Wallace as a suspect. Also, The New York Times wrote, "The Los Angeles Times articles did not offer any documentation to show that Wallace was in Las Vegas that night." In her book, Scott reviews various theories, including the Knight theory, before stating, "Years after the primary investigations, it's still anyone's guess. No one was ever arrested but no one was ever ruled out as a suspect, either." She then (in 2002) wrote that one theory "transcends all the others, and implicates the white record-company power brokers themselves," implicating the bosses of the Suge Knight label. In recent years, however, archived letters of Scott's responses to readers show an evolution toward Anderson as a suspect and a dismissal of the Knight theory. Death On May 29, 1998, Anderson and South Side Associate, Michael Dorrough, spotted two members of the Corner Poccet gang named Michael and Jerry Stone at a car wash in Compton, and pulled over to confront them. Tempers quickly rose, and a shootout occurred with all four men being hit. Anderson was taken to Martin Luther King Jr. Community Hospital in Willowbrook, California, but was pronounced dead from a gunshot wound to the chest shortly after. Jerry and Michael Stone also died. Dorrough was the only person to survive, and he was subsequently charged and convicted for all three homicides. Detective Brennan later stated Anderson's murder was due to a disagreement over drug money with a rival gang and was not related to the Shakur case. 2023 arrest of uncle On September 29, 2023, it was announced that a grand jury had indicted Duane Keith "Keefe D" Davis on charges of murder with the use of a deadly weapon in connection with the killing of Shakur. Davis, 60, was arrested the morning of September 29, 2023, in Las Vegas. See also List of unsolved murders References 1974 births 1998 deaths 1998 murders in the United States 20th-century American musicians Crips Deaths by firearm in California Male murder victims Murdered African-American people People from Compton, California People murdered in California Tupac Shakur Unsolved murders in the United States Murdered gangsters 20th-century African-American people
Christopher, Washington was a former community, north of Auburn in the Green River Valley of King County in the U.S. state of Washington. It was on the west bank of the river. At one time, it had a post office and a school. A post office called Christopher was established in 1887, and remained in operation until 1917. The community was named after Thomas Christopher, an early settler. The community of Thomas stood nearby. Notes Ghost towns in King County, Washington Ghost towns in Washington (state)
```objective-c /* Register groupings for GDB, the GNU debugger. Contributed by Red Hat. This file is part of GDB. This program is free software; you can redistribute it and/or modify (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 along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef REGGROUPS_H #define REGGROUPS_H struct gdbarch; struct reggroup; enum reggroup_type { USER_REGGROUP, INTERNAL_REGGROUP }; /* Pre-defined, user visible, register groups. */ extern struct reggroup *const general_reggroup; extern struct reggroup *const float_reggroup; extern struct reggroup *const system_reggroup; extern struct reggroup *const vector_reggroup; extern struct reggroup *const all_reggroup; /* Pre-defined, internal, register groups. */ extern struct reggroup *const save_reggroup; extern struct reggroup *const restore_reggroup; /* Create a new local register group. */ extern struct reggroup *reggroup_new (const char *name, enum reggroup_type type); /* Add a register group (with attribute values) to the pre-defined list. */ extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group); /* Register group attributes. */ extern const char *reggroup_name (struct reggroup *reggroup); extern enum reggroup_type reggroup_type (struct reggroup *reggroup); /* Interator for the architecture's register groups. Pass in NULL, returns the first group. Pass in a group, returns the next group, or NULL when the last group is reached. */ extern struct reggroup *reggroup_next (struct gdbarch *gdbarch, struct reggroup *last); /* Is REGNUM a member of REGGROUP? */ extern int default_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *reggroup); #endif ```
```javascript import { SET_MENU, SET_MENU_ACTIVE, BACK_PATH, SET_CHAT_COUNT } from '../mutation-types' let state = { backPath: '', index_nav: [{ index: 0, path: { path: '/chat' }, hint: { type: "count", count: 0 }, //count,dot iconClass: 'icon-wechat', text: '' }], menu_active: { text: "", index: 0 }, } const mutations = { [SET_MENU](state, index_nav) { state.index_nav = index_nav; }, [SET_MENU_ACTIVE](state, _index) { // state.menu_active = state.index_nav[_index] }, [BACK_PATH](state, _path) { //,router.afterEach state.backPath = { path: _path }; }, [SET_CHAT_COUNT](state, count) { state.index_nav[0].hint.count = count; } } export default { state, mutations } ```
```groff .\" $OpenBSD: keynote.3,v 1.55 2022/02/18 10:24:32 jsg Exp $ .\" .\" The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) .\" .\" This code was written by Angelos D. Keromytis in Philadelphia, PA, USA, .\" in April-May 1998 .\" .\" .\" Permission to use, copy, and modify this software with or without fee .\" is hereby granted, provided that this entire notice is included in .\" all copies of any software which is or includes a copy or .\" modification of this software. .\" You may use this code under the GNU public license if you so wish. Please .\" contribute changes back to the author. .\" .\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR .\" IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO .\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE .\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR .\" PURPOSE. .\" .Dd $Mdocdate: February 18 2022 $ .Dt KN_INIT 3 .\" .TH KeyNote 3 local .Os .Sh NAME .Nm kn_init , .Nm kn_add_assertion , .Nm kn_remove_assertion , .Nm kn_add_action , .Nm kn_remove_action , .Nm kn_add_authorizer , .Nm kn_remove_authorizer , .Nm kn_do_query , .Nm kn_get_failed , .Nm kn_cleanup_action_environment , .Nm kn_close , .Nm kn_query , .Nm kn_read_asserts , .Nm kn_keycompare , .Nm kn_get_authorizer , .Nm kn_get_licensees , .Nm kn_encode_base64 , .Nm kn_decode_base64 , .Nm kn_encode_hex , .Nm kn_decode_hex , .Nm kn_encode_key , .Nm kn_decode_key , .Nm kn_sign_assertion , .Nm kn_verify_assertion , .Nm kn_free_key , .Nm kn_get_string .Nd a trust-management system library .Sh SYNOPSIS .In sys/types.h .In regex.h .In keynote.h .Bd -literal struct environment { char *env_name; char *env_value; int env_flags; regex_t env_regex; struct environment *env_next; }; struct keynote_deckey { int dec_algorithm; void *dec_key; }; struct keynote_binary { int bn_len; char *bn_key; }; struct keynote_keylist { int key_alg; void *key_key; char *key_stringkey; struct keynote_keylist *key_next; }; .Ed .Vt extern int keynote_errno; .Ft int .Fn kn_init "void" .Ft int .Fn kn_add_assertion "int sessid" "char *assertion" "int len" "int flags" .Ft int .Fn kn_remove_assertion "int sessid" "int assertid" .Ft int .Fn kn_add_action "int sessid" "char *name" "char *value" "int flags" .Ft int .Fn kn_remove_action "int sessid" "char *name" .Ft int .Fn kn_add_authorizer "int sessid" "char *principal" .Ft int .Fn kn_remove_authorizer "int sessid" "char *principal" .Ft int .Fn kn_do_query "int sessid" "char **returnvalues" "int numvalues" .Ft int .Fn kn_get_failed "int sessid" "int type" "int seq" .Ft int .Fn kn_cleanup_action_environment "int sessid" .Ft int .Fn kn_close "int sessid" .Ft int .Fo kn_query .Fa "struct environment *env" .Fa "char **returnvalues" .Fa "int numvalues" .Fa "char **trusted" .Fa "int *trustedlen" .Fa "int numtrusted" .Fa "char **untrusted" .Fa "int *untrustedlen" .Fa "int numuntrusted" .Fa "char **authorizers" .Fa "int numauthorizers" .Fc .Ft char ** .Fn kn_read_asserts "char *array" "int arraylen" "int *numassertions" .Ft int .Fn kn_keycompare "void *key1" "void *key2" "int algorithm" .Ft void * .Fn kn_get_authorizer "int sessid" "int assertid" "int *algorithm" .Ft struct keynote_keylist * .Fn kn_get_licensees "int sessid" "int assertid" .Ft int .Fn kn_encode_base64 "unsigned char const *src" "unsigned int srclen" "char *dst" "unsigned int dstlen" .Ft int .Fn kn_decode_base64 "char const *src" "unsigned char *dst" "unsigned int dstlen" .Ft int .Fn kn_encode_hex "unsigned char *src" "char **dst" "int srclen" .Ft int .Fn kn_decode_hex "char *src" "char **dst" .Ft char * .Fn kn_encode_key "struct keynote_deckey *dc" "int iencoding" "int encoding" "int keytype" .Ft int .Fn kn_decode_key "struct keynote_deckey *dc" "char *key" "int keytype" .Ft char * .Fn kn_sign_assertion "char *assertion" "int len" "char *key" "char *algorithm" "int vflag" .Ft int .Fn kn_verify_assertion "char *assertion" "int len" .Ft void .Fn kn_free_key "struct keynote_deckey *" .Ft char * .Fn kn_get_string "char *" .Fd Link options: -lkeynote -lm -lcrypto .Sh DESCRIPTION For more details on .Nm keynote , see RFC 2704. .Pp .Va keynote_errno contains an error code if some library call failed. Failed calls return \-1 (if their return value is integer), or .Dv NULL (if their return value is a pointer) and set .Va keynote_errno . The defined error codes are: .Bl -tag -width "ERROR_NOTFOUND" -offset indent .It Li ERROR_MEMORY Some memory allocation or usage error was encountered. .It Li ERROR_SYNTAX Some syntactic or logical error was encountered. .It Li ERROR_NOTFOUND One of the arguments referred to a nonexistent structure or entry. .El .Pp If no errors were encountered, .Va keynote_errno will be set to 0. This variable should be reset to 0 if an error was encountered, prior to calling other library routines. .Pp The main interface to .Nm is centered around the concept of a session. A session describes a collection of policies, assertions, action authorizers, return values, and action attributes that the .Nm system uses to evaluate a query. Information is not shared between sessions. Policies, credentials, action authorizers, and action attributes can be added or deleted at any point during the lifetime of a session. Furthermore, an application can discover which assertions failed to be evaluated, and in what way, during a query. .Pp For those applications that only need to do a simple query, there exists a single call that takes as arguments all the necessary information and performs all the necessary steps. This is essentially a wrapper that calls the session API functions as necessary. .Pp Finally, there exist functions for doing ASCII to hexadecimal and Base64 encoding (and vice versa), for encoding/decoding keys between ASCII and binary formats, and for signing and verifying assertions. .Pp The description of all .Nm library functions follows. .Pp .Fn kn_init creates a new .Nm session, and performs any necessary initializations. On success, this function returns the new session ID, which is used by all subsequent calls with a .Fa sessid argument. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_MEMORY . .Pp .Fn kn_add_assertion adds the assertion pointed to by the array .Fa assertion , of length .Fa len in the session identified by .Fa sessid . The first argument can be discarded after the call to this function. The following flags are defined: .Bl -tag -width ASSERT_FLAG_LOCAL -offset indent .It ASSERT_FLAG_LOCAL Mark this assertion as ultimately trusted. Trusted assertions need not be signed, and the .Fa Authorizer and fields can have non-key entries. .El .Pp At least one (trusted) assertion should have .Dv POLICY as the .Fa Authorizer . On success, this function will return an assertion ID which can be used to remove the assertion from the session, by using .Fn kn_remove_assertion . On failure, \-1 is returned, and .Va keynote_errno is set to .Er ERROR_NOTFOUND if the session was not found, .Er ERROR_SYNTAX if the assertion was syntactically incorrect, or .Er ERROR_MEMORY if necessary memory could not be allocated. .Pp .Fn kn_remove_assertion removes the assertion identified by .Fa assertid from the session identified by .Fa sessid . On success, this function returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_NOTFOUND . .Pp .Fn kn_add_action inserts the variable .Fa name in the action environment of session .Fa sessid , with the value .Fa value . The same attribute may be added more than once, but only the last instance will be used (memory resources are consumed however). .Pp The .Fa flags specified are formed by or'ing the following values: .Bl -tag -width ENVIRONMENT_FLAG_REGEX -offset indent .It ENVIRONMENT_FLAG_FUNC In this case, .Fa value is a pointer to a function that takes as argument a string and returns a string. This is used to implement callbacks for getting action attribute values. The argument passed to such a callback function is a string identifying the action attribute whose value is requested, and should return a pointer to string containing that value (this pointer will not be freed by the library), the empty string if the value was not found, or a .Dv NULL to indicate an error (and may set .Va keynote_errno appropriately). Prior to first use (currently, at the time the attribute is added to the session environment), such functions are called with .Dv KEYNOTE_CALLBACK_INITIALIZE as the argument (defined in keynote.h) so that they can perform any special initializations. Furthermore, when the session is deleted, all such functions will be called with .Dv KEYNOTE_CALLBACK_CLEANUP to perform any special cleanup (such as free any allocated memory). A function may be called with either of these arguments more than once, if it has been defined as the callback function for more than one attribute. .It ENVIRONMENT_FLAG_REGEX In this case, .Fa name is a regular expression that may match more than one attribute. In case of conflict between a regular expression and a .Dq simple attribute, the latter will be given priority. In case of conflict between two regular expression attributes, the one added later will be given priority. A callback function should never change the current .Nm session, start/invoke/operate on another session, or call one of the session-API functions. .El .Pp The combination of the two flags may be used to specify callback functions that handle large sets of attributes (even to the extent of having one callback function handling all attribute references). This is particularly useful when the action attribute set is particularly large. .Pp On success, .Fn kn_add_action returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_NOTFOUND if the session was not found, .Er ERROR_SYNTAX if the .Fa name was invalid (e.g., started with an underscore character) or was .Dv NULL , or .Er ERROR_MEMORY if necessary memory could not be allocated. .Pp .Fn kn_remove_action removes action attribute .Fa name from the environment of session .Fa sessid . Notice that if more than one instances of .Fa name exist, only the one added last will be deleted. On success, this function returns 0. On failure, it returns \-1 and .Va keynote_errno is set to .Er ERROR_NOTFOUND if the session or the attribute were not found, or .Er ERROR_SYNTAX if the name was invalid. If the attribute value was a callback, that function will be called with the define .Dv KEYNOTE_CALLBACK_CLEANUP as the argument. .Pp .Fn kn_add_authorizer adds the principal pointed to by .Fa principal to the action authorizers list of session .Fa sessid . The principal is typically an ASCII-encoded key. On success, this function will return 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_NOTFOUND if the session was not found, .Er ERROR_SYNTAX if the encoding was invalid, or .Er ERROR_MEMORY if necessary memory could not be allocated. .Pp .Fn kn_remove_authorizer removes .Fa principal from the action authorizer list of session .Fa sessid . On success, this function returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_NOTFOUND if the session was not found. .Pp .Fn kn_do_query evaluates the request based on the assertions, action attributes, and action authorizers added to session .Fa sessid . .Fa returnvalues is an ordered array of strings that contain the return values. The lowest-ordered return value is contained in .Fa returnvalues Ns Bq 0 , and the highest-ordered value is .Fa returnvalues Ns Bq Fa numvalues No \- 1 . If .Fa returnvalues is .Dv NULL , the .Fa returnvalues from the previous call to .Fn kn_do_query will be used. The programmer SHOULD NOT free .Fa returnvalues after the call to .Fn kn_do_query if this feature is used, as the array is not replicated internally. On success, this function returns an index into the .Fa returnvalues array. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_NOTFOUND if the session was not found or the authorizers list was empty, .Er ERROR_SYNTAX if no .Fa returnvalues have been specified, or .Er ERROR_MEMORY if necessary memory could not be allocated. .Pp .Fn kn_get_failed returns the assertion ID of the .Fa num'th assertion (starting from zero) in session .Fa sessid that was somehow invalid during evaluation. This function is typically called after .Fn kn_do_query is used to evaluate a request. .Fa type specifies the type of failure the application is interested in. It can be set to: .Bl -tag -width KEYNOTE_ERROR_SIGNATURE -offset indent .It KEYNOTE_ERROR_ANY to indicate interest in any error. .It KEYNOTE_ERROR_SYNTAX for syntactic or semantic errors. .It KEYNOTE_ERROR_MEMORY for memory-related problems. .It KEYNOTE_ERROR_SIGNATURE if the assertion could not be cryptographically verified. .El .Pp These values are defined in keynote.h. An application can then delete the offending assertion using .Fn kn_remove_assertion . For example, to remove all assertion whose signature failed, an application could do something like: .Bd -literal while ((assertid = kn_get_failed(sessid, KEYNOTE_ERROR_SIGNATURE, 0) != -1) kn_remove_assertion(sessid, assertid); .Ed .Pp On success, .Fn kn_get_failed returns an assertion ID. On failure, or when no assertion matching the given criteria is found, it returns \-1 and set .Va keynote_errno to .Er ERROR_NOTFOUND . .Pp .Fn kn_cleanup_action_environment removes all action attributes from the action environment of session .Fa sessid . It returns 0 on success. .Pp .Fn kn_close closes session .Fa sessid and frees all related resources, deleting action attributes, action authorizers, and assertions. On success, this function returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_NOTFOUND if the session was not found. .Pp .Fn kn_read_asserts parses the string .Fa array of length .Fa arraylen and returns an array of pointers to strings containing copies of the assertions found in .Fa array . Both the array of pointers and the strings are allocated by .Fn kn_read_asserts dynamically, and thus should be freed by the programmer when they are no longer needed. .Fa numassertions contains the number of assertions (and thus strings in the returned array) found in .Fa array . On failure, this function returns .Dv NULL and sets .Va keynote_errno to .Er ERROR_MEMORY if necessary memory could not be allocated, or .Er ERROR_SYNTAX if .Fa array was .Dv NULL . Note that if there were no assertions found in .Fa array , a valid pointer will be returned, but .Fa numassertions will contain the value zero on return. The returned pointer should be freed by the programmer. .Pp .Fn kn_keycompare compares .Fa key1 and .Fa key2 (which must be of the same .Fa algorithm ) and returns 1 if equal and 0 otherwise. .Pp .Fn kn_get_authorizer returns the authorizer key (in binary format) for assertion .Fa assertid in session .Fa sessid . It also sets the .Fa algorithm argument to the algorithm of the authorizer key. On failure, .Fn kn_get_authorizer returns .Dv NULL , and sets .Va keynote_errno to .Er ERROR_NOTFOUND . .Pp .Fn kn_get_licensees returns the licensee key(s) for assertion .Fa assertid in session .Fa sessid . The keys are returned in a linked list of .Fa struct keynote_keylist structures. On failure, .Fn kn_get_licensees returns .Dv NULL . and sets .Va keynote_errno to .Er ERROR_NOTFOUND . .Pp .Fn kn_query takes as arguments a list of action attributes in .Fa env , a list of return values in .Fa returnvalues (the number of returnvalues is indicated by .Fa numvalues ) , a number .Pf ( Fa numtrusted ) of locally-trusted assertions in .Fa trusted (the length of each assertion is given by the respective element of .Fa trustedlen ) , a number .Pf ( Fa numuntrusted ) of assertions that need to be cryptographically verified in .Fa untrusted (the length of each assertion is given by the respective element of .Fa untrustedlen ) , and a number .Pf ( Fa numauthorizers ) of action authorizers in .Fa authorizers . .Fa env is a linked list of .Fa struct environment structures. The .Fa env_name , .Fa env_value , and .Fa env_flags fields correspond to the .Fa name , .Fa value , and .Fa flags arguments to .Fn kn_add_assertion respectively. .Fa env_regex is not used. On success, this function returns an index in .Fa returnvalues indicating the returned value to the query. On failure, it returns \-1 and sets .Va keynote_errno to the same values as .Fn kn_do_query , or to .Er ERROR_MEMORY if a trusted or untrusted assertion could not be added to the session due to lack of memory resources. Syntax errors in assertions will not be reported by .Fn kn_query . .Pp .Fn kn_encode_base64 converts the data of length .Fa srclen contained in .Fa src in Base64 encoding and stores them in .Fa dst which is of length .Fa dstlen . The actual length of the encoding stored in .Fa dst is returned. .Fa dst should be long enough to also contain the trailing string terminator. If .Fa dst is not long enough to contain the encoded data, this function returns \-1 and sets .Va keynote_errno to .Er ERROR_SYNTAX . .Pp .Fn kn_decode_base64 decodes the Base64-encoded data stored in .Fa src and stores the result in .Fa dst , which is of length .Fa dstlen . The actual length of the decoded data is returned on success. On failure, this function returns \-1 and sets .Va keynote_errno to .Er ERROR_SYNTAX , denoting either an invalid Base64 encoding or insufficient space in .Fa dst . .Pp .Fn kn_encode_hex encodes in ASCII-hexadecimal format the data of length .Fa srclen contained in .Fa src . This function allocates a chunk of memory to store the result, which is returned in .Fa dst . Thus, this function should be used as follows: .Bd -literal char *dst; kn_encode_hex(src, &dst, srclen); .Ed .Pp The length of the allocated buffer will be (2 * srclen + 1). On success, this function returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_MEMORY if it failed to allocate enough memory, .Er ERROR_SYNTAX if .Fa dst was .Dv NULL . .Pp .Fn kn_decode_hex decodes the ASCII hex-encoded string in .Fa src and stores the result in a memory chunk allocated by the function. A pointer to that memory is stored in .Fa dst . The length of the allocated memory will be (strlen(src) / 2). On success, this function returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_MEMORY if it could not allocate enough memory, or .Er ERROR_SYNTAX if .Fa dst was .Dv NULL , or the length of .Fa src is not even. .Pp .Fn kn_encode_key ASCII-encodes a cryptographic key. The binary representation of the key is contained in .Fa dc . The field .Fa dec_key in that structure is a pointer to some cryptographic algorithm dependent information describing the key. In this implementation, this pointer should be a .Fa DSA * or .Fa RSA * for DSA or RSA keys respectively, as used in the SSL library, or a .Fa keynote_binary * for cryptographic keys whose algorithm .Nm does not know about but the application wishes to include in the action authorizers (and thus need to be canonicalized). The field .Fa dec_algorithm describes the cryptographic algorithm, and may be one of .Dv KEYNOTE_ALGORITHM_DSA , .Dv KEYNOTE_ALGORITHM_RSA , or .Dv KEYNOTE_ALGORITHM_BINARY in this implementation. .Pp .Fa iencoding describes how the key should be binary-encoded. This implementation supports .Dv INTERNAL_ENC_PKCS1 for RSA keys, .Dv INTERNAL_ENC_ASN1 for DSA keys, and .Dv INTERNAL_ENC_NONE for BINARY keys. .Fa encoding describes what ASCII encoding should be applied to the key. Valid values are .Dv ENCODING_HEX and .Dv ENCODING_BASE64 , for hexadecimal and Base64 encoding respectively. .Fa keytype is one of .Dv KEYNOTE_PUBLIC_KEY or .Dv KEYNOTE_PRIVATE_KEY to indicate whether the key is public or private. Private keys have the string .Dv KEYNOTE_PRIVATE_KEY_PREFIX (defined in keynote.h) prefixed to the algorithm name. On success, this function returns a string containing the encoded key. On failure, it returns .Dv NULL and sets .Va keynote_errno to .Er ERROR_NOTFOUND if the .Fa dc argument was invalid, .Er ERROR_MEMORY if it failed to allocate the necessary memory, or .Er ERROR_SYNTAX if the key to be converted was invalid. .Pp .Fn kn_decode_key decodes the ASCII-encoded string contained in .Fa key . The result is placed in .Fa dc , with .Fa dec_algorithm describing the algorithm (see .Fn kn_encode_key ) , and .Fa dec_key pointing to an algorithm-dependent structure. In this implementation, this is an SSLeay/OpenSSL-defined .Fa DSA * for DSA keys, .Fa RSA * for RSA and X.509-based keys, and a .Fa keynote_binary * for BINARY keys. .Fa keytype takes the values .Dv KEYNOTE_PUBLIC_KEY or .Dv KEYNOTE_PRIVATE_KEY to specify a public or private key, where applicable. On success, this function returns 0. On failure, it returns \-1 and sets .Va keynote_errno to .Er ERROR_MEMORY if necessary memory could not be allocated, or .Er ERROR_SYNTAX if the key or the ASCII encoding was malformed. .Pp .Fn kn_sign_assertion produces the cryptographic signature for the assertion of length .Fa len stored in .Fa assertion , using the ASCII-encoded cryptographic key contained in .Fa key . The type of signature to be produced is described by the string .Fa algorithm . Possible values for this string are .Dv SIG_RSA_SHA1_PKCS1_HEX , .Dv SIG_RSA_SHA1_PKCS1_BASE64 , .Dv SIG_RSA_MD5_HEX and .Dv SIG_RSA_MD5_HEX for RSA keys, .Dv SIG_DSA_SHA1_HEX and .Dv SIG_DSA_SHA1_BASE64 for DSA keys, .Dv SIG_X509_SHA1_HEX and .Dv SIG_X509_SHA1_BASE64 for X.509-based keys. No other cryptographic signatures are currently supported by this implementation. If .Fa vflag is set to 1, then the generated signature will also be verified. On success, this function returns a string containing the ASCII-encoded signature, without modifying the .Fa assertion . On failure, it returns .Dv NULL and sets .Va keynote_errno to .Er ERROR_NOTFOUND if one of the arguments was .Dv NULL , .Er ERROR_MEMORY if necessary memory could not be allocated, or .Er ERROR_SYNTAX if the .Fa algorithm , the .Fa key , or the .Fa assertion (if signature verification was requested) was invalid. .Pp .Fn kn_verify_assertion verifies the cryptographic signature on the assertion of length .Fa len contained in string .Fa assertion . On success, this function returns .Dv SIGRESULT_TRUE if the signature could be verified, or .Dv SIGRESULT_FALSE otherwise. On failure, this function returns \-1 and sets .Va keynote_errno to .Er ERROR_MEMORY if necessary memory could not be allocated, or .Er ERROR_SYNTAX if the assertion contained a syntactic error, or the cryptographic algorithm was not supported. .Pp .Fn kn_free_key frees a cryptographic key. .Pp .Fn kn_get_string parses the argument, treating it as a .Xr keynote 4 (quoted) string. This is useful for parsing key files. On success, this function returns a pointer to the parsing result. The result is dynamically allocated and should be freed after use. On failure, .Dv NULL is returned. .Sh FILES .Bl -tag -width libkeynote.a -compact .It Pa keynote.h .It Pa libkeynote.a .El .Sh DIAGNOSTICS The return values of all the functions have been given along with the function description above. .Sh SEE ALSO .Xr keynote 1 , .Xr keynote 4 , .Xr keynote 5 .Rs .%A M. Blaze .%A J. Feigenbaum .%A J. Lacy .%D 1996 .%J IEEE Symposium on Security and Privacy .%T Decentralized Trust Management .Re .Rs .%A M. Blaze .%A J. Feigenbaum .%A M. Strauss .%D 1998 .%J Financial Crypto Conference .%T Compliance-Checking in the PolicyMaker Trust Management System .Re .Sh STANDARDS .Rs .%A M. Blaze .%A J. Feigenbaum .%A J. Ioannidis .%A A. Keromytis .%D September 1999 .%R RFC 2704 .%T The KeyNote Trust-Management System Version 2 .Re .Sh AUTHORS .An Angelos D. Keromytis Aq Mt angelos@cs.columbia.edu .Sh WEB PAGE .Lk path_to_url~angelos/keynote.html ```
```java /* * * See the CONTRIBUTORS.txt file in the distribution for a * full listing of individual contributors. * * This program is free software: you can redistribute it and/or modify * published by the Free Software Foundation, either version 3 of the * * 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 * * along with this program. If not, see <path_to_url */ package org.openremote.model.persistence; import org.hibernate.HibernateException; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.usertype.UserType; import java.io.Serializable; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; import java.util.Arrays; public class LTreeType implements UserType<String[]> { public static final String TYPE = "ltree"; @Override public int getSqlType() { return Types.OTHER; } @Override public Class<String[]> returnedClass() { return String[].class; } @Override public boolean equals(String[] x, String[] y) throws HibernateException { return Arrays.equals(x, y); } @Override public int hashCode(String[] x) throws HibernateException { return Arrays.hashCode(x); } @Override public String[] nullSafeGet(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner) throws SQLException { String ltreeStr = rs.getString(position); return ltreeStr != null ? ltreeStr.split("\\.") : null; } @Override public void nullSafeSet(PreparedStatement st, String[] value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException { st.setObject(index, value != null ? String.join(".", value) : null, Types.OTHER); } @Override public String[] deepCopy(String[] v) throws HibernateException { return v == null ? null : Arrays.copyOf(v, v.length); } @Override public boolean isMutable() { return false; } @Override public Serializable disassemble(String[] value) throws HibernateException { return value; } @Override public String[] assemble(Serializable cached, Object owner) throws HibernateException { return deepCopy((String[])cached); } @Override public String[] replace(String[] original, String[] target, Object owner) throws HibernateException { // TODO Auto-generated method stub return deepCopy(original); } } ```
```python # -*- coding: utf-8 -*- from __future__ import unicode_literals from ..models import GitHubCore from ..repos import Repository class RepositorySearchResult(GitHubCore): def _update_attributes(self, data): result = data.copy() #: Score of the result self.score = result.pop('score') #: Text matches self.text_matches = result.pop('text_matches', []) #: Repository object self.repository = Repository(result, self) def _repr(self): return '<RepositorySearchResult [{0}]>'.format(self.repository) ```
Mpofana Municipality () is a local municipality within the Umgungundlovu District Municipality, in the KwaZulu-Natal province of South Africa. Main places The 2001 census divided the municipality into the following main places: Politics The municipal council consists of ten members elected by mixed-member proportional representation. Five councillors are elected by first-past-the-post voting in five wards, while the remaining five are chosen from party lists so that the total number of party representatives is proportional to the number of votes received. In the election of 1 November 2021 the African National Congress (ANC) won a majority of seven seats on the council. The following table shows the results of the election. References External links https://web.archive.org/web/20120518060135/http://mpofana.local.gov.za/ Local municipalities of the Umgungundlovu District Municipality
DigiSigner is a cloud-based electronic signature solution focused on ease of use, speed, and affordability. The service enables businesses and individuals to sign documents, and agreements and close deals from anywhere in the world. DigiSigner can be used on various platforms, including laptops, iPhones, iPads, Android, etc. DigiSigner is compliant with all major e-signature laws including ESIGN, UETA, and European eIDAS. The signatures created with DigiSigner are legally binding and are recognized in court. History DigiSigner was created in 2014 by Dmitry Lakhin to provide a flexible, secure, and legally binding e-signature solution and eliminate the need to print, scan, and fax documents. DigiSigner is owned and developed by the company DigiSigner GmbH which operates in Munich, Germany. External links Business software companies PDF software Freeware
```objective-c /* or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file path_to_url Unless required by applicable law or agreed to in writing, "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY specific language governing permissions and limitations */ #import <Foundation/Foundation.h> /** Converts the given `double` _value_ to an `uint64_t` value. @param value The value as a `double`. @return The value as an `uint64_t`. */ uint64_t spt_uint64rint(double value); ```
```objective-c /** * */ #pragma once #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /** Group: Configuration Register */ /** Type of chn_conf0 register * Configuration register 0 for channel n */ typedef union { struct { /** timer_sel : R/W; bitpos: [1:0]; default: 0; * This field is used to select one of timers for channel n. * * 0: select timer0; 1: select timer1; 2: select timer2; 3: select timer3 */ uint32_t timer_sel:2; /** sig_out_en : R/W; bitpos: [2]; default: 0; * Set this bit to enable signal output on channel n. */ uint32_t sig_out_en:1; /** idle_lv : R/W; bitpos: [3]; default: 0; * This bit is used to control the output value when channel n is inactive (when * LEDC_SIG_OUT_EN_CHn is 0). */ uint32_t idle_lv:1; /** para_up : WT; bitpos: [4]; default: 0; * This bit is used to update LEDC_HPOINT_CHn, LEDC_DUTY_START_CHn, * LEDC_SIG_OUT_EN_CHn, LEDC_TIMER_SEL_CHn, LEDC_DUTY_NUM_CHn, LEDC_DUTY_CYCLE_CHn, * LEDC_DUTY_SCALE_CHn, LEDC_DUTY_INC_CHn, and LEDC_OVF_CNT_EN_CHn fields for channel * n, and will be automatically cleared by hardware. */ uint32_t para_up:1; /** ovf_num : R/W; bitpos: [14:5]; default: 0; * This register is used to configure the maximum times of overflow minus 1. * * The LEDC_OVF_CNT_CHn_INT interrupt will be triggered when channel n overflows for * (LEDC_OVF_NUM_CHn + 1) times. */ uint32_t ovf_num:10; /** ovf_cnt_en : R/W; bitpos: [15]; default: 0; * This bit is used to enable the ovf_cnt of channel n. */ uint32_t ovf_cnt_en:1; /** ovf_cnt_reset : WT; bitpos: [16]; default: 0; * Set this bit to reset the ovf_cnt of channel n. */ uint32_t ovf_cnt_reset:1; uint32_t reserved_17:15; }; uint32_t val; } ledc_chn_conf0_reg_t; /** Type of chn_conf1 register * Configuration register 1 for channel n */ typedef union { struct { /** duty_scale : R/W; bitpos: [9:0]; default: 0; * This register is used to configure the changing step scale of duty on channel n. */ uint32_t duty_scale:10; /** duty_cycle : R/W; bitpos: [19:10]; default: 0; * The duty will change every LEDC_DUTY_CYCLE_CHn on channel n. */ uint32_t duty_cycle:10; /** duty_num : R/W; bitpos: [29:20]; default: 0; * This register is used to control the number of times the duty cycle will be changed. */ uint32_t duty_num:10; /** duty_inc : R/W; bitpos: [30]; default: 1; * This register is used to increase or decrease the duty of output signal on channel * n. 1: Increase; 0: Decrease. */ uint32_t duty_inc:1; /** duty_start : R/W/SC; bitpos: [31]; default: 0; * Other configured fields in LEDC_CHn_CONF1_REG will start to take effect when this * bit is set to 1. */ uint32_t duty_start:1; }; uint32_t val; } ledc_chn_conf1_reg_t; /** Type of conf register * Global ledc configuration register */ typedef union { struct { /** apb_clk_sel : R/W; bitpos: [1:0]; default: 0; * This bit is used to select clock source for the 4 timers . * * 2'd1: APB_CLK 2'd2: RTC8M_CLK 2'd3: XTAL_CLK */ uint32_t apb_clk_sel:2; uint32_t reserved_2:29; /** clk_en : R/W; bitpos: [31]; default: 0; * This bit is used to control clock. * * 1'b1: Force clock on for register. 1'h0: Support clock only when application writes * registers. */ uint32_t clk_en:1; }; uint32_t val; } ledc_conf_reg_t; /** Group: Hpoint Register */ /** Type of chn_hpoint register * High point register for channel n */ typedef union { struct { /** hpoint : R/W; bitpos: [13:0]; default: 0; * The output value changes to high when the selected timers has reached the value * specified by this register. */ uint32_t hpoint:14; uint32_t reserved_14:18; }; uint32_t val; } ledc_chn_hpoint_reg_t; /** Group: Duty Cycle Register */ /** Type of chn_duty register * Initial duty cycle for channel n */ typedef union { struct { /** duty : R/W; bitpos: [18:0]; default: 0; * This register is used to change the output duty by controlling the Lpoint. * * The output value turns to low when the selected timers has reached the Lpoint. */ uint32_t duty:19; uint32_t reserved_19:13; }; uint32_t val; } ledc_chn_duty_reg_t; /** Type of chn_duty_r register * Current duty cycle for channel n */ typedef union { struct { /** duty_r : RO; bitpos: [18:0]; default: 0; * This register stores the current duty of output signal on channel n. */ uint32_t duty_r:19; uint32_t reserved_19:13; }; uint32_t val; } ledc_chn_duty_r_reg_t; /** Group: Timer Register */ /** Type of timerx_conf register * Timer x configuration */ typedef union { struct { /** duty_res : R/W; bitpos: [3:0]; default: 0; * This register is used to control the range of the counter in timer x. */ uint32_t duty_res:4; /** clk_div : R/W; bitpos: [21:4]; default: 0; * This register is used to configure the divisor for the divider in timer x. * * The least significant eight bits represent the fractional part. */ uint32_t clk_div:18; /** pause : R/W; bitpos: [22]; default: 0; * This bit is used to suspend the counter in timer x. */ uint32_t pause:1; /** rst : R/W; bitpos: [23]; default: 1; * This bit is used to reset timer x. The counter will show 0 after reset. */ uint32_t rst:1; uint32_t reserved_24:1; /** para_up : WT; bitpos: [25]; default: 0; * Set this bit to update LEDC_CLK_DIV_TIMERx and LEDC_TIMERx_DUTY_RES. */ uint32_t para_up:1; uint32_t reserved_26:6; }; uint32_t val; } ledc_timerx_conf_reg_t; /** Type of timerx_value register * Timer x current counter value */ typedef union { struct { /** timer_cnt : RO; bitpos: [13:0]; default: 0; * This register stores the current counter value of timer x. */ uint32_t timer_cnt:14; uint32_t reserved_14:18; }; uint32_t val; } ledc_timerx_value_reg_t; /** Group: Interrupt Register */ /** Type of int_raw register * Raw interrupt status */ typedef union { struct { /** timer0_ovf_int_raw : R/WTC/SS; bitpos: [0]; default: 0; * Triggered when the timer0 has reached its maximum counter value. */ uint32_t timer0_ovf_int_raw:1; /** timer1_ovf_int_raw : R/WTC/SS; bitpos: [1]; default: 0; * Triggered when the timer1 has reached its maximum counter value. */ uint32_t timer1_ovf_int_raw:1; /** timer2_ovf_int_raw : R/WTC/SS; bitpos: [2]; default: 0; * Triggered when the timer2 has reached its maximum counter value. */ uint32_t timer2_ovf_int_raw:1; /** timer3_ovf_int_raw : R/WTC/SS; bitpos: [3]; default: 0; * Triggered when the timer3 has reached its maximum counter value. */ uint32_t timer3_ovf_int_raw:1; /** duty_chng_end_ch0_int_raw : R/WTC/SS; bitpos: [4]; default: 0; * Interrupt raw bit for channel 0. Triggered when the gradual change of duty has * finished. */ uint32_t duty_chng_end_ch0_int_raw:1; /** duty_chng_end_ch1_int_raw : R/WTC/SS; bitpos: [5]; default: 0; * Interrupt raw bit for channel 1. Triggered when the gradual change of duty has * finished. */ uint32_t duty_chng_end_ch1_int_raw:1; /** duty_chng_end_ch2_int_raw : R/WTC/SS; bitpos: [6]; default: 0; * Interrupt raw bit for channel 2. Triggered when the gradual change of duty has * finished. */ uint32_t duty_chng_end_ch2_int_raw:1; /** duty_chng_end_ch3_int_raw : R/WTC/SS; bitpos: [7]; default: 0; * Interrupt raw bit for channel 3. Triggered when the gradual change of duty has * finished. */ uint32_t duty_chng_end_ch3_int_raw:1; /** duty_chng_end_ch4_int_raw : R/WTC/SS; bitpos: [8]; default: 0; * Interrupt raw bit for channel 4. Triggered when the gradual change of duty has * finished. */ uint32_t duty_chng_end_ch4_int_raw:1; /** duty_chng_end_ch5_int_raw : R/WTC/SS; bitpos: [9]; default: 0; * Interrupt raw bit for channel 5. Triggered when the gradual change of duty has * finished. */ uint32_t duty_chng_end_ch5_int_raw:1; /** ovf_cnt_ch0_int_raw : R/WTC/SS; bitpos: [10]; default: 0; * Interrupt raw bit for channel 0. Triggered when the ovf_cnt has reached the value * specified by LEDC_OVF_NUM_CH0. */ uint32_t ovf_cnt_ch0_int_raw:1; /** ovf_cnt_ch1_int_raw : R/WTC/SS; bitpos: [11]; default: 0; * Interrupt raw bit for channel 1. Triggered when the ovf_cnt has reached the value * specified by LEDC_OVF_NUM_CH1. */ uint32_t ovf_cnt_ch1_int_raw:1; /** ovf_cnt_ch2_int_raw : R/WTC/SS; bitpos: [12]; default: 0; * Interrupt raw bit for channel 2. Triggered when the ovf_cnt has reached the value * specified by LEDC_OVF_NUM_CH2. */ uint32_t ovf_cnt_ch2_int_raw:1; /** ovf_cnt_ch3_int_raw : R/WTC/SS; bitpos: [13]; default: 0; * Interrupt raw bit for channel 3. Triggered when the ovf_cnt has reached the value * specified by LEDC_OVF_NUM_CH3. */ uint32_t ovf_cnt_ch3_int_raw:1; /** ovf_cnt_ch4_int_raw : R/WTC/SS; bitpos: [14]; default: 0; * Interrupt raw bit for channel 4. Triggered when the ovf_cnt has reached the value * specified by LEDC_OVF_NUM_CH4. */ uint32_t ovf_cnt_ch4_int_raw:1; /** ovf_cnt_ch5_int_raw : R/WTC/SS; bitpos: [15]; default: 0; * Interrupt raw bit for channel 5. Triggered when the ovf_cnt has reached the value * specified by LEDC_OVF_NUM_CH5. */ uint32_t ovf_cnt_ch5_int_raw:1; uint32_t reserved_16:16; }; uint32_t val; } ledc_int_raw_reg_t; /** Type of int_st register * Masked interrupt status */ typedef union { struct { /** timer0_ovf_int_st : RO; bitpos: [0]; default: 0; * This is the masked interrupt status bit for the LEDC_TIMER0_OVF_INT interrupt when * LEDC_TIMER0_OVF_INT_ENA is set to 1. */ uint32_t timer0_ovf_int_st:1; /** timer1_ovf_int_st : RO; bitpos: [1]; default: 0; * This is the masked interrupt status bit for the LEDC_TIMER1_OVF_INT interrupt when * LEDC_TIMER1_OVF_INT_ENA is set to 1. */ uint32_t timer1_ovf_int_st:1; /** timer2_ovf_int_st : RO; bitpos: [2]; default: 0; * This is the masked interrupt status bit for the LEDC_TIMER2_OVF_INT interrupt when * LEDC_TIMER2_OVF_INT_ENA is set to 1. */ uint32_t timer2_ovf_int_st:1; /** timer3_ovf_int_st : RO; bitpos: [3]; default: 0; * This is the masked interrupt status bit for the LEDC_TIMER3_OVF_INT interrupt when * LEDC_TIMER3_OVF_INT_ENA is set to 1. */ uint32_t timer3_ovf_int_st:1; /** duty_chng_end_ch0_int_st : RO; bitpos: [4]; default: 0; * This is the masked interrupt status bit for the LEDC_DUTY_CHNG_END_CH0_INT * interrupt when LEDC_DUTY_CHNG_END_CH0_INT_ENAIS set to 1. */ uint32_t duty_chng_end_ch0_int_st:1; /** duty_chng_end_ch1_int_st : RO; bitpos: [5]; default: 0; * This is the masked interrupt status bit for the LEDC_DUTY_CHNG_END_CH1_INT * interrupt when LEDC_DUTY_CHNG_END_CH1_INT_ENAIS set to 1. */ uint32_t duty_chng_end_ch1_int_st:1; /** duty_chng_end_ch2_int_st : RO; bitpos: [6]; default: 0; * This is the masked interrupt status bit for the LEDC_DUTY_CHNG_END_CH2_INT * interrupt when LEDC_DUTY_CHNG_END_CH2_INT_ENAIS set to 1. */ uint32_t duty_chng_end_ch2_int_st:1; /** duty_chng_end_ch3_int_st : RO; bitpos: [7]; default: 0; * This is the masked interrupt status bit for the LEDC_DUTY_CHNG_END_CH3_INT * interrupt when LEDC_DUTY_CHNG_END_CH3_INT_ENAIS set to 1. */ uint32_t duty_chng_end_ch3_int_st:1; /** duty_chng_end_ch4_int_st : RO; bitpos: [8]; default: 0; * This is the masked interrupt status bit for the LEDC_DUTY_CHNG_END_CH4_INT * interrupt when LEDC_DUTY_CHNG_END_CH4_INT_ENAIS set to 1. */ uint32_t duty_chng_end_ch4_int_st:1; /** duty_chng_end_ch5_int_st : RO; bitpos: [9]; default: 0; * This is the masked interrupt status bit for the LEDC_DUTY_CHNG_END_CH5_INT * interrupt when LEDC_DUTY_CHNG_END_CH5_INT_ENAIS set to 1. */ uint32_t duty_chng_end_ch5_int_st:1; /** ovf_cnt_ch0_int_st : RO; bitpos: [10]; default: 0; * This is the masked interrupt status bit for the LEDC_OVF_CNT_CH0_INT interrupt when * LEDC_OVF_CNT_CH0_INT_ENA is set to 1. */ uint32_t ovf_cnt_ch0_int_st:1; /** ovf_cnt_ch1_int_st : RO; bitpos: [11]; default: 0; * This is the masked interrupt status bit for the LEDC_OVF_CNT_CH1_INT interrupt when * LEDC_OVF_CNT_CH1_INT_ENA is set to 1. */ uint32_t ovf_cnt_ch1_int_st:1; /** ovf_cnt_ch2_int_st : RO; bitpos: [12]; default: 0; * This is the masked interrupt status bit for the LEDC_OVF_CNT_CH2_INT interrupt when * LEDC_OVF_CNT_CH2_INT_ENA is set to 1. */ uint32_t ovf_cnt_ch2_int_st:1; /** ovf_cnt_ch3_int_st : RO; bitpos: [13]; default: 0; * This is the masked interrupt status bit for the LEDC_OVF_CNT_CH3_INT interrupt when * LEDC_OVF_CNT_CH3_INT_ENA is set to 1. */ uint32_t ovf_cnt_ch3_int_st:1; /** ovf_cnt_ch4_int_st : RO; bitpos: [14]; default: 0; * This is the masked interrupt status bit for the LEDC_OVF_CNT_CH4_INT interrupt when * LEDC_OVF_CNT_CH4_INT_ENA is set to 1. */ uint32_t ovf_cnt_ch4_int_st:1; /** ovf_cnt_ch5_int_st : RO; bitpos: [15]; default: 0; * This is the masked interrupt status bit for the LEDC_OVF_CNT_CH5_INT interrupt when * LEDC_OVF_CNT_CH5_INT_ENA is set to 1. */ uint32_t ovf_cnt_ch5_int_st:1; uint32_t reserved_16:16; }; uint32_t val; } ledc_int_st_reg_t; /** Type of int_ena register * Interrupt enable bits */ typedef union { struct { /** timer0_ovf_int_ena : R/W; bitpos: [0]; default: 0; * The interrupt enable bit for the LEDC_TIMER0_OVF_INT interrupt. */ uint32_t timer0_ovf_int_ena:1; /** timer1_ovf_int_ena : R/W; bitpos: [1]; default: 0; * The interrupt enable bit for the LEDC_TIMER1_OVF_INT interrupt. */ uint32_t timer1_ovf_int_ena:1; /** timer2_ovf_int_ena : R/W; bitpos: [2]; default: 0; * The interrupt enable bit for the LEDC_TIMER2_OVF_INT interrupt. */ uint32_t timer2_ovf_int_ena:1; /** timer3_ovf_int_ena : R/W; bitpos: [3]; default: 0; * The interrupt enable bit for the LEDC_TIMER3_OVF_INT interrupt. */ uint32_t timer3_ovf_int_ena:1; /** duty_chng_end_ch0_int_ena : R/W; bitpos: [4]; default: 0; * The interrupt enable bit for the LEDC_DUTY_CHNG_END_CH0_INT interrupt. */ uint32_t duty_chng_end_ch0_int_ena:1; /** duty_chng_end_ch1_int_ena : R/W; bitpos: [5]; default: 0; * The interrupt enable bit for the LEDC_DUTY_CHNG_END_CH1_INT interrupt. */ uint32_t duty_chng_end_ch1_int_ena:1; /** duty_chng_end_ch2_int_ena : R/W; bitpos: [6]; default: 0; * The interrupt enable bit for the LEDC_DUTY_CHNG_END_CH2_INT interrupt. */ uint32_t duty_chng_end_ch2_int_ena:1; /** duty_chng_end_ch3_int_ena : R/W; bitpos: [7]; default: 0; * The interrupt enable bit for the LEDC_DUTY_CHNG_END_CH3_INT interrupt. */ uint32_t duty_chng_end_ch3_int_ena:1; /** duty_chng_end_ch4_int_ena : R/W; bitpos: [8]; default: 0; * The interrupt enable bit for the LEDC_DUTY_CHNG_END_CH4_INT interrupt. */ uint32_t duty_chng_end_ch4_int_ena:1; /** duty_chng_end_ch5_int_ena : R/W; bitpos: [9]; default: 0; * The interrupt enable bit for the LEDC_DUTY_CHNG_END_CH5_INT interrupt. */ uint32_t duty_chng_end_ch5_int_ena:1; /** ovf_cnt_ch0_int_ena : R/W; bitpos: [10]; default: 0; * The interrupt enable bit for the LEDC_OVF_CNT_CH0_INT interrupt. */ uint32_t ovf_cnt_ch0_int_ena:1; /** ovf_cnt_ch1_int_ena : R/W; bitpos: [11]; default: 0; * The interrupt enable bit for the LEDC_OVF_CNT_CH1_INT interrupt. */ uint32_t ovf_cnt_ch1_int_ena:1; /** ovf_cnt_ch2_int_ena : R/W; bitpos: [12]; default: 0; * The interrupt enable bit for the LEDC_OVF_CNT_CH2_INT interrupt. */ uint32_t ovf_cnt_ch2_int_ena:1; /** ovf_cnt_ch3_int_ena : R/W; bitpos: [13]; default: 0; * The interrupt enable bit for the LEDC_OVF_CNT_CH3_INT interrupt. */ uint32_t ovf_cnt_ch3_int_ena:1; /** ovf_cnt_ch4_int_ena : R/W; bitpos: [14]; default: 0; * The interrupt enable bit for the LEDC_OVF_CNT_CH4_INT interrupt. */ uint32_t ovf_cnt_ch4_int_ena:1; /** ovf_cnt_ch5_int_ena : R/W; bitpos: [15]; default: 0; * The interrupt enable bit for the LEDC_OVF_CNT_CH5_INT interrupt. */ uint32_t ovf_cnt_ch5_int_ena:1; uint32_t reserved_16:16; }; uint32_t val; } ledc_int_ena_reg_t; /** Type of int_clr register * Interrupt clear bits */ typedef union { struct { /** timer0_ovf_int_clr : WT; bitpos: [0]; default: 0; * Set this bit to clear the LEDC_TIMER0_OVF_INT interrupt. */ uint32_t timer0_ovf_int_clr:1; /** timer1_ovf_int_clr : WT; bitpos: [1]; default: 0; * Set this bit to clear the LEDC_TIMER1_OVF_INT interrupt. */ uint32_t timer1_ovf_int_clr:1; /** timer2_ovf_int_clr : WT; bitpos: [2]; default: 0; * Set this bit to clear the LEDC_TIMER2_OVF_INT interrupt. */ uint32_t timer2_ovf_int_clr:1; /** timer3_ovf_int_clr : WT; bitpos: [3]; default: 0; * Set this bit to clear the LEDC_TIMER3_OVF_INT interrupt. */ uint32_t timer3_ovf_int_clr:1; /** duty_chng_end_ch0_int_clr : WT; bitpos: [4]; default: 0; * Set this bit to clear the LEDC_DUTY_CHNG_END_CH0_INT interrupt. */ uint32_t duty_chng_end_ch0_int_clr:1; /** duty_chng_end_ch1_int_clr : WT; bitpos: [5]; default: 0; * Set this bit to clear the LEDC_DUTY_CHNG_END_CH1_INT interrupt. */ uint32_t duty_chng_end_ch1_int_clr:1; /** duty_chng_end_ch2_int_clr : WT; bitpos: [6]; default: 0; * Set this bit to clear the LEDC_DUTY_CHNG_END_CH2_INT interrupt. */ uint32_t duty_chng_end_ch2_int_clr:1; /** duty_chng_end_ch3_int_clr : WT; bitpos: [7]; default: 0; * Set this bit to clear the LEDC_DUTY_CHNG_END_CH3_INT interrupt. */ uint32_t duty_chng_end_ch3_int_clr:1; /** duty_chng_end_ch4_int_clr : WT; bitpos: [8]; default: 0; * Set this bit to clear the LEDC_DUTY_CHNG_END_CH4_INT interrupt. */ uint32_t duty_chng_end_ch4_int_clr:1; /** duty_chng_end_ch5_int_clr : WT; bitpos: [9]; default: 0; * Set this bit to clear the LEDC_DUTY_CHNG_END_CH5_INT interrupt. */ uint32_t duty_chng_end_ch5_int_clr:1; /** ovf_cnt_ch0_int_clr : WT; bitpos: [10]; default: 0; * Set this bit to clear the LEDC_OVF_CNT_CH0_INT interrupt. */ uint32_t ovf_cnt_ch0_int_clr:1; /** ovf_cnt_ch1_int_clr : WT; bitpos: [11]; default: 0; * Set this bit to clear the LEDC_OVF_CNT_CH1_INT interrupt. */ uint32_t ovf_cnt_ch1_int_clr:1; /** ovf_cnt_ch2_int_clr : WT; bitpos: [12]; default: 0; * Set this bit to clear the LEDC_OVF_CNT_CH2_INT interrupt. */ uint32_t ovf_cnt_ch2_int_clr:1; /** ovf_cnt_ch3_int_clr : WT; bitpos: [13]; default: 0; * Set this bit to clear the LEDC_OVF_CNT_CH3_INT interrupt. */ uint32_t ovf_cnt_ch3_int_clr:1; /** ovf_cnt_ch4_int_clr : WT; bitpos: [14]; default: 0; * Set this bit to clear the LEDC_OVF_CNT_CH4_INT interrupt. */ uint32_t ovf_cnt_ch4_int_clr:1; /** ovf_cnt_ch5_int_clr : WT; bitpos: [15]; default: 0; * Set this bit to clear the LEDC_OVF_CNT_CH5_INT interrupt. */ uint32_t ovf_cnt_ch5_int_clr:1; uint32_t reserved_16:16; }; uint32_t val; } ledc_int_clr_reg_t; /** Group: Version Register */ /** Type of date register * Version control register */ typedef union { struct { /** ledc_date : R/W; bitpos: [31:0]; default: 419829504; * This is the version control register. */ uint32_t ledc_date:32; }; uint32_t val; } ledc_date_reg_t; typedef struct { volatile ledc_chn_conf0_reg_t conf0; volatile ledc_chn_hpoint_reg_t hpoint; volatile ledc_chn_duty_reg_t duty; volatile ledc_chn_conf1_reg_t conf1; volatile ledc_chn_duty_r_reg_t duty_rd; } ledc_chn_reg_t; typedef struct { volatile ledc_chn_reg_t channel[6]; } ledc_ch_group_reg_t; typedef struct { volatile ledc_timerx_conf_reg_t conf; volatile ledc_timerx_value_reg_t value; } ledc_timerx_reg_t; typedef struct { volatile ledc_timerx_reg_t timer[4]; } ledc_timer_group_reg_t; typedef struct ledc_dev_t { volatile ledc_ch_group_reg_t channel_group[1]; uint32_t reserved_078[10]; volatile ledc_timer_group_reg_t timer_group[1]; volatile ledc_int_raw_reg_t int_raw; volatile ledc_int_st_reg_t int_st; volatile ledc_int_ena_reg_t int_ena; volatile ledc_int_clr_reg_t int_clr; volatile ledc_conf_reg_t conf; uint32_t reserved_0d4[10]; volatile ledc_date_reg_t date; } ledc_dev_t; extern ledc_dev_t LEDC; #ifndef __cplusplus _Static_assert(sizeof(ledc_dev_t) == 0x100, "Invalid size of ledc_dev_t structure"); #endif #ifdef __cplusplus } #endif ```
Robert Arthur Thoms (19 May 1826 – 10 June 1903) was a cricket umpire who stood in two Test matches, the first two played in England, in 1880 and 1882. Life and career Thoms was born in Marylebone, London. His father was part-proprietor of a cricket ground in Middlesex. Thoms attended a "good school", where he learnt Latin and Greek. Thoms appeared as a player in three first-class cricket matches in 1850 and 1851: one for an Under 36 XI, one for Marylebone Cricket Club and Metropolitan Clubs and one for the All England Eleven. He was a fine fieldsman and an excellent sprinter over 100 yards. Thoms' long umpiring career lasted from 1863 to 1900 and encompassed 244 first-class matches, including the first two Test matches played in England, between England and Australia at The Oval in 1880 and 1882. When he died, The Times said that he was "the most famous umpire the game has known". The Australian Test captain Joe Darling said, "Thoms was about the only umpire in England who was not afraid of Grace or anyone else." The weekly magazine Cricket said: He was universally regarded as the umpire of the period, imperturbable, accurate and prompt in his decisions, and a great authority on the laws of the game. Unlike most umpires who, when they have given a decision, decline to argue or discuss the matter, he had a habit of explaining just what had happened, and as he very seldom made a mistake, his comments were always heard with respect and often admiration. Thoms frequently wrote articles on cricket for the sporting press, "always having something interesting to say in quaint language, which was charming and entirely his own". He and his wife, the former Elizabeth Constance Farley, had four children, two of whom died in infancy. She died in 1898; he died after a long illness in 1903 at Regent's Park, London. They are buried in a family grave on the eastern side of Highgate Cemetery. References External links Cricinfo profile (including his Wisden obituary notice) 1826 births 1903 deaths Burials at Highgate Cemetery Sportspeople from Marylebone English Test cricket umpires English cricketers All-England Eleven cricketers Marylebone Cricket Club and Metropolitan Clubs cricketers
```go // Package natsort implements natural strings sorting package natsort import ( "regexp" "sort" "strconv" ) type stringSlice []string func (s stringSlice) Len() int { return len(s) } func (s stringSlice) Less(a, b int) bool { return Compare(s[a], s[b]) } func (s stringSlice) Swap(a, b int) { s[a], s[b] = s[b], s[a] } var chunkifyRegexp = regexp.MustCompile(`(\d+|\D+)`) func chunkify(s string) []string { return chunkifyRegexp.FindAllString(s, -1) } // Sort sorts a list of strings in a natural order func Sort(l []string) { sort.Sort(stringSlice(l)) } // Compare returns true if the first string precedes the second one according to natural order func Compare(a, b string) bool { chunksA := chunkify(a) chunksB := chunkify(b) nChunksA := len(chunksA) nChunksB := len(chunksB) for i := range chunksA { if i >= nChunksB { return false } aInt, aErr := strconv.Atoi(chunksA[i]) bInt, bErr := strconv.Atoi(chunksB[i]) // If both chunks are numeric, compare them as integers if aErr == nil && bErr == nil { if aInt == bInt { if i == nChunksA-1 { // We reached the last chunk of A, thus B is greater than A return true } else if i == nChunksB-1 { // We reached the last chunk of B, thus A is greater than B return false } continue } return aInt < bInt } // So far both strings are equal, continue to next chunk if chunksA[i] == chunksB[i] { if i == nChunksA-1 { // We reached the last chunk of A, thus B is greater than A return true } else if i == nChunksB-1 { // We reached the last chunk of B, thus A is greater than B return false } continue } return chunksA[i] < chunksB[i] } return false } ```
The House of Commons Standing Committee on Public Accounts (PACP) is a standing committee of the House of Commons of Canada. It reviews the Auditor General's reports. It is one of five standing committees of the House that is chaired by a member of the opposition. Mandate Review and report on the Public Accounts of Canada Examine all reports of the Auditor General of Canada Membership Subcommittees Subcommittee on Agenda and Procedure (SPAC) External links Standing Committee on Public Accounts (PACP) References Public accounts Public Accounts Committees
```html <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'path_to_url <html xmlns='path_to_url xml:lang='en' lang='en'> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>BOOST_QVM_THROW_EXCEPTION</title> <link href='reno.css' type='text/css' rel='stylesheet'/> </head> <body> <div class="body-0"> <div class="body-1"> <div class="body-2"> <div> <h1>QVM: Quaternions, Vectors, Matrices</h1> </div> <!-- file LICENSE_1_0.txt or copy at path_to_url --> <div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>BOOST_QVM_THROW_EXCEPTION</h3> </div> <div class="RenoIncludeDIV"><p><span class="RenoEscape">&#35;<!--<wiki>`&#35;</wiki>--></span>include &lt;<span class="RenoLink"><a href="boost_qvm_throw_exception_hpp.html">boost/qvm/throw_exception.hpp</a></span>&gt;</p> <div class="RenoIncludeDIV"><pre>#ifndef <span class="RenoLink">BOOST_QVM_THROW_EXCEPTION</span> #include <span class="RenoLink"><a href="www.boost.org/doc/libs/release/libs/exception/doc/boost_throw_exception_hpp.html">&lt;boost/throw_exception.hpp&gt;</a></span> #define <span class="RenoLink">BOOST_QVM_THROW_EXCEPTION</span> <span class="RenoLink"><a href="path_to_url">BOOST_THROW_EXCEPTION</a></span> #endif</pre> </div></div><p>This macro is used whenever Boost QVM throws an exception. Users who override the standard <span class="RenoLink">BOOST_QVM_THROW_EXCEPTION</span> behavior must ensure that when invoked, the substituted implementation does not return control to the caller. Below is a list of all QVM functions that invoke <span class="RenoLink">BOOST_QVM_THROW_EXCEPTION</span>:</p> <div class="RenoPageList"><a href="inverse_mat_.html">inverse(mat)</a><br/> <a href="inverse_quat_.html">inverse(quat)</a><br/> <a href="normalize_quat_.html">normalize(quat)</a><br/> <a href="normalize_vec_.html">normalize(vec)</a><br/> <a href="normalized_quat_.html">normalized(quat)</a><br/> <a href="normalized_vec_.html">normalized(vec)</a><br/> <a href="rot_mat.html">rot_mat</a><br/> <a href="rot_quat.html">rot_quat</a></div> </div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div> See also: <span class="RenoPageList"><a href="boost_qvm_throw_exception_hpp.html">boost/qvm/throw_exception.hpp</a></span> </div> <div class="RenoAutoDIV"><div class="RenoHR"><hr/></div> See also: <span class="RenoPageList"><a href="boost_qvm_throw_exception_hpp.html">boost/qvm/throw_exception.hpp</a></span> </div> <!-- file LICENSE_1_0.txt or copy at path_to_url --> <div id="footer"> <p> <a class="logo" href="path_to_url"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a> <a class="logo" href="path_to_url"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a> </p> </div> </div> </div> </div> </body> </html> ```
The Bombardment of Almería was a naval action which took place on 31 May 1937, during the Spanish Civil War. The Kriegsmarine bombed the city of Almería in retaliation for a Republican air attack on the . Background In April 1937, the Non-intervention Committee established naval patrols in order to patrol the Spanish coasts and harbors. The naval patrols were furnished by Great Britain, France, Germany and Italy. The Spanish Republican Air Force carried out attacks against the harbor of Mallorca, a known-Nationalist naval base. On 24 May 1937, a Republican air raid hit the Italian cruiser , killing six Italian sailors and on the morning of 26 May another Republican air raid nearly missed the . The commander of the German naval patrol protested, nevertheless Mallorca was a patrol zone assigned to France and the foreign ships were inside Spanish territorial waters. The same day, two Republican bombers piloted by Russian pilots, attacked the German heavy cruiser at Ibiza, killing 20–23 German sailors and wounding 73. Hitler wanted to declare war on the Republic, but instead ordered the city of Almeria to be shelled. Bombing of Almeria At dawn on 31 May 1937, the German heavy cruiser and four German destroyers attacked the city of Almeria. The German ships fired 200 shells at the town, killing 19-20 civilians, wounding 50 and destroying 35 buildings. Indalecio Prieto, the Republican minister of Defense wanted to attack the German fleet, but the president Manuel Azaña and the prime minister Juan Negrin were opposed to Prieto's plan because an open war against Germany might have brought the annihilation of the Republic. Negrin and Azaña sent protest notes to the secretary-general of the League of Nations and to the French and the British governments. However, the British and the French governments said that the German attack had been justified. Aftermath On 15 June, Germany denounced a supposed Spanish Republican Navy attack against the German cruiser , and on 23 June Germany and Italy withdrew from the Non-Intervention Committee and Portugal withdrew the British observers on its frontier. At the end of July the Italians started a campaign of maritime attacks against Republican and neutral merchant ships. The loss of merchant ships and the beginning of the Sino-Japanese war led the Soviets to reduce their aid to the Republic. By mid 1937 the Republic was virtually isolated. References Bibliography Explosions in 1937 Mass murder in 1937 Naval battles of the Spanish Civil War Naval battles involving Germany 1937 in Spain Conflicts in 1937 Maritime incidents in 1937 Spanish Civil War massacres History of Andalusia Almería Mediterranean naval operations of the Spanish Civil War May 1937 events
WTFX-FM (93.1 MHz, "Real 93.1") is a commercial mainstream urban radio station licensed to Clarksville, Indiana, serving the Louisville metropolitan area. Owned by iHeartMedia, WTFX has studios located in Louisville, while the station transmitter resides in New Albany, Indiana. Besides a standard analog transmission, WTFX-FM broadcasts over two HD Radio channels, and is available online via iHeartRadio. 93.1 FM signed on in October 1998, first with a loop of songs from "Schoolhouse Rock", and then, on October 12, officially signed on with a Modern AC format as "She 93.1" with the WQSH call letters. In September 1999, "She" moved to 98.9 FM, with 93.1 flipping to country as "The Bull", WYBL. In May 2003, WYBL flipped to smooth jazz as WJZL. In September 2005, 93.1 became the home of active rock-formatted WTFX, as their former frequency (100.5 FM) flipped to adult hits as "Louie FM." WTFX served as the local affiliate for Rover's Morning Glory, Skratch 'N Sniff, and The Side Show Countdown with Nikki Sixx. On May 11, 2016, at 10 a.m., following Rover's Morning Glory, WTFX began stunting with a looped message redirecting listeners to sister station WQMF, which adopted some of WTFX's music and airstaff. The "Fox" active rock format moved to WQMF-HD2. At 5 p.m. that day, WTFX flipped to urban, branded as "93.1 The Beat", launching with 10,000 songs in a row. The first song on "The Beat" was "IDFWU" by Big Sean, followed by "Exchange" by Louisville native Bryson Tiller. The station will become the Louisville affiliate for The Breakfast Club. On March 16, 2018, WTFX rebranded as "Real 93.1". References External links 1998 establishments in Kentucky IHeartMedia radio stations TFX Radio stations established in 1998 TFX-FM Mainstream urban radio stations in the United States
In enzymology, a chitin deacetylase () is an enzyme that catalyzes the chemical reaction chitin + H2O chitosan + acetate Thus, the two substrates of this enzyme are chitin and H2O, whereas its two products are chitosan and acetate. This enzyme belongs to the family of hydrolases, those acting on carbon-nitrogen bonds other than peptide bonds, specifically in linear amides. The systematic name of this enzyme class is chitin amidohydrolase. This enzyme participates in aminosugars metabolism. Structural studies As of late 2007, only one structure has been solved for this class of enzymes, with the PDB accession code . References EC 3.5.1 Enzymes of known structure
Modernform Group Public Company Limited (MODERN) is the manufacturer and distributor of home and office furniture based in Thailand. It is listed on the Stock Exchange of Thailand on . History In 1978, Modernform Home Decorative Products was established as the first company of Modernform Group to import and distribute furniture fittings and accessories from Europe. On 3 April 1980, Modernform Group was established as Modernform Furniture to manufacture and distribute office furniture under brand Modernform Workplace. In 1980, Modernform started manufacturing and marketing office furniture, and subsequently expanded its business scope to cover residential furniture and kitchen units under brands Modernform Exclusive Living and Modernform Kitchen respectively. By 1990, Modernform Group consisted of altogether nine business units, which then were restructured and consolidated as one flagship company, Modernform Group. On , Modernform became a listed company the Stock Exchange of Thailand with 892 million Baht of authorized capital and 832.35 million Baht of registered capital. Notes References Manufacturing companies established in 1980 Furniture companies of Thailand Manufacturing companies based in Bangkok Companies listed on the Stock Exchange of Thailand Thai brands Thai companies established in 1980
Ekaterina Valerievna Krysanova () is a Russian principal dancer of Bolshoi Ballet. Biography Krysanova was born in Moscow, Russia in 1985. Her mother took her to ballet lessons when she was 8. She began studying ballet at the Galina Vishnevskaya Opera Singing Center (Moscow) in 1995, then continued her studies at the Moscow State Choreographic School. L.M. Lavrovsky (teachers Galina Krapivina, Nina Speranskaya), and in 2001 - at the Moscow State Academy of Choreography (class of Tatiana Galtseva). She received a gold medal in 2001 at the Prix de Luxembourg International Ballet Competition and the same year was awarded a bronze in the Junior Competition. In 2002 she was awarded another bronze in Saint Petersburg and the same year attended Bolshoi Ballet Academy from which she graduated in 2003. In the same year, she became a member of the Bolshoi Ballet. She was promoted to the rank of soloist in 2006, became a first soloist in 2008 and by 2009 had been promoted to Leading Soloist under the direction of Svetlana Adyrkhaeva, appearing with the Bavarian State Opera. On 3 December 2011, after a performance of The Bright Stream, Krysanova (who played the role of Zina) reached the rank of Principal. She had appeared in such works as In the Upper Room of Twyla Tharp, Class Concert, Bolt by Alexei Ratmansky, Cinque, Russian Seasons, Ondine and many other contemporary works. Her first soloist role was as the Spanish Doll in The Nutcracker and was followed by the Fairy of Audacity in Sleeping Beauty, as well as many other memorable roles, most of which were produced by Yuri Grigorovich. In 2017, Krysanova appeared in The Taming of the Shrew at the David H. Koch Theater and in 2018 she performed in Don Quixote. Repertoire 2003 Spanish Doll (Nutcracker by P. Tchaikovsky, choreography by Y. Grigorovich) 2004 'two couples' in Part 3, Soloist Part 3 (Symphony in C to music by G. Bizet, choreography by G. Balanchine) 1st variation in The Shadows (L. Minkus' La Bayadere, choreography by M. Petipa, Y. Grigorovich's version) Part in Passacaille to music by A. von Webern (choreography by R. Petit) Fairy of Audacity (The Sleeping Beauty by P. Tchaikovsky, choreography by Y. Grigorovich) 1st pas de trois (Agon by I. Stravinsky, choreography by G. Balanchine) Girls (Magrittomania to music by Y. Krasavin, choreography by Y. Possokhov) — creation at Bolshoi Theatre Guadalquivir (C. Pugni's La Fille du Pharaon, choreography by P. Lacotte after M. Petipa) 2005 Friend/friends to Zina (D. Shostakovich's The Bright Stream, choreography by . A. Ratmansky) Grand Pas variation, 2nd variation in Raimonda's Dreams (Raymonda by A. Glazunov, choreography by M. Petipa, Y. Grigorovich's version) Friend/friends to Shireen (A. Melikov's A Legend of Love, choreography by Y. Grigorovich) Typist/Typists (D. Shostakovich's Bolt, choreography by . A. Ratmansky) Temptation (Les Presages to music by P. Tchaikovsky, choreography by L. Massine) Friend/friends to the Prince, Polish Bride (Swan Lake by P. Tchaikovsky, Y. Grigorovich's second version) Soloist in Part 4 (Symphony in C) Dryad/Three Dryads, 1st Variation in Grand Pas (L. Minkus' Don Quixote, choreography by M. Petipa, A. Gorsky, A. Fadeyechev's version) Friend to Giselle, Two Wilis (Giselle by A. Adam, choreography by J. Coralli, J. Perrot, M. Petipa, Y. Grigorovich's version) Sylph/Sylphs (La Sylphide by H. Levenskiold, choreography by A. Bournonville in version) Soloist (I. Stravinsky's Jeu de cards, choreography by A. Ratmansky) 2006 Princess Aurora (The Sleeping Beauty) Autumn, Waltz Soloist/Soloists, Cinderella (S. Prokofiev's Cinderella, choreography by Y. Possokhov, director Y. Borisov) — creation Lyuska (D. Shostakovich's The Golden Age, choreography by Y. Grigorovich) Tchaikovsky Pas de Deux (choreography by G. Balanchine) Gamzatti (La Bayadere) — debut on the Bolshoi Theatre tour to Monte-Carlo Zina (The Bright Stream) — debut on the Bolshoi Theatre tour to Novosibirsk Odette-Odile (Swan Lake) 2007 Soloist (In the Upper Room by P. Glass, choreography by T. Tharp) Soloist (Misericordes to music by A. Part, choreography by C. Wheeldon) The part in Class Concert (to music by A.Glazunov, A. Lyadov, A. Rubinstein, D. Shostakovich, choreography by A. Messerer) Pas de Trois des Odalisques, Gulnare (Le Corsaire by A. Adam, production and new choreography by A. Ratmansky and Y. Burlaka after M. Petipa) 2008 The title part (H. Levenskiold's La Sylphide, choreography by A. Bournonville, J. Kobborg's version) Amour (creation), Mireille de Poitiers (B. Asfiev's The Flames of Paris, production and new choreography by A. Ratmansky after V. Vainonen) Kitri (Don Quixote) Variation (Grand Pas classique for the ballet Paquita by L. Minkus, choreography by M. Petipa, new choreographic version by Y. Burlaka) — among the creators of this version of the ballet The Couple in Violet (Russian Seasons by L. Desyatnikov, choreography by A. Ratmansky) — among the creators at the Bolshoi Theatre Marie (Nutcracker) 2009 L’Aurore (Coppelia by L. Délibes, choreography by M. Petipa and E. Cecchetti; revival and new choreographic version by S. Vikharev) — creation at the Bolshoi Theatre Aegina (A. Khachaturian's Spartacus, choreography by Y. Grigorovich) The Couple in Yellow (Russian Seasons) — debut on the Bolshoi Theatre tour to St.Petersburg Ballerina (The Bright Stream) Fleur de Lys (C. Pugni's Esmeralda, choreography by M. Petipa, staging and new choreographic version by Y. Burlaka and V. Medvedev) 2010 The part in Serenade by P. Tchaikovsky (choreography by G. Balanchine) Juliet (S. Prokofiev Romeo and Juliet, choreography by Y. Grigorovich ) Medora (Le Corsaire) Paquita (Grand Pas classique for the ballet Paquita, new choreographic version by Y. Burlaka) Aspiccia (La Fille du Pharaon) The Leading Couple in Rubies (Part II of Jewels to music by I. Stransky, choreography by G. Balanchine) 2011 Florine (L. Desyatnikov's Lost Illusions, choreography by A. Ratmansky) — creation Part in Chroma (music by Joby Talbot and Jack White, choreography by W. McGregor) — among the creators at the Bolshoi Theatre 2012 Giselle (Giselle in the version by Y. Grigorovich) Jeanne (The Flames of Paris) The Leading Couple in Diamonds (Part III of Jewels to music by P. Tchaikovsky, choreography by G. Balanchine) The Leading Couple (Classical Symphony to music by S. Prokofiev, choreography by Y. Possokhov) — among the creators at the Bolshoi Theatre Terpsichore (Apollon Musagète by I. Stravinsky, choreography by G. Balanchine) 2013 Nikia (La Bayadere) Angela (Marco Spada to music by D.-F.-E. Auber, P. Lacotte's production) Swanilda (Coppelia) 2014 Katharina (The Taming of the Shrew to music by D. Shostakovich, choreography by J.-C. Maillot) — creation Mekhmene Banu (A Legend of Love) 2015 Coralie (Lost Illusions) 2016 Title part (Raymonda) Part in Short time together to music by M. Richter and L. van Beethoven (choreography by P. Lightfoot and S. León) – among the creators at the Bolshoi Theatre Ondine (Ondine by H. W. Henze, choreography by V. Samodurov) Anyuta (Anyuta to music by V. Gavrilin, choreography by V. Vasiliev) Rita (The Golden Age) 2017 Tatiana (Onegin to music by P. Tchaikovsky, choreography by J. Cranko) Novice (The Cage to music by I. Stravinsky, choreography by J. Robbins) Ballerina (Etudes to music by Carl Czerny, choreography by H. Lander) — creation at the Bolshoi Theatre Carmen (Carmen Suite to music by G. Bizet-R. Shchedrin, A. Alonso production) Juliet (Romeo and Juliet, choreography by A. Ratmansky) – creation at the Bolshoi Theatre 2018 Ballerina (Petrushka by I. Stravinsky, choreography by E. Clug) – creation In 2007, she appeared in the ballet Old Ladies Falling Out to music by L. Desyatnikov (choreography by A. Ratmansky), which was shown first at the Territory Festival, and then under the auspices of the Studio of New Choreography workshop. In 2011, she took part in a co-project of the Bolshoi Theatre and California Centre for the Arts (Remansos to music by E. Granados, choreography by Nacho Duato; Fractus to music by N. Chatham, choreography by K. Armitage; Pas de Trois to music by M. Glinka, choreography by G. Balanchine; Cinque to music by A. Vivaldi, choreography by M. Bigonzetti). Tours 2009 – Medora in Le Corsaire with Bavarian State Ballet (Lukáš Slavický as Conrad); Princess Aurora in The Sleeping Beauty In Kazan, with the Tatar Academic Theatre of Opera and Ballet within the framework of the Nureyev Ballet Festival (Kazan, Andrei Merkuriev as Prince Desiree). 2011 – Gamzatti in La Bayadere with the Tatar Opera and Ballet Theatre within the framework of the Nureyev Ballet Festival (Kazan); Kitri in Don Quixote (R. Barra's production) with the Bavarian State Ballet (Basilio – Andrei Merkuriev, Flavio Salamanca, Lukáš Slavický); Odette/Odile in Swan Lake with Berlin State Ballet (P. Barra's production, Dinu Tamazlacaru as Prince Siegfried) and the title part in La Peri (choreography by V. Malakhov; Akhmed – Mikhail Kaniskin). The same year she appeared at the star gala-concert in memoriam of Galina Ulanova from the Russian ballet icons cycle on the stage of the London Coliseum — there she danced pas de deux from The Flames of Paris opposite Vladislav Lantratov. 2015 – Don Quixote (Ernest Latypov as Basilio) and Swan Lake (Danila Korsuntsev as Prince Siegfried) at the Mariinsky Theatre; Odette/Odile in Swan Lake at the Mariinsky Theatre in the framework of XXIII Music Festival Stars of the White Nights (K. Sergeyev version, Danila Korsuntsev as Prince Siegfried). 2017 — Katharina (The Taming of the Shrew to music by D. Shostakovich, choreography by J.-C. Maillot) with Les Ballets de Monte-Carlo (Vladislav Lantratov as Petruchio). Awards In 2001, she won 1st prize at the Prix de Luxembourg International Ballet Competition and the 3rd at the International Ballet Competition in Moscow (Junior group, Soloists category). In 2002, she won 3rd prize at Vaganova-Prix International Ballet Competition "Ваганова-prix" (Saint-Petersburg). In 2005, she won 2nd prize at International Ballet Competition in Moscow. In 2008, she was awarded the Ballet magazine Soul of Dance prize in the Rising Star category. In 2013, she was awarded the title of People's Artist of the Republic of North Ossetia-Alania. 2015 – The Golden Mask National Theatre prize in the Best ballet female part category for her interpretation of the role of Katharina in The Taming of the Shrew; Positano Léonide Massine Prize (in the Dancer of the Year on the International Stage nomination). 2016 – the twined Prize Benois-Massine Moscow-Positano. In 2018, Ekaterina Krysanova and Igor Tsvirko were awarded the prize of the international ballet festival Dance Open as "Best Duet"; awarded the title "Honored artist of the Russian Federation". References 1985 births Living people Russian ballerinas Dancers from Moscow Bolshoi Ballet principal dancers 21st-century Russian ballet dancers Prix Benois de la Danse winners
```javascript /** * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ 'use strict'; // MODULES // var tape = require( 'tape' ); var noop = require( '@stdlib/utils/noop' ); var ifelseAsync = require( './../lib' ); // TESTS // tape( 'main export is a function', function test( t ) { t.ok( true, __filename ); t.strictEqual( typeof ifelseAsync, 'function', 'main export is a function' ); t.end(); }); tape( 'the function throws an error if provided a first argument which is not a function', function test( t ) { var values; var i; values = [ '5', 5, NaN, true, false, null, void 0, [], {} ]; for ( i = 0; i < values.length; i++ ) { t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); } t.end(); function badValue( value ) { return function badValue() { ifelseAsync( value, 1.0, -1.0, noop ); }; } }); tape( 'the function throws an error if provided a last argument which is not a function', function test( t ) { var values; var i; values = [ '5', 5, NaN, true, false, null, void 0, [], {} ]; for ( i = 0; i < values.length; i++ ) { t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); } t.end(); function badValue( value ) { return function badValue() { ifelseAsync( noop, 1.0, -1.0, value ); }; } }); tape( 'if a predicate function returns a truthy value, the function returns the second argument', function test( t ) { ifelseAsync( predicate, 'beep', 'boop', done ); function predicate( clbk ) { setTimeout( onTimeout, 0 ); function onTimeout() { clbk( null, true ); } } function done( error, result ) { if ( error ) { t.fail( error.message ); } else { t.strictEqual( result, 'beep', 'returns expected value' ); } t.end(); } }); tape( 'if a predicate function returns a falsy value, the function returns the third argument', function test( t ) { ifelseAsync( predicate, 'beep', 'boop', done ); function predicate( clbk ) { setTimeout( onTimeout, 0 ); function onTimeout() { clbk( null, false ); } } function done( error, result ) { if ( error ) { t.fail( error.message ); } else { t.strictEqual( result, 'boop', 'returns expected value' ); } t.end(); } }); tape( 'if a predicate function returns an error, the function returns the error', function test( t ) { ifelseAsync( predicate, 'beep', 'boop', done ); function predicate( clbk ) { setTimeout( onTimeout, 0 ); function onTimeout() { clbk( new Error( 'beep' ) ); } } function done( error ) { if ( error ) { t.pass( error.message ); } else { t.fail( 'should return an error' ); } t.end(); } }); tape( 'the function does not guarantee asynchronous execution', function test( t ) { var i = 0; ifelseAsync( predicate, 'beep', 'boop', done ); i = 1; function predicate( clbk ) { clbk( null, true ); } function done( error, result ) { if ( error ) { t.fail( error.message ); } else { t.strictEqual( result, 'beep', 'returns expected value' ); } t.strictEqual( i, 0, 'releases the zalgo' ); t.end(); } }); ```
This is a list of cases reported in volume 54 (13 How.) of United States Reports, decided by the Supreme Court of the United States in 1852. Nominative reports In 1874, the U.S. government created the United States Reports, and retroactively numbered older privately published case reports as part of the new series. As a result, cases appearing in volumes 1–90 of U.S. Reports have dual citation forms; one for the volume number of U.S. Reports, and one for the volume number of the reports named for the relevant reporter of decisions (these are called "nominative reports"). Benjamin Chew Howard Starting with the 42nd volume of U.S. Reports, the Reporter of Decisions of the Supreme Court of the United States was Benjamin Chew Howard. Howard was Reporter of Decisions from 1843 to 1860, covering volumes 42 through 65 of United States Reports which correspond to volumes 1 through 24 of his Howard's Reports. As such, the dual form of citation to, for example, Mitchell v. Harmony is 54 U.S. (13 How.) 115 (1852). Justices of the Supreme Court at the time of 54 U.S. (13 How.) The Supreme Court is established by Article III, Section 1 of the Constitution of the United States, which says: "The judicial Power of the United States, shall be vested in one supreme Court . . .". The size of the Court is not specified; the Constitution leaves it to Congress to set the number of justices. Under the Judiciary Act of 1789 Congress originally fixed the number of justices at six (one chief justice and five associate justices). Since 1789 Congress has varied the size of the Court from six to seven, nine, ten, and back to nine justices (always including one chief justice). When the cases in 54 U.S. (13 How.) were decided the Court comprised these nine members: Citation style Under the Judiciary Act of 1789 the federal court structure at the time comprised District Courts, which had general trial jurisdiction; Circuit Courts, which had mixed trial and appellate (from the US District Courts) jurisdiction; and the United States Supreme Court, which had appellate jurisdiction over the federal District and Circuit courts—and for certain issues over state courts. The Supreme Court also had limited original jurisdiction (i.e., in which cases could be filed directly with the Supreme Court without first having been heard by a lower federal or state court). There were one or more federal District Courts and/or Circuit Courts in each state, territory, or other geographical region. Bluebook citation style is used for case names, citations, and jurisdictions. "C.C.D." = United States Circuit Court for the District of . . . e.g.,"C.C.D.N.J." = United States Circuit Court for the District of New Jersey "D." = United States District Court for the District of . . . e.g.,"D. Mass." = United States District Court for the District of Massachusetts "E." = Eastern; "M." = Middle; "N." = Northern; "S." = Southern; "W." = Western e.g.,"C.C.S.D.N.Y." = United States Circuit Court for the Southern District of New York e.g.,"M.D. Ala." = United States District Court for the Middle District of Alabama "Ct. Cl." = United States Court of Claims The abbreviation of a state's name alone indicates the highest appellate court in that state's judiciary at the time. e.g.,"Pa." = Supreme Court of Pennsylvania e.g.,"Me." = Supreme Judicial Court of Maine List of cases in 54 U.S. (13 How.) Notes and references See also certificate of division External links Case reports in volume 54 (13 How.) from Library of Congress Case reports in volume 54 (13 How.) from Court Listener Case reports in volume 54 (13 How.) from the Caselaw Access Project of Harvard Law School Case reports in volume 54 (13 How.) from Google Scholar Case reports in volume 54 (13 How.) from Justia Case reports in volume 54 (13 How.) from Open Jurist Website of the United States Supreme Court United States Courts website about the Supreme Court National Archives, Records of the Supreme Court of the United States American Bar Association, How Does the Supreme Court Work? The Supreme Court Historical Society 1852 in United States case law
Dirt Track Racing is a video game by the now defunct developer Ratbag Games. It is the first game in the series, which includes Dirt Track Racing, Dirt Track Racing: Sprint Cars, and Dirt Track Racing 2. Reception The game received "average" reviews according to the review aggregation website GameRankings. GameSpot said, "Even with all of Dirt Track Racing'''s finer points, it's hard to overlook its repetitive tracks and racing events." IGN was positive, saying, "Ratbag proves once again that they are the Kings of racing sims, even the bargain brand." The game won Computer Games Strategy Plus'' 1999 "Racing Game of the Year" award. The editors wrote, "It humbles more expensive products with over 30 tracks and dozens of cars, excellent physics ... and plenty of tuning options." References External links Ratbag Games Last version of Ratbag Games official website reproduced by Australian video game website Sumea for archives purposes. 1999 video games Racing video games Racing video games set in the United States Video games developed in Australia Windows games Windows-only games Multiplayer and single-player video games WizardWorks games Ratbag Games games
```objective-c // Protocol Buffers - Google's data interchange format // path_to_url // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Author: kenton@google.com (Kenton Varda) // atenasio@google.com (Chris Atenasio) (ZigZag transform) // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. // // This header is logically internal, but is made public because it is used // from protocol-compiler-generated code, which may reside in other components. #ifndef GOOGLE_PROTOBUF_WIRE_FORMAT_H__ #define GOOGLE_PROTOBUF_WIRE_FORMAT_H__ #include <string> #include <google/protobuf/stubs/common.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/message.h> #include <google/protobuf/wire_format_lite.h> namespace google { namespace protobuf { namespace io { class CodedInputStream; // coded_stream.h class CodedOutputStream; // coded_stream.h } class UnknownFieldSet; // unknown_field_set.h } namespace protobuf { namespace internal { // This class is for internal use by the protocol buffer library and by // protocol-complier-generated message classes. It must not be called // directly by clients. // // This class contains code for implementing the binary protocol buffer // wire format via reflection. The WireFormatLite class implements the // non-reflection based routines. // // This class is really a namespace that contains only static methods class LIBPROTOBUF_EXPORT WireFormat { public: // Given a field return its WireType static inline WireFormatLite::WireType WireTypeForField( const FieldDescriptor* field); // Given a FieldDescriptor::Type return its WireType static inline WireFormatLite::WireType WireTypeForFieldType( FieldDescriptor::Type type); // Compute the byte size of a tag. For groups, this includes both the start // and end tags. static inline size_t TagSize(int field_number, FieldDescriptor::Type type); // These procedures can be used to implement the methods of Message which // handle parsing and serialization of the protocol buffer wire format // using only the Reflection interface. When you ask the protocol // compiler to optimize for code size rather than speed, it will implement // those methods in terms of these procedures. Of course, these are much // slower than the specialized implementations which the protocol compiler // generates when told to optimize for speed. // Read a message in protocol buffer wire format. // // This procedure reads either to the end of the input stream or through // a WIRETYPE_END_GROUP tag ending the message, whichever comes first. // It returns false if the input is invalid. // // Required fields are NOT checked by this method. You must call // IsInitialized() on the resulting message yourself. static bool ParseAndMergePartial(io::CodedInputStream* input, Message* message); // Serialize a message in protocol buffer wire format. // // Any embedded messages within the message must have their correct sizes // cached. However, the top-level message need not; its size is passed as // a parameter to this procedure. // // These return false iff the underlying stream returns a write error. static void SerializeWithCachedSizes( const Message& message, int size, io::CodedOutputStream* output); // Implements Message::ByteSize() via reflection. WARNING: The result // of this method is *not* cached anywhere. However, all embedded messages // will have their ByteSize() methods called, so their sizes will be cached. // Therefore, calling this method is sufficient to allow you to call // WireFormat::SerializeWithCachedSizes() on the same object. static size_t ByteSize(const Message& message); // your_sha256_hash- // Helpers for dealing with unknown fields // Skips a field value of the given WireType. The input should start // positioned immediately after the tag. If unknown_fields is non-NULL, // the contents of the field will be added to it. static bool SkipField(io::CodedInputStream* input, uint32 tag, UnknownFieldSet* unknown_fields); // Reads and ignores a message from the input. If unknown_fields is non-NULL, // the contents will be added to it. static bool SkipMessage(io::CodedInputStream* input, UnknownFieldSet* unknown_fields); // Read a packed enum field. If the is_valid function is not NULL, values for // which is_valid(value) returns false are appended to unknown_fields_stream. static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input, uint32 field_number, bool (*is_valid)(int), UnknownFieldSet* unknown_fields, RepeatedField<int>* values); // Write the contents of an UnknownFieldSet to the output. static void SerializeUnknownFields(const UnknownFieldSet& unknown_fields, io::CodedOutputStream* output); // Same as above, except writing directly to the provided buffer. // Requires that the buffer have sufficient capacity for // ComputeUnknownFieldsSize(unknown_fields). // // Returns a pointer past the last written byte. static uint8* SerializeUnknownFieldsToArray( const UnknownFieldSet& unknown_fields, uint8* target); // Same thing except for messages that have the message_set_wire_format // option. static void SerializeUnknownMessageSetItems( const UnknownFieldSet& unknown_fields, io::CodedOutputStream* output); // Same as above, except writing directly to the provided buffer. // Requires that the buffer have sufficient capacity for // ComputeUnknownMessageSetItemsSize(unknown_fields). // // Returns a pointer past the last written byte. static uint8* SerializeUnknownMessageSetItemsToArray( const UnknownFieldSet& unknown_fields, uint8* target); // Compute the size of the UnknownFieldSet on the wire. static size_t ComputeUnknownFieldsSize(const UnknownFieldSet& unknown_fields); // Same thing except for messages that have the message_set_wire_format // option. static size_t ComputeUnknownMessageSetItemsSize( const UnknownFieldSet& unknown_fields); // Helper functions for encoding and decoding tags. (Inlined below and in // _inl.h) // // This is different from MakeTag(field->number(), field->type()) in the case // of packed repeated fields. static uint32 MakeTag(const FieldDescriptor* field); // Parse a single field. The input should start out positioned immediately // after the tag. static bool ParseAndMergeField( uint32 tag, const FieldDescriptor* field, // May be NULL for unknown Message* message, io::CodedInputStream* input); // Serialize a single field. static void SerializeFieldWithCachedSizes( const FieldDescriptor* field, // Cannot be NULL const Message& message, io::CodedOutputStream* output); // Compute size of a single field. If the field is a message type, this // will call ByteSize() for the embedded message, insuring that it caches // its size. static size_t FieldByteSize( const FieldDescriptor* field, // Cannot be NULL const Message& message); // Parse/serialize a MessageSet::Item group. Used with messages that use // opion message_set_wire_format = true. static bool ParseAndMergeMessageSetItem( io::CodedInputStream* input, Message* message); static void SerializeMessageSetItemWithCachedSizes( const FieldDescriptor* field, const Message& message, io::CodedOutputStream* output); static size_t MessageSetItemByteSize( const FieldDescriptor* field, const Message& message); // Computes the byte size of a field, excluding tags. For packed fields, it // only includes the size of the raw data, and not the size of the total // length, but for other length-delimited types, the size of the length is // included. static size_t FieldDataOnlyByteSize( const FieldDescriptor* field, // Cannot be NULL const Message& message); enum Operation { PARSE = 0, SERIALIZE = 1, }; // Verifies that a string field is valid UTF8, logging an error if not. // This function will not be called by newly generated protobuf code // but remains present to support existing code. static void VerifyUTF8String(const char* data, int size, Operation op); // The NamedField variant takes a field name in order to produce an // informative error message if verification fails. static void VerifyUTF8StringNamedField(const char* data, int size, Operation op, const char* field_name); private: // Skip a MessageSet field. static bool SkipMessageSetField(io::CodedInputStream* input, uint32 field_number, UnknownFieldSet* unknown_fields); // Parse a MessageSet field. static bool ParseAndMergeMessageSetField(uint32 field_number, const FieldDescriptor* field, Message* message, io::CodedInputStream* input); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(WireFormat); }; // Subclass of FieldSkipper which saves skipped fields to an UnknownFieldSet. class LIBPROTOBUF_EXPORT UnknownFieldSetFieldSkipper : public FieldSkipper { public: UnknownFieldSetFieldSkipper(UnknownFieldSet* unknown_fields) : unknown_fields_(unknown_fields) {} virtual ~UnknownFieldSetFieldSkipper() {} // implements FieldSkipper ----------------------------------------- virtual bool SkipField(io::CodedInputStream* input, uint32 tag); virtual bool SkipMessage(io::CodedInputStream* input); virtual void SkipUnknownEnum(int field_number, int value); protected: UnknownFieldSet* unknown_fields_; }; // inline methods ==================================================== inline WireFormatLite::WireType WireFormat::WireTypeForField( const FieldDescriptor* field) { if (field->is_packed()) { return WireFormatLite::WIRETYPE_LENGTH_DELIMITED; } else { return WireTypeForFieldType(field->type()); } } inline WireFormatLite::WireType WireFormat::WireTypeForFieldType( FieldDescriptor::Type type) { // Some compilers don't like enum -> enum casts, so we implicit_cast to // int first. return WireFormatLite::WireTypeForFieldType( static_cast<WireFormatLite::FieldType>( implicit_cast<int>(type))); } inline uint32 WireFormat::MakeTag(const FieldDescriptor* field) { return WireFormatLite::MakeTag(field->number(), WireTypeForField(field)); } inline size_t WireFormat::TagSize(int field_number, FieldDescriptor::Type type) { // Some compilers don't like enum -> enum casts, so we implicit_cast to // int first. return WireFormatLite::TagSize(field_number, static_cast<WireFormatLite::FieldType>( implicit_cast<int>(type))); } inline void WireFormat::VerifyUTF8String(const char* data, int size, WireFormat::Operation op) { #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED WireFormatLite::VerifyUtf8String( data, size, static_cast<WireFormatLite::Operation>(op), NULL); #else // Avoid the compiler warning about unused variables. (void)data; (void)size; (void)op; #endif } inline void WireFormat::VerifyUTF8StringNamedField( const char* data, int size, WireFormat::Operation op, const char* field_name) { #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED WireFormatLite::VerifyUtf8String( data, size, static_cast<WireFormatLite::Operation>(op), field_name); #else // Avoid the compiler warning about unused variables. (void)data; (void)size; (void)op; (void)field_name; #endif } } // namespace internal } // namespace protobuf } // namespace google #endif // GOOGLE_PROTOBUF_WIRE_FORMAT_H__ ```
```swift // // Emitter.swift // Yams // // Created by Norio Nomura on 12/28/16. // #if SWIFT_PACKAGE @_implementationOnly import CYaml #endif import Foundation /// Produce a YAML string from objects. /// /// - parameter objects: Sequence of Objects. /// - parameter canonical: Output should be the "canonical" format as in the YAML specification. /// - parameter indent: The indentation increment. /// - parameter width: The preferred line width. @c -1 means unlimited. /// - parameter allowUnicode: Unescaped non-ASCII characters are allowed if true. /// - parameter lineBreak: Preferred line break. /// - parameter explicitStart: Explicit document start `---`. /// - parameter explicitEnd: Explicit document end `...`. /// - parameter version: YAML version directive. /// - parameter sortKeys: Whether or not to sort Mapping keys in lexicographic order. /// - parameter sequenceStyle: The style for sequences (arrays / lists) /// - parameter mappingStyle: The style for mappings (dictionaries) /// /// - returns: YAML string. /// /// - throws: `YamlError`. public func dump<Objects>( objects: Objects, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) throws -> String where Objects: Sequence { func representable(from object: Any) throws -> NodeRepresentable { if let representable = object as? NodeRepresentable { return representable } throw YamlError.emitter(problem: "\(object) does not conform to NodeRepresentable!") } let nodes = try objects.map(representable(from:)).map { try $0.represented() } return try serialize( nodes: nodes, canonical: canonical, indent: indent, width: width, allowUnicode: allowUnicode, lineBreak: lineBreak, explicitStart: explicitStart, explicitEnd: explicitEnd, version: version, sortKeys: sortKeys, sequenceStyle: sequenceStyle, mappingStyle: mappingStyle, newLineScalarStyle: newLineScalarStyle ) } /// Produce a YAML string from an object. /// /// - parameter object: Object. /// - parameter canonical: Output should be the "canonical" format as in the YAML specification. /// - parameter indent: The indentation increment. /// - parameter width: The preferred line width. @c -1 means unlimited. /// - parameter allowUnicode: Unescaped non-ASCII characters are allowed if true. /// - parameter lineBreak: Preferred line break. /// - parameter explicitStart: Explicit document start `---`. /// - parameter explicitEnd: Explicit document end `...`. /// - parameter version: YAML version directive. /// - parameter sortKeys: Whether or not to sort Mapping keys in lexicographic order. /// - parameter sequenceStyle: The style for sequences (arrays / lists) /// - parameter mappingStyle: The style for mappings (dictionaries) /// /// - returns: YAML string. /// /// - throws: `YamlError`. public func dump( object: Any?, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) throws -> String { return try serialize( node: object.represented(), canonical: canonical, indent: indent, width: width, allowUnicode: allowUnicode, lineBreak: lineBreak, explicitStart: explicitStart, explicitEnd: explicitEnd, version: version, sortKeys: sortKeys, sequenceStyle: sequenceStyle, mappingStyle: mappingStyle, newLineScalarStyle: newLineScalarStyle ) } /// Produce a YAML string from a `Node`. /// /// - parameter nodes: Sequence of `Node`s. /// - parameter canonical: Output should be the "canonical" format as in the YAML specification. /// - parameter indent: The indentation increment. /// - parameter width: The preferred line width. @c -1 means unlimited. /// - parameter allowUnicode: Unescaped non-ASCII characters are allowed if true. /// - parameter lineBreak: Preferred line break. /// - parameter explicitStart: Explicit document start `---`. /// - parameter explicitEnd: Explicit document end `...`. /// - parameter version: YAML version directive. /// - parameter sortKeys: Whether or not to sort Mapping keys in lexicographic order. /// - parameter sequenceStyle: The style for sequences (arrays / lists) /// - parameter mappingStyle: The style for mappings (dictionaries) /// /// - returns: YAML string. /// /// - throws: `YamlError`. public func serialize<Nodes>( nodes: Nodes, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) throws -> String where Nodes: Sequence, Nodes.Iterator.Element == Node { let emitter = Emitter( canonical: canonical, indent: indent, width: width, allowUnicode: allowUnicode, lineBreak: lineBreak, explicitStart: explicitStart, explicitEnd: explicitEnd, version: version, sortKeys: sortKeys, sequenceStyle: sequenceStyle, mappingStyle: mappingStyle, newLineScalarStyle: newLineScalarStyle ) try emitter.open() try nodes.forEach(emitter.serialize) try emitter.close() return String(data: emitter.data, encoding: .utf8)! } /// Produce a YAML string from a `Node`. /// /// - parameter node: `Node`. /// - parameter canonical: Output should be the "canonical" format as in the YAML specification. /// - parameter indent: The indentation increment. /// - parameter width: The preferred line width. @c -1 means unlimited. /// - parameter allowUnicode: Unescaped non-ASCII characters are allowed if true. /// - parameter lineBreak: Preferred line break. /// - parameter explicitStart: Explicit document start `---`. /// - parameter explicitEnd: Explicit document end `...`. /// - parameter version: YAML version directive. /// - parameter sortKeys: Whether or not to sort Mapping keys in lexicographic order. /// - parameter sequenceStyle: The style for sequences (arrays / lists) /// - parameter mappingStyle: The style for mappings (dictionaries) /// /// - returns: YAML string. /// /// - throws: `YamlError`. public func serialize( node: Node, canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) throws -> String { return try serialize( nodes: [node], canonical: canonical, indent: indent, width: width, allowUnicode: allowUnicode, lineBreak: lineBreak, explicitStart: explicitStart, explicitEnd: explicitEnd, version: version, sortKeys: sortKeys, sequenceStyle: sequenceStyle, mappingStyle: mappingStyle, newLineScalarStyle: newLineScalarStyle ) } /// Class responsible for emitting libYAML events. public final class Emitter { /// Line break options to use when emitting YAML. public enum LineBreak { /// Use CR for line breaks (Mac style). case cr /// Use LN for line breaks (Unix style). case ln /// Use CR LN for line breaks (DOS style). case crln } /// Retrieve this Emitter's binary output. public internal(set) var data = Data() /// Configuration options to use when emitting YAML. public struct Options { /// Set if the output should be in the "canonical" format described in the YAML specification. public var canonical: Bool = false /// Set the indentation value. public var indent: Int = 0 /// Set the preferred line width. -1 means unlimited. public var width: Int = 0 /// Set if unescaped non-ASCII characters are allowed. public var allowUnicode: Bool = false /// Set the preferred line break. public var lineBreak: LineBreak = .ln // internal since we don't know if these should be exposed. var explicitStart: Bool = false var explicitEnd: Bool = false /// The `%YAML` directive value or nil. public var version: (major: Int, minor: Int)? /// Set if emitter should sort keys in lexicographic order. public var sortKeys: Bool = false /// Set the style for sequences (arrays / lists) public var sequenceStyle: Node.Sequence.Style = .any /// Set the style for mappings (dictionaries) public var mappingStyle: Node.Mapping.Style = .any /// Set the style for scalars that include newlines public var newLineScalarStyle: Node.Scalar.Style = .any } /// Configuration options to use when emitting YAML. public var options: Options { didSet { applyOptionsToEmitter() } } /// Create an `Emitter` with the specified options. /// /// - parameter canonical: Set if the output should be in the "canonical" format described in the YAML /// specification. /// - parameter indent: Set the indentation value. /// - parameter width: Set the preferred line width. -1 means unlimited. /// - parameter allowUnicode: Set if unescaped non-ASCII characters are allowed. /// - parameter lineBreak: Set the preferred line break. /// - parameter explicitStart: Explicit document start `---`. /// - parameter explicitEnd: Explicit document end `...`. /// - parameter version: The `%YAML` directive value or nil. /// - parameter sortKeys: Set if emitter should sort keys in lexicographic order. /// - parameter sequenceStyle: Set the style for sequences (arrays / lists) /// - parameter mappingStyle: Set the style for mappings (dictionaries) public init(canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: LineBreak = .ln, explicitStart: Bool = false, explicitEnd: Bool = false, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) { options = Options(canonical: canonical, indent: indent, width: width, allowUnicode: allowUnicode, lineBreak: lineBreak, explicitStart: explicitStart, explicitEnd: explicitEnd, version: version, sortKeys: sortKeys, sequenceStyle: sequenceStyle, mappingStyle: mappingStyle, newLineScalarStyle: newLineScalarStyle) // configure emitter yaml_emitter_initialize(&emitter) yaml_emitter_set_output(&self.emitter, { pointer, buffer, size in guard let buffer = buffer else { return 0 } let emitter = unsafeBitCast(pointer, to: Emitter.self) emitter.data.append(buffer, count: size) return 1 }, unsafeBitCast(self, to: UnsafeMutableRawPointer.self)) applyOptionsToEmitter() yaml_emitter_set_encoding(&emitter, YAML_UTF8_ENCODING) } deinit { yaml_emitter_delete(&emitter) } /// Open & initialize the emitter. /// /// - throws: `YamlError` if the `Emitter` was already opened or closed. public func open() throws { switch state { case .initialized: var event = yaml_event_t() yaml_stream_start_event_initialize(&event, YAML_UTF8_ENCODING) try emit(&event) state = .opened case .opened: throw YamlError.emitter(problem: "serializer is already opened") case .closed: throw YamlError.emitter(problem: "serializer is closed") } } /// Close the `Emitter.` /// /// - throws: `YamlError` if the `Emitter` hasn't yet been initialized. public func close() throws { switch state { case .initialized: throw YamlError.emitter(problem: "serializer is not opened") case .opened: var event = yaml_event_t() yaml_stream_end_event_initialize(&event) try emit(&event) state = .closed case .closed: break // do nothing } } /// Ingest a `Node` to include when emitting the YAML output. /// /// - parameter node: The `Node` to serialize. /// /// - throws: `YamlError` if the `Emitter` hasn't yet been opened or has been closed. public func serialize(node: Node) throws { switch state { case .initialized: throw YamlError.emitter(problem: "serializer is not opened") case .opened: break case .closed: throw YamlError.emitter(problem: "serializer is closed") } var event = yaml_event_t() if let (major, minor) = options.version { var versionDirective = yaml_version_directive_t(major: Int32(major), minor: Int32(minor)) // TODO: Support tags yaml_document_start_event_initialize(&event, &versionDirective, nil, nil, options.explicitStart ? 0 : 1) } else { // TODO: Support tags yaml_document_start_event_initialize(&event, nil, nil, nil, options.explicitStart ? 0 : 1) } try emit(&event) try serializeNode(node) yaml_document_end_event_initialize(&event, options.explicitEnd ? 0 : 1) try emit(&event) } // MARK: Private private var emitter = yaml_emitter_t() private enum State { case initialized, opened, closed } private var state: State = .initialized private func applyOptionsToEmitter() { yaml_emitter_set_canonical(&emitter, options.canonical ? 1 : 0) yaml_emitter_set_indent(&emitter, Int32(options.indent)) yaml_emitter_set_width(&emitter, Int32(options.width)) yaml_emitter_set_unicode(&emitter, options.allowUnicode ? 1 : 0) switch options.lineBreak { case .cr: yaml_emitter_set_break(&emitter, YAML_CR_BREAK) case .ln: yaml_emitter_set_break(&emitter, YAML_LN_BREAK) case .crln: yaml_emitter_set_break(&emitter, YAML_CRLN_BREAK) } } } // MARK: - Options Initializer extension Emitter.Options { /// Create `Emitter.Options` with the specified values. /// /// - parameter canonical: Set if the output should be in the "canonical" format described in the YAML /// specification. /// - parameter indent: Set the indentation value. /// - parameter width: Set the preferred line width. -1 means unlimited. /// - parameter allowUnicode: Set if unescaped non-ASCII characters are allowed. /// - parameter lineBreak: Set the preferred line break. /// - parameter explicitStart: Explicit document start `---`. /// - parameter explicitEnd: Explicit document end `...`. /// - parameter version: The `%YAML` directive value or nil. /// - parameter sortKeys: Set if emitter should sort keys in lexicographic order. /// - parameter sequenceStyle: Set the style for sequences (arrays / lists) /// - parameter mappingStyle: Set the style for mappings (dictionaries) public init(canonical: Bool = false, indent: Int = 0, width: Int = 0, allowUnicode: Bool = false, lineBreak: Emitter.LineBreak = .ln, version: (major: Int, minor: Int)? = nil, sortKeys: Bool = false, sequenceStyle: Node.Sequence.Style = .any, mappingStyle: Node.Mapping.Style = .any, newLineScalarStyle: Node.Scalar.Style = .any) { self.canonical = canonical self.indent = indent self.width = width self.allowUnicode = allowUnicode self.lineBreak = lineBreak self.version = version self.sortKeys = sortKeys self.sequenceStyle = sequenceStyle self.mappingStyle = mappingStyle self.newLineScalarStyle = newLineScalarStyle } } // MARK: Implementation Details extension Emitter { private func emit(_ event: UnsafeMutablePointer<yaml_event_t>) throws { guard yaml_emitter_emit(&emitter, event) == 1 else { throw YamlError(from: emitter) } } private func serializeNode(_ node: Node) throws { switch node { case .scalar(let scalar): try serializeScalar(scalar) case .sequence(let sequence): try serializeSequence(sequence) case .mapping(let mapping): try serializeMapping(mapping) } } private func serializeScalar(_ scalar: Node.Scalar) throws { var value = scalar.string.utf8CString, tag = scalar.resolvedTag.name.rawValue.utf8CString let scalarStyle = yaml_scalar_style_t(rawValue: numericCast(scalar.style.rawValue)) var event = yaml_event_t() _ = value.withUnsafeMutableBytes { value in tag.withUnsafeMutableBytes { tag in yaml_scalar_event_initialize( &event, nil, tag.baseAddress?.assumingMemoryBound(to: UInt8.self), value.baseAddress?.assumingMemoryBound(to: UInt8.self), Int32(value.count - 1), 1, 1, scalarStyle) } } try emit(&event) } private func serializeSequence(_ sequence: Node.Sequence) throws { var tag = sequence.resolvedTag.name.rawValue.utf8CString let implicit: Int32 = sequence.tag.name == .seq ? 1 : 0 let sequenceStyle = yaml_sequence_style_t(rawValue: numericCast(sequence.style.rawValue)) var event = yaml_event_t() _ = tag.withUnsafeMutableBytes { tag in yaml_sequence_start_event_initialize( &event, nil, tag.baseAddress?.assumingMemoryBound(to: UInt8.self), implicit, sequenceStyle) } try emit(&event) try sequence.forEach(self.serializeNode) yaml_sequence_end_event_initialize(&event) try emit(&event) } private func serializeMapping(_ mapping: Node.Mapping) throws { var tag = mapping.resolvedTag.name.rawValue.utf8CString let implicit: Int32 = mapping.tag.name == .map ? 1 : 0 let mappingStyle = yaml_mapping_style_t(rawValue: numericCast(mapping.style.rawValue)) var event = yaml_event_t() _ = tag.withUnsafeMutableBytes { tag in yaml_mapping_start_event_initialize( &event, nil, tag.baseAddress?.assumingMemoryBound(to: UInt8.self), implicit, mappingStyle) } try emit(&event) if options.sortKeys { try mapping.keys.sorted().forEach { try self.serializeNode($0) try self.serializeNode(mapping[$0]!) // swiftlint:disable:this force_unwrapping } } else { try mapping.forEach { try self.serializeNode($0.key) try self.serializeNode($0.value) } } yaml_mapping_end_event_initialize(&event) try emit(&event) } } // swiftlint:disable:this file_length ```
The Whistleblower Protection Act of 1989, 5 U.S.C. 2302(b)(8)-(9), Pub.L. 101-12 as amended, is a United States federal law that protects federal whistleblowers who work for the government and report the possible existence of an activity constituting a violation of law, rules, or regulations, or mismanagement, gross waste of funds, abuse of authority or a substantial and specific danger to public health and safety. A federal agency violates the Whistleblower Protection Act if agency authorities take (or threaten to take) retaliatory personnel action against any employee or applicant because of disclosure of information by that employee or applicant. Authorized federal agencies The Office of Special Counsel investigates federal whistleblower complaints. In October 2008, then-special counsel Scott Bloch resigned amid an FBI investigation into whether he obstructed justice by illegally deleting computer files following complaints that he had retaliated against employees who disagreed with his policies. Then-Senator Barack Obama made a campaign vow to appoint a special counsel committed to whistleblower rights. It was not until April 2011 that President Obama's appointee Carolyn Lerner was confirmed by the Senate. Today, the primary mission of OSC is to safeguard the merit system by protecting federal employees and applicants from prohibited personnel practices, especially reprisal for whistleblowing. The Merit Systems Protection Board, a quasi-judicial agency that adjudicates whistleblower complaints, uses appointed administrative law judges who often back the government. Since 2000, the board has ruled for whistleblowers just three times in 56 cases decided on their merits, according to a Government Accountability Project analysis. Obama appointed a new chairperson and vice chairperson with backgrounds as federal worker advocates, but Tom Devine of GAP says, "It's likely to take years for them to turn things around." Currently, this office works to protect the Merit System Principles and promote an effective Federal workforce free of Prohibited Personnel Practices. The Court of Appeals for the Federal Circuit was established under Article III of the Constitution on October 1, 1982. It is the only court empowered to hear appeals of whistleblower cases decided by the merit board. The Federal Circuit has been criticized by Senator Grassley (R-Iowa) and others in Congress for misinterpreting whistleblower laws and setting a precedent that is hostile to claimants. Between 1994 and 2010, the court had ruled for whistleblowers in only three of 203 cases decided on their merits, GAP's analysis found. Legal cases The U.S. Supreme Court, in the case of Garcetti v. Ceballos, 04-473, ruled in 2006 that government employees do not have protection from retaliation by their employers under the First Amendment of the Constitution when they speak pursuant to their official job duties. The U.S. Merit Systems Protection Board (MSPB) uses agency lawyers in the place of administrative law judges to decide federal employees' whistleblower appeals. These lawyers, dubbed "attorney examiners," deny 98% of whistleblower appeals; the Board and the Federal Circuit Court of Appeals give great deference to their initial decisions, resulting in affirmance rates of 97% and 98%, respectively. The most common characteristics for a court claim that are encompassed within the protection of the Act include: that the plaintiff is an employee or person covered under the specific statutory or common law relied upon for action, that the defendant is an employer or person covered under the specific statutory or common law relied upon for the action, that the plaintiff engaged in protected whistleblower activity, that the defendant knew or had knowledge that the plaintiff engaged in such activity, that there was retaliatory action taken against the one doing the whistleblowing and that the unfair treatment would not have occurred if the plaintiff hadn't brought to attention the activities. Robert MacLean blew the whistle on the fact that the TSA had cut its funding for more air marshals. In 2009 MacLean, represented by the Government Accountability Project, challenged his dismissal at the Merit Systems Protection Board, on the grounds that "his disclosure of the text message was protected under the Whistleblower Protection Act of 1989, because he 'reasonably believe[d]' that the leaked information disclosed 'a substantial and specific danger to public health or safety'." MacLean won the case in a ruling of 7–2 in the Supreme Court in January 2015. Whistleblower Protection Enhancement Act and Presidential Policy Directive 19 President Barack Obama issued Presidential Policy Directive 19 (PPD-19), entitled "Protecting Whistleblowers with Access to Classified Information". According to the directive signed by Obama on October 10, 2012, it is written that "this Presidential Policy Directive ensures that employees (1) serving in the Intelligence Community or (2) who are eligible for access to classified information can effectively report waste, fraud, and abuse while protecting classified national security information. It prohibits retaliation against employees for reporting waste, fraud, and abuse. However, according to a report that the Committee on Homeland Security and Governmental Affairs submitted to accompany S. 743, "the federal whistleblowers have seen their protections diminish in recent years, largely as a result of a series of decisions by the United States Court of Appeals for the Federal Circuit, which has exclusive jurisdiction over many cases brought under the Whistleblower Protection Act (WPA). Specifically, the Federal Circuit has accorded a narrow definition to the type of disclosure that qualifies for whistleblower protection. Additionally, the lack of remedies under current law for most whistleblowers in the intelligence community and for whistleblowers who face retaliation in the form of withdrawal of the employee's security clearance leaves unprotected those who are in a position to disclose wrongdoing that directly affects our national security." S. 743 would address these problems by restoring the original congressional intent of the WPA to adequately protect whistleblowers, by strengthening the WPA, and by creating new whistleblower protections for intelligence employees and new protections for employees whose security clearance is withdrawn in retaliation for having made legitimate whistleblower disclosures. Related legislation On July 14, 2014, the United States House of Representatives voted to pass the All Circuit Review Extension Act (H.R. 4197; 113th Congress), a bill that gives authority to federal employees who want to appeal their judgment to any federal court, and which allows whistleblowers to appeal to any U.S. Court of Appeals that has jurisdiction. The bill would extend from three years after the effective date of the Whistleblower Protection Enhancement Act of 2012 (i.e., December 27, 2012), the period allowed for: (1) filing a petition for judicial review of Merit Systems Protection Board decisions in whistleblower cases, and (2) any review of such a decision by the Director of the Office of Personnel Management (OPM). See also Whistleblower protection in United States False Claims Act Federal crime Immunity from prosecution Informant List of whistleblowers Military Whistleblower Protection Act Qui tam Testimony Turn state's evidence White collar crime Witness Witness intimidation United States Federal Witness Protection Program United States Marshals Service References External links "Whistleblower Protection Act Information." U.S. Securities and Exchange Commission. January 30, 2004. Retrieved May 3, 2007 "File a Complaint (OSC.Gov)." U.S. Office of Special Counsel. Retrieved January 13, 2020 1989 in American law 101st United States Congress United States federal criminal legislation Whistleblower protection legislation Whistleblowing in the United States United States federal labor legislation
On the morning of July 24, 1973, in Dallas, Texas, 30-year-old Dallas Police Officer Darrell Lee Cain murdered Santos Rodriguez, a 12-year-old Mexican-American child. Officer Cain and Officer Roy R. Arnold were investigating reports of a burglary at a Fina gas station when they took Santos Rodriguez and his 13-year-old brother David Rodriguez from their home for an impromptu interrogation over the burglary. Cain shot Santos Rodriguez while conducting Russian roulette on the brothers in an attempt to force a confession from them. Cain was found guilty of murder with malice, and was sentenced to the minimum five years in prison. He was released on September 11, 1979, after serving the minimum two-and-a-half-year sentence. Parties involved Santos Rodriguez Santos Rodriguez was born on November 7, 1960, and was the child of Bessie Garcia and David Rodriguez. He was reported to have been tall. At the time of his death, Santos and his brother lived with an adoptive grandfather, 84-year-old Carlos Minez, at 2921 N. Pearl St. in the Little Mexico neighborhood of Dallas. Their mother, Bessie, was serving a five-year sentence in the Goree women's unit of Huntsville State Prison. She had been convicted for the April 1971 killing of 62-year-old Leonard Brown, her boyfriend. Santos and his brother, David, were placed in the home of Minez, who had helped care for Bessie during her childhood, at their mother's request after her conviction. The three youngest Rodriguez siblings, Ruben, Robert, and Juanita, were placed in foster homes. Santos was a student at William B. Travis Elementary School at 3001 McKinney Ave. Santos and his brother, David, had previous run-ins with the law over shoplifting and truancy, and Santos was described by his teachers as naive and easily influenced, deep thinking, gentle and a fan of classical music. Teachers would also report to The Dallas Morning News that they "kept feeling all along that something was going to happen to those boys". Supervisors at the Pike Park Community Center where Santos played described him as someone who was willing to volunteer to help clean the park and community center. Santos played soccer at Pike Park, and friends described how he played as a starter and could kick a soccer ball halfway down a field. His mother reported that he enjoyed listening to the band Santana, and loved eating enchiladas and hotdogs. David Rodriguez David Rodriguez was Santos' older brother. He was also a student at William B. Travis Elementary at the time of Santos' death. David was in the police car with his brother when Santos was shot, and witnessed his death. David currently lives in Dallas, Texas. Darrell L. Cain Darrell Lee Cain, 30, was a five-year veteran of the Dallas Police Department, when he committed the murder of Santos. He was born in Benkelman, Nebraska, on March 31, 1943. He died on March 17, 2019. He was married in 1964, and had one son at the time of the murder. He served in the Army from 1962 to 1965, and was honorably discharged with the rank of Spec 4. Cain had been previously involved in the controversial death of 18-year-old Michael Morehead (also spelled Michael Moorhead) on April 20, 1970. At around 3:10 a.m. Cain and another officer, Jeffery L. Kirksey, were investigating a silent burglar alarm that had been set off at the Empire Bar & Grill at 3307 Munger Ave. They found Morehead and a relative burgling the restaurant. Morehead and his 26-year-old relative fled the scene, but Morehead was shot three times as he fled, leading to his death. In total, Cain had fired five shots and Kirksey fired eight. Morehead's grandmother produced recorded statements from witnesses claiming that Morehead had been shot while he was on the ground, and that he had begged the officers not to shoot him. While witnesses to the shooting later changed their statements following questioning by the FBI, investigations of the shooting revealed that the officers had shot into the grassy field where Morehead lay. No charges were ever brought against Cain or Kirksey, but they were moved to another patrol area in part due to public pressure and protests. Michael Morehead was the son of George Morehead and Carrie Young. He lived at 2123 Johnson Place, and was buried in Glen Oak Memorial Cemetery in Dallas. Later that year, Cain shot and wounded a man in a Dallas city park. Roy R. Arnold Roy Arnold, 23, was a three-year veteran of the Dallas Police Department at the time of Santos' death. His father was police sergeant Horace "Hap" Arnold. Arnold was not charged in the Santos Rodriguez murder case. On August 3, 1973, he was dismissed from the Dallas Police force for failure to file a full report of the night of the shooting. A resident of the neighborhood where the murder occurred reported to the Dallas Police on August 2, 1973, that they had heard a gunshot from the area before the shooting of Santos. Further investigation revealed that Cain and Arnold had witnessed two youths breaking and entering the Fina gas station and that Arnold had fired one shot towards the suspects in an attempt to warn them from fleeing. The suspects escaped, and Arnold failed to report firing a warning shot. Questions arose during the murder investigation regarding whether or not Arnold had enough time to intervene in the Russian roulette interrogation held by Cain, or whether Arnold could have acted to prevent Santos' death. Background Santos Rodriguez lived in the Little Mexico neighborhood, a historically Mexican-American neighborhood that was built in part due to immigration patterns and segregation practices in Dallas. By the 1950s, Mexican-American and students of Hispanic and Latino origin could attend one of four segregated elementary schools: William B. Travis, Cumberland Hills, Benito Juarez, and City Park. Crozier Tech High School served as the segregated high school for the Mexican-American communities of Dallas. By 1970, Mexican Americans made up around 8% of the city's population, or around 40,000 people. While early Mexican-American organizations tried to assimilate into Anglo Dallas society, Mexican-American students still faced segregated schools that lacked resources compared to Anglo schools, as well as structural racism. The first Mexican-American City Council member, Anita Martinez, was elected in 1969, and at the time of the murder Pedro Aguirre served on the City Council. This time period was also marked by the rise of the Chicano movement, which had begun its development in the mid 1960s with the grape strikes of California and developed into a national Civil Rights movement. Murder Police records noted a burglary call on Tuesday, July 24, 1973, at 2:10 am at a Fina gas station located at 2301 Cedar Springs in Dallas. There are conflicting reports on how and when Cain and Arnold arrived at the scene of the burglary. An article from the Dallas Times Herald stated that Cain and Arnold reported to the Fina gas station after receiving information from police dispatch that there was a robbery in progress, and that the suspect(s) had fled by the time police arrived. In contrast, Arnold was dismissed from the Police force in August 1973 for failing to report firing a warning shot at a suspect fleeing the gas station, indicating that the officers arrived at the robbery and witnessed the suspects as they fled or that Arnold fired upon a civilian in the area. According to The Dallas Morning News, Arnold reported that he believed the suspects were David and Santos Rodriguez. Cain and Arnold went to the home where the Rodriguez brothers were living and took them into custody at around 2:30 am. There was no warrant issued, but the officers claimed they had received permission from their guardian, Carlos Minez. Minez reportedly spoke rudimentary English, and there is no record that either officer spoke Spanish. David and Santos were handcuffed and put into Arnold's police car without being given time to change their clothes or put on shoes, and were taken to the gas station for an impromptu interrogation. The vehicle was parked in a vacant lot behind the gas station with Arnold in the driver's seat, Cain in the seat behind Arnold, Santos in the passenger seat, and David seated behind him. Arnold questioned the boys about the burglary, but neither would confess to committing the crime. Much of the questioning was towards Santos. Cain later testified that after the boys denied criminal involvement he told Arnold that he would make the boys talk, and Cain took his .357 Magnum revolver and removed the bullets in a way that the removed bullets would make a noise as they hit together. Cain claimed he visually checked the cylinder and did not see any bullets left in his gun. Cain took his gun and aimed it at Santos, warning the boy to tell him the truth about the burglary. Santos refused to confess, and Cain pulled the trigger, clicking an empty chamber. Cain again threatened to shoot Santos if he did not confess, and according to later testimony by Cain, Santos' last words were "I am telling the truth." Cain pulled the trigger again at Santos, and this time the gun fired. The bullet struck below Santos' left ear, penetrating his brain and causing his death instantly. Cain and Arnold quickly exited the car, leaving David, who was still handcuffed and unable to exit the vehicle, alone with Santos' body. David told his brother “You are going to be all right” as blood began to seep onto David's feet. David would be left in the vehicle with his brother for around 10 minutes, still handcuffed. Dallas Police Officer Jerry Foster was also at the scene at the time of Santos' killing. Foster was on patrol when he responded to a police broadcast reporting the burglary at the gas station. He investigated the scene and found that a desk drawer was open in the station, a rear window was broken out, and a cigarette machine had been pried open. Foster witnessed the arrival of Cain, Arnold, and the Rodriguez brothers in Arnold's car. Foster reported that he yelled out to Arnold that he had received information that a third individual was suspected in the burglary. Foster approached Arnold's car and laid his arm on the car door when he heard the shooting of Santos. Foster saw Santos' head slump over and saw blood coming from Santos' head. Foster heard Cain scream before Cain quickly exited the vehicle and stated: "My God, My God, What have I done, I didn't mean to do it." Arnold also left the vehicle and vomited. Moments after Cain exited the vehicle, Foster took Cain's gun from him. Five live rounds and one empty cartridge were in the gun. Officer David Rowe, who was also on patrol that morning, responded to a radio call about a boy being accidentally shot. Rowe arrived at the scene minutes after hearing the radio call, and saw that both Rodriguez brothers were still handcuffed and in the police car, with Santos in the front seat "all bloody". Officer Rowe would later attend Santos' funeral. Santos' pulse was checked and an ambulance was called. Santos was pronounced dead on arrival at Parkland Hospital. Aftermath and responses Carlos Minez, Santos' and David's foster grandfather, was notified by Dallas Police of Santos' death by being asked to identify a body. Within hours of the shooting, Cain was suspended from the police force. Dallas Police Chief Frank Dyson filed charges of murder with malice against Cain the same morning of the shooting. A bond of $5,000.00 was set by Municipal Court Judge Frances Goodwin for Cain, and Cain was released Tuesday afternoon after his attorney Phil Burleson posted his bond. Chief Dyson expressed his disappointment at the bond price, and Judge Goodwin later refused to comment on her bond setting when pressed by the Mexican-American community. By July 26, two days after the shooting, the investigation of the Cedar Springs burglary proved that neither of the brother's fingerprints matched any at the scene of the crime. On Tuesday activist Rene Martinez helped organize a community meeting at Pike Park in order to coordinate a protest for Saturday, July 28. Speakers at the Pike Park meeting and attendees, who included leaders such as Pancho Medrano, spoke out against both the shooting and the low bail set for Cain. On Wednesday, July 25, a funeral announcement was listed for Santos in The Dallas Morning News. The announcement listed his surviving relatives and details of his funeral: the service would be held on Thursday, July 26, at 2:00 pm at the First Mexican Baptist Church, and would be officiated by Rev. Rudy Sanchez. Bessie Rodriguez arrived in Dallas on Wednesday on a three-day reprieve from her prison sentence to attend her son's funeral. On Wednesday night she attended a memorial service at Temple Emanu-El Methodist Church. District Attorney Henry Wade announced that same Wednesday that murder charges against Cain would be taken to the Dallas County grand jury once the Dallas Police completed their investigation. Wade met with Minez and Rev. Sanchez and explained the procedure and legal steps in a murder case to the men, and in turn Wade felt that the community wanted him and his top assistant Doug Mulder to handle the case as they had previously handled the kidnapping case of Amanda M. Dealey, the daughter-in-law of Dallas Morning News president Joe M. Dealey. Over 600 people attended Santos' funeral on Thursday. Attendees included Civil Rights leaders Rene Martinez and Al Lipscomb, who criticized the absence of Dallas Police Chief Frank Dyson. In his defense, Dyson claimed that he was told by Rev. Sanchez that police officers should not be in attendance, and contemporary accounts note that fellow officers expressed anger over the shooting of Santos. Santos lay in a silver casket. Rev. Rudy Sanchez led the service and noted that Minez had been a founder of the First Mexican-American Baptist Church, and that Santos and David had converted to Christianity a few months before Santos' death. Rev. Sanchez called for forgiveness and justice, and for the community to do more for children like the Rodriguez brothers. Six pallbearers, friends of Santos, carried Santos' casket to a hearse outside of the church. Around 200 mourners followed the funeral procession to Oakland Cemetery, where a short burial service was held. Santos' headstone lists his name, dates of birth and death, and the words "From his mother". Upon the recommendation of District Attorney Wade, Justice of the Peace Tom Naylor raised Cain's bond to $50,000.00 on Thursday, July 27, and issued a warrant for Cain's arrest. Judge Naylor reported to The Dallas Morning News that he felt the higher bond was more appropriate. On that same day District Attorney Wade and his assistant Doug Mulder presented murder charges against Cain to the grand jury. Several members of the Dallas Police Department were in the grand jury room during the proceedings, including Roy Arnold, the director of the Dallas Police internal affairs division R. O. Dixon, and Lt. T. L. Baker of the crimes against persons division. At this time DPD internal affairs was continuing their investigation of Arnold. Wade met with David and Bessie Rodriguez and two other women on the day of the grand jury hearing, and while he made no official commentary on that meeting, Wade did assure news outlets that affidavits had been presented to the grand jury. Cain surrendered himself at the Dallas County jail that same evening, at around 7:30 pm. During this time a City Council committee temporarily removed the bond-setting powers of municipal court judges in felony cases that involve city employees as a response to the original $5,000.00 bond set for Cain. The three member committee was headed by Mayor Pro Tem George Allen, and had been advised by City Attorney Alex Bickley that a bond was not a punishment for a defendant but rather was a means of ensuring their appearance in court. Nevertheless, the committee saw the low bond as concerning and too low for the seriousness of the case, with the exception of committee member City Councilman Russell Smith. Rev. Rudy Sanchez established a committee of Mexican-American leaders in response to the shooting, and the committee created a list of demands regarding Santos' killing and community concerns regarding mistreatment of minority groups by Dallas police. The committee had a closed meeting with Chief Dyson at the Dallas Public Library on July 26, and afterwards made their demands before a panel of city councilmen and city officials. Their demands included an investigation into why Cain was given a low bond, how and why Dallas Police gave confidential juvenile files to the media, and investigation into every stage of Santos' and David's arrest. Councilman Pedro Aguirre called for more information about Arnold's actions during the shooting, and Councilman Garry Weber assured the Mexican-American community that they had the full support of the City Council. A meeting between the Mexican-American committee and city officials was set for Saturday, July 28, at 9:00 am by city manager George Schrader. On Friday, July 27, Cain was indicted by the grand jury and charged that he "did voluntarily and with malice aforethought kill" Santos. The case was set to appear before District Judge Ed Gossett. By the time of the indictment, the Mercantile National Bank established a Santos Rodriguez fund in order to pay for funeral expenses and future expenses of the Rodriguez siblings, and representatives from the Southern Christian Leadership Conference (SCLC) and the Brown Berets held a joint meeting demanding that Arnold also be charged in the shooting. Attending the Saturday meeting with Chief Dyson and City Manager Schrader were Rev. Rudy Sanchez, Rene Martinez of the Tri-Ethnic committee, Dallas attorney Florentino Ramirez, West Dallas worker Pete Martinez, and members of the Brown Berets, representing the Mexican-American community. City Council members Pedro Aguirre, Garry Weber, Russell Smith, and Adlene Harrison represented the City of Dallas at the meeting. Chief Dyson acknowledged that there were Dallas Police officers who exhibited racial bias when performing their duties, biases he termed "dual standards", and promised to do whatever possible to eliminate them. He did not respond to questions regarding the case against Cain, citing concerns over jeopardizing future criminal proceedings against Cain. Dyson claimed that new policies were being enacted to address racial biases in police officers, including giving psychological tests to determine the attitudes of officers accused of racial discrimination. He also noted that while it was up to the officer's discretion to handcuff suspects, it was not within protocol to take suspects to the scene of a crime. He also reaffirmed that the police records of the Rodriguez brothers should not have been given out to the press. Schrader told the committee that "what occurred on that morning was wrong in every sense." March A march, held on July 28 and called the "March of Justice for Santos Rodriguez", was led by community leaders and organizations, including Rev. Sanchez, Councilman Pete Aguirre, Rene Martinez, Florentino Ramirez, State Representative Sam Hudson, and members of the Brown Berets. Marchers were predominantly of Mexican-American and African-American descent. The organization of the march, according to City Councilman George Allen, had the full backing of the city. The march began at Kennedy Plaza at around 12:00 pm, and led through Main Street to Dallas City Hall which was then located at 106 S. Harwood St. Speeches were made at the steps of City Hall calling for community unity and action, and at around 12:50 pm the march led back to Kennedy Plaza. Prayers were held at the plaza and the original organized march was dispersed. Afterwards, groups broke off from the march and latecomers joined the groups as they headed back towards City Hall. The crowd became agitated, and stores such as Neiman-Marcus, Titche's, Zales, Woolf Brothers, Jas. K. Wilson, Everts Jewelers, and H. L. Green's reported damages to storefronts and looting. At City Hall, leaders of the original march such as Councilman Aguirre and Representative Hudson got on top of a Dallas Police car and used the speaker system in an attempt to get the crowd under control. Dallas Police vehicles were damaged by the crowd, and a motorcycle was burned. Police officers experienced some physical attacks, with five officers injured, but there were no serious injuries. Officers in gas masks and armed with clubs confronted the crowd, and the crowd dispersed as some of its members damaged nearby stores. Leaders of the march later expressed dismay over the chaotic situation, but applauded the purpose of the march and its original organization. The Monday after the march, the Mexican-American committee led by Rev. Sanchez met with the city council to discuss the case and methods of confronting the treatment of minority groups by police. A special committee composed of eleven members was formed by the Greater Dallas Community Relations Committee in order to continue investigation and questioning of the events and circumstances surrounding Santos' shooting. The Rodriguez family later issued a statement regarding the march: The Rodriguez family would only ask that when the people of Dallas hear the name Santos Rodriguez they think not of the unwanted violence that became associated with his name Saturday; but they think of the real Santos Rodriguez, a gentle and well-liked 12-year-old boy who had his life tragically taken from him. Trial On Thursday, October 11, 1973, a hearing was held in the Criminal Court No. 5 for a venue change for Cain's trial. District Attorney Mulder and Cain's attorney Phil Burleson asked for the trial to be moved outside of Dallas County out of concerns that it would be difficult to hold a fair trial in Dallas and surrounding counties due to the publicity of the shooting. Judge Ed Gossett considered moving the case to either Wichita Falls or Austin. Mulder objected to Wichita Falls due to the recent disbarment of the city's District Attorney, and Burleson objected to Travis County due to Austin receiving Dallas news stations and newspapers. Judge Gossett ultimately moved the trial to the 147th District Court of Austin, with the hearing set for November 12, 1973. Judge Gossett stayed on as presiding judge in the case in Austin. He also set a lower bond of $20,000.00 for Cain, which Cain paid on Friday, October 12, and was released. Until that point Cain was still in jail for the shooting. When asked about why he gave Cain a lower bond, Gossett responded that the bond was not a punishment, but rather served to ensure that a prisoner would appear in court. Attorneys for Cain filed 26 pre-trial motions, and included a motion for quashing Cain's indictment due to insufficient evidence, claims that the evidence presented to the grand jury was hearsay, quashing the indictment due to vagueness, requests for criminal records of the victims, recordings of police radio transmissions, requests for statements to police, and other motions typical for a trial. By November 2, Judge Gossett denied the motions to quash the indictments against Cain. At a seminar for trial techniques for defense attorneys held in Fort Worth, Burleson announced that the defense for Cain planned on taking the position that the shooting was accidental, and that Burleson would place Cain on the witness stand to give his view of the event. Cain was represented by Phil Burleson and Michael P. Gibson. The State of Texas was represented by DA Henry Wade, W. T. Westmoreland, Jr., Assistant DAs Doug Mulder and Jon Sparling, DA Robert O. Smith, Assistant DA Herman C. Gotcher, State's Attorney Jim D. Vollers, and State's Attorney David S. McAngus. A jury was chosen for the trial on Monday, November 12. The jury was composed of seven men and five women, and did not have any jurors who were Mexican-American or African-American. During the questioning portion of jury selection, Sparling explained that Texas law recognized two types of murder: murder with malice and murder without malice, and that malice could be formed moments before a murder is committed. In response, Burleson claimed that the events before the shooting would prove that the shooting was an accident. Motion hearings were also held that Monday. Burleson had presented a motion for continuance in choosing jurors, citing concerns over potential jurors becoming influenced by a small contingent of protesters outside of the courthouse, but Judge Gossett denied the motion. Judge Gossett ruled that the criminal histories and reputations of Santos, David, and Bessie Rodriguez were inadmissible in court and that witness descriptions of the shooting were admissible. In response to demonstrators who had gathered at the courthouse (numbering between two and ten), Travis County Sheriff Raymond Frank assigned fifteen to twenty deputies around the courtroom. On Tuesday, November 13, the prosecution brought five witnesses to the stand: David Rodriguez, patrolman Jerry W. Foster, ballistics expert Allan Jones, Officer Fred M. Jenkins, and Associate Medical Examiner Vincent DiMaio. David was the first witness to give his testimony of the day of the murder. At the beginning of his testimony, David detailed how he and Santos spent the evening of July 23 playing football. David claimed that he arrived home and went to bed around 10:00 pm, hearing Santos arrive around 15 minutes afterwards. David fell asleep and awoke to Officers Cain and Arnold taking the boys from their bed and putting them under arrest. David and Santos were handcuffed, and David sat in the back seat next to Cain while Santos was placed in the front seat with Arnold. Prior to the shooting, David saw another police car with two officers arriving at the scene. David and Santos were interrogated, and Santos claimed that they were innocent. David saw Cain pull out his gun, hold it in his lap, open and twirl the cylinder before closing it, and point the gun at Santos. The first time Cain pulled the trigger it made a clicking sound. According to David, Cain told Santos that the gun had a bullet in it this time, and that Santos had better tell Arnold the truth. Santos again claimed his innocence, and the second time Cain pulled the trigger Santos was shot and killed. After Santos was shot, David said he watched Cain out of fear that Cain would shoot him next, and that he did not see Cain touch the cylinder of the gun before Cain left the car. On cross examination, Burleson asked if Cain had emptied the bullets from his gun, and David responded that Cain did not. David previously had stated that officers left him in the car with Santos' body for around 10 minutes. Patrolman Jerry Foster was the second witness. Foster corroborated David's statement about two other officers arriving at the scene before the shooting: Foster stated that he and his partner Thomas McKee were the officers David saw that morning. Foster also stated that he was at the driver's door of the car where David and Santos were sitting when he heard a gunshot and saw the front of the vehicle light up. He then stated that he saw Santos' head fall back, and saw bleeding coming from the left side of Santos' head. He went over to the side of the car where Santos was to try to help him, and saw Cain getting out of the car. Foster went to Cain and took Cain's pistol from him, and did not see Cain touch the cylinder of the gun after leaving the vehicle. When Foster unloaded Cain's gun, he saw five live rounds and one hull in the cylinder. Foster also saw Arnold leave the vehicle and vomit. On cross examination, Foster elaborated that, after leaving the vehicle, Cain repeatedly said "My God, what have I done. I didn't mean to do it...Jerry [Foster], I didn't mean to do it." In Foster's opinion, Cain seemed to be in shock. The third witness was ballistics expert Allan Jones. Jones testified that Santos had been shot from a distance of about six inches. Jones had examined the bullets and saw that none of them had been struck by a firing pin. According to Jones, the .357 Magnum pistol was designed to fire only when the trigger was fully pulled back, but could be made to make a clicking noise using two different methods. The fourth witness was Officer Fred M. Jenkins, who investigated the scene of the burglary and took several hand and finger prints from the machine that had been broken into. The prints were compared by four different officers to the prints of Santos, David, and a cousin of theirs who had also become a suspect, and nothing was found to associate David or Santos to the scene of the crime. The fifth and final witness was Dr. Vincent DiMaio, who conducted Santos' autopsy. Dr. DiMaio confirmed that Santos was killed by a gunshot wound to his head and brain, and that he had removed the bullet from Santos and given it to Jones, who examined the bullet and confirmed that it came from Cain's gun. After the testimonies of the five witnesses, the state rested its case. On Wednesday, November 14, Darrell Cain gave his testimony in his own defense. Cain claimed that he and Arnold found the Rodriguez brothers in their bed, and that they looked sweaty. Arnold told Cain that the brothers were the ones he saw running from the gas station. Cain and Arnold put the boys in handcuffs behind their backs and took them to a parking lot behind the burglarized gas station. Cain recalled that he and Arnold met officers Foster and McKee and that Arnold claimed there may have been a third burglar. According to Cain, when Arnold asked Santos if the boys had another brother, Santos affirmed that they did but that he did not know where his other brother was. Cain told Arnold that he would "make him [Santos] tell the truth", and took his pistol between his legs, emptied it, and visually checked that there were no bullets in the gun before closing the gun's chamber. Cain then pointed the gun at Santos and pulled the trigger, making a clicking sound. He warned Santos to tell the truth, and that there was a bullet in the gun. The second time Cain pulled the trigger, a shot fired, killing Santos. Cain described how he grabbed the bullets from his lap, jumped from the car, and put the bullets back into the gun while he was out of the vehicle. Cain said he was in shock and hysterical, and that he cried over what had happened. Mulder cross-examined Cain and asked if it was within normal police procedure to interrogate a young boy using a gun. Cain responded that it was not. Mulder asked Cain what made him set himself up as a judge of truth, and Cain responded that he did not know. Mulder had Cain reenact the incident in front of the jury. In response to Cain's previous claims that he had pressed his gun's ejector rod to empty it of bullets, Mulder demonstrated that the bullets would fall out of the gun if it were merely tilted. Mulder loaded and unloaded the gun by turning the cylinder upside down several times. Mulder questioned Cain about his claim that he reloaded the pistol, stating that Foster claimed he did not see Cain reload his gun outside of the car. Cain responded that he did indeed reload his gun, but that in the confusion nobody saw him. Mulder asked Cain what Santos' last words were, and Cain responded that they were "I am telling the truth." Roy Arnold was called as a witness to the defense. Arnold claimed that the Rodriguez brothers were the boys he saw fleeing the gas station, and that while he did not witness Cain removing the bullets from his gun, he did hear noises that could have been bullets falling from a chamber, but that he did not truly know. He also claimed that he saw the hammer of the gun fall the first time Cain made the pistol make a clicking noise, but did not see if Cain pulled the trigger during the first round. During cross examination, Arnold claimed that he saw Santos fleeing the gas station and was wearing dark pants and a T-shirt. Arnold admitted that Santos was wearing light green pants when he was killed, and when Arnold was asked by Mulder how he reconciled the fact that Santos was dressed differently than Arnold claimed, Arnold admitted that he could not. The final defense witness was Travis County Deputy Sheriff Tommy Tucker. Tucker demonstrated how, if the ejector rod was used to empty the gun, two bullets could be caught in the chamber. Mulder responded, "Where did they find you?" and again demonstrated that the bullets would freely fall out of the chamber if the gun was tilted up. One testimony was disallowed from the trial. Dallas Psychiatrist Dr. John Holbrook testified to the judge without the presence of the jury that he had given Cain a truth serum, sodium amytal, two days after the shooting while Cain was given a lie detector test by trained polygrapher Ray Jones. According to Holbrook, Cain testified under the influence of this drug that he believed the gun was empty when he pointed it at Santos. Holbrook qualified his testimony by stating that the "truth serum" influenced Cain to tell the truth as Cain knew it to be. Judge Gossett stated that prior appellate court decisions barred the use of lie detector tests as court evidence, and that testimony given while under the influence of "truth serums" fell under the same category. Gossett also barred the media from reporting on the use of a "truth serum" during the time the case was before a jury. Final arguments were held on Thursday, November 15. DA Jon Sparling opened the final arguments, and described Arnold and Cain as "storm troopers" who broke into the Rodriguez home and arrested them without a warrant. Sparling stated that the evidence was overwhelming: Cain was guilty of murder. Sparling told the jury that the state's position was that Cain shot Santos deliberately and intentionally. He also reminded the jury that the law did not require the state to give a motivation for the shooting. The bulk of Sparling's argument was focused on Cain's claim that he believed he emptied the gun. Sparling reminded the jury that David testified that he saw Cain spin the cylinder, not open it, and that Foster did not witness Cain reload his gun as Cain claimed. Sparling claimed that Cain was lying to the jury. Burleson spoke in defense of the client, telling the jury that their job was to ascertain the truth, not all become emotionally involved as the prosecution wanted. Burleson claimed the killing was out of poor judgement and stupidity, and that no man would have intentionally killed a child in front of three witnesses. Mulder closed the final arguments. He compared the arrests of the boys to Nazi Germany, and that while Burleson argued that it was a mistake of fact on the part of Cain in that he thought he unloaded his gun, Mulder argued that proper care of a reasonable man had to be exercised for there to be a mistake of fact. It was against the law for Cain to have pointed his gun at Santos, argued Mulder. He stated: "And I will tell you, the only thing worse than killing a handcuffed child, a 12-year-old child who is handcuffed in a squad car, who had been involved in a burglary from a Fina station, the only thing worse than that...The only thing worse than killing a child who is handcuffed, who is involved in a burglary, is killing a child who was handcuffed who was totally blameless, and totally innocent." After five and a half hours of deliberation, the jury found Cain guilty of murder or negligent homicide. Whether he was found guilty of murder with malice or guilty of murder without malice was decided during the punishment phase of the trial, which was scheduled for Friday, November 16. Final arguments were opened by Assistant DA Herman Gotcher, who argued for the prosecution's recommended murder with malice sentence. Gotcher argued that, as a police officer, Cain had to be held to a higher degree of responsibility for his actions than a layperson. The defense did not argue directly against a murder with malice sentence, and instead focused the crux of their argument on the need for leniency, probation rather than a prison sentence, due to Cain's time serving as a police officer. Gibson urged the jury to remember that Cain served on the police force for five and a half years and risked his life serving the citizens of Dallas, and that he deserved to rebuild what Gibson described as a shattered and torn life. Burleson argued that Cain would be subject to abuse in prison due to his service as a police officer, and that a prison sentence could be a death sentence for Cain. Sparling closed the arguments by calling for equality under the law, undermining the defense's request for leniency due to Cain's service. Sparling stated: Now, what would you have us do, really? I mean, what are we to do, are we to look at the defendant over here and focus on him and his look of designed innocence and blind ourselves to the corpse of the boy he killed? If so, who is to answer for the death of Santos Rodriguez? Who? Are we to hear his cries and close our ears to the sobbing, mourning tears of those people that mourn Santos Rodriguez? If so, who is to answer for the death of Santos Rodriguez? Are we to do what Phil Burleson says, are we to wring our hands and shrug our shoulders and nod our heads, say oh, it's a pity, but let's give him probation. If so, then who is to answer for the death of Santos Rodriguez? You? Me? The community at large? I refuse.After five and a half hours of deliberation, the same time it took to determine guilt, Cain was sentenced to five years in prison for murder with malice. A formal sentencing date was not set on the same day. Cain was freed on bond pending an appeal of his case. By 1975, he remained suspended from the Dallas Police force and worked outside of Dallas County. His attorney, Phil Burleson, argued that Cain deserved a new trial. By October 1975, the Texas Court of Criminal Appeals still had not received the necessary files for appealing the case. The appeal hearing would determine whether Cain would be able to have a new trial or if he would be required to carry out his five-year sentence. Cain's defense attorneys planned to argue that Judge Gossett should have allowed Cain's "truth serum" test to be brought as testimony and that the prosecution's emotionally-charged attacks damaged Cain's case. In the spring of 1975, Burleson reported that court reporters and clerks were completing the records of the original trial and that the defense intended to request to Judge Gossett that the original trial be set aside. DA Henry Wade planned to oppose the plea. At this time Cain was working in Fort Worth and planned on appealing to the Texas Court of Criminal Appeals if the request for a new trial was denied. On Wednesday, November 17, 1976, lawyers representing Cain asked for the Court of Criminal Appeals to order a new trial. On Wednesday, March 9, 1977, the Texas Court of Criminal Appeals ruled that Cain had received a fair trial and upheld the five-year sentence he was given. Cain continued to remain free on bond pending an appeal to the court. The case was eventually taken to the United States Supreme Court, and on Monday, October 3, 1977, the court refused to accept the case for review and upheld the murder conviction and five-year sentence. A brief prepared by Cain's defense claimed that the jury did not have sufficient freedom in their ruling, which eased the prosecution's ability to gain a murder conviction. The Texas Attorney General responded to this brief with his own, stating that the jury had been instructed that Cain was only to be found guilty if there was proof beyond a reasonable doubt that Cain voluntarily shot Santos, and to acquit Cain if Cain had acted under the mistaken assumption that the gun was unloaded and that Cain's mistake was due to lack of proper care. Cain ultimately served two and a half years of his five-year sentence. He served his time at the Texas Department of Corrections facility in Huntsville, Texas. He was classified as a state-approved trusty, which gave him privileged earning status, allowing him to meet his minimum discharge date on September 11, 1979. He had also earned the maximum amount of "good time", earning 30 days of credit for every 30 days he served. Cain had worked as a clerk in the diagnostic unit of the prison, and was described by director of the Texas Department of Corrections W. J. Estelle as a model prisoner. Cain was released on September 11, 1979, at 9:30 am, and was given a $200 check from the state of Texas as routine for Texas prisoners. Burleson stated that Cain had no interest in returning to work as a police officer, which Cain would have been unable to do as a convicted felon. Burleson stated that Cain sought to put his past behind him, and intended to move to a small town outside of the Dallas–Fort Worth metroplex. Cain later worked as an insurance claim adjuster and became married in 1980. He died in 2019 at age 75, and his official obituary did not mention his career as a police officer. Legacy In March 1978, the National Congress of Hispanic American Citizens (El Congreso) and the Mexican-American Legal Defense Educational Fund (MALDEF) urged then-President Jimmy Carter to investigate the treatment of Hispanics by law enforcement officers, citing several cases of police brutality including the shooting of Santos. At a League of United Latin American Citizens (LULAC) convention held in Laredo, Texas, on May 21, 1978, delegates passed a strongly worded resolution demanding that the US Department of Justice prosecute Darrell Cain for killing Santos. On June 23, President Carter met privately with a group of Mexican-American Democrats in the Hyatt Regency Hotel in Houston, Texas to discuss the possibility of pursuing civil rights charges against Cain. Mexican Americans, including four state legislators and members of Hispanic organizations, were in attendance. State Representative Ben Reyes showed color photographs of Santos' body, which garnered an emotional reaction from President Carter, leaving him visibly upset. On June 26, Carter stated that he had asked Attorney General Griffin Bell if civil rights charges should be filed. Previously it had been reported that Assistant Attorney General Drew S. Days had recommended against filing civil rights charges, but Carter refuted the report, claiming that no decision or recommendation had been made. Carter's administration had until July 24 to open up an investigation before the closing of the five-year statute of limitations. The Dallas city council was urged to join in the efforts of seeking a federal investigation into the shooting. Dallas Brown Berets, a delegation of Mexican-American citizens, and representatives from local Methodist churches met with the city council on June 28. Juan Perez, a member of the Dallas Brown Berets, held up a picture of Santos' body during the meeting. A resolution asking for a federal probe, police sensitivity training, and a statewide commission to review police brutality cases was presented to the council by Edwin Sylvest, theology professor at Southern Methodist University (SMU) and a member of the Rio Grande Methodist Conference. The resolution was adopted by the Casa View Methodist Church and Emanuel Methodist Church. Councilwoman Juanita Craft moved to adopt the resolution before she was convinced by Mayor Robert Folsom to table the proposal for three weeks. Folsom called the killing of Santos a tragic event, but was hesitant to adopt a resolution not written by the city council. Councilman Don Hicks compared the killing of Santos to the recent murder of his mother-in-law, lamenting that the killer would likely receive a short sentence and that her rights had been taken from her by her killer. Councilman Bill Nicol compared the Brown Berets to storm troopers attempting to intimidate the council, noting his belief that it was wrong to dredge up a past incident and that he did not believe the resolution backers represented the Mexican-American community at large. Nicol would later withdraw his comparison of the Brown Berets to storm troopers but continued to state that he did not believe Dallas should dwell on the tragedies and shortcomings of the past. On July 14, Justice Department spokesman Terry Adamson announced that the Justice Department would not be pursuing charges against Cain. Adamson cited legal problems which arose due to the length of time that had passed between Cain's trial and the Justice Department's decision to bring charges in civil rights cases. Cain's case would have been tried retroactively, which could bring up issues of due process, and Attorney General Griffin Bell believed the issues that would arise from trying Cain led to questions of fairness and wisdom. This decision to not pursue charges also applied to Roy Arnold. Adamson stated that the decision was one of the hardest announcements he had to make due to Santos' age and the senselessness of his death. Ruben Bonilla, Texas state director of LULAC, called the decision unjustifiable and irresponsible, predicting that Carter would lose the election primaries if challenged by Jerry Brown or Ted Kennedy due to being incapable of securing the Chicano vote. Bonilla also saw Carter's attempts at securing rights for Russian dissidents while ignoring Mexican-American rights in Texas as hypocritical. Bonilla cited how a New York grand jury indicted a policeman over a 1973 shooting as proof that there was a precedent for retroactive applications of due process. School board member Robert Medrano believed that the decision would cause community heartache and create political repercussions. San Antonio attorney Ruben Sandoval, who had petitioned for the Justice Department to prosecute Cain, was saddened by the news and described the relationship between the Carter administration and Mexican-American communities as a bitter divorce. Bessie Rodriguez later revealed that she sent a letter to President Carter on July 18 expressing her feelings of hurt and betrayal. In her letter, Bessie revealed that she felt Carter had led the Mexican-American community to believe that charges would be filed during his state visit. She questioned whether, if Carter's daughter Amy were killed, her killer would receive such a light sentence; she also pointed out that if Santos had killed a policeman his punishment would not have been as light as Cain's. On July 20, Carter called Reyes regarding the decision to not pursue charges against Cain. Reyes reported that Carter personally apologized for the Justice Department decision and understood that he had made a commitment to pursue charges that he was unable to keep. Carter told Reyes that he did not request that the department pursue or not pursue charges, but that he was embarrassed by the decision. Hours after the call, Carter stated that he did not have the inclination or authority to ask the Justice Department to reverse its decision. The office of Vice President Walter Mondale later called Reyes in order to attempt to arrange a meeting between Mexican-American leaders and Deputy Attorney General Benjamin Civiletti. On July 17, a rally was held at Reverchon Park in memory of Santos. Members of the Committee for Justice, Perfecto Delgado and Olga Sepulveda, had organized it in the name of the committee, which was seen as an issue by self-proclaimed chairman Joe Landin, who denied the committee's involvement with the rally. The committee had been registered with the Texas Secretary under Landin's name, but Delgado insisted that the committee did not have a chairman and that Landin was not a member. Around 650 people attended the rally. A satirical play was held and around half a dozen speeches were made. One of the speakers was Adolph Canales, a member of the Mexican-American assembly, who said in his speech that the rally was proof that the community was not going to sit back anymore. Pancho Medrano spoke on behalf of the United Auto Workers, and later said that he hoped his grandchildren would have better lives thanks to the efforts of the community. Afterwards, at about 8:30 pm, around 300 people marched from the park to the site of Santos' shooting and back. Despite Dallas police maintaining a low profile at the park and Brown Berets breaking up groups they worried might cause trouble, there were a few incidents at the park after the march: a false stabbing was reported and bottles were thrown at police officers, allegedly by non-marchers, leading to a 15-minute confrontation between around 100 people and police at the entrance of the park. Three arrests were made. Attendees of the march cited their wish to protect children from future police brutality and saw the rally and march as a starting point for community unity and proof that the community was still angry over the murder. One attendee, John Velas, stated that he used to play basketball with Santos, that other kids would not forget him and that they would make sure Dallas did not forget him. The Dallas Brown Berets led the coordination of a protest march in memory of Santos on July 22. The march was to assemble at 12:00 pm at Kennedy Plaza, proceed to old Dallas City Hall at 106 S. Harwood, and conclude around 3:30 pm at the new Dallas City Hall at 1500 Marilla St. Although as many as 1,000 marchers were expected, 300 marchers ultimately participated. The Brown Berets met with the Dallas Police Department to express their hopes and plans for a peaceful march, and the 50 riot-equipped tactical police assigned to the march kept out of sight of the marchers. Around 50 Brown Berets walked beside the marchers, and around 40 members of the Community of Churches were in attendance as neutral observers. Bessie Rodriguez was also in attendance but left in tears after speaking to reporters, stating that her attorney told her the case for trying Cain was hopeless, and that while she appreciated the marchers' support, she lamented the size of the march. The majority of the marchers were Mexican Americans; organizations in attendance included the Multi-Racial Committee for Justice, the American GI Forum, the Hispanic Organization of Women, and the National Organization for Women. Marchers chanted slogans such as "We want Justice", "Viva Santos", "Down with Carter, down with Bell", and "Viva la Raza". Awareness and memorials for Santos continued over the years. A park in Seattle, Washington is named after Santos. The Santos Rodriguez Memorial Park is located on 16th Ave S. and S. Lander St., and is the front yard of El Centro de la Raza, a non-profit organization. From July 24 to 26, 2013, a graveside ritual at Oakland Cemetery, a panel discussion at the Latino Cultural Center, and a community rally at Pike Park were held in honor of Santos. From July 2013 to August 2013, the Latino Cultural Center presented the exhibit Justicia: the Struggle for Mexican-American Civil Rights in Dallas, Texas, 1920–2012 in conjunction with the Dallas Mexican-American Historical League (DMAHL). The focus of the exhibit was the shooting of Santos. Then-president of DMAHL Albert Valtierra said the shooting of Santos galvanized the community and marked the beginning of the civil rights fight for Mexican Americans in Dallas. Interviews presented at the exhibit are now located at the Dallas History and Archives division of the Dallas Public Library. On September 21, 2013, Mayor Mike Rawlings issued an apology for Santos' death on behalf of the Dallas city council and the Dallas police department. Teatro Dallas produced a play called Santos, a Wandering Soul based on the murder. The play ran in 2013. In 2015, SMU established the Santos Rodriguez Memorial Endowed Scholarship for students studying Human Rights. On October 18, 2018, the Dallas Park Board renamed the Pike Park Recreation Center to the Santos Rodriguez Center. Park board member Jesse Moreno, who was appointed by Dallas City Council member Adam Medrano, led the renaming move. As of July 2018, the center was in need of extensive repairs. The Santos Vive Project was established by Human Rights Dallas to create a memorial to honor Santos, establish a fund to financially assist his surviving relatives, and produce a documentary about his murder. On July 24, 2018, the Santos Vive documentary premiered at the Texas Theatre in Oak Cliff. The SMU Embrey Human Rights Program featured the story of Santos in their Human Rights Map Project. , the most recent annual memorial held for Santos was in July 2020. The event involved speakers reading and reflecting on the names of individuals killed by police, including Michael Morehead (killed by Cain in 1970), Tamir Rice and George Floyd. Dallas police chief Ulysha Reneé Hall made a surprise appearance at the 2020 memorial; she did not speak at the podium but approached Santos' mother to say that the Dallas Police Department was committed to "being a different police department." One activist speaking at the memorial addressed Chief Hall in the crowd, telling her, "I’m calling you out. You came to this memorial and we are glad you are here, but we need your help." On February 09, 2022, a sculpture dedicated to the life and memory of 12-year-old Santos Rodriguez was installed at Pike Park in Dallas. Created by artist Seth Vandable, the six-foot-tall bronze statue depicts a smiling boy with his arms turned toward the sky. The City of Dallas purchased the statue. Santos' mother was in attendance at the unveiling ceremony. See also Murder of Botham Jean Mexicans in Dallas–Fort Worth References Sources External links Civil Rights in Black and Brown: Oral History Project Santos Rodriguez: The March of Justice — 1973 1960 births 1973 deaths 1973 in Texas Deaths by firearm in Texas Deaths by person in Texas Hispanic and Latino American-related controversies History of Dallas Incidents of violence against boys Latino people shot dead by law enforcement officers in the United States Mexican-American history Mexican-American culture in Texas Child murder in the United States People from Dallas People murdered by law enforcement officers in the United States People murdered in Texas Police brutality in the United States Police misconduct in the United States Race and crime in the United States Murders by law enforcement officers in the United States Violence against men in the United States
Thomas A. Renda (born September 19, 1937) was an American politician in the state of Iowa. Renda was born in Des Moines, Iowa. He attended Drake University and Loras College and is a lawyer and judge. He served in the Iowa House of Representatives from 1965 to 1971 as a Democrat. References 1937 births Living people Politicians from Des Moines, Iowa Loras College alumni Iowa state court judges Democratic Party members of the Iowa House of Representatives Drake University Law School alumni
```xml 'use strict'; import { EventEmitter } from 'events'; import { injectable } from 'inversify'; import * as net from 'net'; import { createDeferred, Deferred } from '../../common/utils/async'; import { IUnitTestSocketServer } from './types'; const MaxConnections = 100; @injectable() export class UnitTestSocketServer extends EventEmitter implements IUnitTestSocketServer { private server?: net.Server; private startedDef?: Deferred<number>; private sockets: net.Socket[] = []; private ipcBuffer = ''; constructor() { super(); } public get clientsConnected(): boolean { return this.sockets.length > 0; } public dispose() { this.stop(); } public stop() { if (this.server) { this.server.close(); this.server = undefined; } } public start({ port, host }: { port: number; host: string } = { port: 0, host: 'localhost' }): Promise<number> { this.ipcBuffer = ''; this.startedDef = createDeferred<number>(); this.server = net.createServer(this.connectionListener.bind(this)); this.server.maxConnections = MaxConnections; this.server.on('error', (err) => { if (this.startedDef) { this.startedDef.reject(err); this.startedDef = undefined; } this.emit('error', err); }); this.log('starting server as', 'TCP'); if (host.trim().length === 0) { host = 'localhost'; } this.server.on('connection', (socket: net.Socket) => { this.emit('start', socket); }); this.server.listen(port, host, () => { this.startedDef?.resolve((this.server?.address() as net.AddressInfo).port); this.startedDef = undefined; }); return this.startedDef?.promise; } private connectionListener(socket: net.Socket) { this.sockets.push(socket); socket.setEncoding('utf8'); this.log('## socket connection to server detected ##'); socket.on('close', () => { this.ipcBuffer = ''; this.onCloseSocket(); }); socket.on('error', (err) => { this.log('server socket error', err); this.emit('error', err); }); socket.on('data', (data) => { const sock = socket; // Assume we have just one client socket connection let dataStr = (this.ipcBuffer += data); while (true) { const startIndex = dataStr.indexOf('{'); if (startIndex === -1) { return; } const lengthOfMessage = parseInt( dataStr.slice(dataStr.indexOf(':') + 1, dataStr.indexOf('{')).trim(), 10, ); if (dataStr.length < startIndex + lengthOfMessage) { return; } let message: any; try { message = JSON.parse(dataStr.substring(startIndex, lengthOfMessage + startIndex)); } catch (jsonErr) { this.emit('error', jsonErr); return; } dataStr = this.ipcBuffer = dataStr.substring(startIndex + lengthOfMessage); this.emit(message.event, message.body, sock); } }); this.emit('connect', socket); } private log(message: string, ...data: any[]) { this.emit('log', message, ...data); } private onCloseSocket() { for (let i = 0, count = this.sockets.length; i < count; i += 1) { const socket = this.sockets[i]; if (socket && socket.readable) { continue; } let destroyedSocketId; if ((socket as any).id) { destroyedSocketId = (socket as any).id; } this.log('socket disconnected', destroyedSocketId?.toString()); if (socket && socket.destroy) { socket.destroy(); } this.sockets.splice(i, 1); this.emit('socket.disconnected', socket, destroyedSocketId); return; } } } ```
```smalltalk // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Cryptography.X509Certificates; using Microsoft.Extensions.EnvironmentAbstractions; using NuGet.Packaging; using NuGet.Packaging.Signing; using HashAlgorithmName = System.Security.Cryptography.HashAlgorithmName; namespace Microsoft.DotNet.Cli.NuGetPackageDownloader { internal class FirstPartyNuGetPackageSigningVerifier : IFirstPartyNuGetPackageSigningVerifier { internal readonly HashSet<string> _firstPartyCertificateThumbprints = new(StringComparer.OrdinalIgnoreCase) { your_sha256_hash, your_sha256_hash, your_sha256_hash }; private readonly HashSet<string> _upperFirstPartyCertificateThumbprints = new(StringComparer.OrdinalIgnoreCase) { your_sha256_hash, your_sha256_hash }; private const string FirstPartyCertificateSubject = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"; public FirstPartyNuGetPackageSigningVerifier() { } public bool Verify(FilePath nupkgToVerify, out string commandOutput) { return NuGetVerify(nupkgToVerify, out commandOutput) && IsFirstParty(nupkgToVerify); } internal bool IsFirstParty(FilePath nupkgToVerify) { try { using (var packageReader = new PackageArchiveReader(nupkgToVerify.Value)) { PrimarySignature primarySignature = packageReader.GetPrimarySignatureAsync(CancellationToken.None).GetAwaiter().GetResult(); using (IX509CertificateChain certificateChain = SignatureUtility.GetCertificateChain(primarySignature)) { if (certificateChain.Count < 2) { return false; } X509Certificate2 firstCert = certificateChain.First(); if (_firstPartyCertificateThumbprints.Contains(firstCert.GetCertHashString(HashAlgorithmName.SHA256))) { return true; } if (firstCert.Subject.Equals(FirstPartyCertificateSubject, StringComparison.OrdinalIgnoreCase) && _upperFirstPartyCertificateThumbprints.Contains( certificateChain[1].GetCertHashString(HashAlgorithmName.SHA256))) { return true; } } } return false; } catch (FileNotFoundException) { return false; } } private static bool NuGetVerify(FilePath nupkgToVerify, out string commandOutput) { var args = new[] { "verify", "--all", nupkgToVerify.Value }; var command = new DotNetCommandFactory(alwaysRunOutOfProc: true) .Create("nuget", args); var commandResult = command.CaptureStdOut().Execute(); commandOutput = commandResult.StdOut + Environment.NewLine + commandResult.StdErr; return commandResult.ExitCode == 0; } } } ```
Narun () is a village in Taftan-e Jonubi Rural District of the Central District of Taftan County, Sistan and Baluchestan province, Iran. At the 2006 National Census, its population was 538 in 129 households, when it was in the former Nukabad District of Khash County. The following census in 2011 counted 387 people in 78 households. The latest census in 2016 showed a population of 826 people in 190 households. It was the largest village in its rural district. In 2018, Nukabad District was separated from Khash County, elevated to the status of Taftan County, and divided into three districts, with the city of Nukabad as its only city and capital of the new county. References Populated places in Sistan and Baluchestan Province
```c++ /*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library path_to_url LICENSE_1_0.txt or copy at path_to_url =============================================================================*/ // Tests, if macro expansion eats up follow up tokens under certain conditions // (which it shouldn't). #define SCAN(x) x #define BUG BUG_2 #define BUG_2 //R #line 19 "t_1_025.cpp" SCAN(BUG) 1 2 3 4 5 //R 1 2 3 4 5 //H 10: t_1_025.cpp(13): #define //H 08: t_1_025.cpp(13): SCAN(x)=x //H 10: t_1_025.cpp(15): #define //H 08: t_1_025.cpp(15): BUG=BUG_2 //H 10: t_1_025.cpp(16): #define //H 08: t_1_025.cpp(16): BUG_2= //H 00: t_1_025.cpp(19): SCAN(BUG), [t_1_025.cpp(13): SCAN(x)=x] //H 01: t_1_025.cpp(15): BUG //H 02: BUG_2 //H 01: t_1_025.cpp(16): BUG_2 //H 02: //H 03: _ //H 03: _ //H 02: //H 03: _ ```
Leeds is an unincorporated community in Osage Township, LaSalle County, Illinois, United States. Leeds is located along the BNSF Railway in the southern panhandle of LaSalle County, northeast of Rutland. References Unincorporated communities in LaSalle County, Illinois Unincorporated communities in Illinois
```smalltalk #define TMP_PRESENT using UnityEngine; using UnityEngine.TextCore; using UnityEngine.UI; using UnityEngine.Events; using UnityEngine.EventSystems; using System; using System.Text; using System.Collections; using System.Collections.Generic; namespace TMPro { public interface ITextElement { Material sharedMaterial { get; } void Rebuild(CanvasUpdate update); int GetInstanceID(); } public enum TextAlignmentOptions { TopLeft = _HorizontalAlignmentOptions.Left | _VerticalAlignmentOptions.Top, Top = _HorizontalAlignmentOptions.Center | _VerticalAlignmentOptions.Top, TopRight = _HorizontalAlignmentOptions.Right | _VerticalAlignmentOptions.Top, TopJustified = _HorizontalAlignmentOptions.Justified | _VerticalAlignmentOptions.Top, TopFlush = _HorizontalAlignmentOptions.Flush | _VerticalAlignmentOptions.Top, TopGeoAligned = _HorizontalAlignmentOptions.Geometry | _VerticalAlignmentOptions.Top, Left = _HorizontalAlignmentOptions.Left | _VerticalAlignmentOptions.Middle, Center = _HorizontalAlignmentOptions.Center | _VerticalAlignmentOptions.Middle, Right = _HorizontalAlignmentOptions.Right | _VerticalAlignmentOptions.Middle, Justified = _HorizontalAlignmentOptions.Justified | _VerticalAlignmentOptions.Middle, Flush = _HorizontalAlignmentOptions.Flush | _VerticalAlignmentOptions.Middle, CenterGeoAligned = _HorizontalAlignmentOptions.Geometry | _VerticalAlignmentOptions.Middle, BottomLeft = _HorizontalAlignmentOptions.Left | _VerticalAlignmentOptions.Bottom, Bottom = _HorizontalAlignmentOptions.Center | _VerticalAlignmentOptions.Bottom, BottomRight = _HorizontalAlignmentOptions.Right | _VerticalAlignmentOptions.Bottom, BottomJustified = _HorizontalAlignmentOptions.Justified | _VerticalAlignmentOptions.Bottom, BottomFlush = _HorizontalAlignmentOptions.Flush | _VerticalAlignmentOptions.Bottom, BottomGeoAligned = _HorizontalAlignmentOptions.Geometry | _VerticalAlignmentOptions.Bottom, BaselineLeft = _HorizontalAlignmentOptions.Left | _VerticalAlignmentOptions.Baseline, Baseline = _HorizontalAlignmentOptions.Center | _VerticalAlignmentOptions.Baseline, BaselineRight = _HorizontalAlignmentOptions.Right | _VerticalAlignmentOptions.Baseline, BaselineJustified = _HorizontalAlignmentOptions.Justified | _VerticalAlignmentOptions.Baseline, BaselineFlush = _HorizontalAlignmentOptions.Flush | _VerticalAlignmentOptions.Baseline, BaselineGeoAligned = _HorizontalAlignmentOptions.Geometry | _VerticalAlignmentOptions.Baseline, MidlineLeft = _HorizontalAlignmentOptions.Left | _VerticalAlignmentOptions.Geometry, Midline = _HorizontalAlignmentOptions.Center | _VerticalAlignmentOptions.Geometry, MidlineRight = _HorizontalAlignmentOptions.Right | _VerticalAlignmentOptions.Geometry, MidlineJustified = _HorizontalAlignmentOptions.Justified | _VerticalAlignmentOptions.Geometry, MidlineFlush = _HorizontalAlignmentOptions.Flush | _VerticalAlignmentOptions.Geometry, MidlineGeoAligned = _HorizontalAlignmentOptions.Geometry | _VerticalAlignmentOptions.Geometry, CaplineLeft = _HorizontalAlignmentOptions.Left | _VerticalAlignmentOptions.Capline, Capline = _HorizontalAlignmentOptions.Center | _VerticalAlignmentOptions.Capline, CaplineRight = _HorizontalAlignmentOptions.Right | _VerticalAlignmentOptions.Capline, CaplineJustified = _HorizontalAlignmentOptions.Justified | _VerticalAlignmentOptions.Capline, CaplineFlush = _HorizontalAlignmentOptions.Flush | _VerticalAlignmentOptions.Capline, CaplineGeoAligned = _HorizontalAlignmentOptions.Geometry | _VerticalAlignmentOptions.Capline }; /// <summary> /// Internal horizontal text alignment options. /// </summary> public enum _HorizontalAlignmentOptions { Left = 0x1, Center = 0x2, Right = 0x4, Justified = 0x8, Flush = 0x10, Geometry = 0x20 } /// <summary> /// Internal vertical text alignment options. /// </summary> public enum _VerticalAlignmentOptions { Top = 0x100, Middle = 0x200, Bottom = 0x400, Baseline = 0x800, Geometry = 0x1000, Capline = 0x2000, } /// <summary> /// Flags controlling what vertex data gets pushed to the mesh. /// </summary> public enum TextRenderFlags { DontRender = 0x0, Render = 0xFF }; public enum TMP_TextElementType { Character, Sprite }; public enum MaskingTypes { MaskOff = 0, MaskHard = 1, MaskSoft = 2 }; //, MaskTex = 4 }; public enum TextOverflowModes { Overflow = 0, Ellipsis = 1, Masking = 2, Truncate = 3, ScrollRect = 4, Page = 5, Linked = 6 }; public enum MaskingOffsetMode { Percentage = 0, Pixel = 1 }; public enum TextureMappingOptions { Character = 0, Line = 1, Paragraph = 2, MatchAspect = 3 }; public enum FontStyles { Normal = 0x0, Bold = 0x1, Italic = 0x2, Underline = 0x4, LowerCase = 0x8, UpperCase = 0x10, SmallCaps = 0x20, Strikethrough = 0x40, Superscript = 0x80, Subscript = 0x100, Highlight = 0x200 }; public enum FontWeight { Thin = 100, ExtraLight = 200, Light = 300, Regular = 400, Medium = 500, SemiBold = 600, Bold = 700, Heavy = 800, Black = 900 }; /// <summary> /// Base class which contains common properties and functions shared between the TextMeshPro and TextMeshProUGUI component. /// </summary> public abstract class TMP_Text : MaskableGraphic { /// <summary> /// A string containing the text to be displayed. /// </summary> public string text { get { return m_text; } set { if (m_text == value) return; m_text = old_text = value; m_inputSource = TextInputSources.String; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] [TextArea(5, 10)] protected string m_text; /// <summary> /// /// </summary> public bool isRightToLeftText { get { return m_isRightToLeft; } set { if (m_isRightToLeft == value) return; m_isRightToLeft = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_isRightToLeft = false; /// <summary> /// The Font Asset to be assigned to this text object. /// </summary> public TMP_FontAsset font { get { return m_fontAsset; } set { if (m_fontAsset == value) return; m_fontAsset = value; LoadFontAsset(); m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected TMP_FontAsset m_fontAsset; protected TMP_FontAsset m_currentFontAsset; protected bool m_isSDFShader; /// <summary> /// The material to be assigned to this text object. /// </summary> public virtual Material fontSharedMaterial { get { return m_sharedMaterial; } set { if (m_sharedMaterial == value) return; SetSharedMaterial(value); m_havePropertiesChanged = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetMaterialDirty(); } } [SerializeField] protected Material m_sharedMaterial; protected Material m_currentMaterial; protected MaterialReference[] m_materialReferences = new MaterialReference[32]; protected Dictionary<int, int> m_materialReferenceIndexLookup = new Dictionary<int, int>(); protected TMP_RichTextTagStack<MaterialReference> m_materialReferenceStack = new TMP_RichTextTagStack<MaterialReference>(new MaterialReference[16]); protected int m_currentMaterialIndex; //protected int m_sharedMaterialHashCode; /// <summary> /// An array containing the materials used by the text object. /// </summary> public virtual Material[] fontSharedMaterials { get { return GetSharedMaterials(); } set { SetSharedMaterials(value); m_havePropertiesChanged = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetMaterialDirty(); } } [SerializeField] protected Material[] m_fontSharedMaterials; /// <summary> /// The material to be assigned to this text object. An instance of the material will be assigned to the object's renderer. /// </summary> public Material fontMaterial { // Return an Instance of the current material. get { return GetMaterial(m_sharedMaterial); } // Assign new font material set { if (m_sharedMaterial != null && m_sharedMaterial.GetInstanceID() == value.GetInstanceID()) return; m_sharedMaterial = value; m_padding = GetPaddingForMaterial(); m_havePropertiesChanged = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetMaterialDirty(); } } [SerializeField] protected Material m_fontMaterial; /// <summary> /// The materials to be assigned to this text object. An instance of the materials will be assigned. /// </summary> public virtual Material[] fontMaterials { get { return GetMaterials(m_fontSharedMaterials); } set { SetSharedMaterials(value); m_havePropertiesChanged = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetMaterialDirty(); } } [SerializeField] protected Material[] m_fontMaterials; protected bool m_isMaterialDirty; /// <summary> /// This is the default vertex color assigned to each vertices. Color tags will override vertex colors unless the overrideColorTags is set. /// </summary> public override Color color { get { return m_fontColor; } set { if (m_fontColor == value) return; m_havePropertiesChanged = true; m_fontColor = value; SetVerticesDirty(); } } //[UnityEngine.Serialization.FormerlySerializedAs("m_fontColor")] // Required for backwards compatibility with pre-Unity 4.6 releases. [SerializeField] protected Color32 m_fontColor32 = Color.white; [SerializeField] protected Color m_fontColor = Color.white; protected static Color32 s_colorWhite = new Color32(255, 255, 255, 255); protected Color32 m_underlineColor = s_colorWhite; protected Color32 m_strikethroughColor = s_colorWhite; protected Color32 m_highlightColor = s_colorWhite; protected Vector4 m_highlightPadding = Vector4.zero; /// <summary> /// Sets the vertex color alpha value. /// </summary> public float alpha { get { return m_fontColor.a; } set { if (m_fontColor.a == value) return; m_fontColor.a = value; m_havePropertiesChanged = true; SetVerticesDirty(); } } /// <summary> /// Determines if Vertex Color Gradient should be used /// </summary> /// <value><c>true</c> if enable vertex gradient; otherwise, <c>false</c>.</value> public bool enableVertexGradient { get { return m_enableVertexGradient; } set { if (m_enableVertexGradient == value) return; m_havePropertiesChanged = true; m_enableVertexGradient = value; SetVerticesDirty(); } } [SerializeField] protected bool m_enableVertexGradient; [SerializeField] protected ColorMode m_colorMode = ColorMode.FourCornersGradient; /// <summary> /// Sets the vertex colors for each of the 4 vertices of the character quads. /// </summary> /// <value>The color gradient.</value> public VertexGradient colorGradient { get { return m_fontColorGradient; } set { m_havePropertiesChanged = true; m_fontColorGradient = value; SetVerticesDirty(); } } [SerializeField] protected VertexGradient m_fontColorGradient = new VertexGradient(Color.white); /// <summary> /// Set the vertex colors of the 4 vertices of each character quads. /// </summary> public TMP_ColorGradient colorGradientPreset { get { return m_fontColorGradientPreset; } set { m_havePropertiesChanged = true; m_fontColorGradientPreset = value; SetVerticesDirty(); } } [SerializeField] protected TMP_ColorGradient m_fontColorGradientPreset; /// <summary> /// Default Sprite Asset used by the text object. /// </summary> public TMP_SpriteAsset spriteAsset { get { return m_spriteAsset; } set { m_spriteAsset = value; m_havePropertiesChanged = true; m_isInputParsingRequired = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected TMP_SpriteAsset m_spriteAsset; /// <summary> /// Determines whether or not the sprite color is multiplies by the vertex color of the text. /// </summary> public bool tintAllSprites { get { return m_tintAllSprites; } set { if (m_tintAllSprites == value) return; m_tintAllSprites = value; m_havePropertiesChanged = true; SetVerticesDirty(); } } [SerializeField] protected bool m_tintAllSprites; protected bool m_tintSprite; protected Color32 m_spriteColor; /// <summary> /// This overrides the color tags forcing the vertex colors to be the default font color. /// </summary> public bool overrideColorTags { get { return m_overrideHtmlColors; } set { if (m_overrideHtmlColors == value) return; m_havePropertiesChanged = true; m_overrideHtmlColors = value; SetVerticesDirty(); } } [SerializeField] protected bool m_overrideHtmlColors = false; /// <summary> /// Sets the color of the _FaceColor property of the assigned material. Changing face color will result in an instance of the material. /// </summary> public Color32 faceColor { get { if (m_sharedMaterial == null) return m_faceColor; m_faceColor = m_sharedMaterial.GetColor(ShaderUtilities.ID_FaceColor); return m_faceColor; } set { if (m_faceColor.Compare(value)) return; SetFaceColor(value); m_havePropertiesChanged = true; m_faceColor = value; SetVerticesDirty(); SetMaterialDirty(); } } [SerializeField] protected Color32 m_faceColor = Color.white; /// <summary> /// Sets the color of the _OutlineColor property of the assigned material. Changing outline color will result in an instance of the material. /// </summary> public Color32 outlineColor { get { if (m_sharedMaterial == null) return m_outlineColor; m_outlineColor = m_sharedMaterial.GetColor(ShaderUtilities.ID_OutlineColor); return m_outlineColor; } set { if (m_outlineColor.Compare(value)) return; SetOutlineColor(value); m_havePropertiesChanged = true; m_outlineColor = value; SetVerticesDirty(); } } [SerializeField] protected Color32 m_outlineColor = Color.black; /// <summary> /// Sets the thickness of the outline of the font. Setting this value will result in an instance of the material. /// </summary> public float outlineWidth { get { if (m_sharedMaterial == null) return m_outlineWidth; m_outlineWidth = m_sharedMaterial.GetFloat(ShaderUtilities.ID_OutlineWidth); return m_outlineWidth; } set { if (m_outlineWidth == value) return; SetOutlineThickness(value); m_havePropertiesChanged = true; m_outlineWidth = value; SetVerticesDirty(); } } protected float m_outlineWidth = 0.0f; /// <summary> /// The point size of the font. /// </summary> public float fontSize { get { return m_fontSize; } set { if (m_fontSize == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_fontSize = value; if (!m_enableAutoSizing) m_fontSizeBase = m_fontSize; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_fontSize = 36; // Font Size protected float m_currentFontSize; // Temporary Font Size affected by tags [SerializeField] protected float m_fontSizeBase = 36; protected TMP_RichTextTagStack<float> m_sizeStack = new TMP_RichTextTagStack<float>(16); /// <summary> /// The scale of the current text. /// </summary> public float fontScale { get { return m_fontScale; } } /// <summary> /// Control the weight of the font if an alternative font asset is assigned for the given weight in the font asset editor. /// </summary> public FontWeight fontWeight { get { return m_fontWeight; } set { if (m_fontWeight == value) return; m_fontWeight = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected FontWeight m_fontWeight = FontWeight.Regular; protected FontWeight m_FontWeightInternal = FontWeight.Regular; protected TMP_RichTextTagStack<FontWeight> m_FontWeightStack = new TMP_RichTextTagStack<FontWeight>(8); /// <summary> /// /// </summary> public float pixelsPerUnit { get { var localCanvas = canvas; if (!localCanvas) return 1; // For dynamic fonts, ensure we use one pixel per pixel on the screen. if (!font) return localCanvas.scaleFactor; // For non-dynamic fonts, calculate pixels per unit based on specified font size relative to font object's own font size. if (m_currentFontAsset == null || m_currentFontAsset.faceInfo.pointSize <= 0 || m_fontSize <= 0) return 1; return m_fontSize / m_currentFontAsset.faceInfo.pointSize; } } /// <summary> /// Enable text auto-sizing /// </summary> public bool enableAutoSizing { get { return m_enableAutoSizing; } set { if (m_enableAutoSizing == value) return; m_enableAutoSizing = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_enableAutoSizing; protected float m_maxFontSize; // Used in conjunction with auto-sizing protected float m_minFontSize; // Used in conjunction with auto-sizing /// <summary> /// Minimum point size of the font when text auto-sizing is enabled. /// </summary> public float fontSizeMin { get { return m_fontSizeMin; } set { if (m_fontSizeMin == value) return; m_fontSizeMin = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_fontSizeMin = 0; // Text Auto Sizing Min Font Size. /// <summary> /// Maximum point size of the font when text auto-sizing is enabled. /// </summary> public float fontSizeMax { get { return m_fontSizeMax; } set { if (m_fontSizeMax == value) return; m_fontSizeMax = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_fontSizeMax = 0; // Text Auto Sizing Max Font Size. /// <summary> /// The style of the text /// </summary> public FontStyles fontStyle { get { return m_fontStyle; } set { if (m_fontStyle == value) return; m_fontStyle = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected FontStyles m_fontStyle = FontStyles.Normal; protected FontStyles m_FontStyleInternal = FontStyles.Normal; protected TMP_FontStyleStack m_fontStyleStack; /// <summary> /// Property used in conjunction with padding calculation for the geometry. /// </summary> public bool isUsingBold { get { return m_isUsingBold; } } protected bool m_isUsingBold = false; // Used to ensure GetPadding & Ratios take into consideration bold characters. /// <summary> /// Text alignment options /// </summary> public TextAlignmentOptions alignment { get { return m_textAlignment; } set { if (m_textAlignment == value) return; m_havePropertiesChanged = true; m_textAlignment = value; SetVerticesDirty(); } } [SerializeField] [UnityEngine.Serialization.FormerlySerializedAs("m_lineJustification")] protected TextAlignmentOptions m_textAlignment = TextAlignmentOptions.TopLeft; protected TextAlignmentOptions m_lineJustification; protected TMP_RichTextTagStack<TextAlignmentOptions> m_lineJustificationStack = new TMP_RichTextTagStack<TextAlignmentOptions>(new TextAlignmentOptions[16]); protected Vector3[] m_textContainerLocalCorners = new Vector3[4]; /// <summary> /// Use the extents of the text geometry for alignment instead of font metrics. /// </summary> //public bool alignByGeometry //{ // get { return m_alignByGeometry; } // set { if (m_alignByGeometry == value) return; m_havePropertiesChanged = true; m_alignByGeometry = value; SetVerticesDirty(); } //} //[SerializeField] //protected bool m_alignByGeometry; /// <summary> /// The amount of additional spacing between characters. /// </summary> public float characterSpacing { get { return m_characterSpacing; } set { if (m_characterSpacing == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_characterSpacing = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_characterSpacing = 0; protected float m_cSpacing = 0; protected float m_monoSpacing = 0; /// <summary> /// The amount of additional spacing between words. /// </summary> public float wordSpacing { get { return m_wordSpacing; } set { if (m_wordSpacing == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_wordSpacing = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_wordSpacing = 0; /// <summary> /// The amount of additional spacing to add between each lines of text. /// </summary> public float lineSpacing { get { return m_lineSpacing; } set { if (m_lineSpacing == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_lineSpacing = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_lineSpacing = 0; protected float m_lineSpacingDelta = 0; // Used with Text Auto Sizing feature protected float m_lineHeight = TMP_Math.FLOAT_UNSET; // Used with the <line-height=xx.x> tag. /// <summary> /// The amount of potential line spacing adjustment before text auto sizing kicks in. /// </summary> public float lineSpacingAdjustment { get { return m_lineSpacingMax; } set { if (m_lineSpacingMax == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_lineSpacingMax = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_lineSpacingMax = 0; // Text Auto Sizing Max Line spacing reduction. //protected bool m_forceLineBreak; /// <summary> /// The amount of additional spacing to add between each lines of text. /// </summary> public float paragraphSpacing { get { return m_paragraphSpacing; } set { if (m_paragraphSpacing == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_paragraphSpacing = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_paragraphSpacing = 0; /// <summary> /// Percentage the width of characters can be adjusted before text auto-sizing begins to reduce the point size. /// </summary> public float characterWidthAdjustment { get { return m_charWidthMaxAdj; } set { if (m_charWidthMaxAdj == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_charWidthMaxAdj = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_charWidthMaxAdj = 0f; // Text Auto Sizing Max Character Width reduction. protected float m_charWidthAdjDelta = 0; /// <summary> /// Controls whether or not word wrapping is applied. When disabled, the text will be displayed on a single line. /// </summary> public bool enableWordWrapping { get { return m_enableWordWrapping; } set { if (m_enableWordWrapping == value) return; m_havePropertiesChanged = true; m_isInputParsingRequired = true; m_isCalculateSizeRequired = true; m_enableWordWrapping = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_enableWordWrapping = false; protected bool m_isCharacterWrappingEnabled = false; protected bool m_isNonBreakingSpace = false; protected bool m_isIgnoringAlignment; /// <summary> /// Controls the blending between using character and word spacing to fill-in the space for justified text. /// </summary> public float wordWrappingRatios { get { return m_wordWrappingRatios; } set { if (m_wordWrappingRatios == value) return; m_wordWrappingRatios = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected float m_wordWrappingRatios = 0.4f; // Controls word wrapping ratios between word or characters. /// <summary> /// /// </summary> //public bool enableAdaptiveJustification //{ // get { return m_enableAdaptiveJustification; } // set { if (m_enableAdaptiveJustification == value) return; m_enableAdaptiveJustification = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } //} //[SerializeField] //protected bool m_enableAdaptiveJustification; //protected float m_adaptiveJustificationThreshold = 10.0f; /// <summary> /// Controls the Text Overflow Mode /// </summary> public TextOverflowModes overflowMode { get { return m_overflowMode; } set { if (m_overflowMode == value) return; m_overflowMode = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected TextOverflowModes m_overflowMode = TextOverflowModes.Overflow; /// <summary> /// Indicates if the text exceeds the vertical bounds of its text container. /// </summary> public bool isTextOverflowing { get { if (m_firstOverflowCharacterIndex != -1) return true; return false; } } /// <summary> /// The first character which exceeds the vertical bounds of its text container. /// </summary> public int firstOverflowCharacterIndex { get { return m_firstOverflowCharacterIndex; } } [SerializeField] protected int m_firstOverflowCharacterIndex = -1; /// <summary> /// The linked text component used for flowing the text from one text component to another. /// </summary> public TMP_Text linkedTextComponent { get { return m_linkedTextComponent; } set { if (m_linkedTextComponent != value) { // Release previously linked text component. if (m_linkedTextComponent != null) { m_linkedTextComponent.overflowMode = TextOverflowModes.Overflow; m_linkedTextComponent.linkedTextComponent = null; m_linkedTextComponent.isLinkedTextComponent = false; } m_linkedTextComponent = value; if (m_linkedTextComponent != null) m_linkedTextComponent.isLinkedTextComponent = true; } m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected TMP_Text m_linkedTextComponent; /// <summary> /// Indicates whether this text component is linked to another. /// </summary> public bool isLinkedTextComponent { get { return m_isLinkedTextComponent; } set { m_isLinkedTextComponent = value; if (m_isLinkedTextComponent == false) m_firstVisibleCharacter = 0; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_isLinkedTextComponent; /// <summary> /// Property indicating whether the text is Truncated or using Ellipsis. /// </summary> public bool isTextTruncated { get { return m_isTextTruncated; } } [SerializeField] protected bool m_isTextTruncated; /// <summary> /// Determines if kerning is enabled or disabled. /// </summary> public bool enableKerning { get { return m_enableKerning; } set { if (m_enableKerning == value) return; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_enableKerning = value; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_enableKerning; /// <summary> /// Adds extra padding around each character. This may be necessary when the displayed text is very small to prevent clipping. /// </summary> public bool extraPadding { get { return m_enableExtraPadding; } set { if (m_enableExtraPadding == value) return; m_havePropertiesChanged = true; m_enableExtraPadding = value; UpdateMeshPadding(); /* m_isCalculateSizeRequired = true;*/ SetVerticesDirty(); /* SetLayoutDirty();*/ } } [SerializeField] protected bool m_enableExtraPadding = false; [SerializeField] protected bool checkPaddingRequired; /// <summary> /// Enables or Disables Rich Text Tags /// </summary> public bool richText { get { return m_isRichText; } set { if (m_isRichText == value) return; m_isRichText = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_isRichText = true; // Used to enable or disable Rich Text. /// <summary> /// Enables or Disables parsing of CTRL characters in input text. /// </summary> public bool parseCtrlCharacters { get { return m_parseCtrlCharacters; } set { if (m_parseCtrlCharacters == value) return; m_parseCtrlCharacters = value; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_parseCtrlCharacters = true; /// <summary> /// Sets the RenderQueue along with Ztest to force the text to be drawn last and on top of scene elements. /// </summary> public bool isOverlay { get { return m_isOverlay; } set { if (m_isOverlay == value) return; m_isOverlay = value; SetShaderDepth(); m_havePropertiesChanged = true; SetVerticesDirty(); } } protected bool m_isOverlay = false; /// <summary> /// Sets Perspective Correction to Zero for Orthographic Camera mode & 0.875f for Perspective Camera mode. /// </summary> public bool isOrthographic { get { return m_isOrthographic; } set { if (m_isOrthographic == value) return; m_havePropertiesChanged = true; m_isOrthographic = value; SetVerticesDirty(); } } [SerializeField] protected bool m_isOrthographic = false; /// <summary> /// Sets the culling on the shaders. Note changing this value will result in an instance of the material. /// </summary> public bool enableCulling { get { return m_isCullingEnabled; } set { if (m_isCullingEnabled == value) return; m_isCullingEnabled = value; SetCulling(); m_havePropertiesChanged = true; } } [SerializeField] protected bool m_isCullingEnabled = false; /// <summary> /// Controls whether or not the text object will be culled when using a 2D Rect Mask. /// </summary> public bool ignoreRectMaskCulling { get { return m_ignoreRectMaskCulling; } set { if (m_ignoreRectMaskCulling == value) return; m_ignoreRectMaskCulling = value; m_havePropertiesChanged = true; } } [SerializeField] protected bool m_ignoreRectMaskCulling; /// <summary> /// Forces objects that are not visible to get refreshed. /// </summary> public bool ignoreVisibility { get { return m_ignoreCulling; } set { if (m_ignoreCulling == value) return; m_havePropertiesChanged = true; m_ignoreCulling = value; } } [SerializeField] protected bool m_ignoreCulling = true; // Not implemented yet. /// <summary> /// Controls how the face and outline textures will be applied to the text object. /// </summary> public TextureMappingOptions horizontalMapping { get { return m_horizontalMapping; } set { if (m_horizontalMapping == value) return; m_havePropertiesChanged = true; m_horizontalMapping = value; SetVerticesDirty(); } } [SerializeField] protected TextureMappingOptions m_horizontalMapping = TextureMappingOptions.Character; /// <summary> /// Controls how the face and outline textures will be applied to the text object. /// </summary> public TextureMappingOptions verticalMapping { get { return m_verticalMapping; } set { if (m_verticalMapping == value) return; m_havePropertiesChanged = true; m_verticalMapping = value; SetVerticesDirty(); } } [SerializeField] protected TextureMappingOptions m_verticalMapping = TextureMappingOptions.Character; /// <summary> /// Controls the UV Offset for the various texture mapping mode on the text object. /// </summary> //public Vector2 mappingUvOffset //{ // get { return m_uvOffset; } // set { if (m_uvOffset == value) return; m_havePropertiesChanged = true; m_uvOffset = value; SetVerticesDirty(); } //} //[SerializeField] //protected Vector2 m_uvOffset = Vector2.zero; // Used to offset UV on Texturing /// <summary> /// Controls the horizontal offset of the UV of the texture mapping mode for each line of the text object. /// </summary> public float mappingUvLineOffset { get { return m_uvLineOffset; } set { if (m_uvLineOffset == value) return; m_havePropertiesChanged = true; m_uvLineOffset = value; SetVerticesDirty(); } } [SerializeField] protected float m_uvLineOffset = 0.0f; // Used for UV line offset per line /// <summary> /// Determines if the Mesh will be rendered. /// </summary> public TextRenderFlags renderMode { get { return m_renderMode; } set { if (m_renderMode == value) return; m_renderMode = value; m_havePropertiesChanged = true; } } protected TextRenderFlags m_renderMode = TextRenderFlags.Render; /// <summary> /// Determines the sorting order of the geometry of the text object. /// </summary> public VertexSortingOrder geometrySortingOrder { get { return m_geometrySortingOrder; } set { m_geometrySortingOrder = value; m_havePropertiesChanged = true; SetVerticesDirty(); } } [SerializeField] protected VertexSortingOrder m_geometrySortingOrder; /// <summary> /// Determines if the data structures allocated to contain the geometry of the text object will be reduced in size if the number of characters required to display the text is reduced by more than 256 characters. /// This reduction has the benefit of reducing the amount of vertex data being submitted to the graphic device but results in GC when it occurs. /// </summary> public bool vertexBufferAutoSizeReduction { get { return m_VertexBufferAutoSizeReduction; } set { m_VertexBufferAutoSizeReduction = value; m_havePropertiesChanged = true; SetVerticesDirty(); } } [SerializeField] protected bool m_VertexBufferAutoSizeReduction = true; /// <summary> /// The first character which should be made visible in conjunction with the Text Overflow Linked mode. /// </summary> public int firstVisibleCharacter { get { return m_firstVisibleCharacter; } set { if (m_firstVisibleCharacter == value) return; m_havePropertiesChanged = true; m_firstVisibleCharacter = value; SetVerticesDirty(); } } [SerializeField] protected int m_firstVisibleCharacter; /// <summary> /// Allows to control how many characters are visible from the input. /// </summary> public int maxVisibleCharacters { get { return m_maxVisibleCharacters; } set { if (m_maxVisibleCharacters == value) return; m_havePropertiesChanged = true; m_maxVisibleCharacters = value; SetVerticesDirty(); } } protected int m_maxVisibleCharacters = 99999; /// <summary> /// Allows to control how many words are visible from the input. /// </summary> public int maxVisibleWords { get { return m_maxVisibleWords; } set { if (m_maxVisibleWords == value) return; m_havePropertiesChanged = true; m_maxVisibleWords = value; SetVerticesDirty(); } } protected int m_maxVisibleWords = 99999; /// <summary> /// Allows control over how many lines of text are displayed. /// </summary> public int maxVisibleLines { get { return m_maxVisibleLines; } set { if (m_maxVisibleLines == value) return; m_havePropertiesChanged = true; m_isInputParsingRequired = true; m_maxVisibleLines = value; SetVerticesDirty(); } } protected int m_maxVisibleLines = 99999; /// <summary> /// Determines if the text's vertical alignment will be adjusted based on visible descender of the text. /// </summary> public bool useMaxVisibleDescender { get { return m_useMaxVisibleDescender; } set { if (m_useMaxVisibleDescender == value) return; m_havePropertiesChanged = true; m_isInputParsingRequired = true; SetVerticesDirty(); } } [SerializeField] protected bool m_useMaxVisibleDescender = true; /// <summary> /// Controls which page of text is shown /// </summary> public int pageToDisplay { get { return m_pageToDisplay; } set { if (m_pageToDisplay == value) return; m_havePropertiesChanged = true; m_pageToDisplay = value; SetVerticesDirty(); } } [SerializeField] protected int m_pageToDisplay = 1; protected bool m_isNewPage = false; /// <summary> /// The margins of the text object. /// </summary> public virtual Vector4 margin { get { return m_margin; } set { if (m_margin == value) return; m_margin = value; ComputeMarginSize(); m_havePropertiesChanged = true; SetVerticesDirty(); } } [SerializeField] protected Vector4 m_margin = new Vector4(0, 0, 0, 0); protected float m_marginLeft; protected float m_marginRight; protected float m_marginWidth; // Width of the RectTransform minus left and right margins. protected float m_marginHeight; // Height of the RectTransform minus top and bottom margins. protected float m_width = -1; /// <summary> /// Returns data about the text object which includes information about each character, word, line, link, etc. /// </summary> public TMP_TextInfo textInfo { get { return m_textInfo; } } [SerializeField] protected TMP_TextInfo m_textInfo; // Class which holds information about the Text object such as characters, lines, mesh data as well as metrics. /// <summary> /// Property tracking if any of the text properties have changed. Flag is set before the text is regenerated. /// </summary> public bool havePropertiesChanged { get { return m_havePropertiesChanged; } set { if (m_havePropertiesChanged == value) return; m_havePropertiesChanged = value; m_isInputParsingRequired = true; SetAllDirty(); } } //[SerializeField] protected bool m_havePropertiesChanged; // Used to track when properties of the text object have changed. /// <summary> /// Property to handle legacy animation component. /// </summary> public bool isUsingLegacyAnimationComponent { get { return m_isUsingLegacyAnimationComponent; } set { m_isUsingLegacyAnimationComponent = value; } } [SerializeField] protected bool m_isUsingLegacyAnimationComponent; /// <summary> /// Returns are reference to the Transform /// </summary> public new Transform transform { get { if (m_transform == null) m_transform = GetComponent<Transform>(); return m_transform; } } protected Transform m_transform; /// <summary> /// Returns are reference to the RectTransform /// </summary> public new RectTransform rectTransform { get { if (m_rectTransform == null) m_rectTransform = GetComponent<RectTransform>(); return m_rectTransform; } } protected RectTransform m_rectTransform; /// <summary> /// Enables control over setting the size of the text container to match the text object. /// </summary> public virtual bool autoSizeTextContainer { get; set; } protected bool m_autoSizeTextContainer; /// <summary> /// The mesh used by the font asset and material assigned to the text object. /// </summary> public virtual Mesh mesh { get { return m_mesh; } } protected Mesh m_mesh; /// <summary> /// Determines if the geometry of the characters will be quads or volumetric (cubes). /// </summary> public bool isVolumetricText { get { return m_isVolumetricText; } set { if (m_isVolumetricText == value) return; m_havePropertiesChanged = value; m_textInfo.ResetVertexLayout(value); m_isInputParsingRequired = true; SetVerticesDirty(); SetLayoutDirty(); } } [SerializeField] protected bool m_isVolumetricText; /// <summary> /// Returns the bounds of the mesh of the text object in world space. /// </summary> public Bounds bounds { get { if (m_mesh == null) return new Bounds(); return GetCompoundBounds(); } } /// <summary> /// Returns the bounds of the text of the text object. /// </summary> public Bounds textBounds { get { if (m_textInfo == null) return new Bounds(); return GetTextBounds(); } } // *** Unity Event Handling *** //[Serializable] //public class TextChangedEvent : UnityEvent { } ///// <summary> ///// Event delegate triggered when text has changed and been rendered. ///// </summary> //public TextChangedEvent onTextChanged //{ // get { return m_OnTextChanged; } // set { m_OnTextChanged = value; } //} //[SerializeField] //private TextChangedEvent m_OnTextChanged = new TextChangedEvent(); //protected void SendOnTextChanged() //{ // if (onTextChanged != null) // onTextChanged.Invoke(); //} // *** SPECIAL COMPONENTS *** /// <summary> /// Component used to control wrapping of text following some arbitrary shape. /// </summary> //public MarginShaper marginShaper //{ // get // { // if (m_marginShaper == null) m_marginShaper = GetComponent<MarginShaper>(); // return m_marginShaper; // } //} //[SerializeField] //protected MarginShaper m_marginShaper; /// <summary> /// Component used to control and animate sprites in the text object. /// </summary> protected TMP_SpriteAnimator spriteAnimator { get { if (m_spriteAnimator == null) { m_spriteAnimator = GetComponent<TMP_SpriteAnimator>(); if (m_spriteAnimator == null) m_spriteAnimator = gameObject.AddComponent<TMP_SpriteAnimator>(); } return m_spriteAnimator; } } [SerializeField] protected TMP_SpriteAnimator m_spriteAnimator; /// <summary> /// /// </summary> //public TMP_TextShaper textShaper //{ // get // { // if (m_textShaper == null) // m_textShaper = GetComponent<TMP_TextShaper>(); // return m_textShaper; // } //} //[SerializeField] //protected TMP_TextShaper m_textShaper; // *** PROPERTIES RELATED TO UNITY LAYOUT SYSTEM *** /// <summary> /// /// </summary> public float flexibleHeight { get { return m_flexibleHeight; } } protected float m_flexibleHeight = -1f; /// <summary> /// /// </summary> public float flexibleWidth { get { return m_flexibleWidth; } } protected float m_flexibleWidth = -1f; /// <summary> /// /// </summary> public float minWidth { get { return m_minWidth; } } protected float m_minWidth; /// <summary> /// /// </summary> public float minHeight { get { return m_minHeight; } } protected float m_minHeight; /// <summary> /// /// </summary> public float maxWidth { get { return m_maxWidth; } } protected float m_maxWidth; /// <summary> /// /// </summary> public float maxHeight { get { return m_maxHeight; } } protected float m_maxHeight; /// <summary> /// /// </summary> protected LayoutElement layoutElement { get { if (m_LayoutElement == null) { m_LayoutElement = GetComponent<LayoutElement>(); } return m_LayoutElement; } } protected LayoutElement m_LayoutElement; /// <summary> /// Computed preferred width of the text object. /// </summary> public virtual float preferredWidth { get { if (!m_isPreferredWidthDirty) return m_preferredWidth; m_preferredWidth = GetPreferredWidth(); return m_preferredWidth; } } protected float m_preferredWidth; protected float m_renderedWidth; protected bool m_isPreferredWidthDirty; /// <summary> /// Computed preferred height of the text object. /// </summary> public virtual float preferredHeight { get { if (!m_isPreferredHeightDirty) return m_preferredHeight; m_preferredHeight = GetPreferredHeight(); return m_preferredHeight; } } protected float m_preferredHeight; protected float m_renderedHeight; protected bool m_isPreferredHeightDirty; protected bool m_isCalculatingPreferredValues; private int m_recursiveCount; /// <summary> /// Compute the rendered width of the text object. /// </summary> public virtual float renderedWidth { get { return GetRenderedWidth(); } } /// <summary> /// Compute the rendered height of the text object. /// </summary> public virtual float renderedHeight { get { return GetRenderedHeight(); } } /// <summary> /// /// </summary> public int layoutPriority { get { return m_layoutPriority; } } protected int m_layoutPriority = 0; protected bool m_isCalculateSizeRequired = false; protected bool m_isLayoutDirty; protected bool m_verticesAlreadyDirty; protected bool m_layoutAlreadyDirty; protected bool m_isAwake; internal bool m_isWaitingOnResourceLoad; internal bool m_isInputParsingRequired = false; // Used to determine if the input text needs to be re-parsed. // Protected Fields internal enum TextInputSources { Text = 0, SetText = 1, SetCharArray = 2, String = 3 }; //[SerializeField] internal TextInputSources m_inputSource; protected string old_text; // Used by SetText to determine if the text has changed. //protected float old_arg0, old_arg1, old_arg2; // Used by SetText to determine if the args have changed. protected float m_fontScale; // Scaling of the font based on Atlas true Font Size and Rendered Font Size. protected float m_fontScaleMultiplier; // Used for handling of superscript and subscript. protected char[] m_htmlTag = new char[128]; // Maximum length of rich text tag. This is preallocated to avoid GC. protected RichTextTagAttribute[] m_xmlAttribute = new RichTextTagAttribute[8]; protected float[] m_attributeParameterValues = new float[16]; protected float tag_LineIndent = 0; protected float tag_Indent = 0; protected TMP_RichTextTagStack<float> m_indentStack = new TMP_RichTextTagStack<float>(new float[16]); protected bool tag_NoParsing; //protected TMP_LinkInfo tag_LinkInfo = new TMP_LinkInfo(); protected bool m_isParsingText; protected Matrix4x4 m_FXMatrix; protected bool m_isFXMatrixSet; protected UnicodeChar[] m_TextParsingBuffer; // This array holds the characters to be processed by GenerateMesh(); protected struct UnicodeChar { public int unicode; public int stringIndex; public int length; } //protected UnicodeChar[] m_InternalParsingBuffer; private TMP_CharacterInfo[] m_internalCharacterInfo; // Used by functions to calculate preferred values. protected char[] m_input_CharArray = new char[256]; // This array hold the characters from the SetText(); private int m_charArray_Length = 0; protected int m_totalCharacterCount; // Structures used to save the state of the text layout in conjunction with line breaking / word wrapping. protected WordWrapState m_SavedWordWrapState = new WordWrapState(); protected WordWrapState m_SavedLineState = new WordWrapState(); //protected WordWrapState m_SavedAlignment = new WordWrapState (); // Fields whose state is saved in conjunction with text parsing and word wrapping. protected int m_characterCount; //protected int m_visibleCharacterCount; //protected int m_visibleSpriteCount; protected int m_firstCharacterOfLine; protected int m_firstVisibleCharacterOfLine; protected int m_lastCharacterOfLine; protected int m_lastVisibleCharacterOfLine; protected int m_lineNumber; protected int m_lineVisibleCharacterCount; protected int m_pageNumber; protected float m_maxAscender; protected float m_maxCapHeight; protected float m_maxDescender; protected float m_maxLineAscender; protected float m_maxLineDescender; protected float m_startOfLineAscender; //protected float m_maxFontScale; protected float m_lineOffset; protected Extents m_meshExtents; // Fields used for vertex colors protected Color32 m_htmlColor = new Color(255, 255, 255, 128); protected TMP_RichTextTagStack<Color32> m_colorStack = new TMP_RichTextTagStack<Color32>(new Color32[16]); protected TMP_RichTextTagStack<Color32> m_underlineColorStack = new TMP_RichTextTagStack<Color32>(new Color32[16]); protected TMP_RichTextTagStack<Color32> m_strikethroughColorStack = new TMP_RichTextTagStack<Color32>(new Color32[16]); protected TMP_RichTextTagStack<Color32> m_highlightColorStack = new TMP_RichTextTagStack<Color32>(new Color32[16]); protected TMP_ColorGradient m_colorGradientPreset; protected TMP_RichTextTagStack<TMP_ColorGradient> m_colorGradientStack = new TMP_RichTextTagStack<TMP_ColorGradient>(new TMP_ColorGradient[16]); protected float m_tabSpacing = 0; protected float m_spacing = 0; //protected bool IsRectTransformDriven; // STYLE TAGS protected TMP_RichTextTagStack<int> m_styleStack = new TMP_RichTextTagStack<int>(new int[16]); protected TMP_RichTextTagStack<int> m_actionStack = new TMP_RichTextTagStack<int>(new int[16]); protected float m_padding = 0; protected float m_baselineOffset; // Used for superscript and subscript. protected TMP_RichTextTagStack<float> m_baselineOffsetStack = new TMP_RichTextTagStack<float>(new float[16]); protected float m_xAdvance; // Tracks x advancement from character to character. protected TMP_TextElementType m_textElementType; protected TMP_TextElement m_cached_TextElement; // Glyph / Character information is cached into this variable which is faster than having to fetch from the Dictionary multiple times. protected TMP_Character m_cached_Underline_Character; // Same as above but for the underline character which is used for Underline. protected TMP_Character m_cached_Ellipsis_Character; protected TMP_SpriteAsset m_defaultSpriteAsset; protected TMP_SpriteAsset m_currentSpriteAsset; protected int m_spriteCount = 0; protected int m_spriteIndex; protected int m_spriteAnimationID; //protected TMP_XmlTagStack<int> m_spriteAnimationStack = new TMP_XmlTagStack<int>(new int[16]); /// <summary> /// Method which derived classes need to override to load Font Assets. /// </summary> protected virtual void LoadFontAsset() { } /// <summary> /// Function called internally when a new shared material is assigned via the fontSharedMaterial property. /// </summary> /// <param name="mat"></param> protected virtual void SetSharedMaterial(Material mat) { } /// <summary> /// Function called internally when a new material is assigned via the fontMaterial property. /// </summary> protected virtual Material GetMaterial(Material mat) { return null; } /// <summary> /// Function called internally when assigning a new base material. /// </summary> /// <param name="mat"></param> protected virtual void SetFontBaseMaterial(Material mat) { } /// <summary> /// Method which returns an array containing the materials used by the text object. /// </summary> /// <returns></returns> protected virtual Material[] GetSharedMaterials() { return null; } /// <summary> /// /// </summary> protected virtual void SetSharedMaterials(Material[] materials) { } /// <summary> /// Method returning instances of the materials used by the text object. /// </summary> /// <returns></returns> protected virtual Material[] GetMaterials(Material[] mats) { return null; } /// <summary> /// Method to set the materials of the text and sub text objects. /// </summary> /// <param name="mats"></param> //protected virtual void SetMaterials (Material[] mats) { } /// <summary> /// Function used to create an instance of the material /// </summary> /// <param name="source"></param> /// <returns></returns> protected virtual Material CreateMaterialInstance(Material source) { Material mat = new Material(source); mat.shaderKeywords = source.shaderKeywords; mat.name += " (Instance)"; return mat; } protected void SetVertexColorGradient(TMP_ColorGradient gradient) { if (gradient == null) return; m_fontColorGradient.bottomLeft = gradient.bottomLeft; m_fontColorGradient.bottomRight = gradient.bottomRight; m_fontColorGradient.topLeft = gradient.topLeft; m_fontColorGradient.topRight = gradient.topRight; SetVerticesDirty(); } /// <summary> /// Function to control the sorting of the geometry of the text object. /// </summary> protected void SetTextSortingOrder(VertexSortingOrder order) { } /// <summary> /// Function to sort the geometry of the text object in accordance to the provided order. /// </summary> /// <param name="order"></param> protected void SetTextSortingOrder(int[] order) { } /// <summary> /// Function called internally to set the face color of the material. This will results in an instance of the material. /// </summary> /// <param name="color"></param> protected virtual void SetFaceColor(Color32 color) { } /// <summary> /// Function called internally to set the outline color of the material. This will results in an instance of the material. /// </summary> /// <param name="color"></param> protected virtual void SetOutlineColor(Color32 color) { } /// <summary> /// Function called internally to set the outline thickness property of the material. This will results in an instance of the material. /// </summary> /// <param name="thickness"></param> protected virtual void SetOutlineThickness(float thickness) { } /// <summary> /// Set the Render Queue and ZTest mode on the current material /// </summary> protected virtual void SetShaderDepth() { } /// <summary> /// Set the culling mode on the material. /// </summary> protected virtual void SetCulling() { } /// <summary> /// Get the padding value for the currently assigned material /// </summary> /// <returns></returns> protected virtual float GetPaddingForMaterial() { return 0; } /// <summary> /// Get the padding value for the given material /// </summary> /// <returns></returns> protected virtual float GetPaddingForMaterial(Material mat) { return 0; } /// <summary> /// Method to return the local corners of the Text Container or RectTransform. /// </summary> /// <returns></returns> protected virtual Vector3[] GetTextContainerLocalCorners() { return null; } // PUBLIC FUNCTIONS protected bool m_ignoreActiveState; /// <summary> /// Function to force the regeneration of the text object. /// </summary> public virtual void ForceMeshUpdate() { } /// <summary> /// Method used for resetting vertex layout when switching to and from Volumetric Text mode. /// </summary> /// <param name="updateMesh"></param> //protected virtual void ResetVertexLayout() { } /// <summary> /// Function to force the regeneration of the text object. /// </summary> /// <param name="ignoreActiveState">If set to true, the text object will be regenerated regardless of is active state.</param> public virtual void ForceMeshUpdate(bool ignoreActiveState) { } /// <summary> /// Internal function used by the Text Input Field to populate TMP_TextInfo data. /// </summary> internal void SetTextInternal(string text) { m_text = text; m_renderMode = TextRenderFlags.DontRender; m_isInputParsingRequired = true; ForceMeshUpdate(); m_renderMode = TextRenderFlags.Render; } /// <summary> /// Function to force the regeneration of the text object. /// </summary> /// <param name="flags"> Flags to control which portions of the geometry gets uploaded.</param> //public virtual void ForceMeshUpdate(TMP_VertexDataUpdateFlags flags) { } /// <summary> /// Function to update the geometry of the main and sub text objects. /// </summary> /// <param name="mesh"></param> /// <param name="index"></param> public virtual void UpdateGeometry(Mesh mesh, int index) { } /// <summary> /// Function to push the updated vertex data into the mesh and renderer. /// </summary> public virtual void UpdateVertexData(TMP_VertexDataUpdateFlags flags) { } /// <summary> /// Function to push the updated vertex data into the mesh and renderer. /// </summary> public virtual void UpdateVertexData() { } /// <summary> /// Function to push a new set of vertices to the mesh. /// </summary> /// <param name="vertices"></param> public virtual void SetVertices(Vector3[] vertices) { } /// <summary> /// Function to be used to force recomputing of character padding when Shader / Material properties have been changed via script. /// </summary> public virtual void UpdateMeshPadding() { } /// <summary> /// /// </summary> //public virtual new void UpdateGeometry() { } /// <summary> /// Tweens the CanvasRenderer color associated with this Graphic. /// </summary> /// <param name="targetColor">Target color.</param> /// <param name="duration">Tween duration.</param> /// <param name="ignoreTimeScale">Should ignore Time.scale?</param> /// <param name="useAlpha">Should also Tween the alpha channel?</param> public override void CrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha) { base.CrossFadeColor(targetColor, duration, ignoreTimeScale, useAlpha); InternalCrossFadeColor(targetColor, duration, ignoreTimeScale, useAlpha); } /// <summary> /// Tweens the alpha of the CanvasRenderer color associated with this Graphic. /// </summary> /// <param name="alpha">Target alpha.</param> /// <param name="duration">Duration of the tween in seconds.</param> /// <param name="ignoreTimeScale">Should ignore Time.scale?</param> public override void CrossFadeAlpha(float alpha, float duration, bool ignoreTimeScale) { base.CrossFadeAlpha(alpha, duration, ignoreTimeScale); InternalCrossFadeAlpha(alpha, duration, ignoreTimeScale); } /// <summary> /// /// </summary> /// <param name="targetColor"></param> /// <param name="duration"></param> /// <param name="ignoreTimeScale"></param> /// <param name="useAlpha"></param> /// <param name="useRGB"></param> protected virtual void InternalCrossFadeColor(Color targetColor, float duration, bool ignoreTimeScale, bool useAlpha) { } /// <summary> /// /// </summary> /// <param name="alpha"></param> /// <param name="duration"></param> /// <param name="ignoreTimeScale"></param> protected virtual void InternalCrossFadeAlpha(float alpha, float duration, bool ignoreTimeScale) { } /// <summary> /// Method to parse the input text based on its source /// </summary> protected void ParseInputText() { //Debug.Log("Re-parsing Text."); ////Profiler.BeginSample("ParseInputText()"); m_isInputParsingRequired = false; switch (m_inputSource) { case TextInputSources.String: case TextInputSources.Text: StringToCharArray(m_text, ref m_TextParsingBuffer); break; case TextInputSources.SetText: SetTextArrayToCharArray(m_input_CharArray, ref m_TextParsingBuffer); break; case TextInputSources.SetCharArray: break; } SetArraySizes(m_TextParsingBuffer); ////Profiler.EndSample(); } /// <summary> /// /// </summary> /// <param name="text"></param> public void SetText(string text) { SetText(text, true); } /// <summary> /// /// </summary> /// <param name="text"></param> public void SetText(string text, bool syncTextInputBox) { //if (text == old_text) return; //old_text = text; m_inputSource = TextInputSources.SetCharArray; StringToCharArray(text, ref m_TextParsingBuffer); #if UNITY_EDITOR // Set the text in the Text Input Box in the Unity Editor only. // TODO: Could revise to convert to string literal if (syncTextInputBox) m_text = text; #endif m_isInputParsingRequired = true; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } /// <summary> /// <para>Formatted string containing a pattern and a value representing the text to be rendered.</para> /// <para>ex. TextMeshPro.SetText ("Number is {0:1}.", 5.56f);</para> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="text">String containing the pattern."</param> /// <param name="arg0">Value is a float.</param> public void SetText(string text, float arg0) { SetText(text, arg0, 255, 255); } /// <summary> /// <para>Formatted string containing a pattern and a value representing the text to be rendered.</para> /// <para>ex. TextMeshPro.SetText ("First number is {0} and second is {1:2}.", 10, 5.756f);</para> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="text">String containing the pattern."</param> /// <param name="arg0">Value is a float.</param> /// <param name="arg1">Value is a float.</param> public void SetText(string text, float arg0, float arg1) { SetText(text, arg0, arg1, 255); } /// <summary> /// <para>Formatted string containing a pattern and a value representing the text to be rendered.</para> /// <para>ex. TextMeshPro.SetText ("A = {0}, B = {1} and C = {2}.", 2, 5, 7);</para> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="text">String containing the pattern."</param> /// <param name="arg0">Value is a float.</param> /// <param name="arg1">Value is a float.</param> /// <param name="arg2">Value is a float.</param> public void SetText(string text, float arg0, float arg1, float arg2) { int decimalPrecision = 0; int index = 0; for (int i = 0; i < text.Length; i++) { char c = text[i]; if (c == 123) // '{' { // Check if user is requesting some decimal precision. Format is {0:2} if (text[i + 2] == 58) // ':' { decimalPrecision = text[i + 3] - 48; } switch (text[i + 1] - 48) { case 0: // 1st Arg AddFloatToCharArray(arg0, ref index, decimalPrecision); break; case 1: // 2nd Arg AddFloatToCharArray(arg1, ref index, decimalPrecision); break; case 2: // 3rd Arg AddFloatToCharArray(arg2, ref index, decimalPrecision); break; } if (text[i + 2] == 58) i += 4; else i += 2; continue; } m_input_CharArray[index] = c; index += 1; } m_input_CharArray[index] = (char)0; m_charArray_Length = index; // Set the length to where this '0' termination is. #if UNITY_EDITOR // Create new string to be displayed in the Input Text Box of the Editor Panel. m_text = new string(m_input_CharArray, 0, index); #endif m_inputSource = TextInputSources.SetText; m_isInputParsingRequired = true; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } /// <summary> /// Set the text using a StringBuilder. /// </summary> /// <description> /// Using a StringBuilder instead of concatenating strings prevents memory pollution with temporary objects. /// </description> /// <param name="text">StringBuilder with text to display.</param> public void SetText(StringBuilder text) { m_inputSource = TextInputSources.SetCharArray; #if UNITY_EDITOR // Set the text in the Text Input Box in the Unity Editor only. m_text = text.ToString(); #endif StringBuilderToIntArray(text, ref m_TextParsingBuffer); m_isInputParsingRequired = true; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } /// <summary> /// Character array containing the text to be displayed. /// </summary> /// <param name="sourceText"></param> public void SetCharArray(char[] sourceText) { // Initialize internal character buffer if necessary if (m_TextParsingBuffer == null) m_TextParsingBuffer = new UnicodeChar[8]; #if UNITY_EDITOR // Create new string to be displayed in the Input Text Box of the Editor Panel. if (sourceText == null || sourceText.Length == 0) m_text = string.Empty; else m_text = new string(sourceText); #endif // Clear the Style stack. m_styleStack.Clear(); int writeIndex = 0; for (int i = 0; sourceText != null && i < sourceText.Length; i++) { if (sourceText[i] == 92 && i < sourceText.Length - 1) { switch ((int)sourceText[i + 1]) { case 110: // \n LineFeed if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 10; i += 1; writeIndex += 1; continue; case 114: // \r LineFeed if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 13; i += 1; writeIndex += 1; continue; case 116: // \t Tab if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 9; i += 1; writeIndex += 1; continue; } } // Handle inline replacement of <stlye> and <br> tags. if (sourceText[i] == 60) { if (IsTagName(ref sourceText, "<BR>", i)) { if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 10; ; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref sourceText, "<STYLE=", i)) { int srcOffset; if (ReplaceOpeningStyleTag(ref sourceText, i, out srcOffset, ref m_TextParsingBuffer, ref writeIndex)) { i = srcOffset; continue; } } else if (IsTagName(ref sourceText, "</STYLE>", i)) { ReplaceClosingStyleTag(ref sourceText, i, ref m_TextParsingBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = sourceText[i]; writeIndex += 1; } if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 0; m_inputSource = TextInputSources.SetCharArray; m_isInputParsingRequired = true; m_havePropertiesChanged = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } /// <summary> /// Character array containing the text to be displayed. /// </summary> /// <param name="sourceText"></param> public void SetCharArray(char[] sourceText, int start, int length) { // Initialize internal character buffer if necessary if (m_TextParsingBuffer == null) m_TextParsingBuffer = new UnicodeChar[8]; #if UNITY_EDITOR // Create new string to be displayed in the Input Text Box of the Editor Panel. if (sourceText == null || sourceText.Length == 0 || length == 0) { m_text = string.Empty; start = 0; length = 0; } else { // TODO: Add potential range check on start + length relative to array size. m_text = new string(sourceText, start, length); } #endif // Clear the Style stack. m_styleStack.Clear(); int writeIndex = 0; int i = start; int end = start + length; for (; i < end; i++) { if (sourceText[i] == 92 && i < length - 1) { switch ((int)sourceText[i + 1]) { case 110: // \n LineFeed if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 10; i += 1; writeIndex += 1; continue; case 114: // \r LineFeed if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 13; i += 1; writeIndex += 1; continue; case 116: // \t Tab if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 9; i += 1; writeIndex += 1; continue; } } // Handle inline replacement of <stlye> and <br> tags. if (sourceText[i] == 60) { if (IsTagName(ref sourceText, "<BR>", i)) { if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref sourceText, "<STYLE=", i)) { int srcOffset; if (ReplaceOpeningStyleTag(ref sourceText, i, out srcOffset, ref m_TextParsingBuffer, ref writeIndex)) { i = srcOffset; continue; } } else if (IsTagName(ref sourceText, "</STYLE>", i)) { ReplaceClosingStyleTag(ref sourceText, i, ref m_TextParsingBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = sourceText[i]; writeIndex += 1; } if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 0; m_inputSource = TextInputSources.SetCharArray; m_havePropertiesChanged = true; m_isInputParsingRequired = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } /// <summary> /// Character array containing the text to be displayed. /// </summary> /// <param name="sourceText"></param> public void SetCharArray(int[] sourceText, int start, int length) { // Initialize internal character buffer if necessary if (m_TextParsingBuffer == null) m_TextParsingBuffer = new UnicodeChar[8]; #if UNITY_EDITOR // Create new string to be displayed in the Input Text Box of the Editor Panel. if (sourceText == null || sourceText.Length == 0 || length == 0) { m_text = string.Empty; start = 0; length = 0; } else { m_text = sourceText.IntToString(start, length); } #endif // Clear the Style stack. m_styleStack.Clear(); int writeIndex = 0; int end = start + length; for (int i = start; i < end && i < sourceText.Length; i++) { if (sourceText[i] == 92 && i < length - 1) { switch ((int)sourceText[i + 1]) { case 110: // \n LineFeed if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 10; i += 1; writeIndex += 1; continue; case 114: // \r LineFeed if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 13; i += 1; writeIndex += 1; continue; case 116: // \t Tab if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 9; i += 1; writeIndex += 1; continue; } } // Handle inline replacement of <stlye> and <br> tags. if (sourceText[i] == 60) { if (IsTagName(ref sourceText, "<BR>", i)) { if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref sourceText, "<STYLE=", i)) { int srcOffset; if (ReplaceOpeningStyleTag(ref sourceText, i, out srcOffset, ref m_TextParsingBuffer, ref writeIndex)) { i = srcOffset; continue; } } else if (IsTagName(ref sourceText, "</STYLE>", i)) { ReplaceClosingStyleTag(ref sourceText, i, ref m_TextParsingBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = sourceText[i]; writeIndex += 1; } if (writeIndex == m_TextParsingBuffer.Length) ResizeInternalArray(ref m_TextParsingBuffer); m_TextParsingBuffer[writeIndex].unicode = 0; m_inputSource = TextInputSources.SetCharArray; m_havePropertiesChanged = true; m_isInputParsingRequired = true; m_isCalculateSizeRequired = true; SetVerticesDirty(); SetLayoutDirty(); } /// <summary> /// Copies Content of formatted SetText() to charBuffer. /// </summary> /// <param name="sourceText"></param> /// <param name="charBuffer"></param> protected void SetTextArrayToCharArray(char[] sourceText, ref UnicodeChar[] charBuffer) { //Debug.Log("SetText Array to Char called."); if (sourceText == null || m_charArray_Length == 0) return; if (charBuffer == null) charBuffer = new UnicodeChar[8]; // Clear the Style stack. m_styleStack.Clear(); int writeIndex = 0; for (int i = 0; i < m_charArray_Length; i++) { // Handle UTF-32 in the input text (string). if (char.IsHighSurrogate(sourceText[i]) && char.IsLowSurrogate(sourceText[i + 1])) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = char.ConvertToUtf32(sourceText[i], sourceText[i + 1]); i += 1; writeIndex += 1; continue; } // Handle inline replacement of <stlye> and <br> tags. if (sourceText[i] == 60) { if (IsTagName(ref sourceText, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref sourceText, "<STYLE=", i)) { int srcOffset; if (ReplaceOpeningStyleTag(ref sourceText, i, out srcOffset, ref charBuffer, ref writeIndex)) { i = srcOffset; continue; } } else if (IsTagName(ref sourceText, "</STYLE>", i)) { ReplaceClosingStyleTag(ref sourceText, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = sourceText[i]; writeIndex += 1; } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 0; } /// <summary> /// Method to store the content of a string into an integer array. /// </summary> /// <param name="sourceText"></param> /// <param name="charBuffer"></param> protected void StringToCharArray(string sourceText, ref UnicodeChar[] charBuffer) { if (sourceText == null) { charBuffer[0].unicode = 0; return; } if (charBuffer == null) charBuffer = new UnicodeChar[8]; // Clear the Style stack. m_styleStack.SetDefault(0); int writeIndex = 0; for (int i = 0; i < sourceText.Length; i++) { if (m_inputSource == TextInputSources.Text && sourceText[i] == 92 && sourceText.Length > i + 1) { switch ((int)sourceText[i + 1]) { case 85: // \U00000000 for UTF-32 Unicode if (sourceText.Length > i + 9) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = GetUTF32(sourceText, i + 2); charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 10; i += 9; writeIndex += 1; continue; } break; case 92: // \ escape if (!m_parseCtrlCharacters) break; if (sourceText.Length <= i + 2) break; if (writeIndex + 2 > charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = sourceText[i + 1]; charBuffer[writeIndex + 1].unicode = sourceText[i + 2]; i += 2; writeIndex += 2; continue; case 110: // \n LineFeed if (!m_parseCtrlCharacters) break; if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 1; i += 1; writeIndex += 1; continue; case 114: // \r if (!m_parseCtrlCharacters) break; if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 13; charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 1; i += 1; writeIndex += 1; continue; case 116: // \t Tab if (!m_parseCtrlCharacters) break; if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 9; charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 1; i += 1; writeIndex += 1; continue; case 117: // \u0000 for UTF-16 Unicode if (sourceText.Length > i + 5) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = GetUTF16(sourceText, i + 2); charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 6; i += 5; writeIndex += 1; continue; } break; } } // Handle UTF-32 in the input text (string). // Not sure this is needed // if (char.IsHighSurrogate(sourceText[i]) && char.IsLowSurrogate(sourceText[i + 1])) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = char.ConvertToUtf32(sourceText[i], sourceText[i + 1]); charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 2; i += 1; writeIndex += 1; continue; } //// Handle inline replacement of <stlye> and <br> tags. if (sourceText[i] == 60 && m_isRichText) { if (IsTagName(ref sourceText, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 1; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref sourceText, "<STYLE=", i)) { int srcOffset; if (ReplaceOpeningStyleTag(ref sourceText, i, out srcOffset, ref charBuffer, ref writeIndex)) { i = srcOffset; continue; } } else if (IsTagName(ref sourceText, "</STYLE>", i)) { ReplaceClosingStyleTag(ref sourceText, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = sourceText[i]; charBuffer[writeIndex].stringIndex = i; charBuffer[writeIndex].length = 1; writeIndex += 1; } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 0; } /// <summary> /// Copy contents of StringBuilder into int array. /// </summary> /// <param name="sourceText">Text to copy.</param> /// <param name="charBuffer">Array to store contents.</param> protected void StringBuilderToIntArray(StringBuilder sourceText, ref UnicodeChar[] charBuffer) { if (sourceText == null) { charBuffer[0].unicode = 0; return; } if (charBuffer == null) charBuffer = new UnicodeChar[8]; // Clear the Style stack. m_styleStack.Clear(); #if UNITY_EDITOR // Create new string to be displayed in the Input Text Box of the Editor Panel. m_text = sourceText.ToString(); #endif int writeIndex = 0; for (int i = 0; i < sourceText.Length; i++) { if (m_parseCtrlCharacters && sourceText[i] == 92 && sourceText.Length > i + 1) { switch ((int)sourceText[i + 1]) { case 85: // \U00000000 for UTF-32 Unicode if (sourceText.Length > i + 9) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = GetUTF32(sourceText, i + 2); i += 9; writeIndex += 1; continue; } break; case 92: // \ escape if (sourceText.Length <= i + 2) break; if (writeIndex + 2 > charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = sourceText[i + 1]; charBuffer[writeIndex + 1].unicode = sourceText[i + 2]; i += 2; writeIndex += 2; continue; case 110: // \n LineFeed if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; i += 1; writeIndex += 1; continue; case 114: // \r if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 13; i += 1; writeIndex += 1; continue; case 116: // \t Tab if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 9; i += 1; writeIndex += 1; continue; case 117: // \u0000 for UTF-16 Unicode if (sourceText.Length > i + 5) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = GetUTF16(sourceText, i + 2); i += 5; writeIndex += 1; continue; } break; } } // Handle UTF-32 in the input text (string). if (char.IsHighSurrogate(sourceText[i]) && char.IsLowSurrogate(sourceText[i + 1])) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = char.ConvertToUtf32(sourceText[i], sourceText[i + 1]); i += 1; writeIndex += 1; continue; } // Handle inline replacement of <stlye> and <br> tags. if (sourceText[i] == 60) { if (IsTagName(ref sourceText, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref sourceText, "<STYLE=", i)) { int srcOffset; if (ReplaceOpeningStyleTag(ref sourceText, i, out srcOffset, ref charBuffer, ref writeIndex)) { i = srcOffset; continue; } } else if (IsTagName(ref sourceText, "</STYLE>", i)) { ReplaceClosingStyleTag(ref sourceText, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = sourceText[i]; writeIndex += 1; } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 0; } /// <summary> /// Method to handle inline replacement of style tag by opening style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="srcOffset"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceOpeningStyleTag(ref string sourceText, int srcIndex, out int srcOffset, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Validate <style> tag. int hashCode = GetTagHashCode(ref sourceText, srcIndex + 7, out srcOffset); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); // Return if we don't have a valid style. if (style == null || srcOffset == 0) return false; m_styleStack.Add(style.hashCode); int styleLength = style.styleOpeningTagArray.Length; // Replace <style> tag with opening definition int[] openingTagArray = style.styleOpeningTagArray; for (int i = 0; i < styleLength; i++) { int c = openingTagArray[i]; if (c == 60) { if (IsTagName(ref openingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref openingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref openingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref openingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref openingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by opening style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="srcOffset"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceOpeningStyleTag(ref int[] sourceText, int srcIndex, out int srcOffset, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Validate <style> tag. int hashCode = GetTagHashCode(ref sourceText, srcIndex + 7, out srcOffset); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); // Return if we don't have a valid style. if (style == null || srcOffset == 0) return false; m_styleStack.Add(style.hashCode); int styleLength = style.styleOpeningTagArray.Length; // Replace <style> tag with opening definition int[] openingTagArray = style.styleOpeningTagArray; for (int i = 0; i < styleLength; i++) { int c = openingTagArray[i]; if (c == 60) { if (IsTagName(ref openingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref openingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref openingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref openingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref openingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by opening style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="srcOffset"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceOpeningStyleTag(ref char[] sourceText, int srcIndex, out int srcOffset, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Validate <style> tag. int hashCode = GetTagHashCode(ref sourceText, srcIndex + 7, out srcOffset); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); // Return if we don't have a valid style. if (style == null || srcOffset == 0) return false; m_styleStack.Add(style.hashCode); int styleLength = style.styleOpeningTagArray.Length; // Replace <style> tag with opening definition int[] openingTagArray = style.styleOpeningTagArray; for (int i = 0; i < styleLength; i++) { int c = openingTagArray[i]; if (c == 60) { if (IsTagName(ref openingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref openingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref openingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref openingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref openingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by opening style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="srcOffset"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceOpeningStyleTag(ref StringBuilder sourceText, int srcIndex, out int srcOffset, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Validate <style> tag. int hashCode = GetTagHashCode(ref sourceText, srcIndex + 7, out srcOffset); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); // Return if we don't have a valid style. if (style == null || srcOffset == 0) return false; m_styleStack.Add(style.hashCode); int styleLength = style.styleOpeningTagArray.Length; // Replace <style> tag with opening definition int[] openingTagArray = style.styleOpeningTagArray; for (int i = 0; i < styleLength; i++) { int c = openingTagArray[i]; if (c == 60) { if (IsTagName(ref openingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref openingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref openingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref openingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref openingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by closing style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceClosingStyleTag(ref string sourceText, int srcIndex, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Get style from the Style Stack int hashCode = m_styleStack.CurrentItem(); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); m_styleStack.Remove(); // Return if we don't have a valid style. if (style == null) return false; int styleLength = style.styleClosingTagArray.Length; // Replace <style> tag with opening definition int[] closingTagArray = style.styleClosingTagArray; for (int i = 0; i < styleLength; i++) { int c = closingTagArray[i]; if (c == 60) { if (IsTagName(ref closingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref closingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref closingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref closingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref closingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by closing style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceClosingStyleTag(ref int[] sourceText, int srcIndex, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Get style from the Style Stack int hashCode = m_styleStack.CurrentItem(); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); m_styleStack.Remove(); // Return if we don't have a valid style. if (style == null) return false; int styleLength = style.styleClosingTagArray.Length; // Replace <style> tag with opening definition int[] closingTagArray = style.styleClosingTagArray; for (int i = 0; i < styleLength; i++) { int c = closingTagArray[i]; if (c == 60) { if (IsTagName(ref closingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref closingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref closingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref closingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref closingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by closing style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceClosingStyleTag(ref char[] sourceText, int srcIndex, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Get style from the Style Stack int hashCode = m_styleStack.CurrentItem(); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); m_styleStack.Remove(); // Return if we don't have a valid style. if (style == null) return false; int styleLength = style.styleClosingTagArray.Length; // Replace <style> tag with opening definition int[] closingTagArray = style.styleClosingTagArray; for (int i = 0; i < styleLength; i++) { int c = closingTagArray[i]; if (c == 60) { if (IsTagName(ref closingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref closingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref closingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref closingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref closingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to handle inline replacement of style tag by closing style definition. /// </summary> /// <param name="sourceText"></param> /// <param name="srcIndex"></param> /// <param name="charBuffer"></param> /// <param name="writeIndex"></param> /// <returns></returns> bool ReplaceClosingStyleTag(ref StringBuilder sourceText, int srcIndex, ref UnicodeChar[] charBuffer, ref int writeIndex) { // Get style from the Style Stack int hashCode = m_styleStack.CurrentItem(); TMP_Style style = TMP_StyleSheet.GetStyle(hashCode); m_styleStack.Remove(); // Return if we don't have a valid style. if (style == null) return false; int styleLength = style.styleClosingTagArray.Length; // Replace <style> tag with opening definition int[] closingTagArray = style.styleClosingTagArray; for (int i = 0; i < styleLength; i++) { int c = closingTagArray[i]; if (c == 60) { if (IsTagName(ref closingTagArray, "<BR>", i)) { if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = 10; writeIndex += 1; i += 3; continue; } else if (IsTagName(ref closingTagArray, "<STYLE=", i)) { int offset; if (ReplaceOpeningStyleTag(ref closingTagArray, i, out offset, ref charBuffer, ref writeIndex)) { i = offset; continue; } } else if (IsTagName(ref closingTagArray, "</STYLE>", i)) { ReplaceClosingStyleTag(ref closingTagArray, i, ref charBuffer, ref writeIndex); // Strip </style> even if style is invalid. i += 7; continue; } } if (writeIndex == charBuffer.Length) ResizeInternalArray(ref charBuffer); charBuffer[writeIndex].unicode = c; writeIndex += 1; } return true; } /// <summary> /// Method to check for a matching rich text tag. /// </summary> /// <param name="text"></param> /// <param name="tag"></param> /// <param name="index"></param> /// <returns></returns> bool IsTagName (ref string text, string tag, int index) { if (text.Length < index + tag.Length) return false; for (int i = 0; i < tag.Length; i++) { if (TMP_TextUtilities.ToUpperFast(text[index + i]) != tag[i]) return false; } return true; } /// <summary> /// Method to check for a matching rich text tag. /// </summary> /// <param name="text"></param> /// <param name="tag"></param> /// <param name="index"></param> /// <returns></returns> bool IsTagName(ref char[] text, string tag, int index) { if (text.Length < index + tag.Length) return false; for (int i = 0; i < tag.Length; i++) { if (TMP_TextUtilities.ToUpperFast(text[index + i]) != tag[i]) return false; } return true; } /// <summary> /// Method to check for a matching rich text tag. /// </summary> /// <param name="text"></param> /// <param name="tag"></param> /// <param name="index"></param> /// <returns></returns> bool IsTagName(ref int[] text, string tag, int index) { if (text.Length < index + tag.Length) return false; for (int i = 0; i < tag.Length; i++) { if (TMP_TextUtilities.ToUpperFast((char)text[index + i]) != tag[i]) return false; } return true; } /// <summary> /// Method to check for a matching rich text tag. /// </summary> /// <param name="text"></param> /// <param name="tag"></param> /// <param name="index"></param> /// <returns></returns> bool IsTagName(ref StringBuilder text, string tag, int index) { if (text.Length < index + tag.Length) return false; for (int i = 0; i < tag.Length; i++) { if (TMP_TextUtilities.ToUpperFast(text[index + i]) != tag[i]) return false; } return true; } /// <summary> /// Get Hashcode for a given tag. /// </summary> /// <param name="text"></param> /// <param name="index"></param> /// <param name="closeIndex"></param> /// <returns></returns> int GetTagHashCode(ref string text, int index, out int closeIndex) { int hashCode = 0; closeIndex = 0; for (int i = index; i < text.Length; i++) { // Skip quote '"' character if (text[i] == 34) continue; // Break at '>' if (text[i] == 62) { closeIndex = i; break; } hashCode = (hashCode << 5) + hashCode ^ text[i]; } return hashCode; } /// <summary> /// Get Hashcode for a given tag. /// </summary> /// <param name="text"></param> /// <param name="index"></param> /// <param name="closeIndex"></param> /// <returns></returns> int GetTagHashCode(ref char[] text, int index, out int closeIndex) { int hashCode = 0; closeIndex = 0; for (int i = index; i < text.Length; i++) { // Skip quote '"' character if (text[i] == 34) continue; // Break at '>' if (text[i] == 62) { closeIndex = i; break; } hashCode = (hashCode << 5) + hashCode ^ text[i]; } return hashCode; } /// <summary> /// Get Hashcode for a given tag. /// </summary> /// <param name="text"></param> /// <param name="index"></param> /// <param name="closeIndex"></param> /// <returns></returns> int GetTagHashCode(ref int[] text, int index, out int closeIndex) { int hashCode = 0; closeIndex = 0; for (int i = index; i < text.Length; i++) { // Skip quote '"' character if (text[i] == 34) continue; // Break at '>' if (text[i] == 62) { closeIndex = i; break; } hashCode = (hashCode << 5) + hashCode ^ text[i]; } return hashCode; } /// <summary> /// Get Hashcode for a given tag. /// </summary> /// <param name="text"></param> /// <param name="index"></param> /// <param name="closeIndex"></param> /// <returns></returns> int GetTagHashCode(ref StringBuilder text, int index, out int closeIndex) { int hashCode = 0; closeIndex = 0; for (int i = index; i < text.Length; i++) { // Skip quote '"' character if (text[i] == 34) continue; // Break at '>' if (text[i] == 62) { closeIndex = i; break; } hashCode = (hashCode << 5) + hashCode ^ text[i]; } return hashCode; } /// <summary> /// /// </summary> void ResizeInternalArray <T>(ref T[] array) { int size = Mathf.NextPowerOfTwo(array.Length + 1); System.Array.Resize(ref array, size); } private readonly float[] k_Power = { 5e-1f, 5e-2f, 5e-3f, 5e-4f, 5e-5f, 5e-6f, 5e-7f, 5e-8f, 5e-9f, 5e-10f }; // Used by FormatText to enable rounding and avoid using Mathf.Pow. /// <summary> /// Function used in conjunction with SetText() /// </summary> /// <param name="number"></param> /// <param name="index"></param> /// <param name="precision"></param> protected void AddFloatToCharArray(double number, ref int index, int precision) { if (number < 0) { m_input_CharArray[index++] = '-'; number = -number; } number += k_Power[Mathf.Min(9, precision)]; double integer = Math.Truncate(number); AddIntToCharArray(integer, ref index, precision); if (precision > 0) { // Add the decimal point m_input_CharArray[index++] = '.'; number -= integer; for (int p = 0; p < precision; p++) { number *= 10; long d = (long)(number); m_input_CharArray[index++] = (char)(d + 48); number -= d; } } } /// <summary> /// // Function used in conjunction with SetText() /// </summary> /// <param name="number"></param> /// <param name="index"></param> /// <param name="precision"></param> protected void AddIntToCharArray(double number, ref int index, int precision) { if (number < 0) { m_input_CharArray[index++] = '-'; number = -number; } int i = index; do { m_input_CharArray[i++] = (char)(number % 10 + 48); number /= 10; } while (number > 0.999d); int lastIndex = i; // Reverse string while (index + 1 < i) { i -= 1; char t = m_input_CharArray[index]; m_input_CharArray[index] = m_input_CharArray[i]; m_input_CharArray[i] = t; index += 1; } index = lastIndex; } /// <summary> /// Method used to determine the number of visible characters and required buffer allocations. /// </summary> /// <param name="chars"></param> /// <returns></returns> protected virtual int SetArraySizes(UnicodeChar[] chars) { return 0; } /// <summary> /// Method which parses the text input, does the layout of the text as well as generating the geometry. /// </summary> protected virtual void GenerateTextMesh() { } /// <summary> /// Function to Calculate the Preferred Width and Height of the text object. /// </summary> /// <returns></returns> public Vector2 GetPreferredValues() { if (m_isInputParsingRequired || m_isTextTruncated) { m_isCalculatingPreferredValues = true; ParseInputText(); } // CALCULATE PREFERRED WIDTH float preferredWidth = GetPreferredWidth(); // CALCULATE PREFERRED HEIGHT float preferredHeight = GetPreferredHeight(); return new Vector2(preferredWidth, preferredHeight); } /// <summary> /// Function to Calculate the Preferred Width and Height of the text object given the provided width and height. /// </summary> /// <returns></returns> public Vector2 GetPreferredValues(float width, float height) { if (m_isInputParsingRequired || m_isTextTruncated) { m_isCalculatingPreferredValues = true; ParseInputText(); } Vector2 margin = new Vector2(width, height); // CALCULATE PREFERRED WIDTH float preferredWidth = GetPreferredWidth(margin); // CALCULATE PREFERRED HEIGHT float preferredHeight = GetPreferredHeight(margin); return new Vector2(preferredWidth, preferredHeight); } /// <summary> /// Function to Calculate the Preferred Width and Height of the text object given a certain string. /// </summary> /// <param name="text"></param> /// <returns></returns> public Vector2 GetPreferredValues(string text) { m_isCalculatingPreferredValues = true; StringToCharArray(text, ref m_TextParsingBuffer); SetArraySizes(m_TextParsingBuffer); Vector2 margin = k_LargePositiveVector2; // CALCULATE PREFERRED WIDTH float preferredWidth = GetPreferredWidth(margin); // CALCULATE PREFERRED HEIGHT float preferredHeight = GetPreferredHeight(margin); return new Vector2(preferredWidth, preferredHeight); } /// <summary> /// Function to Calculate the Preferred Width and Height of the text object given a certain string and size of text container. /// </summary> /// <param name="text"></param> /// <returns></returns> public Vector2 GetPreferredValues(string text, float width, float height) { m_isCalculatingPreferredValues = true; StringToCharArray(text, ref m_TextParsingBuffer); SetArraySizes(m_TextParsingBuffer); Vector2 margin = new Vector2(width, height); // CALCULATE PREFERRED WIDTH float preferredWidth = GetPreferredWidth(margin); // CALCULATE PREFERRED HEIGHT float preferredHeight = GetPreferredHeight(margin); return new Vector2(preferredWidth, preferredHeight); } /// <summary> /// Method to calculate the preferred width of a text object. /// </summary> /// <returns></returns> protected float GetPreferredWidth() { if (TMP_Settings.instance == null) return 0; float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize; // Reset auto sizing point size bounds m_minFontSize = m_fontSizeMin; m_maxFontSize = m_fontSizeMax; m_charWidthAdjDelta = 0; // Set Margins to Infinity Vector2 margin = k_LargePositiveVector2; if (m_isInputParsingRequired || m_isTextTruncated) { m_isCalculatingPreferredValues = true; ParseInputText(); } m_recursiveCount = 0; float preferredWidth = CalculatePreferredValues(fontSize, margin, true).x; m_isPreferredWidthDirty = false; //Debug.Log("GetPreferredWidth() Called at frame " + Time.frameCount + ". Returning width of " + preferredWidth); return preferredWidth; } /// <summary> /// Method to calculate the preferred width of a text object. /// </summary> /// <param name="margin"></param> /// <returns></returns> protected float GetPreferredWidth(Vector2 margin) { float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize; // Reset auto sizing point size bounds m_minFontSize = m_fontSizeMin; m_maxFontSize = m_fontSizeMax; m_charWidthAdjDelta = 0; m_recursiveCount = 0; float preferredWidth = CalculatePreferredValues(fontSize, margin, true).x; //Debug.Log("GetPreferredWidth() Called. Returning width of " + preferredWidth); return preferredWidth; } /// <summary> /// Method to calculate the preferred height of a text object. /// </summary> /// <returns></returns> protected float GetPreferredHeight() { if (TMP_Settings.instance == null) return 0; float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize; // Reset auto sizing point size bounds m_minFontSize = m_fontSizeMin; m_maxFontSize = m_fontSizeMax; m_charWidthAdjDelta = 0; Vector2 margin = new Vector2(m_marginWidth != 0 ? m_marginWidth : k_LargePositiveFloat, k_LargePositiveFloat); if (m_isInputParsingRequired || m_isTextTruncated) { m_isCalculatingPreferredValues = true; ParseInputText(); } m_recursiveCount = 0; float preferredHeight = CalculatePreferredValues(fontSize, margin, !m_enableAutoSizing).y; m_isPreferredHeightDirty = false; //Debug.Log("GetPreferredHeight() Called. Returning height of " + preferredHeight); return preferredHeight; } /// <summary> /// Method to calculate the preferred height of a text object. /// </summary> /// <param name="margin"></param> /// <returns></returns> protected float GetPreferredHeight(Vector2 margin) { float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize; // Reset auto sizing point size bounds m_minFontSize = m_fontSizeMin; m_maxFontSize = m_fontSizeMax; m_charWidthAdjDelta = 0; m_recursiveCount = 0; float preferredHeight = CalculatePreferredValues(fontSize, margin, true).y; //Debug.Log("GetPreferredHeight() Called. Returning height of " + preferredHeight); return preferredHeight; } /// <summary> /// Method returning the rendered width and height of the text object. /// </summary> /// <returns></returns> public Vector2 GetRenderedValues() { return GetTextBounds().size; } /// <summary> /// /// </summary> /// <param name="onlyVisibleCharacters">Should returned value only factor in visible characters and exclude those greater than maxVisibleCharacters for instance.</param> /// <returns></returns> public Vector2 GetRenderedValues(bool onlyVisibleCharacters) { return GetTextBounds(onlyVisibleCharacters).size; } /// <summary> /// Method returning the rendered width of the text object. /// </summary> /// <returns></returns> protected float GetRenderedWidth() { return GetRenderedValues().x; } /// <summary> /// Method returning the rendered width of the text object. /// </summary> /// <returns></returns> protected float GetRenderedWidth(bool onlyVisibleCharacters) { return GetRenderedValues(onlyVisibleCharacters).x; } /// <summary> /// Method returning the rendered height of the text object. /// </summary> /// <returns></returns> protected float GetRenderedHeight() { return GetRenderedValues().y; } /// <summary> /// Method returning the rendered height of the text object. /// </summary> /// <returns></returns> protected float GetRenderedHeight(bool onlyVisibleCharacters) { return GetRenderedValues(onlyVisibleCharacters).y; } /// <summary> /// Method to calculate the preferred width and height of the text object. /// </summary> /// <returns></returns> protected virtual Vector2 CalculatePreferredValues(float defaultFontSize, Vector2 marginSize, bool ignoreTextAutoSizing) { //Debug.Log("*** CalculatePreferredValues() ***"); // ***** Frame: " + Time.frameCount); ////Profiler.BeginSample("TMP Generate Text - Phase I"); // Early exit if no font asset was assigned. This should not be needed since LiberationSans SDF will be assigned by default. if (m_fontAsset == null || m_fontAsset.characterLookupTable == null) { Debug.LogWarning("Can't Generate Mesh! No Font Asset has been assigned to Object ID: " + this.GetInstanceID()); return Vector2.zero; } // Early exit if we don't have any Text to generate. if (m_TextParsingBuffer == null || m_TextParsingBuffer.Length == 0 || m_TextParsingBuffer[0].unicode == (char)0) { return Vector2.zero; } m_currentFontAsset = m_fontAsset; m_currentMaterial = m_sharedMaterial; m_currentMaterialIndex = 0; m_materialReferenceStack.SetDefault(new MaterialReference(0, m_currentFontAsset, null, m_currentMaterial, m_padding)); // Total character count is computed when the text is parsed. int totalCharacterCount = m_totalCharacterCount; // m_VisibleCharacters.Count; if (m_internalCharacterInfo == null || totalCharacterCount > m_internalCharacterInfo.Length) { m_internalCharacterInfo = new TMP_CharacterInfo[totalCharacterCount > 1024 ? totalCharacterCount + 256 : Mathf.NextPowerOfTwo(totalCharacterCount)]; } // Calculate the scale of the font based on selected font size and sampling point size. // baseScale is calculated using the font asset assigned to the text object. float baseScale = m_fontScale = (defaultFontSize / m_fontAsset.faceInfo.pointSize * m_fontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); float currentElementScale = baseScale; m_fontScaleMultiplier = 1; m_currentFontSize = defaultFontSize; m_sizeStack.SetDefault(m_currentFontSize); float fontSizeDelta = 0; int charCode = 0; // Holds the character code of the currently being processed character. m_FontStyleInternal = m_fontStyle; // Set the default style. m_lineJustification = m_textAlignment; // Sets the line justification mode to match editor alignment. m_lineJustificationStack.SetDefault(m_lineJustification); float bold_xAdvance_multiplier = 1; // Used to increase spacing between character when style is bold. m_baselineOffset = 0; // Used by subscript characters. m_baselineOffsetStack.Clear(); m_lineOffset = 0; // Amount of space between lines (font line spacing + m_linespacing). m_lineHeight = TMP_Math.FLOAT_UNSET; float lineGap = m_currentFontAsset.faceInfo.lineHeight - (m_currentFontAsset.faceInfo.ascentLine - m_currentFontAsset.faceInfo.descentLine); m_cSpacing = 0; // Amount of space added between characters as a result of the use of the <cspace> tag. m_monoSpacing = 0; float lineOffsetDelta = 0; m_xAdvance = 0; // Used to track the position of each character. float maxXAdvance = 0; // Used to determine Preferred Width. tag_LineIndent = 0; // Used for indentation of text. tag_Indent = 0; m_indentStack.SetDefault(0); tag_NoParsing = false; //m_isIgnoringAlignment = false; m_characterCount = 0; // Total characters in the char[] // Tracking of line information m_firstCharacterOfLine = 0; m_maxLineAscender = k_LargeNegativeFloat; m_maxLineDescender = k_LargePositiveFloat; m_lineNumber = 0; float marginWidth = marginSize.x; //float marginHeight = marginSize.y; m_marginLeft = 0; m_marginRight = 0; m_width = -1; // Used by Unity's Auto Layout system. float renderedWidth = 0; float renderedHeight = 0; float linebreakingWidth = 0; m_isCalculatingPreferredValues = true; // Tracking of the highest Ascender m_maxAscender = 0; m_maxDescender = 0; // Initialize struct to track states of word wrapping bool isFirstWord = true; bool isLastBreakingChar = false; WordWrapState savedLineState = new WordWrapState(); SaveWordWrappingState(ref savedLineState, 0, 0); WordWrapState savedWordWrapState = new WordWrapState(); int wrappingIndex = 0; // Counter to prevent recursive lockup when computing preferred values. m_recursiveCount += 1; // Parse through Character buffer to read HTML tags and begin creating mesh. for (int i = 0; m_TextParsingBuffer[i].unicode != 0; i++) { charCode = (int)m_TextParsingBuffer[i].unicode; // Parse Rich Text Tag #region Parse Rich Text Tag if (m_isRichText && charCode == 60) // '<' { m_isParsingText = true; m_textElementType = TMP_TextElementType.Character; int endTagIndex; // Check if Tag is valid. If valid, skip to the end of the validated tag. if (ValidateHtmlTag(m_TextParsingBuffer, i + 1, out endTagIndex)) { i = endTagIndex; // Continue to next character or handle the sprite element if (m_textElementType == TMP_TextElementType.Character) continue; } } else { m_textElementType = m_textInfo.characterInfo[m_characterCount].elementType; m_currentMaterialIndex = m_textInfo.characterInfo[m_characterCount].materialReferenceIndex; m_currentFontAsset = m_textInfo.characterInfo[m_characterCount].fontAsset; } #endregion End Parse Rich Text Tag int prev_MaterialIndex = m_currentMaterialIndex; bool isUsingAltTypeface = m_textInfo.characterInfo[m_characterCount].isUsingAlternateTypeface; m_isParsingText = false; // Handle Font Styles like LowerCase, UpperCase and SmallCaps. #region Handling of LowerCase, UpperCase and SmallCaps Font Styles float smallCapsMultiplier = 1.0f; if (m_textElementType == TMP_TextElementType.Character) { if (/*(m_fontStyle & FontStyles.UpperCase) == FontStyles.UpperCase ||*/ (m_FontStyleInternal & FontStyles.UpperCase) == FontStyles.UpperCase) { // If this character is lowercase, switch to uppercase. if (char.IsLower((char)charCode)) charCode = char.ToUpper((char)charCode); } else if (/*(m_fontStyle & FontStyles.LowerCase) == FontStyles.LowerCase ||*/ (m_FontStyleInternal & FontStyles.LowerCase) == FontStyles.LowerCase) { // If this character is uppercase, switch to lowercase. if (char.IsUpper((char)charCode)) charCode = char.ToLower((char)charCode); } else if (/*(m_fontStyle & FontStyles.SmallCaps) == FontStyles.SmallCaps ||*/ (m_FontStyleInternal & FontStyles.SmallCaps) == FontStyles.SmallCaps) { if (char.IsLower((char)charCode)) { smallCapsMultiplier = 0.8f; charCode = char.ToUpper((char)charCode); } } } #endregion // Look up Character Data from Dictionary and cache it. #region Look up Character Data if (m_textElementType == TMP_TextElementType.Sprite) { // If a sprite is used as a fallback then get a reference to it and set the color to white. m_currentSpriteAsset = m_textInfo.characterInfo[m_characterCount].spriteAsset; m_spriteIndex = m_textInfo.characterInfo[m_characterCount].spriteIndex; TMP_SpriteCharacter sprite = m_currentSpriteAsset.spriteCharacterTable[m_spriteIndex]; if (sprite == null) continue; // Sprites are assigned in the E000 Private Area + sprite Index if (charCode == 60) charCode = 57344 + m_spriteIndex; m_currentFontAsset = m_fontAsset; // The sprite scale calculations are based on the font asset assigned to the text object. // Sprite scale is used to determine line height // Current element scale represents a modified scale to normalize the sprite based on the font baseline to ascender. float spriteScale = (m_currentFontSize / m_fontAsset.faceInfo.pointSize * m_fontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); currentElementScale = m_fontAsset.faceInfo.ascentLine / sprite.glyph.metrics.height * sprite.scale * spriteScale; m_cached_TextElement = sprite; m_internalCharacterInfo[m_characterCount].elementType = TMP_TextElementType.Sprite; m_internalCharacterInfo[m_characterCount].scale = spriteScale; //m_internalCharacterInfo[m_characterCount].spriteAsset = m_currentSpriteAsset; //m_internalCharacterInfo[m_characterCount].fontAsset = m_currentFontAsset; //m_internalCharacterInfo[m_characterCount].materialReferenceIndex = m_currentMaterialIndex; m_currentMaterialIndex = prev_MaterialIndex; } else if (m_textElementType == TMP_TextElementType.Character) { m_cached_TextElement = m_textInfo.characterInfo[m_characterCount].textElement; if (m_cached_TextElement == null) continue; //m_currentFontAsset = m_textInfo.characterInfo[m_characterCount].fontAsset; //m_currentMaterial = m_textInfo.characterInfo[m_characterCount].material; m_currentMaterialIndex = m_textInfo.characterInfo[m_characterCount].materialReferenceIndex; // Re-calculate font scale as the font asset may have changed. m_fontScale = m_currentFontSize * smallCapsMultiplier / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f); currentElementScale = m_fontScale * m_fontScaleMultiplier * m_cached_TextElement.scale; m_internalCharacterInfo[m_characterCount].elementType = TMP_TextElementType.Character; } #endregion // Handle Soft Hyphen #region Handle Soft Hyphen float old_scale = currentElementScale; if (charCode == 0xAD) { currentElementScale = 0; } #endregion // Store some of the text object's information m_internalCharacterInfo[m_characterCount].character = (char)charCode; // Handle Kerning if Enabled. #region Handle Kerning TMP_GlyphValueRecord glyphAdjustments = new TMP_GlyphValueRecord(); float characterSpacingAdjustment = m_characterSpacing; if (m_enableKerning) { TMP_GlyphPairAdjustmentRecord adjustmentPair; if (m_characterCount < totalCharacterCount - 1) { uint firstGlyphIndex = m_cached_TextElement.glyphIndex; uint secondGlyphIndex = m_textInfo.characterInfo[m_characterCount + 1].textElement.glyphIndex; long key = new GlyphPairKey(firstGlyphIndex, secondGlyphIndex).key; if (m_currentFontAsset.fontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.TryGetValue(key, out adjustmentPair)) { glyphAdjustments = adjustmentPair.firstAdjustmentRecord.glyphValueRecord; characterSpacingAdjustment = (adjustmentPair.featureLookupFlags & FontFeatureLookupFlags.IgnoreSpacingAdjustments) == FontFeatureLookupFlags.IgnoreSpacingAdjustments ? 0 : characterSpacingAdjustment; } } if (m_characterCount >= 1) { uint firstGlyphIndex = m_textInfo.characterInfo[m_characterCount - 1].textElement.glyphIndex; uint secondGlyphIndex = m_cached_TextElement.glyphIndex; long key = new GlyphPairKey(firstGlyphIndex, secondGlyphIndex).key; if (m_currentFontAsset.fontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.TryGetValue(key, out adjustmentPair)) { glyphAdjustments += adjustmentPair.secondAdjustmentRecord.glyphValueRecord; characterSpacingAdjustment = (adjustmentPair.featureLookupFlags & FontFeatureLookupFlags.IgnoreSpacingAdjustments) == FontFeatureLookupFlags.IgnoreSpacingAdjustments ? 0 : characterSpacingAdjustment; } } } #endregion // Initial Implementation for RTL support. #region Handle Right-to-Left //if (m_isRightToLeft) //{ // m_xAdvance -= ((m_cached_TextElement.xAdvance * bold_xAdvance_multiplier + m_characterSpacing + m_wordSpacing + m_currentFontAsset.normalSpacingOffset) * currentElementScale + m_cSpacing) * (1 - m_charWidthAdjDelta); // if (char.IsWhiteSpace((char)charCode) || charCode == 0x200B) // m_xAdvance -= m_wordSpacing * currentElementScale; //} #endregion // Handle Mono Spacing #region Handle Mono Spacing float monoAdvance = 0; if (m_monoSpacing != 0) { monoAdvance = (m_monoSpacing / 2 - (m_cached_TextElement.glyph.metrics.width / 2 + m_cached_TextElement.glyph.metrics.horizontalBearingX) * currentElementScale); m_xAdvance += monoAdvance; } #endregion // Set Padding based on selected font style #region Handle Style Padding if (m_textElementType == TMP_TextElementType.Character && !isUsingAltTypeface && ((m_FontStyleInternal & FontStyles.Bold) == FontStyles.Bold)) // Checks for any combination of Bold Style. { bold_xAdvance_multiplier = 1 + m_currentFontAsset.boldSpacing * 0.01f; } else { //style_padding = m_currentFontAsset.normalStyle * 2; bold_xAdvance_multiplier = 1.0f; } #endregion Handle Style Padding m_internalCharacterInfo[m_characterCount].baseLine = 0 - m_lineOffset + m_baselineOffset; // Compute and save text element Ascender and maximum line Ascender. float elementAscender = m_currentFontAsset.faceInfo.ascentLine * (m_textElementType == TMP_TextElementType.Character ? currentElementScale / smallCapsMultiplier : m_internalCharacterInfo[m_characterCount].scale) + m_baselineOffset; m_internalCharacterInfo[m_characterCount].ascender = elementAscender - m_lineOffset; m_maxLineAscender = elementAscender > m_maxLineAscender ? elementAscender : m_maxLineAscender; // Compute and save text element Descender and maximum line Descender. float elementDescender = m_currentFontAsset.faceInfo.descentLine * (m_textElementType == TMP_TextElementType.Character ? currentElementScale / smallCapsMultiplier: m_internalCharacterInfo[m_characterCount].scale) + m_baselineOffset; float elementDescenderII = m_internalCharacterInfo[m_characterCount].descender = elementDescender - m_lineOffset; m_maxLineDescender = elementDescender < m_maxLineDescender ? elementDescender : m_maxLineDescender; // Adjust maxLineAscender and maxLineDescender if style is superscript or subscript if ((m_FontStyleInternal & FontStyles.Subscript) == FontStyles.Subscript || (m_FontStyleInternal & FontStyles.Superscript) == FontStyles.Superscript) { float baseAscender = (elementAscender - m_baselineOffset) / m_currentFontAsset.faceInfo.subscriptSize; elementAscender = m_maxLineAscender; m_maxLineAscender = baseAscender > m_maxLineAscender ? baseAscender : m_maxLineAscender; float baseDescender = (elementDescender - m_baselineOffset) / m_currentFontAsset.faceInfo.subscriptSize; elementDescender = m_maxLineDescender; m_maxLineDescender = baseDescender < m_maxLineDescender ? baseDescender : m_maxLineDescender; } if (m_lineNumber == 0) m_maxAscender = m_maxAscender > elementAscender ? m_maxAscender : elementAscender; //if (m_lineOffset == 0) pageAscender = pageAscender > elementAscender ? pageAscender : elementAscender; // Setup Mesh for visible text elements. ie. not a SPACE / LINEFEED / CARRIAGE RETURN. #region Handle Visible Characters if (charCode == 9 || charCode == 0xA0 || charCode == 0x2007 || (!char.IsWhiteSpace((char)charCode) && charCode != 0x200B) || m_textElementType == TMP_TextElementType.Sprite) { // Check if Character exceeds the width of the Text Container #region Handle Line Breaking, Text Auto-Sizing and Horizontal Overflow float width = m_width != -1 ? Mathf.Min(marginWidth + 0.0001f - m_marginLeft - m_marginRight, m_width) : marginWidth + 0.0001f - m_marginLeft - m_marginRight; bool isJustifiedOrFlush = ((_HorizontalAlignmentOptions)m_lineJustification & _HorizontalAlignmentOptions.Flush) == _HorizontalAlignmentOptions.Flush || ((_HorizontalAlignmentOptions)m_lineJustification & _HorizontalAlignmentOptions.Justified) == _HorizontalAlignmentOptions.Justified; // Calculate the line breaking width of the text. linebreakingWidth = m_xAdvance + m_cached_TextElement.glyph.metrics.horizontalAdvance * (1 - m_charWidthAdjDelta) * (charCode != 0xAD ? currentElementScale : old_scale); // Check if Character exceeds the width of the Text Container if (linebreakingWidth > width * (isJustifiedOrFlush ? 1.05f : 1.0f)) { // Word Wrapping #region Handle Word Wrapping if (enableWordWrapping && m_characterCount != m_firstCharacterOfLine) { // Check if word wrapping is still possible #region Line Breaking Check if (wrappingIndex == savedWordWrapState.previous_WordBreak || isFirstWord) { // Word wrapping is no longer possible. Shrink size of text if auto-sizing is enabled. #region Text Auto-Sizing if (ignoreTextAutoSizing == false && m_currentFontSize > m_fontSizeMin) { // Handle Character Width Adjustments #region Character Width Adjustments if (m_charWidthAdjDelta < m_charWidthMaxAdj / 100) { m_recursiveCount = 0; m_charWidthAdjDelta += 0.01f; return CalculatePreferredValues(defaultFontSize, marginSize, false); } #endregion // Adjust Point Size m_maxFontSize = defaultFontSize; defaultFontSize -= Mathf.Max((defaultFontSize - m_minFontSize) / 2, 0.05f); defaultFontSize = (int)(Mathf.Max(defaultFontSize, m_fontSizeMin) * 20 + 0.5f) / 20f; if (m_recursiveCount > 20) return new Vector2(renderedWidth, renderedHeight); return CalculatePreferredValues(defaultFontSize, marginSize, false); } #endregion // Word wrapping is no longer possible, now breaking up individual words. if (m_isCharacterWrappingEnabled == false) { m_isCharacterWrappingEnabled = true; } else isLastBreakingChar = true; } #endregion // Restore to previously stored state of last valid (space character or linefeed) i = RestoreWordWrappingState(ref savedWordWrapState); wrappingIndex = i; // Used to detect when line length can no longer be reduced. // Handling for Soft Hyphen if (m_TextParsingBuffer[i].unicode == 0xAD) // && !m_isCharacterWrappingEnabled) // && ellipsisIndex != i && !m_isCharacterWrappingEnabled) { m_isTextTruncated = true; m_TextParsingBuffer[i].unicode = 0x2D; return CalculatePreferredValues(defaultFontSize, marginSize, true); } // Check if Line Spacing of previous line needs to be adjusted. if (m_lineNumber > 0 && !TMP_Math.Approximately(m_maxLineAscender, m_startOfLineAscender) && m_lineHeight == TMP_Math.FLOAT_UNSET) { //Debug.Log("(1) Adjusting Line Spacing on line #" + m_lineNumber); float offsetDelta = m_maxLineAscender - m_startOfLineAscender; //AdjustLineOffset(m_firstCharacterOfLine, m_characterCount, offsetDelta); m_lineOffset += offsetDelta; savedWordWrapState.lineOffset = m_lineOffset; savedWordWrapState.previousLineAscender = m_maxLineAscender; // TODO - Add check for character exceeding vertical bounds } //m_isNewPage = false; // Calculate lineAscender & make sure if last character is superscript or subscript that we check that as well. float lineAscender = m_maxLineAscender - m_lineOffset; float lineDescender = m_maxLineDescender - m_lineOffset; // Update maxDescender and maxVisibleDescender m_maxDescender = m_maxDescender < lineDescender ? m_maxDescender : lineDescender; m_firstCharacterOfLine = m_characterCount; // Store first character of the next line. // Compute Preferred Width & Height renderedWidth += m_xAdvance; if (m_enableWordWrapping) renderedHeight = m_maxAscender - m_maxDescender; else renderedHeight = Mathf.Max(renderedHeight, lineAscender - lineDescender); // Store the state of the line before starting on the new line. SaveWordWrappingState(ref savedLineState, i, m_characterCount - 1); m_lineNumber += 1; //isStartOfNewLine = true; // Check to make sure Array is large enough to hold a new line. //if (m_lineNumber >= m_internalTextInfo.lineInfo.Length) // ResizeLineExtents(m_lineNumber); // Apply Line Spacing based on scale of the last character of the line. if (m_lineHeight == TMP_Math.FLOAT_UNSET) { float ascender = m_internalCharacterInfo[m_characterCount].ascender - m_internalCharacterInfo[m_characterCount].baseLine; lineOffsetDelta = 0 - m_maxLineDescender + ascender + (lineGap + m_lineSpacing + m_lineSpacingDelta) * baseScale; m_lineOffset += lineOffsetDelta; m_startOfLineAscender = ascender; } else m_lineOffset += m_lineHeight + m_lineSpacing * baseScale; m_maxLineAscender = k_LargeNegativeFloat; m_maxLineDescender = k_LargePositiveFloat; m_xAdvance = 0 + tag_Indent; continue; } #endregion End Word Wrapping // Text Auto-Sizing (text exceeding Width of container. #region Handle Text Auto-Sizing if (ignoreTextAutoSizing == false && defaultFontSize > m_fontSizeMin) { // Handle Character Width Adjustments #region Character Width Adjustments if (m_charWidthAdjDelta < m_charWidthMaxAdj / 100) { m_recursiveCount = 0; m_charWidthAdjDelta += 0.01f; return CalculatePreferredValues(defaultFontSize, marginSize, false); } #endregion // Adjust Point Size m_maxFontSize = defaultFontSize; defaultFontSize -= Mathf.Max((defaultFontSize - m_minFontSize) / 2, 0.05f); defaultFontSize = (int)(Mathf.Max(defaultFontSize, m_fontSizeMin) * 20 + 0.5f) / 20f; if (m_recursiveCount > 20) return new Vector2(renderedWidth, renderedHeight); return CalculatePreferredValues(defaultFontSize, marginSize, false); } #endregion End Text Auto-Sizing } #endregion End Check for Characters Exceeding Width of Text Container } #endregion Handle Visible Characters // Check if Line Spacing of previous line needs to be adjusted. #region Adjust Line Spacing if (m_lineNumber > 0 && !TMP_Math.Approximately(m_maxLineAscender, m_startOfLineAscender) && m_lineHeight == TMP_Math.FLOAT_UNSET && !m_isNewPage) { //Debug.Log("Inline - Adjusting Line Spacing on line #" + m_lineNumber); //float gap = 0; // Compute gap. float offsetDelta = m_maxLineAscender - m_startOfLineAscender; //AdjustLineOffset(m_firstCharacterOfLine, m_characterCount, offsetDelta); elementDescenderII -= offsetDelta; m_lineOffset += offsetDelta; m_startOfLineAscender += offsetDelta; savedWordWrapState.lineOffset = m_lineOffset; savedWordWrapState.previousLineAscender = m_startOfLineAscender; } #endregion // Check if text Exceeds the vertical bounds of the margin area. #region Check Vertical Bounds & Auto-Sizing /* if (m_maxAscender - elementDescenderII > marginHeight + 0.0001f) { // Handle Line spacing adjustments #region Line Spacing Adjustments if (m_enableAutoSizing && m_lineSpacingDelta > m_lineSpacingMax && m_lineNumber > 0) { //loopCountA = 0; //m_lineSpacingDelta -= 1; //GenerateTextMesh(); //return; } #endregion // Handle Text Auto-sizing resulting from text exceeding vertical bounds. #region Text Auto-Sizing (Text greater than vertical bounds) if (m_enableAutoSizing && m_fontSize > m_fontSizeMin) { m_maxFontSize = m_fontSize; m_fontSize -= Mathf.Max((m_fontSize - m_minFontSize) / 2, 0.05f); m_fontSize = (int)(Mathf.Max(m_fontSize, m_fontSizeMin) * 20 + 0.5f) / 20f; //m_recursiveCount = 0; //if (loopCountA > 20) return; // Added to debug CalculatePreferredValues(m_fontSize, marginSize, false); return Vector2.zero; } #endregion Text Auto-Sizing } */ #endregion Check Vertical Bounds // Handle xAdvance & Tabulation Stops. Tab stops at every 25% of Font Size. #region XAdvance, Tabulation & Stops if (charCode == 9) { float tabSize = m_currentFontAsset.faceInfo.tabWidth * currentElementScale; float tabs = Mathf.Ceil(m_xAdvance / tabSize) * tabSize; m_xAdvance = tabs > m_xAdvance ? tabs : m_xAdvance + tabSize; } else if (m_monoSpacing != 0) { m_xAdvance += (m_monoSpacing - monoAdvance + ((characterSpacingAdjustment + m_currentFontAsset.normalSpacingOffset) * currentElementScale) + m_cSpacing) * (1 - m_charWidthAdjDelta); if (char.IsWhiteSpace((char)charCode) || charCode == 0x200B) m_xAdvance += m_wordSpacing * currentElementScale; } else { m_xAdvance += ((m_cached_TextElement.glyph.metrics.horizontalAdvance * bold_xAdvance_multiplier + characterSpacingAdjustment + m_currentFontAsset.normalSpacingOffset + glyphAdjustments.xAdvance) * currentElementScale + m_cSpacing) * (1 - m_charWidthAdjDelta); if (char.IsWhiteSpace((char)charCode) || charCode == 0x200B) m_xAdvance += m_wordSpacing * currentElementScale; } #endregion Tabulation & Stops // Handle Carriage Return #region Carriage Return if (charCode == 13) { maxXAdvance = Mathf.Max(maxXAdvance, renderedWidth + m_xAdvance); renderedWidth = 0; m_xAdvance = 0 + tag_Indent; } #endregion Carriage Return // Handle Line Spacing Adjustments + Word Wrapping & special case for last line. #region Check for Line Feed and Last Character if (charCode == 10 || m_characterCount == totalCharacterCount - 1) { // Check if Line Spacing of previous line needs to be adjusted. if (m_lineNumber > 0 && !TMP_Math.Approximately(m_maxLineAscender, m_startOfLineAscender) && m_lineHeight == TMP_Math.FLOAT_UNSET) { //Debug.Log("(2) Adjusting Line Spacing on line #" + m_lineNumber); float offsetDelta = m_maxLineAscender - m_startOfLineAscender; //AdjustLineOffset(m_firstCharacterOfLine, m_characterCount, offsetDelta); elementDescenderII -= offsetDelta; m_lineOffset += offsetDelta; } // Calculate lineAscender & make sure if last character is superscript or subscript that we check that as well. //float lineAscender = m_maxLineAscender - m_lineOffset; float lineDescender = m_maxLineDescender - m_lineOffset; // Update maxDescender and maxVisibleDescender m_maxDescender = m_maxDescender < lineDescender ? m_maxDescender : lineDescender; m_firstCharacterOfLine = m_characterCount + 1; // Store PreferredWidth paying attention to linefeed and last character of text. if (charCode == 10 && m_characterCount != totalCharacterCount - 1) { maxXAdvance = Mathf.Max(maxXAdvance, renderedWidth + linebreakingWidth); renderedWidth = 0; } else renderedWidth = Mathf.Max(maxXAdvance, renderedWidth + linebreakingWidth); renderedHeight = m_maxAscender - m_maxDescender; // Add new line if not last lines or character. if (charCode == 10) { // Store the state of the line before starting on the new line. SaveWordWrappingState(ref savedLineState, i, m_characterCount); // Store the state of the last Character before the new line. SaveWordWrappingState(ref savedWordWrapState, i, m_characterCount); m_lineNumber += 1; // Apply Line Spacing if (m_lineHeight == TMP_Math.FLOAT_UNSET) { lineOffsetDelta = 0 - m_maxLineDescender + elementAscender + (lineGap + m_lineSpacing + m_paragraphSpacing + m_lineSpacingDelta) * baseScale; m_lineOffset += lineOffsetDelta; } else m_lineOffset += m_lineHeight + (m_lineSpacing + m_paragraphSpacing) * baseScale; m_maxLineAscender = k_LargeNegativeFloat; m_maxLineDescender = k_LargePositiveFloat; m_startOfLineAscender = elementAscender; m_xAdvance = 0 + tag_LineIndent + tag_Indent; m_characterCount += 1; continue; } } #endregion Check for Linefeed or Last Character // Save State of Mesh Creation for handling of Word Wrapping #region Save Word Wrapping State if (m_enableWordWrapping || m_overflowMode == TextOverflowModes.Truncate || m_overflowMode == TextOverflowModes.Ellipsis) { if ((char.IsWhiteSpace((char)charCode) || charCode == 0x200B || charCode == 0x2D || charCode == 0xAD) && !m_isNonBreakingSpace && charCode != 0xA0 && charCode != 0x2011 && charCode != 0x202F && charCode != 0x2060) { // We store the state of numerous variables for the most recent Space, LineFeed or Carriage Return to enable them to be restored // for Word Wrapping. SaveWordWrappingState(ref savedWordWrapState, i, m_characterCount); m_isCharacterWrappingEnabled = false; isFirstWord = false; } // Handling for East Asian languages else if ((charCode > 0x1100 && charCode < 0x11ff || /* Hangul Jamo */ charCode > 0x2E80 && charCode < 0x9FFF || /* CJK */ charCode > 0xA960 && charCode < 0xA97F || /* Hangul Jame Extended-A */ charCode > 0xAC00 && charCode < 0xD7FF || /* Hangul Syllables */ charCode > 0xF900 && charCode < 0xFAFF || /* CJK Compatibility Ideographs */ charCode > 0xFE30 && charCode < 0xFE4F || /* CJK Compatibility Forms */ charCode > 0xFF00 && charCode < 0xFFEF) /* CJK Halfwidth */ && !m_isNonBreakingSpace) { if (isFirstWord || isLastBreakingChar || TMP_Settings.linebreakingRules.leadingCharacters.ContainsKey(charCode) == false && (m_characterCount < totalCharacterCount - 1 && TMP_Settings.linebreakingRules.followingCharacters.ContainsKey(m_internalCharacterInfo[m_characterCount + 1].character) == false)) { SaveWordWrappingState(ref savedWordWrapState, i, m_characterCount); m_isCharacterWrappingEnabled = false; isFirstWord = false; } } else if ((isFirstWord || m_isCharacterWrappingEnabled == true || isLastBreakingChar)) SaveWordWrappingState(ref savedWordWrapState, i, m_characterCount); } #endregion Save Word Wrapping State m_characterCount += 1; } // Check Auto Sizing and increase font size to fill text container. #region Check Auto-Sizing (Upper Font Size Bounds) fontSizeDelta = m_maxFontSize - m_minFontSize; if (!m_isCharacterWrappingEnabled && ignoreTextAutoSizing == false && fontSizeDelta > 0.051f && defaultFontSize < m_fontSizeMax) { m_minFontSize = defaultFontSize; defaultFontSize += Mathf.Max((m_maxFontSize - defaultFontSize) / 2, 0.05f); defaultFontSize = (int)(Mathf.Min(defaultFontSize, m_fontSizeMax) * 20 + 0.5f) / 20f; if (m_recursiveCount > 20) return new Vector2(renderedWidth, renderedHeight); return CalculatePreferredValues(defaultFontSize, marginSize, false); } #endregion End Auto-sizing Check m_isCharacterWrappingEnabled = false; m_isCalculatingPreferredValues = false; // Adjust Preferred Width and Height to account for Margins. renderedWidth += m_margin.x > 0 ? m_margin.x : 0; renderedWidth += m_margin.z > 0 ? m_margin.z : 0; renderedHeight += m_margin.y > 0 ? m_margin.y : 0; renderedHeight += m_margin.w > 0 ? m_margin.w : 0; // Round Preferred Values to nearest 5/100. renderedWidth = (int)(renderedWidth * 100 + 1f) / 100f; renderedHeight = (int)(renderedHeight * 100 + 1f) / 100f; //Debug.Log("Preferred Values: (" + renderedWidth + ", " + renderedHeight + ") with Recursive count of " + m_recursiveCount); ////Profiler.EndSample(); return new Vector2(renderedWidth, renderedHeight); } /// <summary> /// Method returning the compound bounds of the text object and child sub objects. /// </summary> /// <returns></returns> protected virtual Bounds GetCompoundBounds() { return new Bounds(); } /// <summary> /// Method which returns the bounds of the text object; /// </summary> /// <returns></returns> protected Bounds GetTextBounds() { if (m_textInfo == null || m_textInfo.characterCount > m_textInfo.characterInfo.Length) return new Bounds(); Extents extent = new Extents(k_LargePositiveVector2, k_LargeNegativeVector2); for (int i = 0; i < m_textInfo.characterCount && i < m_textInfo.characterInfo.Length; i++) { if (!m_textInfo.characterInfo[i].isVisible) continue; extent.min.x = Mathf.Min(extent.min.x, m_textInfo.characterInfo[i].bottomLeft.x); extent.min.y = Mathf.Min(extent.min.y, m_textInfo.characterInfo[i].descender); extent.max.x = Mathf.Max(extent.max.x, m_textInfo.characterInfo[i].xAdvance); extent.max.y = Mathf.Max(extent.max.y, m_textInfo.characterInfo[i].ascender); } Vector2 size; size.x = extent.max.x - extent.min.x; size.y = extent.max.y - extent.min.y; Vector3 center = (extent.min + extent.max) / 2; return new Bounds(center, size); } /// <summary> /// Method which returns the bounds of the text object; /// </summary> /// <param name="onlyVisibleCharacters"></param> /// <returns></returns> protected Bounds GetTextBounds(bool onlyVisibleCharacters) { if (m_textInfo == null) return new Bounds(); Extents extent = new Extents(k_LargePositiveVector2, k_LargeNegativeVector2); for (int i = 0; i < m_textInfo.characterCount; i++) { if ((i > maxVisibleCharacters || m_textInfo.characterInfo[i].lineNumber > m_maxVisibleLines) && onlyVisibleCharacters) break; if (onlyVisibleCharacters && !m_textInfo.characterInfo[i].isVisible) continue; extent.min.x = Mathf.Min(extent.min.x, m_textInfo.characterInfo[i].origin); extent.min.y = Mathf.Min(extent.min.y, m_textInfo.characterInfo[i].descender); extent.max.x = Mathf.Max(extent.max.x, m_textInfo.characterInfo[i].xAdvance); extent.max.y = Mathf.Max(extent.max.y, m_textInfo.characterInfo[i].ascender); } Vector2 size; size.x = extent.max.x - extent.min.x; size.y = extent.max.y - extent.min.y; Vector2 center = (extent.min + extent.max) / 2; return new Bounds(center, size); } /// <summary> /// Method to adjust line spacing as a result of using different fonts or font point size. /// </summary> /// <param name="startIndex"></param> /// <param name="endIndex"></param> /// <param name="offset"></param> protected virtual void AdjustLineOffset(int startIndex, int endIndex, float offset) { } /// <summary> /// Function to increase the size of the Line Extents Array. /// </summary> /// <param name="size"></param> protected void ResizeLineExtents(int size) { size = size > 1024 ? size + 256 : Mathf.NextPowerOfTwo(size + 1); TMP_LineInfo[] temp_lineInfo = new TMP_LineInfo[size]; for (int i = 0; i < size; i++) { if (i < m_textInfo.lineInfo.Length) temp_lineInfo[i] = m_textInfo.lineInfo[i]; else { temp_lineInfo[i].lineExtents.min = k_LargePositiveVector2; temp_lineInfo[i].lineExtents.max = k_LargeNegativeVector2; temp_lineInfo[i].ascender = k_LargeNegativeFloat; temp_lineInfo[i].descender = k_LargePositiveFloat; } } m_textInfo.lineInfo = temp_lineInfo; } protected static Vector2 k_LargePositiveVector2 = new Vector2(TMP_Math.INT_MAX, TMP_Math.INT_MAX); protected static Vector2 k_LargeNegativeVector2 = new Vector2(TMP_Math.INT_MIN, TMP_Math.INT_MIN); protected static float k_LargePositiveFloat = TMP_Math.FLOAT_MAX; protected static float k_LargeNegativeFloat = TMP_Math.FLOAT_MIN; protected static int k_LargePositiveInt = TMP_Math.INT_MAX; protected static int k_LargeNegativeInt = TMP_Math.INT_MIN; /// <summary> /// Function used to evaluate the length of a text string. /// </summary> /// <param name="text"></param> /// <returns></returns> public virtual TMP_TextInfo GetTextInfo(string text) { return null; } /// <summary> /// Function to force an update of the margin size. /// </summary> public virtual void ComputeMarginSize() { } /// <summary> /// Function used in conjunction with GetTextInfo to figure out Array allocations. /// </summary> /// <param name="chars"></param> /// <returns></returns> //protected int GetArraySizes(int[] chars) //{ // //Debug.Log("Set Array Size called."); // //int visibleCount = 0; // //int totalCount = 0; // int tagEnd = 0; // m_totalCharacterCount = 0; // m_isUsingBold = false; // m_isParsingText = false; // //m_VisibleCharacters.Clear(); // for (int i = 0; chars[i] != 0; i++) // { // int c = chars[i]; // if (m_isRichText && c == 60) // if Char '<' // { // // Check if Tag is Valid // if (ValidateHtmlTag(chars, i + 1, out tagEnd)) // { // i = tagEnd; // //if ((m_style & FontStyles.Underline) == FontStyles.Underline) visibleCount += 3; // if ((m_style & FontStyles.Bold) == FontStyles.Bold) m_isUsingBold = true; // continue; // } // } // //if (!char.IsWhiteSpace((char)c) && c != 0x200B) // //{ // //visibleCount += 1; // //} // //m_VisibleCharacters.Add((char)c); // m_totalCharacterCount += 1; // } // return m_totalCharacterCount; //} /// <summary> /// Save the State of various variables used in the mesh creation loop in conjunction with Word Wrapping /// </summary> /// <param name="state"></param> /// <param name="index"></param> /// <param name="count"></param> protected void SaveWordWrappingState(ref WordWrapState state, int index, int count) { // Multi Font & Material support related state.currentFontAsset = m_currentFontAsset; state.currentSpriteAsset = m_currentSpriteAsset; state.currentMaterial = m_currentMaterial; state.currentMaterialIndex = m_currentMaterialIndex; state.previous_WordBreak = index; state.total_CharacterCount = count; state.visible_CharacterCount = m_lineVisibleCharacterCount; //state.visible_CharacterCount = m_visibleCharacterCount; //state.visible_SpriteCount = m_visibleSpriteCount; state.visible_LinkCount = m_textInfo.linkCount; state.firstCharacterIndex = m_firstCharacterOfLine; state.firstVisibleCharacterIndex = m_firstVisibleCharacterOfLine; state.lastVisibleCharIndex = m_lastVisibleCharacterOfLine; state.fontStyle = m_FontStyleInternal; state.fontScale = m_fontScale; //state.maxFontScale = m_maxFontScale; state.fontScaleMultiplier = m_fontScaleMultiplier; state.currentFontSize = m_currentFontSize; state.xAdvance = m_xAdvance; state.maxCapHeight = m_maxCapHeight; state.maxAscender = m_maxAscender; state.maxDescender = m_maxDescender; state.maxLineAscender = m_maxLineAscender; state.maxLineDescender = m_maxLineDescender; state.previousLineAscender = m_startOfLineAscender; state.preferredWidth = m_preferredWidth; state.preferredHeight = m_preferredHeight; state.meshExtents = m_meshExtents; state.lineNumber = m_lineNumber; state.lineOffset = m_lineOffset; state.baselineOffset = m_baselineOffset; //state.alignment = m_lineJustification; state.vertexColor = m_htmlColor; state.underlineColor = m_underlineColor; state.strikethroughColor = m_strikethroughColor; state.highlightColor = m_highlightColor; state.isNonBreakingSpace = m_isNonBreakingSpace; state.tagNoParsing = tag_NoParsing; // XML Tag Stack state.basicStyleStack = m_fontStyleStack; state.colorStack = m_colorStack; state.underlineColorStack = m_underlineColorStack; state.strikethroughColorStack = m_strikethroughColorStack; state.highlightColorStack = m_highlightColorStack; state.colorGradientStack = m_colorGradientStack; state.sizeStack = m_sizeStack; state.indentStack = m_indentStack; state.fontWeightStack = m_FontWeightStack; state.styleStack = m_styleStack; state.baselineStack = m_baselineOffsetStack; state.actionStack = m_actionStack; state.materialReferenceStack = m_materialReferenceStack; state.lineJustificationStack = m_lineJustificationStack; //state.spriteAnimationStack = m_spriteAnimationStack; state.spriteAnimationID = m_spriteAnimationID; if (m_lineNumber < m_textInfo.lineInfo.Length) state.lineInfo = m_textInfo.lineInfo[m_lineNumber]; } /// <summary> /// Restore the State of various variables used in the mesh creation loop. /// </summary> /// <param name="state"></param> /// <returns></returns> protected int RestoreWordWrappingState(ref WordWrapState state) { int index = state.previous_WordBreak; // Multi Font & Material support related m_currentFontAsset = state.currentFontAsset; m_currentSpriteAsset = state.currentSpriteAsset; m_currentMaterial = state.currentMaterial; m_currentMaterialIndex = state.currentMaterialIndex; m_characterCount = state.total_CharacterCount + 1; m_lineVisibleCharacterCount = state.visible_CharacterCount; //m_visibleCharacterCount = state.visible_CharacterCount; //m_visibleSpriteCount = state.visible_SpriteCount; m_textInfo.linkCount = state.visible_LinkCount; m_firstCharacterOfLine = state.firstCharacterIndex; m_firstVisibleCharacterOfLine = state.firstVisibleCharacterIndex; m_lastVisibleCharacterOfLine = state.lastVisibleCharIndex; m_FontStyleInternal = state.fontStyle; m_fontScale = state.fontScale; m_fontScaleMultiplier = state.fontScaleMultiplier; //m_maxFontScale = state.maxFontScale; m_currentFontSize = state.currentFontSize; m_xAdvance = state.xAdvance; m_maxCapHeight = state.maxCapHeight; m_maxAscender = state.maxAscender; m_maxDescender = state.maxDescender; m_maxLineAscender = state.maxLineAscender; m_maxLineDescender = state.maxLineDescender; m_startOfLineAscender = state.previousLineAscender; m_preferredWidth = state.preferredWidth; m_preferredHeight = state.preferredHeight; m_meshExtents = state.meshExtents; m_lineNumber = state.lineNumber; m_lineOffset = state.lineOffset; m_baselineOffset = state.baselineOffset; //m_lineJustification = state.alignment; m_htmlColor = state.vertexColor; m_underlineColor = state.underlineColor; m_strikethroughColor = state.strikethroughColor; m_highlightColor = state.highlightColor; m_isNonBreakingSpace = state.isNonBreakingSpace; tag_NoParsing = state.tagNoParsing; // XML Tag Stack m_fontStyleStack = state.basicStyleStack; m_colorStack = state.colorStack; m_underlineColorStack = state.underlineColorStack; m_strikethroughColorStack = state.strikethroughColorStack; m_highlightColorStack = state.highlightColorStack; m_colorGradientStack = state.colorGradientStack; m_sizeStack = state.sizeStack; m_indentStack = state.indentStack; m_FontWeightStack = state.fontWeightStack; m_styleStack = state.styleStack; m_baselineOffsetStack = state.baselineStack; m_actionStack = state.actionStack; m_materialReferenceStack = state.materialReferenceStack; m_lineJustificationStack = state.lineJustificationStack; //m_spriteAnimationStack = state.spriteAnimationStack; m_spriteAnimationID = state.spriteAnimationID; if (m_lineNumber < m_textInfo.lineInfo.Length) m_textInfo.lineInfo[m_lineNumber] = state.lineInfo; return index; } /// <summary> /// Store vertex information for each character. /// </summary> /// <param name="style_padding">Style_padding.</param> /// <param name="vertexColor">Vertex color.</param> protected virtual void SaveGlyphVertexInfo(float padding, float style_padding, Color32 vertexColor) { // Save the Vertex Position for the Character #region Setup Mesh Vertices m_textInfo.characterInfo[m_characterCount].vertex_BL.position = m_textInfo.characterInfo[m_characterCount].bottomLeft; m_textInfo.characterInfo[m_characterCount].vertex_TL.position = m_textInfo.characterInfo[m_characterCount].topLeft; m_textInfo.characterInfo[m_characterCount].vertex_TR.position = m_textInfo.characterInfo[m_characterCount].topRight; m_textInfo.characterInfo[m_characterCount].vertex_BR.position = m_textInfo.characterInfo[m_characterCount].bottomRight; #endregion #region Setup Vertex Colors // Alpha is the lower of the vertex color or tag color alpha used. vertexColor.a = m_fontColor32.a < vertexColor.a ? (byte)(m_fontColor32.a) : (byte)(vertexColor.a); // Handle Vertex Colors & Vertex Color Gradient if (!m_enableVertexGradient) { m_textInfo.characterInfo[m_characterCount].vertex_BL.color = vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TL.color = vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TR.color = vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_BR.color = vertexColor; } else { if (!m_overrideHtmlColors && m_colorStack.m_Index > 1) { m_textInfo.characterInfo[m_characterCount].vertex_BL.color = vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TL.color = vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TR.color = vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_BR.color = vertexColor; } else // Handle Vertex Color Gradient { // Use Vertex Color Gradient Preset (if one is assigned) if (m_fontColorGradientPreset != null) { m_textInfo.characterInfo[m_characterCount].vertex_BL.color = m_fontColorGradientPreset.bottomLeft * vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TL.color = m_fontColorGradientPreset.topLeft * vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TR.color = m_fontColorGradientPreset.topRight * vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_BR.color = m_fontColorGradientPreset.bottomRight * vertexColor; } else { m_textInfo.characterInfo[m_characterCount].vertex_BL.color = m_fontColorGradient.bottomLeft * vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TL.color = m_fontColorGradient.topLeft * vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_TR.color = m_fontColorGradient.topRight * vertexColor; m_textInfo.characterInfo[m_characterCount].vertex_BR.color = m_fontColorGradient.bottomRight * vertexColor; } } } if (m_colorGradientPreset != null) { m_textInfo.characterInfo[m_characterCount].vertex_BL.color *= m_colorGradientPreset.bottomLeft; m_textInfo.characterInfo[m_characterCount].vertex_TL.color *= m_colorGradientPreset.topLeft; m_textInfo.characterInfo[m_characterCount].vertex_TR.color *= m_colorGradientPreset.topRight; m_textInfo.characterInfo[m_characterCount].vertex_BR.color *= m_colorGradientPreset.bottomRight; } #endregion // Apply style_padding only if this is a SDF Shader. if (!m_isSDFShader) style_padding = 0f; // Setup UVs for the Character #region Setup UVs Vector2 uv0; uv0.x = (m_cached_TextElement.glyph.glyphRect.x - padding - style_padding) / m_currentFontAsset.atlasWidth; uv0.y = (m_cached_TextElement.glyph.glyphRect.y - padding - style_padding) / m_currentFontAsset.atlasHeight; Vector2 uv1; uv1.x = uv0.x; uv1.y = (m_cached_TextElement.glyph.glyphRect.y + padding + style_padding + m_cached_TextElement.glyph.glyphRect.height) / m_currentFontAsset.atlasHeight; Vector2 uv2; uv2.x = (m_cached_TextElement.glyph.glyphRect.x + padding + style_padding + m_cached_TextElement.glyph.glyphRect.width) / m_currentFontAsset.atlasWidth; uv2.y = uv1.y; Vector2 uv3; uv3.x = uv2.x; uv3.y = uv0.y; // Store UV Information m_textInfo.characterInfo[m_characterCount].vertex_BL.uv = uv0; m_textInfo.characterInfo[m_characterCount].vertex_TL.uv = uv1; m_textInfo.characterInfo[m_characterCount].vertex_TR.uv = uv2; m_textInfo.characterInfo[m_characterCount].vertex_BR.uv = uv3; #endregion Setup UVs // Normal #region Setup Normals & Tangents //Vector3 normal = new Vector3(0, 0, -1); //m_textInfo.characterInfo[m_characterCount].vertex_BL.normal = normal; //m_textInfo.characterInfo[m_characterCount].vertex_TL.normal = normal; //m_textInfo.characterInfo[m_characterCount].vertex_TR.normal = normal; //m_textInfo.characterInfo[m_characterCount].vertex_BR.normal = normal; // Tangents //Vector4 tangent = new Vector4(-1, 0, 0, 1); //m_textInfo.characterInfo[m_characterCount].vertex_BL.tangent = tangent; //m_textInfo.characterInfo[m_characterCount].vertex_TL.tangent = tangent; //m_textInfo.characterInfo[m_characterCount].vertex_TR.tangent = tangent; //m_textInfo.characterInfo[m_characterCount].vertex_BR.tangent = tangent; #endregion end Normals & Tangents } /// <summary> /// Store vertex information for each sprite. /// </summary> /// <param name="padding"></param> /// <param name="style_padding"></param> /// <param name="vertexColor"></param> protected virtual void SaveSpriteVertexInfo(Color32 vertexColor) { // Save the Vertex Position for the Character #region Setup Mesh Vertices m_textInfo.characterInfo[m_characterCount].vertex_BL.position = m_textInfo.characterInfo[m_characterCount].bottomLeft; m_textInfo.characterInfo[m_characterCount].vertex_TL.position = m_textInfo.characterInfo[m_characterCount].topLeft; m_textInfo.characterInfo[m_characterCount].vertex_TR.position = m_textInfo.characterInfo[m_characterCount].topRight; m_textInfo.characterInfo[m_characterCount].vertex_BR.position = m_textInfo.characterInfo[m_characterCount].bottomRight; #endregion // Vertex Color Alpha if (m_tintAllSprites) m_tintSprite = true; Color32 spriteColor = m_tintSprite ? m_spriteColor.Multiply(vertexColor) : m_spriteColor; spriteColor.a = spriteColor.a < m_fontColor32.a ? spriteColor.a = spriteColor.a < vertexColor.a ? spriteColor.a : vertexColor.a : m_fontColor32.a; Color32 c0 = spriteColor; Color32 c1 = spriteColor; Color32 c2 = spriteColor; Color32 c3 = spriteColor; if (m_enableVertexGradient) { if (m_fontColorGradientPreset != null) { c0 = m_tintSprite ? c0.Multiply(m_fontColorGradientPreset.bottomLeft) : c0; c1 = m_tintSprite ? c1.Multiply(m_fontColorGradientPreset.topLeft) : c1; c2 = m_tintSprite ? c2.Multiply(m_fontColorGradientPreset.topRight) : c2; c3 = m_tintSprite ? c3.Multiply(m_fontColorGradientPreset.bottomRight) : c3; } else { c0 = m_tintSprite ? c0.Multiply(m_fontColorGradient.bottomLeft) : c0; c1 = m_tintSprite ? c1.Multiply(m_fontColorGradient.topLeft) : c1; c2 = m_tintSprite ? c2.Multiply(m_fontColorGradient.topRight) : c2; c3 = m_tintSprite ? c3.Multiply(m_fontColorGradient.bottomRight) : c3; } } if (m_colorGradientPreset != null) { c0 = m_tintSprite ? c0.Multiply(m_colorGradientPreset.bottomLeft) : c0; c1 = m_tintSprite ? c1.Multiply(m_colorGradientPreset.topLeft) : c1; c2 = m_tintSprite ? c2.Multiply(m_colorGradientPreset.topRight) : c2; c3 = m_tintSprite ? c3.Multiply(m_colorGradientPreset.bottomRight) : c3; } m_textInfo.characterInfo[m_characterCount].vertex_BL.color = c0; m_textInfo.characterInfo[m_characterCount].vertex_TL.color = c1; m_textInfo.characterInfo[m_characterCount].vertex_TR.color = c2; m_textInfo.characterInfo[m_characterCount].vertex_BR.color = c3; // Setup UVs for the Character #region Setup UVs Vector2 uv0 = new Vector2((float)m_cached_TextElement.glyph.glyphRect.x / m_currentSpriteAsset.spriteSheet.width, (float)m_cached_TextElement.glyph.glyphRect.y / m_currentSpriteAsset.spriteSheet.height); // bottom left Vector2 uv1 = new Vector2(uv0.x, (float)(m_cached_TextElement.glyph.glyphRect.y + m_cached_TextElement.glyph.glyphRect.height) / m_currentSpriteAsset.spriteSheet.height); // top left Vector2 uv2 = new Vector2((float)(m_cached_TextElement.glyph.glyphRect.x + m_cached_TextElement.glyph.glyphRect.width) / m_currentSpriteAsset.spriteSheet.width, uv1.y); // top right Vector2 uv3 = new Vector2(uv2.x, uv0.y); // bottom right // Store UV Information m_textInfo.characterInfo[m_characterCount].vertex_BL.uv = uv0; m_textInfo.characterInfo[m_characterCount].vertex_TL.uv = uv1; m_textInfo.characterInfo[m_characterCount].vertex_TR.uv = uv2; m_textInfo.characterInfo[m_characterCount].vertex_BR.uv = uv3; #endregion Setup UVs // Normal #region Setup Normals & Tangents //Vector3 normal = new Vector3(0, 0, -1); //m_textInfo.characterInfo[m_characterCount].vertex_BL.normal = normal; //m_textInfo.characterInfo[m_characterCount].vertex_TL.normal = normal; //m_textInfo.characterInfo[m_characterCount].vertex_TR.normal = normal; //m_textInfo.characterInfo[m_characterCount].vertex_BR.normal = normal; // Tangents //Vector4 tangent = new Vector4(-1, 0, 0, 1); //m_textInfo.characterInfo[m_characterCount].vertex_BL.tangent = tangent; //m_textInfo.characterInfo[m_characterCount].vertex_TL.tangent = tangent; //m_textInfo.characterInfo[m_characterCount].vertex_TR.tangent = tangent; //m_textInfo.characterInfo[m_characterCount].vertex_BR.tangent = tangent; #endregion end Normals & Tangents } /// <summary> /// Store vertex attributes into the appropriate TMP_MeshInfo. /// </summary> /// <param name="i"></param> /// <param name="index_X4"></param> protected virtual void FillCharacterVertexBuffers(int i, int index_X4) { int materialIndex = m_textInfo.characterInfo[i].materialReferenceIndex; index_X4 = m_textInfo.meshInfo[materialIndex].vertexCount; // Make sure buffers allocation are sufficient to hold the vertex data //if (m_textInfo.meshInfo[materialIndex].vertices.Length < index_X4 + 4) // m_textInfo.meshInfo[materialIndex].ResizeMeshInfo(Mathf.NextPowerOfTwo(index_X4 + 4)); TMP_CharacterInfo[] characterInfoArray = m_textInfo.characterInfo; m_textInfo.characterInfo[i].vertexIndex = index_X4; // Setup Vertices for Characters m_textInfo.meshInfo[materialIndex].vertices[0 + index_X4] = characterInfoArray[i].vertex_BL.position; m_textInfo.meshInfo[materialIndex].vertices[1 + index_X4] = characterInfoArray[i].vertex_TL.position; m_textInfo.meshInfo[materialIndex].vertices[2 + index_X4] = characterInfoArray[i].vertex_TR.position; m_textInfo.meshInfo[materialIndex].vertices[3 + index_X4] = characterInfoArray[i].vertex_BR.position; // Setup UVS0 m_textInfo.meshInfo[materialIndex].uvs0[0 + index_X4] = characterInfoArray[i].vertex_BL.uv; m_textInfo.meshInfo[materialIndex].uvs0[1 + index_X4] = characterInfoArray[i].vertex_TL.uv; m_textInfo.meshInfo[materialIndex].uvs0[2 + index_X4] = characterInfoArray[i].vertex_TR.uv; m_textInfo.meshInfo[materialIndex].uvs0[3 + index_X4] = characterInfoArray[i].vertex_BR.uv; // Setup UVS2 m_textInfo.meshInfo[materialIndex].uvs2[0 + index_X4] = characterInfoArray[i].vertex_BL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[1 + index_X4] = characterInfoArray[i].vertex_TL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[2 + index_X4] = characterInfoArray[i].vertex_TR.uv2; m_textInfo.meshInfo[materialIndex].uvs2[3 + index_X4] = characterInfoArray[i].vertex_BR.uv2; // Setup UVS4 //m_textInfo.meshInfo[0].uvs4[0 + index_X4] = characterInfoArray[i].vertex_BL.uv4; //m_textInfo.meshInfo[0].uvs4[1 + index_X4] = characterInfoArray[i].vertex_TL.uv4; //m_textInfo.meshInfo[0].uvs4[2 + index_X4] = characterInfoArray[i].vertex_TR.uv4; //m_textInfo.meshInfo[0].uvs4[3 + index_X4] = characterInfoArray[i].vertex_BR.uv4; // setup Vertex Colors m_textInfo.meshInfo[materialIndex].colors32[0 + index_X4] = characterInfoArray[i].vertex_BL.color; m_textInfo.meshInfo[materialIndex].colors32[1 + index_X4] = characterInfoArray[i].vertex_TL.color; m_textInfo.meshInfo[materialIndex].colors32[2 + index_X4] = characterInfoArray[i].vertex_TR.color; m_textInfo.meshInfo[materialIndex].colors32[3 + index_X4] = characterInfoArray[i].vertex_BR.color; m_textInfo.meshInfo[materialIndex].vertexCount = index_X4 + 4; } protected virtual void FillCharacterVertexBuffers(int i, int index_X4, bool isVolumetric) { int materialIndex = m_textInfo.characterInfo[i].materialReferenceIndex; index_X4 = m_textInfo.meshInfo[materialIndex].vertexCount; TMP_CharacterInfo[] characterInfoArray = m_textInfo.characterInfo; m_textInfo.characterInfo[i].vertexIndex = index_X4; // Setup Vertices for Characters m_textInfo.meshInfo[materialIndex].vertices[0 + index_X4] = characterInfoArray[i].vertex_BL.position; m_textInfo.meshInfo[materialIndex].vertices[1 + index_X4] = characterInfoArray[i].vertex_TL.position; m_textInfo.meshInfo[materialIndex].vertices[2 + index_X4] = characterInfoArray[i].vertex_TR.position; m_textInfo.meshInfo[materialIndex].vertices[3 + index_X4] = characterInfoArray[i].vertex_BR.position; if (isVolumetric) { Vector3 depth = new Vector3(0, 0, m_fontSize * m_fontScale); m_textInfo.meshInfo[materialIndex].vertices[4 + index_X4] = characterInfoArray[i].vertex_BL.position + depth; m_textInfo.meshInfo[materialIndex].vertices[5 + index_X4] = characterInfoArray[i].vertex_TL.position + depth; m_textInfo.meshInfo[materialIndex].vertices[6 + index_X4] = characterInfoArray[i].vertex_TR.position + depth; m_textInfo.meshInfo[materialIndex].vertices[7 + index_X4] = characterInfoArray[i].vertex_BR.position + depth; } // Setup UVS0 m_textInfo.meshInfo[materialIndex].uvs0[0 + index_X4] = characterInfoArray[i].vertex_BL.uv; m_textInfo.meshInfo[materialIndex].uvs0[1 + index_X4] = characterInfoArray[i].vertex_TL.uv; m_textInfo.meshInfo[materialIndex].uvs0[2 + index_X4] = characterInfoArray[i].vertex_TR.uv; m_textInfo.meshInfo[materialIndex].uvs0[3 + index_X4] = characterInfoArray[i].vertex_BR.uv; if (isVolumetric) { m_textInfo.meshInfo[materialIndex].uvs0[4 + index_X4] = characterInfoArray[i].vertex_BL.uv; m_textInfo.meshInfo[materialIndex].uvs0[5 + index_X4] = characterInfoArray[i].vertex_TL.uv; m_textInfo.meshInfo[materialIndex].uvs0[6 + index_X4] = characterInfoArray[i].vertex_TR.uv; m_textInfo.meshInfo[materialIndex].uvs0[7 + index_X4] = characterInfoArray[i].vertex_BR.uv; } // Setup UVS2 m_textInfo.meshInfo[materialIndex].uvs2[0 + index_X4] = characterInfoArray[i].vertex_BL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[1 + index_X4] = characterInfoArray[i].vertex_TL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[2 + index_X4] = characterInfoArray[i].vertex_TR.uv2; m_textInfo.meshInfo[materialIndex].uvs2[3 + index_X4] = characterInfoArray[i].vertex_BR.uv2; if (isVolumetric) { m_textInfo.meshInfo[materialIndex].uvs2[4 + index_X4] = characterInfoArray[i].vertex_BL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[5 + index_X4] = characterInfoArray[i].vertex_TL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[6 + index_X4] = characterInfoArray[i].vertex_TR.uv2; m_textInfo.meshInfo[materialIndex].uvs2[7 + index_X4] = characterInfoArray[i].vertex_BR.uv2; } // Setup UVS4 //m_textInfo.meshInfo[0].uvs4[0 + index_X4] = characterInfoArray[i].vertex_BL.uv4; //m_textInfo.meshInfo[0].uvs4[1 + index_X4] = characterInfoArray[i].vertex_TL.uv4; //m_textInfo.meshInfo[0].uvs4[2 + index_X4] = characterInfoArray[i].vertex_TR.uv4; //m_textInfo.meshInfo[0].uvs4[3 + index_X4] = characterInfoArray[i].vertex_BR.uv4; // setup Vertex Colors m_textInfo.meshInfo[materialIndex].colors32[0 + index_X4] = characterInfoArray[i].vertex_BL.color; m_textInfo.meshInfo[materialIndex].colors32[1 + index_X4] = characterInfoArray[i].vertex_TL.color; m_textInfo.meshInfo[materialIndex].colors32[2 + index_X4] = characterInfoArray[i].vertex_TR.color; m_textInfo.meshInfo[materialIndex].colors32[3 + index_X4] = characterInfoArray[i].vertex_BR.color; if (isVolumetric) { Color32 backColor = new Color32(255, 255, 128, 255); m_textInfo.meshInfo[materialIndex].colors32[4 + index_X4] = backColor; //characterInfoArray[i].vertex_BL.color; m_textInfo.meshInfo[materialIndex].colors32[5 + index_X4] = backColor; //characterInfoArray[i].vertex_TL.color; m_textInfo.meshInfo[materialIndex].colors32[6 + index_X4] = backColor; //characterInfoArray[i].vertex_TR.color; m_textInfo.meshInfo[materialIndex].colors32[7 + index_X4] = backColor; //characterInfoArray[i].vertex_BR.color; } m_textInfo.meshInfo[materialIndex].vertexCount = index_X4 + (!isVolumetric ? 4 : 8); } /// <summary> /// Fill Vertex Buffers for Sprites /// </summary> /// <param name="i"></param> /// <param name="spriteIndex_X4"></param> protected virtual void FillSpriteVertexBuffers(int i, int index_X4) { int materialIndex = m_textInfo.characterInfo[i].materialReferenceIndex; index_X4 = m_textInfo.meshInfo[materialIndex].vertexCount; TMP_CharacterInfo[] characterInfoArray = m_textInfo.characterInfo; m_textInfo.characterInfo[i].vertexIndex = index_X4; // Setup Vertices for Characters m_textInfo.meshInfo[materialIndex].vertices[0 + index_X4] = characterInfoArray[i].vertex_BL.position; m_textInfo.meshInfo[materialIndex].vertices[1 + index_X4] = characterInfoArray[i].vertex_TL.position; m_textInfo.meshInfo[materialIndex].vertices[2 + index_X4] = characterInfoArray[i].vertex_TR.position; m_textInfo.meshInfo[materialIndex].vertices[3 + index_X4] = characterInfoArray[i].vertex_BR.position; // Setup UVS0 m_textInfo.meshInfo[materialIndex].uvs0[0 + index_X4] = characterInfoArray[i].vertex_BL.uv; m_textInfo.meshInfo[materialIndex].uvs0[1 + index_X4] = characterInfoArray[i].vertex_TL.uv; m_textInfo.meshInfo[materialIndex].uvs0[2 + index_X4] = characterInfoArray[i].vertex_TR.uv; m_textInfo.meshInfo[materialIndex].uvs0[3 + index_X4] = characterInfoArray[i].vertex_BR.uv; // Setup UVS2 m_textInfo.meshInfo[materialIndex].uvs2[0 + index_X4] = characterInfoArray[i].vertex_BL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[1 + index_X4] = characterInfoArray[i].vertex_TL.uv2; m_textInfo.meshInfo[materialIndex].uvs2[2 + index_X4] = characterInfoArray[i].vertex_TR.uv2; m_textInfo.meshInfo[materialIndex].uvs2[3 + index_X4] = characterInfoArray[i].vertex_BR.uv2; // Setup UVS4 //m_textInfo.meshInfo[0].uvs4[0 + index_X4] = characterInfoArray[i].vertex_BL.uv4; //m_textInfo.meshInfo[0].uvs4[1 + index_X4] = characterInfoArray[i].vertex_TL.uv4; //m_textInfo.meshInfo[0].uvs4[2 + index_X4] = characterInfoArray[i].vertex_TR.uv4; //m_textInfo.meshInfo[0].uvs4[3 + index_X4] = characterInfoArray[i].vertex_BR.uv4; // setup Vertex Colors m_textInfo.meshInfo[materialIndex].colors32[0 + index_X4] = characterInfoArray[i].vertex_BL.color; m_textInfo.meshInfo[materialIndex].colors32[1 + index_X4] = characterInfoArray[i].vertex_TL.color; m_textInfo.meshInfo[materialIndex].colors32[2 + index_X4] = characterInfoArray[i].vertex_TR.color; m_textInfo.meshInfo[materialIndex].colors32[3 + index_X4] = characterInfoArray[i].vertex_BR.color; m_textInfo.meshInfo[materialIndex].vertexCount = index_X4 + 4; } /// <summary> /// Method to add the underline geometry. /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <param name="startScale"></param> /// <param name="endScale"></param> /// <param name="maxScale"></param> /// <param name="underlineColor"></param> protected virtual void DrawUnderlineMesh(Vector3 start, Vector3 end, ref int index, float startScale, float endScale, float maxScale, float sdfScale, Color32 underlineColor) { if (m_cached_Underline_Character == null) { if (!TMP_Settings.warningsDisabled) Debug.LogWarning("Unable to add underline since the Font Asset doesn't contain the underline character.", this); return; } int verticesCount = index + 12; // Check to make sure our current mesh buffer allocations can hold these new Quads. if (verticesCount > m_textInfo.meshInfo[0].vertices.Length) { // Resize Mesh Buffers m_textInfo.meshInfo[0].ResizeMeshInfo(verticesCount / 4); } // Adjust the position of the underline based on the lowest character. This matters for subscript character. start.y = Mathf.Min(start.y, end.y); end.y = Mathf.Min(start.y, end.y); float segmentWidth = m_cached_Underline_Character.glyph.metrics.width / 2 * maxScale; if (end.x - start.x < m_cached_Underline_Character.glyph.metrics.width * maxScale) { segmentWidth = (end.x - start.x) / 2f; } float startPadding = m_padding * startScale / maxScale; float endPadding = m_padding * endScale / maxScale; float underlineThickness = m_fontAsset.faceInfo.underlineThickness; // UNDERLINE VERTICES FOR (3) LINE SEGMENTS #region UNDERLINE VERTICES Vector3[] vertices = m_textInfo.meshInfo[0].vertices; // Front Part of the Underline vertices[index + 0] = start + new Vector3(0, 0 - (underlineThickness + m_padding) * maxScale, 0); // BL vertices[index + 1] = start + new Vector3(0, m_padding * maxScale, 0); // TL vertices[index + 2] = vertices[index + 1] + new Vector3(segmentWidth, 0, 0); // TR vertices[index + 3] = vertices[index + 0] + new Vector3(segmentWidth, 0, 0); // BR // Middle Part of the Underline vertices[index + 4] = vertices[index + 3]; // BL vertices[index + 5] = vertices[index + 2]; // TL vertices[index + 6] = end + new Vector3(-segmentWidth, m_padding * maxScale, 0); // TR vertices[index + 7] = end + new Vector3(-segmentWidth, -(underlineThickness + m_padding) * maxScale, 0); // BR // End Part of the Underline vertices[index + 8] = vertices[index + 7]; // BL vertices[index + 9] = vertices[index + 6]; // TL vertices[index + 10] = end + new Vector3(0, m_padding * maxScale, 0); // TR vertices[index + 11] = end + new Vector3(0, -(underlineThickness + m_padding) * maxScale, 0); // BR #endregion // UNDERLINE UV0 #region HANDLE UV0 Vector2[] uvs0 = m_textInfo.meshInfo[0].uvs0; // Calculate UV required to setup the 3 Quads for the Underline. Vector2 uv0 = new Vector2((m_cached_Underline_Character.glyph.glyphRect.x - startPadding) / m_fontAsset.atlasWidth, (m_cached_Underline_Character.glyph.glyphRect.y - m_padding) / m_fontAsset.atlasHeight); // bottom left Vector2 uv1 = new Vector2(uv0.x, (m_cached_Underline_Character.glyph.glyphRect.y + m_cached_Underline_Character.glyph.glyphRect.height + m_padding) / m_fontAsset.atlasHeight); // top left Vector2 uv2 = new Vector2((m_cached_Underline_Character.glyph.glyphRect.x - startPadding + (float)m_cached_Underline_Character.glyph.glyphRect.width / 2) / m_fontAsset.atlasWidth, uv1.y); // Mid Top Left Vector2 uv3 = new Vector2(uv2.x, uv0.y); // Mid Bottom Left Vector2 uv4 = new Vector2((m_cached_Underline_Character.glyph.glyphRect.x + endPadding + (float)m_cached_Underline_Character.glyph.glyphRect.width / 2) / m_fontAsset.atlasWidth, uv1.y); // Mid Top Right Vector2 uv5 = new Vector2(uv4.x, uv0.y); // Mid Bottom right Vector2 uv6 = new Vector2((m_cached_Underline_Character.glyph.glyphRect.x + endPadding + m_cached_Underline_Character.glyph.glyphRect.width) / m_fontAsset.atlasWidth, uv1.y); // End Part - Bottom Right Vector2 uv7 = new Vector2(uv6.x, uv0.y); // End Part - Top Right // Left Part of the Underline uvs0[0 + index] = uv0; // BL uvs0[1 + index] = uv1; // TL uvs0[2 + index] = uv2; // TR uvs0[3 + index] = uv3; // BR // Middle Part of the Underline uvs0[4 + index] = new Vector2(uv2.x - uv2.x * 0.001f, uv0.y); uvs0[5 + index] = new Vector2(uv2.x - uv2.x * 0.001f, uv1.y); uvs0[6 + index] = new Vector2(uv2.x + uv2.x * 0.001f, uv1.y); uvs0[7 + index] = new Vector2(uv2.x + uv2.x * 0.001f, uv0.y); // Right Part of the Underline uvs0[8 + index] = uv5; uvs0[9 + index] = uv4; uvs0[10 + index] = uv6; uvs0[11 + index] = uv7; #endregion // UNDERLINE UV2 #region HANDLE UV2 - SDF SCALE // UV1 contains Face / Border UV layout. float min_UvX = 0; float max_UvX = (vertices[index + 2].x - start.x) / (end.x - start.x); //Calculate the xScale or how much the UV's are getting stretched on the X axis for the middle section of the underline. float xScale = Mathf.Abs(sdfScale); Vector2[] uvs2 = m_textInfo.meshInfo[0].uvs2; uvs2[0 + index] = PackUV(0, 0, xScale); uvs2[1 + index] = PackUV(0, 1, xScale); uvs2[2 + index] = PackUV(max_UvX, 1, xScale); uvs2[3 + index] = PackUV(max_UvX, 0, xScale); min_UvX = (vertices[index + 4].x - start.x) / (end.x - start.x); max_UvX = (vertices[index + 6].x - start.x) / (end.x - start.x); uvs2[4 + index] = PackUV(min_UvX, 0, xScale); uvs2[5 + index] = PackUV(min_UvX, 1, xScale); uvs2[6 + index] = PackUV(max_UvX, 1, xScale); uvs2[7 + index] = PackUV(max_UvX, 0, xScale); min_UvX = (vertices[index + 8].x - start.x) / (end.x - start.x); max_UvX = (vertices[index + 6].x - start.x) / (end.x - start.x); uvs2[8 + index] = PackUV(min_UvX, 0, xScale); uvs2[9 + index] = PackUV(min_UvX, 1, xScale); uvs2[10 + index] = PackUV(1, 1, xScale); uvs2[11 + index] = PackUV(1, 0, xScale); #endregion // UNDERLINE VERTEX COLORS #region // Alpha is the lower of the vertex color or tag color alpha used. underlineColor.a = m_fontColor32.a < underlineColor.a ? (byte)(m_fontColor32.a) : (byte)(underlineColor.a); Color32[] colors32 = m_textInfo.meshInfo[0].colors32; colors32[0 + index] = underlineColor; colors32[1 + index] = underlineColor; colors32[2 + index] = underlineColor; colors32[3 + index] = underlineColor; colors32[4 + index] = underlineColor; colors32[5 + index] = underlineColor; colors32[6 + index] = underlineColor; colors32[7 + index] = underlineColor; colors32[8 + index] = underlineColor; colors32[9 + index] = underlineColor; colors32[10 + index] = underlineColor; colors32[11 + index] = underlineColor; #endregion index += 12; } protected virtual void DrawTextHighlight(Vector3 start, Vector3 end, ref int index, Color32 highlightColor) { if (m_cached_Underline_Character == null) { if (!TMP_Settings.warningsDisabled) Debug.LogWarning("Unable to add underline since the Font Asset doesn't contain the underline character.", this); return; } int verticesCount = index + 4; // Check to make sure our current mesh buffer allocations can hold these new Quads. if (verticesCount > m_textInfo.meshInfo[0].vertices.Length) { // Resize Mesh Buffers m_textInfo.meshInfo[0].ResizeMeshInfo(verticesCount / 4); } // UNDERLINE VERTICES FOR (3) LINE SEGMENTS #region HIGHLIGHT VERTICES Vector3[] vertices = m_textInfo.meshInfo[0].vertices; // Front Part of the Underline vertices[index + 0] = start; // BL vertices[index + 1] = new Vector3(start.x, end.y, 0); // TL vertices[index + 2] = end; // TR vertices[index + 3] = new Vector3(end.x, start.y, 0); // BR #endregion // UNDERLINE UV0 #region HANDLE UV0 Vector2[] uvs0 = m_textInfo.meshInfo[0].uvs0; // Calculate UV required to setup the 3 Quads for the Underline. Vector2 uv0 = new Vector2(((float)m_cached_Underline_Character.glyph.glyphRect.x + m_cached_Underline_Character.glyph.glyphRect.width / 2) / m_fontAsset.atlasWidth, (m_cached_Underline_Character.glyph.glyphRect.y + (float)m_cached_Underline_Character.glyph.glyphRect.height / 2) / m_fontAsset.atlasHeight); // bottom left //Vector2 uv1 = new Vector2(uv0.x, uv0.y); // top left //Vector2 uv2 = new Vector2(uv0.x, uv0.y); // Top Right //Vector2 uv3 = new Vector2(uv2.x, uv0.y); // Bottom Right // Left Part of the Underline uvs0[0 + index] = uv0; // BL uvs0[1 + index] = uv0; // TL uvs0[2 + index] = uv0; // TR uvs0[3 + index] = uv0; // BR #endregion // UNDERLINE UV2 #region HANDLE UV2 - SDF SCALE // UV1 contains Face / Border UV layout. //float min_UvX = 0; //float max_UvX = (vertices[index + 2].x - start.x) / (end.x - start.x); ////Calculate the xScale or how much the UV's are getting stretched on the X axis for the middle section of the underline. //float xScale = 0; // Mathf.Abs(sdfScale); Vector2[] uvs2 = m_textInfo.meshInfo[0].uvs2; Vector2 customUV = new Vector2(0, 1); uvs2[0 + index] = customUV; // PackUV(-0.2f, -0.2f, xScale); uvs2[1 + index] = customUV; // PackUV(-0.2f, -0.1f, xScale); uvs2[2 + index] = customUV; // PackUV(-0.1f, -0.1f, xScale); uvs2[3 + index] = customUV; // PackUV(-0.1f, -0.2f, xScale); #endregion // HIGHLIGHT VERTEX COLORS #region // Alpha is the lower of the vertex color or tag color alpha used. highlightColor.a = m_fontColor32.a < highlightColor.a ? m_fontColor32.a : highlightColor.a; Color32[] colors32 = m_textInfo.meshInfo[0].colors32; colors32[0 + index] = highlightColor; colors32[1 + index] = highlightColor; colors32[2 + index] = highlightColor; colors32[3 + index] = highlightColor; #endregion index += 4; } /// <summary> /// Internal function used to load the default settings of text objects. /// </summary> protected void LoadDefaultSettings() { if (m_text == null || m_isWaitingOnResourceLoad) { if (TMP_Settings.autoSizeTextContainer) autoSizeTextContainer = true; else { m_rectTransform = this.rectTransform; if (GetType() == typeof(TextMeshPro)) m_rectTransform.sizeDelta = TMP_Settings.defaultTextMeshProTextContainerSize; else m_rectTransform.sizeDelta = TMP_Settings.defaultTextMeshProUITextContainerSize; } m_enableWordWrapping = TMP_Settings.enableWordWrapping; m_enableKerning = TMP_Settings.enableKerning; m_enableExtraPadding = TMP_Settings.enableExtraPadding; m_tintAllSprites = TMP_Settings.enableTintAllSprites; m_parseCtrlCharacters = TMP_Settings.enableParseEscapeCharacters; m_fontSize = m_fontSizeBase = TMP_Settings.defaultFontSize; m_fontSizeMin = m_fontSize * TMP_Settings.defaultTextAutoSizingMinRatio; m_fontSizeMax = m_fontSize * TMP_Settings.defaultTextAutoSizingMaxRatio; m_isWaitingOnResourceLoad = false; raycastTarget = TMP_Settings.enableRaycastTarget; } } /// <summary> /// Method used to find and cache references to the Underline and Ellipsis characters. /// </summary> /// <param name=""></param> protected void GetSpecialCharacters(TMP_FontAsset fontAsset) { bool isUsingAlternativeTypeface; TMP_FontAsset tempFontAsset; // Check & Assign Underline Character for use with the Underline tag. if (!fontAsset.characterLookupTable.TryGetValue(95, out m_cached_Underline_Character)) { m_cached_Underline_Character = TMP_FontAssetUtilities.GetCharacterFromFontAsset(95,fontAsset, false, m_FontStyleInternal, (FontWeight)m_FontWeightInternal, out isUsingAlternativeTypeface, out tempFontAsset); if (m_cached_Underline_Character == null) { if (!TMP_Settings.warningsDisabled) Debug.LogWarning("The character used for Underline and Strikethrough is not available in font asset [" + fontAsset.name + "].", this); } } // Check & Assign Underline Character for use with the Underline tag. if (!fontAsset.characterLookupTable.TryGetValue(8230, out m_cached_Ellipsis_Character)) //95 { m_cached_Ellipsis_Character = TMP_FontAssetUtilities.GetCharacterFromFontAsset(8230, fontAsset, false, m_FontStyleInternal, (FontWeight)m_FontWeightInternal, out isUsingAlternativeTypeface, out tempFontAsset); if (m_cached_Ellipsis_Character == null) { if (!TMP_Settings.warningsDisabled) Debug.LogWarning("The character used for Ellipsis is not available in font asset [" + fontAsset.name + "].", this); } } } /// <summary> /// Replace a given number of characters (tag) in the array with a new character and shift subsequent characters in the array. /// </summary> /// <param name="chars">Array which contains the text.</param> /// <param name="insertionIndex">The index of where the new character will be inserted</param> /// <param name="tagLength">Length of the tag being replaced.</param> /// <param name="c">The replacement character.</param> protected void ReplaceTagWithCharacter(int[] chars, int insertionIndex, int tagLength, char c) { chars[insertionIndex] = c; for (int i = insertionIndex + tagLength; i < chars.Length; i++) { chars[i - 3] = chars[i]; } } /// <summary> /// /// </summary> /// <returns></returns> //protected int GetMaterialReferenceForFontWeight() //{ // //bool isItalic = (m_style & FontStyles.Italic) == FontStyles.Italic || (m_fontStyle & FontStyles.Italic) == FontStyles.Italic; // m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentFontAsset.fontWeights[0].italicTypeface.material, m_currentFontAsset.fontWeights[0].italicTypeface, m_materialReferences, m_materialReferenceIndexLookup); // return 0; //} /// <summary> /// /// </summary> /// <returns></returns> protected TMP_FontAsset GetFontAssetForWeight(int fontWeight) { bool isItalic = (m_FontStyleInternal & FontStyles.Italic) == FontStyles.Italic || (m_fontStyle & FontStyles.Italic) == FontStyles.Italic; TMP_FontAsset fontAsset = null; int weightIndex = fontWeight / 100; if (isItalic) fontAsset = m_currentFontAsset.fontWeightTable[weightIndex].italicTypeface; else fontAsset = m_currentFontAsset.fontWeightTable[weightIndex].regularTypeface; return fontAsset; } /// <summary> /// Method to Enable or Disable child SubMesh objects. /// </summary> /// <param name="state"></param> protected virtual void SetActiveSubMeshes(bool state) { } /// <summary> /// Destroy Sub Mesh Objects. /// </summary> protected virtual void ClearSubMeshObjects() { } /// <summary> /// Function to clear the geometry of the Primary and Sub Text objects. /// </summary> public virtual void ClearMesh() { } /// <summary> /// Function to clear the geometry of the Primary and Sub Text objects. /// </summary> public virtual void ClearMesh(bool uploadGeometry) { } /// <summary> /// Function which returns the text after it has been parsed and rich text tags removed. /// </summary> /// <returns></returns> public virtual string GetParsedText() { if (m_textInfo == null) return string.Empty; int characterCount = m_textInfo.characterCount; // TODO - Could implement some static buffer pool shared by all instances of TMP objects. char[] buffer = new char[characterCount]; for (int i = 0; i < characterCount && i < m_textInfo.characterInfo.Length; i++) { buffer[i] = m_textInfo.characterInfo[i].character; } return new string(buffer); } /// <summary> /// Function to pack scale information in the UV2 Channel. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="scale"></param> /// <returns></returns> //protected Vector2 PackUV(float x, float y, float scale) //{ // Vector2 output; // output.x = Mathf.Floor(x * 4095); // output.y = Mathf.Floor(y * 4095); // output.x = (output.x * 4096) + output.y; // output.y = scale; // return output; //} /// <summary> /// Function to pack scale information in the UV2 Channel. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="scale"></param> /// <returns></returns> protected Vector2 PackUV(float x, float y, float scale) { Vector2 output; output.x = (int)(x * 511); output.y = (int)(y * 511); output.x = (output.x * 4096) + output.y; output.y = scale; return output; } /// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> protected float PackUV(float x, float y) { double x0 = (int)(x * 511); double y0 = (int)(y * 511); return (float)((x0 * 4096) + y0); } /// <summary> /// Function used as a replacement for LateUpdate() /// </summary> internal virtual void InternalUpdate() { } /// <summary> /// Function to pack scale information in the UV2 Channel. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="scale"></param> /// <returns></returns> //protected Vector2 PackUV(float x, float y, float scale) //{ // Vector2 output; // output.x = Mathf.Floor(x * 4095); // output.y = Mathf.Floor(y * 4095); // return new Vector2((output.x * 4096) + output.y, scale); //} /// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> //protected float PackUV(float x, float y) //{ // x = (x % 5) / 5; // y = (y % 5) / 5; // return Mathf.Round(x * 4096) + y; //} /// <summary> /// Method to convert Hex to Int /// </summary> /// <param name="hex"></param> /// <returns></returns> protected int HexToInt(char hex) { switch (hex) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; case 'A': return 10; case 'B': return 11; case 'C': return 12; case 'D': return 13; case 'E': return 14; case 'F': return 15; case 'a': return 10; case 'b': return 11; case 'c': return 12; case 'd': return 13; case 'e': return 14; case 'f': return 15; } return 15; } /// <summary> /// Convert UTF-16 Hex to Char /// </summary> /// <returns>The Unicode hex.</returns> /// <param name="i">The index.</param> protected int GetUTF16(string text, int i) { int unicode = 0; unicode += HexToInt(text[i]) << 12; unicode += HexToInt(text[i + 1]) << 8; unicode += HexToInt(text[i + 2]) << 4; unicode += HexToInt(text[i + 3]); return unicode; } /// <summary> /// Convert UTF-16 Hex to Char /// </summary> /// <returns>The Unicode hex.</returns> /// <param name="i">The index.</param> protected int GetUTF16(StringBuilder text, int i) { int unicode = 0; unicode += HexToInt(text[i]) << 12; unicode += HexToInt(text[i + 1]) << 8; unicode += HexToInt(text[i + 2]) << 4; unicode += HexToInt(text[i + 3]); return unicode; } /// <summary> /// Convert UTF-32 Hex to Char /// </summary> /// <returns>The Unicode hex.</returns> /// <param name="i">The index.</param> protected int GetUTF32(string text, int i) { int unicode = 0; unicode += HexToInt(text[i]) << 30; unicode += HexToInt(text[i + 1]) << 24; unicode += HexToInt(text[i + 2]) << 20; unicode += HexToInt(text[i + 3]) << 16; unicode += HexToInt(text[i + 4]) << 12; unicode += HexToInt(text[i + 5]) << 8; unicode += HexToInt(text[i + 6]) << 4; unicode += HexToInt(text[i + 7]); return unicode; } /// <summary> /// Convert UTF-32 Hex to Char /// </summary> /// <returns>The Unicode hex.</returns> /// <param name="i">The index.</param> protected int GetUTF32(StringBuilder text, int i) { int unicode = 0; unicode += HexToInt(text[i]) << 30; unicode += HexToInt(text[i + 1]) << 24; unicode += HexToInt(text[i + 2]) << 20; unicode += HexToInt(text[i + 3]) << 16; unicode += HexToInt(text[i + 4]) << 12; unicode += HexToInt(text[i + 5]) << 8; unicode += HexToInt(text[i + 6]) << 4; unicode += HexToInt(text[i + 7]); return unicode; } /// <summary> /// Method to convert Hex color values to Color32 /// </summary> /// <param name="hexChars"></param> /// <param name="tagCount"></param> /// <returns></returns> protected Color32 HexCharsToColor(char[] hexChars, int tagCount) { if (tagCount == 4) { byte r = (byte)(HexToInt(hexChars[1]) * 16 + HexToInt(hexChars[1])); byte g = (byte)(HexToInt(hexChars[2]) * 16 + HexToInt(hexChars[2])); byte b = (byte)(HexToInt(hexChars[3]) * 16 + HexToInt(hexChars[3])); return new Color32(r, g, b, 255); } else if (tagCount == 5) { byte r = (byte)(HexToInt(hexChars[1]) * 16 + HexToInt(hexChars[1])); byte g = (byte)(HexToInt(hexChars[2]) * 16 + HexToInt(hexChars[2])); byte b = (byte)(HexToInt(hexChars[3]) * 16 + HexToInt(hexChars[3])); byte a = (byte)(HexToInt(hexChars[4]) * 16 + HexToInt(hexChars[4])); return new Color32(r, g, b, a); } else if (tagCount == 7) { byte r = (byte)(HexToInt(hexChars[1]) * 16 + HexToInt(hexChars[2])); byte g = (byte)(HexToInt(hexChars[3]) * 16 + HexToInt(hexChars[4])); byte b = (byte)(HexToInt(hexChars[5]) * 16 + HexToInt(hexChars[6])); return new Color32(r, g, b, 255); } else if (tagCount == 9) { byte r = (byte)(HexToInt(hexChars[1]) * 16 + HexToInt(hexChars[2])); byte g = (byte)(HexToInt(hexChars[3]) * 16 + HexToInt(hexChars[4])); byte b = (byte)(HexToInt(hexChars[5]) * 16 + HexToInt(hexChars[6])); byte a = (byte)(HexToInt(hexChars[7]) * 16 + HexToInt(hexChars[8])); return new Color32(r, g, b, a); } else if (tagCount == 10) { byte r = (byte)(HexToInt(hexChars[7]) * 16 + HexToInt(hexChars[7])); byte g = (byte)(HexToInt(hexChars[8]) * 16 + HexToInt(hexChars[8])); byte b = (byte)(HexToInt(hexChars[9]) * 16 + HexToInt(hexChars[9])); return new Color32(r, g, b, 255); } else if (tagCount == 11) { byte r = (byte)(HexToInt(hexChars[7]) * 16 + HexToInt(hexChars[7])); byte g = (byte)(HexToInt(hexChars[8]) * 16 + HexToInt(hexChars[8])); byte b = (byte)(HexToInt(hexChars[9]) * 16 + HexToInt(hexChars[9])); byte a = (byte)(HexToInt(hexChars[10]) * 16 + HexToInt(hexChars[10])); return new Color32(r, g, b, a); } else if (tagCount == 13) { byte r = (byte)(HexToInt(hexChars[7]) * 16 + HexToInt(hexChars[8])); byte g = (byte)(HexToInt(hexChars[9]) * 16 + HexToInt(hexChars[10])); byte b = (byte)(HexToInt(hexChars[11]) * 16 + HexToInt(hexChars[12])); return new Color32(r, g, b, 255); } else if (tagCount == 15) { byte r = (byte)(HexToInt(hexChars[7]) * 16 + HexToInt(hexChars[8])); byte g = (byte)(HexToInt(hexChars[9]) * 16 + HexToInt(hexChars[10])); byte b = (byte)(HexToInt(hexChars[11]) * 16 + HexToInt(hexChars[12])); byte a = (byte)(HexToInt(hexChars[13]) * 16 + HexToInt(hexChars[14])); return new Color32(r, g, b, a); } return new Color32(255, 255, 255, 255); } /// <summary> /// Method to convert Hex Color values to Color32 /// </summary> /// <param name="hexChars"></param> /// <param name="startIndex"></param> /// <param name="length"></param> /// <returns></returns> protected Color32 HexCharsToColor(char[] hexChars, int startIndex, int length) { if (length == 7) { byte r = (byte)(HexToInt(hexChars[startIndex + 1]) * 16 + HexToInt(hexChars[startIndex + 2])); byte g = (byte)(HexToInt(hexChars[startIndex + 3]) * 16 + HexToInt(hexChars[startIndex + 4])); byte b = (byte)(HexToInt(hexChars[startIndex + 5]) * 16 + HexToInt(hexChars[startIndex + 6])); return new Color32(r, g, b, 255); } else if (length == 9) { byte r = (byte)(HexToInt(hexChars[startIndex + 1]) * 16 + HexToInt(hexChars[startIndex + 2])); byte g = (byte)(HexToInt(hexChars[startIndex + 3]) * 16 + HexToInt(hexChars[startIndex + 4])); byte b = (byte)(HexToInt(hexChars[startIndex + 5]) * 16 + HexToInt(hexChars[startIndex + 6])); byte a = (byte)(HexToInt(hexChars[startIndex + 7]) * 16 + HexToInt(hexChars[startIndex + 8])); return new Color32(r, g, b, a); } return s_colorWhite; } /// <summary> /// Method which returns the number of parameters used in a tag attribute and populates an array with such values. /// </summary> /// <param name="chars">Char[] containing the tag attribute and data</param> /// <param name="startIndex">The index of the first char of the data</param> /// <param name="length">The length of the data</param> /// <param name="parameters">The number of parameters contained in the Char[]</param> /// <returns></returns> int GetAttributeParameters(char[] chars, int startIndex, int length, ref float[] parameters) { int endIndex = startIndex; int attributeCount = 0; while (endIndex < startIndex + length) { parameters[attributeCount] = ConvertToFloat(chars, startIndex, length, out endIndex); length -= (endIndex - startIndex) + 1; startIndex = endIndex + 1; attributeCount += 1; } return attributeCount; } /// <summary> /// Extracts a float value from char[] assuming we know the position of the start, end and decimal point. /// </summary> /// <param name="chars"></param> /// <param name="startIndex"></param> /// <param name="length"></param> /// <returns></returns> protected float ConvertToFloat(char[] chars, int startIndex, int length) { int lastIndex; return ConvertToFloat(chars, startIndex, length, out lastIndex); } /// <summary> /// Extracts a float value from char[] given a start index and length. /// </summary> /// <param name="chars"></param> The Char[] containing the numerical sequence. /// <param name="startIndex"></param> The index of the start of the numerical sequence. /// <param name="length"></param> The length of the numerical sequence. /// <param name="lastIndex"></param> Index of the last character in the validated sequence. /// <returns></returns> protected float ConvertToFloat(char[] chars, int startIndex, int length, out int lastIndex) { if (startIndex == 0) { lastIndex = 0; return -9999; } int endIndex = startIndex + length; bool isIntegerValue = true; float decimalPointMultiplier = 0; // Set value multiplier checking the first character to determine if we are using '+' or '-' int valueSignMultiplier = 1; if (chars[startIndex] == '+') { valueSignMultiplier = 1; startIndex += 1; } else if (chars[startIndex] == '-') { valueSignMultiplier = -1; startIndex += 1; } float value = 0; for (int i = startIndex; i < endIndex; i++) { uint c = chars[i]; if (c >= '0' && c <= '9' || c == '.') { if (c == '.') { isIntegerValue = false; decimalPointMultiplier = 0.1f; continue; } //Calculate integer and floating point value if (isIntegerValue) value = value * 10 + (c - 48) * valueSignMultiplier; else { value = value + (c - 48) * decimalPointMultiplier * valueSignMultiplier; decimalPointMultiplier *= 0.1f; } continue; } else if (c == ',') { if (i + 1 < endIndex && chars[i + 1] == ' ') lastIndex = i + 1; else lastIndex = i; return value; } } lastIndex = endIndex; return value; } /// <summary> /// Function to identify and validate the rich tag. Returns the position of the > if the tag was valid. /// </summary> /// <param name="chars"></param> /// <param name="startIndex"></param> /// <param name="endIndex"></param> /// <returns></returns> protected bool ValidateHtmlTag(UnicodeChar[] chars, int startIndex, out int endIndex) { int tagCharCount = 0; byte attributeFlag = 0; int attributeIndex = 0; m_xmlAttribute[attributeIndex].nameHashCode = 0; m_xmlAttribute[attributeIndex].valueHashCode = 0; m_xmlAttribute[attributeIndex].valueStartIndex = 0; m_xmlAttribute[attributeIndex].valueLength = 0; TagValueType tagValueType = m_xmlAttribute[attributeIndex].valueType = TagValueType.None; TagUnitType tagUnitType = m_xmlAttribute[attributeIndex].unitType = TagUnitType.Pixels; // Clear attribute name hash codes m_xmlAttribute[1].nameHashCode = 0; m_xmlAttribute[2].nameHashCode = 0; m_xmlAttribute[3].nameHashCode = 0; m_xmlAttribute[4].nameHashCode = 0; endIndex = startIndex; bool isTagSet = false; bool isValidHtmlTag = false; for (int i = startIndex; i < chars.Length && chars[i].unicode != 0 && tagCharCount < m_htmlTag.Length && chars[i].unicode != '<'; i++) { int unicode = chars[i].unicode; if (unicode == '>') // ASCII Code of End HTML tag '>' { isValidHtmlTag = true; endIndex = i; m_htmlTag[tagCharCount] = (char)0; break; } m_htmlTag[tagCharCount] = (char)unicode; tagCharCount += 1; if (attributeFlag == 1) { if (tagValueType == TagValueType.None) { // Check for attribute type if (unicode == '+' || unicode == '-' || unicode == '.' || (unicode >= '0' && unicode <= '9')) { tagUnitType = TagUnitType.Pixels; tagValueType = m_xmlAttribute[attributeIndex].valueType = TagValueType.NumericalValue; m_xmlAttribute[attributeIndex].valueStartIndex = tagCharCount - 1; m_xmlAttribute[attributeIndex].valueLength += 1; } else if (unicode == '#') { tagUnitType = TagUnitType.Pixels; tagValueType = m_xmlAttribute[attributeIndex].valueType = TagValueType.ColorValue; m_xmlAttribute[attributeIndex].valueStartIndex = tagCharCount - 1; m_xmlAttribute[attributeIndex].valueLength += 1; } else if (unicode == '"') { tagUnitType = TagUnitType.Pixels; tagValueType = m_xmlAttribute[attributeIndex].valueType = TagValueType.StringValue; m_xmlAttribute[attributeIndex].valueStartIndex = tagCharCount; } else { tagUnitType = TagUnitType.Pixels; tagValueType = m_xmlAttribute[attributeIndex].valueType = TagValueType.StringValue; m_xmlAttribute[attributeIndex].valueStartIndex = tagCharCount - 1; m_xmlAttribute[attributeIndex].valueHashCode = (m_xmlAttribute[attributeIndex].valueHashCode << 5) + m_xmlAttribute[attributeIndex].valueHashCode ^ unicode; m_xmlAttribute[attributeIndex].valueLength += 1; } } else { if (tagValueType == TagValueType.NumericalValue) { // Check for termination of numerical value. if (unicode == 'p' || unicode == 'e' || unicode == '%' || unicode == ' ') { attributeFlag = 2; tagValueType = TagValueType.None; switch (unicode) { case 'e': m_xmlAttribute[attributeIndex].unitType = tagUnitType = TagUnitType.FontUnits; break; case '%': m_xmlAttribute[attributeIndex].unitType = tagUnitType = TagUnitType.Percentage; break; default: m_xmlAttribute[attributeIndex].unitType = tagUnitType = TagUnitType.Pixels; break; } attributeIndex += 1; m_xmlAttribute[attributeIndex].nameHashCode = 0; m_xmlAttribute[attributeIndex].valueHashCode = 0; m_xmlAttribute[attributeIndex].valueType = TagValueType.None; m_xmlAttribute[attributeIndex].unitType = TagUnitType.Pixels; m_xmlAttribute[attributeIndex].valueStartIndex = 0; m_xmlAttribute[attributeIndex].valueLength = 0; } else if (attributeFlag != 2) { m_xmlAttribute[attributeIndex].valueLength += 1; } } else if (tagValueType == TagValueType.ColorValue) { if (unicode != ' ') { m_xmlAttribute[attributeIndex].valueLength += 1; } else { attributeFlag = 2; tagValueType = TagValueType.None; tagUnitType = TagUnitType.Pixels; attributeIndex += 1; m_xmlAttribute[attributeIndex].nameHashCode = 0; m_xmlAttribute[attributeIndex].valueType = TagValueType.None; m_xmlAttribute[attributeIndex].unitType = TagUnitType.Pixels; m_xmlAttribute[attributeIndex].valueHashCode = 0; m_xmlAttribute[attributeIndex].valueStartIndex = 0; m_xmlAttribute[attributeIndex].valueLength = 0; } } else if (tagValueType == TagValueType.StringValue) { // Compute HashCode value for the named tag. if (unicode != '"') { m_xmlAttribute[attributeIndex].valueHashCode = (m_xmlAttribute[attributeIndex].valueHashCode << 5) + m_xmlAttribute[attributeIndex].valueHashCode ^ unicode; m_xmlAttribute[attributeIndex].valueLength += 1; } else { attributeFlag = 2; tagValueType = TagValueType.None; tagUnitType = TagUnitType.Pixels; attributeIndex += 1; m_xmlAttribute[attributeIndex].nameHashCode = 0; m_xmlAttribute[attributeIndex].valueType = TagValueType.None; m_xmlAttribute[attributeIndex].unitType = TagUnitType.Pixels; m_xmlAttribute[attributeIndex].valueHashCode = 0; m_xmlAttribute[attributeIndex].valueStartIndex = 0; m_xmlAttribute[attributeIndex].valueLength = 0; } } } } if (unicode == '=') // '=' attributeFlag = 1; // Compute HashCode for the name of the attribute if (attributeFlag == 0 && unicode == ' ') { if (isTagSet) return false; isTagSet = true; attributeFlag = 2; tagValueType = TagValueType.None; tagUnitType = TagUnitType.Pixels; attributeIndex += 1; m_xmlAttribute[attributeIndex].nameHashCode = 0; m_xmlAttribute[attributeIndex].valueType = TagValueType.None; m_xmlAttribute[attributeIndex].unitType = TagUnitType.Pixels; m_xmlAttribute[attributeIndex].valueHashCode = 0; m_xmlAttribute[attributeIndex].valueStartIndex = 0; m_xmlAttribute[attributeIndex].valueLength = 0; } if (attributeFlag == 0) m_xmlAttribute[attributeIndex].nameHashCode = (m_xmlAttribute[attributeIndex].nameHashCode << 3) - m_xmlAttribute[attributeIndex].nameHashCode + unicode; if (attributeFlag == 2 && unicode == ' ') attributeFlag = 0; } if (!isValidHtmlTag) { return false; } //Debug.Log("Tag is [" + m_htmlTag.ArrayToString() + "]. Tag HashCode: " + m_xmlAttribute[0].nameHashCode + " Tag Value HashCode: " + m_xmlAttribute[0].valueHashCode + " Attribute 1 HashCode: " + m_xmlAttribute[1].nameHashCode + " Value HashCode: " + m_xmlAttribute[1].valueHashCode); //for (int i = 0; i < attributeIndex; i++) // Debug.Log("Tag [" + i + "] with HashCode: " + m_xmlAttribute[i].nameHashCode + " has value of [" + new string(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength) + "] Numerical Value: " + ConvertToFloat(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength)); #region Rich Text Tag Processing #if !RICH_TEXT_ENABLED // Special handling of the no parsing tag </noparse> </NOPARSE> tag if (tag_NoParsing && (m_xmlAttribute[0].nameHashCode != 53822163 && m_xmlAttribute[0].nameHashCode != 49429939)) return false; else if (m_xmlAttribute[0].nameHashCode == 53822163 || m_xmlAttribute[0].nameHashCode == 49429939) { tag_NoParsing = false; return true; } // Color <#FFF> 3 Hex values (short form) if (m_htmlTag[0] == 35 && tagCharCount == 4) { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // Color <#FFF7> 4 Hex values with alpha (short form) else if (m_htmlTag[0] == 35 && tagCharCount == 5) { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // Color <#FF00FF> else if (m_htmlTag[0] == 35 && tagCharCount == 7) // if Tag begins with # and contains 7 characters. { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // Color <#FF00FF00> with alpha else if (m_htmlTag[0] == 35 && tagCharCount == 9) // if Tag begins with # and contains 9 characters. { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } else { float value = 0; switch (m_xmlAttribute[0].nameHashCode) { case 98: // <b> case 66: // <B> m_FontStyleInternal |= FontStyles.Bold; m_fontStyleStack.Add(FontStyles.Bold); m_FontWeightInternal = FontWeight.Bold; return true; case 427: // </b> case 395: // </B> if ((m_fontStyle & FontStyles.Bold) != FontStyles.Bold) { if (m_fontStyleStack.Remove(FontStyles.Bold) == 0) { m_FontStyleInternal &= ~FontStyles.Bold; m_FontWeightInternal = m_FontWeightStack.Peek(); } } return true; case 105: // <i> case 73: // <I> m_FontStyleInternal |= FontStyles.Italic; m_fontStyleStack.Add(FontStyles.Italic); return true; case 434: // </i> case 402: // </I> if ((m_fontStyle & FontStyles.Italic) != FontStyles.Italic) { if (m_fontStyleStack.Remove(FontStyles.Italic) == 0) m_FontStyleInternal &= ~FontStyles.Italic; } return true; case 115: // <s> case 83: // <S> m_FontStyleInternal |= FontStyles.Strikethrough; m_fontStyleStack.Add(FontStyles.Strikethrough); if (m_xmlAttribute[1].nameHashCode == 281955 || m_xmlAttribute[1].nameHashCode == 192323) { m_strikethroughColor = HexCharsToColor(m_htmlTag, m_xmlAttribute[1].valueStartIndex, m_xmlAttribute[1].valueLength); m_strikethroughColor.a = m_htmlColor.a < m_strikethroughColor.a ? (byte)(m_htmlColor.a) : (byte)(m_strikethroughColor .a); } else m_strikethroughColor = m_htmlColor; m_strikethroughColorStack.Add(m_strikethroughColor); return true; case 444: // </s> case 412: // </S> if ((m_fontStyle & FontStyles.Strikethrough) != FontStyles.Strikethrough) { if (m_fontStyleStack.Remove(FontStyles.Strikethrough) == 0) m_FontStyleInternal &= ~FontStyles.Strikethrough; } return true; case 117: // <u> case 85: // <U> m_FontStyleInternal |= FontStyles.Underline; m_fontStyleStack.Add(FontStyles.Underline); if (m_xmlAttribute[1].nameHashCode == 281955 || m_xmlAttribute[1].nameHashCode == 192323) { m_underlineColor = HexCharsToColor(m_htmlTag, m_xmlAttribute[1].valueStartIndex, m_xmlAttribute[1].valueLength); m_underlineColor.a = m_htmlColor.a < m_underlineColor.a ? (byte)(m_htmlColor.a) : (byte)(m_underlineColor.a); } else m_underlineColor = m_htmlColor; m_underlineColorStack.Add(m_underlineColor); return true; case 446: // </u> case 414: // </U> if ((m_fontStyle & FontStyles.Underline) != FontStyles.Underline) { m_underlineColor = m_underlineColorStack.Remove(); if (m_fontStyleStack.Remove(FontStyles.Underline) == 0) m_FontStyleInternal &= ~FontStyles.Underline; } return true; case 43045: // <mark=#FF00FF80> case 30245: // <MARK> m_FontStyleInternal |= FontStyles.Highlight; m_fontStyleStack.Add(FontStyles.Highlight); m_highlightColor = HexCharsToColor(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); m_highlightColor.a = m_htmlColor.a < m_highlightColor.a ? (byte)(m_htmlColor.a) : (byte)(m_highlightColor.a); m_highlightColorStack.Add(m_highlightColor); // Handle Mark Tag Attributes for (int i = 0; i < m_xmlAttribute.Length && m_xmlAttribute[i].nameHashCode != 0; i++) { int nameHashCode = m_xmlAttribute[i].nameHashCode; switch (nameHashCode) { case 281955: // color break; case 15087385: // padding int paramCount = GetAttributeParameters(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength, ref m_attributeParameterValues); if (paramCount != 4) return false; m_highlightPadding = new Vector4(m_attributeParameterValues[0], m_attributeParameterValues[1], m_attributeParameterValues[2], m_attributeParameterValues[3]); break; } } return true; case 155892: // </mark> case 143092: // </MARK> if ((m_fontStyle & FontStyles.Highlight) != FontStyles.Highlight) { m_highlightColor = m_highlightColorStack.Remove(); if (m_fontStyleStack.Remove(FontStyles.Highlight) == 0) m_FontStyleInternal &= ~FontStyles.Highlight; } return true; case 6552: // <sub> case 4728: // <SUB> m_fontScaleMultiplier *= m_currentFontAsset.faceInfo.subscriptSize > 0 ? m_currentFontAsset.faceInfo.subscriptSize : 1; m_baselineOffsetStack.Push(m_baselineOffset); m_baselineOffset += m_currentFontAsset.faceInfo.subscriptOffset * m_fontScale * m_fontScaleMultiplier; m_fontStyleStack.Add(FontStyles.Subscript); m_FontStyleInternal |= FontStyles.Subscript; return true; case 22673: // </sub> case 20849: // </SUB> if ((m_FontStyleInternal & FontStyles.Subscript) == FontStyles.Subscript) { if (m_fontScaleMultiplier < 1) { //m_baselineOffset -= m_currentFontAsset.fontInfo.SubscriptOffset * m_fontScale * m_fontScaleMultiplier; m_baselineOffset = m_baselineOffsetStack.Pop(); m_fontScaleMultiplier /= m_currentFontAsset.faceInfo.subscriptSize > 0 ? m_currentFontAsset.faceInfo.subscriptSize : 1; } if (m_fontStyleStack.Remove(FontStyles.Subscript) == 0) m_FontStyleInternal &= ~FontStyles.Subscript; } return true; case 6566: // <sup> case 4742: // <SUP> m_fontScaleMultiplier *= m_currentFontAsset.faceInfo.superscriptSize > 0 ? m_currentFontAsset.faceInfo.superscriptSize : 1; m_baselineOffsetStack.Push(m_baselineOffset); m_baselineOffset += m_currentFontAsset.faceInfo.superscriptOffset * m_fontScale * m_fontScaleMultiplier; m_fontStyleStack.Add(FontStyles.Superscript); m_FontStyleInternal |= FontStyles.Superscript; return true; case 22687: // </sup> case 20863: // </SUP> if ((m_FontStyleInternal & FontStyles.Superscript) == FontStyles.Superscript) { if (m_fontScaleMultiplier < 1) { //m_baselineOffset -= m_currentFontAsset.fontInfo.SuperscriptOffset * m_fontScale * m_fontScaleMultiplier; m_baselineOffset = m_baselineOffsetStack.Pop(); m_fontScaleMultiplier /= m_currentFontAsset.faceInfo.superscriptSize > 0 ? m_currentFontAsset.faceInfo.superscriptSize : 1; } if (m_fontStyleStack.Remove(FontStyles.Superscript) == 0) m_FontStyleInternal &= ~FontStyles.Superscript; } return true; case -330774850: // <font-weight> case 2012149182: // <FONT-WEIGHT> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); //if (value == -9999) return false; //if ((m_fontStyle & FontStyles.Bold) == FontStyles.Bold) //{ // // Nothing happens since Bold is forced on the text. // //m_fontWeight = 700; // return true; //} //// Remove bold style //m_style &= ~FontStyles.Bold; switch ((int)value) { case 100: m_FontWeightInternal = FontWeight.Thin; break; case 200: m_FontWeightInternal = FontWeight.ExtraLight; break; case 300: m_FontWeightInternal = FontWeight.Light; break; case 400: m_FontWeightInternal = FontWeight.Regular; break; case 500: m_FontWeightInternal = FontWeight.Medium; break; case 600: m_FontWeightInternal = FontWeight.SemiBold; break; case 700: m_FontWeightInternal = FontWeight.Bold; break; case 800: m_FontWeightInternal = FontWeight.Heavy; break; case 900: m_FontWeightInternal = FontWeight.Black; break; } m_FontWeightStack.Add(m_FontWeightInternal); return true; case -1885698441: // </font-weight> case 457225591: // </FONT-WEIGHT> m_FontWeightStack.Remove(); if (m_FontStyleInternal == FontStyles.Bold) m_FontWeightInternal = FontWeight.Bold; else m_FontWeightInternal = m_FontWeightStack.Peek(); return true; case 6380: // <pos=000.00px> <pos=0em> <pos=50%> case 4556: // <POS> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_xAdvance = value * (m_isOrthographic ? 1.0f : 0.1f); //m_isIgnoringAlignment = true; return true; case TagUnitType.FontUnits: m_xAdvance = value * m_currentFontSize * (m_isOrthographic ? 1.0f : 0.1f); //m_isIgnoringAlignment = true; return true; case TagUnitType.Percentage: m_xAdvance = m_marginWidth * value / 100; //m_isIgnoringAlignment = true; return true; } return false; case 22501: // </pos> case 20677: // </POS> m_isIgnoringAlignment = false; return true; case 16034505: // <voffset> case 11642281: // <VOFFSET> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_baselineOffset = value * (m_isOrthographic ? 1 : 0.1f); return true; case TagUnitType.FontUnits: m_baselineOffset = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; return true; case TagUnitType.Percentage: //m_baselineOffset = m_marginHeight * val / 100; return false; } return false; case 54741026: // </voffset> case 50348802: // </VOFFSET> m_baselineOffset = 0; return true; case 43991: // <page> case 31191: // <PAGE> // This tag only works when Overflow - Page mode is used. if (m_overflowMode == TextOverflowModes.Page) { m_xAdvance = 0 + tag_LineIndent + tag_Indent; m_lineOffset = 0; m_pageNumber += 1; m_isNewPage = true; } return true; // <BR> tag is now handled inline where it is replaced by a linefeed or \n. //case 544: // <BR> //case 800: // <br> // m_forceLineBreak = true; // return true; case 43969: // <nobr> case 31169: // <NOBR> m_isNonBreakingSpace = true; return true; case 156816: // </nobr> case 144016: // </NOBR> m_isNonBreakingSpace = false; return true; case 45545: // <size=> case 32745: // <SIZE> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: if (m_htmlTag[5] == 43) // <size=+00> { m_currentFontSize = m_fontSize + value; m_sizeStack.Add(m_currentFontSize); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; } else if (m_htmlTag[5] == 45) // <size=-00> { m_currentFontSize = m_fontSize + value; m_sizeStack.Add(m_currentFontSize); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; } else // <size=00.0> { m_currentFontSize = value; m_sizeStack.Add(m_currentFontSize); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; } case TagUnitType.FontUnits: m_currentFontSize = m_fontSize * value; m_sizeStack.Add(m_currentFontSize); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; case TagUnitType.Percentage: m_currentFontSize = m_fontSize * value / 100; m_sizeStack.Add(m_currentFontSize); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; } return false; case 158392: // </size> case 145592: // </SIZE> m_currentFontSize = m_sizeStack.Remove(); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; case 41311: // <font=xx> case 28511: // <FONT> int fontHashCode = m_xmlAttribute[0].valueHashCode; int materialAttributeHashCode = m_xmlAttribute[1].nameHashCode; int materialHashCode = m_xmlAttribute[1].valueHashCode; // Special handling for <font=default> or <font=Default> if (fontHashCode == 764638571 || fontHashCode == 523367755) { m_currentFontAsset = m_materialReferences[0].fontAsset; m_currentMaterial = m_materialReferences[0].material; m_currentMaterialIndex = 0; //Debug.Log("<font=Default> assigning Font Asset [" + m_currentFontAsset.name + "] with Material [" + m_currentMaterial.name + "]."); m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); m_materialReferenceStack.Add(m_materialReferences[0]); return true; } TMP_FontAsset tempFont; Material tempMaterial; // HANDLE NEW FONT ASSET if (MaterialReferenceManager.TryGetFontAsset(fontHashCode, out tempFont)) { //if (tempFont != m_currentFontAsset) //{ // //Debug.Log("Assigning Font Asset: " + tempFont.name); // m_currentFontAsset = tempFont; // m_fontScale = (m_currentFontSize / m_currentFontAsset.fontInfo.PointSize * m_currentFontAsset.fontInfo.Scale * (m_isOrthographic ? 1 : 0.1f)); //} } else { // Load Font Asset tempFont = Resources.Load<TMP_FontAsset>(TMP_Settings.defaultFontAssetPath + new string(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength)); if (tempFont == null) return false; // Add new reference to the font asset as well as default material to the MaterialReferenceManager MaterialReferenceManager.AddFontAsset(tempFont); } // HANDLE NEW MATERIAL if (materialAttributeHashCode == 0 && materialHashCode == 0) { // No material specified then use default font asset material. m_currentMaterial = tempFont.material; m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentMaterial, tempFont, m_materialReferences, m_materialReferenceIndexLookup); m_materialReferenceStack.Add(m_materialReferences[m_currentMaterialIndex]); } else if (materialAttributeHashCode == 103415287 || materialAttributeHashCode == 72669687) // using material attribute { if (MaterialReferenceManager.TryGetMaterial(materialHashCode, out tempMaterial)) { m_currentMaterial = tempMaterial; m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentMaterial, tempFont, m_materialReferences, m_materialReferenceIndexLookup); m_materialReferenceStack.Add(m_materialReferences[m_currentMaterialIndex]); } else { // Load new material tempMaterial = Resources.Load<Material>(TMP_Settings.defaultFontAssetPath + new string(m_htmlTag, m_xmlAttribute[1].valueStartIndex, m_xmlAttribute[1].valueLength)); if (tempMaterial == null) return false; // Add new reference to this material in the MaterialReferenceManager MaterialReferenceManager.AddFontMaterial(materialHashCode, tempMaterial); m_currentMaterial = tempMaterial; m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentMaterial, tempFont, m_materialReferences, m_materialReferenceIndexLookup); m_materialReferenceStack.Add(m_materialReferences[m_currentMaterialIndex]); } } else return false; m_currentFontAsset = tempFont; m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; case 154158: // </font> case 141358: // </FONT> { MaterialReference materialReference = m_materialReferenceStack.Remove(); m_currentFontAsset = materialReference.fontAsset; m_currentMaterial = materialReference.material; m_currentMaterialIndex = materialReference.index; m_fontScale = (m_currentFontSize / m_currentFontAsset.faceInfo.pointSize * m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1 : 0.1f)); return true; } case 103415287: // <material="material name"> case 72669687: // <MATERIAL> materialHashCode = m_xmlAttribute[0].valueHashCode; // Special handling for <material=default> or <material=Default> if (materialHashCode == 764638571 || materialHashCode == 523367755) { // Check if material font atlas texture matches that of the current font asset. //if (m_currentFontAsset.atlas.GetInstanceID() != m_currentMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID()) return false; m_currentMaterial = m_materialReferences[0].material; m_currentMaterialIndex = 0; m_materialReferenceStack.Add(m_materialReferences[0]); return true; } // Check if material if (MaterialReferenceManager.TryGetMaterial(materialHashCode, out tempMaterial)) { // Check if material font atlas texture matches that of the current font asset. //if (m_currentFontAsset.atlas.GetInstanceID() != tempMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID()) return false; m_currentMaterial = tempMaterial; m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentMaterial, m_currentFontAsset, m_materialReferences, m_materialReferenceIndexLookup); m_materialReferenceStack.Add(m_materialReferences[m_currentMaterialIndex]); } else { // Load new material tempMaterial = Resources.Load<Material>(TMP_Settings.defaultFontAssetPath + new string(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength)); if (tempMaterial == null) return false; // Check if material font atlas texture matches that of the current font asset. //if (m_currentFontAsset.atlas.GetInstanceID() != tempMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID()) return false; // Add new reference to this material in the MaterialReferenceManager MaterialReferenceManager.AddFontMaterial(materialHashCode, tempMaterial); m_currentMaterial = tempMaterial; m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentMaterial, m_currentFontAsset , m_materialReferences, m_materialReferenceIndexLookup); m_materialReferenceStack.Add(m_materialReferences[m_currentMaterialIndex]); } return true; case 374360934: // </material> case 343615334: // </MATERIAL> { //if (m_currentMaterial.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID() != m_materialReferenceStack.PreviousItem().material.GetTexture(ShaderUtilities.ID_MainTex).GetInstanceID()) // return false; MaterialReference materialReference = m_materialReferenceStack.Remove(); m_currentMaterial = materialReference.material; m_currentMaterialIndex = materialReference.index; return true; } case 320078: // <space=000.00> case 230446: // <SPACE> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_xAdvance += value * (m_isOrthographic ? 1 : 0.1f); return true; case TagUnitType.FontUnits: m_xAdvance += value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; return true; case TagUnitType.Percentage: // Not applicable return false; } return false; case 276254: // <alpha=#FF> case 186622: // <ALPHA> if (m_xmlAttribute[0].valueLength != 3) return false; m_htmlColor.a = (byte)(HexToInt(m_htmlTag[7]) * 16 + HexToInt(m_htmlTag[8])); return true; case 1750458: // <a name=" "> return false; case 426: // </a> return true; case 43066: // <link="name"> case 30266: // <LINK> if (m_isParsingText && !m_isCalculatingPreferredValues) { int index = m_textInfo.linkCount; if (index + 1 > m_textInfo.linkInfo.Length) TMP_TextInfo.Resize(ref m_textInfo.linkInfo, index + 1); m_textInfo.linkInfo[index].textComponent = this; m_textInfo.linkInfo[index].hashCode = m_xmlAttribute[0].valueHashCode; m_textInfo.linkInfo[index].linkTextfirstCharacterIndex = m_characterCount; m_textInfo.linkInfo[index].linkIdFirstCharacterIndex = startIndex + m_xmlAttribute[0].valueStartIndex; m_textInfo.linkInfo[index].linkIdLength = m_xmlAttribute[0].valueLength; m_textInfo.linkInfo[index].SetLinkID(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); } return true; case 155913: // </link> case 143113: // </LINK> if (m_isParsingText && !m_isCalculatingPreferredValues) { if (m_textInfo.linkCount < m_textInfo.linkInfo.Length) { m_textInfo.linkInfo[m_textInfo.linkCount].linkTextLength = m_characterCount - m_textInfo.linkInfo[m_textInfo.linkCount].linkTextfirstCharacterIndex; m_textInfo.linkCount += 1; } } return true; case 275917: // <align=> case 186285: // <ALIGN> switch (m_xmlAttribute[0].valueHashCode) { case 3774683: // <align=left> m_lineJustification = TextAlignmentOptions.Left; m_lineJustificationStack.Add(m_lineJustification); return true; case 136703040: // <align=right> m_lineJustification = TextAlignmentOptions.Right; m_lineJustificationStack.Add(m_lineJustification); return true; case -458210101: // <align=center> m_lineJustification = TextAlignmentOptions.Center; m_lineJustificationStack.Add(m_lineJustification); return true; case -523808257: // <align=justified> m_lineJustification = TextAlignmentOptions.Justified; m_lineJustificationStack.Add(m_lineJustification); return true; case 122383428: // <align=flush> m_lineJustification = TextAlignmentOptions.Flush; m_lineJustificationStack.Add(m_lineJustification); return true; } return false; case 1065846: // </align> case 976214: // </ALIGN> m_lineJustification = m_lineJustificationStack.Remove(); return true; case 327550: // <width=xx> case 237918: // <WIDTH> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_width = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: return false; //break; case TagUnitType.Percentage: m_width = m_marginWidth * value / 100; break; } return true; case 1117479: // </width> case 1027847: // </WIDTH> m_width = -1; return true; // STYLE tag is now handled inline and replaced by its definition. //case 322689: // <style="name"> //case 233057: // <STYLE> // TMP_Style style = TMP_StyleSheet.GetStyle(m_xmlAttribute[0].valueHashCode); // if (style == null) return false; // m_styleStack.Add(style.hashCode); // // Parse Style Macro // for (int i = 0; i < style.styleOpeningTagArray.Length; i++) // { // if (style.styleOpeningTagArray[i] == 60) // { // if (ValidateHtmlTag(style.styleOpeningTagArray, i + 1, out i) == false) return false; // } // } // return true; //case 1112618: // </style> //case 1022986: // </STYLE> // style = TMP_StyleSheet.GetStyle(m_xmlAttribute[0].valueHashCode); // if (style == null) // { // // Get style from the Style Stack // int styleHashCode = m_styleStack.CurrentItem(); // style = TMP_StyleSheet.GetStyle(styleHashCode); // m_styleStack.Remove(); // } // if (style == null) return false; // //// Parse Style Macro // for (int i = 0; i < style.styleClosingTagArray.Length; i++) // { // if (style.styleClosingTagArray[i] == 60) // ValidateHtmlTag(style.styleClosingTagArray, i + 1, out i); // } // return true; case 281955: // <color> <color=#FF00FF> or <color=#FF00FF00> case 192323: // <COLOR=#FF00FF> // <color=#FFF> 3 Hex (short hand) if (m_htmlTag[6] == 35 && tagCharCount == 10) { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // <color=#FFF7> 4 Hex (short hand) else if (m_htmlTag[6] == 35 && tagCharCount == 11) { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // <color=#FF00FF> 3 Hex pairs if (m_htmlTag[6] == 35 && tagCharCount == 13) { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // <color=#FF00FF00> 4 Hex pairs else if (m_htmlTag[6] == 35 && tagCharCount == 15) { m_htmlColor = HexCharsToColor(m_htmlTag, tagCharCount); m_colorStack.Add(m_htmlColor); return true; } // <color=name> switch (m_xmlAttribute[0].valueHashCode) { case 125395: // <color=red> m_htmlColor = Color.red; m_colorStack.Add(m_htmlColor); return true; case 3573310: // <color=blue> m_htmlColor = Color.blue; m_colorStack.Add(m_htmlColor); return true; case 117905991: // <color=black> m_htmlColor = Color.black; m_colorStack.Add(m_htmlColor); return true; case 121463835: // <color=green> m_htmlColor = Color.green; m_colorStack.Add(m_htmlColor); return true; case 140357351: // <color=white> m_htmlColor = Color.white; m_colorStack.Add(m_htmlColor); return true; case 26556144: // <color=orange> m_htmlColor = new Color32(255, 128, 0, 255); m_colorStack.Add(m_htmlColor); return true; case -36881330: // <color=purple> m_htmlColor = new Color32(160, 32, 240, 255); m_colorStack.Add(m_htmlColor); return true; case 554054276: // <color=yellow> m_htmlColor = Color.yellow; m_colorStack.Add(m_htmlColor); return true; } return false; case 100149144: //<gradient> case 69403544: // <GRADIENT> int gradientPresetHashCode = m_xmlAttribute[0].valueHashCode; TMP_ColorGradient tempColorGradientPreset; // Check if Color Gradient Preset has already been loaded. if (MaterialReferenceManager.TryGetColorGradientPreset(gradientPresetHashCode, out tempColorGradientPreset)) { m_colorGradientPreset = tempColorGradientPreset; } else { // Load Color Gradient Preset if (tempColorGradientPreset == null) { tempColorGradientPreset = Resources.Load<TMP_ColorGradient>(TMP_Settings.defaultColorGradientPresetsPath + new string(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength)); } if (tempColorGradientPreset == null) return false; MaterialReferenceManager.AddColorGradientPreset(gradientPresetHashCode, tempColorGradientPreset); m_colorGradientPreset = tempColorGradientPreset; } m_colorGradientStack.Add(m_colorGradientPreset); // TODO : Add support for defining preset in the tag itself return true; case 371094791: // </gradient> case 340349191: // </GRADIENT> m_colorGradientPreset = m_colorGradientStack.Remove(); return true; case 1983971: // <cspace=xx.x> case 1356515: // <CSPACE> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_cSpacing = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_cSpacing = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: return false; } return true; case 7513474: // </cspace> case 6886018: // </CSPACE> if (!m_isParsingText) return true; // Adjust xAdvance to remove extra space from last character. if (m_characterCount > 0) { m_xAdvance -= m_cSpacing; m_textInfo.characterInfo[m_characterCount - 1].xAdvance = m_xAdvance; } m_cSpacing = 0; return true; case 2152041: // <mspace=xx.x> case 1524585: // <MSPACE> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_monoSpacing = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_monoSpacing = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: return false; } return true; case 7681544: // </mspace> case 7054088: // </MSPACE> m_monoSpacing = 0; return true; case 280416: // <class="name"> return false; case 1071884: // </color> case 982252: // </COLOR> m_htmlColor = m_colorStack.Remove(); return true; case 2068980: // <indent=10px> <indent=10em> <indent=50%> case 1441524: // <INDENT> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: tag_Indent = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: tag_Indent = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: tag_Indent = m_marginWidth * value / 100; break; } m_indentStack.Add(tag_Indent); m_xAdvance = tag_Indent; return true; case 7598483: // </indent> case 6971027: // </INDENT> tag_Indent = m_indentStack.Remove(); //m_xAdvance = tag_Indent; return true; case 1109386397: // <line-indent> case -842656867: // <LINE-INDENT> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: tag_LineIndent = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: tag_LineIndent = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: tag_LineIndent = m_marginWidth * value / 100; break; } m_xAdvance += tag_LineIndent; return true; case -445537194: // </line-indent> case 1897386838: // </LINE-INDENT> tag_LineIndent = 0; return true; case 2246877: // <sprite=x> case 1619421: // <SPRITE> int spriteAssetHashCode = m_xmlAttribute[0].valueHashCode; TMP_SpriteAsset tempSpriteAsset; m_spriteIndex = -1; // CHECK TAG FORMAT if (m_xmlAttribute[0].valueType == TagValueType.None || m_xmlAttribute[0].valueType == TagValueType.NumericalValue) { // No Sprite Asset is assigned to the text object if (m_spriteAsset != null) { m_currentSpriteAsset = m_spriteAsset; } else if (m_defaultSpriteAsset != null) { m_currentSpriteAsset = m_defaultSpriteAsset; } else if (m_defaultSpriteAsset == null) { if (TMP_Settings.defaultSpriteAsset != null) m_defaultSpriteAsset = TMP_Settings.defaultSpriteAsset; else m_defaultSpriteAsset = Resources.Load<TMP_SpriteAsset>("Sprite Assets/Default Sprite Asset"); m_currentSpriteAsset = m_defaultSpriteAsset; } // No valid sprite asset available if (m_currentSpriteAsset == null) return false; } else { // A Sprite Asset has been specified if (MaterialReferenceManager.TryGetSpriteAsset(spriteAssetHashCode, out tempSpriteAsset)) { m_currentSpriteAsset = tempSpriteAsset; } else { // Load Sprite Asset if (tempSpriteAsset == null) { tempSpriteAsset = Resources.Load<TMP_SpriteAsset>(TMP_Settings.defaultSpriteAssetPath + new string(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength)); } if (tempSpriteAsset == null) return false; //Debug.Log("Loading & assigning new Sprite Asset: " + tempSpriteAsset.name); MaterialReferenceManager.AddSpriteAsset(spriteAssetHashCode, tempSpriteAsset); m_currentSpriteAsset = tempSpriteAsset; } } // Handling of <sprite=index> legacy tag format. if (m_xmlAttribute[0].valueType == TagValueType.NumericalValue) // <sprite=index> { int index = (int)ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (index == -9999) return false; // Check to make sure sprite index is valid if (index > m_currentSpriteAsset.spriteCharacterTable.Count - 1) return false; m_spriteIndex = index; } m_spriteColor = s_colorWhite; m_tintSprite = false; // Handle Sprite Tag Attributes for (int i = 0; i < m_xmlAttribute.Length && m_xmlAttribute[i].nameHashCode != 0; i++) { //Debug.Log("Attribute[" + i + "].nameHashCode=" + m_xmlAttribute[i].nameHashCode + " Value:" + ConvertToFloat(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength)); int nameHashCode = m_xmlAttribute[i].nameHashCode; int index = 0; switch (nameHashCode) { case 43347: // <sprite name=""> case 30547: // <SPRITE NAME=""> m_currentSpriteAsset = TMP_SpriteAsset.SearchForSpriteByHashCode(m_currentSpriteAsset, m_xmlAttribute[i].valueHashCode, true, out index); if (index == -1) return false; m_spriteIndex = index; break; case 295562: // <sprite index=> case 205930: // <SPRITE INDEX=> index = (int)ConvertToFloat(m_htmlTag, m_xmlAttribute[1].valueStartIndex, m_xmlAttribute[1].valueLength); if (index == -9999) return false; // Check to make sure sprite index is valid if (index > m_currentSpriteAsset.spriteCharacterTable.Count - 1) return false; m_spriteIndex = index; break; case 45819: // tint case 33019: // TINT m_tintSprite = ConvertToFloat(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength) != 0; break; case 281955: // color=#FF00FF80 case 192323: // COLOR m_spriteColor = HexCharsToColor(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength); break; case 39505: // anim="0,16,12" start, end, fps case 26705: // ANIM //Debug.Log("Start: " + m_xmlAttribute[i].valueStartIndex + " Length: " + m_xmlAttribute[i].valueLength); int paramCount = GetAttributeParameters(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength, ref m_attributeParameterValues); if (paramCount != 3) return false; m_spriteIndex = (int)m_attributeParameterValues[0]; if (m_isParsingText) { // TODO : fix this! //if (m_attributeParameterValues[0] > m_currentSpriteAsset.spriteInfoList.Count - 1 || m_attributeParameterValues[1] > m_currentSpriteAsset.spriteInfoList.Count - 1) // return false; spriteAnimator.DoSpriteAnimation(m_characterCount, m_currentSpriteAsset, m_spriteIndex, (int)m_attributeParameterValues[1], (int)m_attributeParameterValues[2]); } break; //case 45545: // size //case 32745: // SIZE // break; default: if (nameHashCode != 2246877 && nameHashCode != 1619421) return false; break; } } if (m_spriteIndex == -1) return false; // Material HashCode for the Sprite Asset is the Sprite Asset Hash Code m_currentMaterialIndex = MaterialReference.AddMaterialReference(m_currentSpriteAsset.material, m_currentSpriteAsset, m_materialReferences, m_materialReferenceIndexLookup); m_textElementType = TMP_TextElementType.Sprite; return true; case 730022849: // <lowercase> case 514803617: // <LOWERCASE> m_FontStyleInternal |= FontStyles.LowerCase; m_fontStyleStack.Add(FontStyles.LowerCase); return true; case -1668324918: // </lowercase> case -1883544150: // </LOWERCASE> if ((m_fontStyle & FontStyles.LowerCase) != FontStyles.LowerCase) { if (m_fontStyleStack.Remove(FontStyles.LowerCase) == 0) m_FontStyleInternal &= ~FontStyles.LowerCase; } return true; case 13526026: // <allcaps> case 9133802: // <ALLCAPS> case 781906058: // <uppercase> case 566686826: // <UPPERCASE> m_FontStyleInternal |= FontStyles.UpperCase; m_fontStyleStack.Add(FontStyles.UpperCase); return true; case 52232547: // </allcaps> case 47840323: // </ALLCAPS> case -1616441709: // </uppercase> case -1831660941: // </UPPERCASE> if ((m_fontStyle & FontStyles.UpperCase) != FontStyles.UpperCase) { if (m_fontStyleStack.Remove(FontStyles.UpperCase) == 0) m_FontStyleInternal &= ~FontStyles.UpperCase; } return true; case 766244328: // <smallcaps> case 551025096: // <SMALLCAPS> m_FontStyleInternal |= FontStyles.SmallCaps; m_fontStyleStack.Add(FontStyles.SmallCaps); return true; case -1632103439: // </smallcaps> case -1847322671: // </SMALLCAPS> if ((m_fontStyle & FontStyles.SmallCaps) != FontStyles.SmallCaps) { if (m_fontStyleStack.Remove(FontStyles.SmallCaps) == 0) m_FontStyleInternal &= ~FontStyles.SmallCaps; } return true; case 2109854: // <margin=00.0> <margin=00em> <margin=50%> case 1482398: // <MARGIN> // Check value type switch (m_xmlAttribute[0].valueType) { case TagValueType.NumericalValue: value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); // px if (value == -9999) return false; // Determine tag unit type switch (tagUnitType) { case TagUnitType.Pixels: m_marginLeft = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_marginLeft = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: m_marginLeft = (m_marginWidth - (m_width != -1 ? m_width : 0)) * value / 100; break; } m_marginLeft = m_marginLeft >= 0 ? m_marginLeft : 0; m_marginRight = m_marginLeft; return true; case TagValueType.None: for (int i = 1; i < m_xmlAttribute.Length && m_xmlAttribute[i].nameHashCode != 0; i++) { // Get attribute name int nameHashCode = m_xmlAttribute[i].nameHashCode; switch (nameHashCode) { case 42823: // <margin left=value> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength); // px if (value == -9999) return false; switch (m_xmlAttribute[i].unitType) { case TagUnitType.Pixels: m_marginLeft = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_marginLeft = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: m_marginLeft = (m_marginWidth - (m_width != -1 ? m_width : 0)) * value / 100; break; } m_marginLeft = m_marginLeft >= 0 ? m_marginLeft : 0; break; case 315620: // <margin right=value> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength); // px if (value == -9999) return false; switch (m_xmlAttribute[i].unitType) { case TagUnitType.Pixels: m_marginRight = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_marginRight = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: m_marginRight = (m_marginWidth - (m_width != -1 ? m_width : 0)) * value / 100; break; } m_marginRight = m_marginRight >= 0 ? m_marginRight : 0; break; } } return true; } return false; case 7639357: // </margin> case 7011901: // </MARGIN> m_marginLeft = 0; m_marginRight = 0; return true; case 1100728678: // <margin-left=xx.x> case -855002522: // <MARGIN-LEFT> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); // px if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_marginLeft = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_marginLeft = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: m_marginLeft = (m_marginWidth - (m_width != -1 ? m_width : 0)) * value / 100; break; } m_marginLeft = m_marginLeft >= 0 ? m_marginLeft : 0; return true; case -884817987: // <margin-right=xx.x> case -1690034531: // <MARGIN-RIGHT> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); // px if (value == -9999) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_marginRight = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_marginRight = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: m_marginRight = (m_marginWidth - (m_width != -1 ? m_width : 0)) * value / 100; break; } m_marginRight = m_marginRight >= 0 ? m_marginRight : 0; return true; case 1109349752: // <line-height=xx.x> case -842693512: // <LINE-HEIGHT> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999 || value == 0) return false; switch (tagUnitType) { case TagUnitType.Pixels: m_lineHeight = value * (m_isOrthographic ? 1 : 0.1f); break; case TagUnitType.FontUnits: m_lineHeight = value * (m_isOrthographic ? 1 : 0.1f) * m_currentFontSize; break; case TagUnitType.Percentage: m_lineHeight = m_fontAsset.faceInfo.lineHeight * value / 100 * m_fontScale; break; } return true; case -445573839: // </line-height> case 1897350193: // </LINE-HEIGHT> m_lineHeight = TMP_Math.FLOAT_UNSET; return true; case 15115642: // <noparse> case 10723418: // <NOPARSE> tag_NoParsing = true; return true; case 1913798: // <action> case 1286342: // <ACTION> int actionID = m_xmlAttribute[0].valueHashCode; if (m_isParsingText) { m_actionStack.Add(actionID); Debug.Log("Action ID: [" + actionID + "] First character index: " + m_characterCount); } //if (m_isParsingText) //{ // TMP_Action action = TMP_Action.GetAction(m_xmlAttribute[0].valueHashCode); //} return true; case 7443301: // </action> case 6815845: // </ACTION> if (m_isParsingText) { Debug.Log("Action ID: [" + m_actionStack.CurrentItem() + "] Last character index: " + (m_characterCount - 1)); } m_actionStack.Remove(); return true; case 315682: // <scale=xx.x> case 226050: // <SCALE=xx.x> value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; m_FXMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(value, 1, 1)); m_isFXMatrixSet = true; return true; case 1105611: // </scale> case 1015979: // </SCALE> m_isFXMatrixSet = false; return true; case 2227963: // <rotate=xx.x> case 1600507: // <ROTATE=xx.x> // TODO: Add ability to use Random Rotation value = ConvertToFloat(m_htmlTag, m_xmlAttribute[0].valueStartIndex, m_xmlAttribute[0].valueLength); if (value == -9999) return false; m_FXMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, value), Vector3.one); m_isFXMatrixSet = true; return true; case 7757466: // </rotate> case 7130010: // </ROTATE> m_isFXMatrixSet = false; return true; case 317446: // <table> case 227814: // <TABLE> switch (m_xmlAttribute[1].nameHashCode) { case 327550: // width float tableWidth = ConvertToFloat(m_htmlTag, m_xmlAttribute[1].valueStartIndex, m_xmlAttribute[1].valueLength); switch (tagUnitType) { case TagUnitType.Pixels: Debug.Log("Table width = " + tableWidth + "px."); break; case TagUnitType.FontUnits: Debug.Log("Table width = " + tableWidth + "em."); break; case TagUnitType.Percentage: Debug.Log("Table width = " + tableWidth + "%."); break; } break; } return true; case 1107375: // </table> case 1017743: // </TABLE> return true; case 926: // <tr> case 670: // <TR> return true; case 3229: // </tr> case 2973: // </TR> return true; case 916: // <th> case 660: // <TH> // Set style to bold and center alignment return true; case 3219: // </th> case 2963: // </TH> return true; case 912: // <td> case 656: // <TD> // Style options for (int i = 1; i < m_xmlAttribute.Length && m_xmlAttribute[i].nameHashCode != 0; i++) { switch (m_xmlAttribute[i].nameHashCode) { case 327550: // width float tableWidth = ConvertToFloat(m_htmlTag, m_xmlAttribute[i].valueStartIndex, m_xmlAttribute[i].valueLength); switch (tagUnitType) { case TagUnitType.Pixels: Debug.Log("Table width = " + tableWidth + "px."); break; case TagUnitType.FontUnits: Debug.Log("Table width = " + tableWidth + "em."); break; case TagUnitType.Percentage: Debug.Log("Table width = " + tableWidth + "%."); break; } break; case 275917: // align switch (m_xmlAttribute[i].valueHashCode) { case 3774683: // left Debug.Log("TD align=\"left\"."); break; case 136703040: // right Debug.Log("TD align=\"right\"."); break; case -458210101: // center Debug.Log("TD align=\"center\"."); break; case -523808257: // justified Debug.Log("TD align=\"justified\"."); break; } break; } } return true; case 3215: // </td> case 2959: // </TD> return true; } } #endif #endregion return false; } } } ```
Shurcheh (, also Romanized as Shūrcheh) is a village in Gowdin Rural District, in the Central District of Kangavar County, Kermanshah Province, Iran. At the 2016 census, its population was 696, in 203 families. References Populated places in Kangavar County
```python A simple way to select a random item from a `list/tuple` data stucture Special attributes of objects and classes Get the most of `float`s Keep things in order with `OrderedDict` Prioritize your `queue` ```
```xml import { Navigate, RouteObject } from "react-router-dom"; import PATHS from "config/constants/sub/paths"; export const onboardingRoutes: RouteObject[] = [ { path: PATHS.ONBOARDING.RELATIVE, element: <Navigate to={PATHS.RULES.MY_RULES.ABSOLUTE} />, }, { path: PATHS.RULES.CREATE + "*", element: <Navigate to={PATHS.RULES.MY_RULES.ABSOLUTE} state={{ from: PATHS.RULES.CREATE }} />, }, { path: PATHS.GETTING_STARTED, element: <Navigate to={PATHS.HOME.ABSOLUTE} state={{ from: PATHS.GETTING_STARTED }} />, }, ]; ```
```javascript /* Use of this source code is governed by a MIT license that can be found in the LICENSE file. */ Tests.registerAsync("Socket connect", function(next) { var client = new Socket(TESTS_SERVER_HOST, TESTS_SERVER_PORT).connect(); client.onconnect = function() { Assert.equal(client, this); client.disconnect(); next(); } }, 500); Tests.registerAsync("Socket listen", function(next) { var server = new Socket("127.0.0.1", 9027).listen(); var client = new Socket("127.0.0.1", 9027).connect(); var done = false; server.onaccept = function(new_client) { new_client.foo = "bar"; new_client.write("data"); Assert.equal(new_client.ip, "127.0.0.1"); } client.onread = function(data) { Assert.equal(data, "data"); this.write("reply"); } server.onread = function(new_client, data) { Assert.equal(data, "reply"); Assert.equal(new_client.foo, "bar"); new_client.disconnect(); done = true; } client.ondisconnect = function() { Assert.equal(done, true); next(); } }, 500); Tests.registerAsync("Socket framing", function(next) { var server = new Socket("127.0.0.1", 9028).listen(); var client = new Socket("127.0.0.1", 9028).connect(); server.readline = true; client.readline = true; var done = 0; const datainc = "lastframe\n"; server.onaccept = function(new_client) { new_client.write("data"); setTimeout(function() { new_client.write("data2\nframe2\n"); for (let i = 0; i < datainc.length; i++) { setTimeout(function(pos) { new_client.write(datainc[pos]); }, 50 * i, i); } }, 100); } client.onread = function(data) { if (done == 0) { Assert.equal(data, "datadata2"); } else if (done == 1) { Assert.equal(data, "frame2"); } else if (done == 2) { Assert.equal(data, "lastframe"); this.disconnect(); next(); } done++; } server.onread = function(new_client, data) { } client.ondisconnect = function() { } }, 3000); Tests.registerAsync("Socket lz4", function(next) { var server = new Socket("127.0.0.1", 9029).listen("tcp-lz4"); var client = new Socket("127.0.0.1", 9029).connect("tcp-lz4"); client.encoding = "utf8"; server.encoding = "utf8"; client.readline = true; const payload = "On sait depuis longtemps que travailler avec du texte lisible et contenant du sens est source de distractions, et empche de se concentrer sur la mise en page elle-mme. L'avantage du Lorem Ipsum sur un texte gnrique comme 'Du texte. Du texte. Du texte.' est qu'il possde une distribution de lettres plus ou moins normale, et en tout cas comparable avec celle du franais standard. De nombreuses suites logicielles de mise en page ou diteurs de sites Web ont fait du Lorem Ipsum leur faux texte par dfaut, et une recherche pour 'Lorem Ipsum' vous conduira vers de nombreux sites qui n'en sont encore qu' leur phase de construction. Plusieurs versions sont apparues avec le temps, parfois par accident, souvent intentionnellement (histoire d'y rajouter de petits clins d'oeil, voire des phrases embarassantes). On sait depuis longtemps que travailler avec du texte lisible et contenant du sens est source de distractions, et empche de se concentrer sur la mise en page elle-mme. L'avantage du Lorem Ipsum sur un texte gnrique comme 'Du texte. Du texte. Du texte.' est qu'il possde une distribution de lettres plus ou moins normale, et en tout cas comparable avec celle du franais standard. De nombreuses suites logicielles de mise en page ou diteurs de sites Web ont fait du Lorem Ipsum leur faux texte par dfaut, et une recherche pour 'Lorem Ipsum' vous conduira vers de nombreux sites qui n'en sont encore qu' leur phase de construction. Plusieurs versions sont apparues avec le temps, parfois par accident, souvent intentionnellement (histoire d'y rajouter de petits clins d'oeil, voire des phrases embarassantes)."; console.log(payload.length); var done = 0; server.onaccept = function(new_client) { new_client.write(payload) new_client.write("\n"); } client.onread = function(data) { console.log("Read", data.length); Assert.equal(data, payload); next(); } }, 500); ```
Grismore is an unincorporated community in Perry Township, Noble County, in the U.S. state of Indiana. Geography Grismore is located at . References Unincorporated communities in Noble County, Indiana Unincorporated communities in Indiana
Ayşenil Şamlıoğlu (born 20 March 1956) is a Turkish actress, theatre director, and author. In 1974, she enrolled in the Istanbul University School of Journalism and Public Relations, but left the university and moved to Germany to take foreign language lessons in Frankfurt. Şamlıoğlu soon became interested in theatre and participated in works with amateur theatre groups. Upon returning to Turkey, Şamlıoğlu became enrolled in METU School of Architecture but left the school for the second time to join Anadolu Agency. After working there for a year, she joined a commercial agency as a drawer. She eventually graduated from Hacettepe University Ankara State Conservatory with a degree in theatre studies and in 1982 began working for Adana State Theatre as an actress and director. Between 1988 and 1989, she gave theatre lessons at Hacettepe University and for a while worked as the general secretary for state theatre. Şamlıoğlu also authored Kaçıklık Diploması, which was adapted into a movie by Tunç Başaran. Her breakthrough came with her roles in the series Ferhunde Hanımlar and Bizim Evin Halleri. Her role in Yol Arkadaşım as "Hafize" made her widely known in Turkey. Alongside her career as an actress, she has worked in Istanbul City Theatres and Semaver Company as both a director and actress. In May 2009, Şamlıoğlu was appointed as the general art director for Istanbul City Theatres. She is the daughter of the former President of the Court of Accounts Servet Şamlıoğlu (1926–1991). She also served as a judge at the 17th Afife Theatre Awards. Theatre As director Kozalar : Adalet Ağaoğlu - Pangar - 2016 Dil Kuşu : Pelin Temur - Destar Theatre - 2015 Bana Mastikayı Çalsana : Nilbanu Engindeniz - Aysa Production Theatre - 2007 Dünyanın Ortasında Bir Yer : Özen Yula - Istanbul State Theatre - 2007 The Condemned of Altona : Jean-Paul Sartre - Ankara State Theatre - 2006 Süleyman ve Öbürsüler : Max Frisch \ Yavuz Pekman - Semaver Company - 2005 Gayri Resmi Hürrem : Özen Yula - Istanbul City Theatres - 2004 Külhan Beyi Operası : Ülkü Ayvaz - Antalya State Theatre - 2002 Bina : Behiç Ak - Sivas State Theatre - 2001 The Good Soldier Švejk : Bertolt Brecht - Antalya State Theatre - 2001 The Wasps : Aristophanes - Ankara State Theatre - 2000 Pazartesi Perşembe : Musahipzade Celal - Adana State Theatre - 1999 Frank V : Friedrich Dürrenmatt - Adana State Theatre - 1998 Kozalar : Adalet Ağaoğlu - Istanbul State Theatre - 1997 Ölüler Konuşmak İster : Melih Cevdet Anday - Istanbul State Theatre - 1997 Ich Feuerbach : Tankred Dorst - Ankara State Theatre - 1995 As actress Öldün, Duydun mu? : Yiğit Sertdemir - Altıdan Sonra Theatre - 2013 Evaristo : Civan Canova - Altıdan Sonra Theatre - 2013 Geyikler Lanetler : Murathan Mungan - Ankara State Theatre Gılgameş : Zeynep Avcı - Ankara State Theatre - 1996 Hüzün Coşkusu Altındağ : Yaşar Seymen\Adem Atar - Ankara State Theatre - 1992 Deli Dumrul : Güngör Dilmen - Ankara State Theatre - 1990 Aşkımız Aksaray!ın En Büyük Yangını : Güngör Dilmen - Ankara State Theatre - 1989 Afife Jale : Nezihe Araz - Ankara State Theatre - 1987 Detective Story : Sidney Kingsley - Ankara State Theatre - 1985 Filmography Film Love, Spells and All That (Aşk, Büyü vs.) - 2019 İşe Yarar Bir Şey : Pelin Esmer - 2017 Gülistan Sen Aydınlatırsın Geceyi : Onur Ünlü - 2013 Şevket Eyyvah Eyvah 3 : Hakan Algül - 2013 Necla Eyyvah Eyvah 2 : Hakan Algül - 2010 Necla Prensesin Uykusu : Çağan Irmak - 2010 Ay Lav Yu : Sermiyan Midyat - 2009 Meleğin Sırları : Aclan Büyüktürkoğlu - 2008 Sınav : Ömer Faruk Sorak - 2006 İnşaat : Ömer Vargı - 2003 O da Beni Seviyor : Barış Pirhasan - 2001 Kaçıklık Diploması : Tunç Başaran - 1998 Television Gül Masalı (2022) - Fatma Yargı (2021–2022) - Şahver Bunu Bi' Düsünün (2021) - Münevver Menajerimi Ara (2020–2021) - Peride Sener Hizmetçiler (2020) - Nimet Atahanli Jet Sosyete (2018–2020) - Zahide Özpamuk Tatlı İntikam (2016) - Meliha Yılmaz Kocamın Ailesi (2014) Medcezir (2014) Bebek İşi (2013) Galip Derviş(2013) Aldırma Gönül (2013) Kötü Yol (2012) Bizim Yenge (2011) Sen de Gitme (2011) Çakıl Taşları (2010) Yol Arkadaşım (2008) Fikrimin İnce Gülü (2007) Kabuslar Evi (2006) İlk Aşkım (2006) Taşların Sırrı (2006) Doktorlar (2006) Nefes Nefese (2005) Avrupa Yakası (2004) Bizim Evin Halleri (2000) Ferhunde Hanımlar (1993) Awards 1988, The Art Society's Best Supporting Actress award (Afife Jale) 1997, The Art Society's Director of the Year award (Pierre Ray) 1998, İsmet Küntay Best Director award (Kozalar) 1998, İsmet Küntay Best Director award (Ölüler Konuşmak İster) 2000, İsmet Küntay Best Director award (Pazartesi Perşembe) 2000, Çırağan Lions Club - Türkan Kahramankaptan Best Production award (Pazartesi Perşembe) 2000, The Art Society's Best Production award (Pazartesi Perşembe) 2000, The Critics Association Best Director award (Pazartesi Perşembe) 2000, Afife Most Successful Director award (Gayrı Resmi Hürrem) References External links 1956 births Turkish theatre directors Turkish women theatre directors Turkish stage actresses Turkish film actresses Turkish television actresses Actresses from Istanbul Living people Hacettepe University Ankara State Conservatory alumni
```yaml pip ```
```yaml Parameters: datastoreName: Type: String Description: The name for the data store. userAccountID: Type: String Description: The bucket name for DICOM storage. BootstrapVersion: Type: AWS::SSM::Parameter::Value<String> Default: /cdk-bootstrap/hnb659fds/version Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip] Resources: docexampledicombucket120080DD: Type: AWS::S3::Bucket Properties: Tags: - Key: aws-cdk:auto-delete-objects Value: "true" UpdateReplacePolicy: Delete DeletionPolicy: Delete Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/doc-example-dicom_bucket/Resource docexampledicombucketPolicy983C1F36: Type: AWS::S3::BucketPolicy Properties: Bucket: Ref: docexampledicombucket120080DD PolicyDocument: Statement: - Action: - s3:PutBucketPolicy - s3:GetBucket* - s3:List* - s3:DeleteObject* Effect: Allow Principal: AWS: Fn::GetAtt: - CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092 - Arn Resource: - Fn::GetAtt: - docexampledicombucket120080DD - Arn - Fn::Join: - "" - - Fn::GetAtt: - docexampledicombucket120080DD - Arn - /* Version: "2012-10-17" Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/doc-example-dicom_bucket/Policy/Resource docexampledicombucketAutoDeleteObjectsCustomResource27DACD41: Type: Custom::S3AutoDeleteObjects Properties: ServiceToken: Fn::GetAtt: - CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F - Arn BucketName: Ref: docexampledicombucket120080DD DependsOn: - docexampledicombucketPolicy983C1F36 UpdateReplacePolicy: Delete DeletionPolicy: Delete Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/doc-example-dicom_bucket/AutoDeleteObjectsCustomResource/Default CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: lambda.amazonaws.com ManagedPolicyArns: - Fn::Sub: arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F: Type: AWS::Lambda::Function Properties: Code: ZipFile: | "use strict";var C=Object.create,i=Object.defineProperty,I=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,P=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,L=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},d=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of w(t))!A.call(e,s)&&s!==o&&i(e,s,{get:()=>t[s],enumerable:!(r=I(t,s))||r.enumerable});return e},l=(e,t,o)=>(o=e!=null?C(P(e)):{},d(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),k=e=>d(i({},"__esModule",{value:!0}),e),U={};L(U,{autoDeleteHandler:()=>S,handler:()=>_}),module.exports=k(U);var h=require("@aws-sdk/client-s3"),y=l(require("https")),m=l(require("url")),a={sendHttpRequest:T,log:b,includeStackTraces:!0,userHandlerIndex:"./index"},p="AWSCDK::CustomResourceProviderFramework::CREATE_FAILED",B="AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID";function R(e){return async(t,o)=>{let r={...t,ResponseURL:"..."};if(a.log(JSON.stringify(r,void 0,2)),t.RequestType==="Delete"&&t.PhysicalResourceId===p){a.log("ignoring DELETE event caused by a failed CREATE event"),await u("SUCCESS",t);return}try{let s=await e(r,o),n=D(t,s);await u("SUCCESS",n)}catch(s){let n={...t,Reason:a.includeStackTraces?s.stack:s.message};n.PhysicalResourceId||(t.RequestType==="Create"?(a.log("CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored"),n.PhysicalResourceId=p):a.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(t)}`)),await u("FAILED",n)}}}function D(e,t={}){let o=t.PhysicalResourceId??e.PhysicalResourceId??e.RequestId;if(e.RequestType==="Delete"&&o!==e.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${e.PhysicalResourceId}" to "${t.PhysicalResourceId}" during deletion`);return{...e,...t,PhysicalResourceId:o}}async function u(e,t){let o={Status:e,Reason:t.Reason??e,StackId:t.StackId,RequestId:t.RequestId,PhysicalResourceId:t.PhysicalResourceId||B,LogicalResourceId:t.LogicalResourceId,NoEcho:t.NoEcho,Data:t.Data};a.log("submit response to cloudformation",o);let r=JSON.stringify(o),s=m.parse(t.ResponseURL),n={hostname:s.hostname,path:s.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(r,"utf8")}};await O({attempts:5,sleep:1e3},a.sendHttpRequest)(n,r)}async function T(e,t){return new Promise((o,r)=>{try{let s=y.request(e,n=>o());s.on("error",r),s.write(t),s.end()}catch(s){r(s)}})}function b(e,...t){console.log(e,...t)}function O(e,t){return async(...o)=>{let r=e.attempts,s=e.sleep;for(;;)try{return await t(...o)}catch(n){if(r--<=0)throw n;await x(Math.floor(Math.random()*s)),s*=2}}}async function x(e){return new Promise(t=>setTimeout(t,e))}var g="aws-cdk:auto-delete-objects",H=JSON.stringify({Version:"2012-10-17",Statement:[]}),c=new h.S3({}),_=R(S);async function S(e){switch(e.RequestType){case"Create":return;case"Update":return F(e);case"Delete":return f(e.ResourceProperties?.BucketName)}}async function F(e){let t=e,o=t.OldResourceProperties?.BucketName,r=t.ResourceProperties?.BucketName;if(r!=null&&o!=null&&r!==o)return f(o)}async function N(e){try{let t=(await c.getBucketPolicy({Bucket:e}))?.Policy??H,o=JSON.parse(t);o.Statement.push({Principal:"*",Effect:"Deny",Action:["s3:PutObject"],Resource:[`arn:aws:s3:::${e}/*`]}),await c.putBucketPolicy({Bucket:e,Policy:JSON.stringify(o)})}catch(t){if(t.name==="NoSuchBucket")throw t;console.log(`Could not set new object deny policy on bucket '${e}' prior to deletion.`)}}async function E(e){let t=await c.listObjectVersions({Bucket:e}),o=[...t.Versions??[],...t.DeleteMarkers??[]];if(o.length===0)return;let r=o.map(s=>({Key:s.Key,VersionId:s.VersionId}));await c.deleteObjects({Bucket:e,Delete:{Objects:r}}),t?.IsTruncated&&await E(e)}async function f(e){if(!e)throw new Error("No BucketName was provided.");try{if(!await W(e)){console.log(`Bucket does not have '${g}' tag, skipping cleaning.`);return}await N(e),await E(e)}catch(t){if(t.name==="NoSuchBucket"){console.log(`Bucket '${e}' does not exist.`);return}throw t}}async function W(e){return(await c.getBucketTagging({Bucket:e})).TagSet?.some(o=>o.Key===g&&o.Value==="true")} Timeout: 900 MemorySize: 128 Handler: index.handler Role: Fn::GetAtt: - CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092 - Arn Runtime: nodejs18.x Description: Fn::Join: - "" - - "Lambda function for auto-deleting objects in " - Ref: docexampledicombucket120080DD - " S3 bucket." DependsOn: - CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092 Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler aws:asset:path: asset.your_sha256_hash aws:asset:property: Code MyCfnDatastore: Type: AWS::HealthImaging::Datastore Properties: DatastoreName: Ref: datastoreName Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/MyCfnDatastore docexampleimportrole77AD6B59: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Condition: ForAllValues:StringEquals: aws:SourceAccount: Ref: userAccountID ForAllValues:ArnEquals: aws:SourceArn: Fn::GetAtt: - MyCfnDatastore - DatastoreArn Effect: Allow Principal: Service: medical-imaging.amazonaws.com Version: "2012-10-17" Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/doc-example-import-role/Resource docexampleimportroleDefaultPolicy627063D0: Type: AWS::IAM::Policy Properties: PolicyDocument: Statement: - Action: s3:ListBucket Effect: Allow Resource: Fn::GetAtt: - docexampledicombucket120080DD - Arn - Action: s3:GetObject Effect: Allow Resource: Fn::Join: - "" - - Fn::GetAtt: - docexampledicombucket120080DD - Arn - /* - Action: s3:PutObject Effect: Allow Resource: Fn::Join: - "" - - Fn::GetAtt: - docexampledicombucket120080DD - Arn - /* Version: "2012-10-17" PolicyName: docexampleimportroleDefaultPolicy627063D0 Roles: - Ref: docexampleimportrole77AD6B59 Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/doc-example-import-role/DefaultPolicy/Resource CDKMetadata: Type: AWS::CDK::Metadata Properties: Analytics: v2:deflate64:H4sIAAAAAAAA/1VQy47CMAz8Fu6paVkJcYVyp+p+wMqkBkybBCUOK1T130kp4nGascfj1wKKPId8hv8h002bdbyH/ldQt6o82Ao9GhLyKul/ffiBfhN1SzKKTzZB5TrWt3d6igd1IuzkxAaPbI+Q5C0KBnGeFKOBvnYdja4Hvps87YMqYyo2NQUXvZ4qX/xLqry7cpM2XYdAki4YB6pP4y7KJT42L51tWNjZQVnXEJzD/FqsoFimR5wDc+ajFTYE9YR3kjjpWiUBAAA= Metadata: aws:cdk:path: doc-example-healthimaging-workflow-stack/CDKMetadata/Default Condition: CDKMetadataAvailable Outputs: BucketName: Value: Ref: docexampledicombucket120080DD RoleArn: Value: Fn::GetAtt: - docexampleimportrole77AD6B59 - Arn DatastoreID: Value: Fn::GetAtt: - MyCfnDatastore - DatastoreId Conditions: CDKMetadataAvailable: Fn::Or: - Fn::Or: - Fn::Equals: - Ref: AWS::Region - af-south-1 - Fn::Equals: - Ref: AWS::Region - ap-east-1 - Fn::Equals: - Ref: AWS::Region - ap-northeast-1 - Fn::Equals: - Ref: AWS::Region - ap-northeast-2 - Fn::Equals: - Ref: AWS::Region - ap-south-1 - Fn::Equals: - Ref: AWS::Region - ap-southeast-1 - Fn::Equals: - Ref: AWS::Region - ap-southeast-2 - Fn::Equals: - Ref: AWS::Region - ca-central-1 - Fn::Equals: - Ref: AWS::Region - cn-north-1 - Fn::Equals: - Ref: AWS::Region - cn-northwest-1 - Fn::Or: - Fn::Equals: - Ref: AWS::Region - eu-central-1 - Fn::Equals: - Ref: AWS::Region - eu-north-1 - Fn::Equals: - Ref: AWS::Region - eu-south-1 - Fn::Equals: - Ref: AWS::Region - eu-west-1 - Fn::Equals: - Ref: AWS::Region - eu-west-2 - Fn::Equals: - Ref: AWS::Region - eu-west-3 - Fn::Equals: - Ref: AWS::Region - me-south-1 - Fn::Equals: - Ref: AWS::Region - sa-east-1 - Fn::Equals: - Ref: AWS::Region - us-east-1 - Fn::Equals: - Ref: AWS::Region - us-east-2 - Fn::Or: - Fn::Equals: - Ref: AWS::Region - us-west-1 - Fn::Equals: - Ref: AWS::Region - us-west-2 Rules: CheckBootstrapVersion: Assertions: - Assert: Fn::Not: - Fn::Contains: - - "1" - "2" - "3" - "4" - "5" - Ref: BootstrapVersion AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI. ```
Peter John Bartlett (7 January 1929 – 21 December 2019) was a New Zealand architect and professor of architectural design. Early life, education and family Born in Auckland on 7 January 1929, Bartlett was the son of Florence Mary Bartlett (née Cushman) and John Maddocks Bartlett. He was educated at Auckland Grammar School, before studying architecture at Auckland University College and completing a Bachelor of Architecture degree in 1957. He later undertook doctoral studies at Auckland, supervised by Richard Toy, and submitted his PhD thesis, titled Structured evaluation of attitudes to dwelling environments: people’s subjective assessments of preference satisfaction and meaning as indicators of architectural design performance in 1978. in 1953, Bartlett married Margaret Ann Lawlor, and the couple went on to have six children. Archtitectural career Bartlett was awarded a New Zealand government cultural fund bursary to study in Paris in 1953 and 1954, and spent the postgraduate year of his architectural studies in France. Between 1954 and 1957, he worked in Paris as a project architect on multi-storey housing projects, before returning to New Zealand and going into private practice. In 1958, he won first prize in the New Zealand Institute of Architects (NZIA) Winstone House Competition, and in 1968 he was awarded an NZIA bronze medal for the Newcombe house in Parnell; the building received an NZIA Auckland enduring architecture award in 2013. Bartlett designed the Centennial Theatre Centre at his old school, Auckland Grammar, which won an NZIA Auckland region medal in 1974, and an NZIA gold medal in 1975. Bartlett was elected as a Fellow of the New Zealand Institute of Architects in 1976, and a Fellow of the Royal Society of Arts the following year. Academic career In 1961, Bartlett was one of a number of architects, including Harry Turbott and Bill Wilson, employed as a sessional staff member in the School of Architecture at the University of Auckland. In 1964, he was appointed as a senior lecturer in architecture at the University of Auckland, to teach architectural history and theory, and he was promoted to professor of architectural design in 1977. When he retired in 1993, Bartlett was conferred the title of professor emeritus. Death Bartlett died in the Auckland suburb of Devonport, Auckland on 21 December 2019. References 1929 births 2019 deaths Artists from Auckland People educated at Auckland Grammar School University of Auckland alumni New Zealand architects Academic staff of the University of Auckland
```c /* * SSLv3/TLSv1 client-side functions * * * * ********** * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * ********** * * ********** * * This program is free software; you can redistribute it and/or modify * (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 * * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * ********** */ #if !defined(MBEDTLS_CONFIG_FILE) #include "mbedtls/config.h" #else #include MBEDTLS_CONFIG_FILE #endif #if defined(MBEDTLS_SSL_CLI_C) #if defined(MBEDTLS_PLATFORM_C) #include "mbedtls/platform.h" #else #include <stdlib.h> #define mbedtls_calloc calloc #define mbedtls_free free #endif #include "mbedtls/debug.h" #include "mbedtls/ssl.h" #include "mbedtls/ssl_internal.h" #include <string.h> #include <stdint.h> #if defined(MBEDTLS_HAVE_TIME) #include "mbedtls/platform_time.h" #endif #if defined(MBEDTLS_SSL_SESSION_TICKETS) #include "mbedtls/platform_util.h" #endif #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) static int ssl_write_hostname_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; size_t hostname_len; *olen = 0; if( ssl->hostname == NULL ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding server name extension: %s", ssl->hostname ) ); hostname_len = strlen( ssl->hostname ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, hostname_len + 9 ); /* * Sect. 3, RFC 6066 (TLS Extensions Definitions) * * In order to provide any of the server names, clients MAY include an * extension of type "server_name" in the (extended) client hello. The * "extension_data" field of this extension SHALL contain * "ServerNameList" where: * * struct { * NameType name_type; * select (name_type) { * case host_name: HostName; * } name; * } ServerName; * * enum { * host_name(0), (255) * } NameType; * * opaque HostName<1..2^16-1>; * * struct { * ServerName server_name_list<1..2^16-1> * } ServerNameList; * */ *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SERVERNAME >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SERVERNAME ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 5) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 5) ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 3) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( (hostname_len + 3) ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SERVERNAME_HOSTNAME ) & 0xFF ); *p++ = (unsigned char)( ( hostname_len >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( hostname_len ) & 0xFF ); memcpy( p, ssl->hostname, hostname_len ); *olen = hostname_len + 9; return( 0 ); } #endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */ #if defined(MBEDTLS_SSL_RENEGOTIATION) static int ssl_write_renegotiation_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; *olen = 0; /* We're always including an TLS_EMPTY_RENEGOTIATION_INFO_SCSV in the * initial ClientHello, in which case also adding the renegotiation * info extension is NOT RECOMMENDED as per RFC 5746 Section 3.4. */ if( ssl->renego_status != MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding renegotiation extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 5 + ssl->verify_data_len ); /* * Secure renegotiation */ *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_RENEGOTIATION_INFO ) & 0xFF ); *p++ = 0x00; *p++ = ( ssl->verify_data_len + 1 ) & 0xFF; *p++ = ssl->verify_data_len & 0xFF; memcpy( p, ssl->own_verify_data, ssl->verify_data_len ); *olen = 5 + ssl->verify_data_len; return( 0 ); } #endif /* MBEDTLS_SSL_RENEGOTIATION */ /* * Only if we handle at least one key exchange that needs signatures. */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) static int ssl_write_signature_algorithms_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; size_t sig_alg_len = 0; const int *md; #if defined(MBEDTLS_RSA_C) || defined(MBEDTLS_ECDSA_C) unsigned char *sig_alg_list = buf + 6; #endif *olen = 0; if( ssl->conf->max_minor_ver != MBEDTLS_SSL_MINOR_VERSION_3 ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding signature_algorithms extension" ) ); if( ssl->conf->sig_hashes == NULL ) return( MBEDTLS_ERR_SSL_BAD_CONFIG ); for( md = ssl->conf->sig_hashes; *md != MBEDTLS_MD_NONE; md++ ) { #if defined(MBEDTLS_ECDSA_C) sig_alg_len += 2; #endif #if defined(MBEDTLS_RSA_C) sig_alg_len += 2; #endif if( sig_alg_len > MBEDTLS_SSL_MAX_SIG_HASH_ALG_LIST_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "length in bytes of sig-hash-alg extension too big" ) ); return( MBEDTLS_ERR_SSL_BAD_CONFIG ); } } /* Empty signature algorithms list, this is a configuration error. */ if( sig_alg_len == 0 ) return( MBEDTLS_ERR_SSL_BAD_CONFIG ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, sig_alg_len + 6 ); /* * Prepare signature_algorithms extension (TLS 1.2) */ sig_alg_len = 0; for( md = ssl->conf->sig_hashes; *md != MBEDTLS_MD_NONE; md++ ) { #if defined(MBEDTLS_ECDSA_C) sig_alg_list[sig_alg_len++] = mbedtls_ssl_hash_from_md_alg( *md ); sig_alg_list[sig_alg_len++] = MBEDTLS_SSL_SIG_ECDSA; #endif #if defined(MBEDTLS_RSA_C) sig_alg_list[sig_alg_len++] = mbedtls_ssl_hash_from_md_alg( *md ); sig_alg_list[sig_alg_len++] = MBEDTLS_SSL_SIG_RSA; #endif } /* * enum { * none(0), md5(1), sha1(2), sha224(3), sha256(4), sha384(5), * sha512(6), (255) * } HashAlgorithm; * * enum { anonymous(0), rsa(1), dsa(2), ecdsa(3), (255) } * SignatureAlgorithm; * * struct { * HashAlgorithm hash; * SignatureAlgorithm signature; * } SignatureAndHashAlgorithm; * * SignatureAndHashAlgorithm * supported_signature_algorithms<2..2^16-2>; */ *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SIG_ALG >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SIG_ALG ) & 0xFF ); *p++ = (unsigned char)( ( ( sig_alg_len + 2 ) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( ( sig_alg_len + 2 ) ) & 0xFF ); *p++ = (unsigned char)( ( sig_alg_len >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( sig_alg_len ) & 0xFF ); *olen = 6 + sig_alg_len; return( 0 ); } #endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */ #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) static int ssl_write_supported_elliptic_curves_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; unsigned char *elliptic_curve_list = p + 6; size_t elliptic_curve_len = 0; const mbedtls_ecp_curve_info *info; const mbedtls_ecp_group_id *grp_id; *olen = 0; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding supported_elliptic_curves extension" ) ); if( ssl->conf->curve_list == NULL ) return( MBEDTLS_ERR_SSL_BAD_CONFIG ); for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ ) { info = mbedtls_ecp_curve_info_from_grp_id( *grp_id ); if( info == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "invalid curve in ssl configuration" ) ); return( MBEDTLS_ERR_SSL_BAD_CONFIG ); } elliptic_curve_len += 2; if( elliptic_curve_len > MBEDTLS_SSL_MAX_CURVE_LIST_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "malformed supported_elliptic_curves extension in config" ) ); return( MBEDTLS_ERR_SSL_BAD_CONFIG ); } } /* Empty elliptic curve list, this is a configuration error. */ if( elliptic_curve_len == 0 ) return( MBEDTLS_ERR_SSL_BAD_CONFIG ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 + elliptic_curve_len ); elliptic_curve_len = 0; for( grp_id = ssl->conf->curve_list; *grp_id != MBEDTLS_ECP_DP_NONE; grp_id++ ) { info = mbedtls_ecp_curve_info_from_grp_id( *grp_id ); elliptic_curve_list[elliptic_curve_len++] = info->tls_id >> 8; elliptic_curve_list[elliptic_curve_len++] = info->tls_id & 0xFF; } *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_ELLIPTIC_CURVES ) & 0xFF ); *p++ = (unsigned char)( ( ( elliptic_curve_len + 2 ) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( ( elliptic_curve_len + 2 ) ) & 0xFF ); *p++ = (unsigned char)( ( ( elliptic_curve_len ) >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( ( elliptic_curve_len ) ) & 0xFF ); *olen = 6 + elliptic_curve_len; return( 0 ); } static int ssl_write_supported_point_formats_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; (void) ssl; /* ssl used for debugging only */ *olen = 0; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding supported_point_formats extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS ) & 0xFF ); *p++ = 0x00; *p++ = 2; *p++ = 1; *p++ = MBEDTLS_ECP_PF_UNCOMPRESSED; *olen = 6; return( 0 ); } #endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C || MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) static int ssl_write_ecjpake_kkpp_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { int ret; unsigned char *p = buf; size_t kkpp_len; *olen = 0; /* Skip costly extension if we can't use EC J-PAKE anyway */ if( mbedtls_ecjpake_check( &ssl->handshake->ecjpake_ctx ) != 0 ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding ecjpake_kkpp extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 4 ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ECJPAKE_KKPP >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ECJPAKE_KKPP ) & 0xFF ); /* * We may need to send ClientHello multiple times for Hello verification. * We don't want to compute fresh values every time (both for performance * and consistency reasons), so cache the extension content. */ if( ssl->handshake->ecjpake_cache == NULL || ssl->handshake->ecjpake_cache_len == 0 ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "generating new ecjpake parameters" ) ); ret = mbedtls_ecjpake_write_round_one( &ssl->handshake->ecjpake_ctx, p + 2, end - p - 2, &kkpp_len, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1 , "mbedtls_ecjpake_write_round_one", ret ); return( ret ); } ssl->handshake->ecjpake_cache = mbedtls_calloc( 1, kkpp_len ); if( ssl->handshake->ecjpake_cache == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "allocation failed" ) ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); } memcpy( ssl->handshake->ecjpake_cache, p + 2, kkpp_len ); ssl->handshake->ecjpake_cache_len = kkpp_len; } else { MBEDTLS_SSL_DEBUG_MSG( 3, ( "re-using cached ecjpake parameters" ) ); kkpp_len = ssl->handshake->ecjpake_cache_len; MBEDTLS_SSL_CHK_BUF_PTR( p + 2, end, kkpp_len ); memcpy( p + 2, ssl->handshake->ecjpake_cache, kkpp_len ); } *p++ = (unsigned char)( ( kkpp_len >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( kkpp_len ) & 0xFF ); *olen = kkpp_len + 4; return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) static int ssl_write_max_fragment_length_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; *olen = 0; if( ssl->conf->mfl_code == MBEDTLS_SSL_MAX_FRAG_LEN_NONE ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding max_fragment_length extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 5 ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH ) & 0xFF ); *p++ = 0x00; *p++ = 1; *p++ = ssl->conf->mfl_code; *olen = 5; return( 0 ); } #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) static int ssl_write_truncated_hmac_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; *olen = 0; if( ssl->conf->trunc_hmac == MBEDTLS_SSL_TRUNC_HMAC_DISABLED ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding truncated_hmac extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 4 ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_TRUNCATED_HMAC >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_TRUNCATED_HMAC ) & 0xFF ); *p++ = 0x00; *p++ = 0x00; *olen = 4; return( 0 ); } #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */ #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) static int ssl_write_encrypt_then_mac_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; *olen = 0; if( ssl->conf->encrypt_then_mac == MBEDTLS_SSL_ETM_DISABLED || ssl->conf->max_minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding encrypt_then_mac extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 4 ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC ) & 0xFF ); *p++ = 0x00; *p++ = 0x00; *olen = 4; return( 0 ); } #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */ #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) static int ssl_write_extended_ms_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; *olen = 0; if( ssl->conf->extended_ms == MBEDTLS_SSL_EXTENDED_MS_DISABLED || ssl->conf->max_minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding extended_master_secret extension" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 4 ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET ) & 0xFF ); *p++ = 0x00; *p++ = 0x00; *olen = 4; return( 0 ); } #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */ #if defined(MBEDTLS_SSL_SESSION_TICKETS) static int ssl_write_session_ticket_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; size_t tlen = ssl->session_negotiate->ticket_len; *olen = 0; if( ssl->conf->session_tickets == MBEDTLS_SSL_SESSION_TICKETS_DISABLED ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding session ticket extension" ) ); /* The addition is safe here since the ticket length is 16 bit. */ MBEDTLS_SSL_CHK_BUF_PTR( p, end, 4 + tlen ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SESSION_TICKET >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_SESSION_TICKET ) & 0xFF ); *p++ = (unsigned char)( ( tlen >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( tlen ) & 0xFF ); *olen = 4; if( ssl->session_negotiate->ticket == NULL || tlen == 0 ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "sending session ticket of length %d", tlen ) ); memcpy( p, ssl->session_negotiate->ticket, tlen ); *olen += tlen; return( 0 ); } #endif /* MBEDTLS_SSL_SESSION_TICKETS */ #if defined(MBEDTLS_SSL_ALPN) static int ssl_write_alpn_ext( mbedtls_ssl_context *ssl, unsigned char *buf, const unsigned char *end, size_t *olen ) { unsigned char *p = buf; size_t alpnlen = 0; const char **cur; *olen = 0; if( ssl->conf->alpn_list == NULL ) return( 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, adding alpn extension" ) ); for( cur = ssl->conf->alpn_list; *cur != NULL; cur++ ) alpnlen += strlen( *cur ) + 1; MBEDTLS_SSL_CHK_BUF_PTR( p, end, 6 + alpnlen ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ALPN >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ALPN ) & 0xFF ); /* * opaque ProtocolName<1..2^8-1>; * * struct { * ProtocolName protocol_name_list<2..2^16-1> * } ProtocolNameList; */ /* Skip writing extension and list length for now */ p += 4; for( cur = ssl->conf->alpn_list; *cur != NULL; cur++ ) { /* * mbedtls_ssl_conf_set_alpn_protocols() checked that the length of * protocol names is less than 255. */ *p = (unsigned char)strlen( *cur ); memcpy( p + 1, *cur, *p ); p += 1 + *p; } *olen = p - buf; /* List length = olen - 2 (ext_type) - 2 (ext_len) - 2 (list_len) */ buf[4] = (unsigned char)( ( ( *olen - 6 ) >> 8 ) & 0xFF ); buf[5] = (unsigned char)( ( ( *olen - 6 ) ) & 0xFF ); /* Extension length = olen - 2 (ext_type) - 2 (ext_len) */ buf[2] = (unsigned char)( ( ( *olen - 4 ) >> 8 ) & 0xFF ); buf[3] = (unsigned char)( ( ( *olen - 4 ) ) & 0xFF ); return( 0 ); } #endif /* MBEDTLS_SSL_ALPN */ /* * Generate random bytes for ClientHello */ static int ssl_generate_random( mbedtls_ssl_context *ssl ) { int ret; unsigned char *p = ssl->handshake->randbytes; #if defined(MBEDTLS_HAVE_TIME) mbedtls_time_t t; #endif /* * When responding to a verify request, MUST reuse random (RFC 6347 4.2.1) */ #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && ssl->handshake->verify_cookie != NULL ) { return( 0 ); } #endif #if defined(MBEDTLS_HAVE_TIME) t = mbedtls_time( NULL ); *p++ = (unsigned char)( t >> 24 ); *p++ = (unsigned char)( t >> 16 ); *p++ = (unsigned char)( t >> 8 ); *p++ = (unsigned char)( t ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, current time: %lu", t ) ); #else if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p, 4 ) ) != 0 ) return( ret ); p += 4; #endif /* MBEDTLS_HAVE_TIME */ if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p, 28 ) ) != 0 ) return( ret ); return( 0 ); } /** * \brief Validate cipher suite against config in SSL context. * * \param suite_info cipher suite to validate * \param ssl SSL context * \param min_minor_ver Minimal minor version to accept a cipher suite * \param max_minor_ver Maximal minor version to accept a cipher suite * * \return 0 if valid, else 1 */ static int ssl_validate_ciphersuite( const mbedtls_ssl_ciphersuite_t * suite_info, const mbedtls_ssl_context * ssl, int min_minor_ver, int max_minor_ver ) { (void) ssl; if( suite_info == NULL ) return( 1 ); if( suite_info->min_minor_ver > max_minor_ver || suite_info->max_minor_ver < min_minor_ver ) return( 1 ); #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && ( suite_info->flags & MBEDTLS_CIPHERSUITE_NODTLS ) ) return( 1 ); #endif #if defined(MBEDTLS_ARC4_C) if( ssl->conf->arc4_disabled == MBEDTLS_SSL_ARC4_DISABLED && suite_info->cipher == MBEDTLS_CIPHER_ARC4_128 ) return( 1 ); #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE && mbedtls_ecjpake_check( &ssl->handshake->ecjpake_ctx ) != 0 ) return( 1 ); #endif return( 0 ); } static int ssl_write_client_hello( mbedtls_ssl_context *ssl ) { int ret; size_t i, n, olen, ext_len = 0; unsigned char *buf; unsigned char *p, *q; const unsigned char *end; unsigned char offer_compress; const int *ciphersuites; const mbedtls_ssl_ciphersuite_t *ciphersuite_info; #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) int uses_ec = 0; #endif MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client hello" ) ); if( ssl->conf->f_rng == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "no RNG provided") ); return( MBEDTLS_ERR_SSL_NO_RNG ); } #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE ) #endif { ssl->major_ver = ssl->conf->min_major_ver; ssl->minor_ver = ssl->conf->min_minor_ver; } if( ssl->conf->max_major_ver == 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "configured max major version is invalid, consider using mbedtls_ssl_config_defaults()" ) ); return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); } buf = ssl->out_msg; end = buf + MBEDTLS_SSL_OUT_CONTENT_LEN; /* * Check if there's enough space for the first part of the ClientHello * consisting of the 38 bytes described below, the session identifier (at * most 32 bytes) and its length (1 byte). * * Use static upper bounds instead of the actual values * to allow the compiler to optimize this away. */ MBEDTLS_SSL_CHK_BUF_PTR( buf, end, 38 + 1 + 32 ); /* * The 38 first bytes of the ClientHello: * 0 . 0 handshake type (written later) * 1 . 3 handshake length (written later) * 4 . 5 highest version supported * 6 . 9 current UNIX time * 10 . 37 random bytes * * The current UNIX time (4 bytes) and following 28 random bytes are written * by ssl_generate_random() into ssl->handshake->randbytes buffer and then * copied from there into the output buffer. */ p = buf + 4; mbedtls_ssl_write_version( ssl->conf->max_major_ver, ssl->conf->max_minor_ver, ssl->conf->transport, p ); p += 2; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, max version: [%d:%d]", buf[4], buf[5] ) ); if( ( ret = ssl_generate_random( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_generate_random", ret ); return( ret ); } memcpy( p, ssl->handshake->randbytes, 32 ); MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, random bytes", p, 32 ); p += 32; /* * 38 . 38 session id length * 39 . 39+n session id * 39+n . 39+n DTLS only: cookie length (1 byte) * 40+n . .. DTLS only: cookie * .. . .. ciphersuitelist length (2 bytes) * .. . .. ciphersuitelist * .. . .. compression methods length (1 byte) * .. . .. compression methods * .. . .. extensions length (2 bytes) * .. . .. extensions */ n = ssl->session_negotiate->id_len; if( n < 16 || n > 32 || #if defined(MBEDTLS_SSL_RENEGOTIATION) ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE || #endif ssl->handshake->resume == 0 ) { n = 0; } #if defined(MBEDTLS_SSL_SESSION_TICKETS) /* * RFC 5077 section 3.4: "When presenting a ticket, the client MAY * generate and include a Session ID in the TLS ClientHello." */ #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE ) #endif { if( ssl->session_negotiate->ticket != NULL && ssl->session_negotiate->ticket_len != 0 ) { ret = ssl->conf->f_rng( ssl->conf->p_rng, ssl->session_negotiate->id, 32 ); if( ret != 0 ) return( ret ); ssl->session_negotiate->id_len = n = 32; } } #endif /* MBEDTLS_SSL_SESSION_TICKETS */ /* * The first check of the output buffer size above ( * MBEDTLS_SSL_CHK_BUF_PTR( buf, end, 38 + 1 + 32 );) * has checked that there is enough space in the output buffer for the * session identifier length byte and the session identifier (n <= 32). */ *p++ = (unsigned char) n; for( i = 0; i < n; i++ ) *p++ = ssl->session_negotiate->id[i]; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, session id len.: %d", n ) ); MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, session id", buf + 39, n ); /* * With 'n' being the length of the session identifier * * 39+n . 39+n DTLS only: cookie length (1 byte) * 40+n . .. DTLS only: cookie * .. . .. ciphersuitelist length (2 bytes) * .. . .. ciphersuitelist * .. . .. compression methods length (1 byte) * .. . .. compression methods * .. . .. extensions length (2 bytes) * .. . .. extensions */ /* * DTLS cookie */ #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) { MBEDTLS_SSL_CHK_BUF_PTR( p, end, 1 ); if( ssl->handshake->verify_cookie == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "no verify cookie to send" ) ); *p++ = 0; } else { MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, cookie", ssl->handshake->verify_cookie, ssl->handshake->verify_cookie_len ); *p++ = ssl->handshake->verify_cookie_len; MBEDTLS_SSL_CHK_BUF_PTR( p, end, ssl->handshake->verify_cookie_len ); memcpy( p, ssl->handshake->verify_cookie, ssl->handshake->verify_cookie_len ); p += ssl->handshake->verify_cookie_len; } } #endif /* * Ciphersuite list */ ciphersuites = ssl->conf->ciphersuite_list[ssl->minor_ver]; /* Skip writing ciphersuite length for now */ n = 0; q = p; MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 ); p += 2; for( i = 0; ciphersuites[i] != 0; i++ ) { ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( ciphersuites[i] ); if( ssl_validate_ciphersuite( ciphersuite_info, ssl, ssl->conf->min_minor_ver, ssl->conf->max_minor_ver ) != 0 ) continue; MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, add ciphersuite: %04x", ciphersuites[i] ) ); #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) uses_ec |= mbedtls_ssl_ciphersuite_uses_ec( ciphersuite_info ); #endif MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 ); n++; *p++ = (unsigned char)( ciphersuites[i] >> 8 ); *p++ = (unsigned char)( ciphersuites[i] ); } MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, got %d ciphersuites (excluding SCSVs)", n ) ); /* * Add TLS_EMPTY_RENEGOTIATION_INFO_SCSV */ #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE ) #endif { MBEDTLS_SSL_DEBUG_MSG( 3, ( "adding EMPTY_RENEGOTIATION_INFO_SCSV" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 ); *p++ = (unsigned char)( MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO >> 8 ); *p++ = (unsigned char)( MBEDTLS_SSL_EMPTY_RENEGOTIATION_INFO ); n++; } /* Some versions of OpenSSL don't handle it correctly if not at end */ #if defined(MBEDTLS_SSL_FALLBACK_SCSV) if( ssl->conf->fallback == MBEDTLS_SSL_IS_FALLBACK ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "adding FALLBACK_SCSV" ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 ); *p++ = (unsigned char)( MBEDTLS_SSL_FALLBACK_SCSV_VALUE >> 8 ); *p++ = (unsigned char)( MBEDTLS_SSL_FALLBACK_SCSV_VALUE ); n++; } #endif *q++ = (unsigned char)( n >> 7 ); *q++ = (unsigned char)( n << 1 ); #if defined(MBEDTLS_ZLIB_SUPPORT) offer_compress = 1; #else offer_compress = 0; #endif /* * We don't support compression with DTLS right now: if many records come * in the same datagram, uncompressing one could overwrite the next one. * We don't want to add complexity for handling that case unless there is * an actual need for it. */ #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) offer_compress = 0; #endif if( offer_compress ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress len.: %d", 2 ) ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress alg.: %d %d", MBEDTLS_SSL_COMPRESS_DEFLATE, MBEDTLS_SSL_COMPRESS_NULL ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 3 ); *p++ = 2; *p++ = MBEDTLS_SSL_COMPRESS_DEFLATE; *p++ = MBEDTLS_SSL_COMPRESS_NULL; } else { MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress len.: %d", 1 ) ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, compress alg.: %d", MBEDTLS_SSL_COMPRESS_NULL ) ); MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 ); *p++ = 1; *p++ = MBEDTLS_SSL_COMPRESS_NULL; } /* First write extensions, then the total length */ MBEDTLS_SSL_CHK_BUF_PTR( p, end, 2 ); #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) if( ( ret = ssl_write_hostname_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_hostname_ext", ret ); return( ret ); } ext_len += olen; #endif /* Note that TLS_EMPTY_RENEGOTIATION_INFO_SCSV is always added * even if MBEDTLS_SSL_RENEGOTIATION is not defined. */ #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ( ret = ssl_write_renegotiation_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_renegotiation_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) if( ( ret = ssl_write_signature_algorithms_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_signature_algorithms_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) if( uses_ec ) { if( ( ret = ssl_write_supported_elliptic_curves_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_supported_elliptic_curves_ext", ret ); return( ret ); } ext_len += olen; if( ( ret = ssl_write_supported_point_formats_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_supported_point_formats_ext", ret ); return( ret ); } ext_len += olen; } #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) if( ( ret = ssl_write_ecjpake_kkpp_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_ecjpake_kkpp_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) if( ( ret = ssl_write_max_fragment_length_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_max_fragment_length_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) if( ( ret = ssl_write_truncated_hmac_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_truncated_hmac_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) if( ( ret = ssl_write_encrypt_then_mac_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_encrypt_then_mac_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) if( ( ret = ssl_write_extended_ms_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_extended_ms_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_ALPN) if( ( ret = ssl_write_alpn_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_alpn_ext", ret ); return( ret ); } ext_len += olen; #endif #if defined(MBEDTLS_SSL_SESSION_TICKETS) if( ( ret = ssl_write_session_ticket_ext( ssl, p + 2 + ext_len, end, &olen ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_write_session_ticket_ext", ret ); return( ret ); } ext_len += olen; #endif /* olen unused if all extensions are disabled */ ((void) olen); MBEDTLS_SSL_DEBUG_MSG( 3, ( "client hello, total extension length: %d", ext_len ) ); if( ext_len > 0 ) { /* No need to check for space here, because the extension * writing functions already took care of that. */ *p++ = (unsigned char)( ( ext_len >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( ext_len ) & 0xFF ); p += ext_len; } ssl->out_msglen = p - buf; ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE; ssl->out_msg[0] = MBEDTLS_SSL_HS_CLIENT_HELLO; ssl->state++; #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) mbedtls_ssl_send_flight_completed( ssl ); #endif if( ( ret = mbedtls_ssl_write_handshake_msg( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_handshake_msg", ret ); return( ret ); } #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && ( ret = mbedtls_ssl_flight_transmit( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_flight_transmit", ret ); return( ret ); } #endif /* MBEDTLS_SSL_PROTO_DTLS */ MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client hello" ) ); return( 0 ); } static int ssl_parse_renegotiation_info( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE ) { /* Check verify-data in constant-time. The length OTOH is no secret */ if( len != 1 + ssl->verify_data_len * 2 || buf[0] != ssl->verify_data_len * 2 || mbedtls_ssl_safer_memcmp( buf + 1, ssl->own_verify_data, ssl->verify_data_len ) != 0 || mbedtls_ssl_safer_memcmp( buf + 1 + ssl->verify_data_len, ssl->peer_verify_data, ssl->verify_data_len ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching renegotiation info" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } } else #endif /* MBEDTLS_SSL_RENEGOTIATION */ { if( len != 1 || buf[0] != 0x00 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-zero length renegotiation info" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } ssl->secure_renegotiation = MBEDTLS_SSL_SECURE_RENEGOTIATION; } return( 0 ); } #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) static int ssl_parse_max_fragment_length_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { /* * server should use the extension only if we did, * and if so the server's value should match ours (and len is always 1) */ if( ssl->conf->mfl_code == MBEDTLS_SSL_MAX_FRAG_LEN_NONE || len != 1 || buf[0] != ssl->conf->mfl_code ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching max fragment length extension" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } return( 0 ); } #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) static int ssl_parse_truncated_hmac_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { if( ssl->conf->trunc_hmac == MBEDTLS_SSL_TRUNC_HMAC_DISABLED || len != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching truncated HMAC extension" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } ((void) buf); ssl->session_negotiate->trunc_hmac = MBEDTLS_SSL_TRUNC_HMAC_ENABLED; return( 0 ); } #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */ #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) static int ssl_parse_encrypt_then_mac_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { if( ssl->conf->encrypt_then_mac == MBEDTLS_SSL_ETM_DISABLED || ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 || len != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching encrypt-then-MAC extension" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } ((void) buf); ssl->session_negotiate->encrypt_then_mac = MBEDTLS_SSL_ETM_ENABLED; return( 0 ); } #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */ #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) static int ssl_parse_extended_ms_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { if( ssl->conf->extended_ms == MBEDTLS_SSL_EXTENDED_MS_DISABLED || ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 || len != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching extended master secret extension" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } ((void) buf); ssl->handshake->extended_ms = MBEDTLS_SSL_EXTENDED_MS_ENABLED; return( 0 ); } #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */ #if defined(MBEDTLS_SSL_SESSION_TICKETS) static int ssl_parse_session_ticket_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { if( ssl->conf->session_tickets == MBEDTLS_SSL_SESSION_TICKETS_DISABLED || len != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching session ticket extension" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } ((void) buf); ssl->handshake->new_session_ticket = 1; return( 0 ); } #endif /* MBEDTLS_SSL_SESSION_TICKETS */ #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) static int ssl_parse_supported_point_formats_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { size_t list_size; const unsigned char *p; if( len == 0 || (size_t)( buf[0] + 1 ) != len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } list_size = buf[0]; p = buf + 1; while( list_size > 0 ) { if( p[0] == MBEDTLS_ECP_PF_UNCOMPRESSED || p[0] == MBEDTLS_ECP_PF_COMPRESSED ) { #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) ssl->handshake->ecdh_ctx.point_format = p[0]; #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) ssl->handshake->ecjpake_ctx.point_format = p[0]; #endif MBEDTLS_SSL_DEBUG_MSG( 4, ( "point format selected: %d", p[0] ) ); return( 0 ); } list_size--; p++; } MBEDTLS_SSL_DEBUG_MSG( 1, ( "no point format in common" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } #endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C || MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) static int ssl_parse_ecjpake_kkpp( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { int ret; if( ssl->transform_negotiate->ciphersuite_info->key_exchange != MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "skip ecjpake kkpp extension" ) ); return( 0 ); } /* If we got here, we no longer need our cached extension */ mbedtls_free( ssl->handshake->ecjpake_cache ); ssl->handshake->ecjpake_cache = NULL; ssl->handshake->ecjpake_cache_len = 0; if( ( ret = mbedtls_ecjpake_read_round_one( &ssl->handshake->ecjpake_ctx, buf, len ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_one", ret ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( ret ); } return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_SSL_ALPN) static int ssl_parse_alpn_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { size_t list_len, name_len; const char **p; /* If we didn't send it, the server shouldn't send it */ if( ssl->conf->alpn_list == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-matching ALPN extension" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } /* * opaque ProtocolName<1..2^8-1>; * * struct { * ProtocolName protocol_name_list<2..2^16-1> * } ProtocolNameList; * * the "ProtocolNameList" MUST contain exactly one "ProtocolName" */ /* Min length is 2 (list_len) + 1 (name_len) + 1 (name) */ if( len < 4 ) { mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } list_len = ( buf[0] << 8 ) | buf[1]; if( list_len != len - 2 ) { mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } name_len = buf[2]; if( name_len != list_len - 1 ) { mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } /* Check that the server chosen protocol was in our list and save it */ for( p = ssl->conf->alpn_list; *p != NULL; p++ ) { if( name_len == strlen( *p ) && memcmp( buf + 3, *p, name_len ) == 0 ) { ssl->alpn_chosen = *p; return( 0 ); } } MBEDTLS_SSL_DEBUG_MSG( 1, ( "ALPN extension: no matching protocol" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } #endif /* MBEDTLS_SSL_ALPN */ /* * Parse HelloVerifyRequest. Only called after verifying the HS type. */ #if defined(MBEDTLS_SSL_PROTO_DTLS) static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl ) { const unsigned char *p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl ); int major_ver, minor_ver; unsigned char cookie_len; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse hello verify request" ) ); /* Check that there is enough room for: * - 2 bytes of version * - 1 byte of cookie_len */ if( mbedtls_ssl_hs_hdr_len( ssl ) + 3 > ssl->in_msglen ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "incoming HelloVerifyRequest message is too short" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } /* * struct { * ProtocolVersion server_version; * opaque cookie<0..2^8-1>; * } HelloVerifyRequest; */ MBEDTLS_SSL_DEBUG_BUF( 3, "server version", p, 2 ); mbedtls_ssl_read_version( &major_ver, &minor_ver, ssl->conf->transport, p ); p += 2; /* * Since the RFC is not clear on this point, accept DTLS 1.0 (TLS 1.1) * even is lower than our min version. */ if( major_ver < MBEDTLS_SSL_MAJOR_VERSION_3 || minor_ver < MBEDTLS_SSL_MINOR_VERSION_2 || major_ver > ssl->conf->max_major_ver || minor_ver > ssl->conf->max_minor_ver ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server version" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION ); return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION ); } cookie_len = *p++; if( ( ssl->in_msg + ssl->in_msglen ) - p < cookie_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "cookie length does not match incoming message size" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } MBEDTLS_SSL_DEBUG_BUF( 3, "cookie", p, cookie_len ); mbedtls_free( ssl->handshake->verify_cookie ); ssl->handshake->verify_cookie = mbedtls_calloc( 1, cookie_len ); if( ssl->handshake->verify_cookie == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", cookie_len ) ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); } memcpy( ssl->handshake->verify_cookie, p, cookie_len ); ssl->handshake->verify_cookie_len = cookie_len; /* Start over at ClientHello */ ssl->state = MBEDTLS_SSL_CLIENT_HELLO; mbedtls_ssl_reset_checksum( ssl ); mbedtls_ssl_recv_flight_completed( ssl ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse hello verify request" ) ); return( 0 ); } #endif /* MBEDTLS_SSL_PROTO_DTLS */ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl ) { int ret, i; size_t n; size_t ext_len; unsigned char *buf, *ext; unsigned char comp; #if defined(MBEDTLS_ZLIB_SUPPORT) int accept_comp; #endif #if defined(MBEDTLS_SSL_RENEGOTIATION) int renegotiation_info_seen = 0; #endif int handshake_failure = 0; const mbedtls_ssl_ciphersuite_t *suite_info; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello" ) ); buf = ssl->in_msg; if( ( ret = mbedtls_ssl_read_record( ssl, 1 ) ) != 0 ) { /* No alert on a read error. */ MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE ) { #if defined(MBEDTLS_SSL_RENEGOTIATION) if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS ) { ssl->renego_records_seen++; if( ssl->conf->renego_max_records >= 0 && ssl->renego_records_seen > ssl->conf->renego_max_records ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation requested, but not honored by server" ) ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } MBEDTLS_SSL_DEBUG_MSG( 1, ( "non-handshake message during renegotiation" ) ); ssl->keep_current_message = 1; return( MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO ); } #endif /* MBEDTLS_SSL_RENEGOTIATION */ MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) { if( buf[0] == MBEDTLS_SSL_HS_HELLO_VERIFY_REQUEST ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "received hello verify request" ) ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello" ) ); return( ssl_parse_hello_verify_request( ssl ) ); } else { /* We made it through the verification process */ mbedtls_free( ssl->handshake->verify_cookie ); ssl->handshake->verify_cookie = NULL; ssl->handshake->verify_cookie_len = 0; } } #endif /* MBEDTLS_SSL_PROTO_DTLS */ if( ssl->in_hslen < 38 + mbedtls_ssl_hs_hdr_len( ssl ) || buf[0] != MBEDTLS_SSL_HS_SERVER_HELLO ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } /* * 0 . 1 server_version * 2 . 33 random (maybe including 4 bytes of Unix time) * 34 . 34 session_id length = n * 35 . 34+n session_id * 35+n . 36+n cipher_suite * 37+n . 37+n compression_method * * 38+n . 39+n extensions length (optional) * 40+n . .. extensions */ buf += mbedtls_ssl_hs_hdr_len( ssl ); MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, version", buf + 0, 2 ); mbedtls_ssl_read_version( &ssl->major_ver, &ssl->minor_ver, ssl->conf->transport, buf + 0 ); if( ssl->major_ver < ssl->conf->min_major_ver || ssl->minor_ver < ssl->conf->min_minor_ver || ssl->major_ver > ssl->conf->max_major_ver || ssl->minor_ver > ssl->conf->max_minor_ver ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "server version out of bounds - min: [%d:%d], server: [%d:%d], max: [%d:%d]", ssl->conf->min_major_ver, ssl->conf->min_minor_ver, ssl->major_ver, ssl->minor_ver, ssl->conf->max_major_ver, ssl->conf->max_minor_ver ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION ); return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION ); } MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, current time: %lu", ( (uint32_t) buf[2] << 24 ) | ( (uint32_t) buf[3] << 16 ) | ( (uint32_t) buf[4] << 8 ) | ( (uint32_t) buf[5] ) ) ); memcpy( ssl->handshake->randbytes + 32, buf + 2, 32 ); n = buf[34]; MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, random bytes", buf + 2, 32 ); if( n > 32 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } if( ssl->in_hslen > mbedtls_ssl_hs_hdr_len( ssl ) + 39 + n ) { ext_len = ( ( buf[38 + n] << 8 ) | ( buf[39 + n] ) ); if( ( ext_len > 0 && ext_len < 4 ) || ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) + 40 + n + ext_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } } else if( ssl->in_hslen == mbedtls_ssl_hs_hdr_len( ssl ) + 38 + n ) { ext_len = 0; } else { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } /* ciphersuite (used later) */ i = ( buf[35 + n] << 8 ) | buf[36 + n]; /* * Read and check compression */ comp = buf[37 + n]; #if defined(MBEDTLS_ZLIB_SUPPORT) /* See comments in ssl_write_client_hello() */ #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) accept_comp = 0; else #endif accept_comp = 1; if( comp != MBEDTLS_SSL_COMPRESS_NULL && ( comp != MBEDTLS_SSL_COMPRESS_DEFLATE || accept_comp == 0 ) ) #else /* MBEDTLS_ZLIB_SUPPORT */ if( comp != MBEDTLS_SSL_COMPRESS_NULL ) #endif/* MBEDTLS_ZLIB_SUPPORT */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "server hello, bad compression: %d", comp ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); } /* * Initialize update checksum functions */ ssl->transform_negotiate->ciphersuite_info = mbedtls_ssl_ciphersuite_from_id( i ); if( ssl->transform_negotiate->ciphersuite_info == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "ciphersuite info for %04x not found", i ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR ); return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); } mbedtls_ssl_optimize_checksum( ssl, ssl->transform_negotiate->ciphersuite_info ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, session id len.: %d", n ) ); MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, session id", buf + 35, n ); /* * Check if the session can be resumed */ if( ssl->handshake->resume == 0 || n == 0 || #if defined(MBEDTLS_SSL_RENEGOTIATION) ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE || #endif ssl->session_negotiate->ciphersuite != i || ssl->session_negotiate->compression != comp || ssl->session_negotiate->id_len != n || memcmp( ssl->session_negotiate->id, buf + 35, n ) != 0 ) { ssl->state++; ssl->handshake->resume = 0; #if defined(MBEDTLS_HAVE_TIME) ssl->session_negotiate->start = mbedtls_time( NULL ); #endif ssl->session_negotiate->ciphersuite = i; ssl->session_negotiate->compression = comp; ssl->session_negotiate->id_len = n; memcpy( ssl->session_negotiate->id, buf + 35, n ); } else { ssl->state = MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC; if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR ); return( ret ); } } MBEDTLS_SSL_DEBUG_MSG( 3, ( "%s session has been resumed", ssl->handshake->resume ? "a" : "no" ) ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %04x", i ) ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: %d", buf[37 + n] ) ); /* * Perform cipher suite validation in same way as in ssl_write_client_hello. */ i = 0; while( 1 ) { if( ssl->conf->ciphersuite_list[ssl->minor_ver][i] == 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } if( ssl->conf->ciphersuite_list[ssl->minor_ver][i++] == ssl->session_negotiate->ciphersuite ) { break; } } suite_info = mbedtls_ssl_ciphersuite_from_id( ssl->session_negotiate->ciphersuite ); if( ssl_validate_ciphersuite( suite_info, ssl, ssl->minor_ver, ssl->minor_ver ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %s", suite_info->name ) ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA && ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 ) { ssl->handshake->ecrs_enabled = 1; } #endif if( comp != MBEDTLS_SSL_COMPRESS_NULL #if defined(MBEDTLS_ZLIB_SUPPORT) && comp != MBEDTLS_SSL_COMPRESS_DEFLATE #endif ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } ssl->session_negotiate->compression = comp; ext = buf + 40 + n; MBEDTLS_SSL_DEBUG_MSG( 2, ( "server hello, total extension length: %d", ext_len ) ); while( ext_len ) { unsigned int ext_id = ( ( ext[0] << 8 ) | ( ext[1] ) ); unsigned int ext_size = ( ( ext[2] << 8 ) | ( ext[3] ) ); if( ext_size + 4 > ext_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } switch( ext_id ) { case MBEDTLS_TLS_EXT_RENEGOTIATION_INFO: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found renegotiation extension" ) ); #if defined(MBEDTLS_SSL_RENEGOTIATION) renegotiation_info_seen = 1; #endif if( ( ret = ssl_parse_renegotiation_info( ssl, ext + 4, ext_size ) ) != 0 ) return( ret ); break; #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH) case MBEDTLS_TLS_EXT_MAX_FRAGMENT_LENGTH: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found max_fragment_length extension" ) ); if( ( ret = ssl_parse_max_fragment_length_ext( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */ #if defined(MBEDTLS_SSL_TRUNCATED_HMAC) case MBEDTLS_TLS_EXT_TRUNCATED_HMAC: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found truncated_hmac extension" ) ); if( ( ret = ssl_parse_truncated_hmac_ext( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_SSL_TRUNCATED_HMAC */ #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC) case MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found encrypt_then_mac extension" ) ); if( ( ret = ssl_parse_encrypt_then_mac_ext( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_SSL_ENCRYPT_THEN_MAC */ #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) case MBEDTLS_TLS_EXT_EXTENDED_MASTER_SECRET: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found extended_master_secret extension" ) ); if( ( ret = ssl_parse_extended_ms_ext( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */ #if defined(MBEDTLS_SSL_SESSION_TICKETS) case MBEDTLS_TLS_EXT_SESSION_TICKET: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found session_ticket extension" ) ); if( ( ret = ssl_parse_session_ticket_ext( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_SSL_SESSION_TICKETS */ #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) case MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found supported_point_formats extension" ) ); if( ( ret = ssl_parse_supported_point_formats_ext( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_ECDH_C || MBEDTLS_ECDSA_C || MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) case MBEDTLS_TLS_EXT_ECJPAKE_KKPP: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found ecjpake_kkpp extension" ) ); if( ( ret = ssl_parse_ecjpake_kkpp( ssl, ext + 4, ext_size ) ) != 0 ) { return( ret ); } break; #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_SSL_ALPN) case MBEDTLS_TLS_EXT_ALPN: MBEDTLS_SSL_DEBUG_MSG( 3, ( "found alpn extension" ) ); if( ( ret = ssl_parse_alpn_ext( ssl, ext + 4, ext_size ) ) != 0 ) return( ret ); break; #endif /* MBEDTLS_SSL_ALPN */ default: MBEDTLS_SSL_DEBUG_MSG( 3, ( "unknown extension found: %d (ignoring)", ext_id ) ); } ext_len -= 4 + ext_size; ext += 4 + ext_size; if( ext_len > 0 && ext_len < 4 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello message" ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } } /* * Renegotiation security checks */ if( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION && ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation, breaking off handshake" ) ); handshake_failure = 1; } #if defined(MBEDTLS_SSL_RENEGOTIATION) else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == MBEDTLS_SSL_SECURE_RENEGOTIATION && renegotiation_info_seen == 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension missing (secure)" ) ); handshake_failure = 1; } else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION && ssl->conf->allow_legacy_renegotiation == MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "legacy renegotiation not allowed" ) ); handshake_failure = 1; } else if( ssl->renego_status == MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS && ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION && renegotiation_info_seen == 1 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "renegotiation_info extension present (legacy)" ) ); handshake_failure = 1; } #endif /* MBEDTLS_SSL_RENEGOTIATION */ if( handshake_failure == 1 ) { mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello" ) ); return( 0 ); } #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) static int ssl_parse_server_dh_params( mbedtls_ssl_context *ssl, unsigned char **p, unsigned char *end ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; /* * Ephemeral DH parameters: * * struct { * opaque dh_p<1..2^16-1>; * opaque dh_g<1..2^16-1>; * opaque dh_Ys<1..2^16-1>; * } ServerDHParams; */ if( ( ret = mbedtls_dhm_read_params( &ssl->handshake->dhm_ctx, p, end ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 2, ( "mbedtls_dhm_read_params" ), ret ); return( ret ); } if( ssl->handshake->dhm_ctx.len * 8 < ssl->conf->dhm_min_bitlen ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "DHM prime too short: %d < %d", ssl->handshake->dhm_ctx.len * 8, ssl->conf->dhm_min_bitlen ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: P ", &ssl->handshake->dhm_ctx.P ); MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: G ", &ssl->handshake->dhm_ctx.G ); MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: GY", &ssl->handshake->dhm_ctx.GY ); return( ret ); } #endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) static int ssl_check_server_ecdh_params( const mbedtls_ssl_context *ssl ) { const mbedtls_ecp_curve_info *curve_info; mbedtls_ecp_group_id grp_id; #if defined(MBEDTLS_ECDH_LEGACY_CONTEXT) grp_id = ssl->handshake->ecdh_ctx.grp.id; #else grp_id = ssl->handshake->ecdh_ctx.grp_id; #endif curve_info = mbedtls_ecp_curve_info_from_grp_id( grp_id ); if( curve_info == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "ECDH curve: %s", curve_info->name ) ); #if defined(MBEDTLS_ECP_C) if( mbedtls_ssl_check_curve( ssl, grp_id ) != 0 ) #else if( ssl->handshake->ecdh_ctx.grp.nbits < 163 || ssl->handshake->ecdh_ctx.grp.nbits > 521 ) #endif return( -1 ); MBEDTLS_SSL_DEBUG_ECDH( 3, &ssl->handshake->ecdh_ctx, MBEDTLS_DEBUG_ECDH_QP ); return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) static int ssl_parse_server_ecdh_params( mbedtls_ssl_context *ssl, unsigned char **p, unsigned char *end ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; /* * Ephemeral ECDH parameters: * * struct { * ECParameters curve_params; * ECPoint public; * } ServerECDHParams; */ if( ( ret = mbedtls_ecdh_read_params( &ssl->handshake->ecdh_ctx, (const unsigned char **) p, end ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, ( "mbedtls_ecdh_read_params" ), ret ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ret == MBEDTLS_ERR_ECP_IN_PROGRESS ) ret = MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS; #endif return( ret ); } if( ssl_check_server_ecdh_params( ssl ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message (ECDHE curve)" ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } return( ret ); } #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl, unsigned char **p, unsigned char *end ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; size_t len; ((void) ssl); /* * PSK parameters: * * opaque psk_identity_hint<0..2^16-1>; */ if( end - (*p) < 2 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message (psk_identity_hint length)" ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } len = (*p)[0] << 8 | (*p)[1]; *p += 2; if( end - (*p) < (int) len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message (psk_identity_hint length)" ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } /* * Note: we currently ignore the PKS identity hint, as we only allow one * PSK to be provisionned on the client. This could be changed later if * someone needs that feature. */ *p += len; ret = 0; return( ret ); } #endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) /* * Generate a pre-master secret and encrypt it with the server's RSA key */ static int ssl_write_encrypted_pms( mbedtls_ssl_context *ssl, size_t offset, size_t *olen, size_t pms_offset ) { int ret; size_t len_bytes = ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ? 0 : 2; unsigned char *p = ssl->handshake->premaster + pms_offset; if( offset + len_bytes > MBEDTLS_SSL_OUT_CONTENT_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "buffer too small for encrypted pms" ) ); return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); } /* * Generate (part of) the pre-master as * struct { * ProtocolVersion client_version; * opaque random[46]; * } PreMasterSecret; */ mbedtls_ssl_write_version( ssl->conf->max_major_ver, ssl->conf->max_minor_ver, ssl->conf->transport, p ); if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, p + 2, 46 ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "f_rng", ret ); return( ret ); } ssl->handshake->pmslen = 48; if( ssl->session_negotiate->peer_cert == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "certificate required" ) ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } /* * Now write it out, encrypted */ if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, MBEDTLS_PK_RSA ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "certificate key type mismatch" ) ); return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH ); } if( ( ret = mbedtls_pk_encrypt( &ssl->session_negotiate->peer_cert->pk, p, ssl->handshake->pmslen, ssl->out_msg + offset + len_bytes, olen, MBEDTLS_SSL_OUT_CONTENT_LEN - offset - len_bytes, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_rsa_pkcs1_encrypt", ret ); return( ret ); } #if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_2) if( len_bytes == 2 ) { ssl->out_msg[offset+0] = (unsigned char)( *olen >> 8 ); ssl->out_msg[offset+1] = (unsigned char)( *olen ); *olen += 2; } #endif return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) static int ssl_parse_signature_algorithm( mbedtls_ssl_context *ssl, unsigned char **p, unsigned char *end, mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg ) { ((void) ssl); *md_alg = MBEDTLS_MD_NONE; *pk_alg = MBEDTLS_PK_NONE; /* Only in TLS 1.2 */ if( ssl->minor_ver != MBEDTLS_SSL_MINOR_VERSION_3 ) { return( 0 ); } if( (*p) + 2 > end ) return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); /* * Get hash algorithm */ if( ( *md_alg = mbedtls_ssl_md_alg_from_hash( (*p)[0] ) ) == MBEDTLS_MD_NONE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "Server used unsupported HashAlgorithm %d", *(p)[0] ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } /* * Get signature algorithm */ if( ( *pk_alg = mbedtls_ssl_pk_alg_from_sig( (*p)[1] ) ) == MBEDTLS_PK_NONE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "server used unsupported SignatureAlgorithm %d", (*p)[1] ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } /* * Check if the hash is acceptable */ if( mbedtls_ssl_check_sig_hash( ssl, *md_alg ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "server used HashAlgorithm %d that was not offered", *(p)[0] ) ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "Server used SignatureAlgorithm %d", (*p)[1] ) ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "Server used HashAlgorithm %d", (*p)[0] ) ); *p += 2; return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */ #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) static int ssl_get_ecdh_params_from_cert( mbedtls_ssl_context *ssl ) { int ret; const mbedtls_ecp_keypair *peer_key; if( ssl->session_negotiate->peer_cert == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "certificate required" ) ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, MBEDTLS_PK_ECKEY ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "server key not ECDH capable" ) ); return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH ); } peer_key = mbedtls_pk_ec( ssl->session_negotiate->peer_cert->pk ); if( ( ret = mbedtls_ecdh_get_params( &ssl->handshake->ecdh_ctx, peer_key, MBEDTLS_ECDH_THEIRS ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, ( "mbedtls_ecdh_get_params" ), ret ); return( ret ); } if( ssl_check_server_ecdh_params( ssl ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server certificate (ECDH curve)" ) ); return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE ); } return( ret ); } #endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */ static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl ) { int ret; const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; unsigned char *p = NULL, *end = NULL; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server key exchange" ) ); #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse server key exchange" ) ); ssl->state++; return( 0 ); } ((void) p); ((void) end); #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA ) { if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "ssl_get_ecdh_params_from_cert", ret ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( ret ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse server key exchange" ) ); ssl->state++; return( 0 ); } ((void) p); ((void) end); #endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */ #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled && ssl->handshake->ecrs_state == ssl_ecrs_ske_start_processing ) { goto start_processing; } #endif if( ( ret = mbedtls_ssl_read_record( ssl, 1 ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } /* * ServerKeyExchange may be skipped with PSK and RSA-PSK when the server * doesn't use a psk_identity_hint */ if( ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE ) { if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ) { /* Current message is probably either * CertificateRequest or ServerHelloDone */ ssl->keep_current_message = 1; goto exit; } MBEDTLS_SSL_DEBUG_MSG( 1, ( "server key exchange message must not be skipped" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled ) ssl->handshake->ecrs_state = ssl_ecrs_ske_start_processing; start_processing: #endif p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl ); end = ssl->in_msg + ssl->in_hslen; MBEDTLS_SSL_DEBUG_BUF( 3, "server key exchange", p, end - p ); #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ) { if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } } /* FALLTROUGH */ #endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ) ; /* nothing more to do */ else #endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED || MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ) { if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA ) { if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { ret = mbedtls_ecjpake_read_round_two( &ssl->handshake->ecjpake_ctx, p, end - p ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_two", ret ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } #if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED) if( mbedtls_ssl_ciphersuite_uses_server_signature( ciphersuite_info ) ) { size_t sig_len, hashlen; unsigned char hash[64]; mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE; mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE; unsigned char *params = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl ); size_t params_len = p - params; void *rs_ctx = NULL; /* * Handle the digitally-signed structure */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 ) { if( ssl_parse_signature_algorithm( ssl, &p, end, &md_alg, &pk_alg ) != 0 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } } else #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ #if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_1) if( ssl->minor_ver < MBEDTLS_SSL_MINOR_VERSION_3 ) { pk_alg = mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ); /* Default hash for ECDSA is SHA-1 */ if( pk_alg == MBEDTLS_PK_ECDSA && md_alg == MBEDTLS_MD_NONE ) md_alg = MBEDTLS_MD_SHA1; } else #endif { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } /* * Read signature */ if( p > end - 2 ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } sig_len = ( p[0] << 8 ) | p[1]; p += 2; if( p != end - sig_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } MBEDTLS_SSL_DEBUG_BUF( 3, "signature", p, sig_len ); /* * Compute the hash that has been signed */ #if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_1) if( md_alg == MBEDTLS_MD_NONE ) { hashlen = 36; ret = mbedtls_ssl_get_key_exchange_md_ssl_tls( ssl, hash, params, params_len ); if( ret != 0 ) return( ret ); } else #endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \ MBEDTLS_SSL_PROTO_TLS1_1 */ #if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_2) if( md_alg != MBEDTLS_MD_NONE ) { ret = mbedtls_ssl_get_key_exchange_md_tls1_2( ssl, hash, &hashlen, params, params_len, md_alg ); if( ret != 0 ) return( ret ); } else #endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \ MBEDTLS_SSL_PROTO_TLS1_2 */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } MBEDTLS_SSL_DEBUG_BUF( 3, "parameters hash", hash, hashlen ); if( ssl->session_negotiate->peer_cert == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "certificate required" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } /* * Verify signature */ if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, pk_alg ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE ); return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH ); } #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled ) rs_ctx = &ssl->handshake->ecrs_ctx.pk; #endif if( ( ret = mbedtls_pk_verify_restartable( &ssl->session_negotiate->peer_cert->pk, md_alg, hash, hashlen, p, sig_len, rs_ctx ) ) != 0 ) { #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ret != MBEDTLS_ERR_ECP_IN_PROGRESS ) #endif mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR ); MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_pk_verify", ret ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ret == MBEDTLS_ERR_ECP_IN_PROGRESS ) ret = MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS; #endif return( ret ); } } #endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */ exit: ssl->state++; MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server key exchange" ) ); return( 0 ); } #if ! defined(MBEDTLS_KEY_EXCHANGE__CERT_REQ_ALLOWED__ENABLED) static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl ) { const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse certificate request" ) ); if( ! mbedtls_ssl_ciphersuite_cert_req_allowed( ciphersuite_info ) ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse certificate request" ) ); ssl->state++; return( 0 ); } MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } #else /* MBEDTLS_KEY_EXCHANGE__CERT_REQ_ALLOWED__ENABLED */ static int ssl_parse_certificate_request( mbedtls_ssl_context *ssl ) { int ret; unsigned char *buf; size_t n = 0; size_t cert_type_len = 0, dn_len = 0; const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse certificate request" ) ); if( ! mbedtls_ssl_ciphersuite_cert_req_allowed( ciphersuite_info ) ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse certificate request" ) ); ssl->state++; return( 0 ); } if( ( ret = mbedtls_ssl_read_record( ssl, 1 ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } ssl->state++; ssl->client_auth = ( ssl->in_msg[0] == MBEDTLS_SSL_HS_CERTIFICATE_REQUEST ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "got %s certificate request", ssl->client_auth ? "a" : "no" ) ); if( ssl->client_auth == 0 ) { /* Current message is probably the ServerHelloDone */ ssl->keep_current_message = 1; goto exit; } /* * struct { * ClientCertificateType certificate_types<1..2^8-1>; * SignatureAndHashAlgorithm * supported_signature_algorithms<2^16-1>; -- TLS 1.2 only * DistinguishedName certificate_authorities<0..2^16-1>; * } CertificateRequest; * * Since we only support a single certificate on clients, let's just * ignore all the information that's supposed to help us pick a * certificate. * * We could check that our certificate matches the request, and bail out * if it doesn't, but it's simpler to just send the certificate anyway, * and give the server the opportunity to decide if it should terminate * the connection when it doesn't like our certificate. * * Same goes for the hash in TLS 1.2's signature_algorithms: at this * point we only have one hash available (see comments in * write_certificate_verify), so let's just use what we have. * * However, we still minimally parse the message to check it is at least * superficially sane. */ buf = ssl->in_msg; /* certificate_types */ if( ssl->in_hslen <= mbedtls_ssl_hs_hdr_len( ssl ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST ); } cert_type_len = buf[mbedtls_ssl_hs_hdr_len( ssl )]; n = cert_type_len; /* * In the subsequent code there are two paths that read from buf: * * the length of the signature algorithms field (if minor version of * SSL is 3), * * distinguished name length otherwise. * Both reach at most the index: * ...hdr_len + 2 + n, * therefore the buffer length at this point must be greater than that * regardless of the actual code path. */ if( ssl->in_hslen <= mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST ); } /* supported_signature_algorithms */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 ) { size_t sig_alg_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 ) | ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) ); #if defined(MBEDTLS_DEBUG_C) unsigned char* sig_alg; size_t i; #endif /* * The furthest access in buf is in the loop few lines below: * sig_alg[i + 1], * where: * sig_alg = buf + ...hdr_len + 3 + n, * max(i) = sig_alg_len - 1. * Therefore the furthest access is: * buf[...hdr_len + 3 + n + sig_alg_len - 1 + 1], * which reduces to: * buf[...hdr_len + 3 + n + sig_alg_len], * which is one less than we need the buf to be. */ if( ssl->in_hslen <= mbedtls_ssl_hs_hdr_len( ssl ) + 3 + n + sig_alg_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST ); } #if defined(MBEDTLS_DEBUG_C) sig_alg = buf + mbedtls_ssl_hs_hdr_len( ssl ) + 3 + n; for( i = 0; i < sig_alg_len; i += 2 ) { MBEDTLS_SSL_DEBUG_MSG( 3, ( "Supported Signature Algorithm found: %d,%d", sig_alg[i], sig_alg[i + 1] ) ); } #endif n += 2 + sig_alg_len; } #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ /* certificate_authorities */ dn_len = ( ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 1 + n] << 8 ) | ( buf[mbedtls_ssl_hs_hdr_len( ssl ) + 2 + n] ) ); n += dn_len; if( ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) + 3 + n ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad certificate request message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST ); } exit: MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse certificate request" ) ); return( 0 ); } #endif /* MBEDTLS_KEY_EXCHANGE__CERT_REQ_ALLOWED__ENABLED */ static int ssl_parse_server_hello_done( mbedtls_ssl_context *ssl ) { int ret; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server hello done" ) ); if( ( ret = mbedtls_ssl_read_record( ssl, 1 ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello done message" ) ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } if( ssl->in_hslen != mbedtls_ssl_hs_hdr_len( ssl ) || ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_HELLO_DONE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server hello done message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE ); } ssl->state++; #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) mbedtls_ssl_recv_flight_completed( ssl ); #endif MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server hello done" ) ); return( 0 ); } static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl ) { int ret; size_t i, n; const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client key exchange" ) ); #if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ) { /* * DHM key exchange -- send G^X mod P */ n = ssl->handshake->dhm_ctx.len; ssl->out_msg[4] = (unsigned char)( n >> 8 ); ssl->out_msg[5] = (unsigned char)( n ); i = 6; ret = mbedtls_dhm_make_public( &ssl->handshake->dhm_ctx, (int) mbedtls_mpi_size( &ssl->handshake->dhm_ctx.P ), &ssl->out_msg[i], n, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_make_public", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: X ", &ssl->handshake->dhm_ctx.X ); MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: GX", &ssl->handshake->dhm_ctx.GX ); if( ( ret = mbedtls_dhm_calc_secret( &ssl->handshake->dhm_ctx, ssl->handshake->premaster, MBEDTLS_PREMASTER_SIZE, &ssl->handshake->pmslen, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_calc_secret", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MPI( 3, "DHM: K ", &ssl->handshake->dhm_ctx.K ); } else #endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \ defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA ) { /* * ECDH key exchange -- send client public value */ i = 4; #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled ) { if( ssl->handshake->ecrs_state == ssl_ecrs_cke_ecdh_calc_secret ) goto ecdh_calc_secret; mbedtls_ecdh_enable_restart( &ssl->handshake->ecdh_ctx ); } #endif ret = mbedtls_ecdh_make_public( &ssl->handshake->ecdh_ctx, &n, &ssl->out_msg[i], 1000, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_make_public", ret ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ret == MBEDTLS_ERR_ECP_IN_PROGRESS ) ret = MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS; #endif return( ret ); } MBEDTLS_SSL_DEBUG_ECDH( 3, &ssl->handshake->ecdh_ctx, MBEDTLS_DEBUG_ECDH_Q ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled ) { ssl->handshake->ecrs_n = n; ssl->handshake->ecrs_state = ssl_ecrs_cke_ecdh_calc_secret; } ecdh_calc_secret: if( ssl->handshake->ecrs_enabled ) n = ssl->handshake->ecrs_n; #endif if( ( ret = mbedtls_ecdh_calc_secret( &ssl->handshake->ecdh_ctx, &ssl->handshake->pmslen, ssl->handshake->premaster, MBEDTLS_MPI_MAX_SIZE, ssl->conf->f_rng, ssl->conf->p_rng ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_calc_secret", ret ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ret == MBEDTLS_ERR_ECP_IN_PROGRESS ) ret = MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS; #endif return( ret ); } MBEDTLS_SSL_DEBUG_ECDH( 3, &ssl->handshake->ecdh_ctx, MBEDTLS_DEBUG_ECDH_Z ); } else #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED || MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) if( mbedtls_ssl_ciphersuite_uses_psk( ciphersuite_info ) ) { /* * opaque psk_identity<0..2^16-1>; */ if( ssl->conf->psk == NULL || ssl->conf->psk_identity == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "got no private key for PSK" ) ); return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ); } i = 4; n = ssl->conf->psk_identity_len; if( i + 2 + n > MBEDTLS_SSL_OUT_CONTENT_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity too long or SSL buffer too short" ) ); return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); } ssl->out_msg[i++] = (unsigned char)( n >> 8 ); ssl->out_msg[i++] = (unsigned char)( n ); memcpy( ssl->out_msg + i, ssl->conf->psk_identity, ssl->conf->psk_identity_len ); i += ssl->conf->psk_identity_len; #if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ) { n = 0; } else #endif #if defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ) { if( ( ret = ssl_write_encrypted_pms( ssl, i, &n, 2 ) ) != 0 ) return( ret ); } else #endif #if defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ) { /* * ClientDiffieHellmanPublic public (DHM send G^X mod P) */ n = ssl->handshake->dhm_ctx.len; if( i + 2 + n > MBEDTLS_SSL_OUT_CONTENT_LEN ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "psk identity or DHM size too long or SSL buffer too short" ) ); return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); } ssl->out_msg[i++] = (unsigned char)( n >> 8 ); ssl->out_msg[i++] = (unsigned char)( n ); ret = mbedtls_dhm_make_public( &ssl->handshake->dhm_ctx, (int) mbedtls_mpi_size( &ssl->handshake->dhm_ctx.P ), &ssl->out_msg[i], n, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_dhm_make_public", ret ); return( ret ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ) { /* * ClientECDiffieHellmanPublic public; */ ret = mbedtls_ecdh_make_public( &ssl->handshake->ecdh_ctx, &n, &ssl->out_msg[i], MBEDTLS_SSL_OUT_CONTENT_LEN - i, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecdh_make_public", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_ECDH( 3, &ssl->handshake->ecdh_ctx, MBEDTLS_DEBUG_ECDH_Q ); } else #endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } if( ( ret = mbedtls_ssl_psk_derive_premaster( ssl, ciphersuite_info->key_exchange ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_psk_derive_premaster", ret ); return( ret ); } } else #endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA ) { i = 4; if( ( ret = ssl_write_encrypted_pms( ssl, i, &n, 0 ) ) != 0 ) return( ret ); } else #endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */ #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { i = 4; ret = mbedtls_ecjpake_write_round_two( &ssl->handshake->ecjpake_ctx, ssl->out_msg + i, MBEDTLS_SSL_OUT_CONTENT_LEN - i, &n, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_write_round_two", ret ); return( ret ); } ret = mbedtls_ecjpake_derive_secret( &ssl->handshake->ecjpake_ctx, ssl->handshake->premaster, 32, &ssl->handshake->pmslen, ssl->conf->f_rng, ssl->conf->p_rng ); if( ret != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_derive_secret", ret ); return( ret ); } } else #endif /* MBEDTLS_KEY_EXCHANGE_RSA_ENABLED */ { ((void) ciphersuite_info); MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } ssl->out_msglen = i + n; ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE; ssl->out_msg[0] = MBEDTLS_SSL_HS_CLIENT_KEY_EXCHANGE; ssl->state++; if( ( ret = mbedtls_ssl_write_handshake_msg( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_handshake_msg", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client key exchange" ) ); return( 0 ); } #if !defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) && \ !defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) && \ !defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) && \ !defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) && \ !defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)&& \ !defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl ) { const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; int ret; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write certificate verify" ) ); if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret ); return( ret ); } if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip write certificate verify" ) ); ssl->state++; return( 0 ); } MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } #else static int ssl_write_certificate_verify( mbedtls_ssl_context *ssl ) { int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE; const mbedtls_ssl_ciphersuite_t *ciphersuite_info = ssl->transform_negotiate->ciphersuite_info; size_t n = 0, offset = 0; unsigned char hash[48]; unsigned char *hash_start = hash; mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE; unsigned int hashlen; void *rs_ctx = NULL; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write certificate verify" ) ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled && ssl->handshake->ecrs_state == ssl_ecrs_crt_vrfy_sign ) { goto sign; } #endif if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_derive_keys", ret ); return( ret ); } if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK || ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip write certificate verify" ) ); ssl->state++; return( 0 ); } if( ssl->client_auth == 0 || mbedtls_ssl_own_cert( ssl ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip write certificate verify" ) ); ssl->state++; return( 0 ); } if( mbedtls_ssl_own_key( ssl ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "got no private key for certificate" ) ); return( MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED ); } /* * Make a signature of the handshake digests */ #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled ) ssl->handshake->ecrs_state = ssl_ecrs_crt_vrfy_sign; sign: #endif ssl->handshake->calc_verify( ssl, hash ); #if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_1) if( ssl->minor_ver != MBEDTLS_SSL_MINOR_VERSION_3 ) { /* * digitally-signed struct { * opaque md5_hash[16]; * opaque sha_hash[20]; * }; * * md5_hash * MD5(handshake_messages); * * sha_hash * SHA(handshake_messages); */ hashlen = 36; md_alg = MBEDTLS_MD_NONE; /* * For ECDSA, default hash is SHA-1 only */ if( mbedtls_pk_can_do( mbedtls_ssl_own_key( ssl ), MBEDTLS_PK_ECDSA ) ) { hash_start += 16; hashlen -= 16; md_alg = MBEDTLS_MD_SHA1; } } else #endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \ MBEDTLS_SSL_PROTO_TLS1_1 */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 ) { /* * digitally-signed struct { * opaque handshake_messages[handshake_messages_length]; * }; * * Taking shortcut here. We assume that the server always allows the * PRF Hash function and has sent it in the allowed signature * algorithms list received in the Certificate Request message. * * Until we encounter a server that does not, we will take this * shortcut. * * Reason: Otherwise we should have running hashes for SHA512 and * SHA224 in order to satisfy 'weird' needs from the server * side. */ if( ssl->transform_negotiate->ciphersuite_info->mac == MBEDTLS_MD_SHA384 ) { md_alg = MBEDTLS_MD_SHA384; ssl->out_msg[4] = MBEDTLS_SSL_HASH_SHA384; } else { md_alg = MBEDTLS_MD_SHA256; ssl->out_msg[4] = MBEDTLS_SSL_HASH_SHA256; } ssl->out_msg[5] = mbedtls_ssl_sig_from_pk( mbedtls_ssl_own_key( ssl ) ); /* Info from md_alg will be used instead */ hashlen = 0; offset = 2; } else #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ { MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) ); return( MBEDTLS_ERR_SSL_INTERNAL_ERROR ); } #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ssl->handshake->ecrs_enabled ) rs_ctx = &ssl->handshake->ecrs_ctx.pk; #endif if( ( ret = mbedtls_pk_sign_restartable( mbedtls_ssl_own_key( ssl ), md_alg, hash_start, hashlen, ssl->out_msg + 6 + offset, &n, ssl->conf->f_rng, ssl->conf->p_rng, rs_ctx ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_pk_sign", ret ); #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) if( ret == MBEDTLS_ERR_ECP_IN_PROGRESS ) ret = MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS; #endif return( ret ); } ssl->out_msg[4 + offset] = (unsigned char)( n >> 8 ); ssl->out_msg[5 + offset] = (unsigned char)( n ); ssl->out_msglen = 6 + n + offset; ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE; ssl->out_msg[0] = MBEDTLS_SSL_HS_CERTIFICATE_VERIFY; ssl->state++; if( ( ret = mbedtls_ssl_write_handshake_msg( ssl ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_handshake_msg", ret ); return( ret ); } MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write certificate verify" ) ); return( ret ); } #endif /* !MBEDTLS_KEY_EXCHANGE_RSA_ENABLED && !MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED && !MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED && !MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED && !MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED && !MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */ #if defined(MBEDTLS_SSL_SESSION_TICKETS) static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl ) { int ret; uint32_t lifetime; size_t ticket_len; unsigned char *ticket; const unsigned char *msg; MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse new session ticket" ) ); if( ( ret = mbedtls_ssl_read_record( ssl, 1 ) ) != 0 ) { MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad new session ticket message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE ); return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE ); } /* * struct { * uint32 ticket_lifetime_hint; * opaque ticket<0..2^16-1>; * } NewSessionTicket; * * 0 . 3 ticket_lifetime_hint * 4 . 5 ticket_len (n) * 6 . 5+n ticket content */ if( ssl->in_msg[0] != MBEDTLS_SSL_HS_NEW_SESSION_TICKET || ssl->in_hslen < 6 + mbedtls_ssl_hs_hdr_len( ssl ) ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad new session ticket message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET ); } msg = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl ); lifetime = ( ((uint32_t) msg[0]) << 24 ) | ( msg[1] << 16 ) | ( msg[2] << 8 ) | ( msg[3] ); ticket_len = ( msg[4] << 8 ) | ( msg[5] ); if( ticket_len + 6 + mbedtls_ssl_hs_hdr_len( ssl ) != ssl->in_hslen ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad new session ticket message" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET ); } MBEDTLS_SSL_DEBUG_MSG( 3, ( "ticket length: %d", ticket_len ) ); /* We're not waiting for a NewSessionTicket message any more */ ssl->handshake->new_session_ticket = 0; ssl->state = MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC; /* * Zero-length ticket means the server changed his mind and doesn't want * to send a ticket after all, so just forget it */ if( ticket_len == 0 ) return( 0 ); mbedtls_platform_zeroize( ssl->session_negotiate->ticket, ssl->session_negotiate->ticket_len ); mbedtls_free( ssl->session_negotiate->ticket ); ssl->session_negotiate->ticket = NULL; ssl->session_negotiate->ticket_len = 0; if( ( ticket = mbedtls_calloc( 1, ticket_len ) ) == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "ticket alloc failed" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); } memcpy( ticket, msg + 6, ticket_len ); ssl->session_negotiate->ticket = ticket; ssl->session_negotiate->ticket_len = ticket_len; ssl->session_negotiate->ticket_lifetime = lifetime; /* * RFC 5077 section 3.4: * "If the client receives a session ticket from the server, then it * discards any Session ID that was sent in the ServerHello." */ MBEDTLS_SSL_DEBUG_MSG( 3, ( "ticket in use, discarding session id" ) ); ssl->session_negotiate->id_len = 0; MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse new session ticket" ) ); return( 0 ); } #endif /* MBEDTLS_SSL_SESSION_TICKETS */ /* * SSL handshake -- client side -- single step */ int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl ) { int ret = 0; if( ssl->state == MBEDTLS_SSL_HANDSHAKE_OVER || ssl->handshake == NULL ) return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "client state: %d", ssl->state ) ); if( ( ret = mbedtls_ssl_flush_output( ssl ) ) != 0 ) return( ret ); #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM && ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING ) { if( ( ret = mbedtls_ssl_flight_transmit( ssl ) ) != 0 ) return( ret ); } #endif /* MBEDTLS_SSL_PROTO_DTLS */ /* Change state now, so that it is right in mbedtls_ssl_read_record(), used * by DTLS for dropping out-of-sequence ChangeCipherSpec records */ #if defined(MBEDTLS_SSL_SESSION_TICKETS) if( ssl->state == MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC && ssl->handshake->new_session_ticket != 0 ) { ssl->state = MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET; } #endif switch( ssl->state ) { case MBEDTLS_SSL_HELLO_REQUEST: ssl->state = MBEDTLS_SSL_CLIENT_HELLO; break; /* * ==> ClientHello */ case MBEDTLS_SSL_CLIENT_HELLO: ret = ssl_write_client_hello( ssl ); break; /* * <== ServerHello * Certificate * ( ServerKeyExchange ) * ( CertificateRequest ) * ServerHelloDone */ case MBEDTLS_SSL_SERVER_HELLO: ret = ssl_parse_server_hello( ssl ); break; case MBEDTLS_SSL_SERVER_CERTIFICATE: ret = mbedtls_ssl_parse_certificate( ssl ); break; case MBEDTLS_SSL_SERVER_KEY_EXCHANGE: ret = ssl_parse_server_key_exchange( ssl ); break; case MBEDTLS_SSL_CERTIFICATE_REQUEST: ret = ssl_parse_certificate_request( ssl ); break; case MBEDTLS_SSL_SERVER_HELLO_DONE: ret = ssl_parse_server_hello_done( ssl ); break; /* * ==> ( Certificate/Alert ) * ClientKeyExchange * ( CertificateVerify ) * ChangeCipherSpec * Finished */ case MBEDTLS_SSL_CLIENT_CERTIFICATE: ret = mbedtls_ssl_write_certificate( ssl ); break; case MBEDTLS_SSL_CLIENT_KEY_EXCHANGE: ret = ssl_write_client_key_exchange( ssl ); break; case MBEDTLS_SSL_CERTIFICATE_VERIFY: ret = ssl_write_certificate_verify( ssl ); break; case MBEDTLS_SSL_CLIENT_CHANGE_CIPHER_SPEC: ret = mbedtls_ssl_write_change_cipher_spec( ssl ); break; case MBEDTLS_SSL_CLIENT_FINISHED: ret = mbedtls_ssl_write_finished( ssl ); break; /* * <== ( NewSessionTicket ) * ChangeCipherSpec * Finished */ #if defined(MBEDTLS_SSL_SESSION_TICKETS) case MBEDTLS_SSL_SERVER_NEW_SESSION_TICKET: ret = ssl_parse_new_session_ticket( ssl ); break; #endif case MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC: ret = mbedtls_ssl_parse_change_cipher_spec( ssl ); break; case MBEDTLS_SSL_SERVER_FINISHED: ret = mbedtls_ssl_parse_finished( ssl ); break; case MBEDTLS_SSL_FLUSH_BUFFERS: MBEDTLS_SSL_DEBUG_MSG( 2, ( "handshake: done" ) ); ssl->state = MBEDTLS_SSL_HANDSHAKE_WRAPUP; break; case MBEDTLS_SSL_HANDSHAKE_WRAPUP: mbedtls_ssl_handshake_wrapup( ssl ); break; default: MBEDTLS_SSL_DEBUG_MSG( 1, ( "invalid state %d", ssl->state ) ); return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); } return( ret ); } #endif /* MBEDTLS_SSL_CLI_C */ ```
Olbermann was a television sports talk show hosted by Keith Olbermann on the American cable network ESPN2. The show, broadcast live daily from Times Square Studios in New York City, premiered on August 26, 2013, and featured Olbermann offering commentary and analysis on issues in the sports world. Olbermann was originally a sixty-minute nightly program, usually starting at 11:00 PM Eastern. For a brief period of time, specifically during the ESPN networks’ coverage of the Australian Open, the show temporarily aired at 6:00 PM in a thirty-minute format. During this period a repeat of the program aired on ESPNEWS at 2:00 AM. In September 2014, Olbermann was moved from its nightly spot to a late afternoon time slot and began airing at 5:00 PM Eastern in a thirty-minute format. ESPNEWS added two additional repeat airings; the first aired at 6:30 p.m., the second one in the usual 2:00 a.m. slot, and the last at 5:00 a.m. On July 10, 2015, two days after ESPN declined to renew his expiring contract, Olbermann announced on air that the series would be coming to an end on July 24. The announcement came after The Hollywood Reporter claimed that ESPN wanted Olbermann to tone down his critical commentary, but the network claimed the move was to cut costs related to Olbermann's salary and the use of the space at Times Square Studios, claims later confirmed by an aborted move of Mike & Mike to the same facility and releases of other network talent at the end of their contracts throughout 2015 and into 2016. Background Olbermann marked the second tour of duty for Keith Olbermann with the ESPN organization, having served as a popular co-anchor (alongside Dan Patrick) of the main network's SportsCenter between 1992 and 1997; it's also Olbermann's second stint at ESPN's secondary network, ESPN2, where he briefly served as original anchor of the network's SportsNight in 1993–1994. In the decade before Olbermann's debut, Olbermann gained notice as an anchor/commentator on hard news and political discussion, serving as host of Countdown with Keith Olbermann, which aired on MSNBC and, briefly, Current TV. Since Olbermann's return to the ESPN family was formally announced in July 2013, much mention had been made in media coverage of the anchor's abrasive off-screen demeanor and his acrimonious partings with several of his previous employers, including his 1997 departure from ESPN. Both Olbermann and ESPN executives had reported "no friction" between them in the run-up to Olbermann's debut (ESPN VP/Programming Jamie Horowitz has noted Olbermann's openness to ideas and suggestions for the program); the anchor himself has owned up to his tempestuous past and his efforts to rebuild bridges with his old colleagues. Olbermann had also indicated he is happy returning to covering sports on a regular basis, telling The New York Times, "If you cover politics for eight years without interruption like I did, you need a change." Format The format rundown below was the format in use when the show was reduced to thirty minutes. Opening monologue: Olbermann opens the show speaking for approximately six minutes about a sports issue of the day. Some of these commentaries are along the lines of the "Special Comment" segments on Countdown where he criticizes a figure and demands action. Others are more lighthearted in nature such as his "Mr. Cranky" predictions. Another occasional feature on his monologs were musings on sports history, lore and his take on it. World's Worst: another Countdown feature adjusted for the sports audience, on people or organizations that have performed something egregious that sets them up for Olbermann's ridicule, and like Countdown, retains Bach's Toccata and Fugue in D Minor as background music. This segment is "more gentle and sarcastic" than its counterpart's sharp political tinge on Countdown; Olbermann pokes fun at "the miscreants, losers and riffraff, the unwashed and the unloved," suggesting that viewers "don't take it completely seriously, I don't mean it completely literally, we just call them 'The Worst Persons In the Sports World'." Occasionally though the 'completely' is dispensed with if the target's behavior was particularly egregious, along with the theme music for extended commentary. Three targets per night are featured, ranked "worse," "worser," and "worst" just as they were on Countdown. Also, as on Countdown, Olbermann tosses his notes at the camera following its conclusion (although he did this more on the Current TV series) and pretends to play the organ chord that closes the musical piece. Although the Worst segment is usually lighthearted in nature, Olbermann will occasionally use the segment to profile someone who did something so bad there is no other place to discuss them and will usually dispense with his end of segment theatrics by either throwing to break or by spinning his chair around so his back is facing the camera. Other times, for instance when Olbermann complimented model Chrissy Teigen on her Dodgers first pitch done while under the influence of alcohol, or ribbed his friend, Cleveland Indians manager Terry Francona, for a story about his over-consumption of ice pops, the "worst" ranking is done fully light-heartedly and disclaimed as the only place in the show's format where the story could fit in. X Joins KO: Olbermann conducts an interview with a featured guest, whether it be from the world of sports or entertainment. ESPN contributors Jason Whitlock, Buster Olney, and John Clayton were frequent guests as are ESPNW contributor Sarah Spain, who like Olbermann is a Cornell University graduate (which Olbermann routinely discusses during the show); Grantland and Baseball Tonight contributor Jonah Keri, MLB.com and former Houston Chronicle columnist Richard Justice, and comedian and writer Bill Scheft, who was Olbermann's designated emergency guest. The Bruno Bash: Every Friday, Olbermann and his former ESPN Radio colleague Tony Bruno would have a discussion focusing on various sports issues of the day, usually in a humorous fashion. The segment was temporarily on hiatus while Bruno focused on his return to daily sports radio hosting on WIP-FM in Philadelphia; he returned on April 2, 2015, with the segment done on Bruno's end most weeks via satellite from ABC O&O WPVI-TV in Philadelphia. Late Headlines/Keith Lights: The closing segment of every show. The segment leads off with Olbermann relaying some tidbits of sports news from earlier in the day, although some news breaks while the program is airing. These are followed by Olbermann commenting on sports highlights, usually from the previous day's action since the show's 5:00 PM airtime usually does not allow for current day highlights. As he recaps them Olbermann will rely on catchphrases he used during his SportsCenter days, such as saying a high-pitched "Hello!" for a collision between two players and "bye, Felicia" for plays that result in someone being dismissed or left behind (such as a strikeout or a fast break). Olbermann also lightheartedly mocks other sports announcers. For instance, for basketball highlights he will do an imitation of Johnny Most when a player makes a three-point shot. using accentuated, For baseball highlights, particularly those where home runs are featured, Olbermann puts a spin on the home run call of John Sterling where he follows the call with a series of three-syllable names, usually starting with Boba Fett. For golf highlights, Olbermann portrays course reporter "Bob Slurm" and speaks in a hushed tone like a stereotypical golf broadcaster would. A further running gag with the golf highlights involves Olbermann getting "caught" portraying Bob Slurm; since he uses the hushed tone, he has to hold his lapel mic close to his face so he can be heard and often the camera cuts away from the highlights while Olbermann is still in character. The voice is also used with Westminster Kennel Club Dog Show highlights in mid-February, and Olbermann interviews the trainer of the Best in Show dog the day after the show, as he did during the run of Countdown. Sometimes, if there are not any games to recap, the segment instead focuses on past highlights with the title "Keith Lights Throughout History". Politics are not entirely off limits on Olbermann; rebuffing a report from The New York Times claiming that he was contractually forbidden from speaking about politics on the show, Olbermann said, "There’s nothing preventing me from doing it other than common sense," although he hinted that some aspects of politics would be covered if it crosses paths with the sports world. The original sixty-minute format included all of the above segments, with the exception that there were two rounds of Keith Lights segments; the first recapped sports action to that point in the program and included the top sports news of the day while the second added any additional action that had been completed in the intervening time. In October 2013 Olbermann adopted a more rigid format. The opening monolog and format rundown switched places, with Olbermann starting the show with the list of topics and introducing the program with "Olbermann is next, by the way, I'm Olbermann." In April 2014, the show again flipped the order of the monolog and the rundown so that the monolog returns to its cold open style and the rundown leads into the first commercial. For the show's finale, Olbermann, instead of opening with a monolog, explained "his crack staff did everything for me today so I don't have to work", which immediately led into first guest Kareem-Abdul Jabbar. Olbermann would close the show in the following manner. Olbermann's signoff pays tribute to two people who influenced his life. After Chet Curtis, with whom Olbermann had worked at WCVB-TV in Boston when he was briefly the station's sportscaster in 1984, died in January 2014 Olbermann began adding the news close to his signoff and employed names of people featured earlier in the show (although he uses "news" and "Eyewitness News" interchangeably; oddly enough, Olbermann's time as a local sportscaster in Boston and Los Angeles did not see him work for any station using the Eyewitness News branding as WCVB brands its newscasts as NewsCenter, while KTLA had the NewsWatch branding and KCBS was using the Action News format while Olbermann was there). Olbermann's signoff line is taken from Arthur Naething, an English teacher of Olbermann's at the Hackley School who used to say this to all of his students and who died in October 2014. Previously Olbermann signed off by using Edward R. Murrow's trademark "good night and good luck" signoff, which he had begun to use while at MSNBC, and had recently begun incorporating the phrase "hap'nin" in honor of his schoolmate Chris Berman. After signing off, Olbermann crumples what is left of his notes and tosses them at the camera, with the lens "shattering" for effect. In his final show on July 24, Olbermann, after a long montage of hilarity and quirks, thanked all of his directors, artists, and colleagues. He then signed off by saying "Bye, Felicia" one last time and threw his signed Abdul-Jabbar basketball toward the camera to close the series. When Olbermann first made the move to 5:00 PM, it coincided with a move of Outside the Lines to follow it on the schedule and at the end of the show, Olbermann would toss to Bob Ley (or whoever happened to be hosting the show that day) in Bristol and briefly discuss the upcoming half-hour. The tosses were cut out of each subsequent reairing and dropped altogether when OTL moved back to ESPN Former segments "This Week in Keith History" - an interlude that finds Olbermann providing amusing reactions to clips from his earlier ESPN stint that he has not seen in advance ("I haven't seen it, I don't know what it is, I didn't get a hint, and yes I did pay for that haircut"). This segment was only featured for the first two weeks of the show and has since been dropped. "Time Marches On" - originated as "Oddball" on Countdown and renamed to its current name when the show moved to Current, this segment saw Olbermann commenting on the "wild and wacky" stories in the world of sports with accompanying video clips. These segments were dropped when Olbermann was reduced to thirty minutes. Guest hosts Guest hosts have occasionally shown up on Olbermann for various reasons. These were initially done out of necessity due to Olbermann's previously announced commitment to anchor Turner Sports' coverage of the Major League Baseball postseason in October 2013. Larry King was the first substitute host, with Colin Cowherd and Jeremy Schaap following him. The format for these shows was largely scrapped, and Cowherd had his own segment at the end of the show where he ranked whether or not a sports figure was having a good day. In early 2014, Olbermann suffered a bout of shingles and required some intermittent substitutes. The two most frequent were Adnan Virk and Pablo S. Torre, and in the former case (since Virk is a SportsCenter anchor) the "Keith Lights" segments returned. When Torre substituted the shows were more interview driven. In both cases, the program would often be reduced in length to thirty minutes. Other guest hosts have included Robert Flores, Bram Weinstein, Max Bretos, Jay Harris, Matt Barrie, Ryen Russillo, and Steve Weissman. Suspension Olbermann was suspended on February 24, 2015, for a week after he made disparaging comments on Twitter regarding Penn State and Penn State IFC/Panhellenic Dance Marathon, which raises money for pediatric cancer. Adnan Virk and Pablo S. Torre hosted the show in his absence. Olbermann gave an apology for his Twitter comments on his first day back from suspension. International broadcasts Canada: Was initially carried on TSN2, normally at midnight ET, i.e. on a tape delay of about one hour. Receiving little promotion, the program was removed from the schedule at the start of October 2013. With the September 2014 move to an afternoon timeslot (combined with the launch of additional TSN channels), the program began airing simultaneously with U.S. broadcast most weekdays on one of the TSN channels, usually TSN2. Australia: Airs on ESPN Australia delayed to 11:00 PM EST. References 2010s American television talk shows American sports television series English-language television shows ESPN2 original programming
The 1957 Virginia 500 was a NASCAR Grand National Series event that was held on May 19, 1957, at Martinsville Speedway in Martinsville, Virginia. Barney Oldfield made his only NASCAR Cup Series appearance at this event. Months after this race, the Automobile Manufacturers Association decided to legally separate themselves from all forms of automobile racing that was being held in the United States; donating millions of dollars in machinery directly to the drivers. Background Martinsville Speedway is one of five short tracks to hold NASCAR races. The standard track at Martinsville Speedway is a four-turn short track oval that is long. The track's turns are banked at eleven degrees, while the front stretch, the location of the finish line, is banked at zero degrees. The back stretch also has a zero degree banking. Race report It took nearly four hours to race 441 laps worth of stock car automobile racing. While originally scheduled for 500 laps, it was stopped prematurely due to a bad in-race crash. Tom Pistone and Billy Myers would end up getting involved in the collision on lap 441; making Buck Baker the automatic winner. Just before the accident took form, Pistone straightened his car and continued. Myers headed for the wall and then jumped it near where a crowd of folks was standing. The 24-driver starting lineup was made up of drivers who were all born in the United States of America. T.A. Toomes would take up the last-place position due to problems with his gasket on lap 121. Paul Goldsmith, Tiny Lund and Buck Baker would dominate the laps prior to the accident. The victory of Buck Baker over second-place finisher Curtis Turner would demonstrate the power of the 1957 Chevrolet. Although its real-life counterpart had fuel injection, the NASCAR version had to use a carburetor. Fuel injection did not become legal in what is now known as the Monster Energy NASCAR Cup Series until the 2012 season. Individual race earnings for this event ranged from the winner's share of $3,170 ($ when adjusted for inflation) to the last-place finisher's share of $125 ($ when adjusted for inflation). A grand total of $12,240 was handed out by NASCAR officials for the explicit purpose of paying off the qualifying drivers ($ when adjusted for inflation). Jess Potter was the only notable crew chief to take part in the race, leading the pit road crew of Brownie King's Chevrolet. Qualifying Failed to qualify: Emanuel Zervakis (#11), Bill Champion (#35), Nace Mattingly (#154), Frank Jamison (#80) *Withdrew. Timeline Section reference: Start of race: Paul Goldsmith started the race with the pole position. Lap 55: Tiny Lund takes over the lead from Paul Goldsmith. Lap 121: Problems with the vehicle's head gasket made T.A. Toomes into the last-place finisher. Lap 128: Buck Baker takes over the lead from Tiny Lund. Lap 145: Billy Myers takes over the lead from Buck Baker. Lap 146: The rear end of Eddie Skinner's vehicle became problematic, forcing him to quit the race. Lap 211: Cotton Owens had a terminal crash; causing him to withdraw from the event. Lap 233: Buck Baker takes over the lead from Billy Myers. Lap 281: Tiny Lund's engine developed problems, forcing him to make an early exit from the race. Lap 329: Billy Myers takes over the lead from Buck Baker. Lap 377: Johnny Allen noticed that his vehicle's clutch had some issues, causing him to pull over and end his hopes of winning the race. Lap 441: Tom Pistone and Billy Myers crashed into each other, jointly ending their chances of winning the race. Finish: Buck Baker was declared the winner after starting the event in 14th place. Finishing order Section reference: References Virginia 500 Virginia 500 NASCAR races at Martinsville Speedway
```smalltalk using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Ocelot.Configuration; using Ocelot.Configuration.File; using Ocelot.Configuration.Validator; using Ocelot.Logging; using Ocelot.Requester; using Ocelot.Responses; using Ocelot.ServiceDiscovery; using Ocelot.ServiceDiscovery.Providers; using Ocelot.UnitTests.Requester; using Ocelot.Values; using System.Security.Claims; using System.Text.Encodings.Web; namespace Ocelot.UnitTests.Configuration.Validation { public class FileConfigurationFluentValidatorTests : UnitTest { private IConfigurationValidator _configurationValidator; private FileConfiguration _fileConfiguration; private Response<ConfigurationValidationResult> _result; private IServiceProvider _provider; private readonly ServiceCollection _services; private readonly Mock<IAuthenticationSchemeProvider> _authProvider; public FileConfigurationFluentValidatorTests() { _services = new ServiceCollection(); _authProvider = new Mock<IAuthenticationSchemeProvider>(); _provider = _services.BuildServiceProvider(); // TODO Replace with mocks _configurationValidator = new FileConfigurationFluentValidator(_provider, new RouteFluentValidator(_authProvider.Object, new HostAndPortValidator(), new FileQoSOptionsFluentValidator(_provider)), new FileGlobalConfigurationFluentValidator(new FileQoSOptionsFluentValidator(_provider))); } [Fact] public void your_sha256_hashd_has_service_fabric_as_option() { var route = GivenServiceDiscoveryRoute(); var configuration = GivenAConfiguration(route); configuration.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashd_has_service_discovery_handler() { var route = GivenServiceDiscoveryRoute(); var configuration = GivenAConfiguration(route); configuration.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); configuration.GlobalConfiguration.ServiceDiscoveryProvider.Type = "FakeServiceDiscoveryProvider"; this.Given(x => x.GivenAConfiguration(configuration)) .And(x => x.GivenAServiceDiscoveryHandler()) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashnamically_and_has_service_discovery_handler() { var configuration = new FileConfiguration(); configuration.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); configuration.GlobalConfiguration.ServiceDiscoveryProvider.Type = "FakeServiceDiscoveryProvider"; this.Given(x => x.GivenAConfiguration(configuration)) .And(x => x.GivenAServiceDiscoveryHandler()) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashbut_no_service_discovery_handler() { var route = GivenServiceDiscoveryRoute(); var configuration = GivenAConfiguration(route); configuration.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); configuration.GlobalConfiguration.ServiceDiscoveryProvider.Type = "FakeServiceDiscoveryProvider"; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorIs<FileValidationFailedError>()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Unable to start Ocelot, errors are: Unable to start Ocelot because either a Route or GlobalConfiguration are using ServiceDiscoveryOptions but no ServiceDiscoveryFinderDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Consul and services.AddConsul() or Ocelot.Provider.Eureka and services.AddEureka()?")) .BDDfy(); } [Fact] public void your_sha256_hashdynamically_but_service_discovery_handler() { var configuration = new FileConfiguration(); configuration.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); configuration.GlobalConfiguration.ServiceDiscoveryProvider.Type = "FakeServiceDiscoveryProvider"; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorIs<FileValidationFailedError>()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Unable to start Ocelot, errors are: Unable to start Ocelot because either a Route or GlobalConfiguration are using ServiceDiscoveryOptions but no ServiceDiscoveryFinderDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Consul and services.AddConsul() or Ocelot.Provider.Eureka and services.AddEureka()?")) .BDDfy(); } [Fact] public void your_sha256_hashbut_no_service_discovery_handler_with_matching_name() { var route = GivenServiceDiscoveryRoute(); var configuration = GivenAConfiguration(route); configuration.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); configuration.GlobalConfiguration.ServiceDiscoveryProvider.Type = "consul"; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .And(x => x.GivenAServiceDiscoveryHandler()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorIs<FileValidationFailedError>()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Unable to start Ocelot, errors are: Unable to start Ocelot because either a Route or GlobalConfiguration are using ServiceDiscoveryOptions but no ServiceDiscoveryFinderDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Consul and services.AddConsul() or Ocelot.Provider.Eureka and services.AddEureka()?")) .BDDfy(); } [Fact] public void your_sha256_hashler() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; route.QoSOptions = new FileQoSOptions { TimeoutValue = 1, ExceptionsAllowedBeforeBreaking = 1, }; this.Given(x => x.GivenAConfiguration(route)) .And(x => x.GivenAQoSHandler()) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hash_qos_handler() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var configuration = GivenAConfiguration(route); configuration.GlobalConfiguration.QoSOptions = new FileQoSOptions { TimeoutValue = 1, ExceptionsAllowedBeforeBreaking = 1, }; this.Given(x => x.GivenAConfiguration(configuration)) .And(x => x.GivenAQoSHandler()) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashdler() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; route.QoSOptions = new FileQoSOptions { TimeoutValue = 1, ExceptionsAllowedBeforeBreaking = 1, }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorIs<FileValidationFailedError>()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Unable to start Ocelot because either a Route or GlobalConfiguration are using QoSOptions but no QosDelegatingHandlerDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Polly and services.AddPolly()?")) .BDDfy(); } [Fact] public void your_sha256_hasho_qos_handler() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var configuration = GivenAConfiguration(route); configuration.GlobalConfiguration.QoSOptions = new FileQoSOptions { TimeoutValue = 1, ExceptionsAllowedBeforeBreaking = 1, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorIs<FileValidationFailedError>()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Unable to start Ocelot because either a Route or GlobalConfiguration are using QoSOptions but no QosDelegatingHandlerDelegate has been registered in dependency injection container. Are you missing a package like Ocelot.Provider.Polly and services.AddPolly()?")) .BDDfy(); } [Fact] public void Configuration_is_valid_if_aggregates_are_valid() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var route2 = GivenDefaultRoute("/tom", "/"); route2.Key = "Tom"; var configuration = GivenAConfiguration(route, route2); configuration.Aggregates = new() { new() { UpstreamPathTemplate = "/", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void Configuration_is_invalid_if_aggregates_are_duplicate_of_routes() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var route2 = GivenDefaultRoute("/tom", "/"); route2.Key = "Tom"; route2.UpstreamHost = "localhost"; var configuration = GivenAConfiguration(route, route2); configuration.Aggregates = new() { new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "route /tom has duplicate aggregate")) .BDDfy(); } [Fact] public void your_sha256_hash() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var route2 = GivenDefaultRoute("/tom", "/"); route2.Key = "Tom"; route2.UpstreamHttpMethod = new() { "Post" }; var configuration = GivenAConfiguration(route, route2); configuration.Aggregates = new() { new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashes() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var route2 = GivenDefaultRoute("/lol", "/"); route2.Key = "Tom"; var configuration = GivenAConfiguration(route, route2); configuration.Aggregates = new() { new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "aggregate /tom has duplicate aggregate")) .BDDfy(); } [Fact] public void Configuration_is_invalid_if_routes_dont_exist_for_aggregate() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var configuration = GivenAConfiguration(route); configuration.Aggregates = new() { new() { UpstreamPathTemplate = "/", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Routes for aggregateRoute / either do not exist or do not have correct ServiceName property")) .BDDfy(); } [Fact] public void your_sha256_hashequest_id_keys() { var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var route2 = GivenDefaultRoute("/tom", "/"); route2.Key = "Tom"; route2.RequestIdKey = "should_fail"; var configuration = GivenAConfiguration(route, route2); configuration.Aggregates = new() { new() { UpstreamPathTemplate = "/", UpstreamHost = "localhost", RouteKeys = new() { "Tom", "Laura" }, }, }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "aggregateRoute / contains Route with specific RequestIdKey, this is not possible with Aggregates")) .BDDfy(); } [Fact] public void your_sha256_hashplate() { this.Given(x => x.GivenAConfiguration(GivenDefaultRoute("path_to_url", "path_to_url{productId}"))) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .Then(x => x.ThenTheErrorIs<FileValidationFailedError>()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Downstream Path Template path_to_url{productId} doesnt start with forward slash")) .And(x => x.ThenTheErrorMessageAtPositionIs(1, "Downstream Path Template path_to_url{productId} contains double forward slash, Ocelot does not support this at the moment. Please raise an issue in GitHib if you need this feature.")) .And(x => x.ThenTheErrorMessageAtPositionIs(2, "Downstream Path Template path_to_url{productId} contains scheme")) .And(x => x.ThenTheErrorMessageAtPositionIs(3, "Upstream Path Template path_to_url contains double forward slash, Ocelot does not support this at the moment. Please raise an issue in GitHib if you need this feature.")) .And(x => x.ThenTheErrorMessageAtPositionIs(4, "Upstream Path Template path_to_url doesnt start with forward slash")) .And(x => x.ThenTheErrorMessageAtPositionIs(5, "Upstream Path Template path_to_url contains scheme")) .BDDfy(); } [Fact] public void Configuration_is_valid_with_one_route() { this.Given(x => x.GivenAConfiguration(GivenDefaultRoute())) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashmplate() { this.Given(x => x.GivenAConfiguration(GivenDefaultRoute("/asdf/", "api/products/"))) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Downstream Path Template api/products/ doesnt start with forward slash")) .BDDfy(); } [Fact] public void your_sha256_hashlate() { this.Given(x => x.GivenAConfiguration(GivenDefaultRoute("api/prod/", "/api/products/"))) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Upstream Path Template api/prod/ doesnt start with forward slash")) .BDDfy(); } [Fact] public void your_sha256_hashthen_another_forward_slash() { this.Given(x => x.GivenAConfiguration(GivenDefaultRoute("//api/prod/", "/api/products/"))) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Upstream Path Template //api/prod/ contains double forward slash, Ocelot does not support this at the moment. Please raise an issue in GitHib if you need this feature.")) .BDDfy(); } [Fact] public void your_sha256_hashh_then_another_forward_slash() { this.Given(x => x.GivenAConfiguration(GivenDefaultRoute("/api/prod/", "//api/products/"))) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Downstream Path Template //api/products/ contains double forward slash, Ocelot does not support this at the moment. Please raise an issue in GitHib if you need this feature.")) .BDDfy(); } [Fact] public void Configuration_is_valid_with_valid_authentication_provider() { var route = GivenDefaultRoute(); route.AuthenticationOptions.AuthenticationProviderKey = "Test"; this.Given(x => x.GivenAConfiguration(route)) .And(x => x.GivenTheAuthSchemeExists("Test")) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void Configuration_is_invalid_with_invalid_authentication_provider() { var route = GivenDefaultRoute(); route.AuthenticationOptions = new FileAuthenticationOptions() { AuthenticationProviderKey = "Test", AuthenticationProviderKeys = new string[] { "Test #1", "Test #2" }, }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "Authentication Options AuthenticationProviderKey:'Test',AuthenticationProviderKeys:['Test #1','Test #2'],AllowedScopes:[] is unsupported authentication provider")) .BDDfy(); } [Fact] public void Configuration_is_not_valid_with_duplicate_routes_all_verbs() { var route = GivenDefaultRoute(); var duplicate = GivenDefaultRoute(); duplicate.DownstreamPathTemplate = "/www/test/"; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "route /asdf/ has duplicate")) .BDDfy(); } [Fact] public void your_sha256_hashrent_hosts() { var route = GivenDefaultRoute(); route.UpstreamHost = "host1"; var duplicate = GivenDefaultRoute(null, "/www/test/"); duplicate.UpstreamHost = "host2"; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void Configuration_is_not_valid_with_duplicate_routes_specific_verbs() { var route = GivenDefaultRoute(); var duplicate = GivenDefaultRoute(null, "/www/test/"); duplicate.UpstreamHttpMethod = new() { "Get" }; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "route /asdf/ has duplicate")) .BDDfy(); } [Fact] public void Configuration_is_valid_with_duplicate_routes_different_verbs() { var route = GivenDefaultRoute(); // "Get" verb is inside var duplicate = GivenDefaultRoute(null, "/www/test/"); duplicate.UpstreamHttpMethod = new() { "Post" }; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hash_upstreamhosts() { var route = GivenDefaultRoute(); route.UpstreamHttpMethod = new(); route.UpstreamHost = "upstreamhost"; var duplicate = GivenDefaultRoute(null, "/www/test/"); duplicate.UpstreamHttpMethod = new(); duplicate.UpstreamHost = "upstreamhost"; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "route /asdf/ has duplicate")) .BDDfy(); } [Fact] public void your_sha256_hasheamhosts() { var route = GivenDefaultRoute(); route.UpstreamHttpMethod = new(); route.UpstreamHost = "upstreamhost111"; var duplicate = GivenDefaultRoute(null, "/www/test/"); duplicate.UpstreamHttpMethod = new(); duplicate.UpstreamHost = "upstreamhost222"; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hasht_is_not_set() { var route = GivenDefaultRoute(); route.UpstreamHttpMethod = new(); route.UpstreamHost = "upstreamhost"; var duplicate = GivenDefaultRoute(null, "/www/test/"); duplicate.UpstreamHttpMethod = new(); this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void Configuration_is_invalid_with_invalid_rate_limit_configuration() { var route = GivenDefaultRoute(); route.RateLimitOptions = new FileRateLimitRule { Period = "1x", EnableRateLimiting = true, }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "RateLimitOptions.Period does not contain integer then s (second), m (minute), h (hour), d (day) e.g. 1m for 1 minute period")) .BDDfy(); } [Fact] public void Configuration_is_valid_with_valid_rate_limit_configuration() { var route = GivenDefaultRoute(); route.RateLimitOptions = new FileRateLimitRule { Period = "1d", EnableRateLimiting = true, }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void your_sha256_hashname() { var route = GivenServiceDiscoveryRoute(); var config = GivenAConfiguration(route); config.GlobalConfiguration.ServiceDiscoveryProvider = GivenDefaultServiceDiscoveryProvider(); this.Given(x => x.GivenAConfiguration(config)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } private const string Empty = ""; [Theory] [InlineData(null)] [InlineData(Empty)] public void your_sha256_hashst(string downstreamHost) { var route = GivenDefaultRoute(); route.DownstreamHostAndPorts[0].Host = downstreamHost; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "When not using service discovery Host must be set on DownstreamHostAndPorts if you are not using Route.Host or Ocelot cannot find your service!")) .BDDfy(); } [Theory] [InlineData(null, true)] [InlineData(Empty, true)] [InlineData("Test", false)] public void your_sha256_hashd(string serviceName, bool valid) { // Arrange var route = GivenDefaultRoute(); route.ServiceName = serviceName; var config = GivenAConfiguration(route); config.GlobalConfiguration.ServiceDiscoveryProvider = null; // Act WhenIValidateTheConfiguration(); // Assert _result.Data.IsError.ShouldNotBe(valid); _result.Data.Errors.Count.ShouldBe(valid ? 0 : 1); } [Theory] [InlineData(false, null, false)] [InlineData(true, null, false)] [InlineData(true, "type", false)] [InlineData(true, "servicefabric", true)] public void your_sha256_hashValidated(bool create, string type, bool valid) { // Arrange var route = GivenServiceDiscoveryRoute(); var config = GivenAConfiguration(route); var provider = create ? GivenDefaultServiceDiscoveryProvider() : null; config.GlobalConfiguration.ServiceDiscoveryProvider = provider; if (create && provider != null) { provider.Type = type; } // Act WhenIValidateTheConfiguration(); // Assert _result.Data.IsError.ShouldNotBe(valid); _result.Data.Errors.Count.ShouldBeGreaterThanOrEqualTo(valid ? 0 : 1); } [Theory] [InlineData(false)] [InlineData(true)] public void your_sha256_hashegates_Validated(bool hasDelegate) { // Arrange var valid = hasDelegate; var route = GivenServiceDiscoveryRoute(); var config = GivenAConfiguration(route); config.GlobalConfiguration.ServiceDiscoveryProvider = null; if (hasDelegate) { GivenAServiceDiscoveryHandler(); } // Act WhenIValidateTheConfiguration(); // Assert _result.Data.IsError.ShouldNotBe(valid); _result.Data.Errors.Count.ShouldBe(valid ? 0 : 1); } [Fact] public void your_sha256_hash_is_set() { var route = GivenDefaultRoute(); route.DownstreamHostAndPorts = new() { new("bbc.co.uk", 123), }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void Configuration_is_valid_when_no_downstream_but_has_host_and_port() { var route = GivenDefaultRoute(); route.DownstreamHostAndPorts = new() { new("test", 123), }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) .BDDfy(); } [Fact] public void Configuration_is_not_valid_when_no_host_and_port() { var route = GivenDefaultRoute(); route.DownstreamHostAndPorts = new(); this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "When not using service discovery DownstreamHostAndPorts must be set and not empty or Ocelot cannot find your service!")) .BDDfy(); } [Fact] public void Configuration_is_not_valid_when_host_and_port_is_empty() { var route = GivenDefaultRoute(); route.DownstreamHostAndPorts = new() { new(), }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) .And(x => x.ThenTheErrorMessageAtPositionIs(0, "When not using service discovery Host must be set on DownstreamHostAndPorts if you are not using Route.Host or Ocelot cannot find your service!")) .BDDfy(); } [Fact] [Trait("PR", "1312")] [Trait("Feat", "360")] public void Configuration_is_not_valid_when_upstream_headers_the_same() { // Arrange var route1 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/api/products/", new() { { "header1", "value1" }, { "header2", "value2" }, }); var route2 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/www/test/", new() { { "header2", "value2" }, { "header1", "value1" }, }); GivenAConfiguration(route1, route2); // Act WhenIValidateTheConfiguration(); // Assert ThenTheResultIsNotValid(); ThenTheErrorMessageAtPositionIs(0, "route /asdf/ has duplicate"); } [Fact] [Trait("PR", "1312")] [Trait("Feat", "360")] public void Configuration_is_valid_when_upstream_headers_not_the_same() { // Arrange var route1 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/api/products/", new() { { "header1", "value1" }, { "header2", "value2" }, }); var route2 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/www/test/", new() { { "header2", "value2" }, { "header1", "valueDIFFERENT" }, }); GivenAConfiguration(route1, route2); // Act WhenIValidateTheConfiguration(); // Assert ThenTheResultIsValid(); } [Fact] [Trait("PR", "1312")] [Trait("Feat", "360")] public void Configuration_is_valid_when_upstream_headers_count_not_the_same() { // Arrange var route1 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/api/products/", new() { { "header1", "value1" }, { "header2", "value2" }, }); var route2 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/www/test/", new() { { "header2", "value2" }, }); GivenAConfiguration(route1, route2); // Act WhenIValidateTheConfiguration(); // Assert ThenTheResultIsValid(); } [Fact] [Trait("PR", "1312")] [Trait("Feat", "360")] public void your_sha256_hash_not_empty() { // Arrange var route1 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/api/products/", new() { { "header1", "value1" }, { "header2", "value2" }, }); var route2 = GivenRouteWithUpstreamHeaderTemplates("/asdf/", "/www/test/", new()); GivenAConfiguration(route1, route2); // Act WhenIValidateTheConfiguration(); // Assert ThenTheResultIsValid(); } [Theory] [Trait("PR", "1927")] [InlineData("/foo/{bar}/foo", "/yahoo/foo/{bar}")] // valid [InlineData("/foo/{bar}/{foo}", "/yahoo/{foo}/{bar}")] // valid [InlineData("/foo/{bar}/{bar}", "/yahoo/foo/{bar}", "UpstreamPathTemplate '/foo/{bar}/{bar}' has duplicated placeholder")] // invalid [InlineData("/foo/{bar}/{bar}", "/yahoo/{foo}/{bar}", "UpstreamPathTemplate '/foo/{bar}/{bar}' has duplicated placeholder")] // invalid [InlineData("/yahoo/foo/{bar}", "/foo/{bar}/foo")] // valid [InlineData("/yahoo/{foo}/{bar}", "/foo/{bar}/{foo}")] // valid [InlineData("/yahoo/foo/{bar}", "/foo/{bar}/{bar}", "DownstreamPathTemplate '/foo/{bar}/{bar}' has duplicated placeholder")] // invalid [InlineData("/yahoo/{foo}/{bar}", "/foo/{bar}/{bar}", "DownstreamPathTemplate '/foo/{bar}/{bar}' has duplicated placeholder")] // invalid public void your_sha256_hasholdersAreValidated(string upstream, string downstream, params string[] expected) { // Arrange var route = GivenDefaultRoute(upstream, downstream); GivenAConfiguration(route); // Act WhenIValidateTheConfiguration(); // Assert ThenThereAreErrors(expected.Length > 0); ThenTheErrorMessagesAre(expected); } [Theory] [Trait("PR", "1927")] [Trait("Bug", "683")] [InlineData("/foo/bar/{everything}/{everything}", "/bar/{everything}", "foo", "UpstreamPathTemplate '/foo/bar/{everything}/{everything}' has duplicated placeholder")] [InlineData("/foo/bar/{everything}/{everything}", "/bar/{everything}/{everything}", "foo", "UpstreamPathTemplate '/foo/bar/{everything}/{everything}' has duplicated placeholder", "DownstreamPathTemplate '/bar/{everything}/{everything}' has duplicated placeholder")] public void your_sha256_hasheam_path_template(string upstream, string downstream, string host, params string[] expected) { // Arrange var route = GivenDefaultRoute(upstream, downstream, host); GivenAConfiguration(route); // Act WhenIValidateTheConfiguration(); // Assert ThenTheResultIsNotValid(); ThenTheErrorMessagesAre(expected); } [Theory] [Trait("PR", "1927")] [Trait("Bug", "683")] [InlineData("/foo/bar/{everything}", "/bar/{everything}/{everything}", "foo", "DownstreamPathTemplate '/bar/{everything}/{everything}' has duplicated placeholder")] [InlineData("/foo/bar/{everything}/{everything}", "/bar/{everything}/{everything}", "foo", "UpstreamPathTemplate '/foo/bar/{everything}/{everything}' has duplicated placeholder", "DownstreamPathTemplate '/bar/{everything}/{everything}' has duplicated placeholder")] public void your_sha256_hashtream_path_template(string upstream, string downstream, string host, params string[] expected) { // Arrange var route = GivenDefaultRoute(upstream, downstream, host); GivenAConfiguration(route); // Act WhenIValidateTheConfiguration(); // Assert ThenTheResultIsNotValid(); ThenTheErrorMessagesAre(expected); } private static FileRoute GivenDefaultRoute() => GivenDefaultRoute(null, null, null); private static FileRoute GivenDefaultRoute(string upstream, string downstream) => GivenDefaultRoute(upstream, downstream, null); private static FileRoute GivenDefaultRoute(string upstream, string downstream, string host) => new() { UpstreamHttpMethod = new() { HttpMethods.Get }, UpstreamPathTemplate = upstream ?? "/asdf/", DownstreamPathTemplate = downstream ?? "/api/products/", DownstreamHostAndPorts = new() { new(host ?? "bbc.co.uk", 12345), }, DownstreamScheme = Uri.UriSchemeHttp, }; private static FileRoute GivenServiceDiscoveryRoute() => new() { UpstreamHttpMethod = new() { HttpMethods.Get }, UpstreamPathTemplate = "/laura", DownstreamPathTemplate = "/", DownstreamScheme = Uri.UriSchemeHttp, ServiceName = "test", }; private static FileRoute GivenRouteWithUpstreamHeaderTemplates(string upstream, string downstream, Dictionary<string, string> templates) => new() { UpstreamPathTemplate = upstream, DownstreamPathTemplate = downstream, DownstreamHostAndPorts = new() { new("bbc.co.uk", 123), }, UpstreamHttpMethod = new() { HttpMethods.Get }, UpstreamHeaderTemplates = templates, }; private void GivenAConfiguration(FileConfiguration fileConfiguration) => _fileConfiguration = fileConfiguration; private FileConfiguration GivenAConfiguration(params FileRoute[] routes) { var config = new FileConfiguration(); config.Routes.AddRange(routes); _fileConfiguration = config; return config; } private static FileServiceDiscoveryProvider GivenDefaultServiceDiscoveryProvider() => new() { Scheme = Uri.UriSchemeHttps, Host = "localhost", Type = "ServiceFabric", Port = 8500, }; private void WhenIValidateTheConfiguration() { _result = _configurationValidator.IsValid(_fileConfiguration).Result; } private void ThenTheResultIsValid() { _result.Data.IsError.ShouldBeFalse(); } private void ThenTheResultIsNotValid() { _result.Data.IsError.ShouldBeTrue(); } private void ThenTheErrorIs<T>() { _result.Data.Errors[0].ShouldBeOfType<T>(); } private void ThenTheErrorMessageAtPositionIs(int index, string expected) { _result.Data.Errors[index].Message.ShouldBe(expected); } private void ThenThereAreErrors(bool isError) { _result.Data.IsError.ShouldBe(isError); } private void ThenTheErrorMessagesAre(IEnumerable<string> messages) { _result.Data.Errors.Count.ShouldBe(messages.Count()); foreach (var msg in messages) { _result.Data.Errors.ShouldContain(e => e.Message == msg); } } private void GivenTheAuthSchemeExists(string name) { _authProvider.Setup(x => x.GetAllSchemesAsync()).ReturnsAsync(new List<AuthenticationScheme> { new(name, name, typeof(TestHandler)), }); } private void GivenAQoSHandler() { DelegatingHandler Del(DownstreamRoute a, IHttpContextAccessor b, IOcelotLoggerFactory c) => new FakeDelegatingHandler(); _services.AddSingleton((QosDelegatingHandlerDelegate)Del); _provider = _services.BuildServiceProvider(); _configurationValidator = new FileConfigurationFluentValidator(_provider, new RouteFluentValidator(_authProvider.Object, new HostAndPortValidator(), new FileQoSOptionsFluentValidator(_provider)), new FileGlobalConfigurationFluentValidator(new FileQoSOptionsFluentValidator(_provider))); } private void GivenAServiceDiscoveryHandler() { ServiceDiscoveryFinderDelegate del = (a, b, c) => new FakeServiceDiscoveryProvider(); _services.AddSingleton(del); _provider = _services.BuildServiceProvider(); _configurationValidator = new FileConfigurationFluentValidator(_provider, new RouteFluentValidator(_authProvider.Object, new HostAndPortValidator(), new FileQoSOptionsFluentValidator(_provider)), new FileGlobalConfigurationFluentValidator(new FileQoSOptionsFluentValidator(_provider))); } private class FakeServiceDiscoveryProvider : IServiceDiscoveryProvider { public Task<List<Service>> GetAsync() => Task.FromResult<List<Service>>(new()); } private class TestOptions : AuthenticationSchemeOptions { } private class TestHandler : AuthenticationHandler<TestOptions> { // path_to_url // .NET 8.0: TimeProvider is now a settable property on the Options classes for the authentication and identity components. // It can be set directly or by registering a provider in the dependency injection container. #if NET8_0_OR_GREATER public TestHandler(IOptionsMonitor<TestOptions> options, ILoggerFactory logger, UrlEncoder encoder) : base(options, logger, encoder) { } #else public TestHandler(IOptionsMonitor<TestOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock) { } #endif protected override Task<AuthenticateResult> HandleAuthenticateAsync() { var principal = new ClaimsPrincipal(); return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, new AuthenticationProperties(), Scheme.Name))); } } } } ```
Netcong High School was a high school in Netcong in Morris County, New Jersey, United States. In 1969 the school had 390 students. It was a part of the Netcong School District. History Netcong High first opened in the 1900s. In 1969, students protested after New Jersey courts ended a prayer program. The school administration stated the prayer was student-organized and voluntary. New Jersey courts argued that it violated Engel v. Vitale (1962). Judge Joseph Stamler of New Jersey Superior Court issued a decision in February 1970 in the case State Board of Education v. Board of Education of Netcong, New Jersey regarding a policy under which the district's school board provided for voluntary readings at the start of the school day at the high school of prayers that had been published in the Congressional Record, as delivered by Chaplain of the United States House of Representatives. Attendance at these readings was voluntary, and the board said that they were intended as inspirational remarks, rather than prayer in the schools. In his decision, Judge Stamler prohibited what he described as a "subterfuge [that] is degrading to all religions", arguing that by taking what were "beautiful prayers" and referring to them merely as "remarks", the school district was working to "peddle religion in a very cheap manner under an assumed name." The New Jersey Supreme Court unanimously affirmed Stamler's decision and the United States Supreme Court refused to hear an appeal from the district's school board. The school closed in 1974 and the building became Netcong Elementary School. Lenape Valley Regional High School in Stanhope now serves as the public high school for Netcong residents. Notable alumni John Giannantonio (born c. 1934) set several national high school football records, many which still stand as of 2016. As a , sophomore in 1950, Giannantonio rushed for 4,756 yards and 41 touchdowns over the team's eight-game season. During a game in November that season against Mountain Lakes High School he rushed for 754 yards and nine touchdowns in a 61–0 win. His 594.5 rushing yards per game average, season rushing yards total, and single-game rushing yards against Mountain Lakes remain national high school records as of 2016. References Public high schools in Morris County, New Jersey 1974 disestablishments in New Jersey Defunct high schools in New Jersey Educational institutions disestablished in 1974 Netcong, New Jersey
Donald Boyd Wilson (11 September 1910 – 6 March 2002) was a Scottish television writer and producer who worked for the BBC. His work included co-creating the science fiction series Doctor Who in 1963, also later claiming to have named the series, and adapting and producing The Forsyte Saga in 1967. Early life and career Wilson attended the Glasgow School of Art, following which his first jobs were as a newspaper cartoonist and sketch writer. His initial career was in the film industry, including working for MGM at Elstree Studios, where he was Assistant Director of such films as Jericho (1937) and Goodbye, Mr. Chips (1939). During the Second World War he served with the Cameronians and the 43rd Wessex Division before afterwards returning to the film industry, including helming his only film as director, Warning to Wantons. In 1955 he was recruited to BBC Television by the then Head of Drama, Michael Barry. As the Head of the Script Department, Wilson was ultimately responsible for overseeing the commissioning and development of all the original scripts and adaptations transmitted by BBC Television. Doctor Who When the Script Department was rendered redundant by Sydney Newman’s radical shake-up of the BBC Drama Department after his arrival as its head in 1962, the highly respected Wilson was given one of the most senior positions under Newman as Head of Serials. In this position, Wilson was responsible for overseeing the creation and development of a series that Newman himself had originally conceived: an educational science-fiction serial entitled Doctor Who. It was Wilson, together with Newman and staff writer C. E. Webber, who co-wrote the first format document for the programme. In a 1971 interview Wilson claimed to have named the series, and when this claim was put to Newman he did not dispute it. Wilson was responsible for much of the early development work on the show, although he did strongly attempt to dissuade producer Verity Lambert from using writer Terry Nation’s script featuring a race of aliens named Daleks. However, once the script had been made and transmitted to great success, he called Lambert into his office to admit that she clearly knew the show better than he did and told her that he would no longer interfere with her decisions. Later career In 1965, Wilson gave up his position as Head of Serials to concentrate on realising a long-held ambition of bringing The Forsyte Saga to the screen. Acting as both adapter and producer, Wilson created one of the BBC’s most popular and successful drama serials of all time, which was a huge hit on its eventual screening on BBC Two in 1967, and was quickly repeated on BBC One. Later, he acted as adapter and producer again on such prestigious costume dramas as The First Churchills (1969) and Anna Karenina (1977), and also worked for Anglia Television on their series Orson Welles Great Mysteries in 1973. Death After his work on Anna Karenina he retired to Gloucestershire, where he died at the age of 91 in March 2002. References External links 1910 births 2002 deaths 20th-century British screenwriters 20th-century Scottish writers 21st-century Scottish people Alumni of the Glasgow School of Art BBC television producers British Army personnel of World War II People from Dunblane Scottish television producers Scottish television writers
```go package chainkd import ( "encoding/hex" "errors" ) const ( extendedPublicKeySize = 64 extendedPrivateKeySize = 64 ) var ( ErrBadKeyLen = errors.New("bad key length") ErrBadKeyStr = errors.New("bad key string") ) func (xpub XPub) MarshalText() ([]byte, error) { hexBytes := make([]byte, hex.EncodedLen(len(xpub.Bytes()))) hex.Encode(hexBytes, xpub.Bytes()) return hexBytes, nil } func (xpub XPub) Bytes() []byte { return xpub[:] } func (xprv XPrv) MarshalText() ([]byte, error) { hexBytes := make([]byte, hex.EncodedLen(len(xprv.Bytes()))) hex.Encode(hexBytes, xprv.Bytes()) return hexBytes, nil } func (xprv XPrv) Bytes() []byte { return xprv[:] } func (xpub *XPub) UnmarshalText(inp []byte) error { if len(inp) != 2*extendedPublicKeySize { return ErrBadKeyStr } _, err := hex.Decode(xpub[:], inp) return err } func (xpub XPub) String() string { return hex.EncodeToString(xpub.Bytes()) } func (xprv *XPrv) UnmarshalText(inp []byte) error { if len(inp) != 2*extendedPrivateKeySize { return ErrBadKeyStr } _, err := hex.Decode(xprv[:], inp) return err } func (xprv XPrv) String() string { return hex.EncodeToString(xprv.Bytes()) } ```
C11 (formerly C1X) is an informal name for ISO/IEC 9899:2011, a past standard for the C programming language. It replaced C99 (standard ISO/IEC 9899:1999) and has been superseded by C17 (standard ISO/IEC 9899:2018). C11 mainly standardizes features already supported by common contemporary compilers, and includes a detailed memory model to better support multiple threads of execution. Due to delayed availability of conforming C99 implementations, C11 makes certain features optional, to make it easier to comply with the core language standard. The final draft, N1570, was published in April 2011. The new standard passed its final draft review on October 10, 2011 and was officially ratified by ISO and published as ISO/IEC 9899:2011 on December 8, 2011, with no comments requiring resolution by participating national bodies. A standard macro __STDC_VERSION__ is defined with value 201112L to indicate that C11 support is available. Changes from C99 The standard includes several changes to the C99 language and library specifications, such as Alignment specification (_Alignas specifier, _Alignof operator, aligned_alloc function, <stdalign.h> header) The _Noreturn function specifier and the <stdnoreturn.h> header Type-generic expressions using the _Generic keyword. For example, the following macro cbrt(x) translates to cbrtl(x), cbrt(x) or cbrtf(x) depending on the type of x: #define cbrt(x) _Generic((x), long double: cbrtl, \ default: cbrt, \ float: cbrtf)(x) Multi-threading support (_Thread_local storage-class specifier, <threads.h> header including thread creation/management functions, mutex, condition variable and thread-specific storage functionality, as well as <stdatomic.h> for atomic operations supporting the C11 memory model). Improved Unicode support based on the C Unicode Technical Report ISO/IEC TR 19769:2004 (char16_t and char32_t types for storing UTF-16/UTF-32 encoded data, including conversion functions in <uchar.h> and the corresponding u and U string literal prefixes, as well as the u8 prefix for UTF-8 encoded literals). Removal of the gets function (in favor of safer fgets), which was deprecated in the previous C language standard revision, ISO/IEC 9899:1999/Cor.3:2007(E). Bounds-checking interfaces (Annex K). Analyzability features (Annex L). More macros for querying the characteristics of floating-point types, concerning subnormal floating-point numbers and the number of decimal digits the type is able to store. Anonymous structures and unions, useful when unions and structures are nested, e.g. in . Static assertions, which are evaluated during translation at a later phase than #if and #error, when types are understood by the translator. An exclusive create-and-open mode ("…x" suffix) for fopen. This behaves like O_CREAT|O_EXCL in POSIX, which is commonly used for lock files. The quick_exit function as a third way to terminate a program, intended to do at least minimal deinitialization. A new timespec_get function and corresponding structure in <time.h> with a degree of POSIX compatibility. Macros for the construction of complex values (partly because real + imaginary*I might not yield the expected value if imaginary is infinite or NaN). Optional features The new revision allows implementations to not support certain parts of the standard — including some that had been mandatory to support in the 1999 revision. Programs can use predefined macros to determine whether an implementation supports a certain feature or not. Compiler support Some features of C11 are supported by the GCC starting with version 4.6, Clang starting with version 3.1, IBM XL C starting with version 12.1, and Microsoft Visual C++ starting with VS 2019 (16.8) in September 2020. Criticism The optional bounds-checking interfaces (Annex K) remain controversial and have not been widely implemented, and their deprecation or removal from the next standard revision has been proposed. Even Microsoft, a main proponent of this interface, does not conform to the definition. In addition, Annex K does not include the more useful TR24731-2 (dynamic allocation functions), such as and . The few open-source implementations include Open Watcom C/C++'s "Safer C" library and safeclib. See also C++23, C++20, C++17, C++14, C++11, C++03, C++98, versions of the C++ programming language standard Compatibility of C and C++ References Further reading Safe C API—Concise solution of buffer overflow, The OWASP Foundation, OWASP AppSec, Beijing 2011 External links C Language Working Group WG14 Documents N1570 - final draft of C11 standard - dated April 12, 2011 The C1X Charter The standard draft in simple ASCII and linked HTML forms, in addition to the PDF. Safe C Library of Bounded APIs C (programming language) Programming language standards IEC standards ISO standards
Banbridge A.F.C. was an intermediate-level football club playing in the Mid-Ulster Football League in Northern Ireland. The club was based in Banbridge. In 2014, the club merged with Banbridge Town. References Defunct association football clubs in Northern Ireland Association football clubs in County Down Association football clubs established in 1997 Association football clubs disestablished in 2014 1997 establishments in Northern Ireland 2014 disestablishments in Northern Ireland AFC
The Queensbury Mill is a historic mill building at 1 Market Street in Somersworth, New Hampshire. Built in 1884, it is unusual for the period for its wood-frame construction, and for its financing, executed by local businessmen to attract shoe manufacturers to the city. The mill was listed on the National Register of Historic Places in 1987. The building has been converted into apartments. Description and history The Queensbury Mill is located on the west side of downtown Somersworth, extending along the south side of Winter Street between its junctions with Market and Linden Streets. It is a wood-frame structure, in length, with a gabled roof, and a full-height brick basement level, providing a full four stories of space. A brick chimney rises near the center of its length, near a projecting stair house which rises above the main roof line. The mill was built in 1884 and enlarged in 1892, and was owned by a consortium of local business leaders. They sought to diversify the city's economy by attracting shoe manufacturers, who were dealing with a period of labor unrest in the major shoe-producing centers of Massachusetts. Built by local craftsmen, the mill is unusual for its wood-frame construction, which was not the norm for mill buildings of the 1880s, and it lacks other features typically added to these buildings to limit the spread of fire. The building housed a shoe manufacturing operation until 1902, when it was taken over by the Queensbury Mills of Worcester, Massachusetts and converted to yarn production. The initiative to attract shoe manufacturing was broadly successful, however: the Somersworth Shoe Company operated in buildings formerly of the Great Falls Manufacturing Company until 1984. See also Woodbury Mill: another historic shoe factory in New Hampshire. National Register of Historic Places listings in Strafford County, New Hampshire References Industrial buildings and structures on the National Register of Historic Places in New Hampshire Buildings and structures completed in 1884 Buildings and structures in Strafford County, New Hampshire Somersworth, New Hampshire National Register of Historic Places in Strafford County, New Hampshire
```objective-c // // APAddress.m // APAddressBook // // Created by Alexey Belkevich on 4/19/14. // #import "APAddress.h" @implementation APAddress @end ```
```yaml # Consul URL for accessing APIs consulUrl: ${consul.consulUrl:path_to_url} # access token to the consul server consulToken: ${consul.consulToken:the_one_ring} # number of requests before reset the shared connection. maxReqPerConn: ${consul.maxReqPerConn:1000000} # deregister the service after the amount of time after health check failed. deregisterAfter: ${consul.deregisterAfter:2m} # health check interval for TCP or HTTP check. Or it will be the TTL for TTL check. Every 10 seconds, # TCP or HTTP check request will be sent. Or if there is no heart beat request from service after 10 seconds, # then mark the service is critical. checkInterval: ${consul.checkInterval:10s} # One of the following health check approach will be selected. Two passive (TCP and HTTP) and one active (TTL) # enable health check TCP. Ping the IP/port to ensure that the service is up. This should be used for most of # the services with simple dependencies. If the port is open on the address, it indicates that the service is up. tcpCheck: ${consul.tcpCheck:false} # enable health check HTTP. A http get request will be sent to the service to ensure that 200 response status is # coming back. This is suitable for service that depending on database or other infrastructure services. You should # implement a customized health check handler that checks dependencies. i.e. if db is down, return status 400. httpCheck: ${consul.httpCheck:false} # enable health check TTL. When this is enabled, Consul won't actively check your service to ensure it is healthy, # but your service will call check endpoint with heart beat to indicate it is alive. This requires that the service # is built on top of light-4j and the above options are not available. For example, your service is behind NAT. ttlCheck: ${consul.ttlCheck:true} # endpoints that support blocking will also honor a wait parameter specifying a maximum duration for the blocking request. # This is limited to 10 minutes.This value can be specified in the form of "10s" or "5m" (i.e., 10 seconds or 5 minutes, # respectively). wait: ${consul.wait:600s} # Additional buffer of time to allow Consul to terminate the blocking query connection timeoutBuffer: ${consul.timeoutBuffer:5s} # enable HTTP/2 # must disable when using HTTP with Consul (mostly using local Consul agent), Consul only supports HTTP/1.1 when not using TLS # optional to enable when using HTTPS with Consul, it will have better performance enableHttp2: ${consul.enableHttp2:false} # Consul connection establishment timeout in seconds connectionTimeout: ${consul.connectionTimeout:5} # Consul request completion timeout in seconds # This does NOT apply to Consul service discovery lookups (see the 'wait' and 'timeoutBuffer' properties for that) requestTimeout: ${consul.requestTimeout:5} # Time to wait in seconds between reconnect attempts when Consul connection fails reconnectInterval: ${consul.reconnectInterval:2} # A random number of seconds in between 0 and reconnectJitter added to reconnectInterval (to avoid too many reconnect # requests at one time) reconnectJitter: ${consul.reconnectJitter:2} # Time in seconds between blocking queries with Consul lookupInterval: ${consul.lookupInterval:30} # Max number of failed Consul connection or request attempts before self-termination # -1 means an infinite # of attempts are allowed maxAttemptsBeforeShutdown: ${consul.maxAttemptsBeforeShutdown:-1} # Shuts down host application if any Consul lookup thread stops reporting a heartbeat for # 2 * ( lookupInterval + wait (in seconds) + timeoutBuffer (in seconds) ) seconds shutdownIfThreadFrozen: ${consul.shutdownIfThreadFrozen:false} ```
Delbrück () is a town in the east of North Rhine-Westphalia, Germany, located in the district Paderborn. History The first document mentioning the town dates to 1219. In 1410, the town was destroyed by fire during a conflict between the bishop of Paderborn and the bishop of Cologne. Subdivisions Mayors Robert Oelsmeier (CSU): 1999–2009 Werner Peitz (independent) since 2009 Twin towns – sister cities Delbrück is twinned with: Budakeszi, Hungary Quérénaing, France Zossen, Germany Notable people Albert Florath (1888–1957), official advisor in Delbrück, worked in the Poor, Church and School Department as well as in the police department Martin Amedick (born 1982), footballer Dennis Eilhoff (born 1982), footballer Notes References External links Paderborn (district)
```toml # # file name: set3-initial-9.small16 # # machine-generated by: ucptrietest.c [code_point_trie.struct] name = "set3-initial-9.small16" index = [ 0,0x40,0x5c,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x11c,0x136,0x14e,0x16d,0,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x5c,0x6c,0x7c,0x8c, 0x80,0x90,0xa0,0xb0,0x80,0x90,0xa0,0xb0,0x80,0x90,0xa0,0xb0,0x80,0x90,0xa0,0xb0, 0x80,0x90,0xa0,0xb0,0x80,0x90,0xa0,0xb0,0x80,0x90,0xa0,0xb0,0x80,0x90,0xa0,0xb0, 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0xc7,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7, 0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7, 0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0xd7,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0xe7,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4, 0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4, 0xf4,0xf4,0xf4,0xf4,0xf4,0xf6,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x104,0x110,0x110,0x110,0x110,0x110,0x110,0x110, 0x110,0x110,0x110,0x110,0x110,0x110,0x110,0x110,0x110,0x110,0x110,0x110,0x44,0x50,0x50,0x50, 0x50,0x50,0x50,0x50,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70, 0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x70,0x78,3,3,3,3,3,3, 3,3,3,3,3,3,0x98,0x98,0x98,0x98,0x98,0x98,0x98,0x98,3,3, 3,3,3,0xb8,0xd5,0xd5,0xd5,0xd5,0xd5,0xd5,0xd5,0xd5,0xe8,3,3,3, 3,3,3,0xfc ] data_16 = [ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 9,9,9,9,9,9,9,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,9,9,9,9,9,9,9,9,9, 9,9,9,9,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,9,9,9,9,9,9,9,9,9,9,9,9, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,0xad ] indexLength = 372 dataLength = 290 highStart = 0xce00 shifted12HighStart = 0xd type = 1 valueWidth = 0 index3NullOffset = 0x3 dataNullOffset = 0x80 nullValue = 0x9 [code_point_trie.testdata] # Array of (limit, value) pairs checkRanges = [ 0,9,0x31,9,0xa4,1,0x3400,9,0x6789,2,0x9000,9,0xa000,4,0xabcd,9, 0xbcde,3,0xcccc,9,0x110000,6 ] ```
```yaml # Do not edit. Data is from res/country/metadata and path_to_url atmOperators: [Caixabank, La Caixa, Laboral Kutxa, Caja Rural de Navarra, Caja Rural, BBVA] chargingStationOperators: [Iberdrola, Zunder, Ionity, Endesa, Wenea, 'Tesla, Inc.', Ingeteam] officialLanguages: [es, eu] parcelLockerBrand: [Amazon Locker] ```
```scss .#{$prefix}tip { position: absolute; overflow: visible; /*pointer needs to be able to stick out*/ } .#{$prefix}tip-body { overflow: hidden; position: relative; } .#{$prefix}tip-anchor { position: absolute; overflow: hidden; border-style: solid; } ```
```objective-c // // Path_UNIX.h // // Library: Foundation // Package: Filesystem // Module: Path // // Definition of the PathImpl class fo rUnix. // // and Contributors. // // #ifndef Foundation_Path_UNIX_INCLUDED #define Foundation_Path_UNIX_INCLUDED #include <vector> #include "Poco/Foundation.h" namespace Poco { class PathImpl { public: static std::string currentImpl(); static std::string homeImpl(); static std::string configHomeImpl(); static std::string dataHomeImpl(); static std::string tempHomeImpl(); static std::string cacheHomeImpl(); static std::string tempImpl(); static std::string configImpl(); static std::string nullImpl(); static std::string expandImpl(const std::string & path); static void listRootsImpl(std::vector<std::string> & roots); }; } // namespace Poco #endif // Foundation_Path_UNIX_INCLUDED ```
```c++ //===-- SBAddress.cpp -----------------------------------------------------===// // // See path_to_url for license information. // //===your_sha256_hash------===// #include "lldb/API/SBAddress.h" #include "Utils.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBSection.h" #include "lldb/API/SBStream.h" #include "lldb/Core/Address.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Target/Target.h" #include "lldb/Utility/Instrumentation.h" #include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; SBAddress::SBAddress() : m_opaque_up(new Address()) { LLDB_INSTRUMENT_VA(this); } SBAddress::SBAddress(const Address &address) : m_opaque_up(std::make_unique<Address>(address)) {} SBAddress::SBAddress(const SBAddress &rhs) : m_opaque_up(new Address()) { LLDB_INSTRUMENT_VA(this, rhs); m_opaque_up = clone(rhs.m_opaque_up); } SBAddress::SBAddress(lldb::SBSection section, lldb::addr_t offset) : m_opaque_up(new Address(section.GetSP(), offset)) { LLDB_INSTRUMENT_VA(this, section, offset); } // Create an address by resolving a load address using the supplied target SBAddress::SBAddress(lldb::addr_t load_addr, lldb::SBTarget &target) : m_opaque_up(new Address()) { LLDB_INSTRUMENT_VA(this, load_addr, target); SetLoadAddress(load_addr, target); } SBAddress::~SBAddress() = default; const SBAddress &SBAddress::operator=(const SBAddress &rhs) { LLDB_INSTRUMENT_VA(this, rhs); if (this != &rhs) m_opaque_up = clone(rhs.m_opaque_up); return *this; } bool lldb::operator==(const SBAddress &lhs, const SBAddress &rhs) { if (lhs.IsValid() && rhs.IsValid()) return lhs.ref() == rhs.ref(); return false; } bool SBAddress::operator!=(const SBAddress &rhs) const { LLDB_INSTRUMENT_VA(this, rhs); return !(*this == rhs); } bool SBAddress::IsValid() const { LLDB_INSTRUMENT_VA(this); return this->operator bool(); } SBAddress::operator bool() const { LLDB_INSTRUMENT_VA(this); return m_opaque_up != nullptr && m_opaque_up->IsValid(); } void SBAddress::Clear() { LLDB_INSTRUMENT_VA(this); m_opaque_up = std::make_unique<Address>(); } void SBAddress::SetAddress(lldb::SBSection section, lldb::addr_t offset) { LLDB_INSTRUMENT_VA(this, section, offset); Address &addr = ref(); addr.SetSection(section.GetSP()); addr.SetOffset(offset); } void SBAddress::SetAddress(const Address &address) { ref() = address; } lldb::addr_t SBAddress::GetFileAddress() const { LLDB_INSTRUMENT_VA(this); if (m_opaque_up->IsValid()) return m_opaque_up->GetFileAddress(); else return LLDB_INVALID_ADDRESS; } lldb::addr_t SBAddress::GetLoadAddress(const SBTarget &target) const { LLDB_INSTRUMENT_VA(this, target); lldb::addr_t addr = LLDB_INVALID_ADDRESS; TargetSP target_sp(target.GetSP()); if (target_sp) { if (m_opaque_up->IsValid()) { std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex()); addr = m_opaque_up->GetLoadAddress(target_sp.get()); } } return addr; } void SBAddress::SetLoadAddress(lldb::addr_t load_addr, lldb::SBTarget &target) { LLDB_INSTRUMENT_VA(this, load_addr, target); // Create the address object if we don't already have one ref(); if (target.IsValid()) *this = target.ResolveLoadAddress(load_addr); else m_opaque_up->Clear(); // Check if we weren't were able to resolve a section offset address. If we // weren't it is ok, the load address might be a location on the stack or // heap, so we should just have an address with no section and a valid offset if (!m_opaque_up->IsValid()) m_opaque_up->SetOffset(load_addr); } bool SBAddress::OffsetAddress(addr_t offset) { LLDB_INSTRUMENT_VA(this, offset); if (m_opaque_up->IsValid()) { addr_t addr_offset = m_opaque_up->GetOffset(); if (addr_offset != LLDB_INVALID_ADDRESS) { m_opaque_up->SetOffset(addr_offset + offset); return true; } } return false; } lldb::SBSection SBAddress::GetSection() { LLDB_INSTRUMENT_VA(this); lldb::SBSection sb_section; if (m_opaque_up->IsValid()) sb_section.SetSP(m_opaque_up->GetSection()); return sb_section; } lldb::addr_t SBAddress::GetOffset() { LLDB_INSTRUMENT_VA(this); if (m_opaque_up->IsValid()) return m_opaque_up->GetOffset(); return 0; } Address *SBAddress::operator->() { return m_opaque_up.get(); } const Address *SBAddress::operator->() const { return m_opaque_up.get(); } Address &SBAddress::ref() { if (m_opaque_up == nullptr) m_opaque_up = std::make_unique<Address>(); return *m_opaque_up; } const Address &SBAddress::ref() const { // This object should already have checked with "IsValid()" prior to calling // this function. In case you didn't we will assert and die to let you know. assert(m_opaque_up.get()); return *m_opaque_up; } Address *SBAddress::get() { return m_opaque_up.get(); } bool SBAddress::GetDescription(SBStream &description) { LLDB_INSTRUMENT_VA(this, description); // Call "ref()" on the stream to make sure it creates a backing stream in // case there isn't one already... Stream &strm = description.ref(); if (m_opaque_up->IsValid()) { m_opaque_up->Dump(&strm, nullptr, Address::DumpStyleResolvedDescription, Address::DumpStyleModuleWithFileAddress, 4); } else strm.PutCString("No value"); return true; } SBModule SBAddress::GetModule() { LLDB_INSTRUMENT_VA(this); SBModule sb_module; if (m_opaque_up->IsValid()) sb_module.SetSP(m_opaque_up->GetModule()); return sb_module; } SBSymbolContext SBAddress::GetSymbolContext(uint32_t resolve_scope) { LLDB_INSTRUMENT_VA(this, resolve_scope); SBSymbolContext sb_sc; SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope); if (m_opaque_up->IsValid()) m_opaque_up->CalculateSymbolContext(&sb_sc.ref(), scope); return sb_sc; } SBCompileUnit SBAddress::GetCompileUnit() { LLDB_INSTRUMENT_VA(this); SBCompileUnit sb_comp_unit; if (m_opaque_up->IsValid()) sb_comp_unit.reset(m_opaque_up->CalculateSymbolContextCompileUnit()); return sb_comp_unit; } SBFunction SBAddress::GetFunction() { LLDB_INSTRUMENT_VA(this); SBFunction sb_function; if (m_opaque_up->IsValid()) sb_function.reset(m_opaque_up->CalculateSymbolContextFunction()); return sb_function; } SBBlock SBAddress::GetBlock() { LLDB_INSTRUMENT_VA(this); SBBlock sb_block; if (m_opaque_up->IsValid()) sb_block.SetPtr(m_opaque_up->CalculateSymbolContextBlock()); return sb_block; } SBSymbol SBAddress::GetSymbol() { LLDB_INSTRUMENT_VA(this); SBSymbol sb_symbol; if (m_opaque_up->IsValid()) sb_symbol.reset(m_opaque_up->CalculateSymbolContextSymbol()); return sb_symbol; } SBLineEntry SBAddress::GetLineEntry() { LLDB_INSTRUMENT_VA(this); SBLineEntry sb_line_entry; if (m_opaque_up->IsValid()) { LineEntry line_entry; if (m_opaque_up->CalculateSymbolContextLineEntry(line_entry)) sb_line_entry.SetLineEntry(line_entry); } return sb_line_entry; } ```