text
stringlengths
101
197k
meta
stringlengths
167
272
{ "translations": { "Not all calendars are completely cached" : "Vsi koledarji niso popolnoma predpomnjeni", "Everything seems to be completely cached" : "Videti je, da so vsi predmeti predpomnjeni", "No calendars found." : "Ni najdenih koledarjev.", "No events found." : "Ni najdenih dogodkov.", "Wrong calendar" : "Napačen koledar", "You do not have the permissions to edit this event." : "Ni ustreznih dovoljenj za urejanje tega dogodka.", "The file contained either no events or all events are already saved in your calendar." : "Datoteka ni vsebovala dogodkov, ali pa so vsi že shranjeni v koledarju.", "events have been saved in the new calendar" : "v novi koledar so bili shranjeni dogodki", "Import failed" : "Uvoz je spodletel", "_%n event has been saved in the new calendar %s._::_%n events have been saved in the new calendar %s._" : ["%n dogodek je bil shranjen v nov koledar %s.","%n dogodka sta bila shranjena v nov koledar %s.","%n dogodki so bili shranjeni v nov koledar %s.","%n dogodkov je bilo shranjenih v nov koledar %s."], "_%n event has been saved in your calendar._::_%n events have been saved in your calendar._" : ["%n dogodek je bil shranjen v koledar.","% dogodka sta bila shranjena v koledar.","%n dogodki so bili shranjeni v koledar.","%n dogodkov je bilo shranjenih v koledar."], "New Timezone:" : "Nov časovni pas:", "Timezone changed" : "Časovni pas je spremenjen", "Invalid request" : "Neveljavna zahteva", "Calendar" : "Koledar", "Error sending mail" : "Napaka pošiljanja sporočila", "Deletion failed" : "Brisanje je spodletelo.", "ddd d MMMM[ yyyy]{ - [ddd d] MMMM yyyy}" : "ddd, d. MMMM [ yyyy]{ - [ddd, d.] MMMM yyyy}", "ddd d MMMM[ yyyy] HH:mm{ - [ ddd d MMMM yyyy] HH:mm}" : "ddd. d. MMMM[ yyyy] HH:mm{ - [ ddd. d. MMMM yyyy] HH:mm}", "Do you really want to delete this calendar?" : "Ali res želite izbrisati koledar?", "group" : "skupina", "can edit" : "lahko ureja", "can share" : "lahko omogoči souporabo", "ddd" : "ddd", "ddd M/d" : "ddd, d. M.", "dddd M/d" : "dddd, d. M.", "MMMM yyyy" : "MMMM yyyy", "MMM d[ yyyy]{ '–'[ MMM] d yyyy}" : "d. MMM[ yyyy]{ '–' d.[ MMM] yyyy}", "dddd, MMM d, yyyy" : "dddd, d. MMM yyyy", "Sunday" : "nedelja", "Monday" : "ponedeljek", "Tuesday" : "torek", "Wednesday" : "sreda", "Thursday" : "četrtek", "Friday" : "petek", "Saturday" : "sobota", "Sun." : "ned", "Mon." : "pon", "Tue." : "tor", "Wed." : "sre", "Thu." : "čet", "Fri." : "pet", "Sat." : "sob", "January" : "januar", "February" : "februar", "March" : "marec", "April" : "april", "May" : "maj", "June" : "junij", "July" : "julij", "August" : "avgust", "September" : "september", "October" : "oktober", "November" : "november", "December" : "december", "Jan." : "jan", "Feb." : "feb", "Mar." : "mar", "Apr." : "apr", "May." : "maj", "Jun." : "jun", "Jul." : "jul", "Aug." : "avg", "Sep." : "sep", "Oct." : "okt", "Nov." : "nov", "Dec." : "dec", "All day" : "Cel dan", "New Calendar" : "Nov koledar", "Missing or invalid fields" : "Manjkajoča ali neveljavna polja", "Title" : "Naslov", "From Date" : "Od datuma", "From Time" : "Od časa", "To Date" : "Do datuma", "To Time" : "Do časa", "The event ends before it starts" : "Dogodek se konča preden se začne", "There was a database fail" : "Napaka v podatkovni zbirki", "Interval is not valid. It must be a positive integer!" : "Določilo časovnega razmika ni veljavno. Vrednost mora biti pozitivno celo število..", "Import" : "Uvozi", "Shared" : "V souporabi", "Error" : "Napaka", "Error while sharing" : "Napaka med souporabo", "Error while unsharing" : "Napaka med odstranjevanjem souporabe", "Error while changing permissions" : "Napaka med spreminjanjem dovoljenj", "Shared with you and the group {group} by {owner}" : "V souporabi z vami in skupino {group}. Lastnik je {owner}.", "Shared with you by {owner}" : "V souporabi z vami. Lastnik je {owner}.", "Share with users or groups …" : "Souporaba z uporabniki ali s skupinami ...", "Share with users, groups or remote users …" : "Souporaba z uporabniki, skupinami ali oddaljenimi uporabniki ...", "Share" : "Souporaba", "Share with people on other ownClouds using the syntax username@example.com/owncloud" : "Souporaba z uporabniki drugih oblakov ownCloud je mogoča s povezavo uporabnik@domena.si/owncloud", "Share link" : "Povezava za souporabo", "The public link will expire no later than {days} days after it is created" : "Javna povezava bo potekla {days} dni po ustvarjanju.", "Link" : "Povezava", "Password protect" : "Zaščiti z geslom", "Password" : "Geslo", "Choose a password for the public link" : "Izberite geslo za javno povezavo", "Allow editing" : "Dovoli urejanje", "Email link to person" : "Posreduj povezavo po elektronski pošti", "Send" : "Pošlji", "Set expiration date" : "Nastavi datum preteka", "Expiration" : "Datum preteka", "Expiration date" : "Datum preteka", "An error occured. Please try again" : "Prišlo je do napake. Poskusite znova.", "Adding user..." : "Dodajanje uporabnika ...", "remote" : "oddaljeno", "Resharing is not allowed" : "Nadaljnja souporaba ni dovoljena", "Shared in {item} with {user}" : "V souporabi v {item} z uporabnikom {user}", "Unshare" : "Prekliči souporabo", "notify by email" : "obvesti po elektronski pošti", "access control" : "nadzor dostopa", "create" : "ustvari", "change" : "spremeni", "delete" : "izbriši", "Password protected" : "Zaščiteno z geslom", "Error unsetting expiration date" : "Napaka brisanja datuma preteka", "Error setting expiration date" : "Napaka nastavljanja datuma preteka", "Sending ..." : "Pošiljanje ...", "Email sent" : "Elektronska pošta je poslana", "Warning" : "Opozorilo", "Birthday" : "Rojstni dan", "Business" : "Poslovno", "Call" : "Pokliči", "Clients" : "Stranke", "Deliverer" : "Dobavitelj", "Holidays" : "Dopust", "Ideas" : "Ideje", "Journey" : "Potovanje", "Jubilee" : "Obletnica", "Meeting" : "Srečanje", "Other" : "Drugo", "Personal" : "Osebno", "Projects" : "Projekti", "Questions" : "Vprašanja", "Work" : "Delo", "by" : "od", "unnamed" : "neimenovano", "You do not have the permissions to update this calendar." : "Ni ustreznih dovoljenj za posodobitev tega koledarja.", "You do not have the permissions to delete this calendar." : "Ni ustreznih dovoljenj za izbris tega koledarja.", "You do not have the permissions to add to this calendar." : "Ni ustreznih dovoljenj za dodajanje tega koledarja.", "You do not have the permissions to add events to this calendar." : "Ni ustreznih dovoljenj za dodajanje dogodkov v ta koledar.", "You cannot add non-public events to a shared calendar." : "V koledar v souporabi ni mogoče dodati zasebnih dogodkov.", "You do not have the permissions to delete this event." : "Ni ustreznih dovoljenj za izbris tega dogodka.", "Busy" : "Zasedeno", "Show full event" : "Pokaži poln dogodek", "Show only busy" : "Pokaži le zasedeno", "Hide event" : "Skrij dogodek", "Does not repeat" : "Se ne ponavlja", "Daily" : "Dnevno", "Weekly" : "Tedensko", "Every Weekday" : "Vsak dan v tednu", "Bi-Weekly" : "Dvakrat mesečno", "Monthly" : "Mesečno", "Yearly" : "Letno", "never" : "nikoli", "by occurrences" : "po pojavljanju", "by date" : "po datumu", "by monthday" : "po dnevu v mesecu", "by weekday" : "po dnevu v tednu", "events week of month" : "dogodki tedna v mesecu", "first" : "prvi", "second" : "drugi", "third" : "tretji", "fourth" : "četrti", "fifth" : "peti", "last" : "zadnji", "by events date" : "po datumu dogodka", "by yearday(s)" : "po številu let", "by weeknumber(s)" : "po tednu v letu", "by day and month" : "po dnevu in mesecu", "Contact birthdays" : "Rojstni dan stika", "Date" : "Datum", "Day" : "Dan", "Week" : "Teden", "Month" : "Mesec", "Today" : "Danes", "CalDav Link" : "Povezava CalDav", "Timezone" : "Časovni pas", "Update timezone automatically" : "Samodejno posodobi časovne podatke", "Time format" : "Oblika zapisa časa", "24h" : "24 ur", "12h" : "12 ur", "Start week on" : "Začni teden na", "Cache" : "Predpomnilnik", "Clear cache for repeating events" : "Počisti predpomnilnik ponavljajočih se dogodkov", "Primary CalDAV address" : "Osnovni naslov CalDAV", "iOS/OS X CalDAV address" : "Naslov CalDAV iOS/OS", "Contacts' birthdays CalDAV address" : "Naslov koledarja CalDAV rojstnih dni stika", "Share Calendar" : "Daj koledar v souporabo", "Download" : "Prejmi", "Edit" : "Uredi", "Delete" : "Izbriši", "New calendar" : "Nov koledar", "Edit calendar" : "Uredi koledar", "Edit event" : "Uredi dogodek", "Save event" : "Shrani dogodek", "Delete event" : "Izbriši dogodek", "Eventinfo" : "Podrobnosti dogodka", "Repeating" : "Ponavljanje", "Alarm" : "Alarm", "Attendees" : "Udeleženci", "Title of the Event" : "Naslov dogodka", "from" : "od", "to" : "do", "All Day Event" : "Celodnevni dogodek", "Advanced options" : "Napredne možnosti", "Location" : "Mesto", "View on map" : "Pokaži na zemljevidu", "Categories (separate by comma)" : "Kategorije (ločene z vejico)", "Edit categories" : "Uredi kategorije", "Description" : "Opis", "Export event" : "Izvozi dogodek", "Repeat" : "Ponovi", "Advanced" : "Napredno", "Select weekdays" : "Izbor delovnih dni tedna", "Select days" : "Izberite dneve", "and the events day of year." : "in dnevu dogodka v letu.", "and the events day of month." : "in dnevu dogodka v mesecu.", "Select months" : "Izberite mesece", "Select weeks" : "Izberite tedne", "and the events week of year." : "in tednu dogodka v letu.", "Interval" : "Časovni razmik", "End" : "Konec", "occurrences" : "pojavitve", "Visibility to people shared with" : "Vidno posameznikom v souporabi", "create a new calendar" : "Ustvari nov koledar", "Import a calendar file" : "Uvozi datoteko koledarja", "Please choose a calendar" : "Izberite koledar", "Name of new calendar" : "Ime novega koledarja", "Take an available name!" : "Izberite ime, ki še ni v uporabi!", "A Calendar with this name already exists. If you continue anyhow, these calendars will be merged." : "Koledar s tem imenom že obstaja. Z nadaljevanjem bosta vsebini koledarjev združeni.", "Remove all events from the selected calendar" : "Odstrani vse dogodke iz izbranega koledarja", "Close Dialog" : "Zapri pogovorno okno", "Create a new event" : "Ustvari nov dogodek", "Create event" : "Ustvari dogodek", "Share with user or group" : "Omogoči souporabo s skupino ali z uporabnikom", "Not shared with anyone" : "Ni v souporabi", "Send Email" : "Pošlji elektronsko sporočilo", "Shared via calendar" : "V souporabi preko koledarja", "Not shared with anyone via calendar" : "Ni v souporabi preko koledarja", "View an event" : "Poglej dogodek", "Category" : "Kategorija", "No categories selected" : "Ni izbrane kategorije", "%s of %s" : "%s od %s", "Access Class" : "Razred dostopa", "From" : "Od", "at" : "pri", "To" : "Do" },"pluralForm" :"nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);" }
{'repo_name': 'owncloudarchive/calendar', 'stars': '184', 'repo_language': 'PHP', 'file_name': 'geo.js', 'mime_type': 'text/plain', 'hash': -5962059470682222831, 'source_dataset': 'data'}
load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ "network.go", "plugins.go", ], importpath = "k8s.io/kubernetes/pkg/kubelet/dockershim/network", visibility = ["//visibility:public"], deps = [ "//pkg/features:go_default_library", "//pkg/kubelet/apis/config:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/dockershim/network/hostport:go_default_library", "//pkg/kubelet/dockershim/network/metrics:go_default_library", "//pkg/util/sysctl:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/exec:go_default_library", ], ) filegroup( name = "package-srcs", srcs = glob(["**"]), tags = ["automanaged"], visibility = ["//visibility:private"], ) filegroup( name = "all-srcs", srcs = [ ":package-srcs", "//pkg/kubelet/dockershim/network/cni:all-srcs", "//pkg/kubelet/dockershim/network/hairpin:all-srcs", "//pkg/kubelet/dockershim/network/hostport:all-srcs", "//pkg/kubelet/dockershim/network/kubenet:all-srcs", "//pkg/kubelet/dockershim/network/metrics:all-srcs", "//pkg/kubelet/dockershim/network/testing:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], )
{'repo_name': 'kubeedge/kubeedge', 'stars': '2686', 'repo_language': 'Go', 'file_name': 'options.go', 'mime_type': 'text/plain', 'hash': 361362659326847308, 'source_dataset': 'data'}
>>> GET /?p=%20 HTTP/1.0 User-Agent: Mozilla <<< HTTP/1.0 200 OK Date: Mon, 31 Aug 2009 20:25:50 GMT Server: Apache Connection: close Content-Type: text/html Content-Length: 12 Hello <<< World!
{'repo_name': 'OISF/libhtp', 'stars': '210', 'repo_language': 'C++', 'file_name': 'HTP.c', 'mime_type': 'text/x-c', 'hash': 3001094573200287162, 'source_dataset': 'data'}
#include "f.h" DUPLICATETYPEPARAMETER extern "C" int puts(const char *s); int main() { puts("duplicate-type-parameter"); }
{'repo_name': 'yrnkrn/zapcc', 'stars': '1045', 'repo_language': 'C++', 'file_name': 'file1.cpp', 'mime_type': 'text/x-c', 'hash': -1962617284363029450, 'source_dataset': 'data'}
--- title: Post Types description: Reference for the schema API --- # Post Types You can create new post types for use creating advanced functionality like blogs, forums, job listings, etc. In this guide, we'll walk through the basic steps. ## Base Post Type All post types are built on a base post type schema called simply `post`. This post type includes functionality that is common to most post use cases. For example, it adds `title`, `content`, `tag`, and `category` fields. It also adds [indexes](https://mongoosejs.com/docs/guide.html#indexes) for common queries. Examples of default indexes are: - Text search on `title` and `content` fields - Unique index on `permalink` - Index on `postType` Here is the [schema definition](https://github.com/fiction-com/factor/blob/development/%40factor/post/post-type.ts). ## Adding A Post Type To add a post type, all that is needed is the `addPostType` function: ```js import { addPostType } from "@factor/api" addPostType({ postType: "myPostType", // ... other options }) ``` For all post type features to work correctly this function needs to be run in both the app and server environments. So make sure to address this with your [main files](./main-files); for example a load configuration of `load: ['app', 'server']`. ## Configuring the Post Type There are many available options available when creating new post types, let's walk through them. ## Post Type Management Options You can control the dashboard management features with the following options: ```js import { addPostType } from "@factor/api" import icon from "./my-icon.svg" addPostType({ postType: "myPostType", managePosts: true, // Enable dashboard menu icon, // Dashboard icon nameIndex: "Users", // Contextual references nameSingle: "User", namePlural: "Users", accessLevel: 500, // accessLevel needed to see dashboard menu noAddNew: true, // hide "add new" addNewText: "Create User", // change add new text listTemplate: () => import("./v-list.vue"), // override post listing component editTemplate: () => import("./v-edit.vue"), // override post edit component }) ``` ## Post Type Permalinks You can control the post type permalinks when you set up the post type. This doesn't create the route however it just allows you to use `postLink` ([doc](./links)) and get the desired link. You'll also need to[ create the routes and handling](./routes) to make the post show correctly on that page. ```js import { addPostType, slugify } from "@factor/api" addPostType({ postType: "myPostType", permalink: (post) => { return `/my-post-type/${post._id}/${slugify(post.title)}` }, }) ``` If you want to allow permalinks to be set in the dashboard: ```js import { addPostType } from "@factor/api" addPostType({ postType: "myPostType", customPermalink: true, // Allow permalink option on post edit permalink: (post) => { return `/my-post-type/${post.permalink}` }, }) ``` ## Create Structure with Post Schema Options ### Schema Definition Schemas are to help organize the handling of post data on your server. Create a custom schema to add new properties or to change the base post definition. The `schemaDefinition` options are used to add a [Mongoose schema](https://mongoosejs.com/docs/guide.html) definition to your post type and extend the base post schema. Post type creation also supports three additional options related to schemas: - `schemaMiddleware` - Callback function for adding [Mongoose middleware](https://mongoosejs.com/docs/middleware.html) functions - `schemaOptions` - Add Mongoose [options](https://mongoosejs.com/docs/guide.html#options) to the schema - `schemaPopulated` - An array of fields that consist of references to other posts and need to be populated on query (e.g. `author`). ```js import { addPostType, ObjectId } from "@factor/api" addPostType({ schemaDefinition: { foo: String, bar: Buffer, baz: Number, buz: {ref: "anotherPostType", type: ObjectId} }, schemaMiddleware: Schema => { Schema.pre('save', function(){ // add middleware }) } schemaPopulated: ['buz'], // populate the buz field with its post schemaOptions: {} // ...other post type options }) ``` #### Notes - Populated fields are fields consisting of just `_id`'s or `objectId` that populate based on data in the original post (like a SQL join) - `ObjectId` is needed for Mongoose to property type check reference to other posts ## Security Permissions For database operations, you need permissions to control access. Factor offers a basic system to control standard CRUD input and output. The base post permissions schema looks like this: ```js addPostType({ permissions: { create: { accessLevel: 100 }, retrieve: { accessLevel: 100, accessPublished: 0, accessAuthor: true, }, update: { accessLevel: 100, accessAuthor: true }, delete: { accessLevel: 200, accessAuthor: true }, embedded: { create: { accessLevel: 1 }, retrieve: { accessLevel: 0 }, update: { accessLevel: 100, accessAuthor: true }, delete: { accessLevel: 100, accessAuthor: true }, }, }, }) ``` In your extending schema you can override this. For example with contact form submissions, we want it to be possible for anyone to create them (`accessLevel: 0`) but you have to be a moderator or the post author to read them (`accessLevel: 300`). In your schema that looks like this: ```js export default { name: "contact-form", permissions: { create: { accessLevel: 0 }, retrieve: { accessLevel: 300, accessAuthor: true, }, }, } ``` ## Template Settings If you would like to allow users to set meta-information on each post, there is a way to add template options in post types using [template settings](./template-settings). ```js addPostType({ postType: "portfolioItems", templateSettings: [ { _id: "items", input: "sortable", label: "Additional Work Info", description: "Additional information about this project", _default: [ { __title: "Client", value: "Client Name" }, { __title: "Role", value: "Role" }, { __title: "Year", value: new Date().getFullYear() }, { __title: "Platforms", value: "Web" }, { __title: "URL", value: "https://www.example.com" }, ], settings: [ { input: "text", label: "Value", _id: "value", }, ], }, ], }) ``` ## Public Sitemap Some post types are meant to be public, e.g. blog posts, while others are meant to be private, e.g. contact form submissions. If you would like to indicate that posts are public and meant to be added to the public sitemap then use `addSitemap`. ```js addPostType({ postType: "portfolioItems", addSitemap: true, }) ``` Enabling this option will add the post type to public tools like the `sitemap.xml` file and search utilities. ## Changing Post Types with Filters You can edit or add to existing post types using standard filters. - `schema-definition-[post type]` - Is a filter to adjust the schema definition of a post type - `schema-hooks-[post type]` - Add additional Mongoose middleware to a schema ```js import { randomToken } from "@factor/api" addFilter({ key: "addApiKey", hook: "schema-definition-user", callback: (definition) => { definition.apiKey = { type: String, default: randomToken(50), } return definition }, }) ```
{'repo_name': 'fiction-com/factor', 'stars': '912', 'repo_language': 'Vue', 'file_name': 'widget-meta.vue', 'mime_type': 'text/html', 'hash': 1444635536505878006, 'source_dataset': 'data'}
.assembly-type-curated_links { &.nav-menu { border-top: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9; margin-bottom: 15px; } } .curated-links { @extend .container; padding: 40px 15px; .nav-menu & { padding: 15px 15px 0 15px; } } .curated-links__list { border-top: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9; padding: 20px 0; list-style: none; .nav-menu & { border-top: none; border-bottom: none; display: flex; padding: 0; margin: 0 0 15px 0; text-align: left; @include desktop-extra-small-and-down { flex-direction: column; } } } .curated-links__list-item { line-height: 40px; padding-left: 12px; .nav-menu & { padding-left: 0; padding-right: 30px; display: inline-block; max-width: 15rem; line-height: 1.3; a { font-size: 14px; } @include desktop-extra-small-and-down { display: block; max-width: 100%; line-height: 24px; margin-bottom: 8px; } } @include desktop-small-and-down { line-height: 24px; margin-bottom: 8px; } } .curated-links__list-item .fa-arrow-alt-circle-right { color: #999; height: 100%; font-size: 8px; } .curated-links__list-item > a { font-size: 20px; @include desktop-small-and-down { font-size: 14px; } }
{'repo_name': 'redhat-developer/developers.redhat.com', 'stars': '134', 'repo_language': 'CSS', 'file_name': 'wdio.conf.browserstack.js', 'mime_type': 'text/plain', 'hash': 7757519888582292555, 'source_dataset': 'data'}
# Copyright 2017-2020 The Verible Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Build rule for generating C or C++ sources with Flex. IMPORTANT: we _strongly recommend_ that you include a unique and project- specific `%option prefix="myproject"` directive in your scanner spec to avoid very hard-to-debug symbol name conflict problems if two scanners are linked into the same dynamically-linked executable. By default, flex includes the definition of a static function `yyunput` in its output. If you never use the lex `unput` function in your lex rules, however, `yyunput` will never be called. This causes problems building the output file, as llvm issues warnings about static functions that are never called. To avoid this problem, use `%option nounput` in the declarations section if your lex rules never use `unput`. Note that if you use the c++ mode of flex, you will need to include the boilerplate header `FlexLexer.h` file in any `cc_library` which includes the generated flex scanner directly. This is typically done by `#include <FlexLexer.h>` which typically is installed in /usr/include when flex is installed. Examples -------- This is a simple example. ``` genlex( name = "html_lex_lex", src = "html.lex", out = "html_lexer.c", ) ``` This example uses a `.tab.hh` file. ``` genlex( name = "rules_l", src = "rules.lex", includes = [ "rules.tab.hh", ], out = "rules.yy.cc", ) ``` """ def _genlex_impl(ctx): """Implementation for genlex rule.""" # Compute the prefix, if not specified. if ctx.attr.prefix: prefix = ctx.attr.prefix else: prefix = ctx.file.src.basename.partition(".")[0] # Construct the arguments. args = ctx.actions.args() args.add("-o", ctx.outputs.out) args.add("-P", prefix) args.add_all(ctx.attr.lexopts) args.add(ctx.file.src) ctx.actions.run( executable = ctx.executable._flex, env = { "M4": ctx.executable._m4.path, }, arguments = [args], inputs = ctx.files.src + ctx.files.includes, tools = [ctx.executable._m4], outputs = [ctx.outputs.out], mnemonic = "Flex", progress_message = "Generating %s from %s" % ( ctx.outputs.out.short_path, ctx.file.src.short_path, ), ) genlex = rule( attrs = { "src": attr.label( mandatory = True, allow_single_file = [ ".l", ".ll", ".lex", ".lpp", ], doc = "The .lex source file for this rule", ), "includes": attr.label_list( allow_files = True, doc = "A list of headers that are included by the .lex file", ), "out": attr.output( mandatory = True, doc = "The generated source file", ), "prefix": attr.string( doc = "External symbol prefix for Flex. This string is " + "passed to flex as the -P option, causing the resulting C " + "file to define external functions named 'prefix'text, " + "'prefix'in, etc. The default is the basename of the source" + "file without the .lex extension.", ), "lexopts": attr.string_list( doc = "A list of options to be added to the flex command line.", ), "_flex": attr.label( default = Label("//bazel:flex_bin"), executable = True, cfg = "host", ), "_m4": attr.label( default = Label("//bazel:m4_bin"), executable = True, cfg = "host", ), }, doc = "Generate C/C++-language sources from a lex file using Flex.", output_to_genfiles = True, implementation = _genlex_impl, )
{'repo_name': 'google/verible', 'stars': '229', 'repo_language': 'C++', 'file_name': 'development.md', 'mime_type': 'text/plain', 'hash': -173052272830232877, 'source_dataset': 'data'}
{ "author": { "name": "Mark Cavage", "email": "mcavage@gmail.com" }, "name": "assert-plus", "description": "Extra assertions on top of node's assert module", "version": "0.1.2", "main": "./assert.js", "dependencies": {}, "devDependencies": {}, "optionalDependencies": {}, "engines": { "node": ">=0.6" }, "_id": "assert-plus@0.1.2", "dist": { "shasum": "d93ffdbb67ac5507779be316a7d65146417beef8", "tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz" }, "_npmVersion": "1.1.59", "_npmUser": { "name": "mcavage", "email": "mcavage@gmail.com" }, "maintainers": [ { "name": "mcavage", "email": "mcavage@gmail.com" } ], "directories": {}, "_shasum": "d93ffdbb67ac5507779be316a7d65146417beef8", "_from": "assert-plus@0.1.2", "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz", "readme": "ERROR: No README data found!" }
{'repo_name': 'hua1995116/musiccloudWebapp', 'stars': '692', 'repo_language': 'Vue', 'file_name': 'webpack.test.conf.js', 'mime_type': 'text/plain', 'hash': 1896213850803863513, 'source_dataset': 'data'}
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. require 'spec_helper' describe 'client.cluster#put_template' do let(:expected_args) do [ 'PUT', url, params, body, {} ] end let(:url) do '_template/foo' end let(:body) do { template: 'bar' } end let(:params) do {} end it 'performs the request' do expect(client_double.indices.put_template(name: 'foo', body: { template: 'bar' })).to eq({}) end context 'when there is no name specified' do let(:client) do Class.new { include Elasticsearch::API }.new end it 'raises an exception' do expect { client.indices.put_template(body: {}) }.to raise_exception(ArgumentError) end end context 'when there is no body specified' do let(:client) do Class.new { include Elasticsearch::API }.new end it 'raises an exception' do expect { client.indices.put_template(name: 'foo') }.to raise_exception(ArgumentError) end end context 'when parameters are specified' do let(:params) do { order: 3 } end let(:url) do '_template/foo' end let(:body) do {} end it 'performs the request' do expect(client_double.indices.put_template(name: 'foo', order: 3, body: {})).to eq({}) end end context 'when the path needs to be URL-escaped' do let(:url) do '_template/foo%5Ebar' end let(:body) do {} end it 'performs the request' do expect(client_double.indices.put_template(name: 'foo^bar', body: {})).to eq({}) end end end
{'repo_name': 'elastic/elasticsearch-ruby', 'stars': '1752', 'repo_language': 'Ruby', 'file_name': 'search_suggest_test.rb', 'mime_type': 'text/x-ruby', 'hash': -2582980171217970394, 'source_dataset': 'data'}
<!-- Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <!-- Note: Static (i.e., not template-generated) href and id attributes start with "pkg-" to make it impossible for them to conflict with generated attributes (some of which correspond to Go identifiers). --> {{with .PDoc}} <script type='text/javascript'> document.ANALYSIS_DATA = {{$.AnalysisData}}; document.CALLGRAPH = {{$.CallGraph}}; </script> {{if $.IsMain}} {{/* command documentation */}} {{comment_html .Doc}} {{else}} {{/* package documentation */}} <div id="short-nav"> <dl> <dd><code>import "{{html .ImportPath}}"</code></dd> </dl> <dl> <dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd> <dd><a href="#pkg-index" class="indexLink">Index</a></dd> {{if $.Examples}} <dd><a href="#pkg-examples" class="examplesLink">Examples</a></dd> {{end}} {{if $.Dirs}} <dd><a href="#pkg-subdirectories">Subdirectories</a></dd> {{end}} </dl> </div> <!-- The package's Name is printed as title by the top-level template --> <div id="pkg-overview" class="toggleVisible"> <div class="collapsed"> <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2> </div> <div class="expanded"> <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2> {{comment_html .Doc}} </div> </div> {{example_html $ ""}} <div id="pkg-index" class="toggleVisible"> <div class="collapsed"> <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2> </div> <div class="expanded"> <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2> <!-- Table of contents for API; must be named manual-nav to turn off auto nav. --> <div id="manual-nav"> <dl> {{if .Consts}} <dd><a href="#pkg-constants">Constants</a></dd> {{end}} {{if .Vars}} <dd><a href="#pkg-variables">Variables</a></dd> {{end}} {{range .Funcs}} {{$name_html := html .Name}} <dd><a href="#{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd> {{end}} {{range .Types}} {{$tname_html := html .Name}} <dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd> {{range .Funcs}} {{$name_html := html .Name}} <dd>&nbsp; &nbsp; <a href="#{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd> {{end}} {{range .Methods}} {{$name_html := html .Name}} <dd>&nbsp; &nbsp; <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd> {{end}} {{end}} {{if $.Notes}} {{range $marker, $item := $.Notes}} <dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd> {{end}} {{end}} </dl> </div><!-- #manual-nav --> {{if $.Examples}} <div id="pkg-examples"> <h4>Examples</h4> <dl> {{range $.Examples}} <dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd> {{end}} </dl> </div> {{end}} {{with .Filenames}} <h4>Package files</h4> <p> <span style="font-size:90%"> {{range .}} <a href="{{.|srcLink|html}}">{{.|filename|html}}</a> {{end}} </span> </p> {{end}} </div><!-- .expanded --> </div><!-- #pkg-index --> <div id="pkg-callgraph" class="toggle" style="display: none"> <div class="collapsed"> <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2> </div> <!-- .expanded --> <div class="expanded"> <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2> <p> In the call graph viewer below, each node is a function belonging to this package and its children are the functions it calls&mdash;perhaps dynamically. </p> <p> The root nodes are the entry points of the package: functions that may be called from outside the package. There may be non-exported or anonymous functions among them if they are called dynamically from another package. </p> <p> Click a node to visit that function's source code. From there you can visit its callers by clicking its declaring <code>func</code> token. </p> <p> Functions may be omitted if they were determined to be unreachable in the particular programs or tests that were analyzed. </p> <!-- Zero means show all package entry points. --> <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul> </div> </div> <!-- #pkg-callgraph --> {{with .Consts}} <h2 id="pkg-constants">Constants</h2> {{range .}} <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{end}} {{end}} {{with .Vars}} <h2 id="pkg-variables">Variables</h2> {{range .}} <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{end}} {{end}} {{range .Funcs}} {{/* Name is a string - no need for FSet */}} {{$name_html := html .Name}} <h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h2> <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{example_html $ .Name}} {{callgraph_html $ "" .Name}} {{end}} {{range .Types}} {{$tname := .Name}} {{$tname_html := html .Name}} <h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a></h2> <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{range .Consts}} <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{end}} {{range .Vars}} <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{end}} {{example_html $ $tname}} {{implements_html $ $tname}} {{methodset_html $ $tname}} {{range .Funcs}} {{$name_html := html .Name}} <h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3> <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{example_html $ .Name}} {{callgraph_html $ "" .Name}} {{end}} {{range .Methods}} {{$name_html := html .Name}} <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3> <pre>{{node_html $ .Decl true}}</pre> {{comment_html .Doc}} {{$name := printf "%s_%s" $tname .Name}} {{example_html $ $name}} {{callgraph_html $ .Recv .Name}} {{end}} {{end}} {{end}} {{with $.Notes}} {{range $marker, $content := .}} <h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2> <ul style="list-style: none; padding: 0;"> {{range .}} <li><a href="{{posLink_url $ .}}">&#x261e;</a> {{html .Body}}</li> {{end}} </ul> {{end}} {{end}} {{end}} {{with .PAst}} {{range $filename, $ast := .}} <a href="{{$filename|srcLink|html}}">{{$filename|filename|html}}</a>:<pre>{{node_html $ $ast false}}</pre> {{end}} {{end}} {{with .Dirs}} {{/* DirList entries are numbers and strings - no need for FSet */}} {{if $.PDoc}} <h2 id="pkg-subdirectories">Subdirectories</h2> {{end}} {{if eq $.Dirname "/src"}} <div id="manual-nav"> <dl> <dt><a href="#stdlib">Standard library</a></dt> <dt><a href="#other">Other packages</a></dt> <dd><a href="#subrepo">Sub-repositories</a></dd> <dd><a href="#community">Community</a></dd> </dl> </div> <h2 id="stdlib">Standard library</h2> <img class="gopher" src="/doc/gopher/pkg.png"/> {{end}} <table class="dir"> <tr> <th>Name</th> <th>&nbsp;&nbsp;&nbsp;&nbsp;</th> <th style="text-align: left; width: auto">Synopsis</th> </tr> {{if not (or (eq $.Dirname "/src") (eq $.Dirname "/src/cmd") $.DirFlat)}} <tr> <td><a href="..">..</a></td> </tr> {{end}} {{range .List}} {{if $.DirFlat}} {{if .HasPkg}} <tr> <td class="name"><a href="{{html .Path}}/">{{html .Path}}</a></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="width: auto">{{html .Synopsis}}</td> </tr> {{end}} {{else}} <tr> <td class="name">{{repeat `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;` .Depth}}<a href="{{html .Path}}/">{{html .Name}}</a></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> <td style="width: auto">{{html .Synopsis}}</td> </tr> {{end}} {{end}} </table> {{if eq $.Dirname "/src"}} <h2 id="other">Other packages</h2> <h3 id="subrepo">Sub-repositories</h3> <p> These packages are part of the Go Project but outside the main Go tree. They are developed under looser <a href="/doc/go1compat">compatibility requirements</a> than the Go core. Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>". </p> <ul> <li><a href="//godoc.org/golang.org/x/crypto">crypto</a> — additional cryptography packages.</li> <li><a href="//godoc.org/golang.org/x/image">image</a> — additional imaging packages.</li> <li><a href="//godoc.org/golang.org/x/net">net</a> — additional networking packages.</li> <li><a href="//godoc.org/golang.org/x/sys">sys</a> — packages for making system calls.</li> <li><a href="//godoc.org/golang.org/x/text">text</a> — packages for working with text.</li> <li><a href="//godoc.org/golang.org/x/tools">tools</a> — godoc, vet, cover, and other tools.</li> <li><a href="//godoc.org/golang.org/x/exp">exp</a> — experimental code (handle with care; may change without warning).</li> </ul> <h3 id="community">Community</h3> <p> These services can help you find Open Source packages provided by the community. </p> <ul> <li><a href="//godoc.org">GoDoc</a> - a package index and search engine.</li> <li><a href="http://go-search.org">Go Search</a> - a code search engine.</li> <li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li> </ul> {{end}} {{end}}
{'repo_name': 'evergreen-ci/evergreen', 'stars': '234', 'repo_language': 'Go', 'file_name': 'split_command.go', 'mime_type': 'text/plain', 'hash': 9221017408502594913, 'source_dataset': 'data'}
<?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- namespace think\process\exception; use think\Process; class Timeout extends \RuntimeException { const TYPE_GENERAL = 1; const TYPE_IDLE = 2; private $process; private $timeoutType; public function __construct(Process $process, $timeoutType) { $this->process = $process; $this->timeoutType = $timeoutType; parent::__construct(sprintf('The process "%s" exceeded the timeout of %s seconds.', $process->getCommandLine(), $this->getExceededTimeout())); } public function getProcess() { return $this->process; } public function isGeneralTimeout() { return $this->timeoutType === self::TYPE_GENERAL; } public function isIdleTimeout() { return $this->timeoutType === self::TYPE_IDLE; } public function getExceededTimeout() { switch ($this->timeoutType) { case self::TYPE_GENERAL: return $this->process->getTimeout(); case self::TYPE_IDLE: return $this->process->getIdleTimeout(); default: throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType)); } } }
{'repo_name': 'apanly/mooc', 'stars': '246', 'repo_language': 'PHP', 'file_name': 'yii2.conf', 'mime_type': 'text/plain', 'hash': -4614919817597961695, 'source_dataset': 'data'}
# frozen_string_literal: true source ENV['GEM_SOURCE'] || 'https://rubygems.org' # Disable analytics when running in development ENV['BOLT_DISABLE_ANALYTICS'] = 'true' # Disable warning that Bolt may be installed as a gem ENV['BOLT_GEM'] = 'true' gemspec group(:bolt_server) do # Bolt server gems are managed here not in the gemspec gem "hocon", '>= 1.2.5' gem "json-schema", '>= 2.8.0' gem "puma", '>= 3.12.0' gem "rack", '>= 2.0.5' gem "rails-auth", '>= 2.1.4' gem "sinatra", '>= 2.0.4' end # Optional paint gem for rainbow outputter gem "paint", "~> 2.2" group(:test) do gem "beaker-hostgenerator" gem "mocha", '~> 1.4.0' gem "rack-test", '~> 1.0' gem "rubocop", '~> 0.61', require: false end group(:packaging) do gem 'packaging', '~> 0.99.35' end local_gemfile = File.join(__dir__, 'Gemfile.local') if File.exist? local_gemfile eval_gemfile local_gemfile end
{'repo_name': 'puppetlabs/bolt', 'stars': '326', 'repo_language': 'Ruby', 'file_name': 'pwsh_bolt.tests.ps1.erb', 'mime_type': 'text/plain', 'hash': 3890193399270299474, 'source_dataset': 'data'}
{ buildPythonPackage, fetchPypi, isPy3k, stdenv }: buildPythonPackage rec { pname = "lmtpd"; version = "6.2.0"; disabled = !isPy3k; src = fetchPypi { inherit pname version; sha256 = "2c6825d2ffa1de099440411a742f58e1b3e8deeb3345adcfd4c2c38d4baf62b3"; }; meta = with stdenv.lib; { homepage = "https://github.com/moggers87/lmtpd"; description = "LMTP counterpart to smtpd in the Python standard library"; license = licenses.mit; maintainers = with maintainers; [ jluttine ]; }; }
{'repo_name': 'NixOS/nixpkgs', 'stars': '5317', 'repo_language': 'Nix', 'file_name': 'default.nix', 'mime_type': 'text/plain', 'hash': -8818758400413841683, 'source_dataset': 'data'}
/* Monkey HTTP Daemon * ------------------ * Copyright (C) 2012, Lauri Kasanen <cand@gmx.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <libmonkey.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> /* * This example shows how to start the server, and point it to /tmp. * It also creates /tmp/index.html. */ static void write_index() { const char *path = "/tmp/index.html"; FILE *f = fopen(path, "w"); if (!f) exit(1); fprintf(f, "<html><body><h2>Hello Monkey</h2></body></html>"); fclose(f); } int main() { int ret; write_index(); // All defaults. Bind to all interfaces, port 2001, default plugins, /tmp. // No callbacks are used. mklib_ctx ctx = mklib_init(NULL, 0, 0, "/tmp"); if (!ctx) return 1; // The default has no index files, let's set index.html as one. ret = mklib_config(ctx, MKC_INDEXFILE, "index.html", NULL); if (!ret) return 1; // Start the server. mklib_start(ctx); // I'm now free to do my own things. I'm just going to wait for a keypress. printf("All set and running! Visit me, I default to localhost:2001.\n"); printf("Press a key to exit.\n"); getchar(); mklib_stop(ctx); return 0; }
{'repo_name': 'monkey/monkey', 'stars': '517', 'repo_language': 'C', 'file_name': 'sys_siglist.h', 'mime_type': 'text/x-c', 'hash': -7746814982924333035, 'source_dataset': 'data'}
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>hc_nodtdstaff</title></head><body onload="parent.loadComplete()"> <p> <em>EMP0001</em> <strong>Margaret Martin</strong> <code>Accountant</code> <sup>56,000</sup> <var>Female</var> <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym> </p> </body></html>
{'repo_name': 'jsdom/jsdom', 'stars': '14372', 'repo_language': 'JavaScript', 'file_name': 'utils.js', 'mime_type': 'text/plain', 'hash': -8020759389929339170, 'source_dataset': 'data'}
const Sequelize = require('sequelize') const sequelize = new Sequelize('nodejs_login1', 'root', '', { host: 'localhost', dialect: 'mysql', operatorsAliases: false, }) module.exports = sequelize
{'repo_name': 'ArjunAranetaCodes/MoreCodes-Youtube', 'stars': '226', 'repo_language': 'JavaScript', 'file_name': 'Task.js', 'mime_type': 'text/plain', 'hash': 6934788253087996930, 'source_dataset': 'data'}
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /****************************************************************** iLBC Speech Coder ANSI-C Source Code WebRtcIlbcfix_Vq4.c ******************************************************************/ #include "modules/audio_coding/codecs/ilbc/vq4.h" #include "modules/audio_coding/codecs/ilbc/constants.h" /*----------------------------------------------------------------* * vector quantization *---------------------------------------------------------------*/ void WebRtcIlbcfix_Vq4( int16_t *Xq, /* quantized vector (Q13) */ int16_t *index, int16_t *CB, /* codebook in Q13 */ int16_t *X, /* vector to quantize (Q13) */ int16_t n_cb ){ int16_t i, j; int16_t pos, minindex=0; int16_t tmp; int32_t dist, mindist; pos = 0; mindist = WEBRTC_SPL_WORD32_MAX; /* start value */ /* Find the codebook with the lowest square distance */ for (j = 0; j < n_cb; j++) { tmp = X[0] - CB[pos]; dist = tmp * tmp; for (i = 1; i < 4; i++) { tmp = X[i] - CB[pos + i]; dist += tmp * tmp; } if (dist < mindist) { mindist = dist; minindex = j; } pos += 4; } /* Store the quantized codebook and the index */ for (i = 0; i < 4; i++) { Xq[i] = CB[minindex*4 + i]; } *index = minindex; }
{'repo_name': 'Telegram-FOSS-Team/Telegram-FOSS', 'stars': '824', 'repo_language': 'Java', 'file_name': 'EmojiTextureMaker.m', 'mime_type': 'text/x-objective-c', 'hash': -4776876551632749262, 'source_dataset': 'data'}
<div> <h3>Start new transport</h3> <tabset> <tab heading="Irc"> <div id="tr1"> <label>Irc bot nick:</label> <input type="text" ng-model="nick"/> <label>Irc bot password:</label> <input type="text" ng-model="password"/> <label>Irc channel:</label> <input type="text" ng-model="channel"/> <label>Irc channel key:</label> <input type="text" ng-model="channel_key"/> <label>Irc server host:</label> <input type="text" ng-model="host"/> <label>Irc server port:</label> <input type="text" ng-model="port"/> <label>Use ssl:</label> <input type="checkbox" ng-model="ssl"/> <label>Recconnect timeout:</label> <input type="text" ng-model="timeout"/> <br/> <button ng-click="start_irc(nick, password, channel, channel_key, host, port, ssl, timeout)" class="btn">Start</button> </div> </tab> <tab heading="XMPP"> <div id="tr2"> <label>Bot login:</label> <input type="text" ng-model="jabber_login"/> <label>Bot password:</label> <input type="text" ng-model="jabber_password"/> <label>Jabber room:</label> <input type="text" ng-model="jabber_room"/> <label>Nick in room:</label> <input type="text" ng-model="jabber_nick"/> <label>Jabber server:</label> <input type="text" ng-model="jabber_server"/> <label>Jabber resource:</label> <input type="text" ng-model="jabber_resource"/> <label>Server port:</label> <input type="text" ng-model="jabber_port"/> <label>Use ssl:</label> <input type="checkbox" ng-model="jabber_ssl"/> <label>Recconnect timeout:</label> <input type="text" ng-model="jabber_reconnect_timeout"/> <br/> <button ng-click="start_xmpp(jabber_nick, jabber_password, jabber_room, jabber_server, jabber_resource, jabber_port, jabber_ssl, jabber_reconnect_timeout)" class="btn">Start</button> </div> </tab> <tab heading="Campfire"> <div id="tr3"> <label>Bot nick:</label> <input type="text" ng-model="campfire_nick"/> <label>Campfire token:</label> <input type="text" ng-model="campfire_token"/> <label>Campfire room id:</label> <input type="text" ng-model="campfire_room_id"/> <label>Campfire subdomain:</label> <input type="text" ng-model="campfire_subdomain"/> <label>Reconnect timeout:</label> <input type="text" ng-model="campfire_reconnect_timeout"/> <br/> <button ng-click="start_campfire(campfire_nick, campfire_token, campfire_room_id, campfire_subdomain, campfire_reconnect_timeout)" class="btn">Start</button> </div> </tab> <tab heading="HipChat"> <div id="tr4"> <label>Bot jid:</label> <input type="text" ng-model="hipchat_jid"/> <label>Bot password:</label> <input type="text" ng-model="hipchat_password"/> <label>Hipchat room:</label> <input type="text" ng-model="hipchat_room"/> <label>Hipchat bot nick:</label> <input type="text" ng-model="hipchat_nick"/> <label>Reconnect timeout:</label> <input type="text" ng-model="hipchat_reconnect_timeout"/> <br/> <button ng-click="start_hipchat(hipchat_jid, hipchat_password, hipchat_room, hipchat_nick, hipchat_reconnect_timeout)" class="btn">Start</button> </div> </tab> <tab heading="Skype"> <div id="tr5"> <label>Ybot http backend host:</label> <input type="text" ng-model="skype_http_host"/> <label>Ybot http backend port:</label> <input type="text" ng-model="skype_http_port"/> <br/> <button ng-click="start_skype(skype_http_host, skype_http_port)" class="btn">Start</button> </div> </tab> <tab heading="HTTP"> <label>HTTP host:</label> <input type="text" ng-model="http_host"/> <label>HTTP port:</label> <input type="text" ng-model="http_port"/> <label>Bot nick:</label> <input type="text" ng-model="http_bot_nick"/> <br/> <button ng-click="start_http(http_host, http_port, http_bot_nick)" class="btn">Start</button> </tab> <tab heading="Flowdock"> <label>Bot chat nick:</label> <input type="text" ng-model="flowdock_nick"/> <label>Bot flowdock login:</label> <input type="text" ng-model="flowdock_login"/> <label>Bot password:</label> <input type="text" ng-model="flowdock_password"/> <label>flowdock organization:</label> <input type="text" ng-model="flowdock_org"/> <label>flowdock flow:</label> <input type="text" ng-model="flowdock_flow"/> <br/> <button ng-click="start_flowdock(flowdock_nick, flowdock_login, flowdock_password, flowdock_org, flowdock_flow)" class="btn">Start</button> </tab> <tab heading="TalkerApp"> <label>Bot chat nick:</label> <input type="text" ng-model="talkerapp_nick"/> <label>Bot talkerapp room:</label> <input type="text" ng-model="talkerapp_room"/> <label>Talkerapp token:</label> <input type="text" ng-model="talkerapp_token"/> <br/> <button ng-click="start_talkerapp(talkerapp_nick, talkerapp_room, talkerapp_token)" class="btn">Start</button> </tab> </tabset> </div>
{'repo_name': 'OtpChatBot/Ybot', 'stars': '197', 'repo_language': 'Erlang', 'file_name': 'ackbar.rb', 'mime_type': 'text/x-ruby', 'hash': 7304790798251594045, 'source_dataset': 'data'}
package com.b44t.messenger; import androidx.annotation.NonNull; import androidx.annotation.Nullable; public class DcContext { public final static int DC_PREF_DEFAULT_MDNS_ENABLED = 1; public final static int DC_PREF_DEFAULT_TRIM_ENABLED = 0; public final static int DC_PREF_DEFAULT_TRIM_LENGTH = 500; public final static int DC_EVENT_INFO = 100; public final static int DC_EVENT_WARNING = 300; public final static int DC_EVENT_ERROR = 400; public final static int DC_EVENT_ERROR_NETWORK = 401; public final static int DC_EVENT_ERROR_SELF_NOT_IN_GROUP = 410; public final static int DC_EVENT_MSGS_CHANGED = 2000; public final static int DC_EVENT_INCOMING_MSG = 2005; public final static int DC_EVENT_MSGS_NOTICED = 2008; public final static int DC_EVENT_MSG_DELIVERED = 2010; public final static int DC_EVENT_MSG_FAILED = 2012; public final static int DC_EVENT_MSG_READ = 2015; public final static int DC_EVENT_CHAT_MODIFIED = 2020; public final static int DC_EVENT_CHAT_EPHEMERAL_TIMER_MODIFIED = 2021; public final static int DC_EVENT_CONTACTS_CHANGED = 2030; public final static int DC_EVENT_LOCATION_CHANGED = 2035; public final static int DC_EVENT_CONFIGURE_PROGRESS = 2041; public final static int DC_EVENT_IMEX_PROGRESS = 2051; public final static int DC_EVENT_IMEX_FILE_WRITTEN = 2052; public final static int DC_EVENT_SECUREJOIN_INVITER_PROGRESS = 2060; public final static int DC_EVENT_SECUREJOIN_JOINER_PROGRESS = 2061; public final static int DC_IMEX_EXPORT_SELF_KEYS = 1; public final static int DC_IMEX_IMPORT_SELF_KEYS = 2; public final static int DC_IMEX_EXPORT_BACKUP = 11; public final static int DC_IMEX_IMPORT_BACKUP = 12; public final static int DC_GCL_VERIFIED_ONLY = 1; public final static int DC_GCL_ADD_SELF = 2; public final static int DC_GCL_ARCHIVED_ONLY = 0x01; public final static int DC_GCL_NO_SPECIALS = 0x02; public final static int DC_GCL_ADD_ALLDONE_HINT = 0x04; public final static int DC_GCL_FOR_FORWARDING = 0x08; public final static int DC_GCM_ADDDAYMARKER = 0x01; public final static int DC_QR_ASK_VERIFYCONTACT = 200; public final static int DC_QR_ASK_VERIFYGROUP = 202; public final static int DC_QR_FPR_OK = 210; public final static int DC_QR_FPR_MISMATCH = 220; public final static int DC_QR_FPR_WITHOUT_ADDR = 230; public final static int DC_QR_ACCOUNT = 250; public final static int DC_QR_WEBRTC = 260; public final static int DC_QR_ADDR = 320; public final static int DC_QR_TEXT = 330; public final static int DC_QR_URL = 332; public final static int DC_QR_ERROR = 400; public final static int DC_LP_AUTH_OAUTH2 = 0x2; public final static int DC_LP_AUTH_NORMAL = 0x4; public final static int DC_SOCKET_AUTO = 0; public final static int DC_SOCKET_SSL = 1; public final static int DC_SOCKET_STARTTLS = 2; public final static int DC_SOCKET_PLAIN = 3; public final static int DC_SHOW_EMAILS_OFF = 0; public final static int DC_SHOW_EMAILS_ACCEPTED_CONTACTS = 1; public final static int DC_SHOW_EMAILS_ALL = 2; public final static int DC_MEDIA_QUALITY_BALANCED = 0; public final static int DC_MEDIA_QUALITY_WORSE = 1; public DcContext(String osName, String dbfile) { contextCPtr = createContextCPtr(osName, dbfile); } public boolean isOk() { return contextCPtr != 0; } @Override protected void finalize() throws Throwable { super.finalize(); unref(); } public void unref() { if (contextCPtr != 0) { unrefContextCPtr(); contextCPtr = 0; } } public DcEventEmitter getEventEmitter () { return new DcEventEmitter(getEventEmitterCPtr()); } public native void setStockTranslation (int stockId, String translation); public native String getBlobdir (); public native void configure (); public native void stopOngoingProcess (); public native int isConfigured (); public native void startIo (); public native void stopIo (); public native boolean isIoRunning (); public native void maybeNetwork (); public native void setConfig (String key, String value); public void setConfigInt (String key, int value) { setConfig(key, Integer.toString(value)); } public native boolean setConfigFromQr (String qr); public native String getConfig (String key); public int getConfigInt (String key) { try{return Integer.parseInt(getConfig(key));} catch(Exception e) {} return 0; } @Deprecated public String getConfig (String key, String def) { return getConfig(key); } @Deprecated public int getConfigInt (String key, int def) { return getConfigInt(key); } public native String getInfo (); public native String getOauth2Url (String addr, String redirectUrl); public native String initiateKeyTransfer (); public native boolean continueKeyTransfer (int msg_id, String setup_code); public native void imex (int what, String dir); public native String imexHasBackup (String dir); public native boolean mayBeValidAddr (String addr); public native int lookupContactIdByAddr(String addr); public native int[] getContacts (int flags, String query); public native int getBlockedCount (); public native int[] getBlockedContacts (); public @NonNull DcContact getContact (int contact_id) { return new DcContact(getContactCPtr(contact_id)); } public native int createContact (String name, String addr); public native void blockContact (int id, int block); public native String getContactEncrInfo (int contact_id); public native boolean deleteContact (int id); public native int addAddressBook (String adrbook); public @NonNull DcChatlist getChatlist (int listflags, String query, int queryId) { return new DcChatlist(getChatlistCPtr(listflags, query, queryId)); } public @NonNull DcChat getChat (int chat_id) { return new DcChat(getChatCPtr(chat_id)); } public native void markseenMsgs (int msg_ids[]); public native void marknoticedChat (int chat_id); public native void marknoticedContact (int contact_id); public native void setChatVisibility (int chat_id, int visibility); public native int getChatIdByContactId (int contact_id); public native int createChatByContactId(int contact_id); public native int createChatByMsgId (int msg_id); public native int createGroupChat (boolean verified, String name); public native boolean isContactInChat (int chat_id, int contact_id); public native int addContactToChat (int chat_id, int contact_id); public native int removeContactFromChat(int chat_id, int contact_id); public native void setDraft (int chat_id, DcMsg msg/*null=delete*/); public @Nullable DcMsg getDraft (int chat_id) { return new DcMsg(getDraftCPtr(chat_id)); } public native int setChatName (int chat_id, String name); public native int setChatProfileImage (int chat_id, String name); public native int[] getChatMsgs (int chat_id, int flags, int marker1before); public native int[] searchMsgs (int chat_id, String query); public native int[] getFreshMsgs (); public native int[] getChatMedia (int chat_id, int type1, int type2, int type3); public native int getNextMedia (int msg_id, int dir, int type1, int type2, int type3); public native int[] getChatContacts (int chat_id); public native int getChatEphemeralTimer (int chat_id); public native boolean setChatEphemeralTimer (int chat_id, int timer); public native boolean setChatMuteDuration (int chat_id, long duration); public native void deleteChat (int chat_id); public @NonNull DcMsg getMsg (int msg_id) { return new DcMsg(getMsgCPtr(msg_id)); } public native String getMsgInfo (int id); public native int getFreshMsgCount (int chat_id); public native int estimateDeletionCount(boolean from_server, long seconds); public native void deleteMsgs (int msg_ids[]); public native void forwardMsgs (int msg_ids[], int chat_id); public native int prepareMsg (int chat_id, DcMsg msg); public native int sendMsg (int chat_id, DcMsg msg); public native int sendTextMsg (int chat_id, String text); public native int sendVideochatInvitation(int chat_id); public native int addDeviceMsg (String label, DcMsg msg); public native boolean wasDeviceMsgEverAdded(String label); public native void updateDeviceChats (); public @NonNull DcLot checkQr (String qr) { return new DcLot(checkQrCPtr(qr)); } public native String getSecurejoinQr (int chat_id); public native int joinSecurejoin (String qr); public native void sendLocationsToChat (int chat_id, int seconds); public native boolean isSendingLocationsToChat(int chat_id); public @NonNull DcArray getLocations (int chat_id, int contact_id, long timestamp_start, long timestamp_end) { return new DcArray(getLocationsCPtr(chat_id, contact_id, timestamp_start, timestamp_end)); } public native void deleteAllLocations (); public @Nullable DcProvider getProviderFromEmail (String email) { long cptr = getProviderFromEmailCPtr(email); return cptr!=0 ? new DcProvider(cptr) : null; } /** * @return true if at least one chat has location streaming enabled */ public native boolean setLocation (float latitude, float longitude, float accuracy); // helper to get/return strings from/to handleEvent() public native static boolean data2IsString(int event); // working with raw c-data private long contextCPtr; // CAVE: the name is referenced in the JNI private native long createContextCPtr(String osName, String dbfile); private native void unrefContextCPtr (); private native long getEventEmitterCPtr(); public native long createMsgCPtr (int viewtype); private native long getChatlistCPtr (int listflags, String query, int queryId); private native long getChatCPtr (int chat_id); private native long getMsgCPtr (int id); private native long getDraftCPtr (int id); private native long getContactCPtr (int id); private native long getLocationsCPtr (int chat_id, int contact_id, long timestamp_start, long timestamp_end); private native long checkQrCPtr (String qr); private native long getProviderFromEmailCPtr (String addr); }
{'repo_name': 'deltachat/deltachat-android', 'stars': '549', 'repo_language': 'Java', 'file_name': 'config', 'mime_type': 'text/plain', 'hash': 8696381366733588019, 'source_dataset': 'data'}
import amqpstorm from amqpstorm.tests.functional.utility import TestFunctionalFramework from amqpstorm.tests.functional.utility import setup class ExchangeFunctionalTests(TestFunctionalFramework): @setup(exchange=True) def test_functional_exchange_declare(self): self.channel.exchange.declare(self.exchange_name, passive=False, durable=True, auto_delete=True) self.assertEqual({}, self.channel.exchange.declare(self.exchange_name, passive=True)) @setup(exchange=True) def test_functional_exchange_delete(self): self.channel.exchange.declare(self.exchange_name) self.channel.exchange.delete(self.exchange_name, if_unused=True) self.assertRaises(amqpstorm.AMQPChannelError, self.channel.exchange.declare, self.exchange_name, passive=True) @setup(exchange=True, override_names=['exchange1', 'exchange2']) def test_functional_exchange_bind(self): self.channel.exchange.declare('exchange1') self.channel.exchange.declare('exchange2') self.assertEqual(self.channel.exchange.bind('exchange1', 'exchange2', 'routing_key'), {}) @setup(exchange=True, override_names=['exchange1', 'exchange2']) def test_functional_exchange_unbind(self): self.channel.exchange.declare('exchange1') self.channel.exchange.declare('exchange2') self.channel.exchange.bind('exchange1', 'exchange2', 'routing_key') self.assertEqual(self.channel.exchange.unbind('exchange1', 'exchange2', 'routing_key'), {})
{'repo_name': 'eandersson/amqpstorm', 'stars': '116', 'repo_language': 'Python', 'file_name': 'channel.rst', 'mime_type': 'text/plain', 'hash': -3147780201870214816, 'source_dataset': 'data'}
// Copyright 2018 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.exec; import static java.util.stream.Collectors.joining; import com.google.auto.value.AutoValue; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Lists; import com.google.devtools.build.lib.actions.ActionContext; import com.google.devtools.build.lib.actions.DynamicStrategyRegistry; import com.google.devtools.build.lib.actions.SandboxedSpawnStrategy; import com.google.devtools.build.lib.actions.Spawn; import com.google.devtools.build.lib.actions.SpawnStrategy; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventHandler; import com.google.devtools.build.lib.events.Reporter; import com.google.devtools.build.lib.server.FailureDetails; import com.google.devtools.build.lib.server.FailureDetails.ExecutionOptions.Code; import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; import com.google.devtools.build.lib.util.AbruptExitException; import com.google.devtools.build.lib.util.DetailedExitCode; import com.google.devtools.build.lib.util.RegexFilter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Nullable; /** * Registry that collects spawn strategies and rules about their applicability and makes them * available for querying through various registry interfaces. * * <p>An instance of this registry can be created using its {@linkplain Builder builder}, which is * available to Blaze modules during server startup. */ public final class SpawnStrategyRegistry implements DynamicStrategyRegistry, ActionContext, RemoteLocalFallbackRegistry { private final ImmutableListMultimap<String, SpawnStrategy> mnemonicToStrategies; private final ImmutableListMultimap<RegexFilter, SpawnStrategy> filterToStrategies; private final ImmutableList<? extends SpawnStrategy> defaultStrategies; private final ImmutableMultimap<String, SandboxedSpawnStrategy> mnemonicToRemoteDynamicStrategies; private final ImmutableMultimap<String, SandboxedSpawnStrategy> mnemonicToLocalDynamicStrategies; @Nullable private final AbstractSpawnStrategy remoteLocalFallbackStrategy; private SpawnStrategyRegistry( ImmutableListMultimap<String, SpawnStrategy> mnemonicToStrategies, ImmutableListMultimap<RegexFilter, SpawnStrategy> filterToStrategies, ImmutableList<? extends SpawnStrategy> defaultStrategies, ImmutableMultimap<String, SandboxedSpawnStrategy> mnemonicToRemoteDynamicStrategies, ImmutableMultimap<String, SandboxedSpawnStrategy> mnemonicToLocalDynamicStrategies, @Nullable AbstractSpawnStrategy remoteLocalFallbackStrategy) { this.mnemonicToStrategies = mnemonicToStrategies; this.filterToStrategies = filterToStrategies; this.defaultStrategies = defaultStrategies; this.mnemonicToRemoteDynamicStrategies = mnemonicToRemoteDynamicStrategies; this.mnemonicToLocalDynamicStrategies = mnemonicToLocalDynamicStrategies; this.remoteLocalFallbackStrategy = remoteLocalFallbackStrategy; } /** * Returns the strategies applying to the given spawn, in priority order. * * <p>Which strategies are returned is based on the precedence as documented on the construction * methods of {@linkplain Builder this registry's builder}. * * <p>If the reason for selecting the context is worth mentioning to the user, logs a message * using the given {@link Reporter}. */ @VisibleForTesting public List<? extends SpawnStrategy> getStrategies(Spawn spawn, EventHandler reporter) { // Don't override test strategies by --strategy_regexp for backwards compatibility. if (spawn.getResourceOwner() != null && !"TestRunner".equals(spawn.getMnemonic())) { String description = spawn.getResourceOwner().getProgressMessage(); if (description != null) { for (Map.Entry<RegexFilter, Collection<SpawnStrategy>> filterStrategies : filterToStrategies.asMap().entrySet()) { if (filterStrategies.getKey().isIncluded(description)) { // TODO(schmitt): Why is this done here and not after running canExec? reporter.handle( Event.progress(description + " with context " + filterStrategies.getValue())); return ImmutableList.copyOf(filterStrategies.getValue()); } } } } if (mnemonicToStrategies.containsKey(spawn.getMnemonic())) { return mnemonicToStrategies.get(spawn.getMnemonic()); } return defaultStrategies; } @Override public void notifyUsedDynamic(ActionContext.ActionContextRegistry actionContextRegistry) { for (SandboxedSpawnStrategy strategy : mnemonicToLocalDynamicStrategies.values()) { strategy.usedContext(actionContextRegistry); } for (SandboxedSpawnStrategy strategy : mnemonicToRemoteDynamicStrategies.values()) { strategy.usedContext(actionContextRegistry); } } @Override public List<SandboxedSpawnStrategy> getDynamicSpawnActionContexts( Spawn spawn, DynamicMode dynamicMode) { ImmutableMultimap<String, SandboxedSpawnStrategy> mnemonicToDynamicStrategies = dynamicMode == DynamicStrategyRegistry.DynamicMode.REMOTE ? mnemonicToRemoteDynamicStrategies : mnemonicToLocalDynamicStrategies; return ImmutableList.<SandboxedSpawnStrategy>builder() .addAll(mnemonicToDynamicStrategies.get(spawn.getMnemonic())) .addAll(mnemonicToDynamicStrategies.get("")) .build(); } @Nullable @Override public AbstractSpawnStrategy getRemoteLocalFallbackStrategy() { return remoteLocalFallbackStrategy; } /** * Notifies all (non-dynamic) strategies stored in this registry that they are {@linkplain * SpawnStrategy#usedContext used}. */ public void notifyUsed(ActionContext.ActionContextRegistry actionContextRegistry) { for (SpawnStrategy strategy : filterToStrategies.values()) { strategy.usedContext(actionContextRegistry); } for (SpawnStrategy strategy : mnemonicToStrategies.values()) { strategy.usedContext(actionContextRegistry); } for (SpawnStrategy strategy : defaultStrategies) { strategy.usedContext(actionContextRegistry); } if (remoteLocalFallbackStrategy != null) { remoteLocalFallbackStrategy.usedContext(actionContextRegistry); } } /** * Records the list of all spawn strategies that can be returned by the various query methods of * this registry to the given reporter. */ void writeSpawnStrategiesTo(Reporter reporter) { for (Map.Entry<String, Collection<SpawnStrategy>> entry : mnemonicToStrategies.asMap().entrySet()) { reporter.handle( Event.info( String.format( "MnemonicToStrategyImplementations: \"%s\" = [%s]", entry.getKey(), toImplementationNames(entry.getValue())))); } for (Map.Entry<RegexFilter, Collection<SpawnStrategy>> entry : filterToStrategies.asMap().entrySet()) { Collection<SpawnStrategy> value = entry.getValue(); reporter.handle( Event.info( String.format( "FilterToStrategyImplementations: \"%s\" = [%s]", entry.getKey(), toImplementationNames(value)))); } reporter.handle( Event.info( String.format( "DefaultStrategyImplementations: [%s]", toImplementationNames(defaultStrategies)))); if (remoteLocalFallbackStrategy != null) { reporter.handle( Event.info( String.format( "RemoteLocalFallbackImplementation: [%s]", remoteLocalFallbackStrategy.getClass().getSimpleName()))); } for (Map.Entry<String, Collection<SandboxedSpawnStrategy>> entry : mnemonicToRemoteDynamicStrategies.asMap().entrySet()) { reporter.handle( Event.info( String.format( "MnemonicToRemoteDynamicStrategyImplementations: \"%s\" = [%s]", entry.getKey(), toImplementationNames(entry.getValue())))); } for (Map.Entry<String, Collection<SandboxedSpawnStrategy>> entry : mnemonicToLocalDynamicStrategies.asMap().entrySet()) { reporter.handle( Event.info( String.format( "MnemonicToLocalDynamicStrategyImplementations: \"%s\" = [%s]", entry.getKey(), toImplementationNames(entry.getValue())))); } } private String toImplementationNames(Collection<?> strategies) { return strategies.stream() .map(strategy -> strategy.getClass().getSimpleName()) .collect(joining(", ")); } /** Returns a new {@link Builder} suitable for creating instances of SpawnStrategyRegistry. */ public static Builder builder() { return new Builder(); } /** * Builder collecting the strategies and restrictions thereon for a {@link SpawnStrategyRegistry}. * * <p>To {@linkplain SpawnStrategyRegistry#getStrategies match a strategy to a spawn} it needs to * be both {@linkplain #registerStrategy registered} and its registered command-line identifier * has to match {@linkplain #addDescriptionFilter a filter on the spawn's progress message}, * {@linkplain #addMnemonicFilter a filter on the spawn's mnemonic} or be part of the default * strategies (see below). * * <p><strong>Default strategies</strong> are either {@linkplain #setDefaultStrategies set * explicitly} or, if {@link #setDefaultStrategies} is not called on this builder, comprised of * all registered strategies, in registration order (i.e. the earliest strategy registered will be * first in the list of strategies returned by {@link SpawnStrategyRegistry#getStrategies}). */ public static final class Builder { private ImmutableList<String> explicitDefaultStrategies = ImmutableList.of(); // TODO(schmitt): Using a list and autovalue so as to be able to reverse order while legacy sort // is supported. Can be converted to same as mnemonics once legacy behavior is removed. private final List<FilterAndIdentifiers> filterAndIdentifiers = new ArrayList<>(); private final HashMap<String, SpawnStrategy> identifierToStrategy = new HashMap<>(); private final ArrayList<SpawnStrategy> strategiesInRegistrationOrder = new ArrayList<>(); // Using List values here rather than multimaps as there is no need for the latter's // functionality: The values are always replaced as a whole, no adding/creation required. private final HashMap<String, List<String>> mnemonicToIdentifiers = new HashMap<>(); private final HashMap<String, List<String>> mnemonicToRemoteIdentifiers = new HashMap<>(); private final HashMap<String, List<String>> mnemonicToLocalIdentifiers = new HashMap<>(); private boolean legacyFilterIterationOrder = false; @Nullable private String remoteLocalFallbackStrategyIdentifier; /** * Adds a filter limiting any spawn whose {@linkplain * com.google.devtools.build.lib.actions.ActionExecutionMetadata#getProgressMessage() owner's * progress message} matches the regular expression to only use strategies with the given * command-line identifiers, in order. * * <p>If multiple filters match the same spawn (including an identical filter) the order of * precedence of calls to this method is determined by {@link * #useLegacyDescriptionFilterPrecedence()}. */ public Builder addDescriptionFilter(RegexFilter filter, List<String> identifiers) { filterAndIdentifiers.add( new AutoValue_SpawnStrategyRegistry_FilterAndIdentifiers( filter, ImmutableList.copyOf(identifiers))); return this; } /** * Adds a filter limiting any spawn whose {@linkplain Spawn#getMnemonic() mnemonic} * (case-sensitively) matches the given mnemonic to only use strategies with the given * command-line identifiers, in order. * * <p>If the same mnemonic is registered multiple times the last such call will take precedence. * * <p>Note that if a spawn matches a {@linkplain #addDescriptionFilter registered description * filter} that filter will take precedence over any mnemonic-based filters. */ // last one wins public Builder addMnemonicFilter(String mnemonic, List<String> identifiers) { mnemonicToIdentifiers.put(mnemonic, identifiers); return this; } /** * Registers a strategy implementation with this collector, distinguishing it from other * strategies with the given command-line identifiers (of which at least one is required). * * <p>If multiple strategies are registered with the same command-line identifier the last one * so registered will take precedence. */ public Builder registerStrategy(SpawnStrategy strategy, List<String> commandlineIdentifiers) { Preconditions.checkArgument( commandlineIdentifiers.size() >= 1, "At least one commandLineIdentifier must be given"); for (String identifier : commandlineIdentifiers) { identifierToStrategy.put(identifier, strategy); } strategiesInRegistrationOrder.add(strategy); return this; } public Builder registerStrategy(SpawnStrategy strategy, String... commandlineIdentifiers) { return registerStrategy(strategy, ImmutableList.copyOf(commandlineIdentifiers)); } /** * Instructs this collector to use the legacy description filter precedence, i.e. to prefer the * first regular expression filter that matches a spawn over any later registered filters. * * <p>The default behavior of this collector is to prefer the last registered description filter * over any previously registered matching filters. */ public Builder useLegacyDescriptionFilterPrecedence() { legacyFilterIterationOrder = true; return this; } /** * Explicitly sets the identifiers of default strategies to use if a spawn matches no filters. * * <p>Note that if this method is not called on the builder, all registered strategies are * considered default strategies, in registration order. See also the {@linkplain Builder class * documentation}. */ public Builder setDefaultStrategies(List<String> defaultStrategies) { // Ensure there are actual strategies and the contents are not empty. Preconditions.checkArgument(!defaultStrategies.isEmpty()); Preconditions.checkArgument( defaultStrategies.stream().anyMatch(strategy -> !"".equals(strategy))); this.explicitDefaultStrategies = ImmutableList.copyOf(defaultStrategies); return this; } /** * Reset the default strategies (see {@link #setDefaultStrategies}) to the reverse of the order * they were registered in. */ public Builder resetDefaultStrategies() { this.explicitDefaultStrategies = ImmutableList.of(); return this; } /** * Sets the strategy names to use in the remote branch of dynamic execution for a given action * mnemonic. * * <p>During execution, each strategy is {@linkplain SpawnStrategy#canExec(Spawn, * ActionContextRegistry) asked} whether it can execute a given Spawn. The first strategy in the * list that says so will get the job. */ public Builder addDynamicRemoteStrategiesByMnemonic(String mnemonic, List<String> strategies) { mnemonicToRemoteIdentifiers.put(mnemonic, strategies); return this; } /** * Sets the strategy names to use in the local branch of dynamic execution for a given action * mnemonic. * * <p>During execution, each strategy is {@linkplain SpawnStrategy#canExec(Spawn, * ActionContextRegistry) asked} whether it can execute a given Spawn. The first strategy in the * list that says so will get the job. */ public Builder addDynamicLocalStrategiesByMnemonic(String mnemonic, List<String> strategies) { mnemonicToLocalIdentifiers.put(mnemonic, strategies); return this; } /** * Sets the commandline identifier of the strategy to be used when falling back from remote to * local execution. * * <p>Note that this is an optional setting, if not provided {@link * SpawnStrategyRegistry#getRemoteLocalFallbackStrategy()} will return {@code null}. If the * value <b>is</b> provided it must match the commandline identifier of a registered strategy * (at {@linkplain #build build} time). */ public Builder setRemoteLocalFallbackStrategyIdentifier(String commandlineIdentifier) { this.remoteLocalFallbackStrategyIdentifier = commandlineIdentifier; return this; } /** * Finalizes the construction of the registry. * * @throws AbruptExitException if a strategy command-line identifier was used in a filter or the * default strategies but no strategy for that identifier was registered */ public SpawnStrategyRegistry build() throws AbruptExitException { List<FilterAndIdentifiers> orderedFilterAndIdentifiers = filterAndIdentifiers; if (!legacyFilterIterationOrder) { orderedFilterAndIdentifiers = Lists.reverse(filterAndIdentifiers); } ListMultimap<RegexFilter, SpawnStrategy> filterToStrategies = LinkedListMultimap.create(); for (FilterAndIdentifiers filterAndIdentifier : orderedFilterAndIdentifiers) { RegexFilter filter = filterAndIdentifier.filter(); filterToStrategies.putAll(filter, toStrategies(filterAndIdentifier.identifiers(), filter)); } ImmutableListMultimap.Builder<String, SpawnStrategy> mnemonicToStrategies = new ImmutableListMultimap.Builder<>(); for (Map.Entry<String, List<String>> entry : mnemonicToIdentifiers.entrySet()) { mnemonicToStrategies.putAll( entry.getKey(), toStrategies(entry.getValue(), "mnemonic " + entry.getKey())); } ImmutableListMultimap.Builder<String, SandboxedSpawnStrategy> mnemonicToLocalStrategies = new ImmutableListMultimap.Builder<>(); for (Map.Entry<String, List<String>> entry : mnemonicToLocalIdentifiers.entrySet()) { mnemonicToLocalStrategies.putAll( entry.getKey(), toSandboxedStrategies(entry.getValue(), "local mnemonic " + entry.getKey())); } ImmutableListMultimap.Builder<String, SandboxedSpawnStrategy> mnemonicToRemoteStrategies = new ImmutableListMultimap.Builder<>(); for (Map.Entry<String, List<String>> entry : mnemonicToRemoteIdentifiers.entrySet()) { mnemonicToRemoteStrategies.putAll( entry.getKey(), toSandboxedStrategies(entry.getValue(), "remote mnemonic " + entry.getKey())); } AbstractSpawnStrategy remoteLocalFallbackStrategy = null; if (remoteLocalFallbackStrategyIdentifier != null) { SpawnStrategy strategy = toStrategy("remote fallback strategy", remoteLocalFallbackStrategyIdentifier); if (!(strategy instanceof AbstractSpawnStrategy)) { // TODO(schmitt): Check if all strategies can use the same base and remove check if so. throw createExitException( String.format( "'%s' was requested for the remote fallback strategy but is not an" + " abstract spawn strategy (which is required for remote" + " fallback execution).", strategy.getClass().getSimpleName()), Code.REMOTE_FALLBACK_STRATEGY_NOT_ABSTRACT_SPAWN); } remoteLocalFallbackStrategy = (AbstractSpawnStrategy) strategy; } ImmutableList<? extends SpawnStrategy> defaultStrategies; if (explicitDefaultStrategies.isEmpty()) { // Use the strategies as registered, in reverse order. defaultStrategies = ImmutableList.copyOf(Lists.reverse(strategiesInRegistrationOrder)); } else { defaultStrategies = toStrategies(explicitDefaultStrategies, "default strategies"); } return new SpawnStrategyRegistry( mnemonicToStrategies.build(), ImmutableListMultimap.copyOf(filterToStrategies), defaultStrategies, mnemonicToRemoteStrategies.build(), mnemonicToLocalStrategies.build(), remoteLocalFallbackStrategy); } private ImmutableList<? extends SpawnStrategy> toStrategies( List<String> identifiers, Object requestName) throws AbruptExitException { ImmutableList.Builder<SpawnStrategy> strategies = ImmutableList.builder(); for (String identifier : identifiers) { if (identifier.isEmpty()) { continue; } strategies.add(toStrategy(requestName, identifier)); } return strategies.build(); } private SpawnStrategy toStrategy(Object requestName, String identifier) throws AbruptExitException { SpawnStrategy strategy = identifierToStrategy.get(identifier); if (strategy == null) { throw createExitException( String.format( "'%s' was requested for %s but no strategy with that identifier was registered. " + "Valid values are: [%s]", identifier, requestName, Joiner.on(", ").join(identifierToStrategy.keySet())), Code.STRATEGY_NOT_FOUND); } return strategy; } private Iterable<? extends SandboxedSpawnStrategy> toSandboxedStrategies( List<String> identifiers, Object requestName) throws AbruptExitException { Iterable<? extends SpawnStrategy> strategies = toStrategies(identifiers, requestName); for (SpawnStrategy strategy : strategies) { if (!(strategy instanceof SandboxedSpawnStrategy)) { throw createExitException( String.format( "'%s' was requested for %s but is not a sandboxed strategy (which is required for" + " dynamic execution).", strategy.getClass().getSimpleName(), requestName), Code.DYNAMIC_STRATEGY_NOT_SANDBOXED); } } @SuppressWarnings("unchecked") // Each element of the iterable was checked to fulfil this. Iterable<? extends SandboxedSpawnStrategy> sandboxedStrategies = (Iterable<? extends SandboxedSpawnStrategy>) strategies; return sandboxedStrategies; } } private static AbruptExitException createExitException(String message, Code detailedCode) { return new AbruptExitException( DetailedExitCode.of( FailureDetail.newBuilder() .setMessage(message) .setExecutionOptions( FailureDetails.ExecutionOptions.newBuilder().setCode(detailedCode)) .build())); } @AutoValue abstract static class FilterAndIdentifiers { abstract RegexFilter filter(); abstract ImmutableList<String> identifiers(); } }
{'repo_name': 'bazelbuild/bazel', 'stars': '15030', 'repo_language': 'Java', 'file_name': 'BUILD', 'mime_type': 'text/plain', 'hash': 8682481748782727849, 'source_dataset': 'data'}
// RUN: %{ispc} %s --target=avx2-i32x4 --nowrap -O0 --emit-llvm-text -o - | FileCheck %s // REQUIRES: X86_ENABLED // CHECK: [[PRTARG_PTR_BITCAST:%[a-zA-Z0-9_.]+]] = bitcast [1 x i8*]* [[PRTARG_PTR:%[a-zA-Z0-9_.]+]] to i8** // CHECK: [[PRTARG_BITCAST:%[a-zA-Z0-9_.]+]] = bitcast <4 x i32>* {{%[a-zA-Z0-9_.]+}} to i8* // CHECK: [[SCT_OFF:%[a-zA-Z0-9_.]+]] = getelementptr [1 x i8*], [1 x i8*]* [[PRTARG_PTR]], i32 0, i32 0 // CHECK: store i8* [[PRTARG_BITCAST]], i8** [[SCT_OFF]] // CHECK: __do_print(i8* {{%[a-zA-Z0-9_.]+}}, i8* {{%[a-zA-Z0-9_.]+}}, i32 4, i64 {{%[a-zA-Z0-9_.]+}}, i8** [[PRTARG_PTR_BITCAST]]) void foo(bool bool_var) { print("\n bool_var = %\n", bool_var); }
{'repo_name': 'ispc/ispc', 'stars': '1599', 'repo_language': 'C++', 'file_name': 'FixWindowsPath.cmake', 'mime_type': 'text/plain', 'hash': -2987120439431734622, 'source_dataset': 'data'}
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ import * as msRest from "@azure/ms-rest-js"; import * as msRestAzure from "@azure/ms-rest-azure-js"; import * as Models from "../models"; import * as Mappers from "../models/accountsMappers"; import * as Parameters from "../models/parameters"; import { AzureNetAppFilesManagementClientContext } from "../azureNetAppFilesManagementClientContext"; /** Class representing a Accounts. */ export class Accounts { private readonly client: AzureNetAppFilesManagementClientContext; /** * Create a Accounts. * @param {AzureNetAppFilesManagementClientContext} client Reference to the service client. */ constructor(client: AzureNetAppFilesManagementClientContext) { this.client = client; } /** * List and describe all NetApp accounts in the resource group. * @summary Describe all NetApp Accounts in a resource group * @param resourceGroupName The name of the resource group. * @param [options] The optional parameters * @returns Promise<Models.AccountsListResponse> */ list(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise<Models.AccountsListResponse>; /** * @param resourceGroupName The name of the resource group. * @param callback The callback */ list(resourceGroupName: string, callback: msRest.ServiceCallback<Models.NetAppAccountList>): void; /** * @param resourceGroupName The name of the resource group. * @param options The optional parameters * @param callback The callback */ list(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.NetAppAccountList>): void; list(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.NetAppAccountList>, callback?: msRest.ServiceCallback<Models.NetAppAccountList>): Promise<Models.AccountsListResponse> { return this.client.sendOperationRequest( { resourceGroupName, options }, listOperationSpec, callback) as Promise<Models.AccountsListResponse>; } /** * Get the NetApp account * @summary Describe a NetApp Account * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<Models.AccountsGetResponse> */ get(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<Models.AccountsGetResponse>; /** * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param callback The callback */ get(resourceGroupName: string, accountName: string, callback: msRest.ServiceCallback<Models.NetAppAccount>): void; /** * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param options The optional parameters * @param callback The callback */ get(resourceGroupName: string, accountName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.NetAppAccount>): void; get(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.NetAppAccount>, callback?: msRest.ServiceCallback<Models.NetAppAccount>): Promise<Models.AccountsGetResponse> { return this.client.sendOperationRequest( { resourceGroupName, accountName, options }, getOperationSpec, callback) as Promise<Models.AccountsGetResponse>; } /** * Create or update the specified NetApp account within the resource group * @summary Create or update a NetApp account * @param body NetApp Account object supplied in the body of the operation. * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<Models.AccountsCreateOrUpdateResponse> */ createOrUpdate(body: Models.NetAppAccount, resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<Models.AccountsCreateOrUpdateResponse> { return this.beginCreateOrUpdate(body,resourceGroupName,accountName,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise<Models.AccountsCreateOrUpdateResponse>; } /** * Delete the specified NetApp account * @summary Delete a NetApp account * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<msRest.RestResponse> */ deleteMethod(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<msRest.RestResponse> { return this.beginDeleteMethod(resourceGroupName,accountName,options) .then(lroPoller => lroPoller.pollUntilFinished()); } /** * Patch the specified NetApp account * @summary Update a NetApp account * @param body NetApp Account object supplied in the body of the operation. * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<Models.AccountsUpdateResponse> */ update(body: Models.NetAppAccountPatch, resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<Models.AccountsUpdateResponse> { return this.beginUpdate(body,resourceGroupName,accountName,options) .then(lroPoller => lroPoller.pollUntilFinished()) as Promise<Models.AccountsUpdateResponse>; } /** * Create or update the specified NetApp account within the resource group * @summary Create or update a NetApp account * @param body NetApp Account object supplied in the body of the operation. * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<msRestAzure.LROPoller> */ beginCreateOrUpdate(body: Models.NetAppAccount, resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<msRestAzure.LROPoller> { return this.client.sendLRORequest( { body, resourceGroupName, accountName, options }, beginCreateOrUpdateOperationSpec, options); } /** * Delete the specified NetApp account * @summary Delete a NetApp account * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<msRestAzure.LROPoller> */ beginDeleteMethod(resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<msRestAzure.LROPoller> { return this.client.sendLRORequest( { resourceGroupName, accountName, options }, beginDeleteMethodOperationSpec, options); } /** * Patch the specified NetApp account * @summary Update a NetApp account * @param body NetApp Account object supplied in the body of the operation. * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account * @param [options] The optional parameters * @returns Promise<msRestAzure.LROPoller> */ beginUpdate(body: Models.NetAppAccountPatch, resourceGroupName: string, accountName: string, options?: msRest.RequestOptionsBase): Promise<msRestAzure.LROPoller> { return this.client.sendLRORequest( { body, resourceGroupName, accountName, options }, beginUpdateOperationSpec, options); } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const listOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts", urlParameters: [ Parameters.subscriptionId, Parameters.resourceGroupName ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.NetAppAccountList }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const getOperationSpec: msRest.OperationSpec = { httpMethod: "GET", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", urlParameters: [ Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 200: { bodyMapper: Mappers.NetAppAccount }, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { httpMethod: "PUT", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", urlParameters: [ Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "body", mapper: { ...Mappers.NetAppAccount, required: true } }, responses: { 200: { bodyMapper: Mappers.NetAppAccount }, 201: { bodyMapper: Mappers.NetAppAccount }, 202: {}, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginDeleteMethodOperationSpec: msRest.OperationSpec = { httpMethod: "DELETE", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", urlParameters: [ Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], responses: { 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, serializer }; const beginUpdateOperationSpec: msRest.OperationSpec = { httpMethod: "PATCH", path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", urlParameters: [ Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.accountName ], queryParameters: [ Parameters.apiVersion ], headerParameters: [ Parameters.acceptLanguage ], requestBody: { parameterPath: "body", mapper: { ...Mappers.NetAppAccountPatch, required: true } }, responses: { 200: { bodyMapper: Mappers.NetAppAccount }, 201: { bodyMapper: Mappers.NetAppAccount }, 202: {}, default: { bodyMapper: Mappers.CloudError } }, serializer };
{'repo_name': 'Azure/azure-sdk-for-js', 'stars': '574', 'repo_language': 'TypeScript', 'file_name': 'identity.api.md', 'mime_type': 'text/x-java', 'hash': 6151328080478447133, 'source_dataset': 'data'}
// Aseprite // Copyright (C) 2001-2015 David Capello // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "app/commands/command.h" #include "app/context.h" #include "app/context_access.h" #include "app/document.h" #include "app/launcher.h" namespace app { class OpenInFolderCommand : public Command { public: OpenInFolderCommand(); Command* clone() const override { return new OpenInFolderCommand(*this); } protected: bool onEnabled(Context* context) override; void onExecute(Context* context) override; }; OpenInFolderCommand::OpenInFolderCommand() : Command("OpenInFolder", "Open In Folder", CmdUIOnlyFlag) { } bool OpenInFolderCommand::onEnabled(Context* context) { const ContextReader reader(context); return reader.document() && reader.document()->isAssociatedToFile(); } void OpenInFolderCommand::onExecute(Context* context) { launcher::open_folder(context->activeDocument()->filename()); } Command* CommandFactory::createOpenInFolderCommand() { return new OpenInFolderCommand; } } // namespace app
{'repo_name': 'LibreSprite/LibreSprite', 'stars': '795', 'repo_language': 'C++', 'file_name': 'modp_b64_data.h', 'mime_type': 'text/x-c', 'hash': -2005535529746962561, 'source_dataset': 'data'}
module github.com/grpc-ecosystem/go-grpc-middleware require ( github.com/go-kit/kit v0.9.0 github.com/go-logfmt/logfmt v0.4.0 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/gogo/protobuf v1.2.1 github.com/golang/protobuf v1.3.2 github.com/opentracing/opentracing-go v1.1.0 github.com/pkg/errors v0.8.1 // indirect github.com/sirupsen/logrus v1.4.2 github.com/stretchr/testify v1.4.0 go.uber.org/atomic v1.4.0 // indirect go.uber.org/multierr v1.1.0 // indirect go.uber.org/zap v1.10.0 golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect google.golang.org/grpc v1.19.0 ) go 1.13
{'repo_name': 'docker/cli', 'stars': '2265', 'repo_language': 'Go', 'file_name': 'docker_windows.go', 'mime_type': 'text/plain', 'hash': 264467541206548760, 'source_dataset': 'data'}
namespace WmiExplorer.Forms { partial class Form_Update { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.richTextBoxUpdate = new System.Windows.Forms.RichTextBox(); this.buttonCancelHidden = new System.Windows.Forms.Button(); this.SuspendLayout(); // // richTextBoxUpdate // this.richTextBoxUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.richTextBoxUpdate.BorderStyle = System.Windows.Forms.BorderStyle.None; this.richTextBoxUpdate.Cursor = System.Windows.Forms.Cursors.IBeam; this.richTextBoxUpdate.Location = new System.Drawing.Point(12, 12); this.richTextBoxUpdate.Name = "richTextBoxUpdate"; this.richTextBoxUpdate.ReadOnly = true; this.richTextBoxUpdate.Size = new System.Drawing.Size(471, 156); this.richTextBoxUpdate.TabIndex = 0; this.richTextBoxUpdate.Text = ""; this.richTextBoxUpdate.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxUpdate_LinkClicked); // // buttonCancelHidden // this.buttonCancelHidden.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.buttonCancelHidden.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonCancelHidden.Location = new System.Drawing.Point(193, 174); this.buttonCancelHidden.Name = "buttonCancelHidden"; this.buttonCancelHidden.Size = new System.Drawing.Size(100, 25); this.buttonCancelHidden.TabIndex = 1; this.buttonCancelHidden.Text = "OK"; this.buttonCancelHidden.UseVisualStyleBackColor = true; this.buttonCancelHidden.Click += new System.EventHandler(this.button1_Click); // // Form_Update // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoSize = true; this.CancelButton = this.buttonCancelHidden; this.ClientSize = new System.Drawing.Size(484, 211); this.Controls.Add(this.richTextBoxUpdate); this.Controls.Add(this.buttonCancelHidden); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form_Update"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "WMI Explorer Update"; this.ResumeLayout(false); } #endregion private System.Windows.Forms.RichTextBox richTextBoxUpdate; private System.Windows.Forms.Button buttonCancelHidden; } }
{'repo_name': 'vinaypamnani/wmie2', 'stars': '396', 'repo_language': 'C#', 'file_name': 'Resources.Designer.cs', 'mime_type': 'text/plain', 'hash': -4584814096290124058, 'source_dataset': 'data'}
How to use ---------- To embed the player in your web page, use the following XHTML syntax: --------------------------------------------------------------------------- <object width="0" height="0" type="application/x-shockwave-flash" data="asap.swf" id="asap"> <param name="movie" value="asap.swf" /> <param name="FlashVars" value="file=File.sap" /> </object> --------------------------------------------------------------------------- (tested with Internet Explorer 8, Firefox 3.5 and Chrome 3.0). The player will play the specified file. It doesn't display anything. The player understands the following parameters (in ampersand-separated `FlashVars`): - `file` - URL of the file to play - `song` - zero-based subsong number - `defaultPlaybackTime` - playback time for songs with unspecified duration, in the `"mm:ss.xxx"` format - `loopPlaybackTime` - playback time for songs marked as looping (use `"ONCE"` to stop playback when the loop starts) The player contains the following methods that can be called from JavaScript: - `setPlaybackTime(defaultPlaybackTime : String, loopPlaybackTime : String) : void` - sets playback times (see above) - `asapPlay(filename : String, song : int = -1) : void` - plays the specified song (-1 for default) - `asapStop() : void` - stops playback
{'repo_name': 'quarnster/boxeebox-xbmc', 'stars': '117', 'repo_language': 'C++', 'file_name': 'strings.po', 'mime_type': 'text/x-po', 'hash': -8052892941114296329, 'source_dataset': 'data'}
// Copyright (c) 2017-2018 Uber Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package handlers import ( "bytes" "encoding/json" "fmt" "net/http" "net/http/httptest" "testing" "github.com/gorilla/mux" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/uber/aresdb/controller/models" mutatorMocks "github.com/uber/aresdb/controller/mutators/mocks" metaCom "github.com/uber/aresdb/metastore/common" "go.uber.org/zap" ) func TestConfigHandler(t *testing.T) { var testServer *httptest.Server testJob := models.JobConfig{ Name: "demand", Version: 0, AresTableConfig: models.TableConfig{ Name: "demand_table", }, StreamingConfig: models.KafkaConfig{ Topic: "demand_topic1", Cluster: "demand_cluster", }, } testSchema := metaCom.Table{ Name: "", Columns: []metaCom.Column{ { Name: "col1", Type: "Int32", }, }, } logger, _ := zap.NewDevelopment() sugaredLogger := logger.Sugar() t.Run("Should work for GetJob endpoint", func(t *testing.T) { mockJobMutator := mutatorMocks.JobMutator{} mockSchemaMutator := mutatorMocks.TableSchemaMutator{} p := ConfigHandlerParams{ Logger: sugaredLogger, JobMutator: &mockJobMutator, SchemaMutator: &mockSchemaMutator, } jobHandler := NewConfigHandler(p) testRouter := mux.NewRouter() jobHandler.Register(testRouter.PathPrefix("/config").Subrouter()) testServer = httptest.NewUnstartedServer(testRouter) testServer.Start() mockJobMutator.On("GetJob", "ns1", "job1").Return(testJob, nil) mockSchemaMutator.On("GetTable", "ns1", "demand_table").Return(&testSchema, nil) hostPort := testServer.Listener.Addr().String() resp, err := http.Get(fmt.Sprintf("http://%s/config/ns1/jobs/job1", hostPort)) assert.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) testServer.Close() }) t.Run("Should work for GetJobs request", func(t *testing.T) { mockJobMutator := mutatorMocks.JobMutator{} mockSchemaMutator := mutatorMocks.TableSchemaMutator{} p := ConfigHandlerParams{ Logger: sugaredLogger, JobMutator: &mockJobMutator, SchemaMutator: &mockSchemaMutator, } jobHandler := NewConfigHandler(p) testRouter := mux.NewRouter() jobHandler.Register(testRouter.PathPrefix("/config").Subrouter()) testServer = httptest.NewUnstartedServer(testRouter) testServer.Start() mockJobMutator.On("GetJobs", "ns1").Return([]models.JobConfig{testJob}, nil) mockSchemaMutator.On("GetTable", "ns1", "demand_table").Return(&testSchema, nil) hostPort := testServer.Listener.Addr().String() resp, err := http.Get(fmt.Sprintf("http://%s/config/ns1/jobs", hostPort)) assert.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) testServer.Close() }) t.Run("Should work for DeletaJob request", func(t *testing.T) { mockJobMutator := mutatorMocks.JobMutator{} p := ConfigHandlerParams{ Logger: sugaredLogger, JobMutator: &mockJobMutator, } jobHandler := NewConfigHandler(p) testRouter := mux.NewRouter() jobHandler.Register(testRouter.PathPrefix("/config").Subrouter()) testServer = httptest.NewUnstartedServer(testRouter) testServer.Start() mockJobMutator.On("DeleteJob", "ns1", "job1").Return(nil) hostPort := testServer.Listener.Addr().String() req, _ := http.NewRequest(http.MethodDelete, fmt.Sprintf("http://%s/config/ns1/jobs/%s", hostPort, "job1"), &bytes.Buffer{}) resp, err := http.DefaultClient.Do(req) assert.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) testServer.Close() }) t.Run("Should work for UpdateJob request", func(t *testing.T) { mockJobMutator := mutatorMocks.JobMutator{} p := ConfigHandlerParams{ Logger: sugaredLogger, JobMutator: &mockJobMutator, } jobHandler := NewConfigHandler(p) testRouter := mux.NewRouter() jobHandler.Register(testRouter.PathPrefix("/config").Subrouter()) testServer = httptest.NewUnstartedServer(testRouter) testServer.Start() testJobBytes, _ := json.Marshal(testJob) mockJobMutator.On("UpdateJob", "ns1", mock.Anything).Return(nil) hostPort := testServer.Listener.Addr().String() req, _ := http.NewRequest(http.MethodPut, fmt.Sprintf("http://%s/config/ns1/jobs/%s", hostPort, "job1"), bytes.NewBuffer(testJobBytes)) resp, err := http.DefaultClient.Do(req) assert.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) testServer.Close() }) t.Run("Should work for AddJob request", func(t *testing.T) { mockJobMutator := mutatorMocks.JobMutator{} p := ConfigHandlerParams{ Logger: sugaredLogger, JobMutator: &mockJobMutator, } jobHandler := NewConfigHandler(p) testRouter := mux.NewRouter() jobHandler.Register(testRouter.PathPrefix("/config").Subrouter()) testServer = httptest.NewUnstartedServer(testRouter) testServer.Start() jobBytes, _ := json.Marshal(testJob) mockJobMutator.On("AddJob", "ns1", mock.Anything).Return(nil) hostPort := testServer.Listener.Addr().String() resp, err := http.Post(fmt.Sprintf("http://%s/config/ns1/jobs", hostPort), "application/json", bytes.NewBuffer(jobBytes)) assert.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) testServer.Close() }) t.Run("Should work for GetHash request", func(t *testing.T) { mockJobMutator := mutatorMocks.JobMutator{} p := ConfigHandlerParams{ Logger: sugaredLogger, JobMutator: &mockJobMutator, } jobHandler := NewConfigHandler(p) testRouter := mux.NewRouter() jobHandler.Register(testRouter.PathPrefix("/config").Subrouter()) testServer = httptest.NewUnstartedServer(testRouter) testServer.Start() mockJobMutator.On("GetHash", "ns1").Return("someHash", nil) hostPort := testServer.Listener.Addr().String() resp, err := http.Get(fmt.Sprintf("http://%s/config/ns1/hash", hostPort)) assert.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) testServer.Close() }) }
{'repo_name': 'uber/aresdb', 'stars': '2360', 'repo_language': 'Go', 'file_name': 'config_test.go', 'mime_type': 'text/plain', 'hash': -886186803091258739, 'source_dataset': 'data'}
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.pinot.plugin.ingestion.batch.spark; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.pinot.plugin.ingestion.batch.common.SegmentPushUtils; import org.apache.pinot.spi.env.PinotConfiguration; import org.apache.pinot.spi.filesystem.PinotFS; import org.apache.pinot.spi.filesystem.PinotFSFactory; import org.apache.pinot.spi.ingestion.batch.runner.IngestionJobRunner; import org.apache.pinot.spi.ingestion.batch.spec.Constants; import org.apache.pinot.spi.ingestion.batch.spec.PinotFSSpec; import org.apache.pinot.spi.ingestion.batch.spec.SegmentGenerationJobSpec; import org.apache.pinot.spi.utils.retry.AttemptsExceededException; import org.apache.pinot.spi.utils.retry.RetriableOperationException; import org.apache.spark.SparkContext; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.VoidFunction; public class SparkSegmentUriPushJobRunner implements IngestionJobRunner, Serializable { private SegmentGenerationJobSpec _spec; public SparkSegmentUriPushJobRunner() { } public SparkSegmentUriPushJobRunner(SegmentGenerationJobSpec spec) { init(spec); } @Override public void init(SegmentGenerationJobSpec spec) { _spec = spec; if (_spec.getPushJobSpec() == null) { throw new RuntimeException("Missing PushJobSpec"); } } @Override public void run() { //init all file systems List<PinotFSSpec> pinotFSSpecs = _spec.getPinotFSSpecs(); for (PinotFSSpec pinotFSSpec : pinotFSSpecs) { PinotFSFactory.register(pinotFSSpec.getScheme(), pinotFSSpec.getClassName(), new PinotConfiguration(pinotFSSpec)); } //Get outputFS for writing output Pinot segments URI outputDirURI; try { outputDirURI = new URI(_spec.getOutputDirURI()); if (outputDirURI.getScheme() == null) { outputDirURI = new File(_spec.getOutputDirURI()).toURI(); } } catch (URISyntaxException e) { throw new RuntimeException("outputDirURI is not valid - '" + _spec.getOutputDirURI() + "'"); } PinotFS outputDirFS = PinotFSFactory.create(outputDirURI.getScheme()); //Get list of files to process String[] files; try { files = outputDirFS.listFiles(outputDirURI, true); } catch (IOException e) { throw new RuntimeException("Unable to list all files under outputDirURI - '" + outputDirURI + "'"); } List<String> segmentUris = new ArrayList<>(); for (String file : files) { URI uri = URI.create(file); if (uri.getPath().endsWith(Constants.TAR_GZ_FILE_EXT)) { URI updatedURI = SegmentPushUtils .generateSegmentTarURI(outputDirURI, uri, _spec.getPushJobSpec().getSegmentUriPrefix(), _spec.getPushJobSpec().getSegmentUriSuffix()); segmentUris.add(updatedURI.toString()); } } int pushParallelism = _spec.getPushJobSpec().getPushParallelism(); if (pushParallelism < 1) { pushParallelism = segmentUris.size(); } if (pushParallelism == 1) { // Push from driver try { SegmentPushUtils.sendSegmentUris(_spec, segmentUris); } catch (RetriableOperationException | AttemptsExceededException e) { throw new RuntimeException(e); } } else { JavaSparkContext sparkContext = JavaSparkContext.fromSparkContext(SparkContext.getOrCreate()); JavaRDD<String> pathRDD = sparkContext.parallelize(segmentUris, pushParallelism); // Prevent using lambda expression in Spark to avoid potential serialization exceptions, use inner function instead. pathRDD.foreach(new VoidFunction<String>() { @Override public void call(String segmentUri) throws Exception { try { SegmentPushUtils.sendSegmentUris(_spec, Arrays.asList(segmentUri)); } catch (RetriableOperationException | AttemptsExceededException e) { throw new RuntimeException(e); } } }); } } }
{'repo_name': 'apache/incubator-pinot', 'stars': '2609', 'repo_language': 'Java', 'file_name': 'read_model.md', 'mime_type': 'text/plain', 'hash': -6847417749260434432, 'source_dataset': 'data'}
/* * Copyright (C) 2011 Thomas Akehurst * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.tomakehurst.wiremock.extension; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Maps; import java.util.Map; import static com.github.tomakehurst.wiremock.common.Exceptions.throwUnchecked; import static com.google.common.collect.FluentIterable.from; import static java.util.Arrays.asList; public class ExtensionLoader { @SuppressWarnings("unchecked") public static <T> Map<String, T> loadExtension(String... classNames) { return (Map<String, T>) asMap( from(asList(classNames)) .transform(toClasses()) .transform(toExtensions())); } public static Map<String, Extension> load(String... classNames) { return loadExtension(classNames); } public static Map<String, Extension> asMap(Iterable<Extension> extensions) { return Maps.uniqueIndex( extensions, new Function<Extension, String>() { public String apply(Extension extension) { return extension.getName(); } }); } public static Map<String, Extension> load(Class<? extends Extension>... classes) { return asMap(from(asList(classes)).transform(toExtensions())); } private static Function<Class<? extends Extension>, Extension> toExtensions() { return new Function<Class<? extends Extension>, Extension>() { @SuppressWarnings("unchecked") public Extension apply(Class<? extends Extension> extensionClass) { try { return extensionClass.newInstance(); } catch (Exception e) { return throwUnchecked(e, Extension.class); } } }; } private static Function<String, Class<? extends Extension>> toClasses() { return new Function<String, Class<? extends Extension>>() { @SuppressWarnings("unchecked") public Class<? extends Extension> apply(String className) { try { return (Class<? extends Extension>) Class.forName(className); } catch (ClassNotFoundException e) { return throwUnchecked(e, Class.class); } } }; } public static <T extends Extension> Predicate<Map.Entry<String, Extension>> valueAssignableFrom(final Class<T> extensionType) { return new Predicate<Map.Entry<String, Extension>>() { public boolean apply(Map.Entry<String, Extension> input) { return extensionType.isAssignableFrom(input.getValue().getClass()); } }; } }
{'repo_name': 'tomakehurst/wiremock', 'stars': '3947', 'repo_language': 'Java', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': 352963552309969705, 'source_dataset': 'data'}
TIMESTAMP = 1510338674 SHA256 (Log-Agent-1.003.tar.gz) = 90e94807ab8474be9604c2d13222b909fd7cf525fb648a2e65adc0b64bb317ac SIZE (Log-Agent-1.003.tar.gz) = 55841
{'repo_name': 'pfsense/FreeBSD-ports', 'stars': '255', 'repo_language': 'None', 'file_name': 'distinfo', 'mime_type': 'text/plain', 'hash': -7132208203720657910, 'source_dataset': 'data'}
import React from "react"; import PropTypes from "prop-types"; const CardImage = ({ src, alt }) => ( <div className="card-img"> <img src={src} alt={alt} /> </div> ); CardImage.propTypes = { src: PropTypes.string.isRequired, // For accessibility. You can pass an empty string ("") in case you want // screen readers to ignore the image alt: PropTypes.string.isRequired, }; export default CardImage;
{'repo_name': 'kubeapps/kubeapps', 'stars': '2143', 'repo_language': 'TypeScript', 'file_name': 'example-apprepo.yaml', 'mime_type': 'text/plain', 'hash': -8556710266451012527, 'source_dataset': 'data'}
" Vim indent file " Language: Objective-C " Maintainer: Kazunobu Kuriyama <kazunobu.kuriyama@nifty.com> " Last Change: 2004 May 16 " " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal cindent " Set the function to do the work. setlocal indentexpr=GetObjCIndent() " To make a colon (:) suggest an indentation other than a goto/swich label, setlocal indentkeys-=: setlocal indentkeys+=<:> " Only define the function once. if exists("*GetObjCIndent") finish endif function s:GetWidth(line, regexp) let end = matchend(a:line, a:regexp) let width = 0 let i = 0 while i < end if a:line[i] != "\t" let width = width + 1 else let width = width + &ts - (width % &ts) endif let i = i + 1 endwhile return width endfunction function s:LeadingWhiteSpace(line) let end = strlen(a:line) let width = 0 let i = 0 while i < end let char = a:line[i] if char != " " && char != "\t" break endif if char != "\t" let width = width + 1 else let width = width + &ts - (width % &ts) endif let i = i + 1 endwhile return width endfunction function GetObjCIndent() let theIndent = cindent(v:lnum) let prev_line = getline(v:lnum - 1) let cur_line = getline(v:lnum) if prev_line !~# ":" || cur_line !~# ":" return theIndent endif if prev_line !~# ";" let prev_colon_pos = s:GetWidth(prev_line, ":") let delta = s:GetWidth(cur_line, ":") - s:LeadingWhiteSpace(cur_line) let theIndent = prev_colon_pos - delta endif return theIndent endfunction
{'repo_name': 'coolwanglu/vim.js', 'stars': '4392', 'repo_language': 'C', 'file_name': 'stock_icons.h', 'mime_type': 'text/plain', 'hash': -5313626844614106967, 'source_dataset': 'data'}
/////////////////////////////////////////////////////////////////////////////// // Copyright Christopher Kormanyos 2007 - 2020. // Distributed under the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef MCAL_2011_10_20_H_ #define MCAL_2011_10_20_H_ #include <mcal_cpu.h> #include <mcal_eep.h> #include <mcal_gpt.h> #include <mcal_irq.h> #include <mcal_led.h> #include <mcal_port.h> #include <mcal_pwm.h> #include <mcal_ser.h> #include <mcal_spi.h> #include <mcal_wdg.h> static_assert( (std::numeric_limits<mcal::gpt::value_type>::digits >= 64) && (std::numeric_limits<mcal::gpt::value_type>::is_integer == true) && (std::numeric_limits<mcal::gpt::value_type>::is_signed == false), "The gpt value type must be an unsigned integer type having at least 64 bits."); namespace mcal { void init(); } #endif // MCAL_2011_10_20_H_
{'repo_name': 'ckormanyos/real-time-cpp', 'stars': '209', 'repo_language': 'C++', 'file_name': 'chapter01_01-001_led_program.cpp', 'mime_type': 'text/x-c++', 'hash': 7762720424974142663, 'source_dataset': 'data'}
# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mozillazg101@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/
{'repo_name': 'mozillazg/python-pinyin', 'stars': '2709', 'repo_language': 'Python', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -8109924729139185155, 'source_dataset': 'data'}
package sdk.chat.ui.fragments; import android.view.MenuItem; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import io.reactivex.Single; import io.reactivex.SingleSource; import io.reactivex.functions.Predicate; import sdk.chat.core.dao.Thread; import sdk.chat.core.events.NetworkEvent; import sdk.chat.core.interfaces.ThreadType; import sdk.chat.core.session.ChatSDK; import sdk.chat.ui.R; import sdk.chat.ui.utils.DialogUtils; import sdk.chat.ui.utils.ToastHelper; import sdk.guru.common.RX; public class PrivateThreadsFragment extends ThreadsFragment { @Override protected Predicate<NetworkEvent> mainEventFilter() { return NetworkEvent.filterPrivateThreadsUpdated(); } @Override public void initViews() { super.initViews(); dm.add(getOnLongClickObservable().subscribe(thread -> DialogUtils.showToastDialog(getContext(), 0, R.string.alert_delete_thread, R.string.delete, R.string.cancel, () -> { dm.add(ChatSDK.thread().deleteThread(thread) .observeOn(RX.main()) .subscribe(() -> { clearData(); reloadData(); }, throwable -> ToastHelper.show(getContext(), throwable.getLocalizedMessage()))); }, null))); } @Override protected Single<List<Thread>> getThreads() { return Single.defer(() -> { List<Thread> threads = ChatSDK.thread().getThreads(ThreadType.Private); if (ChatSDK.config().privateChatRoomLifetimeMinutes == 0) { return Single.just(threads); } else { // Do we need to filter the list to remove old chat rooms? long now = new Date().getTime(); List<Thread> filtered = new ArrayList<>(); for (Thread t : threads) { if (t.getCreationDate() == null || now - t.getCreationDate().getTime() < TimeUnit.MINUTES.toMillis(ChatSDK.config().privateChatRoomLifetimeMinutes)) { filtered.add(t); } } return Single.just(filtered); } }).subscribeOn(RX.single()); } @Override public boolean onOptionsItemSelected(MenuItem item){ /* Cant use switch in the library*/ int id = item.getItemId(); if (id == R.id.action_add) { ChatSDK.ui().startCreateThreadActivity(getContext()); return true; } return super.onOptionsItemSelected(item); } }
{'repo_name': 'chat-sdk/chat-sdk-android', 'stars': '1277', 'repo_language': 'Java', 'file_name': 'NotificationBuilder.java', 'mime_type': 'text/x-java', 'hash': -3579016980177823724, 'source_dataset': 'data'}
{ "plan" : [ { "@type" : "ksqlPlanV1", "statementText" : "CREATE STREAM INPUT (FOO ARRAY<STRING>) WITH (KAFKA_TOPIC='input_topic', VALUE_FORMAT='PROTOBUF', WRAP_SINGLE_VALUE=true);", "ddlCommand" : { "@type" : "createStreamV1", "sourceName" : "INPUT", "schema" : "`ROWKEY` STRING KEY, `FOO` ARRAY<STRING>", "keyField" : null, "timestampColumn" : null, "topicName" : "input_topic", "formats" : { "keyFormat" : { "format" : "KAFKA", "properties" : { } }, "valueFormat" : { "format" : "PROTOBUF", "properties" : { } }, "options" : [ ] }, "windowInfo" : null }, "queryPlan" : null }, { "@type" : "ksqlPlanV1", "statementText" : "CREATE STREAM OUTPUT AS SELECT *\nFROM INPUT INPUT\nEMIT CHANGES", "ddlCommand" : { "@type" : "createStreamV1", "sourceName" : "OUTPUT", "schema" : "`ROWKEY` STRING KEY, `FOO` ARRAY<STRING>", "keyField" : null, "timestampColumn" : null, "topicName" : "OUTPUT", "formats" : { "keyFormat" : { "format" : "KAFKA", "properties" : { } }, "valueFormat" : { "format" : "PROTOBUF", "properties" : { } }, "options" : [ ] }, "windowInfo" : null }, "queryPlan" : { "sources" : [ "INPUT" ], "sink" : "OUTPUT", "physicalPlan" : { "@type" : "streamSinkV1", "properties" : { "queryContext" : "OUTPUT" }, "source" : { "@type" : "streamSelectV1", "properties" : { "queryContext" : "Project" }, "source" : { "@type" : "streamSourceV1", "properties" : { "queryContext" : "KsqlTopic/Source" }, "topicName" : "input_topic", "formats" : { "keyFormat" : { "format" : "KAFKA", "properties" : { } }, "valueFormat" : { "format" : "PROTOBUF", "properties" : { } }, "options" : [ ] }, "timestampColumn" : null, "sourceSchema" : "`ROWKEY` STRING KEY, `FOO` ARRAY<STRING>" }, "selectExpressions" : [ "FOO AS FOO" ] }, "formats" : { "keyFormat" : { "format" : "KAFKA", "properties" : { } }, "valueFormat" : { "format" : "PROTOBUF", "properties" : { } }, "options" : [ ] }, "topicName" : "OUTPUT" }, "queryId" : "CSAS_OUTPUT_0" } } ], "configs" : { "ksql.extension.dir" : "ext", "ksql.streams.cache.max.bytes.buffering" : "0", "ksql.security.extension.class" : null, "ksql.transient.prefix" : "transient_", "ksql.persistence.wrap.single.values" : "true", "ksql.authorization.cache.expiry.time.secs" : "30", "ksql.schema.registry.url" : "", "ksql.streams.default.deserialization.exception.handler" : "io.confluent.ksql.errors.LogMetricAndContinueExceptionHandler", "ksql.output.topic.name.prefix" : "", "ksql.streams.auto.offset.reset" : "earliest", "ksql.query.pull.enable.standby.reads" : "false", "ksql.connect.url" : "http://localhost:8083", "ksql.service.id" : "some.ksql.service.id", "ksql.internal.topic.min.insync.replicas" : "1", "ksql.streams.shutdown.timeout.ms" : "300000", "ksql.new.api.enabled" : "false", "ksql.streams.state.dir" : "/var/folders/p9/bk8xks6s2lndncftdbq36xh80000gp/T/confluent8393051053551629823", "ksql.internal.topic.replicas" : "1", "ksql.insert.into.values.enabled" : "true", "ksql.query.pull.max.allowed.offset.lag" : "9223372036854775807", "ksql.streams.default.production.exception.handler" : "io.confluent.ksql.errors.ProductionExceptionHandlerUtil$LogAndFailProductionExceptionHandler", "ksql.access.validator.enable" : "auto", "ksql.streams.bootstrap.servers" : "localhost:0", "ksql.streams.commit.interval.ms" : "2000", "ksql.metric.reporters" : "", "ksql.streams.auto.commit.interval.ms" : "0", "ksql.metrics.extension" : null, "ksql.streams.topology.optimization" : "all", "ksql.query.pull.streamsstore.rebalancing.timeout.ms" : "10000", "ksql.hidden.topics" : "_confluent.*,__confluent.*,_schemas,__consumer_offsets,__transaction_state,connect-configs,connect-offsets,connect-status,connect-statuses", "ksql.streams.num.stream.threads" : "4", "ksql.authorization.cache.max.entries" : "10000", "ksql.metrics.tags.custom" : "", "ksql.pull.queries.enable" : "true", "ksql.udfs.enabled" : "true", "ksql.udf.enable.security.manager" : "true", "ksql.connect.worker.config" : "", "ksql.sink.window.change.log.additional.retention" : "1000000", "ksql.readonly.topics" : "_confluent.*,__confluent.*,_schemas,__consumer_offsets,__transaction_state,connect-configs,connect-offsets,connect-status,connect-statuses", "ksql.udf.collect.metrics" : "false", "ksql.persistent.prefix" : "query_", "ksql.query.persistent.active.limit" : "2147483647" } }
{'repo_name': 'confluentinc/ksql', 'stars': '3555', 'repo_language': 'Java', 'file_name': 'BasicCallbackHandler.java', 'mime_type': 'text/x-java', 'hash': -8529541636847465915, 'source_dataset': 'data'}
/* * OpenWolf GPL Source Code * Copyright (C) 2011 Dusan Jocic <dusanjocic@msn.com> * * ET: Legacy * Copyright (C) 2012-2018 ET:Legacy team <mail@etlegacy.com> * * This file is part of ET: Legacy - http://www.etlegacy.com * * ET: Legacy is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ET: Legacy is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ET: Legacy. If not, see <http://www.gnu.org/licenses/>. * * In addition, Wolfenstein: Enemy Territory GPL Source Code is also * subject to certain additional terms. You should have received a copy * of these additional terms immediately following the terms and conditions * of the GNU General Public License which accompanied the source code. * If not, please request a copy in writing from id Software at the address below. * * id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. */ /** * @file htable.c * @brief * * @note This is FEATURE_IRC_CLIENT and FEATURE_IRC_SERVER only */ #include "htable.h" /*=============================================* * Type definitions * *=============================================*/ /** * @struct listhead_t * @brief "List heads" - used to store various lists */ struct listhead_t { struct listhead_t *previous; struct listhead_t *next; }; /** * @def RESET_LIST * @brief Resets a list head */ #define RESET_LIST(LPTR) \ ((LPTR)->previous = (LPTR)->next = (LPTR)) /** * @struct tentry_t * @brief Table entry - used to store actual items */ struct tentry_t { /// Entry in one of the table's sub-lists struct listhead_t loc_list; /// Entry in the table's main list struct listhead_t full_list; /// Cached hash value unsigned int hash; }; /* * Function pointers */ typedef unsigned int ( *getkey_t )(const char *key); typedef char * ( *keyfromentry_t )(struct tentry_t *entry, size_t key_offset); typedef int ( *comparekey_t )(const char *k1, const char *k2); /** * @struct hashtable_s * @brief Main hash table structure */ struct hashtable_s { /// Actual size of the table size_t size; /// Table flags unsigned int flags; /// Item size size_t item_size; /// Key offset in an item size_t key_offset; /// Length of key (0 for pointer) size_t key_length; /// Functions getkey_t GetKey; keyfromentry_t KeyFromEntry; comparekey_t CompareKey; /// List of all items struct listhead_t all_items; }; /** * @def TABLE_START * @brief Macro that finds the first list head after a table's main structure */ #define TABLE_START(TABLE) \ ((struct listhead_t *)(((char *)(TABLE)) + sizeof(struct hashtable_s))) /*=============================================* * Internal functions prototypes * *=============================================*/ /// Checks if a size is a prime number static qboolean _HT_IsPrime(size_t n); /// Finds the next higher prime number static size_t _HT_NextPrime(size_t n); /// Computes a string's hash key (case insensitive) static unsigned int _HT_GetCIKey(const char *key); /// Computes a string's hash key (case sensitive) static unsigned int _HT_GetKey(const char *key); /// Returns a table entry's key (in-table items, fixed size key) static char *_HT_KeyFromEntryII(struct tentry_t *entry, size_t key_offset); /// Returns a table entry's key (in-table items, pointer key) static char *_HT_KeyFromEntryIP(struct tentry_t *entry, size_t key_offset); /// Returns a table entry's key (external items, fixed size key) static char *_HT_KeyFromEntryPI(struct tentry_t *entry, size_t key_offset); /// Returns a table entry's key (external items, pointer key) static char *_HT_KeyFromEntryPP(struct tentry_t *entry, size_t key_offset); /// Allocate and initialise a table entry. static struct tentry_t *_HT_CreateEntry(hashtable_t table, unsigned int hash, struct listhead_t *list_entry, const char *key); /// Insert a table entry into a table's global list static void _HT_InsertInGlobalList(hashtable_t table, struct tentry_t *t_entry, const char *key); /*=============================================* * Hash table public functions * *=============================================*/ /** * @brief Hash table creation * * @param[in] size Size of the table (will be rounded up to the next * prime number) * @param[in] flags Combination of HT_FLAG_* for the table * @param[in] item_size Size of the table's items * @param[in] key_offset Offset of the key in the table's items * @param[in] key_length Maximal length of the key in the table; if 0, the key * will be accessed as a pointer instead of an array */ hashtable_t HT_Create( size_t size, unsigned int flags, size_t item_size, size_t key_offset, size_t key_length ) { hashtable_t table; size_t real_size; struct listhead_t *t_item; // Allocate table real_size = _HT_NextPrime(size); table = Z_Malloc(sizeof(struct hashtable_s) + real_size * sizeof(struct listhead_t)); etl_assert(table); // Initialise main table fields table->size = real_size; table->flags = flags; table->item_size = item_size; table->key_offset = key_offset; table->key_length = key_length; RESET_LIST(&table->all_items); // Set functions table->GetKey = (flags & HT_FLAG_CASE) ? _HT_GetKey : _HT_GetCIKey; table->CompareKey = (flags & HT_FLAG_CASE) ? strcmp : Q_stricmp; // Q_strcasecmp if ((flags & HT_FLAG_INTABLE) == 0) { table->KeyFromEntry = key_length ? _HT_KeyFromEntryPI : _HT_KeyFromEntryPP; } else { table->KeyFromEntry = key_length ? _HT_KeyFromEntryII : _HT_KeyFromEntryIP; } // Initialise table entries t_item = TABLE_START(table); while (real_size > 0) { RESET_LIST(t_item); t_item++; real_size--; } return table; } /** * @brief Hash table destruction * @param[in] table */ void HT_Destroy(hashtable_t table) { qboolean del_key; struct listhead_t *list_head; struct listhead_t *list_entry; struct tentry_t *t_entry; del_key = (table->key_length == 0 && (table->flags & (HT_FLAG_INTABLE | HT_FLAG_FREE)) != 0); list_head = &(table->all_items); list_entry = list_head->next; while (list_entry != list_head) { t_entry = (struct tentry_t *)(((char *) list_entry) - HT_OffsetOfField(struct tentry_t, full_list)); list_entry = list_entry->next; if (del_key) { Z_Free(table->KeyFromEntry(t_entry, table->key_offset)); } if ((table->flags & (HT_FLAG_INTABLE | HT_FLAG_FREE)) == HT_FLAG_FREE) { void **data = (void **)(((char *) t_entry) + sizeof(struct tentry_t)); Z_Free(*data); } Z_Free(t_entry); } Z_Free(table); } /** * @brief Gets an item from the table. * * @param[in] table The hash table to access * @param[in] key The key to look up * @param[out] created Pointer to a boolean which will be set to true if * the item was created; if NULL, no creation will take * place */ void *HT_GetItem( hashtable_t table, const char *key, qboolean *created ) { unsigned int hash; struct listhead_t *list_head; struct listhead_t *list_entry; struct tentry_t *t_entry; void *data; etl_assert(table->key_length == 0 || table->key_length >= strlen(key)); // Try finding the item hash = table->GetKey(key); list_head = (TABLE_START(table) + (hash % table->size)); list_entry = list_head->next; while (list_entry != list_head) { t_entry = ( struct tentry_t * ) list_entry; if (t_entry->hash > hash) { break; } if (t_entry->hash == hash) { char *item_key = table->KeyFromEntry(t_entry, table->key_offset); if (!table->CompareKey(key, item_key)) { data = (void *)(((char *)t_entry) + sizeof(struct tentry_t)); if (created != NULL) { *created = qfalse; } return (table->flags & HT_FLAG_INTABLE) ? data : (*(void **)data); } } list_entry = list_entry->next; } // Check if we can create the entry if (created == NULL) { return NULL; } // Create entry *created = qtrue; t_entry = _HT_CreateEntry(table, hash, list_entry, key); // Initialise data data = (void *)(((char *)t_entry) + sizeof(struct tentry_t)); if ((table->flags & HT_FLAG_INTABLE) == 0) { *(void **) data = Z_Malloc(table->item_size); data = *(void **) data; } Com_Memset(data, 0, table->item_size); // Copy key if (table->key_length == 0) { char **key_ptr = (char **)(((char *) data) + table->key_offset); *key_ptr = Z_Malloc(strlen(key) + 1); strcpy(*key_ptr, key); } else { char *key_ptr = ((char *) data) + table->key_offset; strcpy(key_ptr, key); } return data; } /** * @brief Stores an item into the table * * @param[in] table The hash table to add an item to * @param[in] item The item to add to the table * @param[in] allow_replacement whether replacement of a previous item * is allowed * * @return The item that matched the specified key, or NULL if no item * using the same key existed * * @note Replacement behaviour varies greatly depending on the flags. * If the items are stored in-table, or if the table must free the * memory they use, a replacement will still return NULL, as the * memory will have been freed or reused. */ void *HT_PutItem( hashtable_t table, void *item, qboolean allow_replacement ) { void *ret_val = NULL; void *prev_entry = NULL; const char *insert_key; unsigned int hash; struct listhead_t *list_head; struct listhead_t *list_entry; struct tentry_t *t_entry = NULL; // Extract item key if (table->key_length) { insert_key = ((const char *) item) + table->key_offset; } else { insert_key = *(const char **)(((char *) item) + table->key_offset); } // Try finding an item with that key, or the new item's location hash = table->GetKey(insert_key); list_head = (TABLE_START(table) + (hash % table->size)); list_entry = list_head->next; while (list_entry != list_head) { t_entry = ( struct tentry_t * ) list_entry; if (t_entry->hash > hash) { break; } if (t_entry->hash == hash) { const char *item_key = table->KeyFromEntry(t_entry, table->key_offset); int cres = table->CompareKey(insert_key, item_key); if (!cres) { prev_entry = (((char *)t_entry) + sizeof(struct tentry_t)); ret_val = (table->flags & HT_FLAG_INTABLE) ? prev_entry : (*(void **)prev_entry); if (!allow_replacement) { return ret_val; } break; } else if (cres > 0) { break; } } list_entry = list_entry->next; } if (ret_val != NULL) { // Delete previous item's key if it was a pointer and either // items are in-table or should be freed automatically if (table->key_length == 0 && (table->flags & (HT_FLAG_INTABLE | HT_FLAG_FREE)) != 0) { Z_Free(table->KeyFromEntry(t_entry, table->key_offset)); } if ((table->flags & HT_FLAG_INTABLE) != 0) { // Copy item data Com_Memcpy(prev_entry, item, table->item_size); ret_val = NULL; } else { if ((table->flags & HT_FLAG_FREE) != 0) { // Free previous item Z_Free(ret_val); ret_val = NULL; } *(void **) prev_entry = item; } } else { void *data; t_entry = _HT_CreateEntry(table, hash, list_entry, insert_key); data = (void *)(((char *)t_entry) + sizeof(struct tentry_t)); if ((table->flags & HT_FLAG_INTABLE) != 0) { Com_Memcpy(data, item, table->item_size); } else { *(void **) data = item; // FIXME: never used } } return ret_val; } /** * @brief Deletes an item from the table * * @param[in] table The hash table from which an item is to be deleted * @param[in] key The key to delete * @param[out] found A pointer to a pointer which will be set to * the deleted item's value; may be NULL * * @return true if an item was deleted, false otherwise * * @note If the items are stored in-table or are freed automatically, then * the "found" parameter will always be ignored. */ qboolean HT_DeleteItem( hashtable_t table, const char *key, void **found ) { unsigned int hash; struct listhead_t *list_head; struct listhead_t *list_entry; struct tentry_t *t_entry = NULL; void *data = NULL; // Try finding the item hash = table->GetKey(key); list_head = (TABLE_START(table) + (hash % table->size)); list_entry = list_head->next; while (list_entry != list_head) { t_entry = ( struct tentry_t * ) list_entry; if (t_entry->hash > hash) { break; } if (t_entry->hash == hash) { char *item_key = table->KeyFromEntry(t_entry, table->key_offset); if (!table->CompareKey(key, item_key)) { data = (void *)(((char *)t_entry) + sizeof(struct tentry_t)); data = (table->flags & HT_FLAG_INTABLE) ? data : (*(void **)data); break; } } list_entry = list_entry->next; } // Did we find it? if (data == NULL) { if (found != NULL) { *found = NULL; } return qfalse; } // Detach it from its lists t_entry->loc_list.previous->next = t_entry->loc_list.next; t_entry->loc_list.next->previous = t_entry->loc_list.previous; t_entry->full_list.previous->next = t_entry->full_list.next; t_entry->full_list.next->previous = t_entry->full_list.previous; // Delete key if (table->key_length == 0 && (table->flags & (HT_FLAG_INTABLE | HT_FLAG_FREE)) != 0) { Z_Free(table->KeyFromEntry(t_entry, table->key_offset)); } // Delete item if ((table->flags & (HT_FLAG_INTABLE | HT_FLAG_FREE)) == HT_FLAG_FREE) { Z_Free(data); } // Delete entry Z_Free(t_entry); // Set found pointer if (found != NULL) { if ((table->flags & (HT_FLAG_INTABLE | HT_FLAG_FREE)) != 0) { data = NULL; } *found = data; } return qtrue; } /** * @brief Applies a function to all items in the table. * * @param[in] table The hash table onto which the function is to be applied * @param[in] function Pointer to the function to apply * @param[in] data Extra data to pass as the function's second parameter * * @note The order in which the function is applied is either the insertion * order or, if the table has HT_FLAG_SORTED set, the increasing key * order. * * @note The function should return false if processing is to stop. */ void HT_Apply( hashtable_t table, ht_apply_funct function, void *data ) { struct listhead_t *list_head; struct listhead_t *list_entry; list_head = &(table->all_items); list_entry = list_head->next; while (list_entry != list_head) { void *item; item = ((char *) list_entry) - HT_OffsetOfField(struct tentry_t, full_list) + sizeof(struct tentry_t); list_entry = list_entry->next; if ((table->flags & HT_FLAG_INTABLE) == 0) { item = *(void **) item; } if (!function(item, data)) { return; } } } /*=============================================* * Functions related to prime numbers * *=============================================*/ /** * @brief _HT_IsPrime * @param[in] n * @return */ static qboolean _HT_IsPrime(size_t n) { size_t temp; size_t nsq; size_t inc; if (n == 0) { return qfalse; } nsq = ceil(sqrt((double)n)); for (inc = 1, temp = 2 ; temp <= nsq ; temp += inc) { if (n % temp == 0) { return qfalse; } if (temp == 3) { inc = 2; } } return qtrue; } /** * @brief _HT_NextPrime * @param[in] n * @return */ static size_t _HT_NextPrime(size_t n) { size_t value = n; while (!_HT_IsPrime(value)) value++; return value; } /*=============================================* * Key computation functions * *=============================================*/ /** * @brief _HT_GetCIKey * @param[in] key * @return */ static unsigned int _HT_GetCIKey(const char *key) { const char *current = key; unsigned int hash = 111119; while (*current) { hash += (unsigned char)tolower(*current); hash += (hash << 10); hash ^= (hash >> 6); current++; } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; } /** * @brief _HT_GetKey * @param[in] key * @return */ static unsigned int _HT_GetKey(const char *key) { const char *current = key; unsigned int hash = 111119; while (*current) { hash += (unsigned char) *current; hash += (hash << 10); hash ^= (hash >> 6); current++; } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash; } /*=============================================* * Key retrieval * *=============================================*/ /** * @brief _HT_KeyFromEntryII * @param[in] entry * @param[in] key_offset * @return */ static char *_HT_KeyFromEntryII(struct tentry_t *entry, size_t key_offset) { void *item_addr; item_addr = (void *)(((char *)entry) + sizeof(struct tentry_t)); return (char *)(((char *)item_addr) + key_offset); } /** * @brief _HT_KeyFromEntryIP * @param[in] entry * @param[in] key_offset * @return */ static char *_HT_KeyFromEntryIP(struct tentry_t *entry, size_t key_offset) { void *item_addr; item_addr = (void *)(((char *)entry) + sizeof(struct tentry_t)); return *(char **)(((char *)item_addr) + key_offset); } /** * @brief _HT_KeyFromEntryPI * @param[in] entry * @param[in] key_offset * @return */ static char *_HT_KeyFromEntryPI(struct tentry_t *entry, size_t key_offset) { void *item_addr; item_addr = *(void **)(((char *)entry) + sizeof(struct tentry_t)); return (char *)(((char *)item_addr) + key_offset); } /** * @brief _HT_KeyFromEntryPP * @param[in] entry * @param[in] key_offset * @return */ static char *_HT_KeyFromEntryPP(struct tentry_t *entry, size_t key_offset) { void *item_addr; item_addr = *(void **)(((char *)entry) + sizeof(struct tentry_t)); return *(char **)(((char *)item_addr) + key_offset); } /*=============================================* * Other internal functions * *=============================================*/ /** * @brief _HT_CreateEntry * @param[in] table * @param[in] hash * @param[in,out] list_entry * @param[in] key * @return */ static struct tentry_t *_HT_CreateEntry( hashtable_t table, unsigned int hash, struct listhead_t *list_entry, const char *key) { // Allocate new entry struct tentry_t *t_entry; size_t entry_size = sizeof(struct tentry_t); entry_size += (table->flags & HT_FLAG_INTABLE) ? table->item_size : sizeof(void *); t_entry = Z_Malloc(entry_size); t_entry->hash = hash; // Add entry to local list t_entry->loc_list.previous = list_entry->previous; t_entry->loc_list.next = list_entry; list_entry->previous = t_entry->loc_list.previous->next = &(t_entry->loc_list); _HT_InsertInGlobalList(table, t_entry, key); return t_entry; } /** * @brief _HT_InsertInGlobalList * @param[in] table * @param[in,out] t_entry * @param[in] key */ static void _HT_InsertInGlobalList(hashtable_t table, struct tentry_t *t_entry, const char *key) { if ((table->flags & HT_FLAG_SORTED) == 0) { // Append to global list t_entry->full_list.previous = table->all_items.previous; t_entry->full_list.next = &(table->all_items); table->all_items.previous = t_entry->full_list.previous->next = &(t_entry->full_list); } else { // Global list must be kept sorted, find insert location struct listhead_t *list_entry = table->all_items.next; while (list_entry != &(table->all_items)) { struct tentry_t *ai_entry; const char *ai_key; int cres; ai_entry = (struct tentry_t *)(((char *) list_entry) - HT_OffsetOfField(struct tentry_t, full_list)); ai_key = table->KeyFromEntry(ai_entry, table->key_offset); cres = table->CompareKey(ai_key, key); etl_assert(cres != 0); if (cres > 0) { break; } list_entry = list_entry->next; } t_entry->full_list.previous = list_entry->previous; t_entry->full_list.next = list_entry; list_entry->previous = t_entry->full_list.previous->next = &(t_entry->full_list); } }
{'repo_name': 'etlegacy/etlegacy', 'stars': '107', 'repo_language': 'C', 'file_name': 'ETLBuildMod.cmake', 'mime_type': 'text/plain', 'hash': -7961755411919313419, 'source_dataset': 'data'}
/* * * Template Numerical Toolkit (TNT): Two-dimensional Fortran numerical array * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_FORTRAN_ARRAY2D_H #define TNT_FORTRAN_ARRAY2D_H #include <cstdlib> #include <iostream> #ifdef TNT_BOUNDS_CHECK #include <assert.h> #endif #include "tnt_i_refvec.h" namespace TNT { template <class T> class Fortran_Array2D { private: i_refvec<T> v_; int m_; int n_; T* data_; void initialize_(int n); void copy_(T* p, const T* q, int len); void set_(T* begin, T* end, const T& val); public: typedef T value_type; Fortran_Array2D(); Fortran_Array2D(int m, int n); Fortran_Array2D(int m, int n, T *a); Fortran_Array2D(int m, int n, const T &a); inline Fortran_Array2D(const Fortran_Array2D &A); inline Fortran_Array2D & operator=(const T &a); inline Fortran_Array2D & operator=(const Fortran_Array2D &A); inline Fortran_Array2D & ref(const Fortran_Array2D &A); Fortran_Array2D copy() const; Fortran_Array2D & inject(const Fortran_Array2D & A); inline T& operator()(int i, int j); inline const T& operator()(int i, int j) const ; inline int dim1() const; inline int dim2() const; ~Fortran_Array2D(); /* extended interface */ inline int ref_count() const; }; template <class T> Fortran_Array2D<T>::Fortran_Array2D() : v_(), m_(0), n_(0), data_(0) {} template <class T> Fortran_Array2D<T>::Fortran_Array2D(const Fortran_Array2D<T> &A) : v_(A.v_), m_(A.m_), n_(A.n_), data_(A.data_) {} template <class T> Fortran_Array2D<T>::Fortran_Array2D(int m, int n) : v_(m*n), m_(m), n_(n), data_(v_.begin()) {} template <class T> Fortran_Array2D<T>::Fortran_Array2D(int m, int n, const T &val) : v_(m*n), m_(m), n_(n), data_(v_.begin()) { set_(data_, data_+m*n, val); } template <class T> Fortran_Array2D<T>::Fortran_Array2D(int m, int n, T *a) : v_(a), m_(m), n_(n), data_(v_.begin()) {} template <class T> inline T& Fortran_Array2D<T>::operator()(int i, int j) { #ifdef TNT_BOUNDS_CHECK assert(i >= 1); assert(i <= m_); assert(j >= 1); assert(j <= n_); #endif return v_[ (j-1)*m_ + (i-1) ]; } template <class T> inline const T& Fortran_Array2D<T>::operator()(int i, int j) const { #ifdef TNT_BOUNDS_CHECK assert(i >= 1); assert(i <= m_); assert(j >= 1); assert(j <= n_); #endif return v_[ (j-1)*m_ + (i-1) ]; } template <class T> Fortran_Array2D<T> & Fortran_Array2D<T>::operator=(const T &a) { set_(data_, data_+m_*n_, a); return *this; } template <class T> Fortran_Array2D<T> Fortran_Array2D<T>::copy() const { Fortran_Array2D B(m_,n_); B.inject(*this); return B; } template <class T> Fortran_Array2D<T> & Fortran_Array2D<T>::inject(const Fortran_Array2D &A) { if (m_ == A.m_ && n_ == A.n_) copy_(data_, A.data_, m_*n_); return *this; } template <class T> Fortran_Array2D<T> & Fortran_Array2D<T>::ref(const Fortran_Array2D<T> &A) { if (this != &A) { v_ = A.v_; m_ = A.m_; n_ = A.n_; data_ = A.data_; } return *this; } template <class T> Fortran_Array2D<T> & Fortran_Array2D<T>::operator=(const Fortran_Array2D<T> &A) { return ref(A); } template <class T> inline int Fortran_Array2D<T>::dim1() const { return m_; } template <class T> inline int Fortran_Array2D<T>::dim2() const { return n_; } template <class T> Fortran_Array2D<T>::~Fortran_Array2D() { } template <class T> inline int Fortran_Array2D<T>::ref_count() const { return v_.ref_count(); } template <class T> void Fortran_Array2D<T>::set_(T* begin, T* end, const T& a) { for (T* p=begin; p<end; p++) *p = a; } template <class T> void Fortran_Array2D<T>::copy_(T* p, const T* q, int len) { T *end = p + len; while (p<end ) *p++ = *q++; } } /* namespace TNT */ #endif /* TNT_FORTRAN_ARRAY2D_H */
{'repo_name': 'prody/ProDy', 'stars': '154', 'repo_language': 'Python', 'file_name': 'functions.py', 'mime_type': 'text/x-python', 'hash': 7171724335473914897, 'source_dataset': 'data'}
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/PassKitCore.framework/PassKitCore */ @interface PawuKFL8icsLHMZd : NSObject { NSString * _emailAddress; NSString * _firstName; NSString * _fullName; NSString * _lastName; NSString * _phoneNumber; unsigned long long _source; unsigned long long _type; } @property (nonatomic, retain) NSString *emailAddress; @property (nonatomic, retain) NSString *firstName; @property (nonatomic, retain) NSString *fullName; @property (nonatomic, retain) NSString *lastName; @property (nonatomic, retain) NSString *phoneNumber; @property (nonatomic) unsigned long long source; @property (nonatomic) unsigned long long type; - (void).cxx_destruct; - (id)emailAddress; - (id)firstName; - (id)fullName; - (id)initWithEmailAddress:(id)arg1 source:(unsigned long long)arg2; - (id)initWithFirstName:(id)arg1 lastName:(id)arg2 source:(unsigned long long)arg3; - (id)initWithFullName:(id)arg1 source:(unsigned long long)arg2; - (id)initWithPhoneNumber:(id)arg1 source:(unsigned long long)arg2; - (id)initWithSource:(unsigned long long)arg1; - (id)lastName; - (id)phoneNumber; - (void)setEmailAddress:(id)arg1; - (void)setFirstName:(id)arg1; - (void)setFullName:(id)arg1; - (void)setLastName:(id)arg1; - (void)setPhoneNumber:(id)arg1; - (void)setSource:(unsigned long long)arg1; - (void)setType:(unsigned long long)arg1; - (unsigned long long)source; - (unsigned long long)type; @end
{'repo_name': 'nst/iOS-Runtime-Headers', 'stars': '7551', 'repo_language': 'Objective-C', 'file_name': 'NPNameParser.h', 'mime_type': 'text/plain', 'hash': -1800577784292229314, 'source_dataset': 'data'}
export function assertNever(shouldBeNever: never): never { throw new Error('Unhandled case: ' + JSON.stringify(shouldBeNever)); }
{'repo_name': 'nomcopter/react-mosaic', 'stars': '2386', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 3787198836188282876, 'source_dataset': 'data'}
# 实现感知机的基本算法和对偶算法 # 结果比较 结果在perceptron.ipynb中展示 # 相关博客 #### [感知机原理(Perceptron)](https://www.cnblogs.com/huangyc/p/9706575.html)
{'repo_name': 'SmallVagetable/machine_learning_python', 'stars': '357', 'repo_language': 'Python', 'file_name': 'perceptron-checkpoint.ipynb', 'mime_type': 'text/plain', 'hash': 2061209752557977622, 'source_dataset': 'data'}
var f = require('./f.js')(); for (var r = f.next(); !r.done; r = f.next()) { console.log(r.value); }
{'repo_name': 'splunk/splunk-sdk-javascript', 'stars': '161', 'repo_language': 'JavaScript', 'file_name': 'splunk.ui.timeline.js', 'mime_type': 'text/plain', 'hash': -2852185661591028802, 'source_dataset': 'data'}
[ { "fields": { "slug": "hdf", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "047edfb6-f85e-41d6-9d0f-8b48aa92d7e4", "description": "HDF" }, "model": "fpr.format" }, { "fields": { "slug": "microsoft-prx-file", "group": "00abbdd0-51b3-4162-b93a-45deb4ed8654", "uuid": "fe82092a-2d87-4e3a-b4d6-02fa394a261a", "description": "Microsoft PRX File" }, "model": "fpr.format" }, { "fields": { "slug": "autoshade-rendering-slide", "group": "fdf9e267-a18c-46a4-a162-b81bcba6322f", "uuid": "9a21e188-c69c-48df-ab83-2698d0c865c5", "description": "AutoShade Rendering Slide" }, "model": "fpr.format" }, { "fields": { "slug": "qa-word-processor-document", "group": "805d359a-32f0-4767-8a9c-cc14f13d8392", "uuid": "5c45da5f-3e87-4edd-99bf-1d7a2778d2d8", "description": "Q&A Word Processor Document" }, "model": "fpr.format" }, { "fields": { "slug": "draco-file-format", "group": "8d32bf98-b569-4469-8953-10416b53b920", "uuid": "3519dd00-481a-4b8d-90b1-6defe365ac33", "description": "Draco File Format" }, "model": "fpr.format" }, { "fields": { "slug": "ogr-gfs-file", "group": "89961b53-4d5c-49e2-9910-8825d96c8640", "uuid": "949ca049-a6f7-4190-9b7a-49727e8d09cd", "description": "OGR GFS File" }, "model": "fpr.format" }, { "fields": { "slug": "quickdraw-3d-metafile-ascii", "group": "8d32bf98-b569-4469-8953-10416b53b920", "uuid": "bbbe0611-0c38-4567-9bcf-30cb746bde84", "description": "QuickDraw 3D Metafile (ASCII)" }, "model": "fpr.format" }, { "fields": { "slug": "quickdraw-3d-metafile-binary", "group": "8d32bf98-b569-4469-8953-10416b53b920", "uuid": "8878c629-2c22-44a0-ab2e-03c4addaf178", "description": "QuickDraw 3D Metafile (Binary)" }, "model": "fpr.format" }, { "fields": { "slug": "windows-journal-format", "group": "805d359a-32f0-4767-8a9c-cc14f13d8392", "uuid": "30dd63f1-9974-42c2-8e22-1bc3d782360a", "description": "Windows Journal Format" }, "model": "fpr.format" }, { "fields": { "slug": "bknas-seismic-data-format", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "57809984-fdd4-4b8a-a45f-8b12d4016a93", "description": "BKNAS Seismic Data Format" }, "model": "fpr.format" }, { "fields": { "slug": "adobe-audio-waveform", "group": "c94ce0e6-c275-4c09-b802-695a18b7bf2a", "uuid": "6d66819a-6ad7-4f6e-a96d-95d319bf038a", "description": "Adobe Audio Waveform" }, "model": "fpr.format" }, { "fields": { "slug": "avchd-clip-information-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "c45fc923-2743-41ad-8fb1-703533ee04fa", "description": "AVCHD Clip Information File" }, "model": "fpr.format" }, { "fields": { "slug": "m2ts", "group": "f22e9c29-9d4a-429e-adaf-38f3aecaff99", "uuid": "9d2f5dcd-ccc3-4e54-b9eb-38682b3d29d7", "description": "M2TS" }, "model": "fpr.format" }, { "fields": { "slug": "snap-main-data-file", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "94a005c2-8437-4d9f-adb3-c65d7b968a66", "description": "SNAP Main Data File" }, "model": "fpr.format" }, { "fields": { "slug": "snap-archive-data-file", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "374cffbe-7bc8-4fc7-b96b-68b53b422651", "description": "SNAP Archive Data File" }, "model": "fpr.format" }, { "fields": { "slug": "snap-processed-data-file", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "a960c6dc-8959-4de9-b14d-92eb540dd963", "description": "SNAP Processed Data File" }, "model": "fpr.format" }, { "fields": { "slug": "phase-one-raw-image", "group": "be86edbf-f62c-431f-b549-300d23c7cd0d", "uuid": "35692ae4-ae93-41dd-82d9-476b8e38dd49", "description": "Phase One Raw Image" }, "model": "fpr.format" }, { "fields": { "slug": "phase-one-iiq-raw-image", "group": "be86edbf-f62c-431f-b549-300d23c7cd0d", "uuid": "53cd1ce7-610e-4b2e-89c2-4a42c302fc20", "description": "Phase One IIQ Raw Image" }, "model": "fpr.format" }, { "fields": { "slug": "hasselblad-3fr-raw-image", "group": "be86edbf-f62c-431f-b549-300d23c7cd0d", "uuid": "757a61e0-b82d-4a24-b765-36f6dcd01cda", "description": "Hasselblad 3FR Raw Image" }, "model": "fpr.format" }, { "fields": { "slug": "leaf-mosaic-raw-image", "group": "be86edbf-f62c-431f-b549-300d23c7cd0d", "uuid": "9c6e2f60-6ed1-442c-9a2b-befed38ea22b", "description": "Leaf Mosaic Raw Image" }, "model": "fpr.format" }, { "fields": { "slug": "portable-database", "group": "7d161ac1-2879-445d-8e6d-cbc9eff5c225", "uuid": "58393f57-f266-4ba5-83ab-8f1d0fe3f2a7", "description": "Portable Database" }, "model": "fpr.format" }, { "fields": { "slug": "silo", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "a6d8f765-9fe0-4ea9-ab1c-b6eee4894573", "description": "Silo" }, "model": "fpr.format" }, { "fields": { "slug": "cue-sheet", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "1d1cc0ba-0624-44a7-be2e-bd0e343be84c", "description": "Cue Sheet" }, "model": "fpr.format" }, { "fields": { "slug": "preferred-executable-format", "group": "00abbdd0-51b3-4162-b93a-45deb4ed8654", "uuid": "38f38ac3-c985-4864-974d-0ed239ec3fc6", "description": "Preferred Executable Format" }, "model": "fpr.format" }, { "fields": { "slug": "apple-disk-image", "group": "84362779-5e64-442d-9394-1d42ea961240", "uuid": "335e1b35-ecb2-44a7-8ed1-dd0acf329673", "description": "Apple Disk Image" }, "model": "fpr.format" }, { "fields": { "slug": "google-document-link-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "545dac6f-60cc-4325-b161-b5c49fb9d22d", "description": "Google Document Link File" }, "model": "fpr.format" }, { "fields": { "slug": "avchd-playlist-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "a92cb474-bc96-46f8-9a9f-076d1c59e96c", "description": "AVCHD Playlist File" }, "model": "fpr.format" }, { "fields": { "slug": "avchd-movie-object-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "8bf48c82-0970-488a-88de-f4aa7cfee94e", "description": "AVCHD Movie Object File" }, "model": "fpr.format" }, { "fields": { "slug": "avchd-index-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "e6377fa8-eb0c-41f7-85e9-d8eda731e717", "description": "AVCHD Index File" }, "model": "fpr.format" }, { "fields": { "slug": "avchd-thumbnail-index-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "e0e6764c-616e-44da-9a5e-a5162c1eb641", "description": "AVCHD Thumbnail Index File" }, "model": "fpr.format" }, { "fields": { "slug": "microsoft-program-database", "group": "7d161ac1-2879-445d-8e6d-cbc9eff5c225", "uuid": "233ea0bf-4b04-4cbc-b3d4-fd9b37504de8", "description": "Microsoft Program Database" }, "model": "fpr.format" }, { "fields": { "slug": "asp-application-directive-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "1537816a-27d6-4571-80f0-60cbf554b911", "description": "ASP Application Directive File" }, "model": "fpr.format" }, { "fields": { "slug": "asp-control-directive-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "cc36487f-a23d-4cbb-af02-205a6a2cfe47", "description": "ASP Control Directive File" }, "model": "fpr.format" }, { "fields": { "slug": "asp-webservice-directive-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "71748eca-75e8-4810-8b74-b5949692bba7", "description": "ASP WebService Directive File" }, "model": "fpr.format" }, { "fields": { "slug": "hangul-word-processor-document", "group": "805d359a-32f0-4767-8a9c-cc14f13d8392", "uuid": "1a91d8c5-7bfb-47b1-9e4c-8dd934f33cda", "description": "Hangul Word Processor Document" }, "model": "fpr.format" }, { "fields": { "slug": "trim-context-reference-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "6f792e7f-0e96-4d87-9588-85e14fd4d25e", "description": "TRIM Context Reference File" }, "model": "fpr.format" }, { "fields": { "slug": "monkeys-audio-file", "group": "c94ce0e6-c275-4c09-b802-695a18b7bf2a", "uuid": "cebeecd6-ce04-46c3-af92-43e3a4d08ca2", "description": "Monkey's Audio File" }, "model": "fpr.format" }, { "fields": { "slug": "fat-disk-image", "group": "84362779-5e64-442d-9394-1d42ea961240", "uuid": "576a0e0b-a01f-4bec-bd28-8b21105fe07b", "description": "FAT Disk Image" }, "model": "fpr.format" }, { "fields": { "slug": "visual-basic-vb-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "dfe40dbb-5a58-45c3-bc5a-f5533161e1f9", "description": "Visual Basic (VB) File" }, "model": "fpr.format" }, { "fields": { "slug": "vbscript-vbs-file", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "7362fe48-3f60-4185-82b6-ea28de54f6d2", "description": "VBScript (VBS) File" }, "model": "fpr.format" }, { "fields": { "slug": "exclude-file", "group": "00abbdd0-51b3-4162-b93a-45deb4ed8654", "uuid": "3be95ba5-581f-4002-924b-18b502e2a5f1", "description": "Exclude File" }, "model": "fpr.format" }, { "fields": { "slug": "scribus-document", "group": "3616a69f-e9c4-4357-b366-57082cf75a3e", "uuid": "cfc197b4-c039-4ea3-9fc2-d7cdbaa53140", "description": "Scribus Document" }, "model": "fpr.format" }, { "fields": { "slug": "alias-pix-image-file", "group": "be86edbf-f62c-431f-b549-300d23c7cd0d", "uuid": "e86fab63-2d29-4035-a11f-1f5b9aaaf5a9", "description": "Alias Pix Image File" }, "model": "fpr.format" }, { "fields": { "slug": "alias-scene-description-language", "group": "8d32bf98-b569-4469-8953-10416b53b920", "uuid": "cb51a1dc-3fd7-4ebe-90b1-e1bbecca7ee7", "description": "Alias Scene Description Language" }, "model": "fpr.format" }, { "fields": { "slug": "the-neuroimaging-informatics-technology-init-2", "group": "9c183a8f-89b7-47cc-a6ba-4ed038cf63d5", "uuid": "42b7510a-e4af-4a76-8702-d3eb9910e8dd", "description": "The Neuroimaging Informatics Technology Initiative File Format" }, "model": "fpr.format" }, { "fields": { "slug": "pea-archive-format", "group": "c7a96cdf-dde2-42f1-a679-5a7f251c6ce9", "uuid": "f18c7e97-f753-404a-9669-266193f82d0d", "description": "PEA Archive Format" }, "model": "fpr.format" }, { "fields": { "slug": "freearc-archive-format", "group": "c7a96cdf-dde2-42f1-a679-5a7f251c6ce9", "uuid": "c6f71d37-39a3-4112-a0bd-4e19eeda8cdd", "description": "FreeArc Archive Format" }, "model": "fpr.format" }, { "fields": { "slug": "zpaq-archive-format", "group": "c7a96cdf-dde2-42f1-a679-5a7f251c6ce9", "uuid": "39d287c8-f55e-4a41-8f5c-c48452cc1d9b", "description": "ZPAQ Archive Format" }, "model": "fpr.format" }, { "fields": { "slug": "tcr-ebook", "group": "57361413-1c3b-405d-a9c0-7d3ea381090e", "uuid": "47628c18-73ab-4086-9c87-d1e0b107f80f", "description": "TCR eBook" }, "model": "fpr.format" }, { "fields": { "slug": "xz-file-format", "group": "c7a96cdf-dde2-42f1-a679-5a7f251c6ce9", "uuid": "5f1ab6e3-33ff-43da-a491-45cd83fff57a", "description": "XZ File Format" }, "model": "fpr.format" }, { "fields": { "slug": "yenc-encoded-file", "group": "c7a96cdf-dde2-42f1-a679-5a7f251c6ce9", "uuid": "ff257a80-d2ae-49e0-8a69-1bb3544e46ec", "description": "yEnc Encoded File" }, "model": "fpr.format" }, { "fields": { "replaces": null, "uuid": "4d5f40e1-b4f3-4406-9adf-38d310254062", "format": "047edfb6-f85e-41d6-9d0f-8b48aa92d7e4", "lastmodified": "2017-10-19T20:32:16.913Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "1-4", "slug": "hdf-1-4", "pronom_id": "fmt/1041", "description": "HDF 1-4" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "de582109-8fd7-46cb-a8bd-847e6a10200d", "format": "9b3f9406-a375-4b66-9081-61a317e68cbf", "lastmodified": "2017-10-19T20:32:16.918Z", "enabled": false, "access_format": false, "preservation_format": false, "version": "2.0", "slug": "wordperfect-graphics-20", "pronom_id": "fmt/1042", "description": "WordPerfect Graphics 2.0" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "9dcf7e6d-3515-431f-8ed0-11711bdd0e7e", "format": "fe82092a-2d87-4e3a-b4d6-02fa394a261a", "lastmodified": "2017-10-19T20:32:16.925Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "microsoft-prx", "pronom_id": "fmt/1043", "description": "Microsoft PRX" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "91ec9c6c-f4b9-46ad-ba4f-955938ef91d7", "format": "9a21e188-c69c-48df-ab83-2698d0c865c5", "lastmodified": "2017-10-19T20:32:16.930Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "autoshade-rnd", "pronom_id": "fmt/1044", "description": "AutoShade RND" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "48284829-4f7c-4b07-a4aa-c6de2e6582b2", "format": "5c45da5f-3e87-4edd-99bf-1d7a2778d2d8", "lastmodified": "2017-10-19T20:32:16.934Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "qa-write-word-processor-wp", "pronom_id": "fmt/1045", "description": "Q&A Write Word Processor (WP)" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "49b30ffd-9a82-41ee-819d-6349d8b1a0de", "format": "3519dd00-481a-4b8d-90b1-6defe365ac33", "lastmodified": "2017-10-19T20:32:16.937Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "draco", "pronom_id": "fmt/1046", "description": "Draco" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "2be024c8-fbde-4615-ab63-fbc429f2441d", "format": "4022207c-7ce2-4ab3-866a-65ca2f68dbf5", "lastmodified": "2017-10-19T20:32:16.941Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "3.2", "slug": "geography-markup-language-32", "pronom_id": "fmt/1047", "description": "Geography Markup Language 3.2" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "64b5eece-7416-4d6a-8f68-9a54f1016de4", "format": "949ca049-a6f7-4190-9b7a-49727e8d09cd", "lastmodified": "2017-10-19T20:32:16.948Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "ogr-gfs-file", "pronom_id": "fmt/1048", "description": "OGR GFS File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "530dab1c-71cc-4e3e-82de-9786396178e6", "format": "bbbe0611-0c38-4567-9bcf-30cb746bde84", "lastmodified": "2017-10-19T20:32:16.952Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "3dmf-ascii", "pronom_id": "fmt/1049", "description": "3DMF ASCII" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "bf8ad7dc-9587-4a73-879a-325cb170ca4e", "format": "8878c629-2c22-44a0-ab2e-03c4addaf178", "lastmodified": "2017-10-19T20:32:16.956Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "1", "slug": "3dmf-binary", "pronom_id": "fmt/1050", "description": "3DMF Binary" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "3c1ca25d-9483-47eb-bee7-be77a2531f05", "format": "30dd63f1-9974-42c2-8e22-1bc3d782360a", "lastmodified": "2017-10-19T20:32:16.962Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "windows-journal", "pronom_id": "fmt/1051", "description": "Windows Journal" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "6e1c1b1c-0a59-411f-8ca2-02cd722f85c6", "format": "57809984-fdd4-4b8a-a45f-8b12d4016a93", "lastmodified": "2017-10-19T20:32:16.966Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "1.0", "slug": "bknas", "pronom_id": "fmt/1052", "description": "BKNAS" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "1d4252aa-a017-4eab-a3dc-7d7a1efc7921", "format": "6d66819a-6ad7-4f6e-a96d-95d319bf038a", "lastmodified": "2017-10-19T20:32:16.970Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "adobe-pek", "pronom_id": "fmt/1053", "description": "Adobe .pek" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "818804da-7c42-4e2d-a1d1-9042c79c5346", "format": "c45fc923-2743-41ad-8fb1-703533ee04fa", "lastmodified": "2017-10-19T20:32:16.974Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "avchd-clip-information-file", "pronom_id": "fmt/1054", "description": "AVCHD Clip Information File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "d17f8df7-c483-46ff-adef-acca7e517a01", "format": "9d2f5dcd-ccc3-4e54-b9eb-38682b3d29d7", "lastmodified": "2017-10-19T20:32:16.980Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "m2ts", "pronom_id": "fmt/1055", "description": "M2TS" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "4b42b267-ea90-458d-a8b0-592a79fad09b", "format": "94a005c2-8437-4d9f-adb3-c65d7b968a66", "lastmodified": "2017-10-19T20:32:16.984Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "snap-main-data-file", "pronom_id": "fmt/1056", "description": "SNAP Main data file" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "e674a753-8842-4fab-8bf4-e4fcc38fa1b8", "format": "374cffbe-7bc8-4fc7-b96b-68b53b422651", "lastmodified": "2017-10-19T20:32:16.987Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "snap-archive-data-file", "pronom_id": "fmt/1057", "description": "SNAP Archive data file" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "dffcb406-401f-4f29-902e-b2d94884b71a", "format": "a960c6dc-8959-4de9-b14d-92eb540dd963", "lastmodified": "2017-10-19T20:32:16.993Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "snap-processed-data-file", "pronom_id": "fmt/1058", "description": "SNAP Processed data file" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "013ec7bb-61d2-425d-b1c7-6fd4e1c49ae2", "format": "37904504-22a0-40b2-9505-21f89382d484", "lastmodified": "2017-10-19T20:32:16.997Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "2", "slug": "filemaker-pro-2", "pronom_id": "fmt/1059", "description": "FileMaker Pro 2" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "41d64274-677f-4a9c-a9cc-8972e23dd846", "format": "35692ae4-ae93-41dd-82d9-476b8e38dd49", "lastmodified": "2017-10-19T20:32:17.003Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "phase-one-raw-big-endian", "pronom_id": "fmt/1060", "description": "Phase One Raw big endian" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "9eb7232f-992d-40af-9596-ff574aa26394", "format": "53cd1ce7-610e-4b2e-89c2-4a42c302fc20", "lastmodified": "2017-10-19T20:32:17.008Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "phase-one-iiq-raw", "pronom_id": "fmt/1061", "description": "Phase One IIQ Raw" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "bc808b74-7c2d-4f02-9bcf-dd8fc600e6fa", "format": "757a61e0-b82d-4a24-b765-36f6dcd01cda", "lastmodified": "2017-10-19T20:32:17.012Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "hasselblad-3fr", "pronom_id": "fmt/1062", "description": "Hasselblad 3FR" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "74017184-a319-4223-b0bb-456839a68f08", "format": "9c6e2f60-6ed1-442c-9a2b-befed38ea22b", "lastmodified": "2017-10-19T20:32:17.018Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "leaf-mosaic-raw", "pronom_id": "fmt/1063", "description": "Leaf Mosaic Raw" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "1f0aa422-4413-46ed-a62e-6c9af73937a3", "format": "58393f57-f266-4ba5-83ab-8f1d0fe3f2a7", "lastmodified": "2017-10-19T20:32:17.022Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "1", "slug": "portable-database-1", "pronom_id": "fmt/1064", "description": "Portable Database 1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "671a6178-3e1b-45ec-aa58-49cf76f33eb9", "format": "58393f57-f266-4ba5-83ab-8f1d0fe3f2a7", "lastmodified": "2017-10-19T20:32:17.027Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "2", "slug": "portable-database-2", "pronom_id": "fmt/1065", "description": "Portable Database 2" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "78cf6108-c121-4674-9cc3-7089c80fe95e", "format": "58393f57-f266-4ba5-83ab-8f1d0fe3f2a7", "lastmodified": "2017-10-19T20:32:17.031Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "3", "slug": "portable-database-3", "pronom_id": "fmt/1066", "description": "Portable Database 3" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "823c7007-57bc-40df-b98a-e699c9bc8f3a", "format": "a6d8f765-9fe0-4ea9-ab1c-b6eee4894573", "lastmodified": "2017-10-19T20:32:17.037Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "", "slug": "silo-pdb-1", "pronom_id": "fmt/1067", "description": "SILO PDB 1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "6ba2ec28-2c04-4317-a17a-e5320baa381d", "format": "a6d8f765-9fe0-4ea9-ab1c-b6eee4894573", "lastmodified": "2017-10-19T20:32:17.040Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "", "slug": "silo-hdf5", "pronom_id": "fmt/1068", "description": "SILO HDF5" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "e1896e80-b8b7-452d-8ae0-ff36a584ba54", "format": "1d1cc0ba-0624-44a7-be2e-bd0e343be84c", "lastmodified": "2017-10-19T20:32:17.046Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "cue-sheet", "pronom_id": "fmt/1069", "description": "CUE Sheet" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "82b3fb83-5534-47d3-a3a6-f7814a5ae175", "format": "38f38ac3-c985-4864-974d-0ed239ec3fc6", "lastmodified": "2017-10-19T20:32:17.050Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "preferred-executable-format", "pronom_id": "fmt/1070", "description": "Preferred Executable Format" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "35ce1ee7-9d72-47ae-b92a-745661df1ef8", "format": "335e1b35-ecb2-44a7-8ed1-dd0acf329673", "lastmodified": "2017-10-19T20:32:17.053Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "apple-disk-image", "pronom_id": "fmt/1071", "description": "Apple Disk Image" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "38f1c4c9-312f-4062-9543-f073e1d7ef70", "format": "37904504-22a0-40b2-9505-21f89382d484", "lastmodified": "2017-10-19T20:32:17.058Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "1", "slug": "filemaker-pro-1", "pronom_id": "fmt/1072", "description": "FileMaker Pro 1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "a9a9d3db-6691-45ec-8a0a-a36dbed93f02", "format": "545dac6f-60cc-4325-b161-b5c49fb9d22d", "lastmodified": "2017-10-19T20:32:17.062Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "google-document-link-file", "pronom_id": "fmt/1073", "description": "Google Document Link File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "0c99d4b2-e4b1-4ebe-8ebd-b751be979ee8", "format": "a92cb474-bc96-46f8-9a9f-076d1c59e96c", "lastmodified": "2017-10-19T20:32:17.066Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "avchd-playlist-file-1", "pronom_id": "fmt/1074", "description": "AVCHD Playlist File 1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "3bc6345f-6f80-4149-8e1a-697ba68d0207", "format": "8bf48c82-0970-488a-88de-f4aa7cfee94e", "lastmodified": "2017-10-19T20:32:17.070Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "avchd-movie-object-file", "pronom_id": "fmt/1075", "description": "AVCHD Movie Object File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "ba8edd84-f579-4315-98f3-ddec0675b950", "format": "e6377fa8-eb0c-41f7-85e9-d8eda731e717", "lastmodified": "2017-10-19T20:32:17.074Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "avchd-index-file", "pronom_id": "fmt/1076", "description": "AVCHD Index File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "3ed05b73-e60d-41d0-8334-f74b54368740", "format": "e0e6764c-616e-44da-9a5e-a5162c1eb641", "lastmodified": "2017-10-19T20:32:17.080Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "avchd-thumbnail-index-file", "pronom_id": "fmt/1077", "description": "AVCHD Thumbnail Index File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "243e4dfc-dcf2-44d9-bb49-ee7099f74476", "format": "233ea0bf-4b04-4cbc-b3d4-fd9b37504de8", "lastmodified": "2017-10-19T20:32:17.084Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "2.00", "slug": "microsoft-pdb-200", "pronom_id": "fmt/1078", "description": "Microsoft PDB 2.00" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "0e7bf332-0b03-4adc-819d-73f9ac489c07", "format": "233ea0bf-4b04-4cbc-b3d4-fd9b37504de8", "lastmodified": "2017-10-19T20:32:17.087Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "7.00", "slug": "microsoft-pdb-700", "pronom_id": "fmt/1079", "description": "Microsoft PDB 7.00" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "3ac12571-040d-40cc-a47c-d988fb0a8ee1", "format": "1537816a-27d6-4571-80f0-60cbf554b911", "lastmodified": "2017-10-19T20:32:17.092Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "asp-application-directive", "pronom_id": "fmt/1080", "description": "ASP Application Directive" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "7594ca97-8587-4bc1-a818-b08d6be7a813", "format": "cc36487f-a23d-4cbb-af02-205a6a2cfe47", "lastmodified": "2017-10-19T20:32:17.096Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "asp-control-directive", "pronom_id": "fmt/1081", "description": "ASP Control Directive" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "c49d5a49-4186-4b05-8476-b7c43f0b59b5", "format": "71748eca-75e8-4810-8b74-b5949692bba7", "lastmodified": "2017-10-19T20:32:17.100Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "asp-webservice-directive", "pronom_id": "fmt/1082", "description": "ASP WebService Directive" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "c14a474d-00b8-45ba-882f-28fc88f5ffbf", "format": "1a91d8c5-7bfb-47b1-9e4c-8dd934f33cda", "lastmodified": "2017-10-19T20:32:17.103Z", "enabled": false, "access_format": false, "preservation_format": false, "version": "3", "slug": "hwp-3", "pronom_id": "fmt/1083", "description": "HWP 3" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "6aad4402-39d6-45d7-9f74-baf2a8d2a27b", "format": "1a91d8c5-7bfb-47b1-9e4c-8dd934f33cda", "lastmodified": "2017-10-19T20:32:17.107Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "5", "slug": "hangul-word-processor-document", "pronom_id": "fmt/1084", "description": "Hangul Word Processor Document" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "97db2e67-c375-44de-8075-c7b7dd69f4c8", "format": "6f792e7f-0e96-4d87-9588-85e14fd4d25e", "lastmodified": "2017-10-19T20:32:17.112Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "trim-context-reference-file", "pronom_id": "fmt/1085", "description": "TRIM Context Reference File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "87ed7ce6-cbca-4e38-8eaa-f31a70f337c0", "format": "cebeecd6-ce04-46c3-af92-43e3a4d08ca2", "lastmodified": "2017-10-19T20:32:17.116Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "monkeys-audio-variant-1", "pronom_id": "fmt/1086", "description": "Monkey's Audio variant 1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "ffdad5e7-c536-4e8e-b186-045ab129b61c", "format": "576a0e0b-a01f-4bec-bd28-8b21105fe07b", "lastmodified": "2017-10-19T20:32:17.120Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "fat-disk-image", "pronom_id": "fmt/1087", "description": "FAT Disk Image" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "9a362fb0-27bd-406c-8d45-ab62a7f018af", "format": "dfe40dbb-5a58-45c3-bc5a-f5533161e1f9", "lastmodified": "2017-10-19T20:32:17.125Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "visual-basic-vb-file", "pronom_id": "fmt/1088", "description": "Visual Basic (VB) File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "873efec2-3616-47d8-81b6-ae0b745fb648", "format": "7362fe48-3f60-4185-82b6-ea28de54f6d2", "lastmodified": "2017-10-19T20:32:17.130Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "vbscript-vbs-file", "pronom_id": "fmt/1089", "description": "VBScript (VBS) File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "4df221f1-e628-48c4-be93-c5f94ca1470d", "format": "3be95ba5-581f-4002-924b-18b502e2a5f1", "lastmodified": "2017-10-19T20:32:17.133Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "exclude-file", "pronom_id": "fmt/1090", "description": "Exclude File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "a2a506d3-55ed-4865-9c24-14a9a9df57d8", "format": "cfc197b4-c039-4ea3-9fc2-d7cdbaa53140", "lastmodified": "2017-10-19T20:32:17.137Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "scribus", "pronom_id": "fmt/1091", "description": "Scribus" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "9ad3ebc4-a3a1-4d52-aa2e-272add00e5af", "format": "e86fab63-2d29-4035-a11f-1f5b9aaaf5a9", "lastmodified": "2017-10-19T20:32:17.142Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "alias-pix-image", "pronom_id": "fmt/1092", "description": "Alias Pix Image" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "c306ba16-4692-4d7b-ba91-89e4edc829a1", "format": "cb51a1dc-3fd7-4ebe-90b1-e1bbecca7ee7", "lastmodified": "2017-10-19T20:32:17.148Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "alias-scene-description-language", "pronom_id": "fmt/1093", "description": "Alias Scene Description Language" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "0f846e4c-8dc6-445b-b0a1-edd4f1c7f4be", "format": "42b7510a-e4af-4a76-8702-d3eb9910e8dd", "lastmodified": "2017-10-19T20:32:17.152Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "2", "slug": "the-neuroimaging-informatics-technology-init-2", "pronom_id": "fmt/1094", "description": "The Neuroimaging Informatics Technology Initiative File Format V2 variant1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "7ac94685-cf1a-41e7-a27e-8a4fa095eff9", "format": "f18c7e97-f753-404a-9669-266193f82d0d", "lastmodified": "2017-10-19T20:32:17.156Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "pea-archive", "pronom_id": "fmt/1095", "description": "PEA Archive" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "557d808a-5eb6-424d-bb9d-b7642383606c", "format": "c6f71d37-39a3-4112-a0bd-4e19eeda8cdd", "lastmodified": "2017-10-19T20:32:17.160Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "freearc-archive-format", "pronom_id": "fmt/1096", "description": "FreeArc Archive Format" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "3a23dfa5-40e3-4e6b-9181-dc6f97a7736a", "format": "39d287c8-f55e-4a41-8f5c-c48452cc1d9b", "lastmodified": "2017-10-19T20:32:17.166Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "zpaq-archive-format-variant-1", "pronom_id": "fmt/1097", "description": "ZPAQ Archive Format variant 1" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "77fab12d-e8eb-402d-861f-6cee88816648", "format": "47628c18-73ab-4086-9c87-d1e0b107f80f", "lastmodified": "2017-10-19T20:32:17.170Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "tcr-ebook", "pronom_id": "fmt/1099", "description": "TCR eBook" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "b2f87a44-d7eb-4d50-be59-c627c5ad5243", "format": "5f1ab6e3-33ff-43da-a491-45cd83fff57a", "lastmodified": "2017-10-19T20:32:17.173Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "xz-file-format", "pronom_id": "fmt/1098", "description": "XZ File Format" }, "model": "fpr.formatversion" }, { "fields": { "replaces": null, "uuid": "798e8a89-1e2f-4152-bad1-0940e7e48c2f", "format": "ff257a80-d2ae-49e0-8a69-1bb3544e46ec", "lastmodified": "2017-10-19T20:32:17.177Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "None", "slug": "yenc-file", "pronom_id": "fmt/1100", "description": "yEnc File" }, "model": "fpr.formatversion" }, { "fields": { "replaces": "de582109-8fd7-46cb-a8bd-847e6a10200d", "uuid": "62119ae2-168a-4327-920f-088c947e8e7e", "format": "9b3f9406-a375-4b66-9081-61a317e68cbf", "lastmodified": "2017-10-24T00:02:41.241Z", "enabled": false, "access_format": false, "preservation_format": false, "version": "2.0", "slug": "wordperfect-graphics", "pronom_id": "fmt/1042", "description": "WordPerfect Graphics" }, "model": "fpr.formatversion" }, { "fields": { "replaces": "e2534186-ed8d-4da1-9639-2a80028a2469", "uuid": "81f14076-963c-4287-a5b2-ece415a25d86", "format": "9b3f9406-a375-4b66-9081-61a317e68cbf", "lastmodified": "2017-10-24T00:03:10.107Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "1.0", "slug": "wordperfect-graphics-metafile", "pronom_id": "x-fmt/395", "description": "WordPerfect Graphics Metafile " }, "model": "fpr.formatversion" }, { "fields": { "replaces": "62119ae2-168a-4327-920f-088c947e8e7e", "uuid": "531a1364-0c48-4e85-978e-4f8ca4d32b02", "format": "9b3f9406-a375-4b66-9081-61a317e68cbf", "lastmodified": "2017-10-24T00:03:22.434Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "2.0", "slug": "wordperfect-graphics-metafile-2", "pronom_id": "fmt/1042", "description": "WordPerfect Graphics Metafile" }, "model": "fpr.formatversion" }, { "fields": { "replaces": "c14a474d-00b8-45ba-882f-28fc88f5ffbf", "uuid": "1d669b73-3603-404e-993c-1ffd640edefb", "format": "1a91d8c5-7bfb-47b1-9e4c-8dd934f33cda", "lastmodified": "2017-10-24T17:45:12.470Z", "enabled": true, "access_format": false, "preservation_format": false, "version": "3", "slug": "hangul-word-processor-document-2", "pronom_id": "fmt/1083", "description": "Hangul Word Processor Document" }, "model": "fpr.formatversion" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "6ae9bc7d-273d-444b-abe8-74bb3acd7f07", "format": "41d64274-677f-4a9c-a9cc-8972e23dd846", "lastmodified": "2017-10-25T22:44:07.105Z", "enabled": true, "command": "6957fdac-a1ed-470f-89f7-fb00be42ea13", "purpose": "access", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "78a72ab7-158d-463d-8640-a5201c7ff23e", "format": "41d64274-677f-4a9c-a9cc-8972e23dd846", "lastmodified": "2017-10-25T22:47:33.777Z", "enabled": true, "command": "a34ddc9b-c922-4bb6-8037-bbe713332175", "purpose": "preservation", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "175300fb-38ca-4eaf-ac47-c50570f4a9e4", "format": "41d64274-677f-4a9c-a9cc-8972e23dd846", "lastmodified": "2017-10-25T22:48:46.110Z", "enabled": true, "command": "1628571b-c2cd-4822-afdb-53561400c7c4", "purpose": "thumbnail", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "3686b594-0f4c-42de-b059-21081bc559ad", "format": "9eb7232f-992d-40af-9596-ff574aa26394", "lastmodified": "2017-10-25T22:49:46.011Z", "enabled": true, "command": "6957fdac-a1ed-470f-89f7-fb00be42ea13", "purpose": "access", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "b3d06aeb-d68b-48b8-8b9e-ed8770a11bfa", "format": "9eb7232f-992d-40af-9596-ff574aa26394", "lastmodified": "2017-10-25T22:51:48.578Z", "enabled": true, "command": "a34ddc9b-c922-4bb6-8037-bbe713332175", "purpose": "preservation", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "3e3bae76-9bcd-4493-9a08-9ffa5179cff7", "format": "9eb7232f-992d-40af-9596-ff574aa26394", "lastmodified": "2017-10-25T22:53:16.879Z", "enabled": true, "command": "1628571b-c2cd-4822-afdb-53561400c7c4", "purpose": "thumbnail", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "e68ad5c9-b3ae-498f-8190-a730fe21d052", "format": "bc808b74-7c2d-4f02-9bcf-dd8fc600e6fa", "lastmodified": "2017-10-25T22:54:23.521Z", "enabled": true, "command": "6957fdac-a1ed-470f-89f7-fb00be42ea13", "purpose": "access", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "ac3de556-7652-48a7-897a-a28b6890cc7a", "format": "bc808b74-7c2d-4f02-9bcf-dd8fc600e6fa", "lastmodified": "2017-10-25T22:55:22.116Z", "enabled": true, "command": "a34ddc9b-c922-4bb6-8037-bbe713332175", "purpose": "preservation", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "db2063c0-964c-4ba1-9d43-651b85c295f7", "format": "bc808b74-7c2d-4f02-9bcf-dd8fc600e6fa", "lastmodified": "2017-10-25T22:57:00.952Z", "enabled": true, "command": "1628571b-c2cd-4822-afdb-53561400c7c4", "purpose": "thumbnail", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "aa3f6af1-1764-48bd-83bd-ede5e90c6f13", "format": "74017184-a319-4223-b0bb-456839a68f08", "lastmodified": "2017-10-25T22:58:05.559Z", "enabled": true, "command": "6957fdac-a1ed-470f-89f7-fb00be42ea13", "purpose": "access", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "e8fbf4dc-c661-48e8-a919-b2632c48d14d", "format": "74017184-a319-4223-b0bb-456839a68f08", "lastmodified": "2017-10-25T22:59:02.346Z", "enabled": true, "command": "a34ddc9b-c922-4bb6-8037-bbe713332175", "purpose": "preservation", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "64d956de-fa5a-454a-bb5d-f4655e982945", "format": "74017184-a319-4223-b0bb-456839a68f08", "lastmodified": "2017-10-25T23:00:15.925Z", "enabled": true, "command": "1628571b-c2cd-4822-afdb-53561400c7c4", "purpose": "thumbnail", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "ac2c790c-2e6f-475e-b5fb-38055f0fabd4", "format": "35ce1ee7-9d72-47ae-b92a-745661df1ef8", "lastmodified": "2017-10-25T23:08:11.725Z", "enabled": true, "command": "8f41dc6f-05eb-46d4-9b22-0a0d74673510", "purpose": "extract", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "0d16fdc4-9717-4710-8edf-841df47a307b", "format": "ffdad5e7-c536-4e8e-b186-045ab129b61c", "lastmodified": "2017-10-25T23:09:31.220Z", "enabled": true, "command": "8f41dc6f-05eb-46d4-9b22-0a0d74673510", "purpose": "extract", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "c618f3d7-1fcb-476c-a076-e7413f19337b", "format": "35ce1ee7-9d72-47ae-b92a-745661df1ef8", "lastmodified": "2017-10-25T23:13:06.658Z", "enabled": true, "command": "928ce834-8830-44cc-a282-4ba1271f7842", "purpose": "characterization", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "count_not_okay": 0, "replaces": null, "count_attempts": 0, "uuid": "369140d2-ffdd-4050-8ff8-1947b325b4a5", "format": "ffdad5e7-c536-4e8e-b186-045ab129b61c", "lastmodified": "2017-10-25T23:13:55.318Z", "enabled": true, "command": "928ce834-8830-44cc-a282-4ba1271f7842", "purpose": "characterization", "count_okay": 0 }, "model": "fpr.fprule" }, { "fields": { "replaces": null, "uuid": "38c0dccc-37e1-4d66-bcfd-24aec42d300a", "format": "4d5f40e1-b4f3-4406-9adf-38d310254062", "lastmodified": "2017-10-19T20:32:16.917Z", "enabled": true, "command_output": ".hdf", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "601ffbfd-f57f-43d3-b573-43f66b036754", "format": "9dcf7e6d-3515-431f-8ed0-11711bdd0e7e", "lastmodified": "2017-10-19T20:32:16.929Z", "enabled": true, "command_output": ".prx", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "3857d953-c879-4d2c-b188-1d238d452fa4", "format": "91ec9c6c-f4b9-46ad-ba4f-955938ef91d7", "lastmodified": "2017-10-19T20:32:16.933Z", "enabled": true, "command_output": ".rnd", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "304a7606-915f-40a0-b234-06532c5aba38", "format": "49b30ffd-9a82-41ee-819d-6349d8b1a0de", "lastmodified": "2017-10-19T20:32:16.940Z", "enabled": true, "command_output": ".drc", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "074e7818-bfb0-45af-b92d-ffc0f0dacc1b", "format": "64b5eece-7416-4d6a-8f68-9a54f1016de4", "lastmodified": "2017-10-19T20:32:16.950Z", "enabled": true, "command_output": ".gfs", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "20813f23-55e9-4e1e-bf44-d248556dc070", "format": "3c1ca25d-9483-47eb-bee7-be77a2531f05", "lastmodified": "2017-10-19T20:32:16.965Z", "enabled": true, "command_output": ".jnt", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "a7186073-531d-4619-9d26-0d7b1efd0b39", "format": "6e1c1b1c-0a59-411f-8ca2-02cd722f85c6", "lastmodified": "2017-10-19T20:32:16.969Z", "enabled": true, "command_output": ".bknas", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "88decadd-94f1-4ec7-8895-1116ce3137d3", "format": "1d4252aa-a017-4eab-a3dc-7d7a1efc7921", "lastmodified": "2017-10-19T20:32:16.973Z", "enabled": true, "command_output": ".pek", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "d459e225-fda2-43a3-9a38-a09aa54038f8", "format": "d17f8df7-c483-46ff-adef-acca7e517a01", "lastmodified": "2017-10-19T20:32:16.982Z", "enabled": true, "command_output": ".mts", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "c7a5bdca-b299-4bae-884c-44b0fd052738", "format": "4b42b267-ea90-458d-a8b0-592a79fad09b", "lastmodified": "2017-10-19T20:32:16.986Z", "enabled": true, "command_output": ".mdf", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "bcfa5ae4-7654-4662-bfb5-27937704b993", "format": "dffcb406-401f-4f29-902e-b2d94884b71a", "lastmodified": "2017-10-19T20:32:16.996Z", "enabled": true, "command_output": ".snpdf", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "ec0cbf17-d1a0-474c-b414-5fd53ff6bda6", "format": "9eb7232f-992d-40af-9596-ff574aa26394", "lastmodified": "2017-10-19T20:32:17.011Z", "enabled": true, "command_output": ".iiq", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "c747c748-c172-46a6-8ef7-5a9fee6d6b58", "format": "74017184-a319-4223-b0bb-456839a68f08", "lastmodified": "2017-10-19T20:32:17.021Z", "enabled": true, "command_output": ".mos", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "c317feaa-9ffe-457c-b5f7-14bbd04864ee", "format": "e1896e80-b8b7-452d-8ae0-ff36a584ba54", "lastmodified": "2017-10-19T20:32:17.049Z", "enabled": true, "command_output": ".cue", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "2a097052-cc9b-4e3a-be05-58bfc8577627", "format": "a9a9d3db-6691-45ec-8a0a-a36dbed93f02", "lastmodified": "2017-10-19T20:32:17.065Z", "enabled": true, "command_output": ".gslides", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "28c8978a-b3cd-4150-8e5c-cc8a22737198", "format": "0c99d4b2-e4b1-4ebe-8ebd-b751be979ee8", "lastmodified": "2017-10-19T20:32:17.069Z", "enabled": true, "command_output": ".mpl", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "51c6070e-d7ee-49e1-aa5c-6639b94c0466", "format": "3ed05b73-e60d-41d0-8334-f74b54368740", "lastmodified": "2017-10-19T20:32:17.082Z", "enabled": true, "command_output": ".tid", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "8dc81826-c5f8-4e00-9cbe-a356e85981e1", "format": "3ac12571-040d-40cc-a47c-d988fb0a8ee1", "lastmodified": "2017-10-19T20:32:17.095Z", "enabled": true, "command_output": ".asax", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "81b8f708-bac5-4e74-af14-277ba45c0bd5", "format": "7594ca97-8587-4bc1-a818-b08d6be7a813", "lastmodified": "2017-10-19T20:32:17.099Z", "enabled": true, "command_output": ".ascx", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "8daa88b8-8c0f-43ea-a5c6-37085dd0d5c1", "format": "c49d5a49-4186-4b05-8476-b7c43f0b59b5", "lastmodified": "2017-10-19T20:32:17.102Z", "enabled": true, "command_output": ".asmx", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "a3303847-1d9c-4ed0-ad94-24ede4e65e25", "format": "97db2e67-c375-44de-8075-c7b7dd69f4c8", "lastmodified": "2017-10-19T20:32:17.115Z", "enabled": true, "command_output": ".tr5", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "7f04fa9f-76e5-4591-a962-4e8ba0f994eb", "format": "87ed7ce6-cbca-4e38-8eaa-f31a70f337c0", "lastmodified": "2017-10-19T20:32:17.119Z", "enabled": true, "command_output": ".ape", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "13b3add2-669c-410a-b5a5-38939f57dfd9", "format": "9a362fb0-27bd-406c-8d45-ab62a7f018af", "lastmodified": "2017-10-19T20:32:17.129Z", "enabled": true, "command_output": ".vb", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "37614118-47da-4e91-b844-e666cae404af", "format": "873efec2-3616-47d8-81b6-ae0b745fb648", "lastmodified": "2017-10-19T20:32:17.133Z", "enabled": true, "command_output": ".vbs", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "7e75c235-035b-44fc-bba1-6d6e4b354788", "format": "4df221f1-e628-48c4-be93-c5f94ca1470d", "lastmodified": "2017-10-19T20:32:17.136Z", "enabled": true, "command_output": ".exclude", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "d7576959-ea77-4833-9db6-50eee9382107", "format": "a2a506d3-55ed-4865-9c24-14a9a9df57d8", "lastmodified": "2017-10-19T20:32:17.141Z", "enabled": true, "command_output": ".sla", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "dafaa886-7a89-493c-bc1a-82026ef019c0", "format": "c306ba16-4692-4d7b-ba91-89e4edc829a1", "lastmodified": "2017-10-19T20:32:17.151Z", "enabled": true, "command_output": ".sdl", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "56801dd2-6c4d-4372-9db1-8563bd536674", "format": "0f846e4c-8dc6-445b-b0a1-edd4f1c7f4be", "lastmodified": "2017-10-19T20:32:17.155Z", "enabled": true, "command_output": ".nii", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "1add0346-912c-4459-9eb2-b91e183eae28", "format": "7ac94685-cf1a-41e7-a27e-8a4fa095eff9", "lastmodified": "2017-10-19T20:32:17.159Z", "enabled": true, "command_output": ".pea", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "9a75e0b0-9c81-4fa5-aea5-81a072fd5bb0", "format": "3a23dfa5-40e3-4e6b-9181-dc6f97a7736a", "lastmodified": "2017-10-19T20:32:17.169Z", "enabled": true, "command_output": ".zpaq", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "55ce1be7-5983-4528-a0e5-7121c4494d14", "format": "77fab12d-e8eb-402d-861f-6cee88816648", "lastmodified": "2017-10-19T20:32:17.172Z", "enabled": true, "command_output": ".tcr", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "407388b8-cf47-45e2-a3f1-51869d69758a", "format": "b2f87a44-d7eb-4d50-be59-c627c5ad5243", "lastmodified": "2017-10-19T20:32:17.176Z", "enabled": true, "command_output": ".xz", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" }, { "fields": { "replaces": null, "uuid": "f2d7f880-4734-4067-ab96-56bef2f12004", "format": "798e8a89-1e2f-4152-bad1-0940e7e48c2f", "lastmodified": "2017-10-19T20:32:17.180Z", "enabled": true, "command_output": ".yenc", "command": "41efbe1b-3fc7-4b24-9290-d0fb5d0ea9e9" }, "model": "fpr.idrule" } ]
{'repo_name': 'artefactual/archivematica', 'stars': '211', 'repo_language': 'Python', 'file_name': 'test.in', 'mime_type': 'text/plain', 'hash': 5725931405932641211, 'source_dataset': 'data'}
; RUN: llvm-dis < %s.bc| FileCheck %s ; RUN: verify-uselistorder < %s.bc ; global-variables.3.2.ll.bc was generated by passing this file to llvm-as-3.2. ; The test checks that LLVM does not silently misread global variables attributes of ; older bitcode files. @global.var = global i32 1 ; CHECK: @global.var = global i32 1 @constant.var = constant i32 1 ; CHECK: @constant.var = constant i32 1 @noinit.var = global float undef ; CHECK: @noinit.var = global float undef @section.var = global i32 1, section "foo" ; CHECK: @section.var = global i32 1, section "foo" @align.var = global i64 undef, align 8 ; CHECK: @align.var = global i64 undef, align 8 @unnamed_addr.var = unnamed_addr global i8 1 ; CHECK: @unnamed_addr.var = unnamed_addr global i8 1 @default_addrspace.var = addrspace(0) global i8 1 ; CHECK: @default_addrspace.var = global i8 1 @non_default_addrspace.var = addrspace(1) global i8* undef ; CHECK: @non_default_addrspace.var = addrspace(1) global i8* undef @initialexec.var = thread_local(initialexec) global i32 0, align 4 ; CHECK: @initialexec.var = thread_local(initialexec) global i32 0, align 4 @localdynamic.var = thread_local(localdynamic) constant i32 0, align 4 ; CHECK: @localdynamic.var = thread_local(localdynamic) constant i32 0, align 4 @localexec.var = thread_local(localexec) constant i32 0, align 4 ; CHECK: @localexec.var = thread_local(localexec) constant i32 0, align 4 @string.var = private unnamed_addr constant [13 x i8] c"hello world\0A\00" ; CHECK: @string.var = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
{'repo_name': 'ahmedbougacha/dagger', 'stars': '165', 'repo_language': 'LLVM', 'file_name': '2011-01-11-CC.ll', 'mime_type': 'text/plain', 'hash': -3983320202155987061, 'source_dataset': 'data'}
/** * author: Di (微信小程序开发工程师) * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com) * 垂直微信小程序开发交流社区 * * github地址: https://github.com/icindy/wxParse * * for: 微信小程序富文本解析 * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184 */ // Regular Expressions for parsing tags and attributes var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/, attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5 var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); // Block Elements - HTML 5 var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"); // Inline Elements - HTML 5 var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); // Elements that you can, intentionally, leave open // (and which close themselves) var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); // Attributes that have their values filled in disabled="disabled" var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); // Special Elements (can contain anything) var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block"); function HTMLParser(html, handler) { var index, chars, match, stack = [], last = html; stack.last = function () { return this[this.length - 1]; }; while (html) { chars = true; // Make sure we're not in a script or style element if (!stack.last() || !special[stack.last()]) { // Comment if (html.indexOf("<!--") == 0) { index = html.indexOf("-->"); if (index >= 0) { if (handler.comment) handler.comment(html.substring(4, index)); html = html.substring(index + 3); chars = false; } // end tag } else if (html.indexOf("</") == 0) { match = html.match(endTag); if (match) { html = html.substring(match[0].length); match[0].replace(endTag, parseEndTag); chars = false; } // start tag } else if (html.indexOf("<") == 0) { match = html.match(startTag); if (match) { html = html.substring(match[0].length); match[0].replace(startTag, parseStartTag); chars = false; } } if (chars) { index = html.indexOf("<"); var text = index < 0 ? html : html.substring(0, index); html = index < 0 ? "" : html.substring(index); if (handler.chars) handler.chars(text); } } else { html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) { text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2"); if (handler.chars) handler.chars(text); return ""; }); parseEndTag("", stack.last()); } if (html == last) throw "Parse Error: " + html; last = html; } // Clean up any remaining tags parseEndTag(); function parseStartTag(tag, tagName, rest, unary) { tagName = tagName.toLowerCase(); if (block[tagName]) { while (stack.last() && inline[stack.last()]) { parseEndTag("", stack.last()); } } if (closeSelf[tagName] && stack.last() == tagName) { parseEndTag("", tagName); } unary = empty[tagName] || !!unary; if (!unary) stack.push(tagName); if (handler.start) { var attrs = []; rest.replace(attr, function (match, name) { var value = arguments[2] ? arguments[2] : arguments[3] ? arguments[3] : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ""; attrs.push({ name: name, value: value, escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //" }); }); if (handler.start) { handler.start(tagName, attrs, unary); } } } function parseEndTag(tag, tagName) { // If no tag name is provided, clean shop if (!tagName) var pos = 0; // Find the closest opened tag of the same type else for (var pos = stack.length - 1; pos >= 0; pos--) if (stack[pos] == tagName) break; if (pos >= 0) { // Close all the open elements, up the stack for (var i = stack.length - 1; i >= pos; i--) if (handler.end) handler.end(stack[i]); // Remove the open elements from the stack stack.length = pos; } } }; function makeMap(str) { var obj = {}, items = str.split(","); for (var i = 0; i < items.length; i++) obj[items[i]] = true; return obj; } module.exports = HTMLParser;
{'repo_name': 'ritaswc/wechat_app_template', 'stars': '185', 'repo_language': 'JavaScript', 'file_name': 'bson.js', 'mime_type': 'text/plain', 'hash': -2703993628542332739, 'source_dataset': 'data'}
<template> <media-modal v-if="show" :size="size" :show="show" @media-modal-close="close()"> <div> <div class="modal-header"> <h4 class="modal-title">Rename item</h4> <button class="close float-right" type="button" @click="close()">×</button> </div> <div v-if="loading" class="text-center"> <span class="spinner icon-spinner2"/>Loading... </div> <div v-else> <div class="modal-body"> <div class="form-group"> <label>Current name</label> <p class="form-control-static">{{ getItemName(currentFile) }}</p> </div> <div class="form-group fg-line"> <label>New name</label> <input ref="newItemName" v-model="newItemName" type="text" class="form-control" @keyup.enter="renameItem()"> </div> <media-errors :errors="errors"/> </div> <div class="modal-footer"> <button class="btn btn-primary" type="button" @click="renameItem()"> Apply </button> <button class="btn btn-default" type="button" @click="close()"> Cancel </button> </div> </div> </div> </media-modal> </template> <script> import axios from "axios"; import fileManagerMixin from "./../../mixins/file-manager-mixin"; import MediaErrors from "./MediaErrors"; export default{ components: { "media-errors": MediaErrors, }, mixins: [fileManagerMixin], props:{ currentPath:{ default: "", type: String }, currentFile:{ default: function(){ return {}; }, type: [Object, Boolean] }, /** * Default route prefix */ prefix: { default : "/admin/", type: String }, show:{ default : false, type: Boolean } }, data(){ return { errors: [], loading: false, newItemName: null, size: "modal-md" }; }, watch: { show: function (val) { if (val) { window.Vue.nextTick(() => { this.$refs.newItemName.focus(); }); } } }, mounted(){ document.addEventListener("keydown", (e) => { if (this.show && e.keyCode === 13) { this.renameItem(); } }); }, methods: { close(){ this.errors = []; this.newItemName = null; this.loading = false; this.$emit("media-modal-close"); }, renameItem(){ if (!this.newItemName) { this.errors = ["Please provide a new name for this item"]; } else { this.loading = true; const original = this.getItemName(this.currentFile); const data = { "path": this.currentPath, "original": original, "newName": this.newItemName, "type": (this.isFolder(this.currentFile)) ? "Folder" : "File" }; axios.post(`${this.prefix}browser/rename`, data).then( (response) => { this.$emit("reload-folder"); this.mediaManagerNotify(response.data.success); this.close(); }).catch((error) => { this.errors = (error.response.data.error) ? error.response.data.error : error.response.statusText; this.loading = false; }); } } } }; </script>
{'repo_name': 'talvbansal/media-manager', 'stars': '174', 'repo_language': 'CSS', 'file_name': 'MediaManagerTest.php', 'mime_type': 'text/x-php', 'hash': 4959937116623458977, 'source_dataset': 'data'}
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">טקסט מקומי</string> <string name="action_help">עֶזרָה</string> <string name="description">נוגעת היא משפחה של קונפליקטים שנעשו עם סוכר או דבש, אגוזים קלויים (שקדים, אגוזי מלך, פיסטוקים, אגוזי לוז ואגוזי מקדמיה), מקציפים את חלבוני הביצה, ולפעמים פירות מסוכרים קצוצים. הוא משמש במגוון של ממתקים ו שוקולדים.</string> <string name="help_text">אם אתה זקוק לעזרה, פנה למחלקת התמיכה שלנו.</string> <string name="nougat">חבילת נוגט</string> </resources>
{'repo_name': 'google-developer-training/android-advanced', 'stars': '821', 'repo_language': 'Java', 'file_name': 'DialView.java', 'mime_type': 'text/x-java', 'hash': -948809750378247819, 'source_dataset': 'data'}
// // ExtensionURL.swift // ProfileCreator // // Created by Erik Berglund. // Copyright © 2018 Erik Berglund. All rights reserved. // import Foundation extension URL { var typeIdentifier: String { do { if let uti = try self.resourceValues(forKeys: [.typeIdentifierKey]).typeIdentifier { return uti } } catch { Log.shared.error(message: "Failed getting uti for: \(self.path) with error: \(error)", category: String(describing: self)) } if let unmanagedFileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, self.pathExtension as CFString, nil) { return unmanagedFileUTI.takeRetainedValue() as String } else { return kUTTypeItem as String } } }
{'repo_name': 'ProfileCreator/ProfileCreator', 'stars': '708', 'repo_language': 'Swift', 'file_name': '"iMac Filled"-Icon - Kostenloser Download, PNG und Vektorgrafik.webloc', 'mime_type': 'text/xml', 'hash': 4938978423672449930, 'source_dataset': 'data'}
From e7a2927d5e44209ff61405c9beb3d188eeedc3f6 Mon Sep 17 00:00:00 2001 From: Rosen Penev <rosenp@gmail.com> Date: Sun, 26 Apr 2020 20:27:58 -0700 Subject: [PATCH] libevdev-events: fix compilation with older kernels input_event_(u)sec was introduced in kernel 4.16. Older kernels do not have this. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- tools/libevdev-events.c | 5 +++++ tools/mouse-dpi-tool.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tools/libevdev-events.c b/tools/libevdev-events.c index 547513e..e5940c9 100644 --- a/tools/libevdev-events.c +++ b/tools/libevdev-events.c @@ -33,6 +33,11 @@ #include "libevdev/libevdev.h" +#ifndef input_event_sec +#define input_event_sec time.tv_sec +#define input_event_usec time.tv_usec +#endif + static void print_abs_bits(struct libevdev *dev, int axis) { diff --git a/tools/mouse-dpi-tool.c b/tools/mouse-dpi-tool.c index 9961f3a..c4830e7 100644 --- a/tools/mouse-dpi-tool.c +++ b/tools/mouse-dpi-tool.c @@ -37,6 +37,11 @@ #include "libevdev/libevdev.h" +#ifndef input_event_sec +#define input_event_sec time.tv_sec +#define input_event_usec time.tv_usec +#endif + #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) -- 2.25.3
{'repo_name': 'openwrt/packages', 'stars': '2427', 'repo_language': 'Makefile', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -8569972768809132294, 'source_dataset': 'data'}
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. (function(shared, testing) { var fills = 'backwards|forwards|both'.split('|'); var directions = 'reverse|alternate|alternate-reverse'.split('|'); function makeTiming(timingInput, forGroup) { var timing = { delay: 0, endDelay: 0, fill: forGroup ? 'both' : 'none', iterationStart: 0, iterations: 1, duration: forGroup ? 'auto' : 0, playbackRate: 1, direction: 'normal', easing: 'linear', }; if (typeof timingInput == 'number' && !isNaN(timingInput)) { timing.duration = timingInput; } else if (timingInput !== undefined) { Object.getOwnPropertyNames(timingInput).forEach(function(property) { if (timingInput[property] != 'auto') { if (typeof timing[property] == 'number' || property == 'duration') { if (typeof timingInput[property] != 'number' || isNaN(timingInput[property])) { return; } } if ((property == 'fill') && (fills.indexOf(timingInput[property]) == -1)) { return; } if ((property == 'direction') && (directions.indexOf(timingInput[property]) == -1)) { return; } if (property == 'playbackRate' && shared.isDeprecated('AnimationTiming.playbackRate', '2014-11-28', 'Use AnimationPlayer.playbackRate instead.')) { return; } timing[property] = timingInput[property]; } }); } return timing; } function normalizeTimingInput(timingInput, forGroup) { var timing = makeTiming(timingInput, forGroup); timing.easing = toTimingFunction(timing.easing); return timing; } function cubic(a, b, c, d) { if (a < 0 || a > 1 || c < 0 || c > 1) { return linear; } return function(x) { var start = 0, end = 1; while (1) { var mid = (start + end) / 2; function f(a, b, m) { return 3 * a * (1 - m) * (1 - m) * m + 3 * b * (1 - m) * m * m + m * m * m}; var xEst = f(a, c, mid); if (Math.abs(x - xEst) < 0.001) { return f(b, d, mid); } if (xEst < x) { start = mid; } else { end = mid; } } } } var Start = 1; var Middle = 0.5; var End = 0; function step(count, pos) { return function(x) { if (x >= 1) { return 1; } var stepSize = 1 / count; x += pos * stepSize; return x - x % stepSize; } } var presets = { 'ease': cubic(0.25, 0.1, 0.25, 1), 'ease-in': cubic(0.42, 0, 1, 1), 'ease-out': cubic(0, 0, 0.58, 1), 'ease-in-out': cubic(0.42, 0, 0.58, 1), 'step-start': step(1, Start), 'step-middle': step(1, Middle), 'step-end': step(1, End) }; var numberString = '\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*'; var cubicBezierRe = new RegExp('cubic-bezier\\(' + numberString + ',' + numberString + ',' + numberString + ',' + numberString + '\\)'); var stepRe = /steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/; var linear = function(x) { return x; }; function toTimingFunction(easing) { var cubicData = cubicBezierRe.exec(easing); if (cubicData) { return cubic.apply(this, cubicData.slice(1).map(Number)); } var stepData = stepRe.exec(easing); if (stepData) { return step(Number(stepData[1]), {'start': Start, 'middle': Middle, 'end': End}[stepData[2]]); } var preset = presets[easing]; if (preset) { return preset; } return linear; }; function calculateActiveDuration(timing) { return Math.abs(repeatedDuration(timing) / timing.playbackRate); } function repeatedDuration(timing) { return timing.duration * timing.iterations; } var PhaseNone = 0; var PhaseBefore = 1; var PhaseAfter = 2; var PhaseActive = 3; function calculatePhase(activeDuration, localTime, timing) { if (localTime == null) { return PhaseNone; } if (localTime < timing.delay) { return PhaseBefore; } if (localTime >= timing.delay + activeDuration) { return PhaseAfter; } return PhaseActive; } function calculateActiveTime(activeDuration, fillMode, localTime, phase, delay) { switch (phase) { case PhaseBefore: if (fillMode == 'backwards' || fillMode == 'both') return 0; return null; case PhaseActive: return localTime - delay; case PhaseAfter: if (fillMode == 'forwards' || fillMode == 'both') return activeDuration; return null; case PhaseNone: return null; } } function calculateScaledActiveTime(activeDuration, activeTime, startOffset, timing) { return (timing.playbackRate < 0 ? activeTime - activeDuration : activeTime) * timing.playbackRate + startOffset; } function calculateIterationTime(iterationDuration, repeatedDuration, scaledActiveTime, startOffset, timing) { if (scaledActiveTime === Infinity || scaledActiveTime === -Infinity || (scaledActiveTime - startOffset == repeatedDuration && timing.iterations && ((timing.iterations + timing.iterationStart) % 1 == 0))) { return iterationDuration; } return scaledActiveTime % iterationDuration; } function calculateCurrentIteration(iterationDuration, iterationTime, scaledActiveTime, timing) { if (scaledActiveTime === 0) { return 0; } if (iterationTime == iterationDuration) { return timing.iterationStart + timing.iterations - 1; } return Math.floor(scaledActiveTime / iterationDuration); } function calculateTransformedTime(currentIteration, iterationDuration, iterationTime, timing) { var currentIterationIsOdd = currentIteration % 2 >= 1; var currentDirectionIsForwards = timing.direction == 'normal' || timing.direction == (currentIterationIsOdd ? 'alternate-reverse' : 'alternate'); var directedTime = currentDirectionIsForwards ? iterationTime : iterationDuration - iterationTime; var timeFraction = directedTime / iterationDuration; return iterationDuration * timing.easing(timeFraction); } function calculateTimeFraction(activeDuration, localTime, timing) { var phase = calculatePhase(activeDuration, localTime, timing); var activeTime = calculateActiveTime(activeDuration, timing.fill, localTime, phase, timing.delay); if (activeTime === null) return null; if (activeDuration === 0) return phase === PhaseBefore ? 0 : 1; var startOffset = timing.iterationStart * timing.duration; var scaledActiveTime = calculateScaledActiveTime(activeDuration, activeTime, startOffset, timing); var iterationTime = calculateIterationTime(timing.duration, repeatedDuration(timing), scaledActiveTime, startOffset, timing); var currentIteration = calculateCurrentIteration(timing.duration, iterationTime, scaledActiveTime, timing); return calculateTransformedTime(currentIteration, timing.duration, iterationTime, timing) / timing.duration; } shared.makeTiming = makeTiming; shared.normalizeTimingInput = normalizeTimingInput; shared.calculateActiveDuration = calculateActiveDuration; shared.calculateTimeFraction = calculateTimeFraction; shared.calculatePhase = calculatePhase; shared.toTimingFunction = toTimingFunction; if (WEB_ANIMATIONS_TESTING) { testing.normalizeTimingInput = normalizeTimingInput; testing.toTimingFunction = toTimingFunction; testing.calculateActiveDuration = calculateActiveDuration; testing.calculatePhase = calculatePhase; testing.PhaseNone = PhaseNone; testing.PhaseBefore = PhaseBefore; testing.PhaseActive = PhaseActive; testing.PhaseAfter = PhaseAfter; testing.calculateActiveTime = calculateActiveTime; testing.calculateScaledActiveTime = calculateScaledActiveTime; testing.calculateIterationTime = calculateIterationTime; testing.calculateCurrentIteration = calculateCurrentIteration; testing.calculateTransformedTime = calculateTransformedTime; } })(webAnimationsShared, webAnimationsTesting);
{'repo_name': 'Polymer/polycasts', 'stars': '228', 'repo_language': 'HTML', 'file_name': 'demo.html', 'mime_type': 'text/html', 'hash': -1211529357493269025, 'source_dataset': 'data'}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <title>gameQuery - Tutorial 1 - Final result</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> <script type="text/javascript" src="../../jquery.gamequery.js"></script> <script type="text/javascript" src="./tutorial.js"></script> <style type="text/css"> html,body{ margin: 0; padding: 0; background: black; } </style> </head> <body> <div id="playground" style="width: 700px; height: 250px; background: black;"> <div id="welcomeScreen" style="width: 700px; height: 250px; position: absolute; z-index: 100; background-image: url(logo.png); font-family: verdana, sans-serif;"> <div style="position: absolute; top: 120px; width: 700px; color: white;"> <div id="loadingBar" style="position: relative; left: 100px; height: 15px; width: 0px; background: red;"></div><br /> <center><a style="cursor: pointer;" id="startbutton">Click here to start!</a></center> </div> </div> </div> </body> </html>
{'repo_name': 'onaluf/gameQuery', 'stars': '619', 'repo_language': 'JavaScript', 'file_name': 'mechalchemist.js', 'mime_type': 'text/plain', 'hash': -7017913408826820524, 'source_dataset': 'data'}
using SatisfactorySaveEditor.Model; using SatisfactorySaveEditor.ViewModel.Property; using SatisfactorySaveParser; using System.Windows; namespace SatisfactorySaveEditor.Cheats { public class NoCostCheat : ICheat { public string Name => "Toggle no build cost"; public bool Apply(SaveObjectModel rootItem, SatisfactorySave saveGame) { var gameState = rootItem.FindChild("Persistent_Level:PersistentLevel.BP_GameState_C_0", false); if (gameState == null) { MessageBox.Show("This save does not contain a GameState.\nThis means that the loaded save is probably corrupt. Aborting.", "Cannot find GameState", MessageBoxButton.OK, MessageBoxImage.Error); return false; } var numAdditionalSlots = gameState.FindOrCreateField<BoolPropertyViewModel>("mCheatNoCost"); numAdditionalSlots.Value = !numAdditionalSlots.Value; MessageBox.Show($"{(numAdditionalSlots.Value ? "Enabled" : "Disabled")} no building cost cheat", "Success", MessageBoxButton.OK, MessageBoxImage.Information); return true; } } }
{'repo_name': 'Goz3rr/SatisfactorySaveEditor', 'stars': '128', 'repo_language': 'C#', 'file_name': 'Resources.Designer.cs', 'mime_type': 'text/plain', 'hash': 297720494715940865, 'source_dataset': 'data'}
import { Component } from '@angular/core'; @Component({ selector: 'app-homepage', template: ` <p> Welcome to {{ title }}! </p> `, styles: [] }) export class HomepageComponent { title = 'Pokemon' constructor() {} }
{'repo_name': 'angular/universal', 'stars': '3598', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 1818459516478726679, 'source_dataset': 'data'}
/* * MOXA ART SoCs clock driver. * * Copyright (C) 2013 Jonas Jensen * * Jonas Jensen <jonas.jensen@gmail.com> * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/io.h> #include <linux/of_address.h> #include <linux/clkdev.h> static void __init moxart_of_pll_clk_init(struct device_node *node) { static void __iomem *base; struct clk_hw *hw; struct clk *ref_clk; unsigned int mul; const char *name = node->name; const char *parent_name; of_property_read_string(node, "clock-output-names", &name); parent_name = of_clk_get_parent_name(node, 0); base = of_iomap(node, 0); if (!base) { pr_err("%s: of_iomap failed\n", node->full_name); return; } mul = readl(base + 0x30) >> 3 & 0x3f; iounmap(base); ref_clk = of_clk_get(node, 0); if (IS_ERR(ref_clk)) { pr_err("%s: of_clk_get failed\n", node->full_name); return; } hw = clk_hw_register_fixed_factor(NULL, name, parent_name, 0, mul, 1); if (IS_ERR(hw)) { pr_err("%s: failed to register clock\n", node->full_name); return; } clk_hw_register_clkdev(hw, NULL, name); of_clk_add_hw_provider(node, of_clk_hw_simple_get, hw); } CLK_OF_DECLARE(moxart_pll_clock, "moxa,moxart-pll-clock", moxart_of_pll_clk_init); static void __init moxart_of_apb_clk_init(struct device_node *node) { static void __iomem *base; struct clk_hw *hw; struct clk *pll_clk; unsigned int div, val; unsigned int div_idx[] = { 2, 3, 4, 6, 8}; const char *name = node->name; const char *parent_name; of_property_read_string(node, "clock-output-names", &name); parent_name = of_clk_get_parent_name(node, 0); base = of_iomap(node, 0); if (!base) { pr_err("%s: of_iomap failed\n", node->full_name); return; } val = readl(base + 0xc) >> 4 & 0x7; iounmap(base); if (val > 4) val = 0; div = div_idx[val] * 2; pll_clk = of_clk_get(node, 0); if (IS_ERR(pll_clk)) { pr_err("%s: of_clk_get failed\n", node->full_name); return; } hw = clk_hw_register_fixed_factor(NULL, name, parent_name, 0, 1, div); if (IS_ERR(hw)) { pr_err("%s: failed to register clock\n", node->full_name); return; } clk_hw_register_clkdev(hw, NULL, name); of_clk_add_hw_provider(node, of_clk_hw_simple_get, hw); } CLK_OF_DECLARE(moxart_apb_clock, "moxa,moxart-apb-clock", moxart_of_apb_clk_init);
{'repo_name': 'PhoenixOS/kernel', 'stars': '202', 'repo_language': 'C', 'file_name': 'img-ir-hw.c', 'mime_type': 'text/x-c', 'hash': -7913231282857352200, 'source_dataset': 'data'}
/* * Copyright (C) 2011 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of 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. */ /** * @constructor * @extends {WebInspector.View} */ WebInspector.EmptyView = function(text) { WebInspector.View.call(this); this._text = text; } WebInspector.EmptyView.prototype = { wasShown: function() { this.element.className = "empty-view"; this.element.textContent = this._text; }, set text(text) { this._text = text; if (this.isShowing()) this.element.textContent = this._text; }, __proto__: WebInspector.View.prototype }
{'repo_name': 'tjanczuk/iisnode', 'stars': '1735', 'repo_language': 'C++', 'file_name': 'iisnodeassert.js', 'mime_type': 'text/plain', 'hash': -8442389175325347793, 'source_dataset': 'data'}
using System; using System.Collections.Generic; using System.Threading.Tasks; using Bridge.Html5; using Bridge.Test.NUnit; namespace Bridge.ClientTest.Batch3.BridgeIssues { [Category(Constants.MODULE_ISSUES)] [TestFixture(TestNameFormat = "#2763 - {0}")] public class Bridge2763 { [Test] public static async void TestAsyncArgument() { var done = Assert.Async(); var list = await Bridge2763.GetList(); Assert.NotNull(list); Assert.AreEqual(1, list.Count); Assert.True(list[0] is Bridge2763); done(); } static async Task<List<object>> GetList() => new List<object> { await A() }; #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously static async Task<Bridge2763> A() => new Bridge2763(); #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously } }
{'repo_name': 'bridgedotnet/Bridge', 'stars': '2083', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': -8337632995597901362, 'source_dataset': 'data'}
// DATA_TEMPLATE: empty_table oTest.fnStart( "aoColumns.sName" ); /* This has no effect at all in DOM methods - so we just check that it has applied the name */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "bServerSide": true, "sAjaxSource": "../../../examples/server_side/scripts/server_processing.php", "aoColumns": [ null, null, null, { "sName": 'unit test' }, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Names are stored in the columns object", null, function () { return oSettings.aoColumns[3].sName =="unit test"; } ); oTest.fnComplete(); } );
{'repo_name': 'odenny/hydra', 'stars': '367', 'repo_language': 'JavaScript', 'file_name': 'QueryServiceTest.java', 'mime_type': 'text/plain', 'hash': -985092098492679193, 'source_dataset': 'data'}
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ActiveDebugProfile>Start</ActiveDebugProfile> </PropertyGroup> </Project>
{'repo_name': 'Apress/pro-asp.net-core-mvc', 'stars': '123', 'repo_language': 'CSS', 'file_name': 'bs-commonjs-generator.js', 'mime_type': 'text/plain', 'hash': 4109207635322577951, 'source_dataset': 'data'}
/* Base16 Atelier Sulphurpool Dark - Theme */ /* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ /* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ /* Atelier-Sulphurpool Comment */ .hljs-comment, .hljs-quote { color: #898ea4; } /* Atelier-Sulphurpool Red */ .hljs-variable, .hljs-template-variable, .hljs-attribute, .hljs-tag, .hljs-name, .hljs-regexp, .hljs-link, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #c94922; } /* Atelier-Sulphurpool Orange */ .hljs-number, .hljs-meta, .hljs-built_in, .hljs-builtin-name, .hljs-literal, .hljs-type, .hljs-params { color: #c76b29; } /* Atelier-Sulphurpool Green */ .hljs-string, .hljs-symbol, .hljs-bullet { color: #ac9739; } /* Atelier-Sulphurpool Blue */ .hljs-title, .hljs-section { color: #3d8fd1; } /* Atelier-Sulphurpool Purple */ .hljs-keyword, .hljs-selector-tag { color: #6679cc; } .hljs { display: block; overflow-x: auto; background: #202746; color: #979db4; padding: 0.5em; } .hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: bold; }
{'repo_name': 'ijry/lyadmin', 'stars': '1060', 'repo_language': 'JavaScript', 'file_name': 'README.md', 'mime_type': 'text/plain', 'hash': 7552369693359585337, 'source_dataset': 'data'}
### 邻近十一中共大抓捕 纽约法轮功学员抗议 ------------------------ #### [首页](https://github.com/gfw-breaker/banned-news/blob/master/README.md) &nbsp;&nbsp;|&nbsp;&nbsp; [手把手翻墙教程](https://github.com/gfw-breaker/guides/wiki) &nbsp;&nbsp;|&nbsp;&nbsp; [禁闻聚合安卓版](https://github.com/gfw-breaker/bn-android) &nbsp;&nbsp;|&nbsp;&nbsp; [网门安卓版](https://github.com/oGate2/oGate) &nbsp;&nbsp;|&nbsp;&nbsp; [神州正道安卓版](https://github.com/SzzdOgate/update) <div><div class="post_content" itemprop="articleBody"> <p> 【新唐人北京时间2019年09月28日讯】最近,中共以70年大庆维稳为借口,在中国大陆开始大肆抓捕 <ok href="https://www.ntdtv.com/gb/法轮功.htm"> 法轮功 </ok> 学员。周五,纽约部分法轮功学员在 <ok href="https://www.ntdtv.com/gb/联合国.htm"> 联合国 </ok> 前表达抗议。 </p> <p> 记者:“在持续的 <ok href="https://www.ntdtv.com/gb/联大峰会.htm"> 联大峰会 </ok> 这几天里, <ok href="https://www.ntdtv.com/gb/法轮功.htm"> 法轮功 </ok> 学员们每天都会来到这里来表达他们的诉求。而今天他们将要在这里,这个全世界的窗口前声援,目前在中国大陆遭非法绑架的法轮功学员。而近两个月来遭到最严重非法绑架的地区是吉林市省和四川省。” </p> <p> 迫害法轮功二十年来,每逢中共敏感日,中共都以维稳的名义展开全国大面积的抓捕行动,最近,中共即将迎来“ <ok href="https://www.ntdtv.com/gb/十一.htm"> 十一 </ok> ”,据明慧网统计,近两个月来,其中,吉林省遭绑架的法轮功学员127人,四川省绑架214人。 </p> <p> 现场,法轮功学员整齐的排列在一起,举著标语牌,声援大陆各地遭受迫害的法轮功同修。 </p> <p> 来自四川的大法弟子常晓春:“7月10号那一天,在成都就有40名法轮功学员被成都警察绑架。当天有40个警察他们在毛坤家对他非法的抄家,从下午4点一直抄到晚上的11点,抢走了大量的财物,并且他们在破门而入后,对毛坤进行毒打。当场就把他的手臂都打折了。” </p> <p> 来自吉林的法轮功学员陈敬宇:“在我们吉林市还有个法轮功学员张路,被抓捕后,非法关押毒打,甚至被关在铁笼子里。” </p> <p> 来自辽宁的法轮功学员陆新松:“7月10号仅仅这一天,就绑架了二十多名法轮功学员,在沈阳市政法委统一操控下,出动了大批的公安,以他们一贯的手段,比如说,跟踪啊,定位啊,还有蹲坑。除了实施抓捕,还出现了抄家和抢夺私人财物这种罪行。” </p> <p> 追查迫害法轮功国际组织发言人王志远指出, 越来越多的事实表明, 中国民众已经认识到中共的邪恶本质, 全民反中共的时刻已来临. </p> <p> “追查国际”发言人汪志远:“在中国大陆3亿3千多不畏强权宣布退党; 在近几年以美中贸易战为代表的全世界的反中共、去中共的大潮在迅猛的掀起 ; 在香港全民反中共,反送中就有200多万人上街。” </p> <p> 与此同时,,法轮功学员纷纷表达了他们的心声。 </p> <p> 来自吉林的法轮功学员王建民:“我希望所有被迫害的法轮功学员早日释放。” </p> <p> “追查国际”发言人汪志远:“追查一切迫害法轮功的罪行以及相关组织机构,无论天涯海角。” </p> <p> 新唐人记者陈曦、唐诚纽约报导 </p> <div class="single_ad"> </div> </div> </div> <hr/> 手机上长按并复制下列链接或二维码分享本文章:<br/> https://github.com/gfw-breaker/banned-news/blob/master/pages/prog424/a102674243.md <br/> <a href='https://github.com/gfw-breaker/banned-news/blob/master/pages/prog424/a102674243.md'><img src='https://github.com/gfw-breaker/banned-news/blob/master/pages/prog424/a102674243.md.png'/></a> <br/> 原文地址(需翻墙访问):https://www.ntdtv.com/gb/2019/09/27/a102674243.html ------------------------ #### [首页](https://github.com/gfw-breaker/banned-news/blob/master/README.md) &nbsp;|&nbsp; [一键翻墙软件](https://github.com/gfw-breaker/nogfw/blob/master/README.md) &nbsp;| [《九评共产党》](https://github.com/gfw-breaker/9ping.md/blob/master/README.md#九评之一评共产党是什么) | [《解体党文化》](https://github.com/gfw-breaker/jtdwh.md/blob/master/README.md) | [《共产主义的终极目的》](https://github.com/gfw-breaker/gczydzjmd.md/blob/master/README.md) <img src='http://gfw-breaker.win/banned-news/pages/prog424/a102674243.md' width='0px' height='0px'/>
{'repo_name': 'gfw-breaker/banned-news', 'stars': '105', 'repo_language': 'Python', 'file_name': 'hp-12202019112936.md', 'mime_type': 'text/plain', 'hash': 3237578795456217952, 'source_dataset': 'data'}
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can * obtain a copy of the License at * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html * or packager/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at packager/legal/LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" * exception as provided by Oracle in the GPL Version 2 section of the License * file that accompanied this code. * * Modifications: * If applicable, add the following below the License Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyright [year] [name of copyright owner]" * * Contributor(s): * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package org.glassfish.api.container; /** * Exception, which will be thrown on endpoint registration problems. * * @author Alexey Stashok */ public class EndpointRegistrationException extends Exception { public EndpointRegistrationException() { } public EndpointRegistrationException(String message) { super(message); } }
{'repo_name': 'payara/Payara', 'stars': '745', 'repo_language': 'Java', 'file_name': 'pom.xml', 'mime_type': 'text/xml', 'hash': 6642558412637598544, 'source_dataset': 'data'}
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <Description> iTextSharp.LGPLv2.Core is an unofficial port of the last LGPL version of the iTextSharp (V4.1.6) to .NET Core.</Description> <VersionPrefix>1.6.8</VersionPrefix> <LangVersion>latest</LangVersion> <Authors>Vahid Nasiri</Authors> <TargetFrameworks>netstandard2.0;net40;netstandard1.3;</TargetFrameworks> <TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.3;netstandard2.0</TargetFrameworks> <NoWarn>$(NoWarn);1591</NoWarn> <GenerateDocumentationFile>true</GenerateDocumentationFile> <AssemblyName>iTextSharp.LGPLv2.Core</AssemblyName> <PackageId>iTextSharp.LGPLv2.Core</PackageId> <PackageTags>PdfReport;Excel;Export;iTextSharp;PDF;Report;Reporting;Persian;.NET Core;aspnetcore</PackageTags> <PackageProjectUrl>https://github.com/VahidN/iTextSharp.LGPLv2.Core</PackageProjectUrl> <PackageLicenseUrl>http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html</PackageLicenseUrl> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.3' ">$(PackageTargetFallback);dnxcore50</PackageTargetFallback> <NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.3' ">1.6.1</NetStandardImplicitPackageVersion> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute> <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> </PropertyGroup> <ItemGroup> <EmbeddedResource Include="iTextSharp\text\pdf\fonts\*.*;iTextSharp\text\pdf\fonts\cmaps\*.*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" /> </ItemGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PlatformTarget>anycpu</PlatformTarget> </PropertyGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' "> <PackageReference Include="CoreCompat.System.Drawing" Version="1.0.0-beta006" /> <PackageReference Include="Portable.BouncyCastle" Version="1.8.5" /> <PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" /> <PackageReference Include="System.Net.Requests" Version="4.3.0" /> <PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" /> <PackageReference Include="System.Runtime.Loader" Version="4.3.0" /> <PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.1" /> <PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" /> </ItemGroup> <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3'"> <DefineConstants>NETSTANDARD1_3</DefineConstants> </PropertyGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> <PackageReference Include="System.Drawing.Common" Version="4.7.0" /> <PackageReference Include="Portable.BouncyCastle" Version="1.8.6.7" /> <PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" /> <PackageReference Include="System.Net.Requests" Version="4.3.0" /> <PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" /> <PackageReference Include="System.Runtime.Loader" Version="4.3.0" /> <PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" /> <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.1" /> <PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" /> </ItemGroup> <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'"> <DefineConstants>NETSTANDARD2_0</DefineConstants> </PropertyGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'net40' "> <PackageReference Include="Portable.BouncyCastle" Version="1.8.6.7" /> </ItemGroup> <PropertyGroup Condition="'$(TargetFramework)' == 'net40'"> <DefineConstants>NET40</DefineConstants> </PropertyGroup> </Project>
{'repo_name': 'VahidN/iTextSharp.LGPLv2.Core', 'stars': '260', 'repo_language': 'C#', 'file_name': 'launch.json', 'mime_type': 'text/plain', 'hash': -6582222110709576826, 'source_dataset': 'data'}
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2004, 05, 06 by Ralf Baechle * Copyright (C) 2005 by MIPS Technologies, Inc. */ #include <linux/cpumask.h> #include <linux/oprofile.h> #include <linux/interrupt.h> #include <linux/smp.h> #include <asm/irq_regs.h> #include "op_impl.h" #define M_PERFCTL_EXL (1UL << 0) #define M_PERFCTL_KERNEL (1UL << 1) #define M_PERFCTL_SUPERVISOR (1UL << 2) #define M_PERFCTL_USER (1UL << 3) #define M_PERFCTL_INTERRUPT_ENABLE (1UL << 4) #define M_PERFCTL_EVENT(event) (((event) & 0x3ff) << 5) #define M_PERFCTL_VPEID(vpe) ((vpe) << 16) #define M_PERFCTL_MT_EN(filter) ((filter) << 20) #define M_TC_EN_ALL M_PERFCTL_MT_EN(0) #define M_TC_EN_VPE M_PERFCTL_MT_EN(1) #define M_TC_EN_TC M_PERFCTL_MT_EN(2) #define M_PERFCTL_TCID(tcid) ((tcid) << 22) #define M_PERFCTL_WIDE (1UL << 30) #define M_PERFCTL_MORE (1UL << 31) #define M_COUNTER_OVERFLOW (1UL << 31) static int (*save_perf_irq)(void); #ifdef CONFIG_MIPS_MT_SMP static int cpu_has_mipsmt_pertccounters; #define WHAT (M_TC_EN_VPE | \ M_PERFCTL_VPEID(cpu_data[smp_processor_id()].vpe_id)) #define vpe_id() (cpu_has_mipsmt_pertccounters ? \ 0 : cpu_data[smp_processor_id()].vpe_id) /* * The number of bits to shift to convert between counters per core and * counters per VPE. There is no reasonable interface atm to obtain the * number of VPEs used by Linux and in the 34K this number is fixed to two * anyways so we hardcore a few things here for the moment. The way it's * done here will ensure that oprofile VSMP kernel will run right on a lesser * core like a 24K also or with maxcpus=1. */ static inline unsigned int vpe_shift(void) { if (num_possible_cpus() > 1) return 1; return 0; } #else #define WHAT 0 #define vpe_id() 0 static inline unsigned int vpe_shift(void) { return 0; } #endif static inline unsigned int counters_total_to_per_cpu(unsigned int counters) { return counters >> vpe_shift(); } static inline unsigned int counters_per_cpu_to_total(unsigned int counters) { return counters << vpe_shift(); } #define __define_perf_accessors(r, n, np) \ \ static inline unsigned int r_c0_ ## r ## n(void) \ { \ unsigned int cpu = vpe_id(); \ \ switch (cpu) { \ case 0: \ return read_c0_ ## r ## n(); \ case 1: \ return read_c0_ ## r ## np(); \ default: \ BUG(); \ } \ return 0; \ } \ \ static inline void w_c0_ ## r ## n(unsigned int value) \ { \ unsigned int cpu = vpe_id(); \ \ switch (cpu) { \ case 0: \ write_c0_ ## r ## n(value); \ return; \ case 1: \ write_c0_ ## r ## np(value); \ return; \ default: \ BUG(); \ } \ return; \ } \ __define_perf_accessors(perfcntr, 0, 2) __define_perf_accessors(perfcntr, 1, 3) __define_perf_accessors(perfcntr, 2, 0) __define_perf_accessors(perfcntr, 3, 1) __define_perf_accessors(perfctrl, 0, 2) __define_perf_accessors(perfctrl, 1, 3) __define_perf_accessors(perfctrl, 2, 0) __define_perf_accessors(perfctrl, 3, 1) struct op_mips_model op_model_mipsxx_ops; static struct mipsxx_register_config { unsigned int control[4]; unsigned int counter[4]; } reg; /* Compute all of the registers in preparation for enabling profiling. */ static void mipsxx_reg_setup(struct op_counter_config *ctr) { unsigned int counters = op_model_mipsxx_ops.num_counters; int i; /* Compute the performance counter control word. */ for (i = 0; i < counters; i++) { reg.control[i] = 0; reg.counter[i] = 0; if (!ctr[i].enabled) continue; reg.control[i] = M_PERFCTL_EVENT(ctr[i].event) | M_PERFCTL_INTERRUPT_ENABLE; if (ctr[i].kernel) reg.control[i] |= M_PERFCTL_KERNEL; if (ctr[i].user) reg.control[i] |= M_PERFCTL_USER; if (ctr[i].exl) reg.control[i] |= M_PERFCTL_EXL; reg.counter[i] = 0x80000000 - ctr[i].count; } } /* Program all of the registers in preparation for enabling profiling. */ static void mipsxx_cpu_setup(void *args) { unsigned int counters = op_model_mipsxx_ops.num_counters; switch (counters) { case 4: w_c0_perfctrl3(0); w_c0_perfcntr3(reg.counter[3]); case 3: w_c0_perfctrl2(0); w_c0_perfcntr2(reg.counter[2]); case 2: w_c0_perfctrl1(0); w_c0_perfcntr1(reg.counter[1]); case 1: w_c0_perfctrl0(0); w_c0_perfcntr0(reg.counter[0]); } } /* Start all counters on current CPU */ static void mipsxx_cpu_start(void *args) { unsigned int counters = op_model_mipsxx_ops.num_counters; switch (counters) { case 4: w_c0_perfctrl3(WHAT | reg.control[3]); case 3: w_c0_perfctrl2(WHAT | reg.control[2]); case 2: w_c0_perfctrl1(WHAT | reg.control[1]); case 1: w_c0_perfctrl0(WHAT | reg.control[0]); } } /* Stop all counters on current CPU */ static void mipsxx_cpu_stop(void *args) { unsigned int counters = op_model_mipsxx_ops.num_counters; switch (counters) { case 4: w_c0_perfctrl3(0); case 3: w_c0_perfctrl2(0); case 2: w_c0_perfctrl1(0); case 1: w_c0_perfctrl0(0); } } static int mipsxx_perfcount_handler(void) { unsigned int counters = op_model_mipsxx_ops.num_counters; unsigned int control; unsigned int counter; int handled = IRQ_NONE; if (cpu_has_mips_r2 && !(read_c0_cause() & (1 << 26))) return handled; switch (counters) { #define HANDLE_COUNTER(n) \ case n + 1: \ control = r_c0_perfctrl ## n(); \ counter = r_c0_perfcntr ## n(); \ if ((control & M_PERFCTL_INTERRUPT_ENABLE) && \ (counter & M_COUNTER_OVERFLOW)) { \ oprofile_add_sample(get_irq_regs(), n); \ w_c0_perfcntr ## n(reg.counter[n]); \ handled = IRQ_HANDLED; \ } HANDLE_COUNTER(3) HANDLE_COUNTER(2) HANDLE_COUNTER(1) HANDLE_COUNTER(0) } return handled; } #define M_CONFIG1_PC (1 << 4) static inline int __n_counters(void) { if (!(read_c0_config1() & M_CONFIG1_PC)) return 0; if (!(read_c0_perfctrl0() & M_PERFCTL_MORE)) return 1; if (!(read_c0_perfctrl1() & M_PERFCTL_MORE)) return 2; if (!(read_c0_perfctrl2() & M_PERFCTL_MORE)) return 3; return 4; } static inline int n_counters(void) { int counters; switch (current_cpu_type()) { case CPU_R10000: counters = 2; break; case CPU_R12000: case CPU_R14000: counters = 4; break; default: counters = __n_counters(); } return counters; } static void reset_counters(void *arg) { int counters = (int)(long)arg; switch (counters) { case 4: w_c0_perfctrl3(0); w_c0_perfcntr3(0); case 3: w_c0_perfctrl2(0); w_c0_perfcntr2(0); case 2: w_c0_perfctrl1(0); w_c0_perfcntr1(0); case 1: w_c0_perfctrl0(0); w_c0_perfcntr0(0); } } static int __init mipsxx_init(void) { int counters; counters = n_counters(); if (counters == 0) { printk(KERN_ERR "Oprofile: CPU has no performance counters\n"); return -ENODEV; } #ifdef CONFIG_MIPS_MT_SMP cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19); if (!cpu_has_mipsmt_pertccounters) counters = counters_total_to_per_cpu(counters); #endif on_each_cpu(reset_counters, (void *)(long)counters, 1); op_model_mipsxx_ops.num_counters = counters; switch (current_cpu_type()) { case CPU_20KC: op_model_mipsxx_ops.cpu_type = "mips/20K"; break; case CPU_24K: op_model_mipsxx_ops.cpu_type = "mips/24K"; break; case CPU_25KF: op_model_mipsxx_ops.cpu_type = "mips/25K"; break; case CPU_1004K: #if 0 /* FIXME: report as 34K for now */ op_model_mipsxx_ops.cpu_type = "mips/1004K"; break; #endif case CPU_34K: op_model_mipsxx_ops.cpu_type = "mips/34K"; break; case CPU_74K: op_model_mipsxx_ops.cpu_type = "mips/74K"; break; case CPU_5KC: op_model_mipsxx_ops.cpu_type = "mips/5K"; break; case CPU_R10000: if ((current_cpu_data.processor_id & 0xff) == 0x20) op_model_mipsxx_ops.cpu_type = "mips/r10000-v2.x"; else op_model_mipsxx_ops.cpu_type = "mips/r10000"; break; case CPU_R12000: case CPU_R14000: op_model_mipsxx_ops.cpu_type = "mips/r12000"; break; case CPU_SB1: case CPU_SB1A: op_model_mipsxx_ops.cpu_type = "mips/sb1"; break; default: printk(KERN_ERR "Profiling unsupported for this CPU\n"); return -ENODEV; } save_perf_irq = perf_irq; perf_irq = mipsxx_perfcount_handler; return 0; } static void mipsxx_exit(void) { int counters = op_model_mipsxx_ops.num_counters; counters = counters_per_cpu_to_total(counters); on_each_cpu(reset_counters, (void *)(long)counters, 1); perf_irq = save_perf_irq; } struct op_mips_model op_model_mipsxx_ops = { .reg_setup = mipsxx_reg_setup, .cpu_setup = mipsxx_cpu_setup, .init = mipsxx_init, .exit = mipsxx_exit, .cpu_start = mipsxx_cpu_start, .cpu_stop = mipsxx_cpu_stop, };
{'repo_name': 'spotify/linux', 'stars': '140', 'repo_language': 'C', 'file_name': 'planetcore.h', 'mime_type': 'text/x-c', 'hash': -6292428927582495815, 'source_dataset': 'data'}
id: dsq-747526899 date: 2008-11-06T04:44:45.0000000-08:00 name: haacked avatar: https://github.com/haacked.png?size=120 message: <p>@Liam it was a joke. I've known Ayende for a long time now and he probably has a thicker skin than I do. If *he* finds it insulting, I will retract it immediately, because I like the guy. Apparently a subsequent commenter on his blog post found the answer via Google.<br>@Thomas Not really. Unless we broke up the constraints into two dictionaries, one that is string, string, and one that is string, IRouteConstraint. Is that what you mean?<br></p>
{'repo_name': 'haacked/haacked.com', 'stars': '130', 'repo_language': 'Ruby', 'file_name': 'dsq-747526594.yml', 'mime_type': 'text/html', 'hash': -950019905487079269, 'source_dataset': 'data'}
#!/usr/bin/perl # (C) Maxim Dounin # Tests for http proxy cache. ############################################################################### use warnings; use strict; use Test::More; BEGIN { use FindBin; chdir($FindBin::Bin); } use lib 'lib'; use Test::Nginx qw/ :DEFAULT :gzip /; ############################################################################### select STDERR; $| = 1; select STDOUT; $| = 1; plan(skip_all => 'win32') if $^O eq 'MSWin32'; my $t = Test::Nginx->new()->has(qw/http proxy cache gzip/)->plan(12) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% daemon off; events { } http { %%TEST_GLOBALS_HTTP%% proxy_cache_path %%TESTDIR%%/cache levels=1:2 keys_zone=NAME:10m; server { listen 127.0.0.1:8080; server_name localhost; gzip on; gzip_min_length 0; location / { proxy_pass http://127.0.0.1:8081; proxy_cache NAME; proxy_cache_valid 200 302 1s; proxy_cache_valid 301 1d; proxy_cache_valid any 1m; proxy_cache_min_uses 1; proxy_cache_use_stale error timeout invalid_header http_500 http_404; } location /fake/ { proxy_pass http://127.0.0.1:8082; proxy_cache NAME; } } server { listen 127.0.0.1:8081; server_name localhost; location / { } } } EOF $t->write_file('t.html', 'SEE-THIS'); $t->write_file('t2.html', 'SEE-THIS'); $t->write_file('empty.html', ''); $t->run_daemon(\&http_fake_daemon); $t->run(); ############################################################################### like(http_get('/t.html'), qr/SEE-THIS/, 'proxy request'); $t->write_file('t.html', 'NOOP'); like(http_get('/t.html'), qr/SEE-THIS/, 'proxy request cached'); unlike(http_head('/t2.html'), qr/SEE-THIS/, 'head request'); like(http_get('/t2.html'), qr/SEE-THIS/, 'get after head'); unlike(http_head('/t2.html'), qr/SEE-THIS/, 'head after get'); like(http_get_range('/t.html', 'Range: bytes=4-'), qr/^THIS/m, 'cached range'); like(http_get_range('/t.html', 'Range: bytes=0-2,4-'), qr/^SEE.*^THIS/ms, 'cached multipart range'); like(http_get('/empty.html'), qr/HTTP/, 'empty get first'); like(http_get('/empty.html'), qr/HTTP/, 'empty get second'); select(undef, undef, undef, 1.1); unlink $t->testdir() . '/t.html'; like(http_gzip_request('/t.html'), qr/HTTP.*1c\x0d\x0a.{28}\x0d\x0a0\x0d\x0a\x0d\x0a\z/s, 'non-empty get stale'); unlink $t->testdir() . '/empty.html'; like(http_gzip_request('/empty.html'), qr/HTTP.*14\x0d\x0a.{20}\x0d\x0a0\x0d\x0a\x0d\x0a\z/s, 'empty get stale'); http_get('/fake/unfinished'); like(http_get('/fake/unfinished'), qr/unfinished 2/, 'unfinished not cached'); ############################################################################### sub http_get_range { my ($url, $extra) = @_; return http(<<EOF); GET $url HTTP/1.1 Host: localhost Connection: close $extra EOF } ############################################################################### sub http_fake_daemon { my $server = IO::Socket::INET->new( Proto => 'tcp', LocalAddr => '127.0.0.1:8082', Listen => 5, Reuse => 1 ) or die "Can't create listening socket: $!\n"; my $num = 0; while (my $client = $server->accept()) { $client->autoflush(1); while (<$client>) { last if (/^\x0d?\x0a?$/); } $num++; print $client <<"EOF"; HTTP/1.1 200 OK Content-Length: 100 Cache-Control: max-age=300 Connection: close unfinished $num EOF } } ###############################################################################
{'repo_name': 'NeusoftSecurity/SEnginx', 'stars': '170', 'repo_language': 'C', 'file_name': 'config', 'mime_type': 'text/plain', 'hash': -843160395612503700, 'source_dataset': 'data'}
/** * @file * @copyright defined in go-seele/LICENSE */ package cmd import ( "context" "encoding/json" "fmt" "strings" "github.com/seeleteam/go-seele/cmd/util" "github.com/seeleteam/go-seele/common" "github.com/seeleteam/go-seele/common/keystore" "github.com/seeleteam/go-seele/core/types" "github.com/seeleteam/go-seele/rpc" "github.com/urfave/cli" ) type callArgsFactory func(*cli.Context, *rpc.Client) ([]interface{}, error) type callResultHandler func(inputs []interface{}, result interface{}) error func rpcFlags(callArgFlags ...cli.Flag) []cli.Flag { return append([]cli.Flag{addressFlag}, callArgFlags...) } func parseCallArgs(context *cli.Context, client *rpc.Client) ([]interface{}, error) { var args []interface{} for _, flag := range context.Command.Flags { if flag == addressFlag || flag == cli.HelpFlag { continue } if rf, ok := flag.(rpcFlag); ok { v, err := rf.getValue() if err != nil { return nil, err } args = append(args, v) } else { name := flag.GetName() splitName := strings.Split(name, ",") var flagValue interface{} for _, n := range splitName { flagName := strings.TrimSpace(n) flagValue = context.Generic(flagName) if flagValue != nil { break } } args = append(args, flagValue) } } return args, nil } func handleCallResult(inputs []interface{}, result interface{}) error { if result == nil { return nil } if str, ok := result.(string); ok { fmt.Println(str) return nil } encoded, err := json.MarshalIndent(result, "", "\t") if err != nil { return err } fmt.Println(string(encoded)) return nil } func rpcAction(namespace string, method string) cli.ActionFunc { return rpcActionEx(namespace, method, parseCallArgs, handleCallResult) } func rpcActionEx(namespace string, method string, argsFactory callArgsFactory, resultHandler callResultHandler) cli.ActionFunc { return func(c *cli.Context) error { // Currently, flag is required to specify value. if c.NArg() > 0 { fmt.Printf("flag is not specified for value '%v'\n\n", c.Args().First()) return cli.ShowCommandHelp(c, c.Command.Name) } if namespace == "miner" { if !strings.HasPrefix(addressValue, "127.0.0.1") && !strings.HasPrefix(addressValue, "localhost") { return fmt.Errorf("miner methods only work for 127.0.0.1 (localhost)") } } client, err := rpc.DialTCP(context.Background(), addressValue) if err != nil { return err } args, err := argsFactory(c, client) if err != nil { return err } var result interface{} rpcMethod := fmt.Sprintf("%s_%s", namespace, method) if err = client.Call(&result, rpcMethod, args...); err != nil { return fmt.Errorf("Failed to call rpc, %s", err) } return resultHandler(args, result) } } func rpcActionSystemContract(namespace string, method string, resultHandler callResultHandler) cli.ActionFunc { return func(c *cli.Context) error { client, err := rpc.DialTCP(context.Background(), addressValue) if err != nil { return err } functions, ok := systemContract[namespace] if !ok { return errInvalidCommand } function, ok := functions[method] if !ok { return errInvalidSubcommand } printdata, arg, err := function(client) if err != nil { return err } find := 0 if flags, ok := callFlags[namespace]; ok { if _, ok := flags[method]; ok { // use call method to get receipt find = 1 } } if find == 1 { printdata, err = callTx(client, arg.(*types.Transaction)) if err != nil { return err } } else { if err := sendTx(client, arg); err != nil { return err } } return resultHandler([]interface{}{}, printdata) } } func makeTransaction(context *cli.Context, client *rpc.Client) ([]interface{}, error) { key, txd, err := makeTransactionData(client) if err != nil { return nil, err } tx, err := util.GenerateTx(key.PrivateKey, txd.To, txd.Amount, txd.GasPrice, txd.GasLimit, txd.AccountNonce, txd.Payload) if err != nil { return nil, err } return []interface{}{*tx}, nil } func makeTransactionData(client *rpc.Client) (*keystore.Key, *types.TransactionData, error) { pass, err := common.GetPassword() if err != nil { return nil, nil, fmt.Errorf("failed to get password %s", err) } key, err := keystore.GetKey(fromValue, pass) if err != nil { return nil, nil, fmt.Errorf("invalid sender key file. it should be a private key: %s", err) } txd, err := checkParameter(&key.PrivateKey.PublicKey, client) if err != nil { return nil, nil, err } return key, txd, nil } func onTxAdded(inputs []interface{}, result interface{}) error { if !result.(bool) { fmt.Println("failed to send transaction") } tx := inputs[0].(types.Transaction) fmt.Println("transaction sent successfully") encoded, err := json.MarshalIndent(tx, "", "\t") if err != nil { return err } fmt.Println(string(encoded)) // print corresponding debt if exist debt := types.NewDebtWithoutContext(&tx) if debt != nil { fmt.Println() fmt.Println("It is a cross shard transaction, its debt is:") str, err := json.MarshalIndent(debt, "", "\t") if err != nil { return err } fmt.Println(string(str)) } return nil }
{'repo_name': 'seeleteam/go-seele', 'stars': '235', 'repo_language': 'Go', 'file_name': 'trie.go', 'mime_type': 'text/plain', 'hash': 8298921195780314940, 'source_dataset': 'data'}
// Code generated by protoc-gen-validate. DO NOT EDIT. // source: envoy/api/v2/core/base.proto package envoy_api_v2_core import ( "bytes" "errors" "fmt" "net" "net/mail" "net/url" "regexp" "strings" "time" "unicode/utf8" "github.com/golang/protobuf/ptypes" ) // ensure the imports are used var ( _ = bytes.MinRead _ = errors.New("") _ = fmt.Print _ = utf8.UTFMax _ = (*regexp.Regexp)(nil) _ = (*strings.Reader)(nil) _ = net.IPv4len _ = time.Duration(0) _ = (*url.URL)(nil) _ = (*mail.Address)(nil) _ = ptypes.DynamicAny{} ) // define the regex for a UUID once up-front var _base_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") // Validate checks the field values on Locality with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *Locality) Validate() error { if m == nil { return nil } // no validation rules for Region // no validation rules for Zone // no validation rules for SubZone return nil } // LocalityValidationError is the validation error returned by // Locality.Validate if the designated constraints aren't met. type LocalityValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e LocalityValidationError) Field() string { return e.field } // Reason function returns reason value. func (e LocalityValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e LocalityValidationError) Cause() error { return e.cause } // Key function returns key value. func (e LocalityValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e LocalityValidationError) ErrorName() string { return "LocalityValidationError" } // Error satisfies the builtin error interface func (e LocalityValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sLocality.%s: %s%s", key, e.field, e.reason, cause) } var _ error = LocalityValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = LocalityValidationError{} // Validate checks the field values on BuildVersion with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. func (m *BuildVersion) Validate() error { if m == nil { return nil } if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return BuildVersionValidationError{ field: "Version", reason: "embedded message failed validation", cause: err, } } } if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return BuildVersionValidationError{ field: "Metadata", reason: "embedded message failed validation", cause: err, } } } return nil } // BuildVersionValidationError is the validation error returned by // BuildVersion.Validate if the designated constraints aren't met. type BuildVersionValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e BuildVersionValidationError) Field() string { return e.field } // Reason function returns reason value. func (e BuildVersionValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e BuildVersionValidationError) Cause() error { return e.cause } // Key function returns key value. func (e BuildVersionValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e BuildVersionValidationError) ErrorName() string { return "BuildVersionValidationError" } // Error satisfies the builtin error interface func (e BuildVersionValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sBuildVersion.%s: %s%s", key, e.field, e.reason, cause) } var _ error = BuildVersionValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = BuildVersionValidationError{} // Validate checks the field values on Extension with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *Extension) Validate() error { if m == nil { return nil } // no validation rules for Name // no validation rules for Category // no validation rules for TypeDescriptor if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return ExtensionValidationError{ field: "Version", reason: "embedded message failed validation", cause: err, } } } // no validation rules for Disabled return nil } // ExtensionValidationError is the validation error returned by // Extension.Validate if the designated constraints aren't met. type ExtensionValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ExtensionValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ExtensionValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ExtensionValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ExtensionValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ExtensionValidationError) ErrorName() string { return "ExtensionValidationError" } // Error satisfies the builtin error interface func (e ExtensionValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sExtension.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ExtensionValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ExtensionValidationError{} // Validate checks the field values on Node with the rules defined in the proto // definition for this message. If any rules are violated, an error is returned. func (m *Node) Validate() error { if m == nil { return nil } // no validation rules for Id // no validation rules for Cluster if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NodeValidationError{ field: "Metadata", reason: "embedded message failed validation", cause: err, } } } if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NodeValidationError{ field: "Locality", reason: "embedded message failed validation", cause: err, } } } // no validation rules for BuildVersion // no validation rules for UserAgentName for idx, item := range m.GetExtensions() { _, _ = idx, item if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NodeValidationError{ field: fmt.Sprintf("Extensions[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } for idx, item := range m.GetListeningAddresses() { _, _ = idx, item if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NodeValidationError{ field: fmt.Sprintf("ListeningAddresses[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } switch m.UserAgentVersionType.(type) { case *Node_UserAgentVersion: // no validation rules for UserAgentVersion case *Node_UserAgentBuildVersion: if v, ok := interface{}(m.GetUserAgentBuildVersion()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return NodeValidationError{ field: "UserAgentBuildVersion", reason: "embedded message failed validation", cause: err, } } } } return nil } // NodeValidationError is the validation error returned by Node.Validate if the // designated constraints aren't met. type NodeValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e NodeValidationError) Field() string { return e.field } // Reason function returns reason value. func (e NodeValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e NodeValidationError) Cause() error { return e.cause } // Key function returns key value. func (e NodeValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e NodeValidationError) ErrorName() string { return "NodeValidationError" } // Error satisfies the builtin error interface func (e NodeValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sNode.%s: %s%s", key, e.field, e.reason, cause) } var _ error = NodeValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = NodeValidationError{} // Validate checks the field values on Metadata with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *Metadata) Validate() error { if m == nil { return nil } for key, val := range m.GetFilterMetadata() { _ = val // no validation rules for FilterMetadata[key] if v, ok := interface{}(val).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return MetadataValidationError{ field: fmt.Sprintf("FilterMetadata[%v]", key), reason: "embedded message failed validation", cause: err, } } } } return nil } // MetadataValidationError is the validation error returned by // Metadata.Validate if the designated constraints aren't met. type MetadataValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e MetadataValidationError) Field() string { return e.field } // Reason function returns reason value. func (e MetadataValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e MetadataValidationError) Cause() error { return e.cause } // Key function returns key value. func (e MetadataValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e MetadataValidationError) ErrorName() string { return "MetadataValidationError" } // Error satisfies the builtin error interface func (e MetadataValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sMetadata.%s: %s%s", key, e.field, e.reason, cause) } var _ error = MetadataValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = MetadataValidationError{} // Validate checks the field values on RuntimeUInt32 with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. func (m *RuntimeUInt32) Validate() error { if m == nil { return nil } // no validation rules for DefaultValue if len(m.GetRuntimeKey()) < 1 { return RuntimeUInt32ValidationError{ field: "RuntimeKey", reason: "value length must be at least 1 bytes", } } return nil } // RuntimeUInt32ValidationError is the validation error returned by // RuntimeUInt32.Validate if the designated constraints aren't met. type RuntimeUInt32ValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RuntimeUInt32ValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RuntimeUInt32ValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RuntimeUInt32ValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RuntimeUInt32ValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RuntimeUInt32ValidationError) ErrorName() string { return "RuntimeUInt32ValidationError" } // Error satisfies the builtin error interface func (e RuntimeUInt32ValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRuntimeUInt32.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RuntimeUInt32ValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RuntimeUInt32ValidationError{} // Validate checks the field values on RuntimeDouble with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. func (m *RuntimeDouble) Validate() error { if m == nil { return nil } // no validation rules for DefaultValue if len(m.GetRuntimeKey()) < 1 { return RuntimeDoubleValidationError{ field: "RuntimeKey", reason: "value length must be at least 1 bytes", } } return nil } // RuntimeDoubleValidationError is the validation error returned by // RuntimeDouble.Validate if the designated constraints aren't met. type RuntimeDoubleValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RuntimeDoubleValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RuntimeDoubleValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RuntimeDoubleValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RuntimeDoubleValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RuntimeDoubleValidationError) ErrorName() string { return "RuntimeDoubleValidationError" } // Error satisfies the builtin error interface func (e RuntimeDoubleValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRuntimeDouble.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RuntimeDoubleValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RuntimeDoubleValidationError{} // Validate checks the field values on RuntimeFeatureFlag with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. func (m *RuntimeFeatureFlag) Validate() error { if m == nil { return nil } if m.GetDefaultValue() == nil { return RuntimeFeatureFlagValidationError{ field: "DefaultValue", reason: "value is required", } } if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RuntimeFeatureFlagValidationError{ field: "DefaultValue", reason: "embedded message failed validation", cause: err, } } } if len(m.GetRuntimeKey()) < 1 { return RuntimeFeatureFlagValidationError{ field: "RuntimeKey", reason: "value length must be at least 1 bytes", } } return nil } // RuntimeFeatureFlagValidationError is the validation error returned by // RuntimeFeatureFlag.Validate if the designated constraints aren't met. type RuntimeFeatureFlagValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RuntimeFeatureFlagValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RuntimeFeatureFlagValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RuntimeFeatureFlagValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RuntimeFeatureFlagValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RuntimeFeatureFlagValidationError) ErrorName() string { return "RuntimeFeatureFlagValidationError" } // Error satisfies the builtin error interface func (e RuntimeFeatureFlagValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRuntimeFeatureFlag.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RuntimeFeatureFlagValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RuntimeFeatureFlagValidationError{} // Validate checks the field values on HeaderValue with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. func (m *HeaderValue) Validate() error { if m == nil { return nil } if l := len(m.GetKey()); l < 1 || l > 16384 { return HeaderValueValidationError{ field: "Key", reason: "value length must be between 1 and 16384 bytes, inclusive", } } if !_HeaderValue_Key_Pattern.MatchString(m.GetKey()) { return HeaderValueValidationError{ field: "Key", reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", } } if len(m.GetValue()) > 16384 { return HeaderValueValidationError{ field: "Value", reason: "value length must be at most 16384 bytes", } } if !_HeaderValue_Value_Pattern.MatchString(m.GetValue()) { return HeaderValueValidationError{ field: "Value", reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"", } } return nil } // HeaderValueValidationError is the validation error returned by // HeaderValue.Validate if the designated constraints aren't met. type HeaderValueValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e HeaderValueValidationError) Field() string { return e.field } // Reason function returns reason value. func (e HeaderValueValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e HeaderValueValidationError) Cause() error { return e.cause } // Key function returns key value. func (e HeaderValueValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e HeaderValueValidationError) ErrorName() string { return "HeaderValueValidationError" } // Error satisfies the builtin error interface func (e HeaderValueValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sHeaderValue.%s: %s%s", key, e.field, e.reason, cause) } var _ error = HeaderValueValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = HeaderValueValidationError{} var _HeaderValue_Key_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") var _HeaderValue_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$") // Validate checks the field values on HeaderValueOption with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. func (m *HeaderValueOption) Validate() error { if m == nil { return nil } if m.GetHeader() == nil { return HeaderValueOptionValidationError{ field: "Header", reason: "value is required", } } if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return HeaderValueOptionValidationError{ field: "Header", reason: "embedded message failed validation", cause: err, } } } if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return HeaderValueOptionValidationError{ field: "Append", reason: "embedded message failed validation", cause: err, } } } return nil } // HeaderValueOptionValidationError is the validation error returned by // HeaderValueOption.Validate if the designated constraints aren't met. type HeaderValueOptionValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e HeaderValueOptionValidationError) Field() string { return e.field } // Reason function returns reason value. func (e HeaderValueOptionValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e HeaderValueOptionValidationError) Cause() error { return e.cause } // Key function returns key value. func (e HeaderValueOptionValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e HeaderValueOptionValidationError) ErrorName() string { return "HeaderValueOptionValidationError" } // Error satisfies the builtin error interface func (e HeaderValueOptionValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sHeaderValueOption.%s: %s%s", key, e.field, e.reason, cause) } var _ error = HeaderValueOptionValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = HeaderValueOptionValidationError{} // Validate checks the field values on HeaderMap with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *HeaderMap) Validate() error { if m == nil { return nil } for idx, item := range m.GetHeaders() { _, _ = idx, item if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return HeaderMapValidationError{ field: fmt.Sprintf("Headers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } return nil } // HeaderMapValidationError is the validation error returned by // HeaderMap.Validate if the designated constraints aren't met. type HeaderMapValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e HeaderMapValidationError) Field() string { return e.field } // Reason function returns reason value. func (e HeaderMapValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e HeaderMapValidationError) Cause() error { return e.cause } // Key function returns key value. func (e HeaderMapValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e HeaderMapValidationError) ErrorName() string { return "HeaderMapValidationError" } // Error satisfies the builtin error interface func (e HeaderMapValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sHeaderMap.%s: %s%s", key, e.field, e.reason, cause) } var _ error = HeaderMapValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = HeaderMapValidationError{} // Validate checks the field values on DataSource with the rules defined in the // proto definition for this message. If any rules are violated, an error is returned. func (m *DataSource) Validate() error { if m == nil { return nil } switch m.Specifier.(type) { case *DataSource_Filename: if len(m.GetFilename()) < 1 { return DataSourceValidationError{ field: "Filename", reason: "value length must be at least 1 bytes", } } case *DataSource_InlineBytes: if len(m.GetInlineBytes()) < 1 { return DataSourceValidationError{ field: "InlineBytes", reason: "value length must be at least 1 bytes", } } case *DataSource_InlineString: if len(m.GetInlineString()) < 1 { return DataSourceValidationError{ field: "InlineString", reason: "value length must be at least 1 bytes", } } default: return DataSourceValidationError{ field: "Specifier", reason: "value is required", } } return nil } // DataSourceValidationError is the validation error returned by // DataSource.Validate if the designated constraints aren't met. type DataSourceValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e DataSourceValidationError) Field() string { return e.field } // Reason function returns reason value. func (e DataSourceValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e DataSourceValidationError) Cause() error { return e.cause } // Key function returns key value. func (e DataSourceValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e DataSourceValidationError) ErrorName() string { return "DataSourceValidationError" } // Error satisfies the builtin error interface func (e DataSourceValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sDataSource.%s: %s%s", key, e.field, e.reason, cause) } var _ error = DataSourceValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = DataSourceValidationError{} // Validate checks the field values on RetryPolicy with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. func (m *RetryPolicy) Validate() error { if m == nil { return nil } if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RetryPolicyValidationError{ field: "RetryBackOff", reason: "embedded message failed validation", cause: err, } } } if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RetryPolicyValidationError{ field: "NumRetries", reason: "embedded message failed validation", cause: err, } } } return nil } // RetryPolicyValidationError is the validation error returned by // RetryPolicy.Validate if the designated constraints aren't met. type RetryPolicyValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RetryPolicyValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RetryPolicyValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RetryPolicyValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RetryPolicyValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" } // Error satisfies the builtin error interface func (e RetryPolicyValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRetryPolicy.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RetryPolicyValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RetryPolicyValidationError{} // Validate checks the field values on RemoteDataSource with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. func (m *RemoteDataSource) Validate() error { if m == nil { return nil } if m.GetHttpUri() == nil { return RemoteDataSourceValidationError{ field: "HttpUri", reason: "value is required", } } if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RemoteDataSourceValidationError{ field: "HttpUri", reason: "embedded message failed validation", cause: err, } } } if len(m.GetSha256()) < 1 { return RemoteDataSourceValidationError{ field: "Sha256", reason: "value length must be at least 1 bytes", } } if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RemoteDataSourceValidationError{ field: "RetryPolicy", reason: "embedded message failed validation", cause: err, } } } return nil } // RemoteDataSourceValidationError is the validation error returned by // RemoteDataSource.Validate if the designated constraints aren't met. type RemoteDataSourceValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RemoteDataSourceValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RemoteDataSourceValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RemoteDataSourceValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RemoteDataSourceValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RemoteDataSourceValidationError) ErrorName() string { return "RemoteDataSourceValidationError" } // Error satisfies the builtin error interface func (e RemoteDataSourceValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRemoteDataSource.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RemoteDataSourceValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RemoteDataSourceValidationError{} // Validate checks the field values on AsyncDataSource with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. func (m *AsyncDataSource) Validate() error { if m == nil { return nil } switch m.Specifier.(type) { case *AsyncDataSource_Local: if v, ok := interface{}(m.GetLocal()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AsyncDataSourceValidationError{ field: "Local", reason: "embedded message failed validation", cause: err, } } } case *AsyncDataSource_Remote: if v, ok := interface{}(m.GetRemote()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AsyncDataSourceValidationError{ field: "Remote", reason: "embedded message failed validation", cause: err, } } } default: return AsyncDataSourceValidationError{ field: "Specifier", reason: "value is required", } } return nil } // AsyncDataSourceValidationError is the validation error returned by // AsyncDataSource.Validate if the designated constraints aren't met. type AsyncDataSourceValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AsyncDataSourceValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AsyncDataSourceValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AsyncDataSourceValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AsyncDataSourceValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AsyncDataSourceValidationError) ErrorName() string { return "AsyncDataSourceValidationError" } // Error satisfies the builtin error interface func (e AsyncDataSourceValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sAsyncDataSource.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AsyncDataSourceValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AsyncDataSourceValidationError{} // Validate checks the field values on TransportSocket with the rules defined // in the proto definition for this message. If any rules are violated, an // error is returned. func (m *TransportSocket) Validate() error { if m == nil { return nil } if len(m.GetName()) < 1 { return TransportSocketValidationError{ field: "Name", reason: "value length must be at least 1 bytes", } } switch m.ConfigType.(type) { case *TransportSocket_Config: if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TransportSocketValidationError{ field: "Config", reason: "embedded message failed validation", cause: err, } } } case *TransportSocket_TypedConfig: if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return TransportSocketValidationError{ field: "TypedConfig", reason: "embedded message failed validation", cause: err, } } } } return nil } // TransportSocketValidationError is the validation error returned by // TransportSocket.Validate if the designated constraints aren't met. type TransportSocketValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e TransportSocketValidationError) Field() string { return e.field } // Reason function returns reason value. func (e TransportSocketValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e TransportSocketValidationError) Cause() error { return e.cause } // Key function returns key value. func (e TransportSocketValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e TransportSocketValidationError) ErrorName() string { return "TransportSocketValidationError" } // Error satisfies the builtin error interface func (e TransportSocketValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sTransportSocket.%s: %s%s", key, e.field, e.reason, cause) } var _ error = TransportSocketValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = TransportSocketValidationError{} // Validate checks the field values on RuntimeFractionalPercent with the rules // defined in the proto definition for this message. If any rules are // violated, an error is returned. func (m *RuntimeFractionalPercent) Validate() error { if m == nil { return nil } if m.GetDefaultValue() == nil { return RuntimeFractionalPercentValidationError{ field: "DefaultValue", reason: "value is required", } } if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RuntimeFractionalPercentValidationError{ field: "DefaultValue", reason: "embedded message failed validation", cause: err, } } } // no validation rules for RuntimeKey return nil } // RuntimeFractionalPercentValidationError is the validation error returned by // RuntimeFractionalPercent.Validate if the designated constraints aren't met. type RuntimeFractionalPercentValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RuntimeFractionalPercentValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RuntimeFractionalPercentValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RuntimeFractionalPercentValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RuntimeFractionalPercentValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RuntimeFractionalPercentValidationError) ErrorName() string { return "RuntimeFractionalPercentValidationError" } // Error satisfies the builtin error interface func (e RuntimeFractionalPercentValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sRuntimeFractionalPercent.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RuntimeFractionalPercentValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RuntimeFractionalPercentValidationError{} // Validate checks the field values on ControlPlane with the rules defined in // the proto definition for this message. If any rules are violated, an error // is returned. func (m *ControlPlane) Validate() error { if m == nil { return nil } // no validation rules for Identifier return nil } // ControlPlaneValidationError is the validation error returned by // ControlPlane.Validate if the designated constraints aren't met. type ControlPlaneValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ControlPlaneValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ControlPlaneValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ControlPlaneValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ControlPlaneValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ControlPlaneValidationError) ErrorName() string { return "ControlPlaneValidationError" } // Error satisfies the builtin error interface func (e ControlPlaneValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) } key := "" if e.key { key = "key for " } return fmt.Sprintf( "invalid %sControlPlane.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ControlPlaneValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ControlPlaneValidationError{}
{'repo_name': 'envoyproxy/go-control-plane', 'stars': '568', 'repo_language': 'Go', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -7446309010314535192, 'source_dataset': 'data'}
# 快照服务费用细则(按量后付费) {#concept_rq2_pcx_ydb .concept} 快照服务的基础计费项为:快照容量。 快照容量的计费标准和售卖模型,与对象存储OSS标准型的价格在全地域完全一致,按量付费的单GB价格与OSS标准型一致,对象存储OSS存储包\(包年包月\)同样适用于快照容量的抵扣。 快照费用是根据快照所占用的存储空间大小计费,开通产品时默认按照实际使用量按小时计费(按量后付费模式)。 推荐您采用购买存储包(包年包月)的方式,来提前购买存储资源的使用额度和时长,获取更多的优惠。资源包支持续费和升级。 **说明:** 快照预付费存储包复用OSS存储资源包(包年包月),资费与OSS标准型存储一致。 - [购买预付费存储包](https://common-buy.aliyun.com/?spm=5176.8064714.694085.pricedetail1111.308e14ceu4kW4A&commodityCode=ossbag#/buy?request=%7B%22region%22:%22cn-shanghai%22,%20%22ossbag_type%22:%22storage%22,%20%22ossbag_spec%22:%221024%22,%20%22ord_time%22:%226:Month%22%7D) - [查看预付费价格(同对象存储OSS标准型预付费价格)](https://www.aliyun.com/price/product?spm=5176.8064714.694085.pricedetail2222.308e14ceu4kW4A#/oss/detail) ## 价格表 {#section_qrq_tcx_ydb .section} **中国大陆** |地域|计费项|类型|规格|单价(月)|单价(小时)| |:-|:--|:-|:-|:----|:-----| |华东1|快照容量|标准|1GB|0.148元/GB/月|0.000205556元/GB/小时| |华东2|快照容量|标准|1GB|0.148元/GB/月|0.000205556元/GB/小时| |华北1|快照容量|标准|1GB|0.148元/GB/月|0.000205556元/GB/小时| |华北2|快照容量|标准|1GB|0.148元/GB/月|0.000205556元/GB/小时| |华北3|快照容量|标准|1GB|0.148元/GB/月|0.000205556元/GB/小时| |华南1|快照容量|标准|1GB|0.148元/GB/月|0.000205556元/GB/小时| **香港、新加坡、亚太东南2、欧洲中部1** |计费项|类型|存储空间大小(按量付费)|单价(月)|单价(小时)| |:--|:-|:-----------|:----|:-----| |快照容量|标准|0-5GB\(含\)部分|免费|免费| |快照容量|标准|5GB-50TB\(含\)部分|0.168 元/GB/月|0.000233333 元/GB/小时| |快照容量|标准|50TB-500TB\(含\)部分|0.164 元/GB/月|0.000227778 元/GB/小时| |快照容量|标准|500TB-5000TB\(含\)部分|0.16 元/GB/月|0.000222222 元/GB/小时| |快照容量|标准|5000TB以上部分|0.154 元/GB/月|0.000213889 元/GB/小时| **美西1、美东1** |计费项|类型|存储空间大小(按量付费)|单价(月)|单价(小时)| |:--|:-|:-----------|:----|:-----| |快照容量|标准|0-5GB\(含\)部分|免费|免费| |快照容量|标准|5GB-50TB\(含\)部分|0.165 元/GB/月|0.000229167 元/GB/小时| |快照容量|标准|50TB-500TB\(含\)部分|0.162 元/GB/月|0.000225 元/GB/小时| |快照容量|标准|500TB-5000TB\(含\)部分|0.157 元/GB/月|0.000218056 元/GB/小时| |快照容量|标准|5000TB以上部分|0.152 元/GB/月|0.000211111 元/GB/小时| **亚太东北1** |计费项|类型|存储空间大小(按量付费)|单价(月)|单价(小时)| |:--|:-|:-----------|:----|:-----| |快照容量|标准|0-50TB\(含\)部分|0.197 元/GB/月|0.000273611 元/GB/小时| |快照容量|标准|50TB-500TB\(含\)部分|0.193 元/GB/月|0.000268056 元/GB/小时| |快照容量|标准|500TB-5000TB\(含\)部分|0.187 元/GB/月|0.000259722 元/GB/小时| |快照容量|标准|5000TB以上部分|0.181 元/GB/月|0.000251389 元/GB/小时| **中东东部1** |计费项|类型|存储空间大小(按量付费)|单价(月)|单价(小时)| |:--|:-|:-----------|:----|:-----| |快照容量|标准|0-5GB\(含\)部分|免费|免费| |快照容量|标准|5GB-50TB\(含\)部分|0.219 元/GB/月|0.000304167 元/GB/小时| |快照容量|标准|50TB-500TB\(含\)部分|0.216 元/GB/月|0.0003 元/GB/小时| |快照容量|标准|500TB-5000TB\(含\)部分|0.210 元/GB/月|0.000291667 元/GB/小时| |快照容量|标准|5000TB以上部分|0.204 元/GB/月|0.000283333 元/GB/小时| - **计费模式**:存储费用是根据您所占用的存储空间大小计费。没有购买包年包月资源包的用户,默认按【按量付费】进行小时扣费,按量付费小时价格=月价/24小时/30天。 - **计费说明**: 在按量付费模式下,询价金额如遇小数点,保留三位小数点,第四位四舍五入。账单列表金额遇小数点,保留两位小数点,第三位舍掉,实际扣费金额以此为准;账单详情金额遇小数点,保留三位小数点,第四位四舍五入。 - **余额不足提醒**:以小时为单位整点结算后,若下一计费周期内账户可用余额小于上一周期账单金额,则发短信和邮件提醒。 - **释放通知**:因到期/欠费释放,系统会短信和邮件通知。
{'repo_name': 'AlibabaCloudDocs/ecs', 'stars': '108', 'repo_language': 'None', 'file_name': 'Monitoring.md', 'mime_type': 'text/plain', 'hash': -391010954809694720, 'source_dataset': 'data'}
#include "ge.h" void ge_tobytes(unsigned char *s,const ge_p2 *h) { fe recip; fe x; fe y; fe_invert(recip,h->Z); fe_mul(x,h->X,recip); fe_mul(y,h->Y,recip); fe_tobytes(s,y); s[31] ^= fe_isnegative(x) << 7; }
{'repo_name': 'sumoprojects/sumokoin', 'stars': '125', 'repo_language': 'C++', 'file_name': 'FindBacktrace.cmake', 'mime_type': 'text/plain', 'hash': -8272243310153911114, 'source_dataset': 'data'}
package com.revengemission.sso.oauth2.server.persistence.repository; import com.revengemission.sso.oauth2.server.persistence.entity.RoleEntity; import org.springframework.data.jpa.repository.JpaRepository; public interface RoleRepository extends JpaRepository<RoleEntity, Long> { RoleEntity findByRoleName(String roleName); }
{'repo_name': 'jobmission/oauth2-server', 'stars': '304', 'repo_language': 'Java', 'file_name': 'OAuth2Test.java', 'mime_type': 'text/x-java', 'hash': -9051283312713376025, 'source_dataset': 'data'}
class CreatesMentorDiscussionPost < CreatesDiscussionPost def self.create!(*args) new(*args).create! end attr_reader :mentor def initialize(iteration, mentor, content) @mentor = mentor super(iteration, mentor, content) end # Note: This whole method is pretty racey. # I'm relunctant to do locking because I'd rather avoid the # pain of deadlocks and slowdowns for the occasional missed # notification etc. def create! return false unless mentor_may_comment? create_discussion_post! mentorship = CreateSolutionMentorship.(solution, mentor) solution.update!(last_updated_by_mentor_at: Time.current) mentorship.update!(requires_action_since: nil) notify_solution_user discussion_post end private def notify_solution_user CreateNotification.call( solution.user, :new_discussion_post, "#{strong mentor.handle} has commented on your solution to #{strong solution.exercise.title} on the #{strong solution.exercise.track.title} track.", routes.my_solution_iteration_url(solution, iteration), trigger: discussion_post, # We want this to be the solution not the post # to allow for clearing without a mentor having to # go into every single iteration about: iteration ) DeliverEmail.( solution.user, :new_discussion_post, discussion_post ) end def mentor_may_comment? mentor.mentoring_track?(solution.exercise.track) end def html @html ||= ParseMarkdown.(content) end def solution iteration.solution end end
{'repo_name': 'exercism/website', 'stars': '120', 'repo_language': 'Ruby', 'file_name': '404.html', 'mime_type': 'text/html', 'hash': -7731990200260052747, 'source_dataset': 'data'}
package expose import ( "fmt" "net" "net/http" "sync" "time" "github.com/gorilla/websocket" ) // Accept websocket connections at path / and forward them to the local port. func websocketToTCPHandlerFunc(targetPort uint16) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { http.NotFound(w, r) return } if !websocket.IsWebSocketUpgrade(r) { http.NotFound(w, r) return } upgrader := websocket.Upgrader{ Subprotocols: websocket.Subprotocols(r), CheckOrigin: func(r *http.Request) bool { return true }, } wsconn, err := upgrader.Upgrade(w, r, nil) if err != nil { http.Error(w, fmt.Sprintf("Could not upgrade: %s", err), 500) return } defer wsconn.Close() // only one thing is allowed to write to the wsconn at a time var writeLock sync.Mutex tcpconn, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", targetPort)) if err != nil { http.Error(w, fmt.Sprintf("Could not connect to TCP port: %s", err), 502) return } defer tcpconn.Close() // when it's time to tear down the connection, tear down both sides kill := func() { tcpconn.Close() wsconn.Close() } // Handle control messages wsconn.SetPingHandler(func(appData string) error { writeLock.Lock() defer writeLock.Unlock() return wsconn.WriteControl(websocket.PongMessage, []byte(appData), time.Now().Add(5*time.Second)) }) // send keepalives every 10s ticker := time.NewTicker(10 * time.Second) go func() { for { <-ticker.C writeLock.Lock() err := wsconn.WriteControl(websocket.PingMessage, nil, time.Now().Add(5*time.Second)) writeLock.Unlock() if err != nil { kill() return } } }() defer ticker.Stop() wsconn.SetCloseHandler(func(code int, text string) error { kill() return nil }) // bridge the two connections together, breaking the connection entirely // when any piece fails and completing this function when both directions // are closed var wg sync.WaitGroup wg.Add(2) go func() { defer kill() for { messageType, payload, err := wsconn.ReadMessage() if err != nil { // typically this means the connection was closed, but // regardless of the error we want to close the TCP connection. return } if messageType != websocket.BinaryMessage { // this is a protocol error; we don't support Text return } _, err = tcpconn.Write(payload) if err != nil { // An error occurred before the full payload could // be written; close the connection return } } }() go func() { defer kill() var buf []byte = make([]byte, 1024*512) for { n, err := tcpconn.Read(buf) if err != nil { return } var data = buf[:n] writeLock.Lock() err = wsconn.WriteMessage(websocket.BinaryMessage, data) writeLock.Unlock() if err != nil { return } } }() wg.Wait() } }
{'repo_name': 'taskcluster/taskcluster', 'stars': '103', 'repo_language': 'JavaScript', 'file_name': 'queue_artifacts_test.js', 'mime_type': 'text/plain', 'hash': 7583827972030484742, 'source_dataset': 'data'}
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ #define _OS_INTFS_C_ #include <drv_types.h> #include <hal_data.h> #if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS) #error "Shall be Linux or Windows, but not both!\n" #endif MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); MODULE_AUTHOR("Realtek Semiconductor Corp."); MODULE_VERSION(DRIVERVERSION); /* module param defaults */ int rtw_chip_version = 0x00; int rtw_rfintfs = HWPI; int rtw_lbkmode = 0;//RTL8712_AIR_TRX; int rtw_network_mode = Ndis802_11IBSS;//Ndis802_11Infrastructure;//infra, ad-hoc, auto //NDIS_802_11_SSID ssid; int rtw_channel = 1;//ad-hoc support requirement int rtw_wireless_mode = WIRELESS_MODE_MAX; int rtw_vrtl_carrier_sense = AUTO_VCS; int rtw_vcs_type = RTS_CTS;//* int rtw_rts_thresh = 2347;//* int rtw_frag_thresh = 2346;//* int rtw_preamble = PREAMBLE_LONG;//long, short, auto int rtw_scan_mode = 1;//active, passive int rtw_adhoc_tx_pwr = 1; int rtw_soft_ap = 0; //int smart_ps = 1; #ifdef CONFIG_POWER_SAVING int rtw_power_mgnt = PS_MODE_MAX; #ifdef CONFIG_IPS_LEVEL_2 int rtw_ips_mode = IPS_LEVEL_2; #else int rtw_ips_mode = IPS_NORMAL; #endif #else int rtw_power_mgnt = PS_MODE_ACTIVE; int rtw_ips_mode = IPS_NONE; #endif module_param(rtw_ips_mode, int, 0644); MODULE_PARM_DESC(rtw_ips_mode,"The default IPS mode"); int rtw_smart_ps = 2; int rtw_check_fw_ps = 1; #ifdef CONFIG_TX_EARLY_MODE int rtw_early_mode=1; #endif int rtw_usb_rxagg_mode = 2;//USB_RX_AGG_DMA =1,USB_RX_AGG_USB=2 module_param(rtw_usb_rxagg_mode, int, 0644); int rtw_radio_enable = 1; int rtw_long_retry_lmt = 7; int rtw_short_retry_lmt = 7; int rtw_busy_thresh = 40; //int qos_enable = 0; //* int rtw_ack_policy = NORMAL_ACK; int rtw_mp_mode = 0; int rtw_software_encrypt = 0; int rtw_software_decrypt = 0; int rtw_acm_method = 0;// 0:By SW 1:By HW. int rtw_wmm_enable = 1;// default is set to enable the wmm. int rtw_uapsd_enable = 0; int rtw_uapsd_max_sp = NO_LIMIT; int rtw_uapsd_acbk_en = 0; int rtw_uapsd_acbe_en = 0; int rtw_uapsd_acvi_en = 0; int rtw_uapsd_acvo_en = 0; int rtw_rfkfree_enable = 2; /* disable kfree */ #ifdef CONFIG_80211N_HT int rtw_ht_enable = 1; // 0: 20 MHz, 1: 40 MHz, 2: 80 MHz, 3: 160MHz, 4: 80+80MHz // 2.4G use bit 0 ~ 3, 5G use bit 4 ~ 7 // 0x21 means enable 2.4G 40MHz & 5G 80MHz int rtw_bw_mode = 0x21; int rtw_cbw40_enable = 3; // 0 :diable, bit(0): enable 2.4g, bit(1): enable 5g int rtw_ampdu_enable = 1;//for enable tx_ampdu ,// 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) int rtw_rx_stbc = 1;// 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on // Short GI support Bit Map // BIT0 - 20MHz, 0: non-support, 1: support // BIT1 - 40MHz, 0: non-support, 1: support // BIT2 - 80MHz, 0: non-support, 1: support // BIT3 - 160MHz, 0: non-support, 1: support int rtw_short_gi = 0xf; // BIT0: Enable VHT LDPC Rx, BIT1: Enable VHT LDPC Tx, BIT4: Enable HT LDPC Rx, BIT5: Enable HT LDPC Tx int rtw_ldpc_cap = 0x33; // BIT0: Enable VHT STBC Rx, BIT1: Enable VHT STBC Tx, BIT4: Enable HT STBC Rx, BIT5: Enable HT STBC Tx int rtw_stbc_cap = 0x13; // BIT0: Enable VHT Beamformer, BIT1: Enable VHT Beamformee, BIT4: Enable HT Beamformer, BIT5: Enable HT Beamformee int rtw_beamform_cap = 0x2; #endif //CONFIG_80211N_HT #ifdef CONFIG_80211AC_VHT int rtw_vht_enable = 1; //0:disable, 1:enable, 2:force auto enable int rtw_ampdu_factor = 7; int rtw_vht_rate_sel = 0; #endif //CONFIG_80211AC_VHT int rtw_lowrate_two_xmit = 1;//Use 2 path Tx to transmit MCS0~7 and legacy mode //int rf_config = RF_1T2R; // 1T2R int rtw_rf_config = RF_MAX_TYPE; //auto int rtw_low_power = 0; #ifdef CONFIG_WIFI_TEST int rtw_wifi_spec = 1;//for wifi test #else int rtw_wifi_spec = 0; #endif int rtw_special_rf_path = 0; //0: 2T2R ,1: only turn on path A 1T1R int rtw_channel_plan = RT_CHANNEL_DOMAIN_MAX; #ifdef CONFIG_BT_COEXIST int rtw_btcoex_enable = 1; module_param(rtw_btcoex_enable, int, 0644); MODULE_PARM_DESC(rtw_btcoex_enable, "Enable BT co-existence mechanism"); int rtw_bt_iso = 2;// 0:Low, 1:High, 2:From Efuse int rtw_bt_sco = 3;// 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy int rtw_bt_ampdu =1 ;// 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. int rtw_ant_num = -1; // <0: undefined, >0: Antenna number module_param(rtw_ant_num, int, 0644); MODULE_PARM_DESC(rtw_ant_num, "Antenna number setting"); #endif int rtw_AcceptAddbaReq = _TRUE;// 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. int rtw_antdiv_cfg = 2; // 0:OFF , 1:ON, 2:decide by Efuse config int rtw_antdiv_type = 0 ; //0:decide by efuse 1: for 88EE, 1Tx and 1RxCG are diversity.(2 Ant with SPDT), 2: for 88EE, 1Tx and 2Rx are diversity.( 2 Ant, Tx and RxCG are both on aux port, RxCS is on main port ), 3: for 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) int rtw_switch_usb3 = _FALSE; /* _FALSE: doesn't switch, _TRUE: switch from usb2.0 to usb 3.0 */ #ifdef CONFIG_USB_AUTOSUSPEND int rtw_enusbss = 1;//0:disable,1:enable #else int rtw_enusbss = 0;//0:disable,1:enable #endif int rtw_hwpdn_mode=2;//0:disable,1:enable,2: by EFUSE config #ifdef CONFIG_HW_PWRP_DETECTION int rtw_hwpwrp_detect = 1; #else int rtw_hwpwrp_detect = 0; //HW power ping detect 0:disable , 1:enable #endif #ifdef CONFIG_USB_HCI int rtw_hw_wps_pbc = 1; #else int rtw_hw_wps_pbc = 0; #endif #ifdef CONFIG_TX_MCAST2UNI int rtw_mc2u_disable = 0; #endif // CONFIG_TX_MCAST2UNI #ifdef CONFIG_80211D int rtw_80211d = 0; #endif #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV int rtw_force_ant = 2;//0 :normal, 1:Main ant, 2:Aux ant int rtw_force_igi =0;//0 :normal module_param(rtw_force_ant, int, 0644); module_param(rtw_force_igi, int, 0644); #endif #ifdef CONFIG_QOS_OPTIMIZATION int rtw_qos_opt_enable=1;//0: disable,1:enable #else int rtw_qos_opt_enable=0;//0: disable,1:enable #endif module_param(rtw_qos_opt_enable,int,0644); char* ifname = "wlan%d"; module_param(ifname, charp, 0644); MODULE_PARM_DESC(ifname, "The default name to allocate for first interface"); #ifdef CONFIG_PLATFORM_ANDROID char* if2name = "p2p%d"; #else //CONFIG_PLATFORM_ANDROID char* if2name = "wlan%d"; #endif //CONFIG_PLATFORM_ANDROID module_param(if2name, charp, 0644); MODULE_PARM_DESC(if2name, "The default name to allocate for second interface"); char* rtw_initmac = 0; // temp mac address if users want to use instead of the mac address in Efuse #ifdef CONFIG_MULTI_VIR_IFACES int rtw_ext_iface_num = 1;//primary/secondary iface is excluded module_param(rtw_ext_iface_num, int, 0644); #endif //CONFIG_MULTI_VIR_IFACES module_param(rtw_initmac, charp, 0644); module_param(rtw_channel_plan, int, 0644); module_param(rtw_special_rf_path, int, 0644); module_param(rtw_chip_version, int, 0644); module_param(rtw_rfintfs, int, 0644); module_param(rtw_lbkmode, int, 0644); module_param(rtw_network_mode, int, 0644); module_param(rtw_channel, int, 0644); module_param(rtw_mp_mode, int, 0644); module_param(rtw_wmm_enable, int, 0644); module_param(rtw_vrtl_carrier_sense, int, 0644); module_param(rtw_vcs_type, int, 0644); module_param(rtw_busy_thresh, int, 0644); #ifdef CONFIG_80211N_HT module_param(rtw_ht_enable, int, 0644); module_param(rtw_bw_mode, int, 0644); module_param(rtw_ampdu_enable, int, 0644); module_param(rtw_rx_stbc, int, 0644); module_param(rtw_ampdu_amsdu, int, 0644); #endif //CONFIG_80211N_HT #ifdef CONFIG_80211AC_VHT module_param(rtw_vht_enable, int, 0644); #endif //CONFIG_80211AC_VHT module_param(rtw_lowrate_two_xmit, int, 0644); module_param(rtw_rf_config, int, 0644); module_param(rtw_power_mgnt, int, 0644); module_param(rtw_smart_ps, int, 0644); module_param(rtw_low_power, int, 0644); module_param(rtw_wifi_spec, int, 0644); module_param(rtw_antdiv_cfg, int, 0644); module_param(rtw_antdiv_type, int, 0644); module_param(rtw_switch_usb3, int, 0644); module_param(rtw_enusbss, int, 0644); module_param(rtw_hwpdn_mode, int, 0644); module_param(rtw_hwpwrp_detect, int, 0644); module_param(rtw_hw_wps_pbc, int, 0644); #ifdef CONFIG_TX_EARLY_MODE module_param(rtw_early_mode, int, 0644); #endif #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE char *rtw_adaptor_info_caching_file_path= "/data/misc/wifi/rtw_cache"; module_param(rtw_adaptor_info_caching_file_path, charp, 0644); MODULE_PARM_DESC(rtw_adaptor_info_caching_file_path, "The path of adapter info cache file"); #endif //CONFIG_ADAPTOR_INFO_CACHING_FILE #ifdef CONFIG_LAYER2_ROAMING uint rtw_max_roaming_times=2; module_param(rtw_max_roaming_times, uint, 0644); MODULE_PARM_DESC(rtw_max_roaming_times,"The max roaming times to try"); #endif //CONFIG_LAYER2_ROAMING #ifdef CONFIG_IOL int rtw_fw_iol=1; module_param(rtw_fw_iol, int, 0644); MODULE_PARM_DESC(rtw_fw_iol, "FW IOL. 0:Disable, 1:enable, 2:by usb speed"); #endif //CONFIG_IOL #ifdef CONFIG_FILE_FWIMG char *rtw_fw_file_path = "/system/etc/firmware/rtlwifi/FW_NIC.BIN"; module_param(rtw_fw_file_path, charp, 0644); MODULE_PARM_DESC(rtw_fw_file_path, "The path of fw image"); char *rtw_fw_wow_file_path = "/system/etc/firmware/rtlwifi/FW_WoWLAN.BIN"; module_param(rtw_fw_wow_file_path, charp, 0644); MODULE_PARM_DESC(rtw_fw_wow_file_path, "The path of fw for Wake on Wireless image"); #ifdef CONFIG_MP_INCLUDED char *rtw_fw_mp_bt_file_path = ""; module_param(rtw_fw_mp_bt_file_path, charp, 0644); MODULE_PARM_DESC(rtw_fw_mp_bt_file_path, "The path of fw for MP-BT image"); #endif // CONFIG_MP_INCLUDED #endif // CONFIG_FILE_FWIMG #ifdef CONFIG_TX_MCAST2UNI module_param(rtw_mc2u_disable, int, 0644); #endif // CONFIG_TX_MCAST2UNI #ifdef CONFIG_80211D module_param(rtw_80211d, int, 0644); MODULE_PARM_DESC(rtw_80211d, "Enable 802.11d mechanism"); #endif uint rtw_notch_filter = RTW_NOTCH_FILTER; module_param(rtw_notch_filter, uint, 0644); MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P"); uint rtw_hiq_filter = CONFIG_RTW_HIQ_FILTER; module_param(rtw_hiq_filter, uint, 0644); MODULE_PARM_DESC(rtw_hiq_filter, "0:allow all, 1:allow special, 2:deny all"); uint rtw_adaptivity_en = CONFIG_RTW_ADAPTIVITY_EN; module_param(rtw_adaptivity_en, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_en, "0:disable, 1:enable"); uint rtw_adaptivity_mode = CONFIG_RTW_ADAPTIVITY_MODE; module_param(rtw_adaptivity_mode, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_mode, "0:normal, 1:carrier sense"); uint rtw_adaptivity_dml = CONFIG_RTW_ADAPTIVITY_DML; module_param(rtw_adaptivity_dml, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_dml, "0:disable, 1:enable"); uint rtw_adaptivity_dc_backoff = CONFIG_RTW_ADAPTIVITY_DC_BACKOFF; module_param(rtw_adaptivity_dc_backoff, uint, 0644); MODULE_PARM_DESC(rtw_adaptivity_dc_backoff, "DC backoff for Adaptivity"); uint rtw_amplifier_type_2g = CONFIG_RTW_AMPLIFIER_TYPE_2G; module_param(rtw_amplifier_type_2g, uint, 0644); MODULE_PARM_DESC(rtw_amplifier_type_2g, "BIT3:2G ext-PA, BIT4:2G ext-LNA"); uint rtw_amplifier_type_5g = CONFIG_RTW_AMPLIFIER_TYPE_5G; module_param(rtw_amplifier_type_5g, uint, 0644); MODULE_PARM_DESC(rtw_amplifier_type_5g, "BIT6:5G ext-PA, BIT7:5G ext-LNA"); uint rtw_RFE_type = 64; module_param(rtw_RFE_type, uint, 0644); MODULE_PARM_DESC(rtw_RFE_type, "default init value:64"); uint rtw_TxBBSwing_2G = 0xFF; module_param(rtw_TxBBSwing_2G, uint, 0644); MODULE_PARM_DESC(rtw_TxBBSwing_2G, "default init value:0xFF"); uint rtw_TxBBSwing_5G = 0xFF; module_param(rtw_TxBBSwing_5G, uint, 0644); MODULE_PARM_DESC(rtw_TxBBSwing_5G, "default init value:0xFF"); uint rtw_OffEfuseMask = 0; module_param(rtw_OffEfuseMask, uint, 0644); MODULE_PARM_DESC(rtw_OffEfuseMask, "default open Efuse Mask vaule:0"); uint rtw_FileMaskEfuse = 0; module_param(rtw_FileMaskEfuse, uint, 0644); MODULE_PARM_DESC(rtw_FileMaskEfuse, "default drv Mask Efuse vaule:0"); #if defined(CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY) //eFuse: Regulatory selection=1 int rtw_tx_pwr_lmt_enable = 1; int rtw_tx_pwr_by_rate = 1; #elif defined(CONFIG_CALIBRATE_TX_POWER_TO_MAX)//eFuse: Regulatory selection=0 int rtw_tx_pwr_lmt_enable = 0; int rtw_tx_pwr_by_rate = 1; #else //eFuse: Regulatory selection=2 #ifdef CONFIG_PCI_HCI int rtw_tx_pwr_lmt_enable = 2; // 2- Depend on efuse int rtw_tx_pwr_by_rate = 2;// 2- Depend on efuse #else // USB & SDIO int rtw_tx_pwr_lmt_enable = 0; int rtw_tx_pwr_by_rate = 0; #endif #endif module_param(rtw_tx_pwr_lmt_enable, int, 0644); MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable,"0:Disable, 1:Enable, 2: Depend on efuse"); module_param(rtw_tx_pwr_by_rate, int, 0644); MODULE_PARM_DESC(rtw_tx_pwr_by_rate,"0:Disable, 1:Enable, 2: Depend on efuse"); #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE char *rtw_phy_file_path = REALTEK_CONFIG_PATH; module_param(rtw_phy_file_path, charp, 0644); MODULE_PARM_DESC(rtw_phy_file_path, "The path of phy parameter"); // PHY FILE Bit Map // BIT0 - MAC, 0: non-support, 1: support // BIT1 - BB, 0: non-support, 1: support // BIT2 - BB_PG, 0: non-support, 1: support // BIT3 - BB_MP, 0: non-support, 1: support // BIT4 - RF, 0: non-support, 1: support // BIT5 - RF_TXPWR_TRACK, 0: non-support, 1: support // BIT6 - RF_TXPWR_LMT, 0: non-support, 1: support int rtw_load_phy_file = (BIT2|BIT6); module_param(rtw_load_phy_file, int, 0644); MODULE_PARM_DESC(rtw_load_phy_file,"PHY File Bit Map"); int rtw_decrypt_phy_file = 0; module_param(rtw_decrypt_phy_file, int, 0644); MODULE_PARM_DESC(rtw_decrypt_phy_file,"Enable Decrypt PHY File"); #endif static uint loadparam(PADAPTER padapter, _nic_hdl pnetdev); int _netdev_open(struct net_device *pnetdev); int netdev_open (struct net_device *pnetdev); static int netdev_close (struct net_device *pnetdev); #ifdef CONFIG_PLATFORM_INTEL_BYT extern int rtw_sdio_set_power(int on); #endif //CONFIG_PLATFORM_INTEL_BYT //#ifdef RTK_DMP_PLATFORM uint loadparam( _adapter *padapter, _nic_hdl pnetdev) { uint status = _SUCCESS; struct registry_priv *registry_par = &padapter->registrypriv; _func_enter_; registry_par->chip_version = (u8)rtw_chip_version; registry_par->rfintfs = (u8)rtw_rfintfs; registry_par->lbkmode = (u8)rtw_lbkmode; //registry_par->hci = (u8)hci; registry_par->network_mode = (u8)rtw_network_mode; _rtw_memcpy(registry_par->ssid.Ssid, "ANY", 3); registry_par->ssid.SsidLength = 3; registry_par->channel = (u8)rtw_channel; registry_par->wireless_mode = (u8)rtw_wireless_mode; if (IsSupported24G(registry_par->wireless_mode) && (!IsSupported5G(registry_par->wireless_mode)) && (registry_par->channel > 14)) { registry_par->channel = 1; } else if (IsSupported5G(registry_par->wireless_mode) && (!IsSupported24G(registry_par->wireless_mode)) && (registry_par->channel <= 14)) { registry_par->channel = 36; } registry_par->vrtl_carrier_sense = (u8)rtw_vrtl_carrier_sense ; registry_par->vcs_type = (u8)rtw_vcs_type; registry_par->rts_thresh=(u16)rtw_rts_thresh; registry_par->frag_thresh=(u16)rtw_frag_thresh; registry_par->preamble = (u8)rtw_preamble; registry_par->scan_mode = (u8)rtw_scan_mode; registry_par->adhoc_tx_pwr = (u8)rtw_adhoc_tx_pwr; registry_par->soft_ap= (u8)rtw_soft_ap; registry_par->smart_ps = (u8)rtw_smart_ps; registry_par->check_fw_ps = (u8)rtw_check_fw_ps; registry_par->power_mgnt = (u8)rtw_power_mgnt; registry_par->ips_mode = (u8)rtw_ips_mode; registry_par->radio_enable = (u8)rtw_radio_enable; registry_par->long_retry_lmt = (u8)rtw_long_retry_lmt; registry_par->short_retry_lmt = (u8)rtw_short_retry_lmt; registry_par->busy_thresh = (u16)rtw_busy_thresh; //registry_par->qos_enable = (u8)rtw_qos_enable; registry_par->ack_policy = (u8)rtw_ack_policy; registry_par->mp_mode = (u8)rtw_mp_mode; registry_par->software_encrypt = (u8)rtw_software_encrypt; registry_par->software_decrypt = (u8)rtw_software_decrypt; registry_par->acm_method = (u8)rtw_acm_method; registry_par->usb_rxagg_mode = (u8)rtw_usb_rxagg_mode; //UAPSD registry_par->wmm_enable = (u8)rtw_wmm_enable; registry_par->uapsd_enable = (u8)rtw_uapsd_enable; registry_par->uapsd_max_sp = (u8)rtw_uapsd_max_sp; registry_par->uapsd_acbk_en = (u8)rtw_uapsd_acbk_en; registry_par->uapsd_acbe_en = (u8)rtw_uapsd_acbe_en; registry_par->uapsd_acvi_en = (u8)rtw_uapsd_acvi_en; registry_par->uapsd_acvo_en = (u8)rtw_uapsd_acvo_en; registry_par->RegRfKFreeEnable = (u8)rtw_rfkfree_enable; #ifdef CONFIG_80211N_HT registry_par->ht_enable = (u8)rtw_ht_enable; registry_par->bw_mode = (u8)rtw_bw_mode; registry_par->ampdu_enable = (u8)rtw_ampdu_enable; registry_par->rx_stbc = (u8)rtw_rx_stbc; registry_par->ampdu_amsdu = (u8)rtw_ampdu_amsdu; registry_par->short_gi = (u8)rtw_short_gi; registry_par->ldpc_cap = (u8)rtw_ldpc_cap; registry_par->stbc_cap = (u8)rtw_stbc_cap; registry_par->beamform_cap = (u8)rtw_beamform_cap; #endif #ifdef CONFIG_80211AC_VHT registry_par->vht_enable = (u8)rtw_vht_enable; registry_par->ampdu_factor = (u8)rtw_ampdu_factor; registry_par->vht_rate_sel = (u8)rtw_vht_rate_sel; #endif #ifdef CONFIG_TX_EARLY_MODE registry_par->early_mode = (u8)rtw_early_mode; #endif registry_par->lowrate_two_xmit = (u8)rtw_lowrate_two_xmit; registry_par->rf_config = (u8)rtw_rf_config; registry_par->low_power = (u8)rtw_low_power; registry_par->wifi_spec = (u8)rtw_wifi_spec; registry_par->channel_plan = (u8)rtw_channel_plan; registry_par->special_rf_path = (u8)rtw_special_rf_path; #ifdef CONFIG_BT_COEXIST registry_par->btcoex = (u8)rtw_btcoex_enable; registry_par->bt_iso = (u8)rtw_bt_iso; registry_par->bt_sco = (u8)rtw_bt_sco; registry_par->bt_ampdu = (u8)rtw_bt_ampdu; registry_par->ant_num = (s8)rtw_ant_num; #endif registry_par->bAcceptAddbaReq = (u8)rtw_AcceptAddbaReq; registry_par->antdiv_cfg = (u8)rtw_antdiv_cfg; registry_par->antdiv_type = (u8)rtw_antdiv_type; registry_par->switch_usb3 = (u8)rtw_switch_usb3; #ifdef CONFIG_AUTOSUSPEND registry_par->usbss_enable = (u8)rtw_enusbss;//0:disable,1:enable #endif #ifdef SUPPORT_HW_RFOFF_DETECTED registry_par->hwpdn_mode = (u8)rtw_hwpdn_mode;//0:disable,1:enable,2:by EFUSE config registry_par->hwpwrp_detect = (u8)rtw_hwpwrp_detect;//0:disable,1:enable #endif registry_par->hw_wps_pbc = (u8)rtw_hw_wps_pbc; #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE snprintf(registry_par->adaptor_info_caching_file_path, PATH_LENGTH_MAX, "%s", rtw_adaptor_info_caching_file_path); registry_par->adaptor_info_caching_file_path[PATH_LENGTH_MAX-1]=0; #endif #ifdef CONFIG_LAYER2_ROAMING registry_par->max_roaming_times = (u8)rtw_max_roaming_times; #ifdef CONFIG_INTEL_WIDI registry_par->max_roaming_times = (u8)rtw_max_roaming_times + 2; #endif // CONFIG_INTEL_WIDI #endif #ifdef CONFIG_IOL registry_par->fw_iol = rtw_fw_iol; #endif #ifdef CONFIG_80211D registry_par->enable80211d = (u8)rtw_80211d; #endif snprintf(registry_par->ifname, 16, "%s", ifname); snprintf(registry_par->if2name, 16, "%s", if2name); registry_par->notch_filter = (u8)rtw_notch_filter; #ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV registry_par->force_ant = (u8)rtw_force_ant; registry_par->force_igi = (u8)rtw_force_igi; #endif #ifdef CONFIG_MULTI_VIR_IFACES registry_par->ext_iface_num = (u8)rtw_ext_iface_num; #endif //CONFIG_MULTI_VIR_IFACES registry_par->RegEnableTxPowerLimit = (u8)rtw_tx_pwr_lmt_enable; registry_par->RegEnableTxPowerByRate = (u8)rtw_tx_pwr_by_rate; registry_par->RegPowerBase = 14; registry_par->TxBBSwing_2G = (s8)rtw_TxBBSwing_2G; registry_par->TxBBSwing_5G = (s8)rtw_TxBBSwing_5G; registry_par->bEn_RFE = 1; registry_par->RFE_Type = (u8)rtw_RFE_type; registry_par->AmplifierType_2G = (u8)rtw_amplifier_type_2g; registry_par->AmplifierType_5G = (u8)rtw_amplifier_type_5g; #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE registry_par->load_phy_file = (u8)rtw_load_phy_file; registry_par->RegDecryptCustomFile = (u8)rtw_decrypt_phy_file; #endif registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable; registry_par->hiq_filter = (u8)rtw_hiq_filter; registry_par->adaptivity_en = (u8)rtw_adaptivity_en; registry_par->adaptivity_mode = (u8)rtw_adaptivity_mode; registry_par->adaptivity_dml = (u8)rtw_adaptivity_dml; registry_par->adaptivity_dc_backoff = (u8)rtw_adaptivity_dc_backoff; registry_par->boffefusemask = (u8)rtw_OffEfuseMask; registry_par->bFileMaskEfuse = (u8)rtw_FileMaskEfuse; _func_exit_; return status; } static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct sockaddr *addr = p; if(padapter->bup == _FALSE) { //DBG_871X("r8711_net_set_mac_address(), MAC=%x:%x:%x:%x:%x:%x\n", addr->sa_data[0], addr->sa_data[1], addr->sa_data[2], addr->sa_data[3], //addr->sa_data[4], addr->sa_data[5]); _rtw_memcpy(adapter_mac_addr(padapter), addr->sa_data, ETH_ALEN); //_rtw_memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN); //padapter->bset_hwaddr = _TRUE; } return 0; } static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct recv_priv *precvpriv = &(padapter->recvpriv); padapter->stats.tx_packets = pxmitpriv->tx_pkts;//pxmitpriv->tx_pkts++; padapter->stats.rx_packets = precvpriv->rx_pkts;//precvpriv->rx_pkts++; padapter->stats.tx_dropped = pxmitpriv->tx_drop; padapter->stats.rx_dropped = precvpriv->rx_drop; padapter->stats.tx_bytes = pxmitpriv->tx_bytes; padapter->stats.rx_bytes = precvpriv->rx_bytes; return &padapter->stats; } #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) /* * AC to queue mapping * * AC_VO -> queue 0 * AC_VI -> queue 1 * AC_BE -> queue 2 * AC_BK -> queue 3 */ static const u16 rtw_1d_to_queue[8] = { 2, 3, 3, 2, 1, 1, 0, 0 }; /* Given a data frame determine the 802.1p/1d tag to use. */ unsigned int rtw_classify8021d(struct sk_buff *skb) { unsigned int dscp; /* skb->priority values from 256->263 are magic values to * directly indicate a specific 802.1d priority. This is used * to allow 802.1d priority to be passed directly in from VLAN * tags, etc. */ if (skb->priority >= 256 && skb->priority <= 263) return skb->priority - 256; switch (skb->protocol) { case htons(ETH_P_IP): dscp = ip_hdr(skb)->tos & 0xfc; break; default: return 0; } return dscp >> 5; } static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) , void *accel_priv #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) , select_queue_fallback_t fallback #endif #endif ) { _adapter *padapter = rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; skb->priority = rtw_classify8021d(skb); if(pmlmepriv->acm_mask != 0) { skb->priority = qos_acm(pmlmepriv->acm_mask, skb->priority); } return rtw_1d_to_queue[skb->priority]; } u16 rtw_recv_select_queue(struct sk_buff *skb) { struct iphdr *piphdr; unsigned int dscp; u16 eth_type; u32 priority; u8 *pdata = skb->data; _rtw_memcpy(&eth_type, pdata+(ETH_ALEN<<1), 2); switch (eth_type) { case htons(ETH_P_IP): piphdr = (struct iphdr *)(pdata+ETH_HLEN); dscp = piphdr->tos & 0xfc; priority = dscp >> 5; break; default: priority = 0; } return rtw_1d_to_queue[priority]; } #endif static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ptr) { #if (LINUX_VERSION_CODE>=KERNEL_VERSION(3,11,0)) struct net_device *dev = netdev_notifier_info_to_dev(ptr); #else struct net_device *dev = ptr; #endif #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) if (dev->netdev_ops->ndo_do_ioctl != rtw_ioctl) #else if (dev->do_ioctl != rtw_ioctl) #endif return NOTIFY_DONE; DBG_871X_LEVEL(_drv_info_, FUNC_NDEV_FMT" state:%lu\n", FUNC_NDEV_ARG(dev), state); switch (state) { case NETDEV_CHANGENAME: rtw_adapter_proc_replace(dev); break; } return NOTIFY_DONE; } static struct notifier_block rtw_ndev_notifier = { .notifier_call = rtw_ndev_notifier_call, }; int rtw_ndev_notifier_register(void) { return register_netdevice_notifier(&rtw_ndev_notifier); } void rtw_ndev_notifier_unregister(void) { unregister_netdevice_notifier(&rtw_ndev_notifier); } int rtw_ndev_init(struct net_device *dev) { _adapter *adapter = rtw_netdev_priv(dev); DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter)); strncpy(adapter->old_ifname, dev->name, IFNAMSIZ); adapter->old_ifname[IFNAMSIZ-1] = '\0'; rtw_adapter_proc_init(dev); return 0; } void rtw_ndev_uninit(struct net_device *dev) { _adapter *adapter = rtw_netdev_priv(dev); DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter)); rtw_adapter_proc_deinit(dev); } #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) static const struct net_device_ops rtw_netdev_ops = { .ndo_init = rtw_ndev_init, .ndo_uninit = rtw_ndev_uninit, .ndo_open = netdev_open, .ndo_stop = netdev_close, .ndo_start_xmit = rtw_xmit_entry, #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) .ndo_select_queue = rtw_select_queue, #endif .ndo_set_mac_address = rtw_net_set_mac_address, .ndo_get_stats = rtw_net_get_stats, .ndo_do_ioctl = rtw_ioctl, }; #endif int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) { _adapter *padapter = rtw_netdev_priv(pnetdev); #ifdef CONFIG_EASY_REPLACEMENT struct net_device *TargetNetdev = NULL; _adapter *TargetAdapter = NULL; struct net *devnet = NULL; if(padapter->bDongle == 1) { #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) TargetNetdev = dev_get_by_name("wlan0"); #else #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) devnet = pnetdev->nd_net; #else devnet = dev_net(pnetdev); #endif TargetNetdev = dev_get_by_name(devnet, "wlan0"); #endif if(TargetNetdev) { DBG_871X("Force onboard module driver disappear !!!\n"); TargetAdapter = rtw_netdev_priv(TargetNetdev); TargetAdapter->DriverState = DRIVER_DISAPPEAR; padapter->pid[0] = TargetAdapter->pid[0]; padapter->pid[1] = TargetAdapter->pid[1]; padapter->pid[2] = TargetAdapter->pid[2]; dev_put(TargetNetdev); unregister_netdev(TargetNetdev); padapter->DriverState = DRIVER_REPLACE_DONGLE; } } #endif //CONFIG_EASY_REPLACEMENT if(dev_alloc_name(pnetdev, ifname) < 0) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("dev_alloc_name, fail! \n")); } netif_carrier_off(pnetdev); //rtw_netif_stop_queue(pnetdev); return 0; } struct net_device *rtw_init_netdev(_adapter *old_padapter) { _adapter *padapter; struct net_device *pnetdev; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+init_net_dev\n")); if(old_padapter != NULL) pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(_adapter), (void *)old_padapter); else pnetdev = rtw_alloc_etherdev(sizeof(_adapter)); if (!pnetdev) return NULL; padapter = rtw_netdev_priv(pnetdev); padapter->pnetdev = pnetdev; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) SET_MODULE_OWNER(pnetdev); #endif //pnetdev->init = NULL; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) DBG_871X("register rtw_netdev_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtw_netdev_ops; #else pnetdev->init = rtw_ndev_init; pnetdev->uninit = rtw_ndev_uninit; pnetdev->open = netdev_open; pnetdev->stop = netdev_close; pnetdev->hard_start_xmit = rtw_xmit_entry; pnetdev->set_mac_address = rtw_net_set_mac_address; pnetdev->get_stats = rtw_net_get_stats; pnetdev->do_ioctl = rtw_ioctl; #endif #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX pnetdev->features |= NETIF_F_IP_CSUM; #endif //pnetdev->tx_timeout = NULL; pnetdev->watchdog_timeo = HZ*3; /* 3 second timeout */ #ifdef CONFIG_WIRELESS_EXT pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def; #endif #ifdef WIRELESS_SPY //priv->wireless_data.spy_data = &priv->spy_data; //pnetdev->wireless_data = &priv->wireless_data; #endif //step 2. loadparam(padapter, pnetdev); return pnetdev; } void rtw_unregister_netdev(_adapter *adapter) { struct net_device *netdev = NULL; if (adapter == NULL) return; netdev = adapter->pnetdev; if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) unregister_netdev(netdev); /* will call netdev_close() */ #ifdef CONFIG_IOCTL_CFG80211 rtw_wdev_unregister(adapter->rtw_wdev); #endif } void rtw_unregister_netdevs(struct dvobj_priv *dvobj) { int i; _adapter *adapter = NULL; for (i = 0; i < dvobj->iface_nums; i++) { adapter = dvobj->padapters[i]; if (adapter == NULL) continue; rtw_unregister_netdev(adapter); } } u32 rtw_start_drv_threads(_adapter *padapter) { u32 _status = _SUCCESS; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_start_drv_threads\n")); #ifdef CONFIG_XMIT_THREAD_MODE #if defined(CONFIG_SDIO_HCI) if(is_primary_adapter(padapter)) #endif { padapter->xmitThread = kthread_run(rtw_xmit_thread, padapter, "RTW_XMIT_THREAD"); if(IS_ERR(padapter->xmitThread)) _status = _FAIL; } #endif //#ifdef CONFIG_XMIT_THREAD_MODE #ifdef CONFIG_RECV_THREAD_MODE padapter->recvThread = kthread_run(rtw_recv_thread, padapter, "RTW_RECV_THREAD"); if(IS_ERR(padapter->recvThread)) _status = _FAIL; #endif if(is_primary_adapter(padapter)) { padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "RTW_CMD_THREAD"); if(IS_ERR(padapter->cmdThread)) _status = _FAIL; else _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); //wait for cmd_thread to run } #ifdef CONFIG_EVENT_THREAD_MODE padapter->evtThread = kthread_run(event_thread, padapter, "RTW_EVENT_THREAD"); if(IS_ERR(padapter->evtThread)) _status = _FAIL; #endif rtw_hal_start_thread(padapter); return _status; } void rtw_stop_drv_threads (_adapter *padapter) { RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_stop_drv_threads\n")); #ifdef CONFIG_CONCURRENT_MODE if(padapter->isprimary == _TRUE) #endif //CONFIG_CONCURRENT_MODE { rtw_stop_cmd_thread(padapter); } #ifdef CONFIG_EVENT_THREAD_MODE _rtw_up_sema(&padapter->evtpriv.evt_notify); if(padapter->evtThread){ _rtw_down_sema(&padapter->evtpriv.terminate_evtthread_sema); } #endif #ifdef CONFIG_XMIT_THREAD_MODE // Below is to termindate tx_thread... #if defined(CONFIG_SDIO_HCI) && defined(CONFIG_CONCURRENT_MODE) // Only wake-up primary adapter if(padapter->adapter_type == PRIMARY_ADAPTER) #endif //SDIO_HCI + CONCURRENT { _rtw_up_sema(&padapter->xmitpriv.xmit_sema); _rtw_down_sema(&padapter->xmitpriv.terminate_xmitthread_sema); } RT_TRACE(_module_os_intfs_c_,_drv_info_,("\n drv_halt: rtw_xmit_thread can be terminated ! \n")); #endif #ifdef CONFIG_RECV_THREAD_MODE // Below is to termindate rx_thread... _rtw_up_sema(&padapter->recvpriv.recv_sema); _rtw_down_sema(&padapter->recvpriv.terminate_recvthread_sema); RT_TRACE(_module_os_intfs_c_,_drv_info_,("\n drv_halt:recv_thread can be terminated! \n")); #endif rtw_hal_stop_thread(padapter); } u8 rtw_init_default_value(_adapter *padapter); u8 rtw_init_default_value(_adapter *padapter) { u8 ret = _SUCCESS; struct registry_priv* pregistrypriv = &padapter->registrypriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_priv *pmlmepriv= &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; //xmit_priv pxmitpriv->vcs_setting = pregistrypriv->vrtl_carrier_sense; pxmitpriv->vcs = pregistrypriv->vcs_type; pxmitpriv->vcs_type = pregistrypriv->vcs_type; //pxmitpriv->rts_thresh = pregistrypriv->rts_thresh; pxmitpriv->frag_len = pregistrypriv->frag_thresh; //recv_priv //mlme_priv pmlmepriv->scan_mode = SCAN_ACTIVE; //qos_priv //pmlmepriv->qospriv.qos_option = pregistrypriv->wmm_enable; //ht_priv #ifdef CONFIG_80211N_HT pmlmepriv->htpriv.ampdu_enable = _FALSE;//set to disabled #endif //security_priv //rtw_get_encrypt_decrypt_from_registrypriv(padapter); psecuritypriv->binstallGrpkey = _FAIL; #ifdef CONFIG_GTK_OL psecuritypriv->binstallKCK_KEK = _FAIL; #endif //CONFIG_GTK_OL psecuritypriv->sw_encrypt=pregistrypriv->software_encrypt; psecuritypriv->sw_decrypt=pregistrypriv->software_decrypt; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; psecuritypriv->dot11PrivacyKeyIndex = 0; psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; psecuritypriv->dot118021XGrpKeyid = 1; psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; psecuritypriv->ndisencryptstatus = Ndis802_11WEPDisabled; //pwrctrl_priv //registry_priv rtw_init_registrypriv_dev_network(padapter); rtw_update_registrypriv_dev_network(padapter); //hal_priv rtw_hal_def_value_init(padapter); //misc. RTW_ENABLE_FUNC(padapter, DF_RX_BIT); RTW_ENABLE_FUNC(padapter, DF_TX_BIT); padapter->bLinkInfoDump = 0; padapter->bNotifyChannelChange = _FALSE; #ifdef CONFIG_P2P padapter->bShowGetP2PState = 1; #endif //for debug purpose padapter->fix_rate = 0xFF; padapter->data_fb = 0; padapter->driver_ampdu_spacing = 0xFF; padapter->driver_rx_ampdu_factor = 0xFF; padapter->driver_rx_ampdu_spacing = 0xFF; padapter->fix_rx_ampdu_accept = RX_AMPDU_ACCEPT_INVALID; padapter->fix_rx_ampdu_size = RX_AMPDU_SIZE_INVALID; #ifdef DBG_RX_COUNTER_DUMP padapter->dump_rx_cnt_mode = 0; padapter->drv_rx_cnt_ok = 0; padapter->drv_rx_cnt_crcerror = 0; padapter->drv_rx_cnt_drop = 0; #endif return ret; } struct dvobj_priv *devobj_init(void) { struct dvobj_priv *pdvobj = NULL; if ((pdvobj = (struct dvobj_priv*)rtw_zmalloc(sizeof(*pdvobj))) == NULL) { return NULL; } _rtw_mutex_init(&pdvobj->hw_init_mutex); _rtw_mutex_init(&pdvobj->h2c_fwcmd_mutex); _rtw_mutex_init(&pdvobj->setch_mutex); _rtw_mutex_init(&pdvobj->setbw_mutex); pdvobj->processing_dev_remove = _FALSE; ATOMIC_SET(&pdvobj->disable_func, 0); rtw_macid_ctl_init(&pdvobj->macid_ctl); _rtw_spinlock_init(&pdvobj->cam_ctl.lock); return pdvobj; } void devobj_deinit(struct dvobj_priv *pdvobj) { if(!pdvobj) return; _rtw_mutex_free(&pdvobj->hw_init_mutex); _rtw_mutex_free(&pdvobj->h2c_fwcmd_mutex); _rtw_mutex_free(&pdvobj->setch_mutex); _rtw_mutex_free(&pdvobj->setbw_mutex); rtw_macid_ctl_deinit(&pdvobj->macid_ctl); _rtw_spinlock_free(&pdvobj->cam_ctl.lock); rtw_mfree((u8*)pdvobj, sizeof(*pdvobj)); } u8 rtw_reset_drv_sw(_adapter *padapter) { u8 ret8=_SUCCESS; struct mlme_priv *pmlmepriv= &padapter->mlmepriv; struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); //hal_priv if( is_primary_adapter(padapter)) rtw_hal_def_value_init(padapter); RTW_ENABLE_FUNC(padapter, DF_RX_BIT); RTW_ENABLE_FUNC(padapter, DF_TX_BIT); padapter->bLinkInfoDump = 0; padapter->xmitpriv.tx_pkts = 0; padapter->recvpriv.rx_pkts = 0; pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; //pmlmepriv->LinkDetectInfo.TrafficBusyState = _FALSE; pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 0; pmlmepriv->LinkDetectInfo.LowPowerTransitionCount = 0; _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY |_FW_UNDER_LINKING); #ifdef CONFIG_AUTOSUSPEND #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34)) adapter_to_dvobj(padapter)->pusbdev->autosuspend_disabled = 1;//autosuspend disabled by the user #endif #endif #ifdef DBG_CONFIG_ERROR_DETECT if (is_primary_adapter(padapter)) rtw_hal_sreset_reset_value(padapter); #endif pwrctrlpriv->pwr_state_check_cnts = 0; //mlmeextpriv padapter->mlmeextpriv.sitesurvey_res.state= SCAN_DISABLE; #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS rtw_set_signal_stat_timer(&padapter->recvpriv); #endif return ret8; } u8 rtw_init_drv_sw(_adapter *padapter) { u8 ret8=_SUCCESS; _func_enter_; RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_init_drv_sw\n")); ret8 = rtw_init_default_value(padapter); if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init cmd_priv\n")); ret8=_FAIL; goto exit; } padapter->cmdpriv.padapter=padapter; if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init evt_priv\n")); ret8=_FAIL; goto exit; } if (rtw_init_mlme_priv(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init mlme_priv\n")); ret8=_FAIL; goto exit; } #ifdef CONFIG_P2P rtw_init_wifidirect_timers(padapter); init_wifidirect_info(padapter, P2P_ROLE_DISABLE); reset_global_wifidirect_info(padapter); #ifdef CONFIG_IOCTL_CFG80211 rtw_init_cfg80211_wifidirect_info(padapter); #endif #ifdef CONFIG_WFD if(rtw_init_wifi_display_info(padapter) == _FAIL) RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init init_wifi_display_info\n")); #endif #endif /* CONFIG_P2P */ if(init_mlme_ext_priv(padapter) == _FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init mlme_ext_priv\n")); ret8=_FAIL; goto exit; } #ifdef CONFIG_TDLS if(rtw_init_tdls_info(padapter) == _FAIL) { DBG_871X("Can't rtw_init_tdls_info\n"); ret8=_FAIL; goto exit; } #endif //CONFIG_TDLS if(_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { DBG_871X("Can't _rtw_init_xmit_priv\n"); ret8=_FAIL; goto exit; } if(_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { DBG_871X("Can't _rtw_init_recv_priv\n"); ret8=_FAIL; goto exit; } // add for CONFIG_IEEE80211W, none 11w also can use _rtw_spinlock_init(&padapter->security_key_mutex); // We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). //_rtw_memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); //_init_timer(&(padapter->securitypriv.tkip_timer), padapter->pifp, rtw_use_tkipkey_handler, padapter); if(_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { DBG_871X("Can't _rtw_init_sta_priv\n"); ret8=_FAIL; goto exit; } padapter->stapriv.padapter = padapter; padapter->setband = WIFI_FREQUENCY_BAND_AUTO; padapter->fix_rate = 0xFF; padapter->data_fb = 0; padapter->fix_rx_ampdu_accept = RX_AMPDU_ACCEPT_INVALID; padapter->fix_rx_ampdu_size = RX_AMPDU_SIZE_INVALID; #ifdef DBG_RX_COUNTER_DUMP padapter->dump_rx_cnt_mode = 0; padapter->drv_rx_cnt_ok = 0; padapter->drv_rx_cnt_crcerror = 0; padapter->drv_rx_cnt_drop = 0; #endif rtw_init_bcmc_stainfo(padapter); rtw_init_pwrctrl_priv(padapter); //_rtw_memset((u8 *)&padapter->qospriv, 0, sizeof (struct qos_priv));//move to mlme_priv #ifdef CONFIG_MP_INCLUDED if (init_mp_priv(padapter) == _FAIL) { DBG_871X("%s: initialize MP private data Fail!\n", __func__); } #endif rtw_hal_dm_init(padapter); rtw_hal_sw_led_init(padapter); #ifdef DBG_CONFIG_ERROR_DETECT rtw_hal_sreset_init(padapter); #endif #ifdef CONFIG_INTEL_WIDI if(rtw_init_intel_widi(padapter) == _FAIL) { DBG_871X("Can't rtw_init_intel_widi\n"); ret8=_FAIL; goto exit; } #endif //CONFIG_INTEL_WIDI #ifdef CONFIG_WAPI_SUPPORT padapter->WapiSupport = true; //set true temp, will revise according to Efuse or Registry value later. rtw_wapi_init(padapter); #endif #ifdef CONFIG_BR_EXT _rtw_spinlock_init(&padapter->br_ext_lock); #endif // CONFIG_BR_EXT exit: RT_TRACE(_module_os_intfs_c_,_drv_info_,("-rtw_init_drv_sw\n")); _func_exit_; return ret8; } #ifdef CONFIG_WOWLAN void rtw_cancel_dynamic_chk_timer(_adapter *padapter) { _cancel_timer_ex(&padapter->mlmepriv.dynamic_chk_timer); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel dynamic_chk_timer! \n")); } #endif void rtw_cancel_all_timer(_adapter *padapter) { RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_cancel_all_timer\n")); _cancel_timer_ex(&padapter->mlmepriv.assoc_timer); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel association timer complete! \n")); //_cancel_timer_ex(&padapter->securitypriv.tkip_timer); //RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel tkip_timer! \n")); _cancel_timer_ex(&padapter->mlmepriv.scan_to_timer); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel scan_to_timer! \n")); _cancel_timer_ex(&padapter->mlmepriv.dynamic_chk_timer); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel dynamic_chk_timer! \n")); // cancel sw led timer rtw_hal_sw_led_deinit(padapter); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel DeInitSwLeds! \n")); _cancel_timer_ex(&(adapter_to_pwrctl(padapter)->pwr_state_check_timer)); #ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_P2P _cancel_timer_ex(&padapter->cfg80211_wdinfo.remain_on_ch_timer); #endif //CONFIG_P2P #endif //CONFIG_IOCTL_CFG80211 #ifdef CONFIG_SET_SCAN_DENY_TIMER _cancel_timer_ex(&padapter->mlmepriv.set_scan_deny_timer); rtw_clear_scan_deny(padapter); RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel set_scan_deny_timer! \n")); #endif #ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS _cancel_timer_ex(&padapter->recvpriv.signal_stat_timer); #endif //cancel dm timer rtw_hal_dm_deinit(padapter); #ifdef CONFIG_PLATFORM_FS_MX61 msleep(50); #endif } u8 rtw_free_drv_sw(_adapter *padapter) { struct net_device *pnetdev = (struct net_device*)padapter->pnetdev; RT_TRACE(_module_os_intfs_c_,_drv_info_,("==>rtw_free_drv_sw")); #ifdef CONFIG_WAPI_SUPPORT rtw_wapi_free(padapter); #endif //we can call rtw_p2p_enable here, but: // 1. rtw_p2p_enable may have IO operation // 2. rtw_p2p_enable is bundled with wext interface #ifdef CONFIG_P2P { struct wifidirect_info *pwdinfo = &padapter->wdinfo; if(!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { _cancel_timer_ex( &pwdinfo->find_phase_timer ); _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); _cancel_timer_ex( &pwdinfo->pre_tx_scan_timer); #ifdef CONFIG_CONCURRENT_MODE _cancel_timer_ex( &pwdinfo->ap_p2p_switch_timer ); #endif // CONFIG_CONCURRENT_MODE rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE); } } #endif // add for CONFIG_IEEE80211W, none 11w also can use _rtw_spinlock_free(&padapter->security_key_mutex); #ifdef CONFIG_BR_EXT _rtw_spinlock_free(&padapter->br_ext_lock); #endif // CONFIG_BR_EXT #ifdef CONFIG_INTEL_WIDI rtw_free_intel_widi(padapter); #endif //CONFIG_INTEL_WIDI free_mlme_ext_priv(&padapter->mlmeextpriv); #ifdef CONFIG_TDLS //rtw_free_tdls_info(&padapter->tdlsinfo); #endif //CONFIG_TDLS rtw_free_cmd_priv(&padapter->cmdpriv); rtw_free_evt_priv(&padapter->evtpriv); rtw_free_mlme_priv(&padapter->mlmepriv); //free_io_queue(padapter); _rtw_free_xmit_priv(&padapter->xmitpriv); _rtw_free_sta_priv(&padapter->stapriv); //will free bcmc_stainfo here _rtw_free_recv_priv(&padapter->recvpriv); rtw_free_pwrctrl_priv(padapter); //rtw_mfree((void *)padapter, sizeof (padapter)); #ifdef CONFIG_DRVEXT_MODULE free_drvext(&padapter->drvextpriv); #endif rtw_hal_free_data(padapter); RT_TRACE(_module_os_intfs_c_,_drv_info_,("<==rtw_free_drv_sw\n")); //free the old_pnetdev if(padapter->rereg_nd_name_priv.old_pnetdev) { free_netdev(padapter->rereg_nd_name_priv.old_pnetdev); padapter->rereg_nd_name_priv.old_pnetdev = NULL; } // clear pbuddy_adapter to avoid access wrong pointer. if(padapter->pbuddy_adapter != NULL) { padapter->pbuddy_adapter->pbuddy_adapter = NULL; } RT_TRACE(_module_os_intfs_c_,_drv_info_,("-rtw_free_drv_sw\n")); return _SUCCESS; } #ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_MULTI_VIR_IFACES int _netdev_vir_if_open(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); _adapter *primary_padapter = GET_PRIMARY_ADAPTER(padapter); DBG_871X(FUNC_NDEV_FMT" enter\n", FUNC_NDEV_ARG(pnetdev)); if(!primary_padapter) goto _netdev_virtual_iface_open_error; if(primary_padapter->bup == _FALSE || primary_padapter->hw_init_completed == _FALSE) { _netdev_open(primary_padapter->pnetdev); } if(padapter->bup == _FALSE && primary_padapter->bup == _TRUE && primary_padapter->hw_init_completed == _TRUE) { int i; padapter->bDriverStopped = _FALSE; padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; padapter->bFWReady = primary_padapter->bFWReady; if(rtw_start_drv_threads(padapter) == _FAIL) { goto _netdev_virtual_iface_open_error; } #ifdef CONFIG_IOCTL_CFG80211 rtw_cfg80211_init_wiphy(padapter); #endif padapter->bup = _TRUE; } padapter->net_closed = _FALSE; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); rtw_netif_wake_queue(pnetdev); DBG_871X(FUNC_NDEV_FMT" exit\n", FUNC_NDEV_ARG(pnetdev)); return 0; _netdev_virtual_iface_open_error: padapter->bup = _FALSE; netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); return (-1); } int netdev_vir_if_open(struct net_device *pnetdev) { int ret; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_vir_if_open(pnetdev); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); #ifdef CONFIG_AUTO_AP_MODE //if(padapter->iface_id == 2) // rtw_start_auto_ap(padapter); #endif return ret; } static int netdev_vir_if_close(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); padapter->net_closed = _TRUE; if(pnetdev) { rtw_netif_stop_queue(pnetdev); } #ifdef CONFIG_IOCTL_CFG80211 rtw_scan_abort(padapter); adapter_wdev_data(padapter)->bandroid_scan = _FALSE; #endif return 0; } #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) static const struct net_device_ops rtw_netdev_vir_if_ops = { .ndo_open = netdev_vir_if_open, .ndo_stop = netdev_vir_if_close, .ndo_start_xmit = rtw_xmit_entry, .ndo_set_mac_address = rtw_net_set_mac_address, .ndo_get_stats = rtw_net_get_stats, .ndo_do_ioctl = rtw_ioctl, #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) .ndo_select_queue = rtw_select_queue, #endif }; #endif _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter,struct _io_ops *pops)) { int res = _FAIL; struct net_device *pnetdev=NULL; _adapter *padapter = NULL; struct dvobj_priv *pdvobjpriv; u8 mac[ETH_ALEN]; /* if((primary_padapter->bup == _FALSE) || (rtw_buddy_adapter_up(primary_padapter) == _FALSE)) { goto error_rtw_drv_add_iface; } */ /****** init netdev ******/ pnetdev = rtw_init_netdev(NULL); if (!pnetdev) goto error_rtw_drv_add_iface; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) DBG_871X("register rtw_netdev_virtual_iface_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtw_netdev_vir_if_ops; #else pnetdev->open = netdev_vir_if_open; pnetdev->stop = netdev_vir_if_close; #endif /****** init adapter ******/ padapter = rtw_netdev_priv(pnetdev); _rtw_memcpy(padapter, primary_padapter, sizeof(_adapter)); // padapter->bup = _FALSE; padapter->net_closed = _TRUE; padapter->hw_init_completed = _FALSE; padapter->dir_dev = NULL; padapter->dir_odm = NULL; //set adapter_type/iface type padapter->isprimary = _FALSE; padapter->adapter_type = MAX_ADAPTER; padapter->pbuddy_adapter = primary_padapter; #if 0 #ifndef CONFIG_HWPORT_SWAP //Port0 -> Pri , Port1 -> Sec padapter->iface_type = IFACE_PORT1; #else padapter->iface_type = IFACE_PORT0; #endif //CONFIG_HWPORT_SWAP #else //extended virtual interfaces always are set to port0 padapter->iface_type = IFACE_PORT0; #endif // padapter->pnetdev = pnetdev; /****** setup dvobj ******/ pdvobjpriv = adapter_to_dvobj(padapter); padapter->iface_id = pdvobjpriv->iface_nums; pdvobjpriv->padapters[pdvobjpriv->iface_nums++] = padapter; SET_NETDEV_DEV(pnetdev, dvobj_to_dev(pdvobjpriv)); #ifdef CONFIG_IOCTL_CFG80211 rtw_wdev_alloc(padapter, dvobj_to_dev(pdvobjpriv)); #endif //CONFIG_IOCTL_CFG80211 //set interface_type/chip_type/HardwareType padapter->interface_type = primary_padapter->interface_type; padapter->chip_type = primary_padapter->chip_type; padapter->HardwareType = primary_padapter->HardwareType; padapter->intf_start = NULL; padapter->intf_stop = NULL; //step init_io_priv if ((rtw_init_io_priv(padapter, set_intf_ops)) == _FAIL) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("\n Can't init io_reqs\n")); goto error_rtw_drv_add_iface; } //init drv data if(rtw_init_drv_sw(padapter)!= _SUCCESS) goto error_rtw_drv_add_iface; //get mac address from primary_padapter _rtw_memcpy(mac, adapter_mac_addr(primary_padapter), ETH_ALEN); /* * If the BIT1 is 0, the address is universally administered. * If it is 1, the address is locally administered */ #if 1 /* needs enable MBSSID CAM */ mac[0] |= BIT(1); mac[0] |= (padapter->iface_id-1)<<4; #endif _rtw_memcpy(adapter_mac_addr(padapter), mac, ETH_ALEN); res = _SUCCESS; return padapter; error_rtw_drv_add_iface: if(padapter) rtw_free_drv_sw(padapter); if (pnetdev) rtw_free_netdev(pnetdev); return NULL; } void rtw_drv_stop_vir_if(_adapter *padapter) { struct net_device *pnetdev=NULL; if (padapter == NULL) return; pnetdev = padapter->pnetdev; rtw_cancel_all_timer(padapter); if (padapter->bup == _TRUE) { padapter->bDriverStopped = _TRUE; #ifdef CONFIG_XMIT_ACK if (padapter->xmitpriv.ack_tx) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); #endif if (padapter->intf_stop) { padapter->intf_stop(padapter); } rtw_stop_drv_threads(padapter); padapter->bup = _FALSE; } } void rtw_drv_free_vir_if(_adapter *padapter) { struct net_device *pnetdev=NULL; if (padapter == NULL) return; padapter->pbuddy_adapter = NULL; pnetdev = padapter->pnetdev; #ifdef CONFIG_IOCTL_CFG80211 rtw_wdev_free(padapter->rtw_wdev); #endif //CONFIG_IOCTL_CFG80211 rtw_free_drv_sw(padapter); rtw_free_netdev(pnetdev); } void rtw_drv_stop_vir_ifaces(struct dvobj_priv *dvobj) { int i; //struct dvobj_priv *dvobj = primary_padapter->dvobj; for(i=2;i<dvobj->iface_nums;i++) { rtw_drv_stop_vir_if(dvobj->padapters[i]); } } void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj) { int i; //struct dvobj_priv *dvobj = primary_padapter->dvobj; for(i=2;i<dvobj->iface_nums;i++) { rtw_drv_free_vir_if(dvobj->padapters[i]); } } void rtw_drv_del_vir_if(_adapter *padapter) { rtw_drv_stop_vir_if(padapter); rtw_drv_free_vir_if(padapter); } void rtw_drv_del_vir_ifaces(_adapter *primary_padapter) { int i; struct dvobj_priv *dvobj = primary_padapter->dvobj; for(i=2;i<dvobj->iface_nums;i++) { rtw_drv_del_vir_if(dvobj->padapters[i]); } } #endif //CONFIG_MULTI_VIR_IFACES int _netdev_if2_open(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); _adapter *primary_padapter = padapter->pbuddy_adapter; DBG_871X("+871x_drv - if2_open, bup=%d\n", padapter->bup); #ifdef CONFIG_PLATFORM_INTEL_BYT if (padapter->bup == _FALSE) { u8 mac[ETH_ALEN]; /* get mac address from primary_padapter */ if (primary_padapter->bup == _FALSE) rtw_macaddr_cfg(adapter_mac_addr(primary_padapter), get_hal_mac_addr(primary_padapter)); _rtw_memcpy(mac, adapter_mac_addr(primary_padapter), ETH_ALEN); /* * If the BIT1 is 0, the address is universally administered. * If it is 1, the address is locally administered */ mac[0] |= BIT(1); _rtw_memcpy(adapter_mac_addr(padapter), mac, ETH_ALEN); rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); } #endif //CONFIG_PLATFORM_INTEL_BYT if(primary_padapter->bup == _FALSE || primary_padapter->hw_init_completed == _FALSE) { _netdev_open(primary_padapter->pnetdev); } if(padapter->bup == _FALSE && primary_padapter->bup == _TRUE && primary_padapter->hw_init_completed == _TRUE) { int i; padapter->bDriverStopped = _FALSE; padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; padapter->bFWReady = primary_padapter->bFWReady; //if (init_mlme_ext_priv(padapter) == _FAIL) // goto netdev_if2_open_error; if (rtw_start_drv_threads(padapter) == _FAIL) { goto netdev_if2_open_error; } if (padapter->intf_start) { padapter->intf_start(padapter); } #ifdef CONFIG_IOCTL_CFG80211 rtw_cfg80211_init_wiphy(padapter); #endif padapter->bup = _TRUE; } padapter->net_closed = _FALSE; //execute dynamic_chk_timer only on primary interface // secondary interface shares the timer with primary interface. //_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); rtw_netif_wake_queue(pnetdev); DBG_871X("-871x_drv - if2_open, bup=%d\n", padapter->bup); return 0; netdev_if2_open_error: padapter->bup = _FALSE; netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); return (-1); } int netdev_if2_open(struct net_device *pnetdev) { int ret; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); if (pwrctrlpriv->bInSuspend == _TRUE) { DBG_871X("+871x_drv - netdev_if2_open, bInSuspend=%d\n", pwrctrlpriv->bInSuspend); return 0; } _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_if2_open(pnetdev); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); #ifdef CONFIG_AUTO_AP_MODE //if(padapter->iface_id == 2) rtw_start_auto_ap(padapter); #endif return ret; } static int netdev_if2_close(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; padapter->net_closed = _TRUE; pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; if(pnetdev) { rtw_netif_stop_queue(pnetdev); } #ifdef CONFIG_P2P rtw_p2p_enable(padapter, P2P_ROLE_DISABLE); #endif #ifdef CONFIG_IOCTL_CFG80211 rtw_scan_abort(padapter); adapter_wdev_data(padapter)->bandroid_scan = _FALSE; #endif return 0; } #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) static const struct net_device_ops rtw_netdev_if2_ops = { .ndo_init = rtw_ndev_init, .ndo_uninit = rtw_ndev_uninit, .ndo_open = netdev_if2_open, .ndo_stop = netdev_if2_close, .ndo_start_xmit = rtw_xmit_entry, .ndo_set_mac_address = rtw_net_set_mac_address, .ndo_get_stats = rtw_net_get_stats, .ndo_do_ioctl = rtw_ioctl, #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) .ndo_select_queue = rtw_select_queue, #endif }; #endif _adapter *rtw_drv_if2_init(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter,struct _io_ops *pops)) { int res = _FAIL; struct net_device *pnetdev = NULL; _adapter *padapter = NULL; struct dvobj_priv *pdvobjpriv; u8 mac[ETH_ALEN]; /****** init netdev ******/ pnetdev = rtw_init_netdev(NULL); if (!pnetdev) goto error_rtw_drv_if2_init; #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) DBG_871X("register rtw_netdev_if2_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtw_netdev_if2_ops; #else pnetdev->init = rtw_ndev_init; pnetdev->uninit = rtw_ndev_uninit; pnetdev->open = netdev_if2_open; pnetdev->stop = netdev_if2_close; #endif /****** init adapter ******/ padapter = rtw_netdev_priv(pnetdev); _rtw_memcpy(padapter, primary_padapter, sizeof(_adapter)); // padapter->bup = _FALSE; padapter->net_closed = _TRUE; padapter->hw_init_completed = _FALSE; padapter->dir_dev = NULL; padapter->dir_odm = NULL; //set adapter_type/iface type padapter->isprimary = _FALSE; padapter->adapter_type = SECONDARY_ADAPTER; padapter->pbuddy_adapter = primary_padapter; padapter->iface_id = IFACE_ID1; #ifndef CONFIG_HWPORT_SWAP //Port0 -> Pri , Port1 -> Sec padapter->iface_type = IFACE_PORT1; #else padapter->iface_type = IFACE_PORT0; #endif //CONFIG_HWPORT_SWAP // padapter->pnetdev = pnetdev; /****** setup dvobj ******/ pdvobjpriv = adapter_to_dvobj(padapter); pdvobjpriv->if2 = padapter; pdvobjpriv->padapters[pdvobjpriv->iface_nums++] = padapter; SET_NETDEV_DEV(pnetdev, dvobj_to_dev(pdvobjpriv)); #ifdef CONFIG_IOCTL_CFG80211 rtw_wdev_alloc(padapter, dvobj_to_dev(pdvobjpriv)); #endif //CONFIG_IOCTL_CFG80211 //set interface_type/chip_type/HardwareType padapter->interface_type = primary_padapter->interface_type; padapter->chip_type = primary_padapter->chip_type; padapter->HardwareType = primary_padapter->HardwareType; // padapter->intf_start = primary_padapter->intf_start; padapter->intf_stop = primary_padapter->intf_stop; //step init_io_priv if ((rtw_init_io_priv(padapter, set_intf_ops)) == _FAIL) { RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("\n Can't init io_reqs\n")); goto error_rtw_drv_if2_init; } //init drv data if(rtw_init_drv_sw(padapter)!= _SUCCESS) goto error_rtw_drv_if2_init; /* get mac address from primary_padapter */ _rtw_memcpy(mac, adapter_mac_addr(primary_padapter), ETH_ALEN); /* * If the BIT1 is 0, the address is universally administered. * If it is 1, the address is locally administered */ mac[0] |= BIT(1); _rtw_memcpy(adapter_mac_addr(padapter), mac, ETH_ALEN); rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); primary_padapter->pbuddy_adapter = padapter; res = _SUCCESS; return padapter; error_rtw_drv_if2_init: if(padapter) rtw_free_drv_sw(padapter); if (pnetdev) rtw_free_netdev(pnetdev); return NULL; } void rtw_drv_if2_free(_adapter *if2) { _adapter *padapter = if2; struct net_device *pnetdev = NULL; if (padapter == NULL) return; pnetdev = padapter->pnetdev; #ifdef CONFIG_IOCTL_CFG80211 rtw_wdev_free(padapter->rtw_wdev); #endif /* CONFIG_IOCTL_CFG80211 */ rtw_free_drv_sw(padapter); rtw_free_netdev(pnetdev); } void rtw_drv_if2_stop(_adapter *if2) { _adapter *padapter = if2; struct net_device *pnetdev = NULL; if (padapter == NULL) return; rtw_cancel_all_timer(padapter); if (padapter->bup == _TRUE) { padapter->bDriverStopped = _TRUE; #ifdef CONFIG_XMIT_ACK if (padapter->xmitpriv.ack_tx) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); #endif if (padapter->intf_stop) { padapter->intf_stop(padapter); } rtw_stop_drv_threads(padapter); padapter->bup = _FALSE; } } #endif //end of CONFIG_CONCURRENT_MODE #ifdef CONFIG_BR_EXT void netdev_br_init(struct net_device *netdev) { _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_lock(); #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) //if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == _TRUE) { //struct net_bridge *br = netdev->br_port->br;//->dev->dev_addr; #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if (netdev->br_port) #else // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if (rcu_dereference(adapter->pnetdev->rx_handler_data)) #endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) { struct net_device *br_netdev; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) br_netdev = dev_get_by_name(CONFIG_BR_EXT_BRNAME); #else // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) struct net *devnet = NULL; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) devnet = netdev->nd_net; #else // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) devnet = dev_net(netdev); #endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME); #endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) if (br_netdev) { memcpy(adapter->br_mac, br_netdev->dev_addr, ETH_ALEN); dev_put(br_netdev); } else printk("%s()-%d: dev_get_by_name(%s) failed!", __FUNCTION__, __LINE__, CONFIG_BR_EXT_BRNAME); } adapter->ethBrExtInfo.addPPPoETag = 1; } #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_unlock(); #endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) } #endif //CONFIG_BR_EXT static int _rtw_drv_register_netdev(_adapter *padapter, char *name) { int ret = _SUCCESS; struct net_device *pnetdev = padapter->pnetdev; /* alloc netdev name */ rtw_init_netdev_name(pnetdev, name); _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); /* Tell the network stack we exist */ if (register_netdev(pnetdev) != 0) { DBG_871X(FUNC_NDEV_FMT "Failed!\n", FUNC_NDEV_ARG(pnetdev)); ret = _FAIL; goto error_register_netdev; } DBG_871X("%s, MAC Address (if%d) = " MAC_FMT "\n", __FUNCTION__, (padapter->iface_id+1), MAC_ARG(pnetdev->dev_addr)); return ret; error_register_netdev: if(padapter->iface_id > IFACE_ID0) { rtw_free_drv_sw(padapter); rtw_free_netdev(pnetdev); } return ret; } int rtw_drv_register_netdev(_adapter *if1) { int i, status = _SUCCESS; struct dvobj_priv *dvobj = if1->dvobj; if(dvobj->iface_nums < IFACE_ID_MAX) { for(i=0; i<dvobj->iface_nums; i++) { _adapter *padapter = dvobj->padapters[i]; if(padapter) { char *name; if(padapter->iface_id == IFACE_ID0) name = if1->registrypriv.ifname; else if(padapter->iface_id == IFACE_ID1) name = if1->registrypriv.if2name; else name = "wlan%d"; if((status = _rtw_drv_register_netdev(padapter, name)) != _SUCCESS) { break; } } } } return status; } int _netdev_open(struct net_device *pnetdev) { uint status; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); #ifdef CONFIG_BT_COEXIST_SOCKET_TRX HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); #endif //CONFIG_BT_COEXIST_SOCKET_TRX RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - dev_open\n")); DBG_871X("+871x_drv - drv_open, bup=%d\n", padapter->bup); padapter->netif_up = _TRUE; #ifdef CONFIG_PLATFORM_INTEL_BYT rtw_sdio_set_power(1); #endif //CONFIG_PLATFORM_INTEL_BYT if(pwrctrlpriv->ps_flag == _TRUE){ padapter->net_closed = _FALSE; goto netdev_open_normal_process; } if(padapter->bup == _FALSE) { #ifdef CONFIG_PLATFORM_INTEL_BYT rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter)); rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); #endif //CONFIG_PLATFORM_INTEL_BYT padapter->bDriverStopped = _FALSE; padapter->bSurpriseRemoved = _FALSE; padapter->bCardDisableWOHSM = _FALSE; status = rtw_hal_init(padapter); if (status ==_FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("rtl871x_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } DBG_871X("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); status=rtw_start_drv_threads(padapter); if(status ==_FAIL) { DBG_871X("Initialize driver software resource Failed!\n"); goto netdev_open_error; } #ifdef CONFIG_DRVEXT_MODULE init_drvext(padapter); #endif if (padapter->intf_start) { padapter->intf_start(padapter); } #ifdef CONFIG_IOCTL_CFG80211 rtw_cfg80211_init_wiphy(padapter); #endif rtw_led_control(padapter, LED_CTL_NO_LINK); padapter->bup = _TRUE; pwrctrlpriv->bips_processing = _FALSE; #ifdef CONFIG_PLATFORM_INTEL_BYT #ifdef CONFIG_BT_COEXIST rtw_btcoex_IpsNotify(padapter, IPS_NONE); #endif // CONFIG_BT_COEXIST #endif //CONFIG_PLATFORM_INTEL_BYT } padapter->net_closed = _FALSE; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); #ifndef CONFIG_IPS_CHECK_IN_WD rtw_set_pwr_state_check_timer(pwrctrlpriv); #endif //netif_carrier_on(pnetdev);//call this func when rtw_joinbss_event_callback return success rtw_netif_wake_queue(pnetdev); #ifdef CONFIG_BR_EXT netdev_br_init(pnetdev); #endif // CONFIG_BR_EXT #ifdef CONFIG_BT_COEXIST_SOCKET_TRX if(is_primary_adapter(padapter) && _TRUE == pHalData->EEPROMBluetoothCoexist) { rtw_btcoex_init_socket(padapter); padapter->coex_info.BtMgnt.ExtConfig.HCIExtensionVer = 0x04; rtw_btcoex_SetHciVersion(padapter,0x04); } else DBG_871X("CONFIG_BT_COEXIST: SECONDARY_ADAPTER\n"); #endif //CONFIG_BT_COEXIST_SOCKET_TRX netdev_open_normal_process: #ifdef CONFIG_CONCURRENT_MODE { _adapter *sec_adapter = padapter->pbuddy_adapter; if(sec_adapter && (sec_adapter->bup == _FALSE)) _netdev_if2_open(sec_adapter->pnetdev); } #endif RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - dev_open\n")); DBG_871X("-871x_drv - drv_open, bup=%d\n", padapter->bup); return 0; netdev_open_error: padapter->bup = _FALSE; netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); RT_TRACE(_module_os_intfs_c_,_drv_err_,("-871x_drv - dev_open, fail!\n")); DBG_871X("-871x_drv - drv_open fail, bup=%d\n", padapter->bup); return (-1); } int netdev_open(struct net_device *pnetdev) { int ret; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); if (pwrctrlpriv->bInSuspend == _TRUE) { DBG_871X("+871x_drv - drv_open, bInSuspend=%d\n", pwrctrlpriv->bInSuspend); return 0; } _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); ret = _netdev_open(pnetdev); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); return ret; } #ifdef CONFIG_IPS int ips_netdrv_open(_adapter *padapter) { int status = _SUCCESS; //struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); padapter->net_closed = _FALSE; DBG_871X("===> %s.........\n",__FUNCTION__); padapter->bDriverStopped = _FALSE; padapter->bCardDisableWOHSM = _FALSE; //padapter->bup = _TRUE; status = rtw_hal_init(padapter); if (status ==_FAIL) { RT_TRACE(_module_os_intfs_c_,_drv_err_,("ips_netdrv_open(): Can't init h/w!\n")); goto netdev_open_error; } if (padapter->intf_start) { padapter->intf_start(padapter); } #ifndef CONFIG_IPS_CHECK_IN_WD rtw_set_pwr_state_check_timer(adapter_to_pwrctl(padapter)); #endif _set_timer(&padapter->mlmepriv.dynamic_chk_timer,2000); return _SUCCESS; netdev_open_error: //padapter->bup = _FALSE; DBG_871X("-ips_netdrv_open - drv_open failure, bup=%d\n", padapter->bup); return _FAIL; } int rtw_ips_pwr_up(_adapter *padapter) { int result; PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); #ifdef DBG_CONFIG_ERROR_DETECT struct sreset_priv *psrtpriv = &pHalData->srestpriv; #endif//#ifdef DBG_CONFIG_ERROR_DETECT u32 start_time = rtw_get_current_time(); DBG_871X("===> rtw_ips_pwr_up..............\n"); #if defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_FWLPS_IN_IPS) #ifdef DBG_CONFIG_ERROR_DETECT if (psrtpriv->silent_reset_inprogress == _TRUE) #endif//#ifdef DBG_CONFIG_ERROR_DETECT #endif //defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_FWLPS_IN_IPS) rtw_reset_drv_sw(padapter); result = ips_netdrv_open(padapter); rtw_led_control(padapter, LED_CTL_NO_LINK); DBG_871X("<=== rtw_ips_pwr_up.............. in %dms\n", rtw_get_passing_time_ms(start_time)); return result; } void rtw_ips_pwr_down(_adapter *padapter) { u32 start_time = rtw_get_current_time(); DBG_871X("===> rtw_ips_pwr_down...................\n"); padapter->bCardDisableWOHSM = _TRUE; padapter->net_closed = _TRUE; rtw_ips_dev_unload(padapter); padapter->bCardDisableWOHSM = _FALSE; DBG_871X("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); } #endif void rtw_ips_dev_unload(_adapter *padapter) { struct net_device *pnetdev= (struct net_device*)padapter->pnetdev; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); #ifdef DBG_CONFIG_ERROR_DETECT struct sreset_priv *psrtpriv = &pHalData->srestpriv; #endif//#ifdef DBG_CONFIG_ERROR_DETECT DBG_871X("====> %s...\n",__FUNCTION__); #if defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_FWLPS_IN_IPS) #ifdef DBG_CONFIG_ERROR_DETECT if (psrtpriv->silent_reset_inprogress == _TRUE) #endif //#ifdef DBG_CONFIG_ERROR_DETECT #endif //defined(CONFIG_SWLPS_IN_IPS) || defined(CONFIG_FWLPS_IN_IPS) { rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, 0); if (padapter->intf_stop) { padapter->intf_stop(padapter); } } if(padapter->bSurpriseRemoved == _FALSE) { rtw_hal_deinit(padapter); } } int pm_netdev_open(struct net_device *pnetdev,u8 bnormal) { int status = 0; _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); if (_TRUE == bnormal) { _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); status = _netdev_open(pnetdev); _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); } #ifdef CONFIG_IPS else status = (_SUCCESS == ips_netdrv_open(padapter))?(0):(-1); #endif return status; } static int netdev_close(struct net_device *pnetdev) { _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; #ifdef CONFIG_BT_COEXIST_SOCKET_TRX HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); #endif //CONFIG_BT_COEXIST_SOCKET_TRX RT_TRACE(_module_os_intfs_c_,_drv_info_,("+871x_drv - drv_close\n")); #ifndef CONFIG_PLATFORM_INTEL_BYT if(pwrctl->bInternalAutoSuspend == _TRUE) { //rtw_pwr_wakeup(padapter); if(pwrctl->rf_pwrstate == rf_off) pwrctl->ps_flag = _TRUE; } padapter->net_closed = _TRUE; padapter->netif_up = _FALSE; pmlmepriv->LinkDetectInfo.bBusyTraffic = _FALSE; /* if(!padapter->hw_init_completed) { DBG_871X("(1)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); padapter->bDriverStopped = _TRUE; rtw_dev_unload(padapter); } else*/ if(pwrctl->rf_pwrstate == rf_on){ DBG_871X("(2)871x_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); //s1. if(pnetdev) { rtw_netif_stop_queue(pnetdev); } #ifndef CONFIG_ANDROID //s2. LeaveAllPowerSaveMode(padapter); rtw_disassoc_cmd(padapter, 500, _FALSE); //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); //s2-3. rtw_free_assoc_resources(padapter, 1); //s2-4. rtw_free_network_queue(padapter,_TRUE); #endif // Close LED rtw_led_control(padapter, LED_CTL_POWER_OFF); } #ifdef CONFIG_BR_EXT //if (OPMODE & (WIFI_STATION_STATE | WIFI_ADHOC_STATE)) { //void nat25_db_cleanup(_adapter *priv); nat25_db_cleanup(padapter); } #endif // CONFIG_BR_EXT #ifdef CONFIG_P2P rtw_p2p_enable(padapter, P2P_ROLE_DISABLE); #endif //CONFIG_P2P #ifdef CONFIG_IOCTL_CFG80211 rtw_scan_abort(padapter); adapter_wdev_data(padapter)->bandroid_scan = _FALSE; //padapter->rtw_wdev->iftype = NL80211_IFTYPE_MONITOR; //set this at the end #endif //CONFIG_IOCTL_CFG80211 #ifdef CONFIG_WAPI_SUPPORT rtw_wapi_disable_tx(padapter); #endif #ifdef CONFIG_BT_COEXIST_SOCKET_TRX if(is_primary_adapter(padapter) && _TRUE == pHalData->EEPROMBluetoothCoexist) rtw_btcoex_close_socket(padapter); else DBG_871X("CONFIG_BT_COEXIST: SECONDARY_ADAPTER\n"); #endif //CONFIG_BT_COEXIST_SOCKET_TRX #else //!CONFIG_PLATFORM_INTEL_BYT if (pwrctl->bInSuspend == _TRUE) { DBG_871X("+871x_drv - drv_close, bInSuspend=%d\n", pwrctl->bInSuspend); return 0; } rtw_scan_abort(padapter); // stop scanning process before wifi is going to down DBG_871X("netdev_close, bips_processing=%d\n", pwrctl->bips_processing); while (pwrctl->bips_processing == _TRUE) // waiting for ips_processing done before call rtw_dev_unload() rtw_msleep_os(1); rtw_dev_unload(padapter); rtw_sdio_set_power(0); #endif //!CONFIG_PLATFORM_INTEL_BYT RT_TRACE(_module_os_intfs_c_,_drv_info_,("-871x_drv - drv_close\n")); DBG_871X("-871x_drv - drv_close, bup=%d\n", padapter->bup); return 0; } int pm_netdev_close(struct net_device *pnetdev,u8 bnormal) { int status = 0; status = netdev_close(pnetdev); return status; } void rtw_ndev_destructor(struct net_device *ndev) { DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); #ifdef CONFIG_IOCTL_CFG80211 if (ndev->ieee80211_ptr) rtw_mfree((u8 *)ndev->ieee80211_ptr, sizeof(struct wireless_dev)); #endif free_netdev(ndev); } #ifdef CONFIG_ARP_KEEP_ALIVE struct route_info { struct in_addr dst_addr; struct in_addr src_addr; struct in_addr gateway; unsigned int dev_index; }; static void parse_routes(struct nlmsghdr *nl_hdr, struct route_info *rt_info) { struct rtmsg *rt_msg; struct rtattr *rt_attr; int rt_len; rt_msg = (struct rtmsg *) NLMSG_DATA(nl_hdr); if ((rt_msg->rtm_family != AF_INET) || (rt_msg->rtm_table != RT_TABLE_MAIN)) return; rt_attr = (struct rtattr *) RTM_RTA(rt_msg); rt_len = RTM_PAYLOAD(nl_hdr); for (; RTA_OK(rt_attr, rt_len); rt_attr = RTA_NEXT(rt_attr, rt_len)) { switch (rt_attr->rta_type) { case RTA_OIF: rt_info->dev_index = *(int *) RTA_DATA(rt_attr); break; case RTA_GATEWAY: rt_info->gateway.s_addr = *(u_int *) RTA_DATA(rt_attr); break; case RTA_PREFSRC: rt_info->src_addr.s_addr = *(u_int *) RTA_DATA(rt_attr); break; case RTA_DST: rt_info->dst_addr.s_addr = *(u_int *) RTA_DATA(rt_attr); break; } } } static int route_dump(u32 *gw_addr ,int* gw_index) { int err = 0; struct socket *sock; struct { struct nlmsghdr nlh; struct rtgenmsg g; } req; struct msghdr msg; struct iovec iov; struct sockaddr_nl nladdr; mm_segment_t oldfs; char *pg; int size = 0; err = sock_create(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock); if (err) { printk( ": Could not create a datagram socket, error = %d\n", -ENXIO); return err; } memset(&nladdr, 0, sizeof(nladdr)); nladdr.nl_family = AF_NETLINK; req.nlh.nlmsg_len = sizeof(req); req.nlh.nlmsg_type = RTM_GETROUTE; req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; req.nlh.nlmsg_pid = 0; req.g.rtgen_family = AF_INET; iov.iov_base = &req; iov.iov_len = sizeof(req); msg.msg_name = &nladdr; msg.msg_namelen = sizeof(nladdr); msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_flags = MSG_DONTWAIT; oldfs = get_fs(); set_fs(KERNEL_DS); err = sock_sendmsg(sock, &msg, sizeof(req)); set_fs(oldfs); if (size < 0) goto out_sock; pg = (char *) __get_free_page(GFP_KERNEL); if (pg == NULL) { err = -ENOMEM; goto out_sock; } #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) restart: #endif for (;;) { struct nlmsghdr *h; iov.iov_base = pg; iov.iov_len = PAGE_SIZE; oldfs = get_fs(); set_fs(KERNEL_DS); err = sock_recvmsg(sock, &msg, PAGE_SIZE, MSG_DONTWAIT); set_fs(oldfs); if (err < 0) goto out_sock_pg; if (msg.msg_flags & MSG_TRUNC) { err = -ENOBUFS; goto out_sock_pg; } h = (struct nlmsghdr*) pg; while (NLMSG_OK(h, err)) { struct route_info rt_info; if (h->nlmsg_type == NLMSG_DONE) { err = 0; goto done; } if (h->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *errm = (struct nlmsgerr*) NLMSG_DATA(h); err = errm->error; printk( "NLMSG error: %d\n", errm->error); goto done; } if (h->nlmsg_type == RTM_GETROUTE) { printk( "RTM_GETROUTE: NLMSG: %d\n", h->nlmsg_type); } if (h->nlmsg_type != RTM_NEWROUTE) { printk( "NLMSG: %d\n", h->nlmsg_type); err = -EINVAL; goto done; } memset(&rt_info, 0, sizeof(struct route_info)); parse_routes(h, &rt_info); if(!rt_info.dst_addr.s_addr && rt_info.gateway.s_addr && rt_info.dev_index) { *gw_addr = rt_info.gateway.s_addr; *gw_index = rt_info.dev_index; } h = NLMSG_NEXT(h, err); } if (err) { printk( "!!!Remnant of size %d %d %d\n", err, h->nlmsg_len, h->nlmsg_type); err = -EINVAL; break; } } done: #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) if (!err && req.g.rtgen_family == AF_INET) { req.g.rtgen_family = AF_INET6; iov.iov_base = &req; iov.iov_len = sizeof(req); msg.msg_name = &nladdr; msg.msg_namelen = sizeof(nladdr); msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_flags=MSG_DONTWAIT; oldfs = get_fs(); set_fs(KERNEL_DS); err = sock_sendmsg(sock, &msg, sizeof(req)); set_fs(oldfs); if (err > 0) goto restart; } #endif out_sock_pg: free_page((unsigned long) pg); out_sock: sock_release(sock); return err; } static int arp_query(unsigned char *haddr, u32 paddr, struct net_device *dev) { struct neighbour *neighbor_entry; int ret = 0; neighbor_entry = neigh_lookup(&arp_tbl, &paddr, dev); if (neighbor_entry != NULL) { neighbor_entry->used = jiffies; if (neighbor_entry->nud_state & NUD_VALID) { _rtw_memcpy(haddr, neighbor_entry->ha, dev->addr_len); ret = 1; } neigh_release(neighbor_entry); } return ret; } static int get_defaultgw(u32 *ip_addr ,char mac[]) { int gw_index = 0; // oif device index struct net_device *gw_dev = NULL; //oif device route_dump(ip_addr, &gw_index); if( !(*ip_addr) || !gw_index ) { //DBG_871X("No default GW \n"); return -1; } gw_dev = dev_get_by_index(&init_net, gw_index); if(gw_dev == NULL) { //DBG_871X("get Oif Device Fail \n"); return -1; } if(!arp_query(mac, *ip_addr, gw_dev)) { //DBG_871X( "arp query failed\n"); dev_put(gw_dev); return -1; } dev_put(gw_dev); return 0; } int rtw_gw_addr_query(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); u32 gw_addr = 0; // default gw address unsigned char gw_mac[32] = {0}; // default gw mac int i; int res; if (pwrctl->wowlan_from_cmd == _TRUE) { DBG_871X("%s: return cuz wowlan_from_cmd\n", __func__); return 0; } res = get_defaultgw(&gw_addr, gw_mac); if(!res) { pmlmepriv->gw_ip[0] = gw_addr&0xff; pmlmepriv->gw_ip[1] = (gw_addr&0xff00)>>8; pmlmepriv->gw_ip[2] = (gw_addr&0xff0000)>>16; pmlmepriv->gw_ip[3] = (gw_addr&0xff000000)>>24; _rtw_memcpy(pmlmepriv->gw_mac_addr, gw_mac, 6); DBG_871X("%s Gateway Mac:\t" MAC_FMT "\n", __FUNCTION__, MAC_ARG(pmlmepriv->gw_mac_addr)); DBG_871X("%s Gateway IP:\t" IP_FMT "\n", __FUNCTION__, IP_ARG(pmlmepriv->gw_ip)); } else { DBG_871X("Get Gateway IP/MAC fail!\n"); } return res; } #endif void rtw_dev_unload(PADAPTER padapter) { struct net_device *pnetdev = (struct net_device*)padapter->pnetdev; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); struct dvobj_priv *pobjpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &pobjpriv->drv_dbg; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 cnt = 0; RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("+%s\n",__FUNCTION__)); if (padapter->bup == _TRUE) { DBG_871X("===> %s\n",__FUNCTION__); padapter->bDriverStopped = _TRUE; #ifdef CONFIG_XMIT_ACK if (padapter->xmitpriv.ack_tx) rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); #endif if (padapter->intf_stop) padapter->intf_stop(padapter); RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("@ rtw_dev_unload: stop intf complete!\n")); if (!pwrctl->bInternalAutoSuspend) rtw_stop_drv_threads(padapter); while(ATOMIC_READ(&(pcmdpriv->cmdthd_running)) == _TRUE){ if (cnt > 5) { DBG_871X("stop cmdthd timeout\n"); break; } else { cnt ++; DBG_871X("cmdthd is running(%d)\n", cnt); rtw_msleep_os(10); } } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("@ %s: stop thread complete!\n",__FUNCTION__)); //check the status of IPS if(rtw_hal_check_ips_status(padapter) == _TRUE || pwrctl->rf_pwrstate == rf_off) { //check HW status and SW state DBG_871X_LEVEL(_drv_always_, "%s: driver in IPS-FWLPS\n", __func__); pdbgpriv->dbg_dev_unload_inIPS_cnt++; LeaveAllPowerSaveMode(padapter); } else { DBG_871X_LEVEL(_drv_always_, "%s: driver not in IPS\n", __func__); } if (padapter->bSurpriseRemoved == _FALSE) { #ifdef CONFIG_BT_COEXIST rtw_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); #endif #ifdef CONFIG_WOWLAN if (pwrctl->bSupportRemoteWakeup == _TRUE && pwrctl->wowlan_mode ==_TRUE) { DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup==_TRUE do not run rtw_hal_deinit()\n",__FUNCTION__); } else #endif { //amy modify 20120221 for power seq is different between driver open and ips rtw_hal_deinit(padapter); } padapter->bSurpriseRemoved = _TRUE; } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("@ %s: deinit hal complelt!\n",__FUNCTION__)); padapter->bup = _FALSE; DBG_871X("<=== %s\n",__FUNCTION__); } else { RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("%s: bup==_FALSE\n",__FUNCTION__)); DBG_871X("%s: bup==_FALSE\n",__FUNCTION__); } RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("-%s\n",__FUNCTION__)); } int rtw_suspend_free_assoc_resource(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_P2P struct wifidirect_info* pwdinfo = &padapter->wdinfo; #endif // CONFIG_P2P DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED) #ifdef CONFIG_P2P && rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE) #endif // CONFIG_P2P ) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, pmlmepriv->cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->cur_network.network.MacAddress), pmlmepriv->cur_network.network.Ssid.SsidLength, pmlmepriv->assoc_ssid.SsidLength); rtw_set_to_roam(padapter, 1); } } if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { rtw_disassoc_cmd(padapter, 0, _FALSE); //s2-2. indicate disconnect to os rtw_indicate_disconnect(padapter); } #ifdef CONFIG_AP_MODE else if(check_fwstate(pmlmepriv, WIFI_AP_STATE)) { rtw_sta_flush(padapter); } #endif //s2-3. rtw_free_assoc_resources(padapter, 1); //s2-4. #ifdef CONFIG_AUTOSUSPEND if(is_primary_adapter(padapter) && (!adapter_to_pwrctl(padapter)->bInternalAutoSuspend )) #endif rtw_free_network_queue(padapter, _TRUE); if(check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_indicate_scan_done(padapter, 1); if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE) { DBG_871X_LEVEL(_drv_always_, "%s: fw_under_linking\n", __FUNCTION__); rtw_indicate_disconnect(padapter); } DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return _SUCCESS; } #ifdef CONFIG_WOWLAN int rtw_suspend_wow(_adapter *padapter) { u8 ch, bw, offset; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; #endif struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct wowlan_ioctl_param poidparam; u8 ps_mode; int ret = _SUCCESS; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); DBG_871X("wowlan_pno_enable: %d\n", pwrpriv->wowlan_pno_enable); #ifdef CONFIG_P2P_WOWLAN DBG_871X("wowlan_p2p_enable: %d\n", pwrpriv->wowlan_p2p_enable); #endif if (pwrpriv->wowlan_mode == _TRUE) { if(pnetdev) rtw_netif_stop_queue(pnetdev); #ifdef CONFIG_CONCURRENT_MODE if(pbuddy_netdev){ netif_carrier_off(pbuddy_netdev); rtw_netif_stop_queue(pbuddy_netdev); } #endif//CONFIG_CONCURRENT_MODE // 0. Power off LED rtw_led_control(padapter, LED_CTL_POWER_OFF); // 1. stop thread padapter->bDriverStopped = _TRUE; //for stop thread rtw_stop_drv_threads(padapter); padapter->bDriverStopped = _FALSE; //for 32k command #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { padapter->pbuddy_adapter->bDriverStopped = _TRUE; //for stop thread rtw_stop_drv_threads(padapter->pbuddy_adapter); padapter->pbuddy_adapter->bDriverStopped = _FALSE; //for 32k command } #endif // CONFIG_CONCURRENT_MODE //#ifdef CONFIG_LPS //rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); //#endif #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) // 2. disable interrupt if (padapter->intf_stop) { padapter->intf_stop(padapter); } #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { //free buddy adapter's resource padapter->pbuddy_adapter->intf_stop(padapter->pbuddy_adapter); } #endif // 2.1 clean interupt rtw_hal_clear_interrupt(padapter); #endif //CONFIG_SDIO_HCI // 2.2 free irq //sdio_free_irq(adapter_to_dvobj(padapter)); if(padapter->intf_free_irq) padapter->intf_free_irq(adapter_to_dvobj(padapter)); #ifdef CONFIG_RUNTIME_PORT_SWITCH if (rtw_port_switch_chk(padapter)) { DBG_871X(" ### PORT SWITCH ### \n"); rtw_hal_set_hwreg(padapter, HW_VAR_PORT_SWITCH, NULL); } #endif poidparam.subcode = WOWLAN_ENABLE; rtw_hal_set_hwreg(padapter,HW_VAR_WOWLAN,(u8 *)&poidparam); if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { if(check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n",__FUNCTION__, pmlmepriv->cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->cur_network.network.MacAddress), pmlmepriv->cur_network.network.Ssid.SsidLength, pmlmepriv->assoc_ssid.SsidLength); rtw_set_to_roam(padapter, 0); } } DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == _TRUE) { DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); rtw_indicate_scan_done(padapter, 1); clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); } if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); } #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ //free buddy adapter's resource rtw_suspend_free_assoc_resource(padapter->pbuddy_adapter); } #endif if(pwrpriv->wowlan_pno_enable) { DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); #ifdef CONFIG_FWLPS_IN_IPS rtw_set_fw_in_ips_mode(padapter, _TRUE); #endif } #ifdef CONFIG_LPS else rtw_set_ps_mode(padapter, PS_MODE_MAX, 0, 0, "WOWLAN"); #endif //#ifdef CONFIG_LPS } else { DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode=%d\n", __FUNCTION__, pwrpriv->wowlan_mode); } DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } #endif //#ifdef CONFIG_WOWLAN #ifdef CONFIG_AP_WOWLAN int rtw_suspend_ap_wow(_adapter *padapter) { u8 ch, bw, offset; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev; #endif struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct wowlan_ioctl_param poidparam; u8 ps_mode; int ret = _SUCCESS; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); pwrpriv->wowlan_ap_mode = _TRUE; DBG_871X("wowlan_ap_mode: %d\n", pwrpriv->wowlan_ap_mode); if(pnetdev) rtw_netif_stop_queue(pnetdev); #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; if (pbuddy_netdev) rtw_netif_stop_queue(pbuddy_netdev); } #endif//CONFIG_CONCURRENT_MODE // 0. Power off LED rtw_led_control(padapter, LED_CTL_POWER_OFF); // 1. stop thread padapter->bDriverStopped = _TRUE; //for stop thread rtw_stop_drv_threads(padapter); padapter->bDriverStopped = _FALSE; //for 32k command #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ padapter->pbuddy_adapter->bDriverStopped = _TRUE; //for stop thread rtw_stop_drv_threads(padapter->pbuddy_adapter); padapter->pbuddy_adapter->bDriverStopped = _FALSE; //for 32k command } #endif // CONFIG_CONCURRENT_MODE //#ifdef CONFIG_LPS //rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); //#endif #ifdef CONFIG_SDIO_HCI // 2. disable interrupt rtw_hal_disable_interrupt(padapter); // It need wait for leaving 32K. #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { //free buddy adapter's resource padapter->pbuddy_adapter->intf_stop(padapter->pbuddy_adapter); } #endif // 2.1 clean interupt rtw_hal_clear_interrupt(padapter); #endif //CONFIG_SDIO_HCI // 2.2 free irq //sdio_free_irq(adapter_to_dvobj(padapter)); if(padapter->intf_free_irq) padapter->intf_free_irq(adapter_to_dvobj(padapter)); #ifdef CONFIG_RUNTIME_PORT_SWITCH if (rtw_port_switch_chk(padapter)) { DBG_871X(" ### PORT SWITCH ### \n"); rtw_hal_set_hwreg(padapter, HW_VAR_PORT_SWITCH, NULL); } #endif poidparam.subcode = WOWLAN_AP_ENABLE; rtw_hal_set_hwreg(padapter,HW_VAR_AP_WOWLAN,(u8 *)&poidparam); DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); #ifdef CONFIG_CONCURRENT_MODE if (check_buddy_fwstate(padapter, WIFI_AP_STATE) == _TRUE) { if (rtw_get_ch_setting_union(padapter->pbuddy_adapter, &ch, &bw, &offset) != 0) { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter->pbuddy_adapter), ch, bw, offset); set_channel_bwmode(padapter->pbuddy_adapter, ch, offset, bw); } rtw_suspend_free_assoc_resource(padapter); } else { if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); } rtw_suspend_free_assoc_resource(padapter->pbuddy_adapter); } #else if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); } #endif #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, 0, "AP-WOWLAN"); #endif DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } #endif //#ifdef CONFIG_AP_WOWLAN int rtw_suspend_normal(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; #endif struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); int ret = _SUCCESS; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); if(pnetdev){ netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); } #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; netif_carrier_off(pbuddy_netdev); rtw_netif_stop_queue(pbuddy_netdev); } #endif rtw_suspend_free_assoc_resource(padapter); #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ rtw_suspend_free_assoc_resource(padapter->pbuddy_adapter); } #endif rtw_led_control(padapter, LED_CTL_POWER_OFF); if ((rtw_hal_check_ips_status(padapter) == _TRUE) || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) { DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __FUNCTION__); } #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ rtw_dev_unload(padapter->pbuddy_adapter); } #endif rtw_dev_unload(padapter); //sdio_deinit(adapter_to_dvobj(padapter)); if(padapter->intf_deinit) padapter->intf_deinit(adapter_to_dvobj(padapter)); DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } int rtw_suspend_common(_adapter *padapter) { struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; int ret = 0; u32 start_time = rtw_get_current_time(); DBG_871X_LEVEL(_drv_always_, " suspend start\n"); DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); pdbgpriv->dbg_suspend_cnt++; pwrpriv->bInSuspend = _TRUE; while (pwrpriv->bips_processing == _TRUE) rtw_msleep_os(1); #ifdef CONFIG_IOL_READ_EFUSE_MAP if(!padapter->bup){ u8 bMacPwrCtrlOn = _FALSE; rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if(bMacPwrCtrlOn) rtw_hal_power_off(padapter); } #endif if((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) { DBG_871X("%s bup=%d bDriverStopped=%d bSurpriseRemoved = %d\n", __FUNCTION__ ,padapter->bup, padapter->bDriverStopped,padapter->bSurpriseRemoved); pdbgpriv->dbg_suspend_error_cnt++; goto exit; } rtw_ps_deny(padapter, PS_DENY_SUSPEND); rtw_cancel_all_timer(padapter); #ifdef CONFIG_CONCURRENT_MODE if (padapter->pbuddy_adapter){ rtw_cancel_all_timer(padapter->pbuddy_adapter); } #endif // CONFIG_CONCURRENT_MODE LeaveAllPowerSaveModeDirect(padapter); rtw_stop_cmd_thread(padapter); #ifdef CONFIG_BT_COEXIST // wait for the latest FW to remove this condition. if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { rtw_btcoex_SuspendNotify(padapter, 0); DBG_871X("WIFI_AP_STATE\n"); #ifdef CONFIG_CONCURRENT_MODE } else if (check_buddy_fwstate(padapter, WIFI_AP_STATE)) { rtw_btcoex_SuspendNotify(padapter, 0); DBG_871X("P2P_ROLE_GO\n"); #endif //CONFIG_CONCURRENT_MODE } else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) { rtw_btcoex_SuspendNotify(padapter, 1); DBG_871X("STATION\n"); } #endif // CONFIG_BT_COEXIST rtw_ps_deny_cancel(padapter, PS_DENY_SUSPEND); if (check_fwstate(pmlmepriv,WIFI_STATION_STATE) == _TRUE #ifdef CONFIG_CONCURRENT_MODE && check_buddy_fwstate(padapter, WIFI_AP_STATE) == _FALSE #endif ) { #ifdef CONFIG_WOWLAN if (check_fwstate(pmlmepriv, _FW_LINKED)) { pwrpriv->wowlan_mode = _TRUE; } else if (pwrpriv->wowlan_pno_enable == _TRUE) { pwrpriv->wowlan_mode |= pwrpriv->wowlan_pno_enable; } #ifdef CONFIG_P2P_WOWLAN if(!rtw_p2p_chk_state(&padapter->wdinfo, P2P_STATE_NONE) || P2P_ROLE_DISABLE != padapter->wdinfo.role) { pwrpriv->wowlan_p2p_mode = _TRUE; } if(_TRUE == pwrpriv->wowlan_p2p_mode) pwrpriv->wowlan_mode |= pwrpriv->wowlan_p2p_mode; #endif //CONFIG_P2P_WOWLAN if (pwrpriv->wowlan_mode == _TRUE) rtw_suspend_wow(padapter); else rtw_suspend_normal(padapter); #else //CONFIG_WOWLAN rtw_suspend_normal(padapter); #endif //CONFIG_WOWLAN } else if (check_fwstate(pmlmepriv,WIFI_AP_STATE) == _TRUE #ifdef CONFIG_CONCURRENT_MODE && check_buddy_fwstate(padapter, WIFI_AP_STATE) == _FALSE #endif ) { #ifdef CONFIG_AP_WOWLAN rtw_suspend_ap_wow(padapter); #else rtw_suspend_normal(padapter); #endif //CONFIG_AP_WOWLAN #ifdef CONFIG_CONCURRENT_MODE } else if (check_fwstate(pmlmepriv,WIFI_STATION_STATE) == _TRUE && check_buddy_fwstate(padapter, WIFI_AP_STATE) == _TRUE) { #ifdef CONFIG_AP_WOWLAN rtw_suspend_ap_wow(padapter); #else rtw_suspend_normal(padapter); #endif //CONFIG_AP_WOWLAN #endif } else { rtw_suspend_normal(padapter); } DBG_871X_LEVEL(_drv_always_, "rtw suspend success in %d ms\n", rtw_get_passing_time_ms(start_time)); exit: DBG_871X("<=== %s return %d.............. in %dms\n", __FUNCTION__ , ret, rtw_get_passing_time_ms(start_time)); return ret; } #ifdef CONFIG_WOWLAN int rtw_resume_process_wow(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev; #endif struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; struct wowlan_ioctl_param poidparam; struct sta_info *psta = NULL; int ret = _SUCCESS; _func_enter_; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); if (padapter) { pnetdev = padapter->pnetdev; pwrpriv = adapter_to_pwrctl(padapter); } else { pdbgpriv->dbg_resume_error_cnt++; ret = -1; goto exit; } if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { DBG_871X("%s pdapter %p bDriverStopped %d bSurpriseRemoved %d\n", __FUNCTION__, padapter, padapter->bDriverStopped, padapter->bSurpriseRemoved); goto exit; } #ifdef CONFIG_PNO_SUPPORT pwrpriv->pno_in_resume = _TRUE; #ifdef CONFIG_FWLPS_IN_IPS if(pwrpriv->wowlan_pno_enable) rtw_set_fw_in_ips_mode(padapter, _FALSE); #endif //CONFIG_FWLPS_IN_IPS #endif//CONFIG_PNO_SUPPORT if (pwrpriv->wowlan_mode == _TRUE){ #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "WOWLAN"); #endif //CONFIG_LPS pwrpriv->bFwCurrentInPSMode = _FALSE; #ifdef CONFIG_SDIO_HCI if (padapter->intf_stop) { padapter->intf_stop(padapter); } #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { //free buddy adapter's resource padapter->pbuddy_adapter->intf_stop(padapter->pbuddy_adapter); } #endif rtw_hal_clear_interrupt(padapter); #endif //CONFIG_SDIO_HCI //if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { if((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)){ ret = -1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __FUNCTION__)); goto exit; } //Disable WOW, set H2C command poidparam.subcode=WOWLAN_DISABLE; rtw_hal_set_hwreg(padapter,HW_VAR_WOWLAN,(u8 *)&poidparam); #ifdef CONFIG_CONCURRENT_MODE rtw_reset_drv_sw(padapter->pbuddy_adapter); #endif psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); if (psta) { set_sta_rate(padapter, psta); } padapter->bDriverStopped = _FALSE; DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); rtw_start_drv_threads(padapter); #ifdef CONFIG_CONCURRENT_MODE if (padapter->pbuddy_adapter) { padapter->pbuddy_adapter->bDriverStopped = _FALSE; DBG_871X("%s: wowmode resuming, pbuddy_adapter->DriverStopped:%d\n", __FUNCTION__, padapter->pbuddy_adapter->bDriverStopped); rtw_start_drv_threads(padapter->pbuddy_adapter); } #endif // CONFIG_CONCURRENT_MODE if (padapter->intf_start) { padapter->intf_start(padapter); } #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { //free buddy adapter's resource padapter->pbuddy_adapter->intf_start(padapter->pbuddy_adapter); } if (rtw_buddy_adapter_up(padapter)) { pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; if(pbuddy_netdev){ netif_device_attach(pbuddy_netdev); netif_carrier_on(pbuddy_netdev); } } #endif // start netif queue if (pnetdev) { rtw_netif_wake_queue(pnetdev); } } else{ DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode=%d\n", __FUNCTION__, pwrpriv->wowlan_mode); } if( padapter->pid[1]!=0) { DBG_871X("pid[1]:%d\n",padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect || pwrpriv->wowlan_wake_reason == Rx_DisAssoc || pwrpriv->wowlan_wake_reason == Rx_DeAuth) { DBG_871X("%s: disconnect reason: %02x\n", __func__, pwrpriv->wowlan_wake_reason); rtw_indicate_disconnect(padapter); rtw_sta_media_status_rpt(padapter, rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)), 0); rtw_free_assoc_resources(padapter, 1); pmlmeinfo->state = WIFI_FW_NULL_STATE; } else { DBG_871X("%s: do roaming\n", __func__); rtw_roaming(padapter, NULL); } } if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect) { rtw_lock_ext_suspend_timeout(2000); } if (pwrpriv->wowlan_wake_reason == Rx_GTK || pwrpriv->wowlan_wake_reason == Rx_DisAssoc || pwrpriv->wowlan_wake_reason == Rx_DeAuth) { rtw_lock_ext_suspend_timeout(8000); } if (pwrpriv->wowlan_wake_reason == RX_PNOWakeUp) { #ifdef CONFIG_IOCTL_CFG80211 cfg80211_disconnected(padapter->pnetdev, 0, NULL, 0, GFP_ATOMIC); #endif rtw_lock_ext_suspend_timeout(10000); } if (pwrpriv->wowlan_mode == _TRUE) { pwrpriv->bips_processing = _FALSE; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); #ifndef CONFIG_IPS_CHECK_IN_WD rtw_set_pwr_state_check_timer(pwrpriv); #endif } else { DBG_871X_LEVEL(_drv_always_, "do not reset timer\n"); } pwrpriv->wowlan_mode =_FALSE; // Power On LED rtw_hal_sw_led_init(padapter); if(pwrpriv->wowlan_wake_reason == Rx_DisAssoc || pwrpriv->wowlan_wake_reason == Rx_DeAuth || pwrpriv->wowlan_wake_reason == FWDecisionDisconnect) rtw_led_control(padapter, LED_CTL_NO_LINK); else rtw_led_control(padapter, LED_CTL_LINK); //clean driver side wake up reason. pwrpriv->wowlan_wake_reason = 0; exit: DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); _func_exit_; return ret; } #endif //#ifdef CONFIG_WOWLAN #ifdef CONFIG_AP_WOWLAN int rtw_resume_process_ap_wow(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct net_device *pnetdev = padapter->pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev; #endif struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct dvobj_priv *psdpriv = padapter->dvobj; struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; struct wowlan_ioctl_param poidparam; struct sta_info *psta = NULL; int ret = _SUCCESS; u8 ch, bw, offset; _func_enter_; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); if (padapter) { pnetdev = padapter->pnetdev; pwrpriv = adapter_to_pwrctl(padapter); } else { pdbgpriv->dbg_resume_error_cnt++; ret = -1; goto exit; } #ifdef CONFIG_LPS rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "AP-WOWLAN"); #endif //CONFIG_LPS pwrpriv->bFwCurrentInPSMode = _FALSE; rtw_hal_disable_interrupt(padapter); rtw_hal_clear_interrupt(padapter); //if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) { if((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)){ ret = -1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __FUNCTION__)); goto exit; } //Disable WOW, set H2C command poidparam.subcode = WOWLAN_AP_DISABLE; rtw_hal_set_hwreg(padapter,HW_VAR_AP_WOWLAN,(u8 *)&poidparam); pwrpriv->wowlan_ap_mode = _FALSE; padapter->bDriverStopped = _FALSE; DBG_871X("%s: wowmode resuming, DriverStopped:%d\n", __func__, padapter->bDriverStopped); rtw_start_drv_threads(padapter); #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { padapter->pbuddy_adapter->bDriverStopped = _FALSE; DBG_871X("%s: wowmode resuming, pbuddy_adapter->DriverStopped:%d\n", __FUNCTION__, padapter->pbuddy_adapter->bDriverStopped); rtw_start_drv_threads(padapter->pbuddy_adapter); } #endif // CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { if (rtw_get_ch_setting_union(padapter->pbuddy_adapter, &ch, &bw, &offset) != 0) { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter->pbuddy_adapter), ch, bw, offset); set_channel_bwmode(padapter->pbuddy_adapter, ch, offset, bw); } } else { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); rtw_reset_drv_sw(padapter->pbuddy_adapter); } #else if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); } #endif if (padapter->intf_start) { padapter->intf_start(padapter); } #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { //free buddy adapter's resource padapter->pbuddy_adapter->intf_start(padapter->pbuddy_adapter); } #endif #ifdef CONFIG_CONCURRENT_MODE if (rtw_buddy_adapter_up(padapter)) { pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; if(pbuddy_netdev){ rtw_netif_wake_queue(pbuddy_netdev); } } #endif // start netif queue if (pnetdev) { rtw_netif_wake_queue(pnetdev); } if( padapter->pid[1]!=0) { DBG_871X("pid[1]:%d\n",padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } #ifdef CONFIG_RESUME_IN_WORKQUEUE //rtw_unlock_suspend(); #endif //CONFIG_RESUME_IN_WORKQUEUE if (pwrpriv->wowlan_wake_reason == AP_WakeUp) rtw_lock_ext_suspend_timeout(8000); pwrpriv->bips_processing = _FALSE; _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); #ifndef CONFIG_IPS_CHECK_IN_WD rtw_set_pwr_state_check_timer(pwrpriv); #endif //clean driver side wake up reason. pwrpriv->wowlan_wake_reason = 0; // Power On LED rtw_hal_sw_led_init(padapter); rtw_led_control(padapter, LED_CTL_LINK); exit: DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); _func_exit_; return ret; } #endif //#ifdef CONFIG_APWOWLAN int rtw_resume_process_normal(_adapter *padapter) { struct net_device *pnetdev; #ifdef CONFIG_CONCURRENT_MODE struct net_device *pbuddy_netdev; #endif struct pwrctrl_priv *pwrpriv; struct mlme_priv *pmlmepriv; struct dvobj_priv *psdpriv; struct debug_priv *pdbgpriv; int ret = _SUCCESS; _func_enter_; if (!padapter) { ret = -1; goto exit; } pnetdev = padapter->pnetdev; pwrpriv = adapter_to_pwrctl(padapter); pmlmepriv = &padapter->mlmepriv; psdpriv = padapter->dvobj; pdbgpriv = &psdpriv->drv_dbg; DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); // interface init //if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) if((padapter->intf_init)&& (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) { ret = -1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: initialize SDIO Failed!!\n", __FUNCTION__)); goto exit; } rtw_hal_disable_interrupt(padapter); //if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) if ((padapter->intf_alloc_irq)&&(padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { ret = -1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __FUNCTION__)); goto exit; } rtw_reset_drv_sw(padapter); #ifdef CONFIG_CONCURRENT_MODE rtw_reset_drv_sw(padapter->pbuddy_adapter); #endif pwrpriv->bkeepfwalive = _FALSE; DBG_871X("bkeepfwalive(%x)\n",pwrpriv->bkeepfwalive); if(pm_netdev_open(pnetdev,_TRUE) != 0) { ret = -1; pdbgpriv->dbg_resume_error_cnt++; goto exit; } netif_device_attach(pnetdev); netif_carrier_on(pnetdev); #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)){ pbuddy_netdev = padapter->pbuddy_adapter->pnetdev; netif_device_attach(pbuddy_netdev); netif_carrier_on(pbuddy_netdev); } #endif if( padapter->pid[1]!=0) { DBG_871X("pid[1]:%d\n",padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) rtw_roaming(padapter, NULL); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); rtw_ap_restore_network(padapter); } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); } else { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); } #ifdef CONFIG_CONCURRENT_MODE if(rtw_buddy_adapter_up(padapter)) { _adapter *buddy = padapter->pbuddy_adapter; struct mlme_priv *buddy_mlme = &padapter->pbuddy_adapter->mlmepriv; if (check_fwstate(buddy_mlme, WIFI_STATION_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(buddy), get_fwstate(buddy_mlme)); if (rtw_chk_roam_flags(buddy, RTW_ROAM_ON_RESUME)) rtw_roaming(buddy, NULL); } else if (check_fwstate(buddy_mlme, WIFI_AP_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(buddy), get_fwstate(buddy_mlme)); rtw_ap_restore_network(buddy); } else if (check_fwstate(buddy_mlme, WIFI_ADHOC_STATE)) { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(buddy), get_fwstate(buddy_mlme)); } else { DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(buddy), get_fwstate(buddy_mlme)); } } #endif #ifdef CONFIG_RESUME_IN_WORKQUEUE //rtw_unlock_suspend(); #endif //CONFIG_RESUME_IN_WORKQUEUE DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); exit: _func_exit_; return ret; } int rtw_resume_common(_adapter *padapter) { int ret = 0; u32 start_time = rtw_get_current_time(); struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; _func_enter_; if (pwrpriv->bInSuspend == _FALSE) return 0; DBG_871X_LEVEL(_drv_always_, "resume start\n"); DBG_871X("==> %s (%s:%d)\n",__FUNCTION__, current->comm, current->pid); if (check_fwstate(pmlmepriv,WIFI_STATION_STATE) == _TRUE #ifdef CONFIG_CONCURRENT_MODE && check_buddy_fwstate(padapter, WIFI_AP_STATE) == _FALSE #endif ) { #ifdef CONFIG_WOWLAN if (pwrpriv->wowlan_mode == _TRUE) rtw_resume_process_wow(padapter); else rtw_resume_process_normal(padapter); #else rtw_resume_process_normal(padapter); #endif } else if (check_fwstate(pmlmepriv,WIFI_AP_STATE) == _TRUE #ifdef CONFIG_CONCURRENT_MODE && check_buddy_fwstate(padapter, WIFI_AP_STATE) == _FALSE #endif ) { #ifdef CONFIG_AP_WOWLAN rtw_resume_process_ap_wow(padapter); #else rtw_resume_process_normal(padapter); #endif //CONFIG_AP_WOWLAN #ifdef CONFIG_CONCURRENT_MODE } else if (check_fwstate(pmlmepriv,WIFI_STATION_STATE) == _TRUE && check_buddy_fwstate(padapter, WIFI_AP_STATE) == _TRUE) { #ifdef CONFIG_AP_WOWLAN rtw_resume_process_ap_wow(padapter); #else rtw_resume_process_normal(padapter); #endif //CONFIG_AP_WOWLAN #endif } else { rtw_resume_process_normal(padapter); } #ifdef CONFIG_BT_COEXIST rtw_btcoex_SuspendNotify(padapter, 0); #endif // CONFIG_BT_COEXIST if (pwrpriv) { pwrpriv->bInSuspend = _FALSE; #ifdef CONFIG_PNO_SUPPORT pwrpriv->pno_in_resume = _FALSE; #endif } DBG_871X_LEVEL(_drv_always_, "%s:%d in %d ms\n", __FUNCTION__ ,ret, rtw_get_passing_time_ms(start_time)); _func_exit_; return ret; } #ifdef CONFIG_GPIO_API u8 rtw_get_gpio(struct net_device *netdev, u8 gpio_num) { _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); return rtw_hal_get_gpio(adapter, gpio_num); } EXPORT_SYMBOL(rtw_get_gpio); int rtw_set_gpio_output_value(struct net_device *netdev, u8 gpio_num, bool isHigh) { u8 direction = 0; u8 res = -1; _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); return rtw_hal_set_gpio_output_value(adapter, gpio_num,isHigh); } EXPORT_SYMBOL(rtw_set_gpio_output_value); int rtw_config_gpio(struct net_device *netdev, u8 gpio_num, bool isOutput) { _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); return rtw_hal_config_gpio(adapter,gpio_num,isOutput); } EXPORT_SYMBOL(rtw_config_gpio); int rtw_register_gpio_interrupt(struct net_device *netdev, int gpio_num, void(*callback)(u8 level)) { _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); return rtw_hal_register_gpio_interrupt(adapter,gpio_num,callback); } EXPORT_SYMBOL(rtw_register_gpio_interrupt); int rtw_disable_gpio_interrupt(struct net_device *netdev, int gpio_num) { _adapter *adapter = (_adapter *)rtw_netdev_priv(netdev); return rtw_hal_disable_gpio_interrupt(adapter,gpio_num); } EXPORT_SYMBOL(rtw_disable_gpio_interrupt); #endif //#ifdef CONFIG_GPIO_API
{'repo_name': 'OLIMEX/DIY-LAPTOP', 'stars': '358', 'repo_language': 'C', 'file_name': 'Kconfig', 'mime_type': 'text/plain', 'hash': -4842258974518960046, 'source_dataset': 'data'}
parameters: - name: testProjects type: object default: - OmniSharp.DotNetTest.Tests - OmniSharp.MSBuild.Tests,OmniSharp.Roslyn.CSharp.Tests,OmniSharp.Cake.Tests,OmniSharp.Script.Tests,OmniSharp.Stdio.Tests,OmniSharp.Http.Tests,OmniSharp.Tests,OmniSharp.Lsp.Tests trigger: batch: 'true' branches: include: - master - refs/tags/* pr: autoCancel: 'true' branches: include: - master resources: repositories: - repository: rsg type: github name: RocketSurgeonsGuild/AzureDevopsTemplates ref: refs/tags/v0.4.5 endpoint: github variables: Verbosity: Diagnostic DotNetVersion: "3.1.401" CakeVersion: "0.32.1" NuGetVersion: "4.9.2" GitVersionVersion: "5.0.1" MonoVersion: "6.10.0" Coverage: "$(Agent.BuildDirectory)/c" VstsCoverage: "$(Coverage)" Artifacts: $(Build.SourcesDirectory)/artifacts/ VstsArtifacts: "$(Artifacts)" DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true" jobs: - job: GitVersion pool: vmImage: "windows-2019" steps: - template: gitversion/store.yml@rsg parameters: NuGetVersion: $(NuGetVersion) version: $(GitVersionVersion) - job: macOS pool: vmImage: "macOS-10.15" dependsOn: GitVersion steps: - template: ./.pipelines/init.yml parameters: Verbosity: $(Verbosity) CakeVersion: $(CakeVersion) DotNetVersion: $(DotNetVersion) NuGetVersion: $(NuGetVersion) MonoVersion: $(MonoVersion) - script: | echo $PATH chmod 755 ./build.sh ./build.sh --configuration Release --verbosity Verbose --target CI --publish-all --archive displayName: 'Build' - template: ./.pipelines/artifacts.yml parameters: Artifacts: $(Artifacts) - job: macOS_tests pool: vmImage: "macOS-10.15" dependsOn: GitVersion strategy: matrix: ${{ each project in parameters.testProjects }}: ${{ project }}: TEST_PROJECT: ${{ project }} steps: - template: ./.pipelines/init.yml parameters: Verbosity: $(Verbosity) CakeVersion: $(CakeVersion) DotNetVersion: $(DotNetVersion) NuGetVersion: $(NuGetVersion) MonoVersion: $(MonoVersion) - script: | echo $PATH chmod 755 ./build.sh ./build.sh --configuration Debug --verbosity Verbose --target Test --test-project="$TEST_PROJECT" displayName: 'Build' - template: ./.pipelines/logs.yml parameters: Artifacts: $(Artifacts) - job: Linux pool: vmImage: "ubuntu-18.04" dependsOn: GitVersion steps: - template: ./.pipelines/init.yml parameters: Verbosity: $(Verbosity) CakeVersion: $(CakeVersion) DotNetVersion: $(DotNetVersion) NuGetVersion: $(NuGetVersion) MonoVersion: $(MonoVersion) - script: | chmod 755 ./build.sh ./build.sh --configuration Release --verbosity Verbose --target CI --publish-all --archive displayName: 'Build' - template: ./.pipelines/artifacts.yml parameters: Artifacts: $(Artifacts) - job: Linux_tests pool: vmImage: "ubuntu-18.04" dependsOn: GitVersion strategy: matrix: ${{ each project in parameters.testProjects }}: ${{ project }}: TEST_PROJECT: ${{ project }} steps: - template: ./.pipelines/init.yml parameters: Verbosity: $(Verbosity) CakeVersion: $(CakeVersion) DotNetVersion: $(DotNetVersion) NuGetVersion: $(NuGetVersion) MonoVersion: $(MonoVersion) - script: | chmod 755 ./build.sh ./build.sh --configuration Debug --verbosity Verbose --target Test --test-project="$TEST_PROJECT" displayName: 'Build' - template: ./.pipelines/logs.yml parameters: Artifacts: $(Artifacts) - job: Windows pool: vmImage: "windows-2019" dependsOn: GitVersion steps: - template: ./.pipelines/init.yml parameters: Verbosity: $(Verbosity) CakeVersion: $(CakeVersion) DotNetVersion: $(DotNetVersion) NuGetVersion: $(NuGetVersion) - powershell: .\build.ps1 -configuration Release -verbosity Verbose -target CI -publish-all -archive displayName: 'Build' - template: ./.pipelines/artifacts.yml parameters: Artifacts: $(Artifacts) - job: Windows_tests pool: vmImage: "windows-2019" dependsOn: GitVersion strategy: matrix: ${{ each project in parameters.testProjects }}: ${{ project }}: TEST_PROJECT: ${{ project }} steps: - template: ./.pipelines/init.yml parameters: Verbosity: $(Verbosity) CakeVersion: $(CakeVersion) DotNetVersion: $(DotNetVersion) NuGetVersion: $(NuGetVersion) - powershell: .\build.ps1 -configuration Debug -verbosity Verbose --test-project="$ENV:TEST_PROJECT" -target Test displayName: 'Build' - template: ./.pipelines/logs.yml parameters: Artifacts: $(Artifacts) - job: Release pool: vmImage: "Ubuntu-16.04" dependsOn: - macOS - macOS_tests - Linux - Linux_tests - Windows - Windows_tests steps: - task: NuGetToolInstaller@1 displayName: 'Install NuGet' inputs: versionSpec: $(NuGetVersion) - task: DownloadBuildArtifacts@0 displayName: Download Packages inputs: downloadType: 'single' artifactName: 'packages' buildType: 'current' downloadPath: '$(System.ArtifactsDirectory)' - task: DownloadBuildArtifacts@0 displayName: Download Deployment inputs: downloadType: 'single' artifactName: 'deployment' buildType: 'current' downloadPath: '$(System.ArtifactsDirectory)' - task: DownloadBuildArtifacts@0 displayName: Download NuGet inputs: downloadType: 'single' artifactName: 'nuget' buildType: 'current' downloadPath: '$(System.ArtifactsDirectory)' - task: NuGetCommand@2 displayName: 'Push NuGet packages to myget.org' inputs: command: push nuGetFeedType: external packagesToPush: '$(System.ArtifactsDirectory)/nuget/**/*.nupkg' publishFeedCredentials: myget.org condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))) - task: NuGetCommand@2 displayName: 'Push NuGet packages to nuget.org' inputs: command: push nuGetFeedType: external packagesToPush: '$(System.ArtifactsDirectory)/nuget/**/*.nupkg' publishFeedCredentials: nuget.org condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - script: | AZ_REPO=$(lsb_release -cs) echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \ sudo tee /etc/apt/sources.list.d/azure-cli.list curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - sudo apt-get install apt-transport-https sudo apt-get update && sudo apt-get install azure-cli az storage blob upload-batch --destination "releases" --source "$(System.ArtifactsDirectory)/deployment/" --account-name roslynomnisharp --account-key $BLOB_KEY displayName: Upload to Azure Storage condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) env: BLOB_KEY: $(BLOB_KEY) - task: GitHubRelease@0 displayName: 'GitHub release (edit)' condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) inputs: gitHubConnection: github repositoryName: OmniSharp/omnisharp-roslyn action: edit tag: '$(Build.SourceBranchName)' title: '$(Build.SourceBranchName)' assets: '$(System.ArtifactsDirectory)/packages/**/*' assetUploadMode: replace # releaseNotesSource: input # releaseNotes: asdfasdf12 # isDraft: true # isPreRelease: true # addChangeLog: false
{'repo_name': 'OmniSharp/omnisharp-roslyn', 'stars': '895', 'repo_language': 'C#', 'file_name': 'Using-Omnisharp.md', 'mime_type': 'text/plain', 'hash': 8056059926447215230, 'source_dataset': 'data'}
如果您在腾讯云中使用到了云数据库、云服务器、私有网络等服务,这些服务由不同的人管理,但都共享您的云账号密钥,将存在以下问题: - 您的密钥由多人共享,泄密风险高。 - 您无法限制他人的访问权限,易产生误操作造成安全风险。 这个时候,访问管理应运而生。 有关腾讯云访问管理 CAM 的更多介绍,请参见 [CAM 概述](https://cloud.tencent.com/document/product/598/10583)。 接入CAM 后,可通过子账号实现不同的人管理不同的服务,以避免出现以上的问题。默认情况下,子账号没有使用云数据库实例以及云数据库相关资源的权限。因此,我们就需要创建策略来允许子账号使用他们所需要的资源或者权限。 策略是定义和描述一条或多条权限的语法规范,策略通过授权一个用户或者一组用户来允许或拒绝使用指定资源。CAM 策略的更多基本信息请参见 [策略语法](https://cloud.tencent.com/document/product/598/10603),使用信息请参见 [策略](https://cloud.tencent.com/document/product/598/10601)。 如果您不需要对子账户进行云数据库相关资源的访问管理,您可以跳过此章节。跳过这些部分并不影响您对文档中其余部分的理解和使用。 ### 入门 CAM 策略必须授权使用一个或多个云数据库操作或者必须拒绝使用一个或多个云数据库操作。同时还必须指定可以用于操作的资源(可以是全部资源,某些操作也可以是部分资源),策略还可以包含操作资源所设置的条件。 >! > - 建议用户使用 CAM 策略来管理云数据库资源和授权云数据库操作,对于存量分项目权限的用户体验不变,但不建议再继续使用分项目权限来管理资源与授权操作。 > - 云数据库暂时不支持相关生效条件设置。
{'repo_name': 'tencentyun/qcloud-documents', 'stars': '773', 'repo_language': 'HTML', 'file_name': '发单聊消息之前回调.md', 'mime_type': 'text/plain', 'hash': -7009575725416526670, 'source_dataset': 'data'}
# # Parameters for the Streitz and Mintmire variable charge model for alumina # # Phys. Rev. B, 50, 11996 (1994) # keyword sm smelectronegativity Al 0.000000 5.164327 0.968438 0.746759 O 5.484763 7.017857 2.143957 0.000000 buck Al core Al core 4.474755 0.991317 0.0 0.0 12.0 Al core O core 62.933909 0.443658 0.0 0.0 12.0 O core O core 3322.784218 0.291065 0.0 0.0 12.0 rydberg Al core Al core 0.159472 5.949143672000 3.365875 0.0 12.0 Al core O core 0.094594 9.985407051900 2.358570 0.0 12.0 O core O core 1.865072 16.822405075464 2.005092 0.0 12.0 manybody Al core Al core 0.0 8.0 Al core O core 0.0 8.0 O core O core 0.0 8.0 eam_functional square_root Al core 1.987699 O core 2.116850 eam_density exponential 0 Al core 0.147699 2.017519 3.365875 O core 1.000000 6.871329 2.005092
{'repo_name': 'materialsproject/pymatgen', 'stars': '596', 'repo_language': 'Python', 'file_name': '__init__.py', 'mime_type': 'text/plain', 'hash': 6673412974860233527, 'source_dataset': 'data'}
/* SPDX-License-Identifier: GPL-2.0 */ /* X-SPDX-Copyright-Text: (c) Solarflare Communications Inc */ #ifndef __ONLOAD_MMAP_H__ #define __ONLOAD_MMAP_H__ /* For CI_CFG_* */ #include <ci/internal/transport_config_opt.h> #include <onload/mmap_base.h> #include <cplane/mmap.h> /* OO_MMAP_TYPE_NETIF offsets has following IDs: * - CI_NETIF_MMAP_ID_STATE netif shared state; ep buffers * - CI_NETIF_MMAP_ID_TIMESYNC timesync shared state, read-only * (could be extended to other global shared * states) * - CI_NETIF_MMAP_ID_IO VI resource: IO bar. * - CI_NETIF_MMAP_ID_IOBUFS VI resource: queues * + if CI_CFG_PKTS_AS_HUGE_PAGES=1, mmap pkt_shm_id array * - CI_NETIF_MMAP_ID_PIO VI resource: PIO IO BAR * - CI_NETIF_MMAP_ID_CTPIO VI resource: CTPIO IO BAR * - CI_NETIF_MMAP_ID_OFE_RO OFE read-only part of engine * - CI_NETIF_MMAP_ID_OFE_RW OFE read-write part of engine * - CI_NETIF_MMAP_ID_CPLANE Control plame MIBs mapping * - CI_NETIF_MMAP_ID_PKTS + packet set id * packet sets */ #define CI_NETIF_MMAP_ID_STATE 0 #define CI_NETIF_MMAP_ID_TIMESYNC 1 #define CI_NETIF_MMAP_ID_IO 2 #define CI_NETIF_MMAP_ID_IOBUFS 3 #if CI_CFG_PIO #define CI_NETIF_MMAP_ID_PIO 4 #endif #if CI_CFG_CTPIO #define CI_NETIF_MMAP_ID_CTPIO 5 #endif #ifdef ONLOAD_OFE #define CI_NETIF_MMAP_ID_OFE_RO 6 #define CI_NETIF_MMAP_ID_OFE_RW 7 #endif #define CI_NETIF_MMAP_ID_PKTS 8 #define CI_NETIF_MMAP_ID_PKTSET(id) (CI_NETIF_MMAP_ID_PKTS+(id)) /* OO_MMAP_TYPE_DSHM: * "Donation" shm mmap IDs encode buffer ID and class. */ #ifdef OO_MMAP_TYPE_DSHM # define OO_MMAP_DSHM_BUFFER_ID_WIDTH 32 # define OO_MMAP_DSHM_SHM_CLASS_WIDTH 12 # define OO_MMAP_DSHM_BUFFER_ID(map_id) \ ((map_id) & ((1ull << OO_MMAP_DSHM_BUFFER_ID_WIDTH) - 1)) # define OO_MMAP_DSHM_SHM_CLASS(map_id) \ (((map_id) >> OO_MMAP_DSHM_BUFFER_ID_WIDTH) & \ ((1ull << OO_MMAP_DSHM_SHM_CLASS_WIDTH) - 1)) # define OO_MMAP_DSHM_MAKE_ID(shm_class, buffer_id) \ ((ci_uint64) (buffer_id) | \ ((ci_uint64) (shm_class) << OO_MMAP_DSHM_BUFFER_ID_WIDTH)) #endif #define VMA_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) #endif
{'repo_name': 'majek/openonload', 'stars': '150', 'repo_language': 'C', 'file_name': 'efthrm.mk', 'mime_type': 'text/plain', 'hash': -5927409890916992470, 'source_dataset': 'data'}
/* * This file is based on the Windows Pointer Input Message support code files by * Alvin Wong. * Notwithstanding the license specified in this repository, this file is * redistributed under BSD 2-Clause license written below in order to keep * backporting available. * * All contributions by Alvin Wong: * Copyright (c) 2017 Alvin Wong <alvinhochun@gmail.com> * All rights reserved. * * All other contributions: * Copyright (c) 2018, the respective contributors. * All rights reserved. * * Each contributor holds copyright over their respective contributions. * The project versioning (Git) records all such contribution source information. * * Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ // Get Windows 8 API prototypes and types #ifdef WINVER #undef WINVER #endif #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define WINVER 0x0602 #define _WIN32_WINNT 0x0602 #include "kis_tablet_support_win8.h" #include <QApplication> #include <QDebug> #include <QHash> #include <QLibrary> #include <QPointer> #include <QTabletEvent> #include <QVector> #include <QWidget> #include <QWindow> #include <utility> #ifdef _WIN32 #ifdef KRITA #include <kis_debug.h> #endif #include <windows.h> #include <tpcshrd.h> #ifndef Q_OS_WIN #error This file must not be compiled for non-Windows systems #endif namespace { class Win8PointerInputApi { #define WIN8_POINTER_INPUT_API_LIST(FUNC) \ /* Pointer Input Functions */ \ FUNC(GetPointerPenInfo) \ FUNC(GetPointerPenInfoHistory) \ FUNC(GetPointerType) \ /* Pointer Device Functions */ \ FUNC(GetPointerDevices) \ /*FUNC(GetPointerDeviceProperties)*/ \ FUNC(GetPointerDevice) \ FUNC(GetPointerDeviceRects) \ /*FUNC(RegisterPointerDeviceNotifications)*/ \ /* end */ bool m_loaded; public: #define DEFINE_FP_FROM_WINAPI(func) \ \ public: \ using p##func##_t = std::add_pointer<decltype(func)>::type; \ \ private: \ p##func##_t m_p##func = nullptr; \ \ public: \ const p##func##_t &func = m_p##func; // const fp ref to member WIN8_POINTER_INPUT_API_LIST(DEFINE_FP_FROM_WINAPI) #undef DEFINE_FP_FROM_WINAPI public: Win8PointerInputApi() : m_loaded(false) {} bool init() { if (m_loaded) { return true; } QLibrary user32Lib("user32"); if (!user32Lib.load()) { qWarning() << "Failed to load user32.dll! This really should not happen."; return false; } #ifdef KRITA #define LOAD_AND_CHECK_FP_FROM_WINAPI(func) \ m_p##func = reinterpret_cast<p##func##_t>(user32Lib.resolve(#func)); \ if (!m_p##func) { \ dbgTablet << "Failed to load function " #func " from user32.dll"; \ return false; \ } #else #define LOAD_AND_CHECK_FP_FROM_WINAPI(func) \ m_p##func = reinterpret_cast<p##func##_t>(user32Lib.resolve(#func)); \ if (!m_p##func) { \ return false; \ } #endif WIN8_POINTER_INPUT_API_LIST(LOAD_AND_CHECK_FP_FROM_WINAPI) #undef LOAD_AND_CHECK_FP_FROM_WINAPI #ifdef KRITA dbgTablet << "Loaded Windows 8 Pointer Input API functions"; #endif m_loaded = true; return true; } bool isLoaded() { return m_loaded; } #undef WIN8_POINTER_INPUT_API_LIST }; // class Win8PointerInputApi Win8PointerInputApi api; class PointerFlagsWrapper { const POINTER_FLAGS f; public: PointerFlagsWrapper(POINTER_FLAGS flags) : f(flags) {} static PointerFlagsWrapper fromPointerInfo(const POINTER_INFO &pointerInfo) { return PointerFlagsWrapper(pointerInfo.pointerFlags); } static PointerFlagsWrapper fromPenInfo(const POINTER_PEN_INFO &penInfo) { return fromPointerInfo(penInfo.pointerInfo); } bool isNew() const { return f & POINTER_FLAG_NEW; } bool isInRange() const { return f & POINTER_FLAG_INRANGE; } bool isInContact() const { return f & POINTER_FLAG_INCONTACT; } bool isFirstButtonDown() const { return f & POINTER_FLAG_FIRSTBUTTON; } bool isSecondButtonDown() const { return f & POINTER_FLAG_SECONDBUTTON; } bool isThirdButtonDown() const { return f & POINTER_FLAG_THIRDBUTTON; } bool isForthButtonDown() const { return f & POINTER_FLAG_FOURTHBUTTON; } bool isFifthButtonDown() const { return f & POINTER_FLAG_FIFTHBUTTON; } bool isPrimary() const { return f & POINTER_FLAG_PRIMARY; } bool isConfidence() const { return f & POINTER_FLAG_CONFIDENCE; } bool isCancelled() const { return f & POINTER_FLAG_CANCELED; } bool isDown() const { return f & POINTER_FLAG_DOWN; } bool isUpdate() const { return f & POINTER_FLAG_UPDATE; } bool isUp() const { return f & POINTER_FLAG_UP; } bool isWheel() const { return f & POINTER_FLAG_WHEEL; } bool isHWheel() const { return f & POINTER_FLAG_HWHEEL; } bool isCaptureChanged() const { return f & POINTER_FLAG_CAPTURECHANGED; } bool hasTransform() const { // mingw-w64 headers is missing this flag // return f & POINTER_FLAG_HASTRANSFORM; return f & 0x00400000; } }; // class PointerFlagsWrapper class PenFlagsWrapper { const PEN_FLAGS f; public: PenFlagsWrapper(PEN_FLAGS flags) : f(flags) {} static PenFlagsWrapper fromPenInfo(const POINTER_PEN_INFO &penInfo) { return PenFlagsWrapper(penInfo.penFlags); } bool isBarrelPressed() const { return f & PEN_FLAG_BARREL; } bool isInverted() const { return f & PEN_FLAG_INVERTED; } bool isEraserPressed() const { return f & PEN_FLAG_ERASER; } }; // class PenFlagsWrapper class PenMaskWrapper { const PEN_MASK f; public: PenMaskWrapper(PEN_MASK mask) : f(mask) {} static PenMaskWrapper fromPenInfo(const POINTER_PEN_INFO &penInfo) { return PenMaskWrapper(penInfo.penMask); } bool pressureValid() const { return f & PEN_MASK_PRESSURE; } bool rotationValid() const { return f & PEN_MASK_ROTATION; } bool tiltXValid() const { return f & PEN_MASK_TILT_X; } bool tiltYValid() const { return f & PEN_MASK_TILT_Y; } }; // class PenMaskWrapper struct PointerDeviceItem { // HANDLE handle; // RECT pointerDeviceRect; // RECT displayRect; qreal himetricToPixelX; qreal himetricToPixelY; qreal pixelOffsetX; qreal pixelOffsetY; DISPLAYCONFIG_ROTATION deviceOrientation; // This is needed to fix tilt }; QHash<HANDLE, PointerDeviceItem> penDevices; struct PenPointerItem { // int pointerId; // POINTER_PEN_INFO penInfo; HWND hwnd; HANDLE deviceHandle; QPointer<QWidget> activeWidget; // Current widget receiving events qreal oneOverDpr; // 1 / devicePixelRatio of activeWidget bool widgetIsCaptured; // Current widget is capturing a pen cown event bool widgetIsIgnored; // Pen events should be ignored until pen up bool widgetAcceptsPenEvent; // Whether the widget accepts pen events bool isCaptured() const { return widgetIsCaptured; } }; QHash<int, PenPointerItem> penPointers; // int primaryPenPointerId; bool handlePointerMsg(const MSG &msg); // extern "C" { // // LRESULT CALLBACK pointerDeviceNotificationsWndProc(HWND hwnd, UINT uMsg, // WPARAM wParam, LPARAM lParam) // { // switch (uMsg) { // case WM_POINTERDEVICECHANGE: // dbgTablet << "I would want to handle this WM_POINTERDEVICECHANGE // event, but ms just doesn't want me to use it"; // dbgTablet << " wParam:" << wParam; // dbgTablet << " lParam:" << lParam; // return 0; // case WM_POINTERDEVICEINRANGE: // dbgTablet << "I would want to handle this WM_POINTERDEVICEINRANGE // event, but ms just doesn't want me to use it"; // dbgTablet << " wParam:" << wParam; // dbgTablet << " lParam:" << lParam; // return 0; // case WM_POINTERDEVICEOUTOFRANGE: // dbgTablet << "I would want to handle this WM_POINTERDEVICEOUTOFRANGE // event, but ms just doesn't want me to use it"; // dbgTablet << " wParam:" << wParam; // dbgTablet << " lParam:" << lParam; // return 0; // } // return DefWindowProcW(hwnd, uMsg, wParam, lParam); // } // // } // extern "C" } // namespace bool KisTabletSupportWin8::isAvailable() { // Just try loading the APIs return api.init(); } bool KisTabletSupportWin8::isPenDeviceAvailable() { if (!api.init()) { return false; } UINT32 deviceCount = 0; if (!api.GetPointerDevices(&deviceCount, nullptr)) { #ifdef KRITA dbgTablet << "GetPointerDevices failed"; #endif return false; } if (deviceCount == 0) { #ifdef KRITA dbgTablet << "No pointer devices"; #endif return false; } QVector<POINTER_DEVICE_INFO> devices(deviceCount); if (!api.GetPointerDevices(&deviceCount, devices.data())) { #ifdef KRITA dbgTablet << "GetPointerDevices failed"; #endif return false; } bool hasPenDevice = false; for (const POINTER_DEVICE_INFO &device : devices) { #ifdef KRITA dbgTablet << "Found pointer device" << static_cast<void *>(device.device) << QString::fromWCharArray(device.productString) << "type:" << device.pointerDeviceType; #endif if (device.pointerDeviceType == POINTER_DEVICE_TYPE_INTEGRATED_PEN || device.pointerDeviceType == POINTER_DEVICE_TYPE_EXTERNAL_PEN) { hasPenDevice = true; } } #ifdef KRITA dbgTablet << "hasPenDevice:" << hasPenDevice; #endif return hasPenDevice; } bool KisTabletSupportWin8::init() { return api.init(); } // void KisTabletSupportWin8::registerPointerDeviceNotifications() // { // const wchar_t *className = L"w8PointerMsgWindow"; // HINSTANCE hInst = static_cast<HINSTANCE>(GetModuleHandleW(nullptr)); // WNDCLASSEXW wc; // wc.cbSize = sizeof(WNDCLASSEXW); // wc.style = 0; // wc.lpfnWndProc = pointerDeviceNotificationsWndProc; // wc.cbClsExtra = 0; // wc.cbWndExtra = 0; // wc.hInstance = hInst; // wc.hCursor = 0; // wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW); // wc.hIcon = 0; // wc.hIconSm = 0; // wc.lpszMenuName = 0; // wc.lpszClassName = className; // // if (RegisterClassEx(&wc)) { // HWND hwnd = CreateWindowEx(0, className, nullptr, 0, 0, 0, 0, 0, // HWND_MESSAGE, nullptr, hInst, nullptr); // api.RegisterPointerDeviceNotifications(hwnd, TRUE); // } else { // dbgTablet << "Cannot register dummy window"; // } // } bool KisTabletSupportWin8::nativeEventFilter(const QByteArray &eventType, void *message, long *result) { if (!result) { // I don't know why this even happens, but it actually does // And the same event is sent in again with result != nullptr return false; } // This is only installed on Windows so there is no reason to check eventType MSG &msg = *static_cast<MSG *>(message); switch (msg.message) { case WM_POINTERDOWN: case WM_POINTERUP: case WM_POINTERENTER: case WM_POINTERLEAVE: case WM_POINTERUPDATE: case WM_POINTERCAPTURECHANGED: { bool handled = handlePointerMsg(msg); if (handled) { *result = 0; return true; } break; } case WM_TABLET_QUERYSYSTEMGESTURESTATUS: *result = 0; return true; } Q_UNUSED(eventType) return false; } namespace { QDebug operator<<(QDebug debug, const POINT &pt) { QDebugStateSaver saver(debug); debug.nospace() << '(' << pt.x << ", " << pt.y << ')'; return debug; } QDebug operator<<(QDebug debug, const RECT &rect) { QDebugStateSaver saver(debug); debug.nospace() << '(' << rect.left << ", " << rect.top << ", " << rect.right << ", " << rect.bottom << ')'; return debug; } bool registerOrUpdateDevice(HANDLE deviceHandle, const RECT &pointerDeviceRect, const RECT &displayRect, const DISPLAYCONFIG_ROTATION deviceOrientation) { bool isPreviouslyRegistered = penDevices.contains(deviceHandle); PointerDeviceItem &deviceItem = penDevices[deviceHandle]; PointerDeviceItem oldDeviceItem = deviceItem; // deviceItem.handle = deviceHandle; deviceItem.himetricToPixelX = static_cast<qreal>(displayRect.right - displayRect.left) / (pointerDeviceRect.right - pointerDeviceRect.left); deviceItem.himetricToPixelY = static_cast<qreal>(displayRect.bottom - displayRect.top) / (pointerDeviceRect.bottom - pointerDeviceRect.top); deviceItem.pixelOffsetX = static_cast<qreal>(displayRect.left) - deviceItem.himetricToPixelX * pointerDeviceRect.left; deviceItem.pixelOffsetY = static_cast<qreal>(displayRect.top) - deviceItem.himetricToPixelY * pointerDeviceRect.top; deviceItem.deviceOrientation = deviceOrientation; if (!isPreviouslyRegistered) { #ifdef KRITA dbgTablet << "Registered pen device" << deviceHandle << "with displayRect" << displayRect << "and deviceRect" << pointerDeviceRect << "scale" << deviceItem.himetricToPixelX << deviceItem.himetricToPixelY << "offset" << deviceItem.pixelOffsetX << deviceItem.pixelOffsetY << "orientation" << deviceItem.deviceOrientation; #endif } else if (deviceItem.himetricToPixelX != oldDeviceItem.himetricToPixelX || deviceItem.himetricToPixelY != oldDeviceItem.himetricToPixelY || deviceItem.pixelOffsetX != oldDeviceItem.pixelOffsetX || deviceItem.pixelOffsetY != oldDeviceItem.pixelOffsetY || deviceItem.deviceOrientation != oldDeviceItem.deviceOrientation) { #ifdef KRITA dbgTablet << "Updated pen device" << deviceHandle << "with displayRect" << displayRect << "and deviceRect" << pointerDeviceRect << "scale" << deviceItem.himetricToPixelX << deviceItem.himetricToPixelY << "offset" << deviceItem.pixelOffsetX << deviceItem.pixelOffsetY << "orientation" << deviceItem.deviceOrientation; #endif } return true; } bool registerOrUpdateDevice(HANDLE deviceHandle) { RECT pointerDeviceRect, displayRect; if (!api.GetPointerDeviceRects(deviceHandle, &pointerDeviceRect, &displayRect)) { #ifdef KRITA dbgTablet << "GetPointerDeviceRects failed"; #endif return false; } POINTER_DEVICE_INFO pointerDeviceInfo; if (!api.GetPointerDevice(deviceHandle, &pointerDeviceInfo)) { #ifdef KRITA dbgTablet << "GetPointerDevice failed"; #endif return false; } return registerOrUpdateDevice(deviceHandle, pointerDeviceRect, displayRect, static_cast<DISPLAYCONFIG_ROTATION>( pointerDeviceInfo.displayOrientation)); } QTabletEvent makeProximityTabletEvent(const QEvent::Type eventType, const POINTER_PEN_INFO &penInfo) { PenFlagsWrapper penFlags = PenFlagsWrapper::fromPenInfo(penInfo); QTabletEvent::PointerType pointerType = penFlags.isInverted() ? QTabletEvent::Eraser : QTabletEvent::Pen; const QPointF emptyPoint; return QTabletEvent( eventType, // type emptyPoint, // pos emptyPoint, // globalPos QTabletEvent::Stylus, // device pointerType, // pointerType 0, // pressure 0, // xTilt 0, // yTilt 0, // tangentialPressure 0, // rotation 0, // z Qt::NoModifier, // keyState reinterpret_cast<qint64>(penInfo.pointerInfo.sourceDevice), // uniqueID Qt::NoButton, // button (Qt::MouseButtons)0 // buttons ); } // void rotateTiltAngles(int &tiltX, int &tiltY, const DISPLAYCONFIG_ROTATION // orientation) { // int newTiltX, newTiltY; // switch (orientation) { // case DISPLAYCONFIG_ROTATION_ROTATE90: // newTiltX = -tiltY; // newTiltY = tiltX; // break; // case DISPLAYCONFIG_ROTATION_ROTATE180: // newTiltX = -tiltX; // newTiltY = -tiltY; // break; // case DISPLAYCONFIG_ROTATION_ROTATE270: // newTiltX = tiltY; // newTiltY = -tiltX; // break; // case DISPLAYCONFIG_ROTATION_IDENTITY: // default: // newTiltX = tiltX; // newTiltY = tiltY; // break; // } // tiltX = newTiltX; // tiltY = newTiltY; // } QTabletEvent makePositionalTabletEvent(const QWidget *targetWidget, const QEvent::Type eventType, const POINTER_PEN_INFO &penInfo, const PointerDeviceItem &deviceItem, const PenPointerItem &penPointerItem) { PenFlagsWrapper penFlags = PenFlagsWrapper::fromPenInfo(penInfo); PointerFlagsWrapper pointerFlags = PointerFlagsWrapper::fromPenInfo(penInfo); PenMaskWrapper penMask = PenMaskWrapper::fromPenInfo(penInfo); const QPointF globalPosF((deviceItem.himetricToPixelX * penInfo.pointerInfo.ptHimetricLocationRaw.x + deviceItem.pixelOffsetX) * penPointerItem.oneOverDpr, (deviceItem.himetricToPixelY * penInfo.pointerInfo.ptHimetricLocationRaw.y + deviceItem.pixelOffsetY) * penPointerItem.oneOverDpr); const QPoint globalPos = globalPosF.toPoint(); const QPoint localPos = targetWidget->mapFromGlobal(globalPos); const QPointF delta = globalPosF - globalPos; const QPointF localPosF = localPos + delta; const QTabletEvent::PointerType pointerType = penFlags.isInverted() ? QTabletEvent::Eraser : QTabletEvent::Pen; Qt::MouseButton mouseButton; if (eventType == QEvent::TabletPress) { if (penInfo.pointerInfo.ButtonChangeType == POINTER_CHANGE_SECONDBUTTON_DOWN) { mouseButton = Qt::RightButton; } else { #ifdef KRITA KIS_SAFE_ASSERT_RECOVER(penInfo.pointerInfo.ButtonChangeType == POINTER_CHANGE_FIRSTBUTTON_DOWN) { #else if (!(penInfo.pointerInfo.ButtonChangeType == POINTER_CHANGE_FIRSTBUTTON_DOWN)) { #endif qWarning() << "WM_POINTER* sent unknown ButtonChangeType" << penInfo.pointerInfo.ButtonChangeType; } mouseButton = Qt::LeftButton; } } else if (eventType == QEvent::TabletRelease) { if (penInfo.pointerInfo.ButtonChangeType == POINTER_CHANGE_SECONDBUTTON_UP) { mouseButton = Qt::RightButton; } else { #ifdef KRITA KIS_SAFE_ASSERT_RECOVER(penInfo.pointerInfo.ButtonChangeType == POINTER_CHANGE_FIRSTBUTTON_UP) { #else if (!(penInfo.pointerInfo.ButtonChangeType == POINTER_CHANGE_FIRSTBUTTON_UP)) { #endif qWarning() << "WM_POINTER* sent unknown ButtonChangeType" << penInfo.pointerInfo.ButtonChangeType; } mouseButton = Qt::LeftButton; } } else { mouseButton = Qt::NoButton; } Qt::MouseButtons mouseButtons; if (pointerFlags.isFirstButtonDown()) { mouseButtons |= Qt::LeftButton; } if (pointerFlags.isSecondButtonDown()) { mouseButtons |= Qt::RightButton; } int tiltX = 0, tiltY = 0; if (penMask.tiltXValid()) { tiltX = qBound(-60, penInfo.tiltX, 60); } if (penMask.tiltYValid()) { tiltY = qBound(-60, penInfo.tiltY, 60); } // rotateTiltAngles(tiltX, tiltY, deviceItem.deviceOrientation); int rotation = 0; if (penMask.rotationValid()) { rotation = 360 - penInfo.rotation; // Flip direction and convert to signed int if (rotation > 180) { rotation -= 360; } } return QTabletEvent( eventType, // type localPosF, // pos globalPosF, // globalPos QTabletEvent::Stylus, // device pointerType, // pointerType penMask.pressureValid() ? static_cast<qreal>(penInfo.pressure) / 1024 : 0, // pressure tiltX, // xTilt tiltY, // yTilt 0, // tangentialPressure rotation, // rotation 0, // z QApplication::queryKeyboardModifiers(), // keyState reinterpret_cast<qint64>(penInfo.pointerInfo.sourceDevice), // uniqueID mouseButton, // button mouseButtons // buttons ); } bool sendProximityTabletEvent(const QEvent::Type eventType, const POINTER_PEN_INFO &penInfo) { #ifdef KRITA KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE( eventType == QEvent::TabletEnterProximity || eventType == QEvent::TabletLeaveProximity, false); #else if (!(eventType == QEvent::TabletEnterProximity || eventType == QEvent::TabletLeaveProximity)) { return false; } #endif QTabletEvent ev = makeProximityTabletEvent(eventType, penInfo); ev.setAccepted(false); ev.setTimestamp(penInfo.pointerInfo.dwTime); QCoreApplication::sendEvent(qApp, &ev); return ev.isAccepted(); } void synthesizeMouseEvent(const QTabletEvent &ev, const POINTER_PEN_INFO &penInfo) { // Update the cursor position BOOL result = SetCursorPos(penInfo.pointerInfo.ptPixelLocationRaw.x, penInfo.pointerInfo.ptPixelLocationRaw.y); if (!result) { #ifdef KRITA dbgInput << "SetCursorPos failed, err" << GetLastError(); #endif return; } // Send mousebutton down/up events. Windows stores the button state. DWORD inputDataFlags = 0; switch (ev.type()) { case QEvent::TabletPress: switch (ev.button()) { case Qt::LeftButton: inputDataFlags = MOUSEEVENTF_LEFTDOWN; break; case Qt::RightButton: inputDataFlags = MOUSEEVENTF_RIGHTDOWN; break; default: return; } break; case QEvent::TabletRelease: switch (ev.button()) { case Qt::LeftButton: inputDataFlags = MOUSEEVENTF_LEFTUP; break; case Qt::RightButton: inputDataFlags = MOUSEEVENTF_RIGHTUP; break; default: return; } break; case QEvent::TabletMove: default: return; } INPUT inputData = {}; inputData.type = INPUT_MOUSE; inputData.mi.dwFlags = inputDataFlags; inputData.mi.dwExtraInfo = 0xFF515700 | 0x01; // https://msdn.microsoft.com/en-us/library/windows/desktop/ms703320%28v=vs.85%29.aspx UINT result2 = SendInput(1, &inputData, sizeof(inputData)); if (result2 != 1) { #ifdef KRITA dbgInput << "SendInput failed, err" << GetLastError(); #endif return; } } bool sendPositionalTabletEvent(QWidget *target, const QEvent::Type eventType, const POINTER_PEN_INFO &penInfo, const PointerDeviceItem &device, const PenPointerItem &penPointerItem, const bool shouldSynthesizeMouseEvent) { #ifdef KRITA KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(eventType == QEvent::TabletMove || eventType == QEvent::TabletPress || eventType == QEvent::TabletRelease, false); #else if (!(eventType == QEvent::TabletMove || eventType == QEvent::TabletPress || eventType == QEvent::TabletRelease)) { return false; } #endif QTabletEvent ev = makePositionalTabletEvent(target, eventType, penInfo, device, penPointerItem); ev.setAccepted(false); ev.setTimestamp(penInfo.pointerInfo.dwTime); QCoreApplication::sendEvent(target, &ev); if (!shouldSynthesizeMouseEvent) { // For pen update with multiple updates, only the last update should // be used to synthesize a mouse event. return false; } // This is some specialized code to handle synthesizing of mouse events from // the pen events. Issues being: // 1. We must accept the pointer down/up and the intermediate update events // to indicate that we want all the pen pointer events for painting, // otherwise Windows may do weird stuff and skip passing pointer events. // 2. Some Qt and Krita code uses QCursor::pos() which calls GetCursorPos to // get the cursor position. This doesn't work nicely before ver 1709 and // doesn't work at all on ver 1709 if the pen events are handled, so we // need some way to nudge the cursor on the OS level. // It appears that using the same way (as in synthesizeMouseEvent) to nudge // the cursor does work fine for when painting on canvas (which handles // the QTabletEvent), but not for other widgets because it introduces a lag // with mouse move events on move start and immediately after mouse down. // The resolution is to simulate mouse movement with our own code only for // handled pen events, which is what the following code does. if (ev.type() == QEvent::TabletMove && ev.buttons() == Qt::NoButton) { // Let Windows synthesize mouse hover events return false; } if (ev.type() == QEvent::TabletPress && !ev.isAccepted()) { // On pen down event, if the widget doesn't handle the event, let // Windows translate the event to touch, mouse or whatever return false; } if (ev.type() != QEvent::TabletPress && !penPointerItem.widgetAcceptsPenEvent) { // For other events, if the previous pen down event wasn't handled by // the widget, continue to let Windows translate the event return false; } // Otherwise, we synthesize our mouse events synthesizeMouseEvent(ev, penInfo); return true; // and tell Windows that we do want the pen events. } bool handlePenEnterMsg(const POINTER_PEN_INFO &penInfo) { PointerFlagsWrapper pointerFlags = PointerFlagsWrapper::fromPenInfo(penInfo); if (!pointerFlags.isPrimary()) { // Don't handle non-primary pointer messages for now #ifdef KRITA dbgTablet << "Pointer" << penInfo.pointerInfo.pointerId << "of device" << penInfo.pointerInfo.sourceDevice << "is not flagged PRIMARY"; #endif return false; } // Update the device scaling factors here // It doesn't cost much to recalculate anyway // This ensures that the screen resolution changes are reflected // WM_POINTERDEVICECHANGE might be useful for this, but its docs are too // unclear to use registerOrUpdateDevice(penInfo.pointerInfo.sourceDevice); // TODO: Need a way to remove from device registration when devices are // changed // We now only handle one pointer at a time, so just clear the pointer // registration penPointers.clear(); int pointerId = penInfo.pointerInfo.pointerId; PenPointerItem penPointerItem; penPointerItem.hwnd = penInfo.pointerInfo.hwndTarget; penPointerItem.deviceHandle = penInfo.pointerInfo.sourceDevice; penPointerItem.activeWidget = nullptr; penPointerItem.oneOverDpr = 1.0; penPointerItem.widgetIsCaptured = false; penPointerItem.widgetIsIgnored = false; penPointerItem.widgetAcceptsPenEvent = false; // penPointerItem.pointerId = pointerId; penPointers.insert(pointerId, penPointerItem); // primaryPenPointerId = pointerId; // penEnter sendProximityTabletEvent(QEvent::TabletEnterProximity, penInfo); return false; } bool handlePenLeaveMsg(const POINTER_PEN_INFO &penInfo) { if (!penPointers.contains(penInfo.pointerInfo.pointerId)) { #ifdef KRITA dbgTablet << "Pointer" << penInfo.pointerInfo.pointerId << "wasn't being handled"; #endif return false; } if (!penDevices.contains(penInfo.pointerInfo.sourceDevice)) { #ifdef KRITA dbgTablet << "Device is gone from the registration???"; #endif // TODO: re-register device? penPointers.remove(penInfo.pointerInfo.pointerId); return false; } // penLeave sendProximityTabletEvent(QEvent::TabletLeaveProximity, penInfo); penPointers.remove(penInfo.pointerInfo.pointerId); return false; } bool handleSinglePenUpdate(PenPointerItem &penPointerItem, const POINTER_PEN_INFO &penInfo, const PointerDeviceItem &device, const bool shouldSynthesizeMouseEvent) { QWidget *targetWidget; if (penPointerItem.isCaptured()) { if (penPointerItem.widgetIsIgnored) { return false; } targetWidget = penPointerItem.activeWidget; if (!targetWidget) { return false; } } else { QWidget *hwndWidget = QWidget::find(reinterpret_cast<WId>(penInfo.pointerInfo.hwndTarget)); if (!hwndWidget) { #ifdef KRITA dbgTablet << "HWND cannot be mapped to QWidget (what?)"; #endif return false; } { // Check popup / modal widget QWidget *modalWidget = QApplication::activePopupWidget(); if (!modalWidget) { modalWidget = QApplication::activeModalWidget(); } if (modalWidget && modalWidget != hwndWidget && !modalWidget->isAncestorOf(hwndWidget)) { return false; } } { QWindow *topLevelWindow = hwndWidget->windowHandle(); if (topLevelWindow) { penPointerItem.oneOverDpr = 1.0 / topLevelWindow->devicePixelRatio(); } else { penPointerItem.oneOverDpr = 1.0 / qApp->devicePixelRatio(); } } QPoint posInHwndWidget = hwndWidget->mapFromGlobal( QPoint(static_cast<int>(penInfo.pointerInfo.ptPixelLocationRaw.x * penPointerItem.oneOverDpr), static_cast<int>(penInfo.pointerInfo.ptPixelLocationRaw.y * penPointerItem.oneOverDpr))); targetWidget = hwndWidget->childAt(posInHwndWidget); if (!targetWidget) { // dbgTablet << "No childQWidget at cursor position"; targetWidget = hwndWidget; } // penPointerItem.activeWidget = targetWidget; } bool handled = sendPositionalTabletEvent(targetWidget, QEvent::TabletMove, penInfo, device, penPointerItem, shouldSynthesizeMouseEvent); return handled; } bool handlePenUpdateMsg(const POINTER_PEN_INFO &penInfo) { auto currentPointerIt = penPointers.find(penInfo.pointerInfo.pointerId); if (currentPointerIt == penPointers.end()) { // dbgTablet << "Pointer" << penInfo.pointerInfo.pointerId << "wasn't being // handled"; return false; } const auto devIt = penDevices.find(penInfo.pointerInfo.sourceDevice); if (devIt == penDevices.end()) { #ifdef KRITA dbgTablet << "Device not registered???"; #endif return false; } // UINT32 entriesCount = 0; // if (!api.GetPointerPenInfoHistory(penInfo.pointerInfo.pointerId, // &entriesCount, nullptr)) { // dbgTablet << "GetPointerPenInfoHistory (getting count) failed"; // return false; // } UINT32 entriesCount = penInfo.pointerInfo.historyCount; // dbgTablet << "entriesCount:" << entriesCount; bool handled = false; if (entriesCount != 1) { QVector<POINTER_PEN_INFO> penInfoArray(entriesCount); if (!api.GetPointerPenInfoHistory(penInfo.pointerInfo.pointerId, &entriesCount, penInfoArray.data())) { #ifdef KRITA dbgTablet << "GetPointerPenInfoHistory failed"; #endif return false; } bool handled = false; // The returned array is in reverse chronological order const auto rbegin = penInfoArray.rbegin(); const auto rend = penInfoArray.rend(); const auto rlast = rend - 1; // Only synthesize mouse event for the last one for (auto it = rbegin; it != rend; ++it) { handled |= handleSinglePenUpdate( *currentPointerIt, *it, *devIt, it == rlast); // Bitwise OR doesn't short circuit } } else { handled = handleSinglePenUpdate(*currentPointerIt, penInfo, *devIt, true); } return handled; } bool handlePenDownMsg(const POINTER_PEN_INFO &penInfo) { // PointerFlagsWrapper pointerFlags = // PointerFlagsWrapper::fromPenInfo(penInfo); // if (!pointerFlags.isPrimary()) { // // Don't handle non-primary pointer messages for now // return false; // } auto currentPointerIt = penPointers.find(penInfo.pointerInfo.pointerId); if (currentPointerIt == penPointers.end()) { #ifdef KRITA dbgTablet << "Pointer" << penInfo.pointerInfo.pointerId << "wasn't being handled"; #endif return false; } currentPointerIt->hwnd = penInfo.pointerInfo .hwndTarget; // They *should* be the same, but just in case QWidget *hwndWidget = QWidget::find(reinterpret_cast<WId>(penInfo.pointerInfo.hwndTarget)); if (!hwndWidget) { #ifdef KRITA dbgTablet << "HWND cannot be mapped to QWidget (what?)"; #endif return false; } { QWindow *topLevelWindow = hwndWidget->windowHandle(); if (topLevelWindow) { currentPointerIt->oneOverDpr = 1.0 / topLevelWindow->devicePixelRatio(); } else { currentPointerIt->oneOverDpr = 1.0 / qApp->devicePixelRatio(); } } QPoint posInHwndWidget = hwndWidget->mapFromGlobal( QPoint(static_cast<int>(penInfo.pointerInfo.ptPixelLocationRaw.x * currentPointerIt->oneOverDpr), static_cast<int>(penInfo.pointerInfo.ptPixelLocationRaw.y * currentPointerIt->oneOverDpr))); QWidget *targetWidget = hwndWidget->childAt(posInHwndWidget); if (!targetWidget) { #ifdef KRITA dbgTablet << "No childQWidget at cursor position"; #endif targetWidget = hwndWidget; } currentPointerIt->activeWidget = targetWidget; currentPointerIt->widgetIsCaptured = true; // dbgTablet << "QWidget" << targetWidget->windowTitle() << "is capturing // pointer" << penInfo.pointerInfo.pointerId; { // Check popup / modal widget QWidget *modalWidget = QApplication::activePopupWidget(); if (!modalWidget) { modalWidget = QApplication::activeModalWidget(); } if (modalWidget && modalWidget != hwndWidget && !modalWidget->isAncestorOf(hwndWidget)) { currentPointerIt->widgetIsIgnored = true; #ifdef KRITA dbgTablet << "Pointer" << penInfo.pointerInfo.pointerId << "is being captured but will be ignored"; #endif return false; } } // penDown const auto devIt = penDevices.find(penInfo.pointerInfo.sourceDevice); if (devIt == penDevices.end()) { #ifdef KRITA dbgTablet << "Device not registered???"; #endif return false; } bool handled = sendPositionalTabletEvent(targetWidget, QEvent::TabletPress, penInfo, *devIt, *currentPointerIt, true); currentPointerIt->widgetAcceptsPenEvent = handled; if (!handled) { // dbgTablet << "QWidget did not handle tablet down event"; } return handled; } bool handlePenUpMsg(const POINTER_PEN_INFO &penInfo) { auto currentPointerIt = penPointers.find(penInfo.pointerInfo.pointerId); if (currentPointerIt == penPointers.end()) { #ifdef KRITA dbgTablet << "Pointer" << penInfo.pointerInfo.pointerId << "wasn't being handled"; #endif return false; } PenPointerItem &penPointerItem = *currentPointerIt; if (!penPointerItem.isCaptured()) { #ifdef KRITA dbgTablet << "Pointer wasn't captured"; #endif return false; } if (penPointerItem.widgetIsIgnored) { penPointerItem.widgetIsCaptured = false; penPointerItem.widgetIsIgnored = false; return false; } // penUp QWidget *targetWidget = penPointerItem.activeWidget; if (!targetWidget) { #ifdef KRITA dbgTablet << "Previously captured target has been deleted"; #endif penPointerItem.widgetIsCaptured = false; return false; } const auto devIt = penDevices.find(penInfo.pointerInfo.sourceDevice); if (devIt == penDevices.end()) { #ifdef KRITA dbgTablet << "Device not registered???"; #endif return false; } bool handled = sendPositionalTabletEvent(targetWidget, QEvent::TabletRelease, penInfo, *devIt, penPointerItem, true); // dbgTablet << "QWidget" << currentPointerIt->activeWidget->windowTitle() << // "is releasing capture to pointer" << penInfo.pointerInfo.pointerId; penPointerItem.widgetIsCaptured = false; penPointerItem.widgetAcceptsPenEvent = false; return handled; } bool handlePointerMsg(const MSG &msg) { if (!api.isLoaded()) { qWarning() << "Windows 8 Pointer Input API functions not loaded"; return false; } int pointerId = GET_POINTERID_WPARAM(msg.wParam); POINTER_INPUT_TYPE pointerType; if (!api.GetPointerType(pointerId, &pointerType)) { #ifdef KRITA dbgTablet << "GetPointerType failed"; #endif return false; } if (pointerType != PT_PEN) { // dbgTablet << "pointerType" << pointerType << "is not PT_PEN"; return false; } POINTER_PEN_INFO penInfo; if (!api.GetPointerPenInfo(pointerId, &penInfo)) { #ifdef KRITA dbgTablet << "GetPointerPenInfo failed"; #endif return false; } switch (msg.message) { case WM_POINTERDOWN: // dbgTablet << "WM_POINTERDOWN"; break; case WM_POINTERUP: // dbgTablet << "WM_POINTERUP"; break; case WM_POINTERENTER: // dbgTablet << "WM_POINTERENTER"; break; case WM_POINTERLEAVE: // dbgTablet << "WM_POINTERLEAVE"; break; case WM_POINTERUPDATE: // dbgTablet << "WM_POINTERUPDATE"; break; case WM_POINTERCAPTURECHANGED: // dbgTablet << "WM_POINTERCAPTURECHANGED"; break; default: #ifdef KRITA dbgTablet << "I missed this message: " << msg.message; #endif break; } // dbgTablet << " hwnd: " << penInfo.pointerInfo.hwndTarget; // dbgTablet << " msg hwnd: " << msg.hwnd; // dbgTablet << " pointerId: " << pointerId; // dbgTablet << " sourceDevice:" << penInfo.pointerInfo.sourceDevice; // dbgTablet << " pointerFlags:" << penInfo.pointerInfo.pointerFlags; // dbgTablet << " btnChgType: " << penInfo.pointerInfo.ButtonChangeType; // dbgTablet << " penFlags: " << penInfo.penFlags; // dbgTablet << " penMask: " << penInfo.penMask; // dbgTablet << " pressure: " << penInfo.pressure; // dbgTablet << " rotation: " << penInfo.rotation; // dbgTablet << " tiltX: " << penInfo.tiltX; // dbgTablet << " tiltY: " << penInfo.tiltY; // dbgTablet << " ptPixelLocationRaw: " << // penInfo.pointerInfo.ptPixelLocationRaw; // dbgTablet << " ptHimetricLocationRaw:" << // penInfo.pointerInfo.ptHimetricLocationRaw; // RECT pointerDeviceRect, displayRect; // if (!api.GetPointerDeviceRects(penInfo.pointerInfo.sourceDevice, // &pointerDeviceRect, &displayRect)) { // dbgTablet << "GetPointerDeviceRects failed"; // return false; // } // dbgTablet << " pointerDeviceRect:" << pointerDeviceRect; // dbgTablet << " displayRect:" << displayRect; // dbgTablet << " scaled X:" << // static_cast<qreal>(penInfo.pointerInfo.ptHimetricLocationRaw.x) / // (pointerDeviceRect.right - pointerDeviceRect.left) * (displayRect.right - // displayRect.left); // dbgTablet << " scaled Y:" << // static_cast<qreal>(penInfo.pointerInfo.ptHimetricLocationRaw.y) / // (pointerDeviceRect.bottom - pointerDeviceRect.top) * (displayRect.bottom - // displayRect.top); switch (msg.message) { case WM_POINTERDOWN: return handlePenDownMsg(penInfo); case WM_POINTERUP: return handlePenUpMsg(penInfo); case WM_POINTERENTER: return handlePenEnterMsg(penInfo); case WM_POINTERLEAVE: return handlePenLeaveMsg(penInfo); case WM_POINTERUPDATE: return handlePenUpdateMsg(penInfo); case WM_POINTERCAPTURECHANGED: // TODO: Should this event be handled? #ifdef KRITA dbgTablet << "FIXME: WM_POINTERCAPTURECHANGED isn't handled"; #endif break; } return false; } } // namespace #endif // _WIN32
{'repo_name': 'opentoonz/opentoonz', 'stars': '2801', 'repo_language': 'C++', 'file_name': 'CMakeLists.txt', 'mime_type': 'text/plain', 'hash': -4044862753927245742, 'source_dataset': 'data'}
from base import BaseTest import re ecs_version_log = "\"ecs.version\":" ecs_timestamp_log = "\"@timestamp\":" ecs_message_log = "\"message\":" ecs_log_level_log = "\"log.level\":" class TestLogging(BaseTest): def run_beat_with_args(self, msg, logging_args=[], extra_args=[]): self.render_config_template( console={"pretty": "false"} ) proc = self.start_beat(logging_args=logging_args, extra_args=extra_args) self.wait_until(lambda: self.log_contains(msg), max_timeout=2) proc.check_kill_and_wait() def assert_contains_ecs_log(self, logfile=None): assert self.log_contains(ecs_version_log, logfile=logfile) assert self.log_contains(ecs_timestamp_log, logfile=logfile) assert self.log_contains(ecs_message_log, logfile=logfile) assert self.log_contains(ecs_log_level_log, logfile=logfile) def assert_not_contains_ecs_log(self, logfile=None): assert not self.log_contains(ecs_version_log, logfile=logfile) assert not self.log_contains(ecs_timestamp_log, logfile=logfile) assert not self.log_contains(ecs_log_level_log, logfile=logfile) def test_console_default(self): """ logs to console with default format """ self.run_beat_with_args("mockbeat start running", logging_args=["-e"]) self.assert_not_contains_ecs_log() def test_console_ecs(self): """ logs to console with ECS format """ self.run_beat_with_args("mockbeat start running", logging_args=["-e"], extra_args=["-E", "logging.json=true", "-E", "logging.ecs=true"]) self.assert_contains_ecs_log() def test_file_default(self): """ logs to file with default format """ self.run_beat_with_args("Mockbeat is alive!", logging_args=[], extra_args=["-E", "logging.json=true", "-E", "logging.ecs=false"]) self.assert_not_contains_ecs_log(logfile="logs/mockbeat") def test_file_ecs(self): """ logs to file with ECS format """ self.run_beat_with_args("Mockbeat is alive!", extra_args=["-E", "logging.json=true", "-E", "logging.ecs=true"]) self.assert_contains_ecs_log(logfile="logs/mockbeat")
{'repo_name': 'elastic/beats', 'stars': '9014', 'repo_language': 'Go', 'file_name': 'generate.go', 'mime_type': 'text/plain', 'hash': -3235833556030280984, 'source_dataset': 'data'}
import GRT import sys import argparse def main(): ''' GRT Softmax Example This examples demonstrates how to initialize, train, and use the Softmax algorithm for classification. The Softmax classifier is a simple but effective classifier based on logisitic regression that works well on problems that are linearly separable. In this example we create an instance of an Softmax algorithm and then train the algorithm using some pre-recorded training data. The trained Softmax classification model is then used to predict the class label of some test data. This example shows you how to: - Create an initialize the Softmax algorithm - Load some ClassificationData from a file and partition the training data into a training dataset and a test dataset - Train the Softmax algorithm using the training dataset - Test the Softmax algorithm using the test dataset - Manually compute the accuracy of the classifier You should run this example with one argument pointing to the data you want to load. A good dataset to run this example is acc-orientation.grt, which can be found in the GRT data folder. ''' # Parse the data filename from the argument list parser = argparse.ArgumentParser(description='Process some data.') parser.add_argument('filename', help='A data file') args = parser.parse_args() filename = args.filename # Create a new Softmax instance softmax = GRT.Softmax() # Load some training data to train the classifier trainingData = GRT.ClassificationData() if not trainingData.load( filename ): print("Failed to load training data: %s" % filename) sys.exit(1) # Use 20% of the training dataset to create a test dataset testData = trainingData.split( 80 ) # Train the classifier if not softmax.train( trainingData ): print("Failed to train classifier!") sys.exit(1) # Save the model to a file if not softmax.save("SoftmaxModel.grt"): print("Failed to save the classifier model!") sys.exit(1) # Load the model from a file if not softmax.load("SoftmaxModel.grt"): print("Failed to load the classifier model!") sys.exit(1) # Use the test dataset to test the BAG model accuracy = 0.0 for i in range(testData.getNumSamples()): # Get the i'th test sample classLabel = testData.get(i).getClassLabel() inputVector = testData.get(i).getSample() # Perform a prediction using the classifier if not softmax.predict( inputVector ): print("Failed to perform prediction for test sample: %d" % i) sys.exit(1) # Get the predicted class label predictedClassLabel = softmax.getPredictedClassLabel() classLikelihoods = softmax.getClassLikelihoods() classDistances = softmax.getClassDistances() # Update the accuracy if classLabel == predictedClassLabel: accuracy += 1 # Print out the results print("TestSample: %d ClassLabel: %d PredictedClassLabel: %d" % (i, classLabel, predictedClassLabel)) print(" ClassLikelihoods: " + str(classLikelihoods)) print(" ClassDistances: " + str(classDistances)) print("Test Accuracy: %.3f%%" % (accuracy/float(testData.getNumSamples())*100.0)) return 0 if __name__ == '__main__': sys.exit(main())
{'repo_name': 'nickgillian/grt', 'stars': '702', 'repo_language': 'C++', 'file_name': 'gmock-port.h', 'mime_type': 'text/x-c', 'hash': -3500240993127485448, 'source_dataset': 'data'}
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/) // Copyright (c) 2015 Gerhard Zehetbauer // Copyright (c) 2015 Alexander Nimmervoll // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using System.Linq; using System.Threading.Tasks; using CalDavSynchronizer.Contracts; using CalDavSynchronizer.Implementation; using CalDavSynchronizer.Implementation.Events; using CalDavSynchronizer.IntegrationTests.Infrastructure; using CalDavSynchronizer.IntegrationTests.TestBase; using DDay.iCal; using GenSync.Logging; using NUnit.Framework; namespace CalDavSynchronizer.IntegrationTests { class TaskSynchronizerFixture { private TestComponentContainer _testComponentContainer; [OneTimeSetUp] public void OneTimeSetup() { _testComponentContainer = new TestComponentContainer(); } [Test] [TestCase(true)] [TestCase(false)] [Apartment(System.Threading.ApartmentState.STA)] public async Task CreateOutlookEntity_ExceptionOccurs_DoesNotLeaveEmptyEntityInRepository(bool saveAndReload) { var options = _testComponentContainer.TestOptionsFactory.CreateSogoTasks(); var synchronizer = await CreateSynchronizer(options); await synchronizer.ClearEventRepositoriesAndCache(); bool exceptionCatched = false; var exception = new Exception("bla"); try { await synchronizer.Components.OutlookRepository.Create( w => { if(saveAndReload) w.SaveAndReload(); throw exception; }, 0); } catch (Exception x) { if(ReferenceEquals(x, exception)) exceptionCatched = true; } Assert.That(exceptionCatched, Is.EqualTo(true)); Assert.That( (await synchronizer.Outlook.GetAllEntities()).Count(), Is.EqualTo(0)); } private async Task<TaskTestSynchronizer> CreateSynchronizer(Options options) { var synchronizer = new TaskTestSynchronizer(options, _testComponentContainer); await synchronizer.Initialize(); return synchronizer; } } }
{'repo_name': 'aluxnimm/outlookcaldavsynchronizer', 'stars': '490', 'repo_language': 'C#', 'file_name': 'ConflictInitialSyncStateCreationStrategyAWins.cs', 'mime_type': 'text/plain', 'hash': -7155065369822561000, 'source_dataset': 'data'}
package com.airbnb.lottie.parser; import android.graphics.Rect; import com.airbnb.lottie.LottieComposition; import com.airbnb.lottie.LottieImageAsset; import com.airbnb.lottie.model.Font; import com.airbnb.lottie.model.FontCharacter; import com.airbnb.lottie.model.Marker; import com.airbnb.lottie.model.layer.Layer; import com.airbnb.lottie.parser.moshi.JsonReader; import com.airbnb.lottie.utils.Logger; import com.airbnb.lottie.utils.Utils; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import androidx.collection.LongSparseArray; import androidx.collection.SparseArrayCompat; public class LottieCompositionParser { static JsonReader.Options NAMES = JsonReader.Options.of( "w", "h", "ip", "op", "fr", "v", "layers", "assets", "fonts", "chars", "markers"); public static LottieComposition parse(JsonReader reader) throws IOException { float scale = Utils.dpScale(); float startFrame = 0f; float endFrame = 0f; float frameRate = 0f; final LongSparseArray<Layer> layerMap = new LongSparseArray<>(); final List<Layer> layers = new ArrayList<>(); int width = 0; int height = 0; Map<String, List<Layer>> precomps = new HashMap<>(); Map<String, LottieImageAsset> images = new HashMap<>(); Map<String, Font> fonts = new HashMap<>(); List<Marker> markers = new ArrayList<>(); SparseArrayCompat<FontCharacter> characters = new SparseArrayCompat<>(); LottieComposition composition = new LottieComposition(); reader.beginObject(); while (reader.hasNext()) { switch (reader.selectName(NAMES)) { case 0: width = reader.nextInt(); break; case 1: height = reader.nextInt(); break; case 2: startFrame = (float) reader.nextDouble(); break; case 3: endFrame = (float) reader.nextDouble() - 0.01f; break; case 4: frameRate = (float) reader.nextDouble(); break; case 5: String version = reader.nextString(); String[] versions = version.split("\\."); int majorVersion = Integer.parseInt(versions[0]); int minorVersion = Integer.parseInt(versions[1]); int patchVersion = Integer.parseInt(versions[2]); if (!Utils.isAtLeastVersion(majorVersion, minorVersion, patchVersion, 4, 4, 0)) { composition.addWarning("Lottie only supports bodymovin >= 4.4.0"); } break; case 6: parseLayers(reader, composition, layers, layerMap); default: reader.skipValue(); } } int scaledWidth = (int) (width * scale); int scaledHeight = (int) (height * scale); Rect bounds = new Rect(0, 0, scaledWidth, scaledHeight); composition.init(bounds, startFrame, endFrame, frameRate, layers, layerMap, precomps, images, characters, fonts, markers); return composition; } private static void parseLayers(JsonReader reader, LottieComposition composition, List<Layer> layers, LongSparseArray<Layer> layerMap) throws IOException { int imageCount = 0; reader.beginArray(); while (reader.hasNext()) { Layer layer = LayerParser.parse(reader, composition); if (layer.getLayerType() == Layer.LayerType.IMAGE) { imageCount++; } layers.add(layer); layerMap.put(layer.getId(), layer); if (imageCount > 4) { Logger.warning("You have " + imageCount + " images. Lottie should primarily be " + "used with shapes. If you are using Adobe Illustrator, convert the Illustrator layers" + " to shape layers."); } } reader.endArray(); } }
{'repo_name': 'airbnb/lottie-android', 'stars': '29246', 'repo_language': 'Java', 'file_name': 'AndroidManifest.xml', 'mime_type': 'text/plain', 'hash': -6024238337868485816, 'source_dataset': 'data'}
{# /** * Copyright (C) 2020 Xibo Signage Ltd * * Xibo - Digital Signage - http://www.xibo.org.uk * * This file is part of Xibo. * * Xibo is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * Xibo 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Xibo. If not, see <http://www.gnu.org/licenses/>. */ #} {% extends "form-base.twig" %} {% import "forms.twig" as forms %} {% block formTitle %} {% trans "Add Application" %} {% endblock %} {% block formButtons %} {% trans "Cancel" %}, XiboDialogClose() {% trans "Help" %}, XiboHelpRender("{{ help }}") {% trans "Save" %}, $("#applicationFormSubmit").submit() {% endblock %} {% block formHtml %} <div class="row"> <div class="col-md-12"> <form id="applicationFormSubmit" class="XiboForm form-horizontal" method="post" action="{{ url_for("application.add") }}" data-next-form-url="{{ url_for("application.edit.form", {id:':id'}) }}" data-next-form-id-property="key"> {% set title %}{% trans "Application Name" %}{% endset %} {{ forms.input("name", title) }} </form> </div> </div> {% endblock %}
{'repo_name': 'xibosignage/xibo-cms', 'stars': '225', 'repo_language': 'PHP', 'file_name': 'layout-form-retire.twig', 'mime_type': 'text/plain', 'hash': -7334530305926131714, 'source_dataset': 'data'}
// DejaLu // Copyright (c) 2015 Hoa V. DINH. All rights reserved. #import "DJLConversationListPlaceholderView.h" #import "NSImage+DJLColored.h" #import "DJLColoredProgressIndicator.h" #import "DJLDarkMode.h" #import "FBKVOController.h" @implementation DJLConversationListPlaceholderView { NSImage * _noMessagesImage; NSImage * _notLoadedImage; NSImage * _loadingImage; NSImage * _searchingImage; NSImage * _inboxZeroImage; DJLColoredProgressIndicator * _progressIndicator; FBKVOController * _kvoController; } @synthesize kind = _kind; - (id) initWithFrame:(NSRect)frameRect { self = [super initWithFrame:frameRect]; _kind = DJLConversationListPlaceholderKindNone; CGFloat x = (int) (([self bounds].size.width - 32) / 2); _progressIndicator = [[DJLColoredProgressIndicator alloc] initWithFrame:NSMakeRect(x, [self bounds].size.height - 280, 32, 32)]; [_progressIndicator setAutoresizingMask:NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin]; [_progressIndicator setColor:[NSColor colorWithCalibratedWhite:0.5 alpha:1.0]]; [_progressIndicator setHidden:YES]; [self addSubview:_progressIndicator]; return self; } - (void)viewDidMoveToSuperview { [super viewDidMoveToSuperview]; if ([self superview] == nil) { _kvoController = nil; } else { _kvoController = [FBKVOController controllerWithObserver:self]; __weak typeof(self) weakSelf = self; [_kvoController observe:weakSelf keyPath:@"effectiveAppearance" options:0 block:^(id observer, id object, NSDictionary * change) { _noMessagesImage = nil; _notLoadedImage = nil; _loadingImage = nil; _searchingImage = nil; _inboxZeroImage = nil; [weakSelf setNeedsDisplay:YES]; }]; } } - (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; if (_kind == DJLConversationListPlaceholderKindNone) { return; } NSColor * color; NSColor * textColor; if ([DJLDarkMode isDarkModeForView:self]) { color = [NSColor colorWithCalibratedWhite:1.0 alpha:0.3]; textColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.4]; } else { color = [NSColor colorWithCalibratedWhite:0.0 alpha:0.3]; textColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.4]; } //int iconSize = 0; int top = 0; int textTop = 0; NSImage * image = nil; NSString * text = nil; switch (_kind) { case DJLConversationListPlaceholderKindInboxZero: //iconSize = 200; if (_inboxZeroImage == nil) { NSImage * originImage = [NSImage imageNamed:@"DejaLu_InboxZero_128"]; //originImage = [originImage copy]; //[originImage setSize:NSMakeSize(iconSize, iconSize)]; NSImage * img = [originImage djl_imageWithColor:color]; _inboxZeroImage = img; } top = 180; textTop = 370; text = @"No messages"; image = _inboxZeroImage; break; case DJLConversationListPlaceholderKindEmpty: if (_noMessagesImage == nil) { NSImage * originImage = [NSImage imageNamed:@"DejaLu_Empty_128"]; NSImage * img = [originImage djl_imageWithColor:color]; _noMessagesImage = img; } top = 180; textTop = 400; text = @"No messages"; image = _noMessagesImage; break; case DJLConversationListPlaceholderKindLoading: if (_loadingImage == nil) { NSImage * originImage = [NSImage imageNamed:@"DejaLu_GettingEmail_128"]; NSImage * img = [originImage djl_imageWithColor:color]; _loadingImage = img; } top = 180; textTop = 400; text = @""; image = _loadingImage; break; case DJLConversationListPlaceholderKindNotLoaded: if (_notLoadedImage == nil) { NSImage * originImage = [NSImage imageNamed:@"DejaLu_NetworkErrorOff_128"]; NSImage * img = [originImage djl_imageWithColor:color]; _notLoadedImage = img; } top = 180; textTop = 400; text = @"Not loaded"; image = _notLoadedImage; break; case DJLConversationListPlaceholderKindSearching: if (_searchingImage == nil) { NSImage * originImage = [NSImage imageNamed:@"DejaLu_Search_128"]; NSImage * img = [originImage djl_imageWithColor:color]; _searchingImage = img; } top = 180; textTop = 400; text = @"Searching"; image = _searchingImage; break; case DJLConversationListPlaceholderKindNoAccounts: if (_noMessagesImage == nil) { NSImage * originImage = [NSImage imageNamed:@"DejaLu_Empty_128"]; NSImage * img = [originImage djl_imageWithColor:color]; _noMessagesImage = img; } top = 180; textTop = 400; text = @"No accounts"; image = _noMessagesImage; break; default: // Do nothing. break; } NSRect bounds = [self bounds]; NSSize imageSize = [image size]; NSRect rect = NSMakeRect((bounds.size.width - imageSize.width) / 2, bounds.size.height - top, imageSize.width, imageSize.height); rect = NSIntegralRect(rect); [image drawInRect:rect]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setAlignment:NSTextAlignmentCenter]; [text drawInRect:NSMakeRect(0, bounds.size.height - textTop, bounds.size.width, 200) withAttributes:@{NSFontAttributeName: [NSFont boldSystemFontOfSize:18], NSParagraphStyleAttributeName: paragraphStyle, NSForegroundColorAttributeName: textColor}]; } - (void) setKind:(DJLConversationListPlaceholderKind)kind { _kind = kind; [self setNeedsDisplay:YES]; if (_kind == DJLConversationListPlaceholderKindSearching) { [_progressIndicator setHidden:NO]; [_progressIndicator startAnimation:nil]; } else { [_progressIndicator setHidden:YES]; [_progressIndicator stopAnimation:nil]; } } @end
{'repo_name': 'dinhvh/dejalu', 'stars': '574', 'repo_language': 'C++', 'file_name': 'MainMenu.xib', 'mime_type': 'text/xml', 'hash': 9208548762700155812, 'source_dataset': 'data'}
var apiwriter = require('apiwriter'); exports.getContext = function() { return { repositoryId: null, repositoryName: null, projectId: this.getConfig().getProjectId() }; }; var _getProj = function (context) { return { "id": context.projectId, "name": context.projName } } exports.submitRequests = function() { // Create a repository apiwriter.postJson('/git/repositories', function(context, result) { return { "name": "AnotherRepository", "project": _getProj(context) } }, function(context, result) { context.repositoryId = result.responseBody.id; context.repositoryName = result.responseBody.name; } ); // Get details about the new repository apiwriter.getJson('/git/repositories/{repositoryId}'); // apiwriter.getJson('/git/{projectId}/repositories/{repositoryName}'); // Get a list of repositories apiwriter.getJson('/git/repositories'); /*apiwriter.getJson('/git/{projectId}/repositories', function (context, result) { context.projName = result.responseBody.value[0].project.name; });*/ // Update a repository apiwriter.patchJson('/git/repositories/{repositoryId}', function(context, result) { return {"name": "RenamedRepository"} } ); // Delete a repository apiwriter.deleteJson('/git/repositories/{repositoryId}', null); }
{'repo_name': 'MicrosoftDocs/azure-devops-docs', 'stars': '330', 'repo_language': 'Shell', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': -340823382444628292, 'source_dataset': 'data'}
package org.bouncycastle.util.io; import java.io.IOException; import java.io.OutputStream; /** * An output stream which copies anything written into it to another stream. */ public class TeeOutputStream extends OutputStream { private OutputStream output1; private OutputStream output2; /** * Base constructor. * * @param output1 the output stream that is wrapped. * @param output2 a secondary stream that anything written to output1 is also written to. */ public TeeOutputStream(OutputStream output1, OutputStream output2) { this.output1 = output1; this.output2 = output2; } public void write(byte[] buf) throws IOException { this.output1.write(buf); this.output2.write(buf); } public void write(byte[] buf, int off, int len) throws IOException { this.output1.write(buf, off, len); this.output2.write(buf, off, len); } public void write(int b) throws IOException { this.output1.write(b); this.output2.write(b); } public void flush() throws IOException { this.output1.flush(); this.output2.flush(); } public void close() throws IOException { this.output1.close(); this.output2.close(); } }
{'repo_name': 'bcgit/bc-java', 'stars': '1204', 'repo_language': 'Java', 'file_name': 'ecrypt_HC-128.txt', 'mime_type': 'text/plain', 'hash': -604470052992919617, 'source_dataset': 'data'}
/******************************************************************************* * Copyright (c) 2004, 2006 QNX Software Systems and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.debug.core.model; import org.eclipse.debug.core.DebugException; /** * Provides support for enable/disable actions. */ public interface IEnableDisableTarget { /** * Returns whether this object supports enable/disable operations. * * @return whether this object supports enable/disable operations */ boolean canEnableDisable(); /** * Returns whether this object is enabled. * * @return <code>true</code> if this obvject is enabled, * or <code>false</code> otherwise. */ boolean isEnabled(); /** * Enables/disables this object * * @param enabled enablement flag value * @throws DebugException */ void setEnabled(boolean enabled) throws DebugException; }
{'repo_name': 'eclipse-cdt/cdt', 'stars': '129', 'repo_language': 'Java', 'file_name': 'ReferencedProjectsLanguageSettingsProvider.java', 'mime_type': 'text/x-java', 'hash': -8070279288769927705, 'source_dataset': 'data'}
{ "extensionDescription": { "message": "Създаване, промяна и бързо превключване между групи от раздели", "description": "Description of the extension." }, "openSettings": { "message": "Настройки", "description": "Settings context button title" }, "manageGroupsTitle": { "message": "Управление на групите", "description": "Manage groups" }, "setTabIconAsGroupIcon": { "message": "Пиктограмата на раздела е пиктограма на групата", "description": "Set tab icon as group icon" }, "moveTabToGroupDisabledTitle": { "message": "Преместване в друга група", "description": "Move tab to group title" }, "moveTabToGroupMessage": { "message": "Разделът „$tabtitle$“ е преместен в група „$grouptitle$“.\n\nОтваряне на раздела.", "description": "Tab moved popup title", "placeholders": { "grouptitle": { "content": "$1", "example": "Group 2" }, "tabtitle": { "content": "$2", "example": "tab title" } } }, "warning": { "message": "Внимание!", "description": "Warning!" }, "success": { "message": "Успех!", "description": "Success!" }, "ok": { "message": "Добре", "description": "OK button" }, "save": { "message": "Запазване", "description": "Save" }, "delete": { "message": "Изтриване", "description": "Delete" }, "cancel": { "message": "Отказ", "description": "Cancel" }, "searchPlaceholder": { "message": "Търсене", "description": "Search placeholder" }, "invalidRegExpRuleTitle": { "message": "Правилото „$regexp$“ е грешно и ще бъде пропуснато.", "description": "Invalid rule description", "placeholders": { "regexp": { "content": "$1", "example": "googlecom" } } }, "manageGroupViewGrid": { "message": "Решетка", "description": "Grid display" }, "manageGroupViewFreeArrange": { "message": "Свободна подредба (в бъдещо издание)", "description": "Free arrange" }, "closePopupAfterChangeGroup": { "message": "Затваряне на менюто при смяна на група", "description": "Close popup after changing group" }, "showNotificationAfterMoveTab": { "message": "Известие при автоматично преместване на раздел", "description": "Show notification when tab is moved to another group" }, "openManageGroupsInTab": { "message": "Отваряне на „Управление на групите“ в раздел", "description": "Open \"Manage Groups\" in new tab" }, "showConfirmDialogBeforeGroupDelete": { "message": "Потвърждаване при изтриване на група", "description": "Show confirm dialog before group delete" }, "exportAddonSettingsTitle": { "message": "Резервни копия", "description": "Backup your Simple Tab Groups" }, "exportAddonSettingsDescription": { "message": "Създайте резервни копия на групите от раздели, така че да ги възстановите при нужда.", "description": "Export your tab groups into a backup file for safe-keeping, so that you can restore them at a later time if necessary." }, "exportAddonSettingsButton": { "message": "Създаване", "description": "Create backup" }, "includeTabThumbnailsIntoBackup": { "message": "Миниатюри на разделите (увеличава размера на резервното копие)", "description": "Include tab thumbnails in backup (makes backup file size bigger)" }, "importAddonSettingsTitle": { "message": "Възстановяване на групи от резервно копие", "description": "Restore Simple Tab Groups" }, "importAddonSettingsDescription": { "message": "Внесете резервно копие на групите, които да бъдат възстановени.", "description": "Load a backup file containing the tab groups you want to restore." }, "importAddonSettingsButton": { "message": "Възстановяване", "description": "Restore backup" }, "importSettingsOldTabGroupsAddonTitle": { "message": "Възстановяване на „Tab Groups“ от Quicksaver", "description": "Restore Quicksaver's \"Tab Groups\"" }, "importSettingsOldTabGroupsAddonDescription": { "message": "Внесете резервно копие от старата добавка „Tab Groups“.", "description": "Load a backup file old \"Tab Groups\" addon." }, "openGroupAfterChange": { "message": "Отваряне на групата след смяна", "description": "Open group after changing to it" }, "newGroupTitle": { "message": "Група $id$", "description": "group id", "placeholders": { "id": { "content": "$1", "example": "1" } } }, "searchNotFoundTitle": { "message": "Няма резултати за „$search$“", "description": "No results found", "placeholders": { "search": { "content": "$1", "example": "mail" } } }, "sortGroupsAZ": { "message": "Подреждане [А-Я]", "description": "Sort groups [A-Z]" }, "sortGroupsZA": { "message": "Подреждане [Я-А]", "description": "Sort groups [Z-A]" }, "generalTitle": { "message": "Общи", "description": "General" }, "groupSettings": { "message": "Настройки на групата", "description": "Group settings" }, "deleteGroup": { "message": "Изтриване на групата", "description": "Delete group" }, "deleteGroupTitle": { "message": "Изтриване на групата?", "description": "Delete group?" }, "deleteGroupBody": { "message": "Желаете ли групата „$name$“ да бъде изтрита?<br>При изтриване на група разделите и прозорците в нея биват затваряни.", "description": "Delete group?", "placeholders": { "name": { "content": "$1", "example": "Group #4" } } }, "groupTabsCount": { "message": "$count$ раздела", "description": "Group tabs count", "placeholders": { "count": { "content": "$1", "example": "4" } } }, "groupTabsCountActive": { "message": "$active$/$count$ отворени раздела", "description": "Group tabs count active", "placeholders": { "active": { "content": "$1", "example": "2" }, "count": { "content": "$2", "example": "4" } } }, "deleteTab": { "message": "Изтриване на раздел", "description": "Delete tab" }, "createNewTab": { "message": "Нов раздел", "description": "Open new tab" }, "createNewGroup": { "message": "Нова група", "description": "Create new group" }, "goBackButtonTitle": { "message": "Назад", "description": "Go back" }, "goBackToGroupsButtonTitle": { "message": "Списък с групи", "description": "Go back to groups" }, "title": { "message": "Заглавие", "description": "Title" }, "iconColor": { "message": "Цвят на пиктограмата", "description": "Icon color" }, "selectUserGroupIcon": { "message": "Избиране на пиктограма", "description": "Load icon" }, "selectUserGroupIconWarnText": { "message": "Извинете, не може да избирате пиктограма от това меню, но може в прозореца за управление на групите. Желаете ли прозореца за управление на групите да бъде отворен?", "description": "Sorry, you can't load custom icon in this popup, but you can load custom group icon in \"Manage groups\".\nOpen \"Manage groups\"?" }, "setRandomColor": { "message": "Произволен цвят", "description": "Set random color" }, "catchTabContainers": { "message": "Преместване на разделите от групата в изолатори", "description": "Catch and move tabs with containers to this group" }, "regexpForTabsTitle": { "message": "Регулярен израз за улавяне на раздели", "description": "Regular expressions for catch tabs" }, "regexpForTabsPlaceholder": { "message": "Регулярни изрази", "description": "Regular expressions" }, "regexpForTabsHelp": { "message": "Въведете регулярни изрази за адреси от мрежата. При съвпадение разделът автоматично ще бъде премесен в тази група.\nЕдно правило на ред, но може да има неограничен брой правила.\nПримери:\ngithub\\.com/drive4ik/simple-tab-groups - прехваща страниците от хранилището на добавката\nbugzilla\\.mozilla\\.org - прехваща страници от дефектите на Firefox\n(facebook|twitter|youtube)\\.com - прехваща страници от социалните мрежи", "description": "Regular exceptions helper" }, "hotkeysTitle": { "message": "Клавишни комбинации", "description": "Hotkeys" }, "hotkeysDescription": { "message": "Тук се добавят клавишни комбинации.<br>Ограничения:<br>1. Тези клавишни комбинации ще работят само в страници от интернет (http:, https:), а не в служебните (about:) страници на четеца, защото ППИ на WebExtensions не го позволява.<br>2. Някои комбинации няма да работят с всички клавиатурни подредби. Например, комбинацията <code>Ctrl + ~</code>, създадена с актива английска подредба няма да работи ако в момента е активна българската, защото в българската подредба този клавиш има друг код. За да заобиколите този недостатък просто създайте същата комбинация докато е активна българска клавиатурна подредба: <code>Ctrl + Ю</code>.", "description": "Hotkeys description" }, "addHotKeyButton": { "message": "Нова комбинация", "description": "Add hotkey" }, "deleteHotKeyButton": { "message": "Изтриване на комбинацията", "description": "Delete hotkey" }, "hotkeyPlaceholder": { "message": "Натиснете комбинация", "description": "Press key here" }, "selectAction": { "message": "Избиране", "description": "Select action" }, "selectGroup": { "message": "Избор на група", "description": "Select group" }, "hotkeyActionTitleLoadNextGroup": { "message": "Отваряне на следващата група", "description": "Load next group" }, "hotkeyActionTitleLoadPrevGroup": { "message": "Отваряне на предишната група", "description": "Load previous group" }, "hotkeyActionTitleLoadNextUnloadedGroup": { "message": "Отваряне на следващата неотваряна група", "description": "Load next unloaded group" }, "hotkeyActionTitleLoadPrevUnloadedGroup": { "message": "Отваряне на предишната неотваряна група", "description": "Load previous unloaded group" }, "hotkeyActionTitleLoadHistoryNextGroup": { "message": "Отваряне на следващата група от историята", "description": "Load next group from history" }, "hotkeyActionTitleLoadHistoryPrevGroup": { "message": "Отваряне на предишната група от историята", "description": "Load previous group from history" }, "hotkeyActionTitleLoadFirstGroup": { "message": "Отваряне на първата група", "description": "Load first group" }, "hotkeyActionTitleLoadLastGroup": { "message": "Отваряне на последната група", "description": "Load last group" }, "hotkeyActionTitleLoadCustomGroup": { "message": "Отваряне на определена група", "description": "Load custom group" }, "hotkeyActionTitleAddNewGroup": { "message": "Нова група", "description": "Add new group" }, "hotkeyActionTitleDeleteCurrentGroup": { "message": "Изтриване на текущата група", "description": "Delete current group" }, "hotkeyActionTitleOpenManageGroups": { "message": "Отваряне на управлението на групи", "description": "Open manage groups" }, "hotkeyActionTitleMoveActiveTabToCustomGroup": { "message": "Преместване на раздела в определена група", "description": "Move active tab to custom group" }, "hotkeyActionTitleDiscardGroup": { "message": "Освобождаване на памет от разделите в групата", "description": "Hotkey action Discard group" }, "hotkeyActionTitleDiscardOtherGroups": { "message": "Освобождаване на памет от разделите в другите групи", "description": "Hotkey action Discard other groups" }, "hotkeyActionTitleReloadAllTabsInCurrentGroup": { "message": "Презареждане на разделите в групата", "description": "Reload all tabs in current group" }, "whatsWrongMessage": { "message": "Какво се случи?\nИзпратете съобщение на разработчика на електронния адрес за поддръжка като прикачите журнала. В настройките на добавката най-долу има отметка.", "description": "Whats wrong...\nPlease contact with developer by support email with last error logs (exist button at bottom of options)" }, "saveErrorLogsIntoFile": { "message": "Запазване на последните грешки във файл на JSON", "description": "Save last error logs into JSON file" }, "undoRemoveGroupItemTitle": { "message": "Възстановяване на група „$grouptitle$“", "description": "Undelete a group menu title", "placeholders": { "grouptitle": { "content": "$1", "example": "Group 2" } } }, "undoRemoveGroupNotification": { "message": "Натиснете тук, за да спрете изтриването на група „$grouptitle$“", "description": "Click here to cancel the deletion of the group title", "placeholders": { "grouptitle": { "content": "$1", "example": "Group 2" } } }, "isStickyGroupTitle": { "message": "Магнитна група", "description": "Sticky group" }, "isStickyGroupHelp": { "message": "Разделите от тази група няма да бъдат автоматично премествани в друга група", "description": "Tabs in this group will never be automatically moved to another group" }, "iconStyle": { "message": "Пиктограма", "description": "Icon style" }, "discardTabsAfterHide": { "message": "Освобождаване на памет от скритите раздели", "description": "Discard tabs after hide (this will save the RAM)" }, "notPossibleSwitchGroupBecauseSomeTabShareMicrophoneOrCamera": { "message": "Групата не може да бъде променяна, защото един от отворените раздели използва микрофон или камера", "description": "It is not possible to change the group because one of the opened tabs share microphone or camera" }, "foundHiddenUnSyncTabsDescription": { "message": "Скрити несинхронизирани раздели. Изберете раздел, за да го добавите в текущата група/прозорец или изберете", "description": "Found hidden unsynchronized tabs. Click on tab to show it into current group/window or:" }, "actionHiddenUnSyncTabsMoveAllTabsToCurrentGroup": { "message": "Преместване на всички в текущата група/прозорец", "description": "Move all of these tabs into current group/window" }, "actionHiddenUnSyncTabsCreateGroup": { "message": "Създаване на група с всички", "description": "Create new group with all of these tabs" }, "actionHiddenUnSyncTabsCloseAll": { "message": "Затваряне на всички", "description": "Close all of these tabs" }, "updateTabThumbnail": { "message": "Обновяване на миниатюрата на раздела", "description": "Update thumbnail for this tab" }, "notFoundWindowsAddonStoppedWorking": { "message": "Грешка: не са намерени обикновени или поверителни/инкогнито/изскачащи прозорци.\nДобавката е спряла да работи. Рестартирайте мрежовия четец.", "description": "Error: not found any normal not private/incognito/popup windows.\nAddon stopped working. Please, restart browser." }, "ffFailedAndLostDataMessage": { "message": "Firefox се срина и всички групи от раздели са загубени.\nАко имате резервно копие възстановете групите от него.", "description": "FF failed and all the groups were lost.\nIf you have a backup, you can restore data from it" }, "enterDefaultGroupIconViewTypeTitle": { "message": "Пиктограма на нова група", "description": "Icon style for a new group" }, "openGroupInNewWindow": { "message": "Отваряне на групата в прозорец", "description": "Open group in new window" }, "muteTabsWhenGroupCloseAndRestoreWhenOpen": { "message": "Заглушаване на разделите при затваряне на групата", "description": "Mute tabs when group close and restore when open" }, "showTabAfterMovingItIntoThisGroup": { "message": "Отваряне на раздела след автоматично преместване", "description": "Show the tab after auto-moving it into this group" }, "tabMoving": { "message": "Преместване на раздели", "description": "Tab moving" }, "includeTabFavIconsIntoBackup": { "message": "Пиктограми на разделите (увеличава размера на резервното копие)", "description": "Include tab fav-icons in backup (makes backup file size bigger)" }, "groupRemovedByExtension": { "message": "Групата „$group$“ е премахната от разширението „$extension$“", "description": "Group \"$group$\" removed by extension: $extension$", "placeholders": { "group": { "content": "$1", "example": "group title" }, "extension": { "content": "$2", "example": "external extension title" } } }, "clickHereToReloadAddon": { "message": "Грешка, натиснете за презареждане на добавката STG", "description": "Something went wrong, click here to reload STG addon" }, "extendedTabSearch": { "message": "Разширено търсене", "description": "Extended search" }, "movingMultipleTabsText": { "message": "Преместване на $count$ раздела", "description": "Moving $count$ tabs", "placeholders": { "count": { "content": "$1", "example": "7" } } }, "pinnedTabsAreNotSupported": { "message": "Закачени раздели не се поддържат", "description": "Pinned tabs are not supported" }, "thisUrlsAreNotSupported": { "message": "Адресът „$urls$“ не се поддържа", "description": "This urls \"$urls$\" are not supported", "placeholders": { "urls": { "content": "$1", "example": "about:addons, file://..." } } }, "thisTabsCanNotBeHidden": { "message": "Следните раздели не могат да бъдат скрити защото са закачени, използват микрофона, камерата или споделят екрана: „$titles$“", "description": "These tabs can not be hidden because they are pinned, using a microphone, camera or shared screen: \"$titles$\"", "placeholders": { "titles": { "content": "$1", "example": "some titles" } } }, "moveMultipleTabsToGroupMessage": { "message": "$tabscount$ раздела са преместени.\nНатиснете тук, за да посетите първия", "description": "$tabscount$ tabs has been moved.\nClick here to open the first tab", "placeholders": { "tabscount": { "content": "$1", "example": "4" } } }, "autoBackupEnableTitle": { "message": "Автоматични резервни копия", "description": "Enable auto backup" }, "autoBackupCreateEveryTitle": { "message": "На всеки", "description": "Create backup every:" }, "autoBackupIntervalKeyHours": { "message": "час(а)", "description": "hour(s)" }, "autoBackupIntervalKeyDays": { "message": "ден(а)", "description": "day(s)" }, "autoBackupLastBackupTitle": { "message": "Последното копие е от", "description": "Last backup:" }, "enableDarkTheme": { "message": "Тъмна тема", "description": "Enable dark theme" }, "enableDarkThemeNotification": { "message": "За пълна поддръжка на тъмната тема трябва да зададете на свойството<br><code>svg.context-properties.content.enabled</code> стойност <code>true</code> в страницата на <br><code>about:config</code><br><br><a href='https://support.mozilla.org/kb/about-config-editor-firefox'>Как да го направя?</a>", "description": "Fully support the dark theme text" }, "importSettingsPanoramaViewAddonTitle": { "message": "Възстановяване на „Panorama View“ от photodiode", "description": "Restore photodiode's \"Panorama View\"" }, "importSettingsPanoramaViewAddonDescription": { "message": "Внесете резервно копие от добавката „Panorama View“.", "description": "Load a backup file from \"Panorama View\" addon." }, "importSettingsSyncTabGroupsAddonTitle": { "message": "Възстановяване на „Sync Tab Groups“ от Morikko", "description": "Restore Morikko's \"Sync Tab Groups\"" }, "importSettingsSyncTabGroupsAddonDescription": { "message": "Внесете резервно копие от добавката „Sync Tab Groups“.", "description": "Load a backup file from \"Sync Tab Groups\" addon." }, "browseFileTitle": { "message": "Разглеждане…", "description": "Browse..." }, "openBackupFolder": { "message": "Отваряне на папката", "description": "Open backup folder" }, "createNewGroupWhenOpenNewWindow": { "message": "Създаване на група при отваряне на прозорец", "description": "Create a new group when opening a new window" }, "prependGroupTitleToWindowTitle": { "message": "Добавяне на името на групата към името на прозореца", "description": "Prepend group title to window title" }, "allowAccessToBookmarks": { "message": "Разрешаване на достъпа до отметките", "description": "Allow access to bookmarks" }, "openBookmarkInGroup": { "message": "Отваряне в група", "description": "Open bookmark in group" }, "bookmarkNotAllowed": { "message": "Отметката е забранена", "description": "This bookmark is not allowed" }, "openLinkInGroupDisabledTitle": { "message": "Отваряне в група", "description": "Open link in group title" }, "showContextMenuOnTabs": { "message": "Контекстуално меню на разделите", "description": "Show context menu on tabs" }, "showContextMenuOnLinks": { "message": "Контекстуално меню на препратките", "description": "Show context menu on links" }, "groupsCreatedCount": { "message": "Създадени са $groupscount$ групи", "description": "Groups created count", "placeholders": { "groupscount": { "content": "$1", "example": "4" } } }, "noGroupsCreated": { "message": "Не са създадени групи", "description": "No groups created" }, "noAccessToBookmarks": { "message": "Добавката няма достъп до отметките. Разрешете достъпа в настройките на добавката", "description": "You do not have access to bookmarks. Enable it on in addon settings" }, "exportGroupToMainBookmarkFolder": { "message": "Изнасяне на групите в папка „$bookmarkfolder$“ в отметките", "description": "Export groups to '$bookmarkfolder$' bookmark folder", "placeholders": { "bookmarkfolder": { "content": "$1", "example": "STG bookmarks" } } }, "exportGroupToBookmarks": { "message": "Изнасяне на групата в отметките", "description": "Export group to bookmarks" }, "defaultBookmarkFolderLocation": { "message": "Папка от отметките по подразбиране", "description": "Default bookmark folder location" }, "groupExportedToBookmarks": { "message": "Групата „$grouptitle$“ е успешно изнесена в отметките", "description": "Group '$grouptitle$' successfully exported to bookmarks", "placeholders": { "grouptitle": { "content": "$1", "example": "Group title" } } }, "groupWithoutTabs": { "message": "Групата не съдържа раздели", "description": "This group has no tabs" }, "autoBackupGroupsToBookmarks": { "message": "Създаване на резервно копие на групите в отметките", "description": "Auto backup all groups to bookmarks" }, "exportAllGroupsToBookmarks": { "message": "Изнасяне на групите в отметките", "description": "Export all groups to bookmarks" }, "allGroupsExportedToBookmarks": { "message": "Всички групи са успешно изнесени в отметките", "description": "All groups successfully exported to bookmarks" }, "discardTabTitle": { "message": "Освобождаване на памет от раздела", "description": "Discard tab" }, "autoBackupGroupsToFile": { "message": "Автоматични резервни копия на групите във файл (в папката за изтегляния)", "description": "Auto backup all groups to file (into downloads folder)" }, "folderNameTitle": { "message": "Име на папката", "description": "Folder name title" }, "backupSuccessfullyRestored": { "message": "Резервното копие е възстановено!", "description": "Backup successfully restored" }, "loading": { "message": "Зареждане, моля изчакайте…", "description": "Loading, please wait..." }, "showOtherTabs": { "message": "Показване на другите раздели", "description": "Show other tabs" }, "dontDiscardTabsAfterHideThisGroup": { "message": "Без освобождаване на памет от разделите в групата след смяната ѝ", "description": "Don't discard tabs into this group after hide" }, "showNotificationAfterGroupDelete": { "message": "Показване на известие след изтриване на група", "description": "Show notification after group delete" }, "reloadTab": { "message": "Презареждане на раздела", "description": "Reload tab" }, "thisTabIsNotSupported": { "message": "Този раздел не се поддържа", "description": "This tab is not supported" }, "showExtendGroupsPopupWithActiveTabs": { "message": "Показване на броя отворени раздели в менюто", "description": "Show active tabs in groups popup" }, "reloadAllTabsInGroup": { "message": "Презареждане на разделите в групата", "description": "Reload all tabs in group" }, "tabsCreatedCount": { "message": "$tabscount$ раздела създадени", "description": "Tabs created count", "placeholders": { "tabscount": { "content": "$1", "example": "4" } } }, "tabsNotCreated": { "message": "Не са създадени раздели", "description": "Tabs not created" }, "showTabsWithThumbnailsInManageGroups": { "message": "Представяне на сайтовете с миниатюри в страницата „Управление на групите“", "description": "Show tabs with thumbnails in \"Manage groups\" page" }, "alwaysOpenTabsInContainer": { "message": "Новите разделите се отварят в изолатор", "description": "Always open tabs in container" }, "temporaryContainerTitle": { "message": "⌚Временен изолатор", "description": "⌚Temporary Container" }, "thisContainerIsNotTemporary": { "message": "Изолаторът „$containerName$“ вече не е временен", "description": "This container '$containerName$' is no longer temporary", "placeholders": { "containerName": { "content": "$1", "example": "my container" } } }, "thisContainerNowIsTemporary": { "message": "Изолаторът „$containerName$“ вече е временен", "description": "This container '$containerName$' has now become temporary", "placeholders": { "containerName": { "content": "$1", "example": "⌚Temporary Container 5" } } }, "importAddonSettings": { "message": "Внасяне на настройки", "description": "Import addon settings" }, "importGroups": { "message": "Внасяне на групи", "description": "Import groups" }, "pinnedTabs": { "message": "Закачени раздели", "description": "Pinned tabs" }, "eraseAddonSettingsWarningTitle": { "message": "Това действие ще <b>ЗАЛИЧИ НАПЪЛНО</b> текущите групи и настройки на добавката!<br>Разделите ще останат непокътнати.", "description": "This action will <b>FULL ERASE</b> all existing settings and groups!<br>Tabs will not be affected." }, "clear": { "message": "Изчистване", "description": "Clear" }, "deleteAllAddonDataAndSettings": { "message": "Изтриване на данните и настройките на добавката", "description": "Delete all addon data and settings" }, "warningAllDataWillRemove": { "message": "Внимание! ВСИЧКИ данни на добавката ще бъдат заличени. Сигурни ли сте?", "description": "Warning! Removing ALL addon data! Are you really sure?" }, "ifDifferentContainerReOpen": { "message": "Ако текущия изолатор е различен от избрания, тогава да бъде подменен", "description": "If the container is different from the selected one - change the container" }, "deleteAllAddonDataAndSettingsBeforeRestoringBackup": { "message": "Изтриване на всички данни и настройки на добавката преди възстановяване", "description": "Delete all addon data and settings before restoring backup" }, "helpPageWelcomeV4Title": { "message": "Добре дошли при Simple Tab Groups издание 4", "description": "Welcome to Simple Tab Groups v4" }, "helpPageWelcomeV4Description": { "message": "Моля, отметнете „Възстановяване на предишната сесия“ в настройките на четеца.<br>Това е необходимо, за да бъде запазена връзката между групите и разделите<br>В противен случай при отваряне на четеца разделите няма да бъдат заредени<br>и ще бъдат недостъпни за добавката и ще спре да работи.", "description": "Please enable \"Restore previous session\" in browser settings.<br>This is necessary to maintain communication between the group and the tab, <br>otherwise the tabs will not open when the browser starts and will be lost from the addon -<br>the addon will stop working." }, "helpPageDisableIncognitoTitle": { "message": "Добре дошли при Simple Tab Groups издание 4", "description": "Welcome to Simple Tab Groups v4" }, "helpPageDisableIncognitoDescription": { "message": "Моля, забранете достъпа на добавката до поверителни прозорци:", "description": "Please disable add-on access to private mode in windows:" }, "enableDebugTitle": { "message": "Включване на режим DEBUG", "description": "Enable DEBUG" }, "loggingIsEnabledTitle": { "message": "записване в журнал", "description": "logging is enabled" }, "loggingIsAutoEnabledTitle": { "message": "автоматично записване в журнал поради грешка в добавката", "description": "logging was auto-enabled due to an error in addon" }, "loggingDescription": { "message": "Моля, отметнете полето само ако трябва да пресъздадете грешка и да изпратите журнала на автора. Отмятането на това поле ще доведе до чувствително намаляване на производителността на добавката, тъй като всички нейни действия се отразяват в журнала. След като успешно пресъздадете грешката махнете отметката и добавката ще ви предложи да запазите журнала във файл. В случай на грешка добавката сама може да отметне това поле. В този случай трябва да махнете отметката и пак да запазите журнала във файл.<br>Моля, изпратете този файл по имейл на <a href=\"mailto:drive4ik+stg@protonmail.com\">drive4ik+stg@protonmail.com</a><br><span class=\"has-text-danger\">Внимание! Журналът не съдържа лична информация като пароли, отметки и т.н.</span><br>Той е необходим за пресъздаване на проблема и неговото отстраняване от автора.<br>Поздрави!", "description": "logging description" }, "archiveGroup": { "message": "Архивиране", "description": "Archive" }, "unArchiveGroup": { "message": "Разархивиране", "description": "Unarchive" }, "groupIsArchived": { "message": "Действието не може да бъде изпълнено, защото групата „$grouptitle$“ е архивирана.", "description": "Unable to complete the action, the group is in the archive", "placeholders": { "grouptitle": { "content": "$1", "example": "Group title" } } }, "updateAddonToLatestVersion": { "message": "Моля, обновете добавката до последното ѝ издание.", "description": "Please, update addon to latest version" }, "hotkeyActionTitleRenameGroup": { "message": "Преименуване на група", "description": "Rename group" }, "noGroupsAvailable": { "message": "Няма групи", "description": "You have no groups" }, "alwaysAskNewGroupName": { "message": "Питане за име при създаване на група", "description": "Always ask for a new group name" }, "impossibleToAskUserAboutAction": { "message": "Невъзможно е да бъде питано за „$action$“ на страница „$page$“\n\nНаучете повече", "description": "On page \"$page$\" it is impossible to ask about \"$action$\"", "placeholders": { "page": { "content": "$1", "example": "Add-ons for Firefox" }, "action": { "content": "$2", "example": "some action" } } }, "openPopupTitle": { "message": "Отваря изскачащия прозорец", "description": "Open popup" }, "openSidebarTitle": { "message": "Отваря страничната лента", "description": "Open sidebar" }, "helpPageOpenInContainerTitle": { "message": "Адресът не може да бъде отворен в изолатор", "description": "Can't open URL in container" }, "helpPageOpenInContainerMainTitle": { "message": "Адресът не може да бъде отворен в изолатор <container-name>$containerName$</container-name>", "description": "Can't open the URL into Personal container", "placeholders": { "containerName": { "content": "$1", "example": "Personal" } } }, "helpPageOpenInContainerSubTitle": { "message": "добавката не може да отвори адрес:", "description": "addon can't open URL:" }, "helpPageOpenInContainerDesc1": { "message": "Групата <strong>$groupTitle$</strong> е настроена да отваря раздели в изолатор <container-name>$containerName$</container-name>", "description": "Group 'Group 1' was assigned to open tabs in Personal container.", "placeholders": { "groupTitle": { "content": "$1", "example": "Group 1" }, "containerName": { "content": "$2", "example": "Personal" } } }, "helpPageOpenInContainerDesc2": { "message": "Друга добавка с UUID:", "description": "Another addon, which has UUID:" }, "helpPageOpenInContainerDesc3": { "message": "опитва да да отвори същия адрес в изолатор <container-name>$containerName$</container-name>. Или преместете раздела в друга група, или забранете на добавката <strong>$uuid$</strong> да извършва това действие.", "description": "tries to open this URL in Business container. Move the tab to another group or forbid the addon '757eaba7-0b3d-478b-ace2-cbe0a16eed47' to perform this action.", "placeholders": { "containerName": { "content": "$1", "example": "Business" }, "uuid": { "content": "$2", "example": "757eaba7-0b3d-478b-ace2-cbe0a16eed47" } } }, "helpPageOpenInContainerDesc4": { "message": "Можете да видите добавките и техните UUID на:", "description": "You can find out the addon by UUID on the page:" }, "helpPageOpenInContainerOpenInContainer": { "message": "Отваря в изолатор <container-name>$containerName$</container-name>", "description": "Open in Personal container", "placeholders": { "containerName": { "content": "$1", "example": "Personal" } } } }
{'repo_name': 'Drive4ik/simple-tab-groups', 'stars': '403', 'repo_language': 'HTML', 'file_name': 'messages.json', 'mime_type': 'text/plain', 'hash': -683344825564042021, 'source_dataset': 'data'}
// This file was procedurally generated from the following sources: // - src/class-elements/grammar-privatename-identifier-semantics-stringvalue.case // - src/class-elements/productions/cls-decl-new-no-sc-line-method.template /*--- description: PrivateName Static Semantics, StringValue (field definitions followed by a method in a new line without a semicolon) esid: prod-FieldDefinition features: [class-fields-private, class, class-fields-public] flags: [generated] includes: [propertyHelper.js] info: | ClassElement : MethodDefinition static MethodDefinition FieldDefinition ; ; FieldDefinition : ClassElementName Initializer _opt ClassElementName : PropertyName PrivateName PrivateName :: # IdentifierName IdentifierName :: IdentifierStart IdentifierName IdentifierPart IdentifierStart :: UnicodeIDStart $ _ \ UnicodeEscapeSequence IdentifierPart:: UnicodeIDContinue $ \ UnicodeEscapeSequence <ZWNJ> <ZWJ> UnicodeIDStart:: any Unicode code point with the Unicode property "ID_Start" UnicodeIDContinue:: any Unicode code point with the Unicode property "ID_Continue" NOTE 3 The sets of code points with Unicode properties "ID_Start" and "ID_Continue" include, respectively, the code points with Unicode properties "Other_ID_Start" and "Other_ID_Continue". 1. Return the String value consisting of the sequence of code units corresponding to PrivateName. In determining the sequence any occurrences of \ UnicodeEscapeSequence are first replaced with the code point represented by the UnicodeEscapeSequence and then the code points of the entire PrivateName are converted to code units by UTF16Encoding (10.1.1) each code point. ---*/ class C { #\u{6F}; #\u2118; #ZW_\u200C_NJ; #ZW_\u200D_J; m() { return 42; } o(value) { this.#o = value; return this.#o; } ℘(value) { this.#℘ = value; return this.#℘; } ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS METHOD this.#ZW_‌_NJ = value; return this.#ZW_‌_NJ; } ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS METHOD this.#ZW_‍_J = value; return this.#ZW_‍_J; } } var c = new C(); assert.sameValue(c.m(), 42); assert.sameValue(c.m, C.prototype.m); assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); verifyProperty(C.prototype, "m", { enumerable: false, configurable: true, writable: true, }); assert.sameValue(c.o(1), 1); assert.sameValue(c.℘(1), 1); assert.sameValue(c.ZW_‌_NJ(1), 1); assert.sameValue(c.ZW_‍_J(1), 1);
{'repo_name': 'tc39/test262', 'stars': '1439', 'repo_language': 'JavaScript', 'file_name': 'S11.8.4_A3.2_T1.1.js', 'mime_type': 'text/plain', 'hash': 7956976686322586153, 'source_dataset': 'data'}
/* PoorMan.cpp * * Philip Harrison * Started: 4/25/2004 * Version: 0.1 */ //#include <stdio.h> #include "PoorManApplication.h" int main() { PoorManApplication webServer; webServer.Run(); //printf("webServer: %p", &webServer); //printf("be_app: %p", be_app); return 0; }
{'repo_name': 'haiku/haiku', 'stars': '971', 'repo_language': 'C++', 'file_name': 'bootstrap', 'mime_type': 'text/plain', 'hash': 4830658477573274422, 'source_dataset': 'data'}
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memcpy_72b.cpp Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml Template File: sources-sink-72b.tmpl.cpp */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointer to the bad buffer * GoodSource: Set data pointer to the good buffer * Sinks: memcpy * BadSink : Copy string to data using memcpy * Flow Variant: 72 Data flow: data passed in a vector from one function to another in different source files * * */ #include "std_testcase.h" #include <vector> #include <wchar.h> using namespace std; namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_memcpy_72 { #ifndef OMITBAD void badSink(vector<char *> dataVector) { /* copy data out of dataVector */ char * data = dataVector[2]; { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */ memcpy(data, source, 100*sizeof(char)); data[100-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void goodG2BSink(vector<char *> dataVector) { char * data = dataVector[2]; { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */ memcpy(data, source, 100*sizeof(char)); data[100-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); } } #endif /* OMITGOOD */ } /* close namespace */
{'repo_name': 'CGCL-codes/VulDeePecker', 'stars': '105', 'repo_language': 'C', 'file_name': 'CWE124_Buffer_Underwrite__char_alloca_ncpy_54a.c', 'mime_type': 'text/x-c', 'hash': 4311236077312716308, 'source_dataset': 'data'}
// // ip/basic_resolver_entry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP #define BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <string> #include <boost/asio/detail/string_view.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace ip { /// An entry produced by a resolver. /** * The boost::asio::ip::basic_resolver_entry class template describes an entry * as returned by a resolver. * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Unsafe. */ template <typename InternetProtocol> class basic_resolver_entry { public: /// The protocol type associated with the endpoint entry. typedef InternetProtocol protocol_type; /// The endpoint type associated with the endpoint entry. typedef typename InternetProtocol::endpoint endpoint_type; /// Default constructor. basic_resolver_entry() { } /// Construct with specified endpoint, host name and service name. basic_resolver_entry(const endpoint_type& ep, BOOST_ASIO_STRING_VIEW_PARAM host, BOOST_ASIO_STRING_VIEW_PARAM service) : endpoint_(ep), host_name_(static_cast<std::string>(host)), service_name_(static_cast<std::string>(service)) { } /// Get the endpoint associated with the entry. endpoint_type endpoint() const { return endpoint_; } /// Convert to the endpoint associated with the entry. operator endpoint_type() const { return endpoint_; } /// Get the host name associated with the entry. std::string host_name() const { return host_name_; } /// Get the host name associated with the entry. template <class Allocator> std::basic_string<char, std::char_traits<char>, Allocator> host_name( const Allocator& alloc = Allocator()) const { return std::basic_string<char, std::char_traits<char>, Allocator>( host_name_.c_str(), alloc); } /// Get the service name associated with the entry. std::string service_name() const { return service_name_; } /// Get the service name associated with the entry. template <class Allocator> std::basic_string<char, std::char_traits<char>, Allocator> service_name( const Allocator& alloc = Allocator()) const { return std::basic_string<char, std::char_traits<char>, Allocator>( service_name_.c_str(), alloc); } private: endpoint_type endpoint_; std::string host_name_; std::string service_name_; }; } // namespace ip } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
{'repo_name': 'GoyaPtyLtd/BaseElements-Plugin', 'stars': '125', 'repo_language': 'C++', 'file_name': 'libturbojpeg.a', 'mime_type': 'text/plain', 'hash': -1644166139892078281, 'source_dataset': 'data'}
/***************************************************************************** * Copyright 2003 - 2009 Broadcom Corporation. All rights reserved. * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2, available at * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a * license other than the GPL, without Broadcom's express prior written * consent. *****************************************************************************/ #ifndef NAND_BCM_UMI_H #define NAND_BCM_UMI_H /* ---- Include Files ---------------------------------------------------- */ #include <mach/reg_umi.h> #include <mach/reg_nand.h> #include <cfg_global.h> /* ---- Constants and Types ---------------------------------------------- */ #if (CFG_GLOBAL_CHIP_FAMILY == CFG_GLOBAL_CHIP_FAMILY_BCMRING) #define NAND_ECC_BCH (CFG_GLOBAL_CHIP_REV > 0xA0) #else #define NAND_ECC_BCH 0 #endif #define CFG_GLOBAL_NAND_ECC_BCH_NUM_BYTES 13 #if NAND_ECC_BCH #ifdef BOOT0_BUILD #define NAND_ECC_NUM_BYTES 13 #else #define NAND_ECC_NUM_BYTES CFG_GLOBAL_NAND_ECC_BCH_NUM_BYTES #endif #else #define NAND_ECC_NUM_BYTES 3 #endif #define NAND_DATA_ACCESS_SIZE 512 /* ---- Variable Externs ------------------------------------------ */ /* ---- Function Prototypes --------------------------------------- */ int nand_bcm_umi_bch_correct_page(uint8_t *datap, uint8_t *readEccData, int numEccBytes); /* Check in device is ready */ static inline int nand_bcm_umi_dev_ready(void) { return REG_UMI_NAND_RCSR & REG_UMI_NAND_RCSR_RDY; } /* Wait until device is ready */ static inline void nand_bcm_umi_wait_till_ready(void) { while (nand_bcm_umi_dev_ready() == 0) ; } /* Enable Hamming ECC */ static inline void nand_bcm_umi_hamming_enable_hwecc(void) { /* disable and reset ECC, 512 byte page */ REG_UMI_NAND_ECC_CSR &= ~(REG_UMI_NAND_ECC_CSR_ECC_ENABLE | REG_UMI_NAND_ECC_CSR_256BYTE); /* enable ECC */ REG_UMI_NAND_ECC_CSR |= REG_UMI_NAND_ECC_CSR_ECC_ENABLE; } #if NAND_ECC_BCH /* BCH ECC specifics */ #define ECC_BITS_PER_CORRECTABLE_BIT 13 /* Enable BCH Read ECC */ static inline void nand_bcm_umi_bch_enable_read_hwecc(void) { /* disable and reset ECC */ REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID; /* Turn on ECC */ REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN; } /* Enable BCH Write ECC */ static inline void nand_bcm_umi_bch_enable_write_hwecc(void) { /* disable and reset ECC */ REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID; /* Turn on ECC */ REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN; } /* Config number of BCH ECC bytes */ static inline void nand_bcm_umi_bch_config_ecc(uint8_t numEccBytes) { uint32_t nValue; uint32_t tValue; uint32_t kValue; uint32_t numBits = numEccBytes * 8; /* disable and reset ECC */ REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID | REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID; /* Every correctible bit requires 13 ECC bits */ tValue = (uint32_t) (numBits / ECC_BITS_PER_CORRECTABLE_BIT); /* Total data in number of bits for generating and computing BCH ECC */ nValue = (NAND_DATA_ACCESS_SIZE + numEccBytes) * 8; /* K parameter is used internally. K = N - (T * 13) */ kValue = nValue - (tValue * ECC_BITS_PER_CORRECTABLE_BIT); /* Write the settings */ REG_UMI_BCH_N = nValue; REG_UMI_BCH_T = tValue; REG_UMI_BCH_K = kValue; } /* Pause during ECC read calculation to skip bytes in OOB */ static inline void nand_bcm_umi_bch_pause_read_ecc_calc(void) { REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN | REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC; } /* Resume during ECC read calculation after skipping bytes in OOB */ static inline void nand_bcm_umi_bch_resume_read_ecc_calc(void) { REG_UMI_BCH_CTRL_STATUS = REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN; } /* Poll read ECC calc to check when hardware completes */ static inline uint32_t nand_bcm_umi_bch_poll_read_ecc_calc(void) { uint32_t regVal; do { /* wait for ECC to be valid */ regVal = REG_UMI_BCH_CTRL_STATUS; } while ((regVal & REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID) == 0); return regVal; } /* Poll write ECC calc to check when hardware completes */ static inline void nand_bcm_umi_bch_poll_write_ecc_calc(void) { /* wait for ECC to be valid */ while ((REG_UMI_BCH_CTRL_STATUS & REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID) == 0) ; } /* Read the OOB and ECC, for kernel write OOB to a buffer */ #if defined(__KERNEL__) && !defined(STANDALONE) static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, uint8_t *eccCalc, int numEccBytes, uint8_t *oobp) #else static inline void nand_bcm_umi_bch_read_oobEcc(uint32_t pageSize, uint8_t *eccCalc, int numEccBytes) #endif { int eccPos = 0; int numToRead = 16; /* There are 16 bytes per sector in the OOB */ /* ECC is already paused when this function is called */ if (pageSize != NAND_DATA_ACCESS_SIZE) { /* skip BI */ #if defined(__KERNEL__) && !defined(STANDALONE) *oobp++ = REG_NAND_DATA8; #else REG_NAND_DATA8; #endif numToRead--; } while (numToRead > numEccBytes) { /* skip free oob region */ #if defined(__KERNEL__) && !defined(STANDALONE) *oobp++ = REG_NAND_DATA8; #else REG_NAND_DATA8; #endif numToRead--; } if (pageSize == NAND_DATA_ACCESS_SIZE) { /* read ECC bytes before BI */ nand_bcm_umi_bch_resume_read_ecc_calc(); while (numToRead > 11) { #if defined(__KERNEL__) && !defined(STANDALONE) *oobp = REG_NAND_DATA8; eccCalc[eccPos++] = *oobp; oobp++; #else eccCalc[eccPos++] = REG_NAND_DATA8; #endif numToRead--; } nand_bcm_umi_bch_pause_read_ecc_calc(); if (numToRead == 11) { /* read BI */ #if defined(__KERNEL__) && !defined(STANDALONE) *oobp++ = REG_NAND_DATA8; #else REG_NAND_DATA8; #endif numToRead--; } } /* read ECC bytes */ nand_bcm_umi_bch_resume_read_ecc_calc(); while (numToRead) { #if defined(__KERNEL__) && !defined(STANDALONE) *oobp = REG_NAND_DATA8; eccCalc[eccPos++] = *oobp; oobp++; #else eccCalc[eccPos++] = REG_NAND_DATA8; #endif numToRead--; } } /* Helper function to write ECC */ static inline void NAND_BCM_UMI_ECC_WRITE(int numEccBytes, int eccBytePos, uint8_t *oobp, uint8_t eccVal) { if (eccBytePos <= numEccBytes) *oobp = eccVal; } /* Write OOB with ECC */ static inline void nand_bcm_umi_bch_write_oobEcc(uint32_t pageSize, uint8_t *oobp, int numEccBytes) { uint32_t eccVal = 0xffffffff; /* wait for write ECC to be valid */ nand_bcm_umi_bch_poll_write_ecc_calc(); /* ** Get the hardware ecc from the 32-bit result registers. ** Read after 512 byte accesses. Format B3B2B1B0 ** where B3 = ecc3, etc. */ if (pageSize == NAND_DATA_ACCESS_SIZE) { /* Now fill in the ECC bytes */ if (numEccBytes >= 13) eccVal = REG_UMI_BCH_WR_ECC_3; /* Usually we skip CM in oob[0,1] */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[0], (eccVal >> 16) & 0xff); NAND_BCM_UMI_ECC_WRITE(numEccBytes, 14, &oobp[1], (eccVal >> 8) & 0xff); /* Write ECC in oob[2,3,4] */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 13, &oobp[2], eccVal & 0xff); /* ECC 12 */ if (numEccBytes >= 9) eccVal = REG_UMI_BCH_WR_ECC_2; NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[3], (eccVal >> 24) & 0xff); /* ECC11 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 11, &oobp[4], (eccVal >> 16) & 0xff); /* ECC10 */ /* Always Skip BI in oob[5] */ } else { /* Always Skip BI in oob[0] */ /* Now fill in the ECC bytes */ if (numEccBytes >= 13) eccVal = REG_UMI_BCH_WR_ECC_3; /* Usually skip CM in oob[1,2] */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 15, &oobp[1], (eccVal >> 16) & 0xff); NAND_BCM_UMI_ECC_WRITE(numEccBytes, 14, &oobp[2], (eccVal >> 8) & 0xff); /* Write ECC in oob[3-15] */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 13, &oobp[3], eccVal & 0xff); /* ECC12 */ if (numEccBytes >= 9) eccVal = REG_UMI_BCH_WR_ECC_2; NAND_BCM_UMI_ECC_WRITE(numEccBytes, 12, &oobp[4], (eccVal >> 24) & 0xff); /* ECC11 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 11, &oobp[5], (eccVal >> 16) & 0xff); /* ECC10 */ } /* Fill in the remainder of ECC locations */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 10, &oobp[6], (eccVal >> 8) & 0xff); /* ECC9 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 9, &oobp[7], eccVal & 0xff); /* ECC8 */ if (numEccBytes >= 5) eccVal = REG_UMI_BCH_WR_ECC_1; NAND_BCM_UMI_ECC_WRITE(numEccBytes, 8, &oobp[8], (eccVal >> 24) & 0xff); /* ECC7 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 7, &oobp[9], (eccVal >> 16) & 0xff); /* ECC6 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 6, &oobp[10], (eccVal >> 8) & 0xff); /* ECC5 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 5, &oobp[11], eccVal & 0xff); /* ECC4 */ if (numEccBytes >= 1) eccVal = REG_UMI_BCH_WR_ECC_0; NAND_BCM_UMI_ECC_WRITE(numEccBytes, 4, &oobp[12], (eccVal >> 24) & 0xff); /* ECC3 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 3, &oobp[13], (eccVal >> 16) & 0xff); /* ECC2 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 2, &oobp[14], (eccVal >> 8) & 0xff); /* ECC1 */ NAND_BCM_UMI_ECC_WRITE(numEccBytes, 1, &oobp[15], eccVal & 0xff); /* ECC0 */ } #endif #endif /* NAND_BCM_UMI_H */
{'repo_name': 'SmartisanTech/SmartisanOS_Kernel_Source', 'stars': '411', 'repo_language': 'C', 'file_name': 'spear310.h', 'mime_type': 'text/x-c', 'hash': 3221594917085187869, 'source_dataset': 'data'}
/* * Copyright (c) 2019, Nordic Semiconductor ASA * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef NRFX_NVMC_H__ #define NRFX_NVMC_H__ #include <nrfx.h> #include <hal/nrf_nvmc.h> #include <hal/nrf_ficr.h> #ifdef __cplusplus extern "C" { #endif /** * @defgroup nrfx_nvmc NVMC driver * @{ * @ingroup nrf_nvmc * @brief Non-Volatile Memory Controller (NVMC) peripheral driver. */ /** * @brief Function for erasing a page in flash. * * This function blocks until the erase operation finishes. * * @note Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @param address Address of the first word in the page to erase. * * @retval NRFX_SUCCESS Page erase complete. * @retval NRFX_ERROR_INVALID_ADDR Address is not aligned to the size of the page. */ nrfx_err_t nrfx_nvmc_page_erase(uint32_t address); /** * @brief Function for erasing the user information configuration register (UICR). * * @note Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @retval NRFX_SUCCESS UICR has been successfully erased. * @retval NRFX_ERROR_NOT_SUPPORTED UICR erase is not supported. */ nrfx_err_t nrfx_nvmc_uicr_erase(void); /** * @brief Function for erasing the whole flash memory. * * @note All user code and UICR will be erased. */ void nrfx_nvmc_all_erase(void); #if defined(NRF_NVMC_PARTIAL_ERASE_PRESENT) /** * @brief Function for initiating a complete page erase split into parts (also known as partial erase). * * This function initiates a partial erase with the specified duration. * To execute each part of the partial erase, use @ref nrfx_nvmc_page_partial_erase_continue. * * @param address Address of the first word in the page to erase. * @param duration_ms Time in milliseconds that each partial erase will take. * * @retval NRFX_SUCCESS Partial erase started. * @retval NRFX_ERROR_INVALID_ADDR Address is not aligned to the size of the page. * * @sa nrfx_nvmc_page_partial_erase_continue() */ nrfx_err_t nrfx_nvmc_page_partial_erase_init(uint32_t address, uint32_t duration_ms); /** * @brief Function for performing a part of the complete page erase (also known as partial erase). * * Each part takes the amount of time specified during the initialization. * This function must be called several times to erase the whole page, once for each erase part. * * @note Using a page that was not completely erased leads to undefined behavior. * Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @retval true Partial erase finished. * @retval false Partial erase not finished. * Call the function again to process the next part. */ bool nrfx_nvmc_page_partial_erase_continue(void); #endif // defined(NRF_NVMC_PARTIAL_ERASE_PRESENT) /** * @brief Function for checking whether a byte is writable at the specified address. * * The NVMC is only able to write '0' to bits in the flash that are erased (set to '1'). * It cannot rewrite a bit back to '1'. This function checks if the value currently * residing at the specified address can be transformed to the desired value * without any '0' to '1' transitions. * * @param address Address to be checked. * @param value Value to be checked. * * @retval true Byte can be written at the specified address. * @retval false Byte cannot be written at the specified address. * Erase the page or change the address. */ bool nrfx_nvmc_byte_writable_check(uint32_t address, uint8_t value); /** * @brief Function for writing a single byte to flash. * * To determine if the flash write has been completed, use @ref nrfx_nvmc_write_done_check(). * * @note Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @param address Address to write to. * @param value Value to write. */ void nrfx_nvmc_byte_write(uint32_t address, uint8_t value); /** * @brief Function for checking whether a word is writable at the specified address. * * The NVMC is only able to write '0' to bits in the Flash that are erased (set to '1'). * It cannot rewrite a bit back to '1'. This function checks if the value currently * residing at the specified address can be transformed to the desired value * without any '0' to '1' transitions. * * @param address Address to be checked. Must be word-aligned. * @param value Value to be checked. * * @retval true Word can be written at the specified address. * @retval false Word cannot be written at the specified address. * Erase page or change address. */ bool nrfx_nvmc_word_writable_check(uint32_t address, uint32_t value); /** * @brief Function for writing a 32-bit word to flash. * * To determine if the flash write has been completed, use @ref nrfx_nvmc_write_done_check(). * * @note Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @param address Address to write to. Must be word-aligned. * @param value Value to write. */ void nrfx_nvmc_word_write(uint32_t address, uint32_t value); /** * @brief Function for writing consecutive bytes to flash. * * To determine if the last flash write has been completed, use @ref nrfx_nvmc_write_done_check(). * * @note Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @param address Address to write to. * @param src Pointer to the data to copy from. * @param num_bytes Number of bytes to write. */ void nrfx_nvmc_bytes_write(uint32_t address, void const * src, uint32_t num_bytes); /** * @brief Function for writing consecutive words to flash. * * To determine if the last flash write has been completed, use @ref nrfx_nvmc_write_done_check(). * * @note Depending on the source of the code being executed, * the CPU may be halted during the operation. * Refer to the Product Specification for more information. * * @param address Address to write to. Must be word-aligned. * @param src Pointer to data to copy from. Must be word-aligned. * @param num_words Number of words to write. */ void nrfx_nvmc_words_write(uint32_t address, void const * src, uint32_t num_words); /** * @brief Function for getting the total flash size in bytes. * * @return Flash total size in bytes. */ uint32_t nrfx_nvmc_flash_size_get(void); /** * @brief Function for getting the flash page size in bytes. * * @return Flash page size in bytes. */ uint32_t nrfx_nvmc_flash_page_size_get(void); /** * @brief Function for getting the flash page count. * * @return Flash page count. */ uint32_t nrfx_nvmc_flash_page_count_get(void); /** * @brief Function for checking if the last flash write has been completed. * * @retval true Last write completed successfully. * @retval false Last write is still in progress. */ __STATIC_INLINE bool nrfx_nvmc_write_done_check(void); #if defined(NRF_NVMC_ICACHE_PRESENT) /** * @brief Function for enabling the Instruction Cache (ICache). * * Enabling ICache reduces the amount of accesses to flash memory, * which can boost performance and lower power consumption. */ __STATIC_INLINE void nrfx_nvmc_icache_enable(void); /** @brief Function for disabling ICache. */ __STATIC_INLINE void nrfx_nvmc_icache_disable(void); #endif // defined(NRF_NVMC_ICACHE_PRESENT) #ifndef SUPPRESS_INLINE_IMPLEMENTATION __STATIC_INLINE bool nrfx_nvmc_write_done_check(void) { return nrf_nvmc_ready_check(NRF_NVMC); } #if defined(NRF_NVMC_ICACHE_PRESENT) __STATIC_INLINE void nrfx_nvmc_icache_enable(void) { nrf_nvmc_icache_config_set(NRF_NVMC, NRF_NVMC_ICACHE_ENABLE_WITH_PROFILING); } __STATIC_INLINE void nrfx_nvmc_icache_disable(void) { nrf_nvmc_icache_config_set(NRF_NVMC, NRF_NVMC_ICACHE_DISABLE); } #endif // defined(NRF_NVMC_ICACHE_PRESENT) #endif // SUPPRESS_INLINE_IMPLEMENTATION /** @} */ #ifdef __cplusplus } #endif #endif // NRF_NVMC_H__
{'repo_name': 'pycom/pycom-micropython-sigfox', 'stars': '149', 'repo_language': 'C', 'file_name': 'perf.h', 'mime_type': 'text/x-c', 'hash': 4945135107337359419, 'source_dataset': 'data'}
geomesa { sfts { "example-csv" = { attributes = [ { name = "fid", type = "Integer", index = false } { name = "name", type = "String", index = true } { name = "age", type = "Integer", index = false } { name = "lastseen", type = "Date", index = false, default = true } { name = "geom", type = "Point", index = true, srid = 4326, default = true } ] } } } geomesa { converters { "example-csv" = { type = "delimited-text" format = "CSV" options { skip-lines = 1 } id-field = "uuid()", fields = [ { name = "fid", transform = "$1::int" } { name = "name", transform = "$2::string" } { name = "age", transform = "$3::int" } { name = "lastseen", transform = "date('yyyy-MM-dd', $4)" } { name = "lon", transform = "$7::double" } { name = "lat", transform = "$8::double" } { name = "geom", transform = "point($lon, $lat)" } ] } } }
{'repo_name': 'locationtech/geomesa', 'stars': '924', 'repo_language': 'Scala', 'file_name': 'LeafletTest.scala', 'mime_type': 'text/plain', 'hash': 1877753812379320472, 'source_dataset': 'data'}
// (C) Copyright John Maddock 2006. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "mp_t.hpp" #include <boost/math/special_functions/gamma.hpp> #include <boost/math/special_functions/erf.hpp> // for inverses #include <boost/math/constants/constants.hpp> #include <fstream> #include <boost/math/tools/test_data.hpp> using namespace boost::math::tools; using namespace std; float external_f; float force_truncate(const float* f) { external_f = *f; return external_f; } float truncate_to_float(mp_t r) { float f = boost::math::tools::real_cast<float>(r); return force_truncate(&f); } struct erf_data_generator { boost::math::tuple<mp_t, mp_t> operator()(mp_t z) { // very naively calculate spots using the gamma function at high precision: int sign = 1; if(z < 0) { sign = -1; z = -z; } mp_t g1, g2; g1 = boost::math::tgamma_lower(mp_t(0.5), z * z); g1 /= sqrt(boost::math::constants::pi<mp_t>()); g1 *= sign; if(z < 0.5) { g2 = 1 - (sign * g1); } else { g2 = boost::math::tgamma(mp_t(0.5), z * z); g2 /= sqrt(boost::math::constants::pi<mp_t>()); } if(sign < 1) g2 = 2 - g2; return boost::math::make_tuple(g1, g2); } }; double double_factorial(int N) { double result = 1; while(N > 2) { N -= 2; result *= N; } return result; } void asymptotic_limit(int Bits) { // // The following block of code estimates how large z has // to be before we can use the asymptotic expansion for // erf/erfc and still get convergence: the series becomes // divergent eventually so we have to be careful! // double result = (std::numeric_limits<double>::max)(); int terms = 0; for(int n = 1; n < 15; ++n) { double lim = (Bits-n) * log(2.0) - log(sqrt(3.14)) + log(double_factorial(2*n+1)); double x = 1; while(x*x + (2*n+1)*log(x) <= lim) x += 0.1; if(x < result) { result = x; terms = n; } } std::cout << "Erf asymptotic limit for " << Bits << " bit numbers is " << result << " after approximately " << terms << " terms." << std::endl; result = (std::numeric_limits<double>::max)(); terms = 0; for(int n = 1; n < 30; ++n) { double x = pow(double_factorial(2*n+1)/pow(2.0, n-Bits), 1 / (2.0*n)); if(x < result) { result = x; terms = n; } } std::cout << "Erfc asymptotic limit for " << Bits << " bit numbers is " << result << " after approximately " << terms << " terms." << std::endl; } boost::math::tuple<mp_t, mp_t> erfc_inv(mp_t r) { mp_t x = exp(-r * r); x = x.convert_to<double>(); std::cout << x << " "; mp_t result = boost::math::erfc_inv(x); std::cout << result << std::endl; return boost::math::make_tuple(x, result); } int main(int argc, char*argv []) { parameter_info<mp_t> arg1; test_data<mp_t> data; bool cont; std::string line; if(argc >= 2) { if(strcmp(argv[1], "--limits") == 0) { asymptotic_limit(24); asymptotic_limit(53); asymptotic_limit(64); asymptotic_limit(106); asymptotic_limit(113); return 0; } else if(strcmp(argv[1], "--erf_inv") == 0) { mp_t (*f)(mp_t); f = boost::math::erf_inv; std::cout << "Welcome.\n" "This program will generate spot tests for the inverse erf function:\n"; std::cout << "Enter the number of data points: "; int points; std::cin >> points; data.insert(f, make_random_param(mp_t(-1), mp_t(1), points)); } else if(strcmp(argv[1], "--erfc_inv") == 0) { boost::math::tuple<mp_t, mp_t> (*f)(mp_t); f = erfc_inv; std::cout << "Welcome.\n" "This program will generate spot tests for the inverse erfc function:\n"; std::cout << "Enter the maximum *result* expected from erfc_inv: "; double max_val; std::cin >> max_val; std::cout << "Enter the number of data points: "; int points; std::cin >> points; parameter_info<mp_t> arg = make_random_param(mp_t(0), mp_t(max_val), points); arg.type |= dummy_param; data.insert(f, arg); } } else { std::cout << "Welcome.\n" "This program will generate spot tests for the erf and erfc functions:\n" " erf(z) and erfc(z)\n\n"; do{ if(0 == get_user_parameter_info(arg1, "a")) return 1; data.insert(erf_data_generator(), arg1); std::cout << "Any more data [y/n]?"; std::getline(std::cin, line); boost::algorithm::trim(line); cont = (line == "y"); }while(cont); } std::cout << "Enter name of test data file [default=erf_data.ipp]"; std::getline(std::cin, line); boost::algorithm::trim(line); if(line == "") line = "erf_data.ipp"; std::ofstream ofs(line.c_str()); ofs << std::scientific << std::setprecision(40); write_code(ofs, data, "erf_data"); return 0; } /* Output for asymptotic limits: Erf asymptotic limit for 24 bit numbers is 2.8 after approximately 6 terms. Erfc asymptotic limit for 24 bit numbers is 4.12064 after approximately 17 terms. Erf asymptotic limit for 53 bit numbers is 4.3 after approximately 11 terms. Erfc asymptotic limit for 53 bit numbers is 6.19035 after approximately 29 terms. Erf asymptotic limit for 64 bit numbers is 4.8 after approximately 12 terms. Erfc asymptotic limit for 64 bit numbers is 7.06004 after approximately 29 terms. Erf asymptotic limit for 106 bit numbers is 6.5 after approximately 14 terms. Erfc asymptotic limit for 106 bit numbers is 11.6626 after approximately 29 terms. Erf asymptotic limit for 113 bit numbers is 6.8 after approximately 14 terms. Erfc asymptotic limit for 113 bit numbers is 12.6802 after approximately 29 terms. */
{'repo_name': 'boostorg/math', 'stars': '143', 'repo_language': 'C++', 'file_name': 'numerical_differentiation.qbk', 'mime_type': 'text/x-c++', 'hash': 7224937724903387150, 'source_dataset': 'data'}
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.design.widget.AppBarLayout android:layout_height="wrap_content" android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay" app:elevation="0dp"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" /> </android.support.design.widget.AppBarLayout> <!--<ListView--> <!--android:id="@+id/lv"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="match_parent"--> <!--app:layout_behavior="@string/appbar_scrolling_view_behavior"--> <!--android:dividerHeight="0dp"/>--> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="16dp" android:src="@drawable/ic_create_white_36dp" /> </android.support.design.widget.CoordinatorLayout>
{'repo_name': 'lcodecorex/ExpandTextView', 'stars': '172', 'repo_language': 'Java', 'file_name': 'ExpandTextView.java', 'mime_type': 'text/x-java', 'hash': -3381931246809478531, 'source_dataset': 'data'}
-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*- -- vim: tabstop=2:shiftwidth=2:noexpandtab -- kate: tab-width 2; replace-tabs off; indent-width 2; -- -- ============================================================================= -- Testbench: Tests global constants, functions and settings -- -- Authors: Patrick Lehmann -- -- Description: -- ------------------------------------ -- TODO -- -- License: -- ============================================================================= -- Copyright 2007-2015 Technische Universitaet Dresden - Germany -- Chair for VLSI-Design, Diagnostics and Architecture -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- ============================================================================= entity strings_tb is end strings_tb; library IEEE; use IEEE.std_logic_1164.all; use IEEE.numeric_std.all; library PoC; use PoC.config.all; use PoC.utils.all; use PoC.strings.all; use PoC.simulation.all; architecture tb of strings_tb is constant raw_format_slv_dec_result0 : STRING := raw_format_slv_dec(STD_LOGIC_VECTOR'(x"12")); constant raw_format_slv_dec_result1 : STRING := raw_format_slv_dec(x"3456"); constant raw_format_slv_dec_result2 : STRING := raw_format_slv_dec(x"12345678"); constant raw_format_slv_dec_result3 : STRING := raw_format_slv_dec(x"A1B2C3D4E5F607A8"); constant str_length_result0 : INTEGER := str_length(""); constant str_length_result1 : INTEGER := str_length((1 to 3 => C_POC_NUL)); constant str_length_result2 : INTEGER := str_length("Hello"); constant str_length_result3 : INTEGER := str_length("Hello" & (1 to 3 => C_POC_NUL)); constant str_match_result0 : BOOLEAN := str_match("", ""); constant str_match_result1 : BOOLEAN := str_match("", (1 to 3 => C_POC_NUL)); constant str_match_result2 : BOOLEAN := str_match("Hello", "hello"); constant str_match_result3 : BOOLEAN := str_match("Hello", "Hello"); constant str_match_result4 : BOOLEAN := str_match("Hello World", "Hello"); constant str_match_result5 : BOOLEAN := str_match("Hello", "Hello World"); constant str_match_result6 : BOOLEAN := str_match("Hello", "Hello" & (1 to 3 => C_POC_NUL)); constant str_imatch_result0 : BOOLEAN := str_imatch("", ""); constant str_imatch_result1 : BOOLEAN := str_imatch("", (1 to 3 => C_POC_NUL)); constant str_imatch_result2 : BOOLEAN := str_imatch("Hello", "hello"); constant str_imatch_result3 : BOOLEAN := str_imatch("Hello", "Hello"); constant str_imatch_result4 : BOOLEAN := str_imatch("Hello World", "Hello"); constant str_imatch_result5 : BOOLEAN := str_imatch("Hello", "Hello World"); constant str_imatch_result6 : BOOLEAN := str_imatch("Hello", "Hello" & (1 to 3 => C_POC_NUL)); begin process begin -- raw_format_slv_dec tests tbAssert((raw_format_slv_dec_result0 = "18"), "raw_format_slv_dec(0x12)=" & raw_format_slv_dec_result0 & " Expected='18'"); tbAssert((raw_format_slv_dec_result1 = "13398"), "raw_format_slv_dec(0x3456)=" & raw_format_slv_dec_result1 & " Expected='13398'"); tbAssert((raw_format_slv_dec_result2 = "305419896"), "raw_format_slv_dec(0x12345678)=" & raw_format_slv_dec_result2 & " Expected='305419896'"); tbAssert((raw_format_slv_dec_result3 = "11651590505119483816"), "raw_format_slv_dec(0xA1b2c3d4e5f607a8)=" & raw_format_slv_dec_result3 & " Expected='11651590505119483816'"); -- str_length tests tbAssert((str_length_result0 = 0), "str_length('')=" & INTEGER'image(str_length_result0) & " Expected=0"); tbAssert((str_length_result1 = 0), "str_length('\0\0\0')=" & INTEGER'image(str_length_result1) & " Expected=0"); tbAssert((str_length_result2 = 5), "str_length('Hello')=" & INTEGER'image(str_length_result2) & " Expected=5"); tbAssert((str_length_result3 = 5), "str_length('Hello\0\0\0')=" & INTEGER'image(str_length_result3) & " Expected=5"); -- str_match tests tbAssert((str_match_result0 = TRUE), "str_match('', '')=" & BOOLEAN'image(str_match_result0) & " Expected=TRUE"); tbAssert((str_match_result1 = TRUE), "str_match('', '\0\0\0')=" & BOOLEAN'image(str_match_result1) & " Expected=TRUE"); tbAssert((str_match_result2 = FALSE), "str_match('Hello', 'hello')=" & BOOLEAN'image(str_match_result2) & " Expected=FALSE"); tbAssert((str_match_result3 = TRUE), "str_match('Hello', 'Hello')=" & BOOLEAN'image(str_match_result3) & " Expected=TRUE"); tbAssert((str_match_result4 = FALSE), "str_match('Hello World', 'Hello')=" & BOOLEAN'image(str_match_result4) & " Expected=FALSE"); tbAssert((str_match_result5 = FALSE), "str_match('Hello', 'Hello World')=" & BOOLEAN'image(str_match_result5) & " Expected=FALSE"); tbAssert((str_match_result6 = TRUE), "str_match('Hello', 'Hello\0\0\0')=" & BOOLEAN'image(str_match_result6) & " Expected=TRUE"); -- str_imatch tests tbAssert((str_imatch_result0 = TRUE), "str_imatch('', '')=" & BOOLEAN'image(str_imatch_result0) & " Expected=TRUE"); tbAssert((str_imatch_result1 = TRUE), "str_imatch('', '\0\0\0')=" & BOOLEAN'image(str_imatch_result1) & " Expected=TRUE"); tbAssert((str_imatch_result2 = TRUE), "str_imatch('Hello', 'hello')=" & BOOLEAN'image(str_imatch_result2) & " Expected=TRUE"); tbAssert((str_imatch_result3 = TRUE), "str_imatch('Hello', 'Hello')=" & BOOLEAN'image(str_imatch_result3) & " Expected=TRUE"); tbAssert((str_imatch_result4 = FALSE), "str_imatch('Hello World', 'Hello')=" & BOOLEAN'image(str_imatch_result4) & " Expected=FALSE"); tbAssert((str_imatch_result5 = FALSE), "str_imatch('Hello', 'Hello World')=" & BOOLEAN'image(str_imatch_result5) & " Expected=FALSE"); tbAssert((str_imatch_result6 = TRUE), "str_imatch('Hello', 'Hello\0\0\0')=" & BOOLEAN'image(str_imatch_result6) & " Expected=TRUE"); -- str_pos tests -- str_ipos tests -- str_find tests -- str_ifind tests -- str_replace tests -- str_substr tests -- str_ltrim tests -- str_rtrim tests -- str_trim tests -- str_toLower tests -- str_toUpper tests -- simulation completed -- Report overall simulation result tbPrintResult; wait; end process; end;
{'repo_name': 'ghdl/ghdl', 'stars': '1042', 'repo_language': 'VHDL', 'file_name': 'Debugging.rst', 'mime_type': 'text/plain', 'hash': -1937771106285606109, 'source_dataset': 'data'}
package com.lmxdawn.api.admin.controller.auth; import com.github.pagehelper.PageInfo; import com.lmxdawn.api.admin.annotation.AuthRuleAnnotation; import com.lmxdawn.api.admin.entity.auth.AuthPermission; import com.lmxdawn.api.admin.entity.auth.AuthPermissionRule; import com.lmxdawn.api.admin.entity.auth.AuthRole; import com.lmxdawn.api.common.enums.ResultEnum; import com.lmxdawn.api.admin.req.auth.AuthRoleAuthRequest; import com.lmxdawn.api.admin.req.auth.AuthRoleQueryRequest; import com.lmxdawn.api.admin.req.auth.AuthRoleSaveRequest; import com.lmxdawn.api.admin.service.auth.AuthPermissionRuleService; import com.lmxdawn.api.admin.service.auth.AuthPermissionService; import com.lmxdawn.api.admin.service.auth.AuthRoleService; import com.lmxdawn.api.admin.util.PermissionRuleTreeUtils; import com.lmxdawn.api.admin.res.PageSimpleResponse; import com.lmxdawn.api.common.res.BaseResponse; import com.lmxdawn.api.admin.res.auth.AuthPermissionRuleMergeResponse; import com.lmxdawn.api.admin.res.auth.AuthRoleResponse; import com.lmxdawn.api.common.util.ResultVOUtils; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 角色相关 */ @RestController public class AuthRoleController { @Resource private AuthRoleService authRoleService; @Resource private AuthPermissionRuleService authPermissionRuleService; @Resource private AuthPermissionService authPermissionService; /** * 角色列表 */ @AuthRuleAnnotation("admin/auth/role/index") @GetMapping("/admin/auth/role/index") public BaseResponse index(@Valid AuthRoleQueryRequest authRoleQueryRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List<AuthRole> authRoleList = authRoleService.listAdminPage(authRoleQueryRequest); List<AuthRoleResponse> authRoleResponseList = authRoleList.stream().map(item -> { AuthRoleResponse authRoleResponse = new AuthRoleResponse(); BeanUtils.copyProperties(item, authRoleResponse); return authRoleResponse; }).collect(Collectors.toList()); PageInfo<AuthRole> pageInfo = new PageInfo<>(authRoleList); PageSimpleResponse<AuthRoleResponse> pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(authRoleResponseList); return ResultVOUtils.success(pageSimpleResponse); } /** * 获取授权列表 * * @param id * @return */ @AuthRuleAnnotation("admin/auth/role/authList") @GetMapping("/admin/auth/role/authList") public BaseResponse authList(@RequestParam("id") Long id) { // 查询当前角色拥有的权限id List<AuthPermission> authPermissionList = authPermissionService.listByRoleId(id); List<Long> checkedKeys = authPermissionList.stream() .map(AuthPermission::getPermissionRuleId) .collect(Collectors.toList()); // 查询所有权限规则 List<AuthPermissionRule> authPermissionRuleList = authPermissionRuleService.listAll(); List<AuthPermissionRuleMergeResponse> merge = PermissionRuleTreeUtils.merge(authPermissionRuleList, 0L); Map<String, Object> restMap = new HashMap<>(); restMap.put("list", merge); restMap.put("checkedKeys", checkedKeys); return ResultVOUtils.success(restMap); } @AuthRuleAnnotation("admin/auth/role/auth") @PostMapping("/admin/auth/role/auth") public BaseResponse auth(@RequestBody @Valid AuthRoleAuthRequest authRoleAuthRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } // 先删除之前的授权 authPermissionService.deleteByRoleId(authRoleAuthRequest.getRoleId()); List<AuthPermission> authPermissionList = authRoleAuthRequest.getAuthRules().stream() .map(aLong -> { AuthPermission authPermission = new AuthPermission(); authPermission.setRoleId(authRoleAuthRequest.getRoleId()); authPermission.setPermissionRuleId(aLong); authPermission.setType("admin"); return authPermission; }).collect(Collectors.toList()); int i = authPermissionService.insertAuthPermissionAll(authPermissionList); return ResultVOUtils.success(); } /** * 新增 * * @param authRoleSaveRequest * @param bindingResult * @return */ @AuthRuleAnnotation("admin/auth/role/save") @PostMapping("/admin/auth/role/save") public BaseResponse save(@RequestBody @Valid AuthRoleSaveRequest authRoleSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } AuthRole byName = authRoleService.findByName(authRoleSaveRequest.getName()); if (byName != null) { return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "当前角色已存在"); } AuthRole authRole = new AuthRole(); BeanUtils.copyProperties(authRoleSaveRequest, authRole); boolean b = authRoleService.insertAuthRole(authRole); if (!b) { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); } Map<String, Long> res = new HashMap<>(); res.put("id", authRole.getId()); return ResultVOUtils.success(res); } /** * 编辑 * * @param authRoleSaveRequest * @param bindingResult * @return */ @AuthRuleAnnotation("admin/auth/role/edit") @PostMapping("/admin/auth/role/edit") public BaseResponse edit(@RequestBody @Valid AuthRoleSaveRequest authRoleSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } if (authRoleSaveRequest.getId() == null) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } // 检查是否存在当前角色 AuthRole byName = authRoleService.findByName(authRoleSaveRequest.getName()); if (byName != null && !authRoleSaveRequest.getId().equals(byName.getId())) { return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "当前角色已存在"); } AuthRole authRole = new AuthRole(); BeanUtils.copyProperties(authRoleSaveRequest, authRole); boolean b = authRoleService.updateAuthRole(authRole); if (!b) { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); } return ResultVOUtils.success(); } /** * 删除 * * @param authRoleSaveRequest * @return */ @AuthRuleAnnotation("admin/auth/role/delete") @PostMapping("/admin/auth/role/delete") public BaseResponse delete(@RequestBody AuthRoleSaveRequest authRoleSaveRequest) { if (authRoleSaveRequest.getId() == null) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } boolean b = authRoleService.deleteById(authRoleSaveRequest.getId()); if (!b) { return ResultVOUtils.error(ResultEnum.NOT_NETWORK); } //TODO 删除角色后先前授权的缓存不会消失 // 再删除之前的授权 authPermissionService.deleteByRoleId(authRoleSaveRequest.getId()); return ResultVOUtils.success(); } }
{'repo_name': 'lmxdawn/vue-admin-java', 'stars': '124', 'repo_language': 'Java', 'file_name': 'vue-admin.sql', 'mime_type': 'text/plain', 'hash': -2705288891583605481, 'source_dataset': 'data'}