text stringlengths 2 1.04M | meta dict |
|---|---|
This template provides code structure and gulp tasks to manage AWS Lambda code for multiple functions.
## Config
Everything is in ./config/
See docs and wiki: https://github.com/lorenwest/node-config
See function2 sources for an example of config usage in a function.
## Gulp
gulp -T
- package:function1
- upload:function1
- deploy:function1
- invoke:function1:1
- invoke:function1:2
- package:function2
- upload:function2
- deploy:function2
- invoke:function2:1
- clean
- package
- deploy
- spec
- spec_no_cc
Any file f in ./spec/fixtures/function/ will result in new gulp task: invoke:function:f. This task invokes function remotely.
Use specs to test functions locally.
## Environment
Use NODE_ENV=qa and NODE_ENV=production env vars to change task environment.
You can change env specific options in config files.
## Specs && Code Coverage
Jasmine and Istanbul are used for testing and code coverage respectively.
## Additional functionality
Feel free to modify ./gulp_tasks/aws_lambda.js to add additional functionality, event sources, SQS queues, etc. | {
"content_hash": "80e6bbec50a98cb60fba879e8847b1ec",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 125,
"avg_line_length": 24.976744186046513,
"alnum_prop": 0.770949720670391,
"repo_name": "x3mka/aws-lambda-template",
"id": "13c9ca9d530593df90abf2ec90a0c2b4f6bc7db3",
"size": "1087",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "12597"
}
],
"symlink_target": ""
} |
import {
Observable,
BehaviorSubject
} from 'rxjs';
import {
RxCollection,
} from './rx-collection';
import {
RxAttachment,
RxAttachmentCreator
} from './rx-attachment';
import { RxDocumentData } from './rx-storage';
import { RxChangeEvent } from './rx-change-event';
import { DeepReadonly, PlainJsonValue } from './util';
import { UpdateQuery } from './plugins/update';
import { CRDTEntry } from './plugins/crdt';
export type RxDocument<RxDocumentType = {}, OrmMethods = {}> = RxDocumentBase<RxDocumentType, OrmMethods> & RxDocumentType & OrmMethods;
declare type AtomicUpdateFunction<RxDocumentType> = (
doc: RxDocumentData<RxDocumentType>,
rxDocument: RxDocument<RxDocumentType>
) => RxDocumentType | Promise<RxDocumentType>;
/**
* Meta data that is attached to each document by RxDB.
*/
export type RxDocumentMeta = {
/**
* Last write time.
* Unix epoch in milliseconds.
*/
lwt: number;
/**
* Any other value can be attached to the _meta data.
* Mostly done by plugins to mark documents.
*/
[k: string]: PlainJsonValue;
};
export declare interface RxDocumentBase<RxDocType, OrmMethods = {}> {
isInstanceOfRxDocument: true;
collection: RxCollection<RxDocType, OrmMethods>;
readonly deleted: boolean;
readonly $: Observable<DeepReadonly<any>>;
readonly deleted$: Observable<boolean>;
readonly primary: string;
readonly allAttachments$: Observable<RxAttachment<RxDocType, OrmMethods>[]>;
// internal things
_dataSync$: BehaviorSubject<DeepReadonly<RxDocType>>;
_data: RxDocumentData<RxDocType>;
primaryPath: string;
revision: string;
_atomicQueue: Promise<any>;
$emit(cE: RxChangeEvent<RxDocType>): void;
_saveData(newData: any, oldData: any): Promise<void>;
// /internal things
get$(path: string): Observable<any>;
get(objPath: string): DeepReadonly<any>;
populate(objPath: string): Promise<RxDocument<RxDocType, OrmMethods> | any | null>;
/**
* mutate the document with a function
*/
atomicUpdate(mutationFunction: AtomicUpdateFunction<RxDocType>, context?: string): Promise<RxDocument<RxDocType, OrmMethods>>;
/**
* patches the given properties
*/
atomicPatch(patch: Partial<RxDocType>): Promise<RxDocument<RxDocType, OrmMethods>>;
update(updateObj: UpdateQuery<RxDocType>): Promise<any>;
updateCRDT(updateObj: CRDTEntry<RxDocType> | CRDTEntry<RxDocType>[]): Promise<any>;
remove(): Promise<boolean>;
_handleChangeEvent(cE: any): void;
// only for temporary documents
set(objPath: string, value: any): RxDocument<RxDocType, OrmMethods>;
save(): Promise<boolean>;
// attachments
putAttachment(
creator: RxAttachmentCreator,
/**
* If set to true and data is equal,
* operation will be skipped.
* This prevents us from upgrading the revision
* and causing events in the change stream.
* (default = true)
*/
skipIfSame?: boolean
): Promise<RxAttachment<RxDocType, OrmMethods>>;
getAttachment(id: string): RxAttachment<RxDocType, OrmMethods> | null;
allAttachments(): RxAttachment<RxDocType, OrmMethods>[];
toJSON(withRevAndAttachments: true): DeepReadonly<RxDocumentData<RxDocType>>;
toJSON(withRevAndAttachments?: false): DeepReadonly<RxDocType>;
toMutableJSON(withRevAndAttachments: true): RxDocumentData<RxDocType>;
toMutableJSON(withRevAndAttachments?: false): RxDocType;
destroy(): void;
}
| {
"content_hash": "07c437b0133020746f802098b0af06a1",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 136,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6897913141567964,
"repo_name": "pubkey/rxdb",
"id": "91a8044bbe6627432934023904081c6bfbe64e42",
"size": "3546",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/types/rx-document.d.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "21859"
},
{
"name": "Dart",
"bytes": "9953"
},
{
"name": "HTML",
"bytes": "39441"
},
{
"name": "JavaScript",
"bytes": "41526"
},
{
"name": "Shell",
"bytes": "502"
},
{
"name": "TypeScript",
"bytes": "2218732"
}
],
"symlink_target": ""
} |
FIXME: description
## Installation
Download from http://example.com/FIXME.
## Usage
FIXME: explanation
$ java -jar day3-0.1.0-standalone.jar [args]
## Options
FIXME: listing of options this app accepts.
## Examples
...
### Bugs
...
### Any Other Sections
### That You Think
### Might be Useful
## License
Copyright © 2017 FIXME
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.
| {
"content_hash": "a0e9140b277aea9731fc5fecb1024446",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 70,
"avg_line_length": 13.235294117647058,
"alnum_prop": 0.6977777777777778,
"repo_name": "Flaeme/adventofcode",
"id": "250da5221ed1f2b5b7a7956d3210f0a09d963083",
"size": "459",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2017/day3/README.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Rust",
"bytes": "6971"
}
],
"symlink_target": ""
} |
scrapy crawl councilman_spider -t csv -o ../../data/councilman.csv | {
"content_hash": "cb5b632e3fc897004262269cdd3ffc69",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 66,
"avg_line_length": 66,
"alnum_prop": 0.7424242424242424,
"repo_name": "novelo-io/atlas",
"id": "4234923113e1c7dd8f2f1b04f3dcd5d9203776f3",
"size": "66",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "atlas/scrapers/councilman/run_scraper.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "97"
},
{
"name": "Jupyter Notebook",
"bytes": "215215"
},
{
"name": "Python",
"bytes": "7277"
},
{
"name": "Roff",
"bytes": "126329"
},
{
"name": "Shell",
"bytes": "114"
}
],
"symlink_target": ""
} |
package org.robolectric.shadows;
import android.bluetooth.BluetoothAdapter;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.TestRunners;
import static org.junit.Assert.*;
import static org.robolectric.Robolectric.shadowOf;
@RunWith(TestRunners.WithDefaults.class)
public class BluetoothAdapterTest {
private BluetoothAdapter bluetoothAdapter;
private ShadowBluetoothAdapter shadowBluetoothAdapter;
@Before
public void setUp() throws Exception {
bluetoothAdapter = Robolectric.newInstanceOf(BluetoothAdapter.class);
shadowBluetoothAdapter = shadowOf(bluetoothAdapter);
}
@Test
public void testAdapterDefaultsDisabled() {
assertFalse(bluetoothAdapter.isEnabled());
}
@Test
public void testAdapterCanBeEnabled() {
shadowBluetoothAdapter.setEnabled(true);
assertTrue(bluetoothAdapter.isEnabled());
}
@Test
public void canGetAndSetAddress() throws Exception {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
shadowOf(adapter).setAddress("expected");
assertEquals("expected", adapter.getAddress());
}
}
| {
"content_hash": "f4f8aeacd3000aaa0b000cee9d3c4fe2",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 29.38095238095238,
"alnum_prop": 0.747163695299838,
"repo_name": "jeffreyzh/robolectric",
"id": "8e90618ad74b4f7f485ab49277f3a62824529380",
"size": "1234",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/test/java/org/robolectric/shadows/BluetoothAdapterTest.java",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/photos/library/v1/photos_library.proto
package com.google.photos.library.v1.proto;
/**
*
*
* <pre>
* Response to successfully joining the shared album on behalf of the user.
* </pre>
*
* Protobuf type {@code google.photos.library.v1.JoinSharedAlbumResponse}
*/
public final class JoinSharedAlbumResponse extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.photos.library.v1.JoinSharedAlbumResponse)
JoinSharedAlbumResponseOrBuilder {
private static final long serialVersionUID = 0L;
// Use JoinSharedAlbumResponse.newBuilder() to construct.
private JoinSharedAlbumResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private JoinSharedAlbumResponse() {}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new JoinSharedAlbumResponse();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
}
private JoinSharedAlbumResponse(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
com.google.photos.types.proto.Album.Builder subBuilder = null;
if (album_ != null) {
subBuilder = album_.toBuilder();
}
album_ =
input.readMessage(
com.google.photos.types.proto.Album.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(album_);
album_ = subBuilder.buildPartial();
}
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.photos.library.v1.proto.LibraryServiceProto
.internal_static_google_photos_library_v1_JoinSharedAlbumResponse_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.photos.library.v1.proto.LibraryServiceProto
.internal_static_google_photos_library_v1_JoinSharedAlbumResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.photos.library.v1.proto.JoinSharedAlbumResponse.class,
com.google.photos.library.v1.proto.JoinSharedAlbumResponse.Builder.class);
}
public static final int ALBUM_FIELD_NUMBER = 1;
private com.google.photos.types.proto.Album album_;
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*
* @return Whether the album field is set.
*/
@java.lang.Override
public boolean hasAlbum() {
return album_ != null;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*
* @return The album.
*/
@java.lang.Override
public com.google.photos.types.proto.Album getAlbum() {
return album_ == null ? com.google.photos.types.proto.Album.getDefaultInstance() : album_;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
@java.lang.Override
public com.google.photos.types.proto.AlbumOrBuilder getAlbumOrBuilder() {
return getAlbum();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (album_ != null) {
output.writeMessage(1, getAlbum());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (album_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getAlbum());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.photos.library.v1.proto.JoinSharedAlbumResponse)) {
return super.equals(obj);
}
com.google.photos.library.v1.proto.JoinSharedAlbumResponse other =
(com.google.photos.library.v1.proto.JoinSharedAlbumResponse) obj;
if (hasAlbum() != other.hasAlbum()) return false;
if (hasAlbum()) {
if (!getAlbum().equals(other.getAlbum())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasAlbum()) {
hash = (37 * hash) + ALBUM_FIELD_NUMBER;
hash = (53 * hash) + getAlbum().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseDelimitedFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(
com.google.photos.library.v1.proto.JoinSharedAlbumResponse prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
* <pre>
* Response to successfully joining the shared album on behalf of the user.
* </pre>
*
* Protobuf type {@code google.photos.library.v1.JoinSharedAlbumResponse}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
implements
// @@protoc_insertion_point(builder_implements:google.photos.library.v1.JoinSharedAlbumResponse)
com.google.photos.library.v1.proto.JoinSharedAlbumResponseOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.photos.library.v1.proto.LibraryServiceProto
.internal_static_google_photos_library_v1_JoinSharedAlbumResponse_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.photos.library.v1.proto.LibraryServiceProto
.internal_static_google_photos_library_v1_JoinSharedAlbumResponse_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.photos.library.v1.proto.JoinSharedAlbumResponse.class,
com.google.photos.library.v1.proto.JoinSharedAlbumResponse.Builder.class);
}
// Construct using com.google.photos.library.v1.proto.JoinSharedAlbumResponse.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (albumBuilder_ == null) {
album_ = null;
} else {
album_ = null;
albumBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.photos.library.v1.proto.LibraryServiceProto
.internal_static_google_photos_library_v1_JoinSharedAlbumResponse_descriptor;
}
@java.lang.Override
public com.google.photos.library.v1.proto.JoinSharedAlbumResponse getDefaultInstanceForType() {
return com.google.photos.library.v1.proto.JoinSharedAlbumResponse.getDefaultInstance();
}
@java.lang.Override
public com.google.photos.library.v1.proto.JoinSharedAlbumResponse build() {
com.google.photos.library.v1.proto.JoinSharedAlbumResponse result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.photos.library.v1.proto.JoinSharedAlbumResponse buildPartial() {
com.google.photos.library.v1.proto.JoinSharedAlbumResponse result =
new com.google.photos.library.v1.proto.JoinSharedAlbumResponse(this);
if (albumBuilder_ == null) {
result.album_ = album_;
} else {
result.album_ = albumBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.photos.library.v1.proto.JoinSharedAlbumResponse) {
return mergeFrom((com.google.photos.library.v1.proto.JoinSharedAlbumResponse) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.photos.library.v1.proto.JoinSharedAlbumResponse other) {
if (other == com.google.photos.library.v1.proto.JoinSharedAlbumResponse.getDefaultInstance())
return this;
if (other.hasAlbum()) {
mergeAlbum(other.getAlbum());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.photos.library.v1.proto.JoinSharedAlbumResponse parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage =
(com.google.photos.library.v1.proto.JoinSharedAlbumResponse) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private com.google.photos.types.proto.Album album_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.photos.types.proto.Album,
com.google.photos.types.proto.Album.Builder,
com.google.photos.types.proto.AlbumOrBuilder>
albumBuilder_;
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*
* @return Whether the album field is set.
*/
public boolean hasAlbum() {
return albumBuilder_ != null || album_ != null;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*
* @return The album.
*/
public com.google.photos.types.proto.Album getAlbum() {
if (albumBuilder_ == null) {
return album_ == null ? com.google.photos.types.proto.Album.getDefaultInstance() : album_;
} else {
return albumBuilder_.getMessage();
}
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
public Builder setAlbum(com.google.photos.types.proto.Album value) {
if (albumBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
album_ = value;
onChanged();
} else {
albumBuilder_.setMessage(value);
}
return this;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
public Builder setAlbum(com.google.photos.types.proto.Album.Builder builderForValue) {
if (albumBuilder_ == null) {
album_ = builderForValue.build();
onChanged();
} else {
albumBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
public Builder mergeAlbum(com.google.photos.types.proto.Album value) {
if (albumBuilder_ == null) {
if (album_ != null) {
album_ =
com.google.photos.types.proto.Album.newBuilder(album_)
.mergeFrom(value)
.buildPartial();
} else {
album_ = value;
}
onChanged();
} else {
albumBuilder_.mergeFrom(value);
}
return this;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
public Builder clearAlbum() {
if (albumBuilder_ == null) {
album_ = null;
onChanged();
} else {
album_ = null;
albumBuilder_ = null;
}
return this;
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
public com.google.photos.types.proto.Album.Builder getAlbumBuilder() {
onChanged();
return getAlbumFieldBuilder().getBuilder();
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
public com.google.photos.types.proto.AlbumOrBuilder getAlbumOrBuilder() {
if (albumBuilder_ != null) {
return albumBuilder_.getMessageOrBuilder();
} else {
return album_ == null ? com.google.photos.types.proto.Album.getDefaultInstance() : album_;
}
}
/**
*
*
* <pre>
* Shared album that the user has joined.
* </pre>
*
* <code>.google.photos.types.Album album = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.photos.types.proto.Album,
com.google.photos.types.proto.Album.Builder,
com.google.photos.types.proto.AlbumOrBuilder>
getAlbumFieldBuilder() {
if (albumBuilder_ == null) {
albumBuilder_ =
new com.google.protobuf.SingleFieldBuilderV3<
com.google.photos.types.proto.Album,
com.google.photos.types.proto.Album.Builder,
com.google.photos.types.proto.AlbumOrBuilder>(
getAlbum(), getParentForChildren(), isClean());
album_ = null;
}
return albumBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.photos.library.v1.JoinSharedAlbumResponse)
}
// @@protoc_insertion_point(class_scope:google.photos.library.v1.JoinSharedAlbumResponse)
private static final com.google.photos.library.v1.proto.JoinSharedAlbumResponse DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.photos.library.v1.proto.JoinSharedAlbumResponse();
}
public static com.google.photos.library.v1.proto.JoinSharedAlbumResponse getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<JoinSharedAlbumResponse> PARSER =
new com.google.protobuf.AbstractParser<JoinSharedAlbumResponse>() {
@java.lang.Override
public JoinSharedAlbumResponse parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new JoinSharedAlbumResponse(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<JoinSharedAlbumResponse> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<JoinSharedAlbumResponse> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.photos.library.v1.proto.JoinSharedAlbumResponse getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| {
"content_hash": "c05b5a60ab88a8d2ac035496c4d12e5b",
"timestamp": "",
"source": "github",
"line_count": 713,
"max_line_length": 102,
"avg_line_length": 32.26788218793829,
"alnum_prop": 0.6693180336419351,
"repo_name": "google/java-photoslibrary",
"id": "955c94bb00b92ce0d9eefd131fc9eadaef273f93",
"size": "23007",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "photoslibraryapi/src/main/java/com/google/photos/library/v1/proto/JoinSharedAlbumResponse.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "514376"
}
],
"symlink_target": ""
} |
package org.elasticsearch.analysis.common;
import org.apache.lucene.analysis.CharArraySet;
import org.apache.lucene.analysis.br.BrazilianAnalyzer;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider;
import org.elasticsearch.index.analysis.Analysis;
public class BrazilianAnalyzerProvider extends AbstractIndexAnalyzerProvider<BrazilianAnalyzer> {
private final BrazilianAnalyzer analyzer;
BrazilianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) {
super(indexSettings, name, settings);
analyzer = new BrazilianAnalyzer(
Analysis.parseStopWords(env, indexSettings.getIndexVersionCreated(), settings, BrazilianAnalyzer.getDefaultStopSet()),
Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET)
);
analyzer.setVersion(version);
}
@Override
public BrazilianAnalyzer get() {
return this.analyzer;
}
}
| {
"content_hash": "488028e3bdf488989f0fdff7ecc717c7",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 130,
"avg_line_length": 36.833333333333336,
"alnum_prop": 0.779185520361991,
"repo_name": "strapdata/elassandra",
"id": "05f72a6c0793fadba938466d7347bee7269d342c",
"size": "1893",
"binary": false,
"copies": "2",
"ref": "refs/heads/v6.8.4-strapdata",
"path": "modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/BrazilianAnalyzerProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "10298"
},
{
"name": "Batchfile",
"bytes": "124"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "383497"
},
{
"name": "HTML",
"bytes": "2186"
},
{
"name": "Java",
"bytes": "54992093"
},
{
"name": "Perl",
"bytes": "12512"
},
{
"name": "PowerShell",
"bytes": "19551"
},
{
"name": "Python",
"bytes": "19852"
},
{
"name": "Shell",
"bytes": "106694"
}
],
"symlink_target": ""
} |
class TGAFile
{
char* buffer;
size_t bufferSize;
std::shared_ptr<unsigned char> imageptr;
#pragma pack(push, 1)
struct TGAHeader
{ //https://en.wikipedia.org/wiki/Truevision_TGA
unsigned char idLength;
unsigned char colorMapType;
unsigned char imageType;
//unsigned char colorMapSpec[5];
unsigned short cms_firstIndex;
unsigned short cms_colorMapLen;
unsigned char cms_colorMapEntrySize;
//unsigned char imageSpec[10];
unsigned short is_xOrigin;
unsigned short is_yOrigin;
unsigned short is_iWidth;
unsigned short is_iHeight;
unsigned char is_iBPP;
unsigned char is_iDesc;
}*tgaHeader; //44 bytes
#pragma pack(pop)
void RotateColorOnly();
void RotateColorOnly2();
void RotateColorAndFlip();
void RotateColor(unsigned int renderer);
public:
void Load(const char* fileName, RENDERER rendererType);
void Set(std::shared_ptr<unsigned char> image, unsigned int w, unsigned int h);
void Save(const char* fileName);
unsigned char* GetPtr()
{
return imageptr.get();
}
unsigned int GetWidth()
{
return tgaHeader->is_iWidth;
}
unsigned int GetHeight()
{
return tgaHeader->is_iHeight;
}
unsigned int GetPixelCount()
{
return GetWidth() * GetHeight();
}
TGAFile() : imageptr(nullptr), buffer(nullptr), tgaHeader(nullptr), bufferSize(0)
{
}
~TGAFile()
{
imageptr.reset();
delete[] buffer;
}
};
| {
"content_hash": "eaf9fe91fe6a5abdeb320f4a80d800b3",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 82,
"avg_line_length": 19.768115942028984,
"alnum_prop": 0.717741935483871,
"repo_name": "zolcsieles/VRTestApp",
"id": "6e20c9faf9e8e1ea4d0652b8d1a5e8dd4abed34e",
"size": "1421",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "VRTestApp/TGAFile.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "393"
},
{
"name": "C",
"bytes": "1789"
},
{
"name": "C++",
"bytes": "271046"
},
{
"name": "GLSL",
"bytes": "1779"
},
{
"name": "HLSL",
"bytes": "1438"
},
{
"name": "PowerShell",
"bytes": "1575"
}
],
"symlink_target": ""
} |
AdGroupRetargetingListOperation is an object that holds target ad group retargeting in mutate methods.
### Service
+ [AdGroupRetargetingListService](../../services/AdGroupRetargetingListService.md)
### Namespace
[AdGroupRetargetingListService#Namespace](../../services/AdGroupRetargetingListService.md#namespace)
| field | type | max<br>Occurs | min<br>Occurs | resp<br>onse | add | set | remove | description |
|---|---|---|---|---|---|---|---|---|
| Operation(inherited)|||||||||
| operator| enum Operator|||||||Available to use: ADD, SET, REMOVE |
| AdGroupRetargetingListOperation|||||||
| accountId| long| 1| 1| -| Req| Req| Req| Account ID.|
| Operand[]| <a href="AdGroupRetargetingList.md">AdGroupRetargetingList</a>| unbounded| 1| -| Req| Req| Req| List of operating ad group user.|
<a rel="license" href="http://creativecommons.org/licenses/by-nd/2.1/jp/"><img alt="クリエイティブ・コモンズ・ライセンス" style="border-width:0" src="https://i.creativecommons.org/l/by-nd/2.1/jp/88x31.png" /></a><br />この 作品 は <a rel="license" href="http://creativecommons.org/licenses/by-nd/2.1/jp/">クリエイティブ・コモンズ 表示 - 改変禁止 2.1 日本 ライセンスの下に提供されています。</a>
| {
"content_hash": "2193a354b5ce81e40dc1b43683837b14",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 333,
"avg_line_length": 66.41176470588235,
"alnum_prop": 0.6997342781222321,
"repo_name": "yahoojp-marketing/sponsored-search-api-documents",
"id": "949641f85009025b81ce816ccbd4e29ab3f42d44",
"size": "1283",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/en/api_reference/data/AdGroupRetargetingList/AdGroupRetargetingListOperation.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
/*jshint strict:false, undef:false, unused:false */
var instances = [];
function getSquireInstance ( doc ) {
var l = instances.length,
instance;
while ( l-- ) {
instance = instances[l];
if ( instance._doc === doc ) {
return instance;
}
}
return null;
}
function mergeObjects ( base, extras ) {
var prop, value;
if ( !base ) {
base = {};
}
for ( prop in extras ) {
value = extras[ prop ];
base[ prop ] = ( value && value.constructor === Object ) ?
mergeObjects( base[ prop ], value ) :
value;
}
return base;
}
function Squire ( doc, config ) {
var win = doc.defaultView;
var body = doc.body;
var mutation;
this._win = win;
this._doc = doc;
this._body = body;
this._events = {};
this._lastSelection = null;
// IE loses selection state of iframe on blur, so make sure we
// cache it just before it loses focus.
if ( losesSelectionOnBlur ) {
this.addEventListener( 'beforedeactivate', this.getSelection );
}
this._hasZWS = false;
this._lastAnchorNode = null;
this._lastFocusNode = null;
this._path = '';
this.addEventListener( 'keyup', this._updatePathOnEvent );
this.addEventListener( 'mouseup', this._updatePathOnEvent );
win.addEventListener( 'focus', this, false );
win.addEventListener( 'blur', this, false );
this._undoIndex = -1;
this._undoStack = [];
this._undoStackLength = 0;
this._isInUndoState = false;
this._ignoreChange = false;
if ( canObserveMutations ) {
mutation = new MutationObserver( this._docWasChanged.bind( this ) );
mutation.observe( body, {
childList: true,
attributes: true,
characterData: true,
subtree: true
});
this._mutation = mutation;
} else {
this.addEventListener( 'keyup', this._keyUpDetectChange );
}
// IE sometimes fires the beforepaste event twice; make sure it is not run
// again before our after paste function is called.
this._awaitingPaste = false;
this.addEventListener( isIElt11 ? 'beforecut' : 'cut', onCut );
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', onPaste );
// Opera does not fire keydown repeatedly.
this.addEventListener( isPresto ? 'keypress' : 'keydown', onKey );
// Add key handlers
this._keyHandlers = Object.create( keyHandlers );
// Override default properties
this.setConfig( config );
// Fix IE<10's buggy implementation of Text#splitText.
// If the split is at the end of the node, it doesn't insert the newly split
// node into the document, and sets its value to undefined rather than ''.
// And even if the split is not at the end, the original node is removed
// from the document and replaced by another, rather than just having its
// data shortened.
// We used to feature test for this, but then found the feature test would
// sometimes pass, but later on the buggy behaviour would still appear.
// I think IE10 does not have the same bug, but it doesn't hurt to replace
// its native fn too and then we don't need yet another UA category.
if ( isIElt11 ) {
win.Text.prototype.splitText = function ( offset ) {
var afterSplit = this.ownerDocument.createTextNode(
this.data.slice( offset ) ),
next = this.nextSibling,
parent = this.parentNode,
toDelete = this.length - offset;
if ( next ) {
parent.insertBefore( afterSplit, next );
} else {
parent.appendChild( afterSplit );
}
if ( toDelete ) {
this.deleteData( offset, toDelete );
}
return afterSplit;
};
}
body.setAttribute( 'contenteditable', 'true' );
// Remove Firefox's built-in controls
try {
doc.execCommand( 'enableObjectResizing', false, 'false' );
doc.execCommand( 'enableInlineTableEditing', false, 'false' );
} catch ( error ) {}
instances.push( this );
// Need to register instance before calling setHTML, so that the fixCursor
// function can lookup any default block tag options set.
this.setHTML( '' );
}
var proto = Squire.prototype;
proto.setConfig = function ( config ) {
config = mergeObjects({
blockTag: 'DIV',
blockAttributes: null,
tagAttributes: {
blockquote: null,
ul: null,
ol: null,
li: null
}
}, config );
// Users may specify block tag in lower case
config.blockTag = config.blockTag.toUpperCase();
this._config = config;
return this;
};
proto.createElement = function ( tag, props, children ) {
return createElement( this._doc, tag, props, children );
};
proto.createDefaultBlock = function ( children ) {
var config = this._config;
return fixCursor(
this.createElement( config.blockTag, config.blockAttributes, children )
);
};
proto.didError = function ( error ) {
console.log( error );
};
proto.getDocument = function () {
return this._doc;
};
// --- Events ---
// Subscribing to these events won't automatically add a listener to the
// document node, since these events are fired in a custom manner by the
// editor code.
var customEvents = {
focus: 1, blur: 1,
pathChange: 1, select: 1, input: 1, undoStateChange: 1
};
proto.fireEvent = function ( type, event ) {
var handlers = this._events[ type ],
l, obj;
if ( handlers ) {
if ( !event ) {
event = {};
}
if ( event.type !== type ) {
event.type = type;
}
// Clone handlers array, so any handlers added/removed do not affect it.
handlers = handlers.slice();
l = handlers.length;
while ( l-- ) {
obj = handlers[l];
try {
if ( obj.handleEvent ) {
obj.handleEvent( event );
} else {
obj.call( this, event );
}
} catch ( error ) {
error.details = 'Squire: fireEvent error. Event type: ' + type;
this.didError( error );
}
}
}
return this;
};
proto.destroy = function () {
var win = this._win,
doc = this._doc,
events = this._events,
type;
win.removeEventListener( 'focus', this, false );
win.removeEventListener( 'blur', this, false );
for ( type in events ) {
if ( !customEvents[ type ] ) {
doc.removeEventListener( type, this, true );
}
}
if ( this._mutation ) {
this._mutation.disconnect();
}
var l = instances.length;
while ( l-- ) {
if ( instances[l] === this ) {
instances.splice( l, 1 );
}
}
};
proto.handleEvent = function ( event ) {
this.fireEvent( event.type, event );
};
proto.addEventListener = function ( type, fn ) {
var handlers = this._events[ type ];
if ( !fn ) {
this.didError({
name: 'Squire: addEventListener with null or undefined fn',
message: 'Event type: ' + type
});
return this;
}
if ( !handlers ) {
handlers = this._events[ type ] = [];
if ( !customEvents[ type ] ) {
this._doc.addEventListener( type, this, true );
}
}
handlers.push( fn );
return this;
};
proto.removeEventListener = function ( type, fn ) {
var handlers = this._events[ type ],
l;
if ( handlers ) {
l = handlers.length;
while ( l-- ) {
if ( handlers[l] === fn ) {
handlers.splice( l, 1 );
}
}
if ( !handlers.length ) {
delete this._events[ type ];
if ( !customEvents[ type ] ) {
this._doc.removeEventListener( type, this, false );
}
}
}
return this;
};
// --- Selection and Path ---
proto._createRange =
function ( range, startOffset, endContainer, endOffset ) {
if ( range instanceof this._win.Range ) {
return range.cloneRange();
}
var domRange = this._doc.createRange();
domRange.setStart( range, startOffset );
if ( endContainer ) {
domRange.setEnd( endContainer, endOffset );
} else {
domRange.setEnd( range, startOffset );
}
return domRange;
};
proto.scrollRangeIntoView = function ( range ) {
// Get the bounding rect
var rect = range.getBoundingClientRect();
var node, parent;
if ( !rect.top ) {
node = this._doc.createElement( 'SPAN' );
range = range.cloneRange();
insertNodeInRange( range, node );
rect = node.getBoundingClientRect();
parent = node.parentNode;
parent.removeChild( node );
parent.normalize();
}
// Then check and scroll
var win = this._win;
var height = win.innerHeight;
var top = rect.top;
if ( top > height ) {
win.scrollBy( 0, top - height + 20 );
}
// And fire event for integrations to use
this.fireEvent( 'scrollPointIntoView', {
x: rect.left,
y: top
});
};
proto._moveCursorTo = function ( toStart ) {
var body = this._body,
range = this._createRange( body, toStart ? 0 : body.childNodes.length );
moveRangeBoundariesDownTree( range );
this.setSelection( range );
return this;
};
proto.moveCursorToStart = function () {
return this._moveCursorTo( true );
};
proto.moveCursorToEnd = function () {
return this._moveCursorTo( false );
};
var getWindowSelection = function ( self ) {
return self._win.getSelection() || null;
};
proto.setSelection = function ( range ) {
if ( range ) {
// iOS bug: if you don't focus the iframe before setting the
// selection, you can end up in a state where you type but the input
// doesn't get directed into the contenteditable area but is instead
// lost in a black hole. Very strange.
if ( isIOS ) {
this._win.focus();
}
var sel = getWindowSelection( this );
if ( sel ) {
sel.removeAllRanges();
sel.addRange( range );
this.scrollRangeIntoView( range );
}
}
return this;
};
proto.getSelection = function () {
var sel = getWindowSelection( this ),
selection, startContainer, endContainer;
if ( sel && sel.rangeCount ) {
selection = sel.getRangeAt( 0 ).cloneRange();
startContainer = selection.startContainer;
endContainer = selection.endContainer;
// FF can return the selection as being inside an <img>. WTF?
if ( startContainer && isLeaf( startContainer ) ) {
selection.setStartBefore( startContainer );
}
if ( endContainer && isLeaf( endContainer ) ) {
selection.setEndBefore( endContainer );
}
this._lastSelection = selection;
} else {
selection = this._lastSelection;
}
if ( !selection ) {
selection = this._createRange( this._body.firstChild, 0 );
}
return selection;
};
proto.getSelectedText = function () {
var range = this.getSelection(),
walker = new TreeWalker(
range.commonAncestorContainer,
SHOW_TEXT|SHOW_ELEMENT,
function ( node ) {
return isNodeContainedInRange( range, node, true );
}
),
startContainer = range.startContainer,
endContainer = range.endContainer,
node = walker.currentNode = startContainer,
textContent = '',
addedTextInBlock = false,
value;
if ( !walker.filter( node ) ) {
node = walker.nextNode();
}
while ( node ) {
if ( node.nodeType === TEXT_NODE ) {
value = node.data;
if ( value && ( /\S/.test( value ) ) ) {
if ( node === endContainer ) {
value = value.slice( 0, range.endOffset );
}
if ( node === startContainer ) {
value = value.slice( range.startOffset );
}
textContent += value;
addedTextInBlock = true;
}
} else if ( node.nodeName === 'BR' ||
addedTextInBlock && !isInline( node ) ) {
textContent += '\n';
addedTextInBlock = false;
}
node = walker.nextNode();
}
return textContent;
};
proto.getPath = function () {
return this._path;
};
// --- Workaround for browsers that can't focus empty text nodes ---
// WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=15256
var removeZWS = function ( root ) {
var walker = new TreeWalker( root, SHOW_TEXT, function () {
return true;
}, false ),
parent, node, index;
while ( node = walker.nextNode() ) {
while ( ( index = node.data.indexOf( ZWS ) ) > -1 ) {
if ( node.length === 1 ) {
do {
parent = node.parentNode;
parent.removeChild( node );
node = parent;
walker.currentNode = parent;
} while ( isInline( node ) && !getLength( node ) );
break;
} else {
node.deleteData( index, 1 );
}
}
}
};
proto._didAddZWS = function () {
this._hasZWS = true;
};
proto._removeZWS = function () {
if ( !this._hasZWS ) {
return;
}
removeZWS( this._body );
this._hasZWS = false;
};
// --- Path change events ---
proto._updatePath = function ( range, force ) {
var anchor = range.startContainer,
focus = range.endContainer,
newPath;
if ( force || anchor !== this._lastAnchorNode ||
focus !== this._lastFocusNode ) {
this._lastAnchorNode = anchor;
this._lastFocusNode = focus;
newPath = ( anchor && focus ) ? ( anchor === focus ) ?
getPath( focus ) : '(selection)' : '';
if ( this._path !== newPath ) {
this._path = newPath;
this.fireEvent( 'pathChange', { path: newPath } );
}
}
if ( !range.collapsed ) {
this.fireEvent( 'select' );
}
};
proto._updatePathOnEvent = function () {
this._updatePath( this.getSelection() );
};
// --- Focus ---
proto.focus = function () {
// FF seems to need the body to be focussed (at least on first load).
// Chrome also now needs body to be focussed in order to show the cursor
// (otherwise it is focussed, but the cursor doesn't appear).
// Opera (Presto-variant) however will lose the selection if you call this!
if ( !isPresto ) {
this._body.focus();
}
this._win.focus();
return this;
};
proto.blur = function () {
// IE will remove the whole browser window from focus if you call
// win.blur() or body.blur(), so instead we call top.focus() to focus
// the top frame, thus blurring this frame. This works in everything
// except FF, so we need to call body.blur() in that as well.
if ( isGecko ) {
this._body.blur();
}
top.focus();
return this;
};
// --- Bookmarking ---
var startSelectionId = 'squire-selection-start';
var endSelectionId = 'squire-selection-end';
proto._saveRangeToBookmark = function ( range ) {
var startNode = this.createElement( 'INPUT', {
id: startSelectionId,
type: 'hidden'
}),
endNode = this.createElement( 'INPUT', {
id: endSelectionId,
type: 'hidden'
}),
temp;
insertNodeInRange( range, startNode );
range.collapse( false );
insertNodeInRange( range, endNode );
// In a collapsed range, the start is sometimes inserted after the end!
if ( startNode.compareDocumentPosition( endNode ) &
DOCUMENT_POSITION_PRECEDING ) {
startNode.id = endSelectionId;
endNode.id = startSelectionId;
temp = startNode;
startNode = endNode;
endNode = temp;
}
range.setStartAfter( startNode );
range.setEndBefore( endNode );
};
proto._getRangeAndRemoveBookmark = function ( range ) {
var doc = this._doc,
start = doc.getElementById( startSelectionId ),
end = doc.getElementById( endSelectionId );
if ( start && end ) {
var startContainer = start.parentNode,
endContainer = end.parentNode,
collapsed;
var _range = {
startContainer: startContainer,
endContainer: endContainer,
startOffset: indexOf.call( startContainer.childNodes, start ),
endOffset: indexOf.call( endContainer.childNodes, end )
};
if ( startContainer === endContainer ) {
_range.endOffset -= 1;
}
detach( start );
detach( end );
// Merge any text nodes we split
mergeInlines( startContainer, _range );
if ( startContainer !== endContainer ) {
mergeInlines( endContainer, _range );
}
if ( !range ) {
range = doc.createRange();
}
range.setStart( _range.startContainer, _range.startOffset );
range.setEnd( _range.endContainer, _range.endOffset );
collapsed = range.collapsed;
moveRangeBoundariesDownTree( range );
if ( collapsed ) {
range.collapse( true );
}
}
return range || null;
};
// --- Undo ---
proto._keyUpDetectChange = function ( event ) {
var code = event.keyCode;
// Presume document was changed if:
// 1. A modifier key (other than shift) wasn't held down
// 2. The key pressed is not in range 16<=x<=20 (control keys)
// 3. The key pressed is not in range 33<=x<=45 (navigation keys)
if ( !event.ctrlKey && !event.metaKey && !event.altKey &&
( code < 16 || code > 20 ) &&
( code < 33 || code > 45 ) ) {
this._docWasChanged();
}
};
proto._docWasChanged = function () {
if ( canObserveMutations && this._ignoreChange ) {
this._ignoreChange = false;
return;
}
if ( this._isInUndoState ) {
this._isInUndoState = false;
this.fireEvent( 'undoStateChange', {
canUndo: true,
canRedo: false
});
}
this.fireEvent( 'input' );
};
// Leaves bookmark
proto._recordUndoState = function ( range ) {
// Don't record if we're already in an undo state
if ( !this._isInUndoState ) {
// Advance pointer to new position
var undoIndex = this._undoIndex += 1,
undoStack = this._undoStack;
// Truncate stack if longer (i.e. if has been previously undone)
if ( undoIndex < this._undoStackLength ) {
undoStack.length = this._undoStackLength = undoIndex;
}
// Write out data
if ( range ) {
this._saveRangeToBookmark( range );
}
undoStack[ undoIndex ] = this._getHTML();
this._undoStackLength += 1;
this._isInUndoState = true;
}
};
proto.undo = function () {
// Sanity check: must not be at beginning of the history stack
if ( this._undoIndex !== 0 || !this._isInUndoState ) {
// Make sure any changes since last checkpoint are saved.
this._recordUndoState( this.getSelection() );
this._undoIndex -= 1;
this._setHTML( this._undoStack[ this._undoIndex ] );
var range = this._getRangeAndRemoveBookmark();
if ( range ) {
this.setSelection( range );
}
this._isInUndoState = true;
this.fireEvent( 'undoStateChange', {
canUndo: this._undoIndex !== 0,
canRedo: true
});
this.fireEvent( 'input' );
}
return this;
};
proto.redo = function () {
// Sanity check: must not be at end of stack and must be in an undo
// state.
var undoIndex = this._undoIndex,
undoStackLength = this._undoStackLength;
if ( undoIndex + 1 < undoStackLength && this._isInUndoState ) {
this._undoIndex += 1;
this._setHTML( this._undoStack[ this._undoIndex ] );
var range = this._getRangeAndRemoveBookmark();
if ( range ) {
this.setSelection( range );
}
this.fireEvent( 'undoStateChange', {
canUndo: true,
canRedo: undoIndex + 2 < undoStackLength
});
this.fireEvent( 'input' );
}
return this;
};
// --- Inline formatting ---
// Looks for matching tag and attributes, so won't work
// if <strong> instead of <b> etc.
proto.hasFormat = function ( tag, attributes, range ) {
// 1. Normalise the arguments and get selection
tag = tag.toUpperCase();
if ( !attributes ) { attributes = {}; }
if ( !range && !( range = this.getSelection() ) ) {
return false;
}
// Sanitize range to prevent weird IE artifacts
if ( !range.collapsed &&
range.startContainer.nodeType === TEXT_NODE &&
range.startOffset === range.startContainer.length &&
range.startContainer.nextSibling ) {
range.setStartBefore( range.startContainer.nextSibling );
}
if ( !range.collapsed &&
range.endContainer.nodeType === TEXT_NODE &&
range.endOffset === 0 &&
range.endContainer.previousSibling ) {
range.setEndAfter( range.endContainer.previousSibling );
}
// If the common ancestor is inside the tag we require, we definitely
// have the format.
var root = range.commonAncestorContainer,
walker, node;
if ( getNearest( root, tag, attributes ) ) {
return true;
}
// If common ancestor is a text node and doesn't have the format, we
// definitely don't have it.
if ( root.nodeType === TEXT_NODE ) {
return false;
}
// Otherwise, check each text node at least partially contained within
// the selection and make sure all of them have the format we want.
walker = new TreeWalker( root, SHOW_TEXT, function ( node ) {
return isNodeContainedInRange( range, node, true );
}, false );
var seenNode = false;
while ( node = walker.nextNode() ) {
if ( !getNearest( node, tag, attributes ) ) {
return false;
}
seenNode = true;
}
return seenNode;
};
// Extracts the font-family and font-size (if any) of the element
// holding the cursor. If there's a selection, returns an empty object.
proto.getFontInfo = function ( range ) {
var fontInfo = {
color: undefined,
backgroundColor: undefined,
family: undefined,
size: undefined
};
var seenAttributes = 0;
var element, style;
if ( !range && !( range = this.getSelection() ) ) {
return fontInfo;
}
element = range.commonAncestorContainer;
if ( range.collapsed || element.nodeType === TEXT_NODE ) {
if ( element.nodeType === TEXT_NODE ) {
element = element.parentNode;
}
while ( seenAttributes < 4 && element && ( style = element.style ) ) {
if ( !fontInfo.color ) {
fontInfo.color = style.color;
seenAttributes += 1;
}
if ( !fontInfo.backgroundColor ) {
fontInfo.backgroundColor = style.backgroundColor;
seenAttributes += 1;
}
if ( !fontInfo.family ) {
fontInfo.family = style.fontFamily;
seenAttributes += 1;
}
if ( !fontInfo.size ) {
fontInfo.size = style.fontSize;
seenAttributes += 1;
}
element = element.parentNode;
}
}
return fontInfo;
};
proto._addFormat = function ( tag, attributes, range ) {
// If the range is collapsed we simply insert the node by wrapping
// it round the range and focus it.
var el, walker, startContainer, endContainer, startOffset, endOffset,
node, needsFormat;
if ( range.collapsed ) {
el = fixCursor( this.createElement( tag, attributes ) );
insertNodeInRange( range, el );
range.setStart( el.firstChild, el.firstChild.length );
range.collapse( true );
}
// Otherwise we find all the textnodes in the range (splitting
// partially selected nodes) and if they're not already formatted
// correctly we wrap them in the appropriate tag.
else {
// Create an iterator to walk over all the text nodes under this
// ancestor which are in the range and not already formatted
// correctly.
//
// In Blink/WebKit, empty blocks may have no text nodes, just a <br>.
// Therefore we wrap this in the tag as well, as this will then cause it
// to apply when the user types something in the block, which is
// presumably what was intended.
//
// IMG tags are included because we may want to create a link around them,
// and adding other styles is harmless.
walker = new TreeWalker(
range.commonAncestorContainer,
SHOW_TEXT|SHOW_ELEMENT,
function ( node ) {
return ( node.nodeType === TEXT_NODE ||
node.nodeName === 'BR' ||
node.nodeName === 'IMG'
) && isNodeContainedInRange( range, node, true );
},
false
);
// Start at the beginning node of the range and iterate through
// all the nodes in the range that need formatting.
startContainer = range.startContainer;
startOffset = range.startOffset;
endContainer = range.endContainer;
endOffset = range.endOffset;
// Make sure we start with a valid node.
walker.currentNode = startContainer;
if ( !walker.filter( startContainer ) ) {
startContainer = walker.nextNode();
startOffset = 0;
}
// If there are no interesting nodes in the selection, abort
if ( !startContainer ) {
return range;
}
do {
node = walker.currentNode;
needsFormat = !getNearest( node, tag, attributes );
if ( needsFormat ) {
// <br> can never be a container node, so must have a text node
// if node == (end|start)Container
if ( node === endContainer && node.length > endOffset ) {
node.splitText( endOffset );
}
if ( node === startContainer && startOffset ) {
node = node.splitText( startOffset );
if ( endContainer === startContainer ) {
endContainer = node;
endOffset -= startOffset;
}
startContainer = node;
startOffset = 0;
}
el = this.createElement( tag, attributes );
replaceWith( node, el );
el.appendChild( node );
}
} while ( walker.nextNode() );
// If we don't finish inside a text node, offset may have changed.
if ( endContainer.nodeType !== TEXT_NODE ) {
if ( node.nodeType === TEXT_NODE ) {
endContainer = node;
endOffset = node.length;
} else {
// If <br>, we must have just wrapped it, so it must have only
// one child
endContainer = node.parentNode;
endOffset = 1;
}
}
// Now set the selection to as it was before
range = this._createRange(
startContainer, startOffset, endContainer, endOffset );
}
return range;
};
proto._removeFormat = function ( tag, attributes, range, partial ) {
// Add bookmark
this._saveRangeToBookmark( range );
// We need a node in the selection to break the surrounding
// formatted text.
var doc = this._doc,
fixer;
if ( range.collapsed ) {
if ( cantFocusEmptyTextNodes ) {
fixer = doc.createTextNode( ZWS );
this._didAddZWS();
} else {
fixer = doc.createTextNode( '' );
}
insertNodeInRange( range, fixer );
}
// Find block-level ancestor of selection
var root = range.commonAncestorContainer;
while ( isInline( root ) ) {
root = root.parentNode;
}
// Find text nodes inside formatTags that are not in selection and
// add an extra tag with the same formatting.
var startContainer = range.startContainer,
startOffset = range.startOffset,
endContainer = range.endContainer,
endOffset = range.endOffset,
toWrap = [],
examineNode = function ( node, exemplar ) {
// If the node is completely contained by the range then
// we're going to remove all formatting so ignore it.
if ( isNodeContainedInRange( range, node, false ) ) {
return;
}
var isText = ( node.nodeType === TEXT_NODE ),
child, next;
// If not at least partially contained, wrap entire contents
// in a clone of the tag we're removing and we're done.
if ( !isNodeContainedInRange( range, node, true ) ) {
// Ignore bookmarks and empty text nodes
if ( node.nodeName !== 'INPUT' &&
( !isText || node.data ) ) {
toWrap.push([ exemplar, node ]);
}
return;
}
// Split any partially selected text nodes.
if ( isText ) {
if ( node === endContainer && endOffset !== node.length ) {
toWrap.push([ exemplar, node.splitText( endOffset ) ]);
}
if ( node === startContainer && startOffset ) {
node.splitText( startOffset );
toWrap.push([ exemplar, node ]);
}
}
// If not a text node, recurse onto all children.
// Beware, the tree may be rewritten with each call
// to examineNode, hence find the next sibling first.
else {
for ( child = node.firstChild; child; child = next ) {
next = child.nextSibling;
examineNode( child, exemplar );
}
}
},
formatTags = Array.prototype.filter.call(
root.getElementsByTagName( tag ), function ( el ) {
return isNodeContainedInRange( range, el, true ) &&
hasTagAttributes( el, tag, attributes );
}
);
if ( !partial ) {
formatTags.forEach( function ( node ) {
examineNode( node, node );
});
}
// Now wrap unselected nodes in the tag
toWrap.forEach( function ( item ) {
// [ exemplar, node ] tuple
var el = item[0].cloneNode( false ),
node = item[1];
replaceWith( node, el );
el.appendChild( node );
});
// and remove old formatting tags.
formatTags.forEach( function ( el ) {
replaceWith( el, empty( el ) );
});
// Merge adjacent inlines:
this._getRangeAndRemoveBookmark( range );
if ( fixer ) {
range.collapse( false );
}
var _range = {
startContainer: range.startContainer,
startOffset: range.startOffset,
endContainer: range.endContainer,
endOffset: range.endOffset
};
mergeInlines( root, _range );
range.setStart( _range.startContainer, _range.startOffset );
range.setEnd( _range.endContainer, _range.endOffset );
return range;
};
proto.changeFormat = function ( add, remove, range, partial ) {
// Normalise the arguments and get selection
if ( !range && !( range = this.getSelection() ) ) {
return;
}
// Save undo checkpoint
this._recordUndoState( range );
this._getRangeAndRemoveBookmark( range );
if ( remove ) {
range = this._removeFormat( remove.tag.toUpperCase(),
remove.attributes || {}, range, partial );
}
if ( add ) {
range = this._addFormat( add.tag.toUpperCase(),
add.attributes || {}, range );
}
this.setSelection( range );
this._updatePath( range, true );
// We're not still in an undo state
if ( !canObserveMutations ) {
this._docWasChanged();
}
return this;
};
// --- Block formatting ---
var tagAfterSplit = {
DT: 'DD',
DD: 'DT',
LI: 'LI'
};
var splitBlock = function ( self, block, node, offset ) {
var splitTag = tagAfterSplit[ block.nodeName ],
splitProperties = null,
nodeAfterSplit = split( node, offset, block.parentNode ),
config = self._config;
if ( !splitTag ) {
splitTag = config.blockTag;
splitProperties = config.blockAttributes;
}
// Make sure the new node is the correct type.
if ( !hasTagAttributes( nodeAfterSplit, splitTag, splitProperties ) ) {
block = createElement( nodeAfterSplit.ownerDocument,
splitTag, splitProperties );
if ( nodeAfterSplit.dir ) {
block.dir = nodeAfterSplit.dir;
}
replaceWith( nodeAfterSplit, block );
block.appendChild( empty( nodeAfterSplit ) );
nodeAfterSplit = block;
}
return nodeAfterSplit;
};
proto.forEachBlock = function ( fn, mutates, range ) {
if ( !range && !( range = this.getSelection() ) ) {
return this;
}
// Save undo checkpoint
if ( mutates ) {
this._recordUndoState( range );
this._getRangeAndRemoveBookmark( range );
}
var start = getStartBlockOfRange( range ),
end = getEndBlockOfRange( range );
if ( start && end ) {
do {
if ( fn( start ) || start === end ) { break; }
} while ( start = getNextBlock( start ) );
}
if ( mutates ) {
this.setSelection( range );
// Path may have changed
this._updatePath( range, true );
// We're not still in an undo state
if ( !canObserveMutations ) {
this._docWasChanged();
}
}
return this;
};
proto.modifyBlocks = function ( modify, range ) {
if ( !range && !( range = this.getSelection() ) ) {
return this;
}
// 1. Save undo checkpoint and bookmark selection
if ( this._isInUndoState ) {
this._saveRangeToBookmark( range );
} else {
this._recordUndoState( range );
}
// 2. Expand range to block boundaries
expandRangeToBlockBoundaries( range );
// 3. Remove range.
var body = this._body,
frag;
moveRangeBoundariesUpTree( range, body );
frag = extractContentsOfRange( range, body );
// 4. Modify tree of fragment and reinsert.
insertNodeInRange( range, modify.call( this, frag ) );
// 5. Merge containers at edges
if ( range.endOffset < range.endContainer.childNodes.length ) {
mergeContainers( range.endContainer.childNodes[ range.endOffset ] );
}
mergeContainers( range.startContainer.childNodes[ range.startOffset ] );
// 6. Restore selection
this._getRangeAndRemoveBookmark( range );
this.setSelection( range );
this._updatePath( range, true );
// 7. We're not still in an undo state
if ( !canObserveMutations ) {
this._docWasChanged();
}
return this;
};
var increaseBlockQuoteLevel = function ( frag ) {
return this.createElement( 'BLOCKQUOTE',
this._config.tagAttributes.blockquote, [
frag
]);
};
var decreaseBlockQuoteLevel = function ( frag ) {
var blockquotes = frag.querySelectorAll( 'blockquote' );
Array.prototype.filter.call( blockquotes, function ( el ) {
return !getNearest( el.parentNode, 'BLOCKQUOTE' );
}).forEach( function ( el ) {
replaceWith( el, empty( el ) );
});
return frag;
};
var removeBlockQuote = function (/* frag */) {
return this.createDefaultBlock([
this.createElement( 'INPUT', {
id: startSelectionId,
type: 'hidden'
}),
this.createElement( 'INPUT', {
id: endSelectionId,
type: 'hidden'
})
]);
};
var makeList = function ( self, frag, type ) {
var walker = getBlockWalker( frag ),
node, tag, prev, newLi,
tagAttributes = self._config.tagAttributes,
listAttrs = tagAttributes[ type.toLowerCase() ],
listItemAttrs = tagAttributes.li;
while ( node = walker.nextNode() ) {
tag = node.parentNode.nodeName;
if ( tag !== 'LI' ) {
newLi = self.createElement( 'LI', listItemAttrs );
if ( node.dir ) {
newLi.dir = node.dir;
}
// Have we replaced the previous block with a new <ul>/<ol>?
if ( ( prev = node.previousSibling ) &&
prev.nodeName === type ) {
prev.appendChild( newLi );
}
// Otherwise, replace this block with the <ul>/<ol>
else {
replaceWith(
node,
self.createElement( type, listAttrs, [
newLi
])
);
}
newLi.appendChild( node );
} else {
node = node.parentNode.parentNode;
tag = node.nodeName;
if ( tag !== type && ( /^[OU]L$/.test( tag ) ) ) {
replaceWith( node,
self.createElement( type, listAttrs, [ empty( node ) ] )
);
}
}
}
};
var makeUnorderedList = function ( frag ) {
makeList( this, frag, 'UL' );
return frag;
};
var makeOrderedList = function ( frag ) {
makeList( this, frag, 'OL' );
return frag;
};
var removeList = function ( frag ) {
var lists = frag.querySelectorAll( 'UL, OL' ),
i, l, ll, list, listFrag, children, child;
for ( i = 0, l = lists.length; i < l; i += 1 ) {
list = lists[i];
listFrag = empty( list );
children = listFrag.childNodes;
ll = children.length;
while ( ll-- ) {
child = children[ll];
replaceWith( child, empty( child ) );
}
fixContainer( listFrag );
replaceWith( list, listFrag );
}
return frag;
};
var increaseListLevel = function ( frag ) {
var items = frag.querySelectorAll( 'LI' ),
i, l, item,
type, newParent,
tagAttributes = this._config.tagAttributes,
listItemAttrs = tagAttributes.li,
listAttrs;
for ( i = 0, l = items.length; i < l; i += 1 ) {
item = items[i];
if ( !isContainer( item.firstChild ) ) {
// type => 'UL' or 'OL'
type = item.parentNode.nodeName;
newParent = item.previousSibling;
if ( !newParent || !( newParent = newParent.lastChild ) ||
newParent.nodeName !== type ) {
listAttrs = tagAttributes[ type.toLowerCase() ];
replaceWith(
item,
this.createElement( 'LI', listItemAttrs, [
newParent = this.createElement( type, listAttrs )
])
);
}
newParent.appendChild( item );
}
}
return frag;
};
var decreaseListLevel = function ( frag ) {
var items = frag.querySelectorAll( 'LI' );
Array.prototype.filter.call( items, function ( el ) {
return !isContainer( el.firstChild );
}).forEach( function ( item ) {
var parent = item.parentNode,
newParent = parent.parentNode,
first = item.firstChild,
node = first,
next;
if ( item.previousSibling ) {
parent = split( parent, item, newParent );
}
while ( node ) {
next = node.nextSibling;
if ( isContainer( node ) ) {
break;
}
newParent.insertBefore( node, parent );
node = next;
}
if ( newParent.nodeName === 'LI' && first.previousSibling ) {
split( newParent, first, newParent.parentNode );
}
while ( item !== frag && !item.childNodes.length ) {
parent = item.parentNode;
parent.removeChild( item );
item = parent;
}
}, this );
fixContainer( frag );
return frag;
};
proto._ensureBottomLine = function () {
var body = this._body,
last = body.lastElementChild;
if ( !last ||
last.nodeName !== this._config.blockTag || !isBlock( last ) ) {
body.appendChild( this.createDefaultBlock() );
}
};
// --- Keyboard interaction ---
proto.setKeyHandler = function ( key, fn ) {
this._keyHandlers[ key ] = fn;
return this;
};
// --- Get/Set data ---
proto._getHTML = function () {
return this._body.innerHTML;
};
proto._setHTML = function ( html ) {
var node = this._body;
node.innerHTML = html;
do {
fixCursor( node );
} while ( node = getNextBlock( node ) );
this._ignoreChange = true;
};
proto.getHTML = function ( withBookMark ) {
var brs = [],
node, fixer, html, l, range;
if ( withBookMark && ( range = this.getSelection() ) ) {
this._saveRangeToBookmark( range );
}
if ( useTextFixer ) {
node = this._body;
while ( node = getNextBlock( node ) ) {
if ( !node.textContent && !node.querySelector( 'BR' ) ) {
fixer = this.createElement( 'BR' );
node.appendChild( fixer );
brs.push( fixer );
}
}
}
html = this._getHTML().replace( /\u200B/g, '' );
if ( useTextFixer ) {
l = brs.length;
while ( l-- ) {
detach( brs[l] );
}
}
if ( range ) {
this._getRangeAndRemoveBookmark( range );
}
return html;
};
proto.setHTML = function ( html ) {
var frag = this._doc.createDocumentFragment(),
div = this.createElement( 'DIV' ),
child;
// Parse HTML into DOM tree
div.innerHTML = html;
frag.appendChild( empty( div ) );
cleanTree( frag );
cleanupBRs( frag );
fixContainer( frag );
// Fix cursor
var node = frag;
while ( node = getNextBlock( node ) ) {
fixCursor( node );
}
// Don't fire an input event
this._ignoreChange = true;
// Remove existing body children
var body = this._body;
while ( child = body.lastChild ) {
body.removeChild( child );
}
// And insert new content
body.appendChild( frag );
fixCursor( body );
// Reset the undo stack
this._undoIndex = -1;
this._undoStack.length = 0;
this._undoStackLength = 0;
this._isInUndoState = false;
// Record undo state
var range = this._getRangeAndRemoveBookmark() ||
this._createRange( body.firstChild, 0 );
this._recordUndoState( range );
this._getRangeAndRemoveBookmark( range );
// IE will also set focus when selecting text so don't use
// setSelection. Instead, just store it in lastSelection, so if
// anything calls getSelection before first focus, we have a range
// to return.
if ( losesSelectionOnBlur ) {
this._lastSelection = range;
} else {
this.setSelection( range );
}
this._updatePath( range, true );
return this;
};
proto.insertElement = function ( el, range ) {
if ( !range ) { range = this.getSelection(); }
range.collapse( true );
if ( isInline( el ) ) {
insertNodeInRange( range, el );
range.setStartAfter( el );
} else {
// Get containing block node.
var body = this._body,
splitNode = getStartBlockOfRange( range ) || body,
parent, nodeAfterSplit;
// While at end of container node, move up DOM tree.
while ( splitNode !== body && !splitNode.nextSibling ) {
splitNode = splitNode.parentNode;
}
// If in the middle of a container node, split up to body.
if ( splitNode !== body ) {
parent = splitNode.parentNode;
nodeAfterSplit = split( parent, splitNode.nextSibling, body );
}
if ( nodeAfterSplit ) {
body.insertBefore( el, nodeAfterSplit );
} else {
body.appendChild( el );
// Insert blank line below block.
nodeAfterSplit = this.createDefaultBlock();
body.appendChild( nodeAfterSplit );
}
range.setStart( nodeAfterSplit, 0 );
range.setEnd( nodeAfterSplit, 0 );
moveRangeBoundariesDownTree( range );
}
this.focus();
this.setSelection( range );
this._updatePath( range );
return this;
};
proto.insertImage = function ( src, attributes ) {
var img = this.createElement( 'IMG', mergeObjects({
src: src
}, attributes ));
this.insertElement( img );
return img;
};
var linkRegExp = /\b((?:(?:ht|f)tps?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,}\/)(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)/i;
var addLinks = function ( frag ) {
var doc = frag.ownerDocument,
walker = new TreeWalker( frag, SHOW_TEXT,
function ( node ) {
return !getNearest( node, 'A' );
}, false ),
node, data, parent, match, index, endIndex, child;
while ( node = walker.nextNode() ) {
data = node.data;
parent = node.parentNode;
while ( match = linkRegExp.exec( data ) ) {
index = match.index;
endIndex = index + match[0].length;
if ( index ) {
child = doc.createTextNode( data.slice( 0, index ) );
parent.insertBefore( child, node );
}
child = doc.createElement( 'A' );
child.textContent = data.slice( index, endIndex );
child.href = match[1] ?
/^(?:ht|f)tps?:/.test( match[1] ) ?
match[1] :
'http://' + match[1] :
'mailto:' + match[2];
parent.insertBefore( child, node );
node.data = data = data.slice( endIndex );
}
}
};
// Insert HTML at the cursor location. If the selection is not collapsed
// insertTreeFragmentIntoRange will delete the selection so that it is replaced
// by the html being inserted.
proto.insertHTML = function ( html, isPaste ) {
var range = this.getSelection(),
frag = this._doc.createDocumentFragment(),
div = this.createElement( 'DIV' );
// Parse HTML into DOM tree
div.innerHTML = html;
frag.appendChild( empty( div ) );
// Record undo checkpoint
this._recordUndoState( range );
this._getRangeAndRemoveBookmark( range );
try {
var node = frag;
var event = {
fragment: frag,
preventDefault: function () {
this.defaultPrevented = true;
},
defaultPrevented: false
};
addLinks( frag );
cleanTree( frag );
cleanupBRs( frag );
removeEmptyInlines( frag );
frag.normalize();
while ( node = getNextBlock( node ) ) {
fixCursor( node );
}
if ( isPaste ) {
this.fireEvent( 'willPaste', event );
}
if ( !event.defaultPrevented ) {
insertTreeFragmentIntoRange( range, event.fragment );
if ( !canObserveMutations ) {
this._docWasChanged();
}
range.collapse( false );
this._ensureBottomLine();
}
this.setSelection( range );
this._updatePath( range, true );
} catch ( error ) {
this.didError( error );
}
return this;
};
proto.insertPlainText = function ( plainText, isPaste ) {
var lines = plainText.split( '\n' ),
i, l, line;
for ( i = 0, l = lines.length; i < l; i += 1 ) {
line = lines[i];
line = line.split( '&' ).join( '&' )
.split( '<' ).join( '<' )
.split( '>' ).join( '>' )
.replace( / (?= )/g, ' ' );
// Wrap all but first/last lines in <div></div>
if ( i && i + 1 < l ) {
line = '<DIV>' + ( line || '<BR>' ) + '</DIV>';
}
lines[i] = line;
}
return this.insertHTML( lines.join( '' ), isPaste );
};
// --- Formatting ---
var command = function ( method, arg, arg2 ) {
return function () {
this[ method ]( arg, arg2 );
return this.focus();
};
};
proto.addStyles = function ( styles ) {
if ( styles ) {
var head = this._doc.documentElement.firstChild,
style = this.createElement( 'STYLE', {
type: 'text/css'
});
style.appendChild( this._doc.createTextNode( styles ) );
head.appendChild( style );
}
return this;
};
proto.bold = command( 'changeFormat', { tag: 'B' } );
proto.italic = command( 'changeFormat', { tag: 'I' } );
proto.underline = command( 'changeFormat', { tag: 'U' } );
proto.strikethrough = command( 'changeFormat', { tag: 'S' } );
proto.subscript = command( 'changeFormat', { tag: 'SUB' }, { tag: 'SUP' } );
proto.superscript = command( 'changeFormat', { tag: 'SUP' }, { tag: 'SUB' } );
proto.removeBold = command( 'changeFormat', null, { tag: 'B' } );
proto.removeItalic = command( 'changeFormat', null, { tag: 'I' } );
proto.removeUnderline = command( 'changeFormat', null, { tag: 'U' } );
proto.removeStrikethrough = command( 'changeFormat', null, { tag: 'S' } );
proto.removeSubscript = command( 'changeFormat', null, { tag: 'SUB' } );
proto.removeSuperscript = command( 'changeFormat', null, { tag: 'SUP' } );
proto.makeLink = function ( url, attributes ) {
var range = this.getSelection();
if ( range.collapsed ) {
var protocolEnd = url.indexOf( ':' ) + 1;
if ( protocolEnd ) {
while ( url[ protocolEnd ] === '/' ) { protocolEnd += 1; }
}
insertNodeInRange(
range,
this._doc.createTextNode( url.slice( protocolEnd ) )
);
}
if ( !attributes ) {
attributes = {};
}
attributes.href = url;
this.changeFormat({
tag: 'A',
attributes: attributes
}, {
tag: 'A'
}, range );
return this.focus();
};
proto.removeLink = function () {
this.changeFormat( null, {
tag: 'A'
}, this.getSelection(), true );
return this.focus();
};
proto.setFontFace = function ( name ) {
this.changeFormat({
tag: 'SPAN',
attributes: {
'class': 'font',
style: 'font-family: ' + name + ', sans-serif;'
}
}, {
tag: 'SPAN',
attributes: { 'class': 'font' }
});
return this.focus();
};
proto.setFontSize = function ( size ) {
this.changeFormat({
tag: 'SPAN',
attributes: {
'class': 'size',
style: 'font-size: ' +
( typeof size === 'number' ? size + 'px' : size )
}
}, {
tag: 'SPAN',
attributes: { 'class': 'size' }
});
return this.focus();
};
proto.setTextColour = function ( colour ) {
this.changeFormat({
tag: 'SPAN',
attributes: {
'class': 'colour',
style: 'color:' + colour
}
}, {
tag: 'SPAN',
attributes: { 'class': 'colour' }
});
return this.focus();
};
proto.setHighlightColour = function ( colour ) {
this.changeFormat({
tag: 'SPAN',
attributes: {
'class': 'highlight',
style: 'background-color:' + colour
}
}, {
tag: 'SPAN',
attributes: { 'class': 'highlight' }
});
return this.focus();
};
proto.setTextAlignment = function ( alignment ) {
this.forEachBlock( function ( block ) {
block.className = ( block.className
.split( /\s+/ )
.filter( function ( klass ) {
return !( /align/.test( klass ) );
})
.join( ' ' ) +
' align-' + alignment ).trim();
block.style.textAlign = alignment;
}, true );
return this.focus();
};
proto.setTextDirection = function ( direction ) {
this.forEachBlock( function ( block ) {
block.dir = direction;
}, true );
return this.focus();
};
function removeFormatting ( self, root, clean ) {
var node, next;
for ( node = root.firstChild; node; node = next ) {
next = node.nextSibling;
if ( isInline( node ) ) {
if ( node.nodeType === TEXT_NODE || node.nodeName === 'BR' || node.nodeName === 'IMG' ) {
clean.appendChild( node );
continue;
}
} else if ( isBlock( node ) ) {
clean.appendChild( self.createDefaultBlock([
removeFormatting(
self, node, self._doc.createDocumentFragment() )
]));
continue;
}
removeFormatting( self, node, clean );
}
return clean;
}
proto.removeAllFormatting = function ( range ) {
if ( !range && !( range = this.getSelection() ) || range.collapsed ) {
return this;
}
var stopNode = range.commonAncestorContainer;
while ( stopNode && !isBlock( stopNode ) ) {
stopNode = stopNode.parentNode;
}
if ( !stopNode ) {
expandRangeToBlockBoundaries( range );
stopNode = this._body;
}
if ( stopNode.nodeType === TEXT_NODE ) {
return this;
}
// Record undo point
this._recordUndoState( range );
this._getRangeAndRemoveBookmark( range );
// Avoid splitting where we're already at edges.
moveRangeBoundariesUpTree( range, stopNode );
// Split the selection up to the block, or if whole selection in same
// block, expand range boundaries to ends of block and split up to body.
var doc = stopNode.ownerDocument;
var startContainer = range.startContainer;
var startOffset = range.startOffset;
var endContainer = range.endContainer;
var endOffset = range.endOffset;
// Split end point first to avoid problems when end and start
// in same container.
var formattedNodes = doc.createDocumentFragment();
var cleanNodes = doc.createDocumentFragment();
var nodeAfterSplit = split( endContainer, endOffset, stopNode );
var nodeInSplit = split( startContainer, startOffset, stopNode );
var nextNode, _range, childNodes;
// Then replace contents in split with a cleaned version of the same:
// blocks become default blocks, text and leaf nodes survive, everything
// else is obliterated.
while ( nodeInSplit !== nodeAfterSplit ) {
nextNode = nodeInSplit.nextSibling;
formattedNodes.appendChild( nodeInSplit );
nodeInSplit = nextNode;
}
removeFormatting( this, formattedNodes, cleanNodes );
cleanNodes.normalize();
nodeInSplit = cleanNodes.firstChild;
nextNode = cleanNodes.lastChild;
// Restore selection
childNodes = stopNode.childNodes;
if ( nodeInSplit ) {
stopNode.insertBefore( cleanNodes, nodeAfterSplit );
startOffset = indexOf.call( childNodes, nodeInSplit );
endOffset = indexOf.call( childNodes, nextNode ) + 1;
} else {
startOffset = indexOf.call( childNodes, nodeAfterSplit );
endOffset = startOffset;
}
// Merge text nodes at edges, if possible
_range = {
startContainer: stopNode,
startOffset: startOffset,
endContainer: stopNode,
endOffset: endOffset
};
mergeInlines( stopNode, _range );
range.setStart( _range.startContainer, _range.startOffset );
range.setEnd( _range.endContainer, _range.endOffset );
// And move back down the tree
moveRangeBoundariesDownTree( range );
this.setSelection( range );
this._updatePath( range, true );
return this.focus();
};
proto.increaseQuoteLevel = command( 'modifyBlocks', increaseBlockQuoteLevel );
proto.decreaseQuoteLevel = command( 'modifyBlocks', decreaseBlockQuoteLevel );
proto.makeUnorderedList = command( 'modifyBlocks', makeUnorderedList );
proto.makeOrderedList = command( 'modifyBlocks', makeOrderedList );
proto.removeList = command( 'modifyBlocks', removeList );
proto.increaseListLevel = command( 'modifyBlocks', increaseListLevel );
proto.decreaseListLevel = command( 'modifyBlocks', decreaseListLevel );
| {
"content_hash": "ad1ffec4f8c6e56884786d5005132805",
"timestamp": "",
"source": "github",
"line_count": 1855,
"max_line_length": 229,
"avg_line_length": 30.828032345013476,
"alnum_prop": 0.5538593362011681,
"repo_name": "Endika/Squire",
"id": "69b6fa6830686f0fb5c16516aeb169a3d31e1b49",
"size": "57196",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/Editor.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "6726"
},
{
"name": "JavaScript",
"bytes": "265444"
},
{
"name": "Makefile",
"bytes": "547"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "ee398ee8e22e2c50f3b9987f6b176536",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "5a79f64fd5327be811d658a0c0929d7dfc384b12",
"size": "194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malvales/Malvaceae/Luehea/Luehea gravesii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<component
id="BulletChart"
title="Bullet Chart 2.0"
icon="res/BulletChart/BulletChart.png"
handlerType="div"
modes="commons m"
databound="true"
group="ScnCommunityVisualizations"
propertySheetPath="aps/PropertyPage.html">
<requireJs modes="commons m">res/BulletChart/BulletChart</requireJs>
<property id="onclick" type="ScriptText" title="On Click" group="Events" />
<property id="clickedgraphkey" title="clickedgraphkey" type="String" visible="false"/>
<property id="data" title="Dataset" type="ResultSet" group="DataBinding" visible="false"/>
<property id="realization" title="realization column" type="String"/>
<property id="extrapolation" title="expected realization outcome end of period column" type="String"/>
<property id="threshold1" title="first threshold column" type="String"/>
<property id="threshold2" title="second threshold column" type="String"/>
<property id="threshold3" title="third threshold column" type="String"/>
<property id="threshold4" title="second threshold column" type="String"/>
<property id="threshold5" title="third threshold column" type="String"/>
<property id="labeldimension" title="Row Dimension holding main label" type="String"/>
<property id="sublabeldimension" title="Row Dimension holding sub label" type="String"/>
<property id="keydimension" title="Row Dimension holding unique key for clicking through" type="String"/>
<property id="comparison" title="comparison column" type="String"/>
<property id="showaxis" title="Show X axis numbers" type="boolean"/>
<property id="tooltip" title="Show tooltip" type="boolean"/>
<property id="showalert" title= "show alert" type="String">
<possibleValue>never</possibleValue>
<possibleValue>worse than comparison</possibleValue>
<possibleValue>worse than threshold 5</possibleValue>
<possibleValue>worse than threshold 4</possibleValue>
<possibleValue>worse than threshold 3</possibleValue>
<possibleValue>worse than threshold 2</possibleValue>
<possibleValue>worse than threshold 1</possibleValue>
</property>
<property id="showrealization" title= "show realization value" type="boolean"/>
<property id="maxgraphheight" title= "maximum height of single graph" type="int"/>
<property id="mingraphheight" title= "minimum height of single graph" type="int"/>
<property id="numberofticks" title= "number of ticks in the graph" type="int"/>
<property id="columnmargin" title="horizontal margin between graphs" type="int"/>
<property id="numberofcolumns" title="number of columns" type="int"/>
<property id="rowmargin" title="vertical margin between graphs" type="int"/>
<property id="charttopmargin" title="Bullet Top Margin" type="int"/>
<property id="chartbottommargin" title="Bullet Bottom Margin" type="int"/>
<property id="chartleftmargin" title="Bullet Left Margin" type="int"/>
<property id="chartrightmargin" title="Bullet Right Margin" type="int"/>
<property id="higherisbetter" title="realization higher than target is better" type="boolean"/>
<initialization>
<defaultValue property="numberofcolumns">1</defaultValue>
<defaultValue property="rowmargin">20</defaultValue>
<defaultValue property="columnmargin">30</defaultValue>
<defaultValue property="maxgraphheight">70</defaultValue>
<defaultValue property="mingraphheight">50</defaultValue>
<defaultValue property="higherisbetter">true</defaultValue>
<defaultValue property="showaxis">true</defaultValue>
<defaultValue property="tooltip">false</defaultValue>
<defaultValue property="showalert">true</defaultValue>
<defaultValue property="numberofticks">4</defaultValue>
<defaultValue property="showalert">worse than comparison</defaultValue>
<defaultValue property="TOP_MARGIN">0</defaultValue>
<defaultValue property="LEFT_MARGIN">0</defaultValue>
<defaultValue property="RIGHT_MARGIN">auto</defaultValue>
<defaultValue property="BOTTOM_MARGIN">auto</defaultValue>
<defaultValue property="WIDTH">600</defaultValue>
<defaultValue property="HEIGHT">500</defaultValue>
</initialization>
</component>
| {
"content_hash": "e6da7883e96c6ffd8057f54e50a5ddca",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 107,
"avg_line_length": 59.614285714285714,
"alnum_prop": 0.737359213994728,
"repo_name": "org-scn-design-studio-community/lumiradesignercommunityext_src",
"id": "1338c4919f89e44f2b331a71d61f9ab90369bb30",
"size": "4173",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "legacy_src/org.scn.community.databound/res/BulletChart/def/contribution.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "27333"
},
{
"name": "CSS",
"bytes": "2639483"
},
{
"name": "HTML",
"bytes": "162729"
},
{
"name": "Java",
"bytes": "197833"
},
{
"name": "JavaScript",
"bytes": "13143865"
},
{
"name": "Shell",
"bytes": "443"
},
{
"name": "XSLT",
"bytes": "552"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<HTML><head><TITLE>Manpage of PERF\-SCRIPT\-PYTHON</TITLE>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/main.css" type="text/css">
</head>
<body>
<header class="site-header">
<div class="wrap"> <div class="site-title"><a href="/manpages/index.html">linux manpages</a></div>
<div class="site-description">{"type":"documentation"}</div>
</div>
</header>
<div class="page-content"><div class="wrap">
<H1>PERF\-SCRIPT\-PYTHON</H1>
Section: Misc. Reference Manual Pages (1)<BR>Updated: 10/16/2012<BR><A HREF="#index">Index</A>
<A HREF="/manpages/index.html">Return to Main Contents</A><HR>
<A NAME="lbAB"> </A>
<H2>NAME</H2>
perf-script-python - Process trace data with a Python script
<A NAME="lbAC"> </A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>perf script</I> [-s [Python]:script[.py] ]
</PRE>
<A NAME="lbAD"> </A>
<H2>DESCRIPTION</H2>
<P>
This perf script option is used to process perf script data using perfcqs built-in Python interpreter. It reads and processes the input file and displays the results of the trace analysis implemented in the given Python script, if any.
<A NAME="lbAE"> </A>
<H2>A QUICK EXAMPLE</H2>
<P>
This section shows the process, start to finish, of creating a working Python script that aggregates and extracts useful information from a raw perf script stream. You can avoid reading the rest of this document if an example is enough for you; the rest of the document provides more details on each step and lists the library functions available to script writers.
<P>
This example actually details the steps that were used to create the <I>syscall-counts</I> script you see when you list the available perf script scripts via <I>perf script -l</I>. As such, this script also shows how to integrate your script into the list of general-purpose <I>perf script</I> scripts listed by that command.
<P>
The syscall-counts script is a simple script, but demonstrates all the basic ideas necessary to create a useful script. Herecqs an example of its output (syscall names are not yet supported, they will appear as numbers):
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
syscall events:
event count
---------------------------------------- -----------
sys_write 455067
sys_getdents 4072
sys_close 3037
sys_swapoff 1769
sys_read 923
sys_sched_setparam 826
sys_open 331
sys_newfstat 326
sys_mmap 217
sys_munmap 216
sys_futex 141
sys_select 102
sys_poll 84
sys_setitimer 12
sys_writev 8
15 8
sys_lseek 7
sys_rt_sigprocmask 6
sys_wait4 3
sys_ioctl 3
sys_set_robust_list 1
sys_exit 1
56 1
sys_access 1
.ft
</PRE>
</DL>
<P>
Basically our task is to keep a per-syscall tally that gets updated every time a system call occurs in the system. Our script will do that, but first we need to record the data that will be processed by that script. Theoretically, there are a couple of ways we could do that:
<P>
<DL COMPACT><DT><DD>
*
we could enable every event under the tracing/events/syscalls directory, but this is over 600 syscalls, well beyond the number allowable by perf. These individual syscall events will however be useful if we want to later use the guidance we get from the general-purpose scripts to drill down and get more detail about individual syscalls of interest.
</DL>
<P>
<DL COMPACT><DT><DD>
*
we can enable the sys_enter and/or sys_exit syscalls found under tracing/events/raw_syscalls. These are called for all syscalls; the
<I>id</I>
field can be used to distinguish between individual syscall numbers.
</DL>
<P>
For this script, we only need to know that a syscall was entered; we doncqt care how it exited, so wecqll use <I>perf record</I> to record only the sys_enter events:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
# perf record -a -e raw_syscalls:sys_enter
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 56.545 MB perf.data (~2470503 samples) ]
.ft
</PRE>
</DL>
<P>
The options basically say to collect data for every syscall event system-wide and multiplex the per-cpu output into a single stream. That single stream will be recorded in a file in the current directory called perf.data.
<P>
Once we have a perf.data file containing our data, we can use the -g <I>perf script</I> option to generate a Python script that will contain a callback handler for each event type found in the perf.data trace stream (for more details, see the STARTER SCRIPTS section).
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
# perf script -g python
generated Python script: perf-script.py
The output file created also in the current directory is named
perf-script.py. Here's the file in its entirety:
# perf script event handlers, generated by perf script -g python
# Licensed under the terms of the GNU GPL License version 2
# The common_* event handler fields are the most useful fields common to
# all events. They don't necessarily correspond to the 'common_*' fields
# in the format files. Those fields not available as handler params can
# be retrieved using Python functions of the form common_*(context).
# See the perf-script-python Documentation for the list of available functions.
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/perf-script-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
def trace_begin():
print "in trace_begin"
def trace_end():
print "in trace_end"
def raw_syscalls__sys_enter(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
id, args):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print "id=%d, args=%s\n" % \
(id, args),
def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
common_pid, common_comm):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
def print_header(event_name, cpu, secs, nsecs, pid, comm):
print "%-20s %5u %05u.%09u %8u %-20s " % \
(event_name, cpu, secs, nsecs, pid, comm),
.ft
</PRE>
</DL>
<P>
At the top is a comment block followed by some import statements and a path append which every perf script script should include.
<P>
Following that are a couple generated functions, trace_begin() and trace_end(), which are called at the beginning and the end of the script respectively (for more details, see the SCRIPT_LAYOUT section below).
<P>
Following those are the <I>event handler</I> functions generated one for every event in the <I>perf record</I> output. The handler functions take the form subsystem<I>event_name, and contain named parameters, one for each field in the event; in this case, therecqs only one event, raw_syscalls</I>sys_enter(). (see the EVENT HANDLERS section below for more info on event handlers).
<P>
The final couple of functions are, like the begin and end functions, generated for every script. The first, trace_unhandled(), is called every time the script finds an event in the perf.data file that doesncqt correspond to any event handler in the script. This could mean either that the record step recorded event types that it wasncqt really interested in, or the script was run against a trace file that doesncqt correspond to the script.
<P>
The script generated by -g option simply prints a line for each event found in the trace stream i.e. it basically just dumps the event and its parameter values to stdout. The print_header() function is simply a utility function used for that purpose. Letcqs rename the script and run it to see the default output:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
# mv perf-script.py syscall-counts.py
# perf script -s syscall-counts.py
raw_syscalls__sys_enter 1 00840.847582083 7506 perf id=1, args=
raw_syscalls__sys_enter 1 00840.847595764 7506 perf id=1, args=
raw_syscalls__sys_enter 1 00840.847620860 7506 perf id=1, args=
raw_syscalls__sys_enter 1 00840.847710478 6533 npviewer.bin id=78, args=
raw_syscalls__sys_enter 1 00840.847719204 6533 npviewer.bin id=142, args=
raw_syscalls__sys_enter 1 00840.847755445 6533 npviewer.bin id=3, args=
raw_syscalls__sys_enter 1 00840.847775601 6533 npviewer.bin id=3, args=
raw_syscalls__sys_enter 1 00840.847781820 6533 npviewer.bin id=3, args=
.
.
.
.ft
</PRE>
</DL>
<P>
Of course, for this script, wecqre not interested in printing every trace event, but rather aggregating it in a useful way. So wecqll get rid of everything to do with printing as well as the trace_begin() and trace_unhandled() functions, which we woncqt be using. That leaves us with this minimalistic skeleton:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/perf-script-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
def trace_end():
print "in trace_end"
def raw_syscalls__sys_enter(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
id, args):
.ft
</PRE>
</DL>
<P>
In trace_end(), wecqll simply print the results, but first we need to generate some results to print. To do that we need to have our sys_enter() handler do the necessary tallying until all events have been counted. A hash table indexed by syscall id is a good way to store that information; every time the sys_enter() handler is called, we simply increment a count associated with that hash entry indexed by that syscall id:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
syscalls = autodict()
try:
syscalls[id] += 1
except TypeError:
syscalls[id] = 1
.ft
</PRE>
</DL>
<P>
The syscalls <I>autodict</I> object is a special kind of Python dictionary (implemented in Core.py) that implements Perlcqs <I>autovivifying</I> hashes in Python i.e. with autovivifying hashes, you can assign nested hash values without having to go to the trouble of creating intermediate levels if they doncqt exist e.g syscalls[comm][pid][id] = 1 will create the intermediate hash levels and finally assign the value 1 to the hash entry for <I>id</I> (because the value being assigned isncqt a hash object itself, the initial value is assigned in the TypeError exception. Well, there may be a better way to do this in Python but thatcqs what works for now).
<P>
Putting that code into the raw_syscalls__sys_enter() handler, we effectively end up with a single-level dictionary keyed on syscall id and having the counts wecqve tallied as values.
<P>
The print_syscall_totals() function iterates over the entries in the dictionary and displays a line for each entry containing the syscall name (the dictonary keys contain the syscall ids, which are passed to the Util function syscall_name(), which translates the raw syscall numbers to the corresponding syscall name strings). The output is displayed after all the events in the trace have been processed, by calling the print_syscall_totals() function from the trace_end() handler called at the end of script processing.
<P>
The final script producing the output shown above is shown in its entirety below (syscall_name() helper is not yet available, you can only deal with idcqs for now):
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/perf-script-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
syscalls = autodict()
def trace_end():
print_syscall_totals()
def raw_syscalls__sys_enter(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
id, args):
try:
syscalls[id] += 1
except TypeError:
syscalls[id] = 1
def print_syscall_totals():
if for_comm is not None:
print "\nsyscall events for %s:\n\n" % (for_comm),
else:
print "\nsyscall events:\n\n",
print "%-40s %10s\n" % ("event", "count"),
print "%-40s %10s\n" % ("----------------------------------------", \
"-----------"),
for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \
reverse = True):
print "%-40s %10d\n" % (syscall_name(id), val),
.ft
</PRE>
</DL>
<P>
The script can be run just as before:
<P>
<DL COMPACT><DT><DD>
<PRE>
# perf script -s syscall-counts.py
</PRE>
</DL>
<P>
So those are the essential steps in writing and running a script. The process can be generalized to any tracepoint or set of tracepoints youcqre interested in - basically find the tracepoint(s) youcqre interested in by looking at the list of available events shown by <I>perf list</I> and/or look in /sys/kernel/debug/tracing events for detailed event and field info, record the corresponding trace data using <I>perf record</I>, passing it the list of interesting events, generate a skeleton script using <I>perf script -g python</I> and modify the code to aggregate and display it for your particular needs.
<P>
After youcqve done that you may end up with a general-purpose script that you want to keep around and have available for future use. By writing a couple of very simple shell scripts and putting them in the right place, you can have your script listed alongside the other scripts listed by the <I>perf script -l</I> command e.g.:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
<A HREF="mailto:root@tropicana">root@tropicana</A>:~# perf script -l
List of available trace scripts:
workqueue-stats workqueue stats (ins/exe/create/destroy)
wakeup-latency system-wide min/max/avg wakeup latency
rw-by-file <comm> r/w activity for a program, by file
rw-by-pid system-wide r/w activity
.ft
</PRE>
</DL>
<P>
A nice side effect of doing this is that you also then capture the probably lengthy <I>perf record</I> command needed to record the events for the script.
<P>
To have the script appear as a <I>built-in</I> script, you write two simple scripts, one for recording and one for <I>reporting</I>.
<P>
The <I>record</I> script is a shell script with the same base name as your script, but with -record appended. The shell script should be put into the perf/scripts/python/bin directory in the kernel source tree. In that script, you write the <I>perf record</I> command-line needed for your script:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
# cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-record
#!/bin/bash
perf record -a -e raw_syscalls:sys_enter
.ft
</PRE>
</DL>
<P>
The <I>report</I> script is also a shell script with the same base name as your script, but with -report appended. It should also be located in the perf/scripts/python/bin directory. In that script, you write the <I>perf script -s</I> command-line needed for running your script:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
# cat kernel-source/tools/perf/scripts/python/bin/syscall-counts-report
#!/bin/bash
# description: system-wide syscall counts
perf script -s ~/libexec/perf-core/scripts/python/syscall-counts.py
.ft
</PRE>
</DL>
<P>
Note that the location of the Python script given in the shell script is in the libexec/perf-core/scripts/python directory - this is where the script will be copied by <I>make install</I> when you install perf. For the installation to install your script there, your script needs to be located in the perf/scripts/python directory in the kernel source tree:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
# ls -al kernel-source/tools/perf/scripts/python
<A HREF="mailto:root@tropicana">root@tropicana</A>:/home/trz/src/tip# ls -al tools/perf/scripts/python
total 32
drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
drwxr-xr-x 2 trz trz 4096 2010-01-26 22:29 bin
-rw-r--r-- 1 trz trz 2548 2010-01-26 22:29 check-perf-script.py
drwxr-xr-x 3 trz trz 4096 2010-01-26 22:49 perf-script-Util
-rw-r--r-- 1 trz trz 1462 2010-01-26 22:30 syscall-counts.py
.ft
</PRE>
</DL>
<P>
Once youcqve done that (doncqt forget to do a new <I>make install</I>, otherwise your script woncqt show up at run-time), <I>perf script -l</I> should show a new entry for your script:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
<A HREF="mailto:root@tropicana">root@tropicana</A>:~# perf script -l
List of available trace scripts:
workqueue-stats workqueue stats (ins/exe/create/destroy)
wakeup-latency system-wide min/max/avg wakeup latency
rw-by-file <comm> r/w activity for a program, by file
rw-by-pid system-wide r/w activity
syscall-counts system-wide syscall counts
.ft
</PRE>
</DL>
<P>
You can now perform the record step via <I>perf script record</I>:
<P>
<DL COMPACT><DT><DD>
<PRE>
# perf script record syscall-counts
</PRE>
</DL>
<P>
and display the output using <I>perf script report</I>:
<P>
<DL COMPACT><DT><DD>
<PRE>
# perf script report syscall-counts
</PRE>
</DL>
<A NAME="lbAF"> </A>
<H2>STARTER SCRIPTS</H2>
<P>
You can quickly get started writing a script for a particular set of trace data by generating a skeleton script using <I>perf script -g python</I> in the same directory as an existing perf.data trace file. That will generate a starter script containing a handler for each of the event types in the trace file; it simply prints every available field for each event in the trace file.
<P>
You can also look at the existing scripts in ~/libexec/perf-core/scripts/python for typical examples showing how to do basic things like aggregate event data, print results, etc. Also, the check-perf-script.py script, while not interesting for its results, attempts to exercise all of the main scripting features.
<A NAME="lbAG"> </A>
<H2>EVENT HANDLERS</H2>
<P>
When perf script is invoked using a trace script, a user-defined <I>handler function</I> is called for each event in the trace. If therecqs no handler function defined for a given event type, the event is ignored (or passed to a <I>trace_handled</I> function, see below) and the next event is processed.
<P>
Most of the eventcqs field values are passed as arguments to the handler function; some of the less common ones arencqt - those are available as calls back into the perf executable (see below).
<P>
As an example, the following perf record command can be used to record all sched_wakeup events in the system:
<P>
<DL COMPACT><DT><DD>
<PRE>
# perf record -a -e sched:sched_wakeup
</PRE>
</DL>
<P>
Traces meant to be processed using a script should be recorded with the above option: -a to enable system-wide collection.
<P>
The format file for the sched_wakep event defines the following fields (see /sys/kernel/debug/tracing/events/sched/sched_wakeup/format):
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
format:
field:unsigned short common_type;
field:unsigned char common_flags;
field:unsigned char common_preempt_count;
field:int common_pid;
field:int common_lock_depth;
field:char comm[TASK_COMM_LEN];
field:pid_t pid;
field:int prio;
field:int success;
field:int target_cpu;
.ft
</PRE>
</DL>
<P>
The handler function for this event would be defined as:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
def sched__sched_wakeup(event_name, context, common_cpu, common_secs,
common_nsecs, common_pid, common_comm,
comm, pid, prio, success, target_cpu):
pass
.ft
</PRE>
</DL>
<P>
The handler function takes the form subsystem__event_name.
<P>
The common_* arguments in the handlercqs argument list are the set of arguments passed to all event handlers; some of the fields correspond to the common_* fields in the format file, but some are synthesized, and some of the common_* fields arencqt common enough to to be passed to every event as arguments but are available as library functions.
<P>
Herecqs a brief description of each of the invariant event args:
<P>
<DL COMPACT><DT><DD>
<PRE>
event_name the name of the event as text
context an opaque 'cookie' used in calls back into perf
common_cpu the cpu the event occurred on
common_secs the secs portion of the event timestamp
common_nsecs the nsecs portion of the event timestamp
common_pid the pid of the current task
common_comm the name of the current process
</PRE>
</DL>
<P>
All of the remaining fields in the eventcqs format file have counterparts as handler function arguments of the same name, as can be seen in the example above.
<P>
The above provides the basics needed to directly access every field of every event in a trace, which covers 90% of what you need to know to write a useful trace script. The sections below cover the rest.
<A NAME="lbAH"> </A>
<H2>SCRIPT LAYOUT</H2>
<P>
Every perf script Python script should start by setting up a Python module search path and 'importcqing a few support modules (see module descriptions below):
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/perf-script-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
.ft
</PRE>
</DL>
<P>
The rest of the script can contain handler functions and support functions in any order.
<P>
Aside from the event handler functions discussed above, every script can implement a set of optional functions:
<P>
<B>trace_begin</B>, if defined, is called before any event is processed and gives scripts a chance to do setup tasks:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
def trace_begin:
pass
.ft
</PRE>
</DL>
<P>
<B>trace_end</B>, if defined, is called after all events have been processed and gives scripts a chance to do end-of-script tasks, such as display results:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
def trace_end:
pass
.ft
</PRE>
</DL>
<P>
<B>trace_unhandled</B>, if defined, is called after for any event that doesncqt have a handler explicitly defined for it. The standard set of common arguments are passed into it:
<P>
<DL COMPACT><DT><DD>
<PRE>
.ft C
def trace_unhandled(event_name, context, common_cpu, common_secs,
common_nsecs, common_pid, common_comm):
pass
.ft
</PRE>
</DL>
<P>
The remaining sections provide descriptions of each of the available built-in perf script Python modules and their associated functions.
<A NAME="lbAI"> </A>
<H2>AVAILABLE MODULES AND FUNCTIONS</H2>
<P>
The following sections describe the functions and variables available via the various perf script Python modules. To use the functions and variables from the given module, add the corresponding <I>from XXXX import</I> line to your perf script script.
<A NAME="lbAJ"> </A>
<H3>Core.py Module</H3>
<P>
These functions provide some essential functions to user scripts.
<P>
The <B>flag_str</B> and <B>symbol_str</B> functions provide human-readable strings for flag and symbolic fields. These correspond to the strings and values parsed from the <I>print fmt</I> fields of the event format files:
<P>
<DL COMPACT><DT><DD>
<PRE>
flag_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the flag field field_name of event event_name
symbol_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the symbolic field field_name of event event_name
</PRE>
</DL>
<P>
The <B>autodict</B> function returns a special kind of Python dictionary that implements Perlcqs <I>autovivifying</I> hashes in Python i.e. with autovivifying hashes, you can assign nested hash values without having to go to the trouble of creating intermediate levels if they doncqt exist.
<P>
<DL COMPACT><DT><DD>
<PRE>
autodict() - returns an autovivifying dictionary instance
</PRE>
</DL>
<A NAME="lbAK"> </A>
<H3>perf_trace_context Module</H3>
<P>
Some of the <I>common</I> fields in the event format file arencqt all that common, but need to be made accessible to user scripts nonetheless.
<P>
perf_trace_context defines a set of functions that can be used to access this data in the context of the current event. Each of these functions expects a context variable, which is the same as the context variable passed into every event handler as the second argument.
<P>
<DL COMPACT><DT><DD>
<PRE>
common_pc(context) - returns common_preempt count for the current event
common_flags(context) - returns common_flags for the current event
common_lock_depth(context) - returns common_lock_depth for the current event
</PRE>
</DL>
<A NAME="lbAL"> </A>
<H3>Util.py Module</H3>
<P>
Various utility functions for use with perf script:
<P>
<DL COMPACT><DT><DD>
<PRE>
nsecs(secs, nsecs) - returns total nsecs given secs/nsecs pair
nsecs_secs(nsecs) - returns whole secs portion given nsecs
nsecs_nsecs(nsecs) - returns nsecs remainder given nsecs
nsecs_str(nsecs) - returns printable string in the form secs.nsecs
avg(total, n) - returns average given a sum and a total number of values
</PRE>
</DL>
<A NAME="lbAM"> </A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/manpages/index.html?1+perf-script">perf-script</A></B>(1)
<P>
<HR>
<A NAME="index"> </A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">A QUICK EXAMPLE</A><DD>
<DT><A HREF="#lbAF">STARTER SCRIPTS</A><DD>
<DT><A HREF="#lbAG">EVENT HANDLERS</A><DD>
<DT><A HREF="#lbAH">SCRIPT LAYOUT</A><DD>
<DT><A HREF="#lbAI">AVAILABLE MODULES AND FUNCTIONS</A><DD>
<DL>
<DT><A HREF="#lbAJ">Core.py Module</A><DD>
<DT><A HREF="#lbAK">perf_trace_context Module</A><DD>
<DT><A HREF="#lbAL">Util.py Module</A><DD>
</DL>
<DT><A HREF="#lbAM">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/manpages/index.html">man2html</A>,
using the manual pages.<BR>
Time: 05:29:07 GMT, December 24, 2015
</div></div>
</body>
</HTML>
| {
"content_hash": "da7f62c3355610088af047f31672b50c",
"timestamp": "",
"source": "github",
"line_count": 889,
"max_line_length": 659,
"avg_line_length": 30.98650168728909,
"alnum_prop": 0.6818891349330236,
"repo_name": "yuweijun/yuweijun.github.io",
"id": "fce321385b7e0614e3a3416a5cea34f8a223cd7e",
"size": "27547",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "manpages/man1/perf-script-python.1.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "589062"
},
{
"name": "CSS",
"bytes": "86538"
},
{
"name": "Go",
"bytes": "2652"
},
{
"name": "HTML",
"bytes": "126806134"
},
{
"name": "JavaScript",
"bytes": "12389716"
},
{
"name": "Perl",
"bytes": "7390"
},
{
"name": "PostScript",
"bytes": "32036"
},
{
"name": "Ruby",
"bytes": "8626"
},
{
"name": "Shell",
"bytes": "193"
},
{
"name": "Vim Script",
"bytes": "209"
},
{
"name": "XSLT",
"bytes": "7176"
}
],
"symlink_target": ""
} |
package ru.abelov.stream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
/**
* Realizing class StreamSymbolRemover, that removes from InputStream Strings from an array.
* @author Aleksandr Belov
* @since 27.11.2016
*/
public class StreamSymbolRemover {
/**
* Method dropAbuses().
* Reads InputStream, checks if it contains coincidences with slots of String[].
* If it contains, removes it and writes data to OutputStream.
* @param in - incoming stream to check for coincidences.
* @param out - outcome stream with result.
* @param abuse - substring to check incoming stream.
*/
void dropAbuses(InputStream in, OutputStream out, String[] abuse) {
String data = null;
String abuseArraySlot = null;
try (BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
while ((data = br.readLine()) != null) {
for (String abuseSlot : abuse) {
abuseArraySlot = abuseSlot;
if (data.contains(abuseArraySlot)) {
data = removeSubstringFromString(data, abuseArraySlot);
}
}
out.write(data.getBytes());
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
/**
* Method removeSubstringDataFromString().
* Removes substring from String.
* @param data - string to remove substring.
* @param abuse - substring.
* @return String without substring.
*/
String removeSubstringFromString(String data, String abuse) {
String abusedData = data.replace(abuse, "");
return abusedData;
}
}
| {
"content_hash": "ed003c48f4e8fd8afa79dffe7db27115",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 92,
"avg_line_length": 28.5,
"alnum_prop": 0.706766917293233,
"repo_name": "xcyde/Java-A-to-Z",
"id": "9152de5429edbd244fd48dc59cadcb93aa7d75dd",
"size": "1596",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chapter_003/part_002/src/main/java/ru/abelov/stream/StreamSymbolRemover.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "600285"
},
{
"name": "XSLT",
"bytes": "597"
}
],
"symlink_target": ""
} |
module.exports = function (config) {
config.set({
browsers: ['Firefox'],
frameworks: ['browserify', 'mocha'],
reporters: ['mocha', 'coverage'],
preprocessors: { 'build/*.js': ['browserify'] },
browserify: { debug: true, transform: ['browserify-css', 'browserify-istanbul'] },
files: ['build/*.js'],
coverageReporter: {
reporters : [
{ 'type': 'text' },
{ 'type': 'lcov', dir: 'coverage' },
{ 'type': 'html', dir: 'coverage' }
]
},
port: 9876,
colors: true,
singleRun: true,
logLevel: config.LOG_INFO
});
};
| {
"content_hash": "2f8c6b0a71d541ee150d4f799b135f82",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 86,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.5411764705882353,
"repo_name": "dwillmer/phosphor-widget",
"id": "7401d31dbb17ff78c83dc888e8e78eae01273166",
"size": "595",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/karma-cov.conf.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "575"
},
{
"name": "JavaScript",
"bytes": "1053"
},
{
"name": "Shell",
"bytes": "944"
},
{
"name": "TypeScript",
"bytes": "152275"
}
],
"symlink_target": ""
} |
package org.bouncycastle.asn1;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import org.bouncycastle.util.Arrays;
public class DERObjectIdentifier
extends ASN1Primitive
{
String identifier;
private byte[] body;
/**
* return an OID from the passed in object
*
* @throws IllegalArgumentException if the object cannot be converted.
*/
public static ASN1ObjectIdentifier getInstance(
Object obj)
{
if (obj == null || obj instanceof ASN1ObjectIdentifier)
{
return (ASN1ObjectIdentifier)obj;
}
if (obj instanceof DERObjectIdentifier)
{
return new ASN1ObjectIdentifier(((DERObjectIdentifier)obj).getId());
}
if (obj instanceof ASN1Encodable && ((ASN1Encodable)obj).toASN1Primitive() instanceof ASN1ObjectIdentifier)
{
return (ASN1ObjectIdentifier)((ASN1Encodable)obj).toASN1Primitive();
}
if (obj instanceof byte[])
{
return ASN1ObjectIdentifier.fromOctetString((byte[])obj);
}
throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
}
/**
* return an Object Identifier from a tagged object.
*
* @param obj the tagged object holding the object we want
* @param explicit true if the object is meant to be explicitly
* tagged false otherwise.
* @throws IllegalArgumentException if the tagged object cannot
* be converted.
*/
public static ASN1ObjectIdentifier getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
ASN1Primitive o = obj.getObject();
if (explicit || o instanceof DERObjectIdentifier)
{
return getInstance(o);
}
else
{
return ASN1ObjectIdentifier.fromOctetString(ASN1OctetString.getInstance(obj.getObject()).getOctets());
}
}
private static final long LONG_LIMIT = (Long.MAX_VALUE >> 7) - 0x7f;
DERObjectIdentifier(
byte[] bytes)
{
StringBuffer objId = new StringBuffer();
long value = 0;
BigInteger bigValue = null;
boolean first = true;
for (int i = 0; i != bytes.length; i++)
{
int b = bytes[i] & 0xff;
if (value <= LONG_LIMIT)
{
value += (b & 0x7f);
if ((b & 0x80) == 0) // end of number reached
{
if (first)
{
if (value < 40)
{
objId.append('0');
}
else if (value < 80)
{
objId.append('1');
value -= 40;
}
else
{
objId.append('2');
value -= 80;
}
first = false;
}
objId.append('.');
objId.append(value);
value = 0;
}
else
{
value <<= 7;
}
}
else
{
if (bigValue == null)
{
bigValue = BigInteger.valueOf(value);
}
bigValue = bigValue.or(BigInteger.valueOf(b & 0x7f));
if ((b & 0x80) == 0)
{
if (first)
{
objId.append('2');
bigValue = bigValue.subtract(BigInteger.valueOf(80));
first = false;
}
objId.append('.');
objId.append(bigValue);
bigValue = null;
value = 0;
}
else
{
bigValue = bigValue.shiftLeft(7);
}
}
}
// BEGIN android-changed
/*
* Intern the identifier so there aren't hundreds of duplicates
* (in practice).
*/
this.identifier = objId.toString().intern();
// END android-changed
this.body = Arrays.clone(bytes);
}
public DERObjectIdentifier(
String identifier)
{
if (identifier == null)
{
throw new IllegalArgumentException("'identifier' cannot be null");
}
if (!isValidIdentifier(identifier))
{
throw new IllegalArgumentException("string " + identifier + " not an OID");
}
// BEGIN android-changed
/*
* Intern the identifier so there aren't hundreds of duplicates
* (in practice).
*/
this.identifier = identifier.intern();
// END android-changed
}
DERObjectIdentifier(DERObjectIdentifier oid, String branchID)
{
if (!isValidBranchID(branchID, 0))
{
throw new IllegalArgumentException("string " + branchID + " not a valid OID branch");
}
this.identifier = oid.getId() + "." + branchID;
}
public String getId()
{
return identifier;
}
private void writeField(
ByteArrayOutputStream out,
long fieldValue)
{
byte[] result = new byte[9];
int pos = 8;
result[pos] = (byte)((int)fieldValue & 0x7f);
while (fieldValue >= (1L << 7))
{
fieldValue >>= 7;
result[--pos] = (byte)((int)fieldValue & 0x7f | 0x80);
}
out.write(result, pos, 9 - pos);
}
private void writeField(
ByteArrayOutputStream out,
BigInteger fieldValue)
{
int byteCount = (fieldValue.bitLength() + 6) / 7;
if (byteCount == 0)
{
out.write(0);
}
else
{
BigInteger tmpValue = fieldValue;
byte[] tmp = new byte[byteCount];
for (int i = byteCount - 1; i >= 0; i--)
{
tmp[i] = (byte)((tmpValue.intValue() & 0x7f) | 0x80);
tmpValue = tmpValue.shiftRight(7);
}
tmp[byteCount - 1] &= 0x7f;
out.write(tmp, 0, tmp.length);
}
}
private void doOutput(ByteArrayOutputStream aOut)
{
OIDTokenizer tok = new OIDTokenizer(identifier);
int first = Integer.parseInt(tok.nextToken()) * 40;
String secondToken = tok.nextToken();
if (secondToken.length() <= 18)
{
writeField(aOut, first + Long.parseLong(secondToken));
}
else
{
writeField(aOut, new BigInteger(secondToken).add(BigInteger.valueOf(first)));
}
while (tok.hasMoreTokens())
{
String token = tok.nextToken();
if (token.length() <= 18)
{
writeField(aOut, Long.parseLong(token));
}
else
{
writeField(aOut, new BigInteger(token));
}
}
}
protected synchronized byte[] getBody()
{
if (body == null)
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
doOutput(bOut);
body = bOut.toByteArray();
}
return body;
}
boolean isConstructed()
{
return false;
}
int encodedLength()
throws IOException
{
int length = getBody().length;
return 1 + StreamUtil.calculateBodyLength(length) + length;
}
void encode(
ASN1OutputStream out)
throws IOException
{
byte[] enc = getBody();
out.write(BERTags.OBJECT_IDENTIFIER);
out.writeLength(enc.length);
out.write(enc);
}
public int hashCode()
{
return identifier.hashCode();
}
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof DERObjectIdentifier))
{
return false;
}
return identifier.equals(((DERObjectIdentifier)o).identifier);
}
public String toString()
{
return getId();
}
private static boolean isValidBranchID(
String branchID, int start)
{
boolean periodAllowed = false;
int pos = branchID.length();
while (--pos >= start)
{
char ch = branchID.charAt(pos);
// TODO Leading zeroes?
if ('0' <= ch && ch <= '9')
{
periodAllowed = true;
continue;
}
if (ch == '.')
{
if (!periodAllowed)
{
return false;
}
periodAllowed = false;
continue;
}
return false;
}
return periodAllowed;
}
private static boolean isValidIdentifier(
String identifier)
{
if (identifier.length() < 3 || identifier.charAt(1) != '.')
{
return false;
}
char first = identifier.charAt(0);
if (first < '0' || first > '2')
{
return false;
}
return isValidBranchID(identifier, 2);
}
private static ASN1ObjectIdentifier[][] cache = new ASN1ObjectIdentifier[256][];
static ASN1ObjectIdentifier fromOctetString(byte[] enc)
{
if (enc.length < 3)
{
return new ASN1ObjectIdentifier(enc);
}
int idx1 = enc[enc.length - 2] & 0xff;
// in this case top bit is always zero
int idx2 = enc[enc.length - 1] & 0x7f;
ASN1ObjectIdentifier possibleMatch;
synchronized (cache)
{
ASN1ObjectIdentifier[] first = cache[idx1];
if (first == null)
{
first = cache[idx1] = new ASN1ObjectIdentifier[128];
}
possibleMatch = first[idx2];
if (possibleMatch == null)
{
return first[idx2] = new ASN1ObjectIdentifier(enc);
}
if (Arrays.areEqual(enc, possibleMatch.getBody()))
{
return possibleMatch;
}
idx1 = (idx1 + 1) & 0xff;
first = cache[idx1];
if (first == null)
{
first = cache[idx1] = new ASN1ObjectIdentifier[128];
}
possibleMatch = first[idx2];
if (possibleMatch == null)
{
return first[idx2] = new ASN1ObjectIdentifier(enc);
}
if (Arrays.areEqual(enc, possibleMatch.getBody()))
{
return possibleMatch;
}
idx2 = (idx2 + 1) & 0x7f;
possibleMatch = first[idx2];
if (possibleMatch == null)
{
return first[idx2] = new ASN1ObjectIdentifier(enc);
}
}
if (Arrays.areEqual(enc, possibleMatch.getBody()))
{
return possibleMatch;
}
return new ASN1ObjectIdentifier(enc);
}
}
| {
"content_hash": "552af40968c3439f368c93bd3fdcd12e",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 115,
"avg_line_length": 26.08695652173913,
"alnum_prop": 0.4776315789473684,
"repo_name": "indashnet/InDashNet.Open.UN2000",
"id": "13e1195d6fba1f6d3183a5ebb49a29e921a508e2",
"size": "11400",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android/external/bouncycastle/bcprov/src/main/java/org/bouncycastle/asn1/DERObjectIdentifier.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("08. Upgraded Matcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("08. Upgraded Matcher")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9c9d363f-8a88-4f14-9c75-d32b9e8d2c31")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "008424429e96c008b42eca3b49ab8d47",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.111111111111114,
"alnum_prop": 0.7464488636363636,
"repo_name": "metodiobetsanov/Tech-Module-CSharp",
"id": "e98bd9b809ce7e3e18d4a1c8a09f623df98994bb",
"size": "1411",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tech Module/Programming Fundamentals/CSharp/Arrays and Methods - More Exercises/08. Upgraded Matcher/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "511022"
}
],
"symlink_target": ""
} |
package com.intellij.psi.impl;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.graphInference.InferenceBound;
import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
import com.intellij.psi.impl.source.resolve.graphInference.InferenceVariable;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.JavaClassSupers;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author peter
*/
public class JavaClassSupersImpl extends JavaClassSupers {
@Nullable
public PsiSubstitutor getSuperClassSubstitutor(@NotNull PsiClass superClass,
@NotNull PsiClass derivedClass,
@NotNull GlobalSearchScope scope,
@NotNull PsiSubstitutor derivedSubstitutor) {
if (InheritanceImplUtil.hasObjectQualifiedName(superClass)) return PsiSubstitutor.EMPTY;
if (!(derivedClass instanceof PsiTypeParameter)) {
List<PsiType> bounds = null;
if (superClass instanceof InferenceVariable) {
bounds = ((InferenceVariable)superClass).getBounds(InferenceBound.LOWER);
}
else if (superClass instanceof PsiTypeParameter) {
final PsiType lowerBound = superClass.getUserData(InferenceSession.LOWER_BOUND);
if (lowerBound != null) {
bounds = Collections.singletonList(lowerBound);
}
}
if (bounds != null) {
for (PsiType lowerBound : bounds) {
final PsiSubstitutor substitutor = processLowerBound(lowerBound, derivedClass, scope, derivedSubstitutor);
if (substitutor != null) {
return substitutor;
}
}
}
}
return derivedClass instanceof PsiTypeParameter
? processTypeParameter((PsiTypeParameter)derivedClass, scope, superClass, ContainerUtil.<PsiTypeParameter>newTroveSet(), derivedSubstitutor)
: getSuperSubstitutorWithCaching(superClass, derivedClass, scope, derivedSubstitutor);
}
private static PsiSubstitutor processLowerBound(@NotNull PsiType lowerBound,
@NotNull PsiClass derivedClass,
@NotNull GlobalSearchScope scope,
@NotNull PsiSubstitutor derivedSubstitutor) {
if (lowerBound instanceof PsiClassType) {
final PsiClassType.ClassResolveResult result = ((PsiClassType)lowerBound).resolveGenerics();
final PsiClass boundClass = result.getElement();
if (boundClass != null) {
final PsiSubstitutor substitutor = getSuperSubstitutorWithCaching(boundClass,
derivedClass, scope, result.getSubstitutor());
if (substitutor != null) {
return composeSubstitutors(derivedSubstitutor, substitutor, boundClass);
}
}
}
else if (lowerBound instanceof PsiIntersectionType) {
for (PsiType bound : ((PsiIntersectionType)lowerBound).getConjuncts()) {
final PsiSubstitutor substitutor = processLowerBound(bound, derivedClass, scope, derivedSubstitutor);
if (substitutor != null) {
return substitutor;
}
}
}
return null;
}
@Nullable
private static PsiSubstitutor getSuperSubstitutorWithCaching(@NotNull PsiClass superClass,
@NotNull PsiClass derivedClass,
@NotNull GlobalSearchScope resolveScope,
@NotNull PsiSubstitutor derivedSubstitutor) {
PsiSubstitutor substitutor = ScopedClassHierarchy.getSuperClassSubstitutor(derivedClass, resolveScope, superClass);
if (substitutor == null) return null;
if (PsiUtil.isRawSubstitutor(derivedClass, derivedSubstitutor)) return createRawSubstitutor(superClass);
return composeSubstitutors(derivedSubstitutor, substitutor, superClass);
}
@NotNull
static PsiSubstitutor createRawSubstitutor(@NotNull PsiClass superClass) {
return JavaPsiFacade.getElementFactory(superClass.getProject()).createRawSubstitutor(superClass);
}
@NotNull
private static PsiSubstitutor composeSubstitutors(PsiSubstitutor outer, PsiSubstitutor inner, PsiClass onClass) {
PsiSubstitutor answer = PsiSubstitutor.EMPTY;
Map<PsiTypeParameter, PsiType> outerMap = outer.getSubstitutionMap();
Map<PsiTypeParameter, PsiType> innerMap = inner.getSubstitutionMap();
for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable(onClass)) {
if (outerMap.containsKey(parameter) || innerMap.containsKey(parameter)) {
answer = answer.put(parameter, outer.substitute(inner.substitute(parameter)));
}
}
return answer;
}
/**
* Some type parameters (e.g. {@link com.intellij.psi.impl.source.resolve.graphInference.InferenceVariable} change their supers at will,
* so caching the hierarchy is impossible.
*/
@Nullable
private static PsiSubstitutor processTypeParameter(PsiTypeParameter parameter,
GlobalSearchScope scope,
PsiClass superClass,
Set<PsiTypeParameter> visited,
PsiSubstitutor derivedSubstitutor) {
if (parameter.getManager().areElementsEquivalent(parameter, superClass)) return PsiSubstitutor.EMPTY;
if (!visited.add(parameter)) return null;
for (PsiClassType type : parameter.getExtendsListTypes()) {
PsiClassType.ClassResolveResult result = type.resolveGenerics();
PsiClass psiClass = result.getElement();
if (psiClass == null) continue;
PsiSubstitutor answer;
if (psiClass instanceof PsiTypeParameter) {
answer = processTypeParameter((PsiTypeParameter)psiClass, scope, superClass, visited, derivedSubstitutor);
if (answer != null) {
return answer;
}
}
else {
answer = getSuperSubstitutorWithCaching(superClass, psiClass, scope, result.getSubstitutor());
if (answer != null) {
return composeSubstitutors(derivedSubstitutor, answer, superClass);
}
}
}
return null;
}
}
| {
"content_hash": "da7cb5cad432eb438287381cf7406bbc",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 151,
"avg_line_length": 44.73154362416108,
"alnum_prop": 0.654913728432108,
"repo_name": "MER-GROUP/intellij-community",
"id": "809417d62663055092da9cf4240ece7ffb6305f8",
"size": "7265",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "java/java-psi-impl/src/com/intellij/psi/impl/JavaClassSupersImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "63554"
},
{
"name": "C",
"bytes": "214994"
},
{
"name": "C#",
"bytes": "1538"
},
{
"name": "C++",
"bytes": "190765"
},
{
"name": "CSS",
"bytes": "164277"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Cucumber",
"bytes": "14382"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "FLUX",
"bytes": "57"
},
{
"name": "Groff",
"bytes": "35232"
},
{
"name": "Groovy",
"bytes": "2368473"
},
{
"name": "HTML",
"bytes": "1756000"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "153635614"
},
{
"name": "JavaScript",
"bytes": "141020"
},
{
"name": "Jupyter Notebook",
"bytes": "92629"
},
{
"name": "Kotlin",
"bytes": "1298939"
},
{
"name": "Lex",
"bytes": "166321"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "88100"
},
{
"name": "Objective-C",
"bytes": "28878"
},
{
"name": "Perl6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6570"
},
{
"name": "Python",
"bytes": "23161125"
},
{
"name": "Ruby",
"bytes": "1213"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "64460"
},
{
"name": "Smalltalk",
"bytes": "64"
},
{
"name": "TeX",
"bytes": "62325"
},
{
"name": "TypeScript",
"bytes": "6152"
},
{
"name": "XSLT",
"bytes": "113040"
}
],
"symlink_target": ""
} |
import winston from 'winston';
import mongoose from 'mongoose';
// Overwrite mongoose promise module
mongoose.Promise = Promise;
/**
* Product Schema
*/
const ProductSchema = new mongoose.Schema({
// Description: Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles.
productId: {
type: String,
lowercase: false,
uppercase: false,
trim: null,
match: null,
enum: null,
minlength: null,
maxlength: null,
required: false,
default: false,
select: false,
validate: null,
get: null,
set: null,
unique: false,
sparse: false
},
// Description: Description of product.
description: {
type: String,
lowercase: false,
uppercase: false,
trim: null,
match: null,
enum: null,
minlength: null,
maxlength: null,
required: false,
default: false,
select: false,
validate: null,
get: null,
set: null,
unique: false,
sparse: false
},
// Description: Display name of product.
displayName: {
type: String,
lowercase: false,
uppercase: false,
trim: null,
match: null,
enum: null,
minlength: null,
maxlength: null,
required: false,
default: false,
select: false,
validate: null,
get: null,
set: null,
unique: false,
sparse: false
},
// Description: Capacity of product. For example, 4 people.
capacity: {
type: String,
lowercase: false,
uppercase: false,
trim: null,
match: null,
enum: null,
minlength: null,
maxlength: null,
required: false,
default: false,
select: false,
validate: null,
get: null,
set: null,
unique: false,
sparse: false
},
// Description: Image URL representing the product.
image: {
type: String,
lowercase: false,
uppercase: false,
trim: null,
match: null,
enum: null,
minlength: null,
maxlength: null,
required: false,
default: false,
select: false,
validate: null,
get: null,
set: null,
unique: false,
sparse: false
}
}, {
collection: 'products',
autoIndex: true,
minimize: false,
timestamps: true
});
/**
* Methods
*/
ProductSchema.methods.findSimilarParam = () => new Promise((resolve, reject) => {
this.model('Product').find({ param: this.param }, (err, res) => {
if (err) {
reject(err);
}
resolve(res);
});
});
/**
* Statics
*/
ProductSchema.statics.findByParam = param => new Promise((resolve, reject) => {
this.find({ param: new RegExp(param, 'ig') }, (err, res) => {
if (err) {
reject(err);
}
resolve(res);
});
});
/**
* Query Helpers
*/
ProductSchema.query.byParam = param => this.find({ param: new RegExp(param, 'ig') });
/**
* Indexes
*/
ProductSchema.index({ param: 1, type: -1 });
/**
* Virtuals
*/
ProductSchema.virtual('fullName')
.get(() => `${this.name.first} ${this.name.last}`)
.set((fullName) => {
this.name.first = fullName.substr(0, fullName.indexOf(' '));
this.name.last = fullName.substr(fullName.indexOf(' ') + 1);
});
/**
* Pre Middleware
*/
ProductSchema.pre('init', (next) => {
// do something before a document is returned from mongodb
next(); // if no errors, else call next(err)
});
ProductSchema.pre('validate', (next) => {
// do something before executing registered validation rules for this document
next(); // if no errors, else call next(err)
});
ProductSchema.pre('save', (next) => {
// do something before saving this document
next(); // if no errors, else call next(err)
});
ProductSchema.pre('remove', (next) => {
// do something before removing this document
next(); // if no errors, else call next(err)
});
/**
* Post Middleware
*/
ProductSchema.post('init', (doc) => {
// do something after
winston.log('info', 'Document with _id %s initiated', doc._id);
});
ProductSchema.post('validate', (doc) => {
// do something after
winston.log('info', 'Document with _id %s validated', doc._id);
});
ProductSchema.post('save', (doc) => {
// do something after
winston.log('info', 'Document with _id %s saved', doc._id);
});
ProductSchema.post('remove', (doc) => {
// do something after
winston.log('info', 'Document with _id %s removed', doc._id);
});
/**
* @typedef Product
*/
export default mongoose.model('Product', ProductSchema);
| {
"content_hash": "471ed5fff13cf2a60c78ec78f1377367",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 201,
"avg_line_length": 21.703883495145632,
"alnum_prop": 0.61954819950794,
"repo_name": "engie-factory/mongoose-schemas-generator",
"id": "20233d7f11bf9c6c3f19504d33ce3d2a5ffb0d36",
"size": "4471",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/resources/models/Product.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "129228"
}
],
"symlink_target": ""
} |
package org.keycloak.example.oauth;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.keycloak.KeycloakSecurityContext;
import org.keycloak.adapters.AdapterUtils;
import org.keycloak.adapters.ServerRequest;
import org.keycloak.representations.AccessTokenResponse;
import org.keycloak.servlet.ServletOAuthClient;
import org.keycloak.util.JsonSerialization;
import org.keycloak.util.UriUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class ProductDatabaseClient {
public static class Failure extends Exception {
private int status;
public Failure(int status) {
this.status = status;
}
public int getStatus() {
return status;
}
}
public static void redirect(HttpServletRequest request, HttpServletResponse response) {
// The ServletOAuthClient is obtained by getting a context attribute
// that is set in the Bootstrap context listener in this project.
// You really should come up with a better way to initialize
// and obtain the ServletOAuthClient. I actually suggest downloading the ServletOAuthClient code
// and take a look how it works. You can also take a look at third-party-cdi example
ServletOAuthClient oAuthClient = (ServletOAuthClient) request.getServletContext().getAttribute(ServletOAuthClient.class.getName());
try {
oAuthClient.redirectRelative("pull_data.jsp", request, response);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
static class TypedList extends ArrayList<String> {}
public static AccessTokenResponse getTokenResponse(HttpServletRequest request) {
// The ServletOAuthClient is obtained by getting a context attribute
// that is set in the Bootstrap context listener in this project.
// You really should come up with a better way to initialize
// and obtain the ServletOAuthClient. I actually suggest downloading the ServletOAuthClient code
// and take a look how it works. You can also take a look at third-party-cdi example
ServletOAuthClient oAuthClient = (ServletOAuthClient) request.getServletContext().getAttribute(ServletOAuthClient.class.getName());
try {
return oAuthClient.getBearerToken(request);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ServerRequest.HttpFailure failure) {
throw new RuntimeException(failure);
}
}
public static List<String> getProducts(HttpServletRequest request, String accessToken) throws Failure {
KeycloakSecurityContext session = (KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName());
// The ServletOAuthClient is obtained by getting a context attribute
// that is set in the Bootstrap context listener in this project.
// You really should come up with a better way to initialize
// and obtain the ServletOAuthClient. I actually suggest downloading the ServletOAuthClient code
// and take a look how it works. You can also take a look at third-party-cdi example
ServletOAuthClient oAuthClient = (ServletOAuthClient) request.getServletContext().getAttribute(ServletOAuthClient.class.getName());
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(AdapterUtils.getOriginForRestCalls(request.getRequestURL().toString(), session) + "/database/products");
get.addHeader("Authorization", "Bearer " + accessToken);
try {
HttpResponse response = client.execute(get);
if (response.getStatusLine().getStatusCode() != 200) {
throw new Failure(response.getStatusLine().getStatusCode());
}
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
try {
return JsonSerialization.readValue(is, TypedList.class);
} finally {
is.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static String getBaseUrl(ServletOAuthClient oAuthClient, HttpServletRequest request) {
switch (oAuthClient.getRelativeUrlsUsed()) {
case ALL_REQUESTS:
// Resolve baseURI from the request
return UriUtils.getOrigin(request.getRequestURL().toString());
case BROWSER_ONLY:
// Resolve baseURI from the codeURL (This is already non-relative and based on our hostname)
return UriUtils.getOrigin(oAuthClient.getTokenUrl());
case NEVER:
return "";
default:
return "";
}
}
}
| {
"content_hash": "6180bfbe9ebd349684be958e26822edc",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 139,
"avg_line_length": 44.641666666666666,
"alnum_prop": 0.6708978906104163,
"repo_name": "cmoulliard/keycloak",
"id": "b0e0e00af8da2dd5f43c73e5b1e178dde8abce88",
"size": "5357",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "examples/demo-template/third-party/src/main/java/org/keycloak/example/oauth/ProductDatabaseClient.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "22819"
},
{
"name": "CSS",
"bytes": "549903"
},
{
"name": "HTML",
"bytes": "353305"
},
{
"name": "Java",
"bytes": "7452851"
},
{
"name": "JavaScript",
"bytes": "1281327"
},
{
"name": "Shell",
"bytes": "10703"
},
{
"name": "XSLT",
"bytes": "6012"
}
],
"symlink_target": ""
} |
class CBaseUIContainer;
class CBaseUIScrollView : public CBaseUIElement
{
public:
CBaseUIScrollView(float xPos=0, float yPos=0, float xSize=0, float ySize=0, UString name="");
virtual ~CBaseUIScrollView();
void clear();
ELEMENT_BODY(CBaseUIScrollView)
virtual void draw(Graphics *g);
virtual void update();
virtual void onKeyUp(KeyboardEvent &e);
virtual void onKeyDown(KeyboardEvent &e);
virtual void onChar(KeyboardEvent &e);
// scrolling
void scrollY(int delta, bool animated = true);
void scrollX(int delta, bool animated = true);
void scrollToY(int scrollPosY, bool animated = true);
void scrollToX(int scrollPosX, bool animated = true);
void scrollToElement(CBaseUIElement *element, int xOffset = 0, int yOffset = 0);
void scrollToLeft();
void scrollToRight();
void scrollToBottom();
void scrollToTop();
// set
CBaseUIScrollView *setDrawBackground(bool drawBackground) {m_bDrawBackground = drawBackground; return this;}
CBaseUIScrollView *setDrawFrame(bool drawFrame) {m_bDrawFrame = drawFrame; return this;}
CBaseUIScrollView *setDrawScrollbars(bool drawScrollbars) {m_bDrawScrollbars = drawScrollbars; return this;}
CBaseUIScrollView *setClipping(bool clipping) {m_bClipping = clipping; return this;}
CBaseUIScrollView *setBackgroundColor(Color backgroundColor) {m_backgroundColor = backgroundColor; return this;}
CBaseUIScrollView *setFrameColor(Color frameColor) {m_frameColor = frameColor; return this;}
CBaseUIScrollView *setFrameBrightColor(Color frameBrightColor) {m_frameBrightColor = frameBrightColor; return this;}
CBaseUIScrollView *setFrameDarkColor(Color frameDarkColor) {m_frameDarkColor = frameDarkColor; return this;}
CBaseUIScrollView *setScrollbarColor(Color scrollbarColor) {m_scrollbarColor = scrollbarColor; return this;}
CBaseUIScrollView *setHorizontalScrolling(bool horizontalScrolling) {m_bHorizontalScrolling = horizontalScrolling; return this;}
CBaseUIScrollView *setVerticalScrolling(bool verticalScrolling) {m_bVerticalScrolling = verticalScrolling; return this;}
CBaseUIScrollView *setScrollSizeToContent(int border = 5);
CBaseUIScrollView *setScrollResistance(int scrollResistanceInPixels) {m_iScrollResistance = scrollResistanceInPixels; return this;}
CBaseUIScrollView *setBlockScrolling(bool block) {m_bBlockScrolling = block; return this;} // means: disable scrolling, not scrolling in 'blocks'
void setScrollMouseWheelMultiplier(float scrollMouseWheelMultiplier) {m_fScrollMouseWheelMultiplier = scrollMouseWheelMultiplier;}
void setScrollbarSizeMultiplier(float scrollbarSizeMultiplier) {m_fScrollbarSizeMultiplier = scrollbarSizeMultiplier;}
// get
inline CBaseUIContainer *getContainer() const {return m_container;}
inline float getScrollPosY() const {return m_vScrollPos.y;}
inline float getScrollPosX() const {return m_vScrollPos.x;}
inline Vector2 getScrollSize() const {return m_vScrollSize;}
inline Vector2 getVelocity() const {return (m_vScrollPos - m_vVelocity);}
inline bool isScrolling() const {return m_bScrolling;}
bool isBusy();
// events
void onResized();
void onMouseDownOutside();
void onMouseDownInside();
void onMouseUpInside();
void onMouseUpOutside();
void onFocusStolen();
void onEnabled();
void onDisabled();
protected:
virtual void onMoved();
private:
void updateClipping();
void updateScrollbars();
// main container
CBaseUIContainer *m_container;
// vars
bool m_bDrawFrame;
bool m_bDrawBackground;
bool m_bDrawScrollbars;
bool m_bClipping;
Color m_backgroundColor;
Color m_frameColor;
Color m_frameBrightColor;
Color m_frameDarkColor;
Color m_scrollbarColor;
Vector2 m_vScrollPos;
Vector2 m_vScrollPosBackup;
Vector2 m_vMouseBackup;
float m_fScrollMouseWheelMultiplier;
float m_fScrollbarSizeMultiplier;
McRect m_verticalScrollbar;
McRect m_horizontalScrollbar;
// scroll logic
bool m_bScrolling;
bool m_bScrollbarScrolling;
bool m_bScrollbarIsVerticalScrolling;
bool m_bBlockScrolling;
bool m_bHorizontalScrolling;
bool m_bVerticalScrolling;
Vector2 m_vScrollSize;
Vector2 m_vMouseBackup2;
Vector2 m_vMouseBackup3;
Vector2 m_vVelocity;
Vector2 m_vKineticAverage;
bool m_bAutoScrollingX;
bool m_bAutoScrollingY;
int m_iPrevScrollDeltaX;
bool m_bScrollResistanceCheck;
int m_iScrollResistance;
};
#endif
| {
"content_hash": "9c4599fa56f8c090c6765065ea5034a5",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 146,
"avg_line_length": 33.79527559055118,
"alnum_prop": 0.7947343895619757,
"repo_name": "McKay42/McEngine",
"id": "3daee282fc6bc4cc132e28830685212e4817bd14",
"size": "4695",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "McEngine/src/GUI/CBaseUIScrollView.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "12023"
},
{
"name": "C",
"bytes": "8567787"
},
{
"name": "C#",
"bytes": "628349"
},
{
"name": "C++",
"bytes": "8967564"
},
{
"name": "CMake",
"bytes": "46447"
},
{
"name": "Lua",
"bytes": "24873"
},
{
"name": "Makefile",
"bytes": "37122"
},
{
"name": "Objective-C",
"bytes": "9060"
},
{
"name": "Objective-C++",
"bytes": "15899"
},
{
"name": "Python",
"bytes": "26615"
},
{
"name": "Shell",
"bytes": "8467"
}
],
"symlink_target": ""
} |
package com.kageiit;
import org.junit.Test;
public class JacoboTest {
@Test
public void foo() {
new Jacobo().foo();
}
}
| {
"content_hash": "3fe4b01a87a06425b08d300b77031c39",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 27,
"avg_line_length": 13,
"alnum_prop": 0.5944055944055944,
"repo_name": "kageiit/gradle-jacobo-plugin",
"id": "dd494660b20c51eee05ea1a2dec54529d9cc4124",
"size": "143",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example/src/test/java/com/kageiit/JacoboTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "12999"
},
{
"name": "Java",
"bytes": "362"
}
],
"symlink_target": ""
} |
layout: page
title: Cohen Family Reunion
date: 2016-05-24
author: Brandon Pope
tags: weekly links, java
status: published
summary: Etiam aliquam, mauris quis aliquet condimentum.
banner: images/banner/meeting-01.jpg
booking:
startDate: 11/02/2017
endDate: 11/05/2017
ctyhocn: SNTSCHX
groupCode: CFR
published: true
---
Nullam tristique imperdiet nunc sed molestie. Nullam venenatis, eros vel scelerisque dictum, nulla mi auctor nibh, nec tristique mauris mauris eu nibh. Pellentesque in volutpat mi, non pretium ipsum. Sed euismod, ex a sollicitudin consequat, orci erat condimentum odio, ut volutpat nisl lacus vitae sapien. Pellentesque aliquam leo felis, eget sollicitudin neque tincidunt non. Etiam non ipsum sed lectus efficitur posuere. Etiam sagittis vitae leo sit amet ullamcorper. Fusce nec mollis odio, sit amet laoreet magna.
Duis nec nibh euismod purus convallis dignissim et sed diam. Quisque at urna nec nibh sagittis eleifend. Ut vel metus placerat, accumsan eros a, eleifend velit. Vivamus turpis erat, ultricies pretium eleifend et, tincidunt sed nibh. Donec ac consequat metus, eu luctus eros. Aenean suscipit felis mi, a vulputate sem dictum et. Ut consequat ullamcorper efficitur. Fusce interdum vel ex eu ornare. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc mattis mollis tempus. Donec in imperdiet quam, et feugiat turpis.
* Vivamus aliquet massa vel pulvinar lobortis
* Duis ac ligula luctus, iaculis magna sit amet, convallis tellus
* Integer pretium orci eu ligula hendrerit, et sodales justo efficitur
* Quisque placerat est ac odio mattis, sed aliquet metus porta.
Duis sed sem magna. Vivamus sagittis feugiat justo sit amet tincidunt. Pellentesque tincidunt, massa et auctor finibus, lorem dui gravida orci, accumsan facilisis enim ex nec nisi. Morbi dolor risus, faucibus id sollicitudin non, fermentum ut lacus. Nam nec diam erat. Nunc tincidunt vehicula massa, ac accumsan ante elementum quis. Aenean pellentesque dui at tincidunt laoreet. Nulla orci lacus, viverra nec finibus sit amet, consequat et eros. Mauris sed turpis suscipit justo lobortis bibendum vel vel orci. Ut bibendum luctus tempus. Proin convallis massa ut lacus feugiat, ut finibus libero egestas.
| {
"content_hash": "5a24a56a074b093dfef95600495ad426",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 604,
"avg_line_length": 92.66666666666667,
"alnum_prop": 0.8062050359712231,
"repo_name": "KlishGroup/prose-pogs",
"id": "9f8acfb7070390c08fec588e211702afb16242aa",
"size": "2228",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "pogs/S/SNTSCHX/CFR/index.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
from builderactions import get_builder_details
import copy
import datetime
import glob
import imp
from optparse import OptionParser
import os
import StringIO
import subprocess
import sys
from testconfigurations import test_option_setup
from testinstance import TestInstance
import time
import tempfile
import xml.etree.ElementTree as ET
# ----------
if sys.platform.startswith("win"):
bam_shell = 'bam.bat'
else:
bam_shell = 'bam'
def print_message(message):
print >>sys.stdout, message
sys.stdout.flush()
class Package:
def __init__(self, root, name, version):
self.root = root
self.name = name
self.version = version
self.repo = None
self.package_dir = None
@classmethod
def from_xml(cls, xml_filename):
document = ET.parse(xml_filename)
root = document.getroot()
instance = cls(None, root.attrib["name"], root.attrib.get("version", None))
instance.package_dir = os.path.normpath(os.path.join(xml_filename, os.pardir, os.pardir))
instance.repo = os.path.normpath(os.path.join(instance.package_dir, os.pardir))
return instance
def get_description(self):
if self.version:
return "%s-%s in %s" % (self.name, self.version, self.repo)
else:
return "%s in %s" % (self.name, self.repo)
def get_path(self):
return self.package_dir
def get_id(self):
if self.version:
return "-".join([self.name, self.version])
else:
return self.name
def get_name(self):
return self.name
# ----------
def find_all_packages_to_test(root, options):
"""Locate packages that can be tested
Args:
root:
options:
"""
if options.verbose:
print_message("Locating packages under '%s'" % root)
tests = []
dirs = os.listdir(root)
dirs.sort()
for packageName in dirs:
if packageName.startswith("."):
continue
package_dir = os.path.join(root, packageName)
if not os.path.isdir(package_dir):
continue
bam_dir = os.path.join(package_dir, 'bam')
if not os.path.isdir(bam_dir):
continue
xml_files = glob.glob(os.path.join(bam_dir, "*.xml"))
if len(xml_files) == 0:
continue
if len(xml_files) > 1:
raise RuntimeError("Too many XML files found in %s to identify a package definition file" % bam_dir)
package = Package.from_xml(xml_files[0])
if options.verbose:
print_message("\t%s" % package.get_id())
tests.append(package)
return tests
def _init_builder(builder, options):
builder.init(options)
def _pre_execute(builder):
builder.pre_action()
def _run_buildamation(options, instance, extra_args, output_messages, error_messages):
arg_list = []
if options.prefix:
arg_list.append(options.prefix)
arg_list.extend([
bam_shell,
"-o=%s" % options.buildRoot,
"-b=%s" % options.buildmode
])
for config in options.configurations:
arg_list.append("--config=%s" % config)
arg_list.append("-j=" + str(options.numJobs))
if options.debugSymbols:
arg_list.append("-d")
if options.verbose:
arg_list.append("-v=2")
else:
arg_list.append("-v=0")
if options.forceDefinitionUpdate:
arg_list.append("--forceupdates")
if not options.noInitialClean:
arg_list.append("--clean")
if extra_args:
arg_list.extend(extra_args)
if options.injected:
for inject in options.injected:
arg_list.append("--injectdefaultpackage=%s" % inject)
print_message('%s: %s' % (datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d(%H:%M:%S)'), " ".join(arg_list)))
if options.verbose:
p = subprocess.Popen(arg_list, cwd=instance.package_path())
p.wait()
else:
out_fd, out_path = tempfile.mkstemp()
err_fd, err_path = tempfile.mkstemp()
try:
with os.fdopen(out_fd, 'w') as out:
with os.fdopen(err_fd, 'w') as err:
p = subprocess.Popen(arg_list, stdout=out, stderr=err, cwd=instance.package_path())
while p.poll() is None:
sys.stdout.write('.') # keep something alive on the console
sys.stdout.flush()
time.sleep(1)
p.wait()
print_message('')
except Exception, e:
print_message(str(e))
finally:
with open(out_path) as out:
output_messages.write(out.read())
with open(err_path) as err:
error_messages.write(err.read())
os.remove(out_path)
os.remove(err_path)
return p.returncode, arg_list
def _post_execute(builder, options, instance, output_messages, error_messages):
if options.dumpprojects:
builder.dump_generated_files(instance, options)
exit_code = builder.post_action(instance, options, output_messages, error_messages)
return exit_code
class Stats(object):
def __init__(self):
self._total = 0
self._success = 0
self._fail = []
self._ignore = []
def execute_test_instance(instance, options, output_buffer, stats, the_builder):
print_message(128 * '=')
if instance.runnable():
print_message("* Running %s\t%s\t%s" % (instance.package_name(), instance.flavour(), ' '.join(instance.variation_arguments())))
if options.excludedVariations:
print_message(" (excluding %s)" % options.excludedVariations)
else:
print_message("* Ignoring %s\t%s" % (instance.package_name(), instance.flavour()))
output_buffer.write("IGNORED: Test instance '%s' is not runnable in this configuration\n" % str(instance))
stats._total += 1
stats._ignore.append(str(instance))
return 0
if options.verbose:
print_message("\tPackage Description : %s" % instance.package_description())
non_kwargs = []
exit_code = 0
stats._total += 1
iterations = 1
for it in range(0, iterations):
extra_args = non_kwargs[:]
if options.Flavours:
extra_args.extend(options.Flavours)
extra_args.extend(instance.variation_arguments())
try:
output_messages = StringIO.StringIO()
error_messages = StringIO.StringIO()
start_time = os.times()
_pre_execute(the_builder)
returncode, arg_list = _run_buildamation(options, instance, extra_args, output_messages, error_messages)
if returncode == 0 and not options.dryrun:
if the_builder.repeat_no_clean:
no_clean_options = copy.deepcopy(options)
no_clean_options.noInitialClean = True
returncode, _ = _run_buildamation(no_clean_options, instance, extra_args, output_messages, error_messages)
if returncode == 0:
returncode = _post_execute(the_builder, options, instance, output_messages, error_messages)
end_time = os.times()
except Exception, e:
print_message("Popen exception: '%s'" % str(e))
raise
finally:
message = "Test instance '%s'" % str(instance)
if extra_args:
message += " with extra arguments '%s'" % " ".join(extra_args)
try:
message += " executed in (%f,%f,%f,%f,%f) seconds" %\
(
end_time[0] - start_time[0],
end_time[1] - start_time[1],
end_time[2] - start_time[2],
end_time[3] - start_time[3],
end_time[4] - start_time[4]
)
except UnboundLocalError: # for end_time
pass
try:
if returncode == 0:
stats._success += 1
output_buffer.write("SUCCESS: %s\n" % message)
if options.verbose:
if len(output_messages.getvalue()) > 0:
output_buffer.write("Messages:\n")
output_buffer.write(output_messages.getvalue())
if len(error_messages.getvalue()) > 0:
output_buffer.write("Errors:\n")
output_buffer.write(error_messages.getvalue())
else:
stats._fail.append(str(instance))
output_buffer.write("* FAILURE *: %s\n" % message)
output_buffer.write("Command was: %s\n" % " ".join(arg_list))
output_buffer.write("Executed in: %s\n" % instance.package_path())
if len(output_messages.getvalue()) > 0:
output_buffer.write("Messages:\n")
output_buffer.write(output_messages.getvalue())
if len(error_messages.getvalue()) > 0:
output_buffer.write("Errors:\n")
output_buffer.write(error_messages.getvalue())
output_buffer.write("\n")
exit_code -= 1
except UnboundLocalError: # for returncode
message += "... did not complete due to earlier errors"
return exit_code
def clean_up(options):
arg_list = []
cur_dir = os.path.dirname(os.path.realpath(__file__))
if sys.platform.startswith("win"):
arg_list.append(os.path.join(cur_dir, "removedebugprojects.bat"))
arg_list.append("-nopause")
else:
arg_list.append(os.path.join(cur_dir, "removedebugprojects.sh"))
if options.verbose:
print_message("Executing: %s" % arg_list)
p = subprocess.Popen(arg_list)
p.wait()
def find_bam_default_repository():
try:
bam_install_dir = subprocess.check_output([bam_shell, '--installdir']).rstrip()
repo_dir = os.path.realpath(os.path.join(bam_install_dir, os.pardir, os.pardir, os.pardir))
return repo_dir
except:
raise RuntimeError("Unable to locate BAM on the PATH")
# ----------
if __name__ == "__main__":
bam_dir = find_bam_default_repository()
optParser = OptionParser(description="BuildAMation unittests")
# optParser.add_option("--platform", "-p", dest="platforms", action="append", default=None, help="Platforms to test")
optParser.add_option("--configuration", "-c", dest="configurations", type="choice", choices=["debug","profile","optimized"], action="append", default=None, help="Configurations to test")
optParser.add_option("--test", "-t", dest="tests", action="append", default=None, help="Tests to run")
optParser.add_option("--excludetest", "-T", dest="xtests", action="append", default=None, help="Tests to not run")
optParser.add_option("--buildroot", "-o", dest="buildRoot", action="store", default="build", help="BuildAMation build root")
optParser.add_option("--buildmode", "-b", dest="buildmode", type="choice", choices=["Native", "VSSolution", "MakeFile", "Xcode"], action="store", default="Native", help="BuildAMation build mode to test")
optParser.add_option("--keepfiles", "-k", dest="keepFiles", action="store_true", default=False, help="Keep the BuildAMation build files around")
optParser.add_option("--jobs", "-j", dest="numJobs", action="store", type="int", default=1, help="Number of jobs to use with BuildAMation builds")
optParser.add_option("--verbose", "-v", dest="verbose", action="store_true", default=False, help="Verbose output")
optParser.add_option("--debug", "-d", dest="debugSymbols", action="store_true", default=False, help="Build BuildAMation packages with debug information")
optParser.add_option("--noinitialclean", "-i", dest="noInitialClean", action="store_true", default=False, help="Disable cleaning packages before running tests")
optParser.add_option("--forcedefinitionupdate", "-f", dest="forceDefinitionUpdate", action="store_true", default=False, help="Force definition file updates")
optParser.add_option("--excludevariation", "-x", dest="excludedVariations", action="append", default=None, help="Exclude a variation from the test configurations")
optParser.add_option("--C.bitdepth", dest="bitDepth", type="choice", choices=["*", "32", "64"], action="store", default="*", help="Build bit depth to test")
optParser.add_option("--repo", "-r", dest="repos", action="append", default=[bam_dir], help="Add a package repository to test")
optParser.add_option("--nodefaultrepo", dest="nodefaultrepo", action="store_true", default=False, help="Do not test the default repository")
optParser.add_option("--injectdefaultpackage", dest="injected", action="append", default=None, help="Inject default packages, specify packagename or packagename-packageversion")
optParser.add_option("--dumpprojects", dest="dumpprojects", action="store_true", default=False, help="Dump generated project files to stdout")
optParser.add_option("--prefix", dest="prefix", action="store", default=None, help="Prefix command to each bam process")
optParser.add_option("--keepgoing", dest="keepgoing", action="store_true", default=False, help="Keep going after test failures.")
optParser.add_option("--dry-run", "-n", dest="dryrun", action="store_true", default=False, help="Dry run - don't execute any builder actions.")
test_option_setup(optParser)
(options, args) = optParser.parse_args()
if options.nodefaultrepo:
options.repos.remove(bam_dir)
if not options.repos:
raise RuntimeError("No package repositories to test")
if options.verbose:
print_message("Options are %s" % options)
print_message("Args are %s" % args)
# if not options.platforms:
# raise RuntimeError("No platforms were specified")
if not options.configurations:
raise RuntimeError("No configurations were specified")
# if not options.noInitialClean:
# clean_up(options)
exit_code = 0
for repo in options.repos:
if not os.path.isabs(repo):
repo = os.path.join(os.getcwd(), repo)
repoTestDir = os.path.join(repo, "tests")
bamTestsConfigPathname = os.path.join(repoTestDir, 'bamtests.py')
if not os.path.isfile(bamTestsConfigPathname):
print_message("Package repository %s has no bamtests.py file" % repo)
continue
bamtests = imp.load_source('bamtests', bamTestsConfigPathname)
testConfigs = bamtests.configure_repository()
tests = find_all_packages_to_test(repoTestDir, options)
if options.tests:
if options.verbose:
print_message("Tests to run are: %s" % options.tests)
filteredTests = []
for test in options.tests:
found = False
for package in tests:
if package.get_id() == test:
filteredTests.append(package)
found = True
break
if not found:
raise RuntimeError("Unrecognized package '%s'" % test)
tests = filteredTests
if options.xtests:
if options.verbose:
print_message("Tests to not run are: %s" % options.xtests)
tests = [t for t in tests if not t.get_id() in options.xtests]
test_instances = set()
stats = Stats()
for test in tests:
try:
configs = testConfigs[test.get_name()]
except KeyError, e:
if options.verbose:
print_message("No configuration for package %s: %s" % (test.get_name(), str(e)))
continue
if not isinstance(configs, (list,tuple)):
configs = [configs]
for config in configs:
try:
variations = config.get_variations(options.buildmode, options.excludedVariations, options.bitDepth)
except KeyError:
variations = [None]
for variation in variations:
test_instances.add(TestInstance(test, '+'.join(set(options.configurations)), variation, config.get_package_options(), config.get_alias()))
if options.verbose:
print "Test instances are:"
for instance in sorted(test_instances, key=lambda instance: str(instance)):
print "\t%s" % str(instance)
# builder gets constructed once, for all packages
the_builder = get_builder_details(options.buildmode)
_init_builder(the_builder, options)
output_buffer = StringIO.StringIO()
for test in sorted(test_instances, key=lambda instance: str(instance)):
exit_code += execute_test_instance(test, options, output_buffer, stats, the_builder)
if exit_code != 0 and not options.keepgoing:
print "Aborted early due to failures..."
break
if not options.keepFiles:
# TODO: consider keeping track of all directories created instead
clean_up(options)
print_message("--------------------")
print_message("| Results summary |")
print_message("--------------------")
print_message(output_buffer.getvalue())
print_message("Success %s/%s" % (stats._success, stats._total))
print_message("Failure %s/%s" % (len(stats._fail), stats._total))
if stats._fail:
for failed in stats._fail:
print_message("\t%s" % failed)
print_message("Ignored %s/%s" % (len(stats._ignore), stats._total))
if stats._ignore:
for ignored in stats._ignore:
print_message("\t%s" % ignored)
logsDir = os.path.join(repoTestDir, "Logs")
if not os.path.isdir(logsDir):
os.makedirs(logsDir)
logFileName = os.path.join(logsDir, "tests_" + time.strftime("%d-%m-%YT%H-%M-%S") + ".log")
logFile = open(logFileName, "w")
logFile.write(output_buffer.getvalue())
logFile.close()
output_buffer.close()
sys.exit(exit_code)
| {
"content_hash": "b2021108abf2deea675ac5b75eb418dd",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 207,
"avg_line_length": 42.94859813084112,
"alnum_prop": 0.58997932760309,
"repo_name": "markfinal/BuildAMation",
"id": "f52bd71abab07376f2b85efbfee498b1c3627f63",
"size": "18401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/runtests.py",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "25495"
},
{
"name": "Batchfile",
"bytes": "6399"
},
{
"name": "C",
"bytes": "249476"
},
{
"name": "C#",
"bytes": "3318412"
},
{
"name": "C++",
"bytes": "35331"
},
{
"name": "Objective-C",
"bytes": "10923"
},
{
"name": "PowerShell",
"bytes": "737"
},
{
"name": "Python",
"bytes": "97729"
},
{
"name": "Shell",
"bytes": "5166"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>lc: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / extra-dev</a></li>
<li class="active"><a href="">8.10.0 / lc - 8.8.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
lc
<small>
8.8.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2020-08-24 06:00:58 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-08-24 06:00:58 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.10.0 Formal proof management system
num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/lc"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/lc"]
depends: [
"ocaml"
"coq" {>= "8.8" & < "8.9~"}
]
tags: [ "keyword: Module" "keyword: Monad" "keyword: Category" "keyword: Lambda-calculus" "keyword: Higher-order syntax" "category: Computer Science/Lambda Calculi" "date: 2006-01-12" "date: 2008-09-9" ]
authors: [ "André Hirschowitz <ah@math.unice.fr> [http://math.unice.fr/~ah/]" "Marco Maggesi <maggesi@math.unifi.it> [http://www.math.unifi.it/~maggesi/]" ]
bug-reports: "https://github.com/coq-contribs/lc/issues"
dev-repo: "git+https://github.com/coq-contribs/lc.git"
synopsis: "Modules over monads and lambda-calculi"
description: """
http://www.math.unifi.it/~/maggesi/mechanized/
We define a notion of module over a monad and use it to
propose a new definition (or semantics) for abstract
syntax (with binding constructions). Using our notion of
module, we build a category of `exponential' monads,
which can be understood as the category of
lambda-calculi, and prove that it has an initial object
(the pure untyped lambda-calculus)."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/lc/archive/v8.8.0.tar.gz"
checksum: "md5=fb031a9dd8bca286b37200c8eea93fec"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-lc.8.8.0 coq.8.10.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.10.0).
The following dependencies couldn't be met:
- coq-lc -> coq < 8.9~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-lc.8.8.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "f2ab65f97394c47dc41a4ed44a32581f",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 283,
"avg_line_length": 43.046783625730995,
"alnum_prop": 0.5525064529275914,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "bd71e438345ece00e96061c99f828e9d7386a7af",
"size": "7387",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.06.1-2.0.5/extra-dev/8.10.0/lc/8.8.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
import requests
class Jira(object):
def __init__(self, url):
self.url = url
def find_all(self, jql, fields=None, offset=0, limit=1000):
# Prepare request url
get_url = self.url
if not get_url.endswith("/"):
get_url += "/"
get_url += "search?jql=%s" % jql
if fields:
get_url += "&fields=%s" % fields
get_url_wlimit = get_url
if offset:
get_url_wlimit += "&startAt=%s" % offset
if limit:
get_url_wlimit += "&maxResults=%s" % limit
# Execute request
result = self.get_request(get_url_wlimit)
issues = result['issues']
# Partition if offset on server limited
if result['maxResults'] < limit:
new_limit = result['maxResults']
new_offset = offset + new_limit
total = result['total']
while new_offset < limit and new_offset < total:
new_get_url = get_url + "&startAt=%s&maxResults=%s" \
% (new_offset, new_limit)
curr_result = self.get_request(new_get_url)
issues += curr_result['issues']
new_offset += new_limit
return issues
def get_request(self, url):
r = requests.get(url)
if not r.ok:
r.raise_for_status()
return r.json()
def test_jira_availability(self):
get_url = self.url
if not get_url.endswith("/"):
get_url += "/"
get_url += "issuetype"
r = requests.get(get_url, timeout=9.05)
if not r.ok:
r.raise_for_status()
return r.ok
| {
"content_hash": "63239c4e0616d3159fffb2ae1adebc41",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 69,
"avg_line_length": 26.887096774193548,
"alnum_prop": 0.50749850029994,
"repo_name": "VaclavDedik/triager",
"id": "993c55749e3ef43ecc53c9bb97104ac94e536821",
"size": "1667",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "triager/jira.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3001"
},
{
"name": "HTML",
"bytes": "22690"
},
{
"name": "JavaScript",
"bytes": "150"
},
{
"name": "Python",
"bytes": "44122"
}
],
"symlink_target": ""
} |
<?php
/**
* Sendfriend log resource collection
*
* @category Mage
* @package Mage_Sendfriend
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Sendfriend_Model_Resource_Sendfriend_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
/**
* Init resource collection
*
*/
protected function _construct()
{
$this->_init('sendfriend/sendfriend');
}
}
| {
"content_hash": "99aeab5eb36e6dd7a0b85f099f2a8208",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 20.045454545454547,
"alnum_prop": 0.6485260770975056,
"repo_name": "5452/durex",
"id": "c6a5dd72fba9c61374db7985c6b89da4a0b40b82",
"size": "1400",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/code/core/Mage/Sendfriend/Model/Resource/Sendfriend/Collection.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ActionScript",
"bytes": "19946"
},
{
"name": "CSS",
"bytes": "2190550"
},
{
"name": "JavaScript",
"bytes": "1290492"
},
{
"name": "PHP",
"bytes": "102689019"
},
{
"name": "Shell",
"bytes": "642"
},
{
"name": "XSLT",
"bytes": "2066"
}
],
"symlink_target": ""
} |
title: Optimize Mobile Performance with Jdrop
author: Josh Habdas
date: 2011-03-06
categories:
- reference
tags:
- mobile
- webperf
- debugging
- programming
---
Last month [Steve Souders announced Jdrop][1], a JSON repository in the cloud. Using Jdrop and Souders' [Mobile Perf bookmarklet][2], developers can send mobile browser data to the cloud for more careful analysis on other devices.
<!--more-->
As a UI developer and fan of Souders' book _Even Faster Web Sites_ I couldn't resist giving Jdrop a try. After setting-up an account and installing the Mobile Perf bookmarklet on my Android 2.3 device I was up and running. During the process I learned two important things:
* Bookmarklets are helping close the gap between desktop plug-ins and mobile device browsers.
* Distributed JSON repositories provide a convenient way to visualize data from mobile devices on a remote server.
[Mobile Perf bookmarklet][2] provides a pop-up dialog (right) that provides easy access to other bookmarklets and performance tools, many of which have the ability to send data to [Jdrop][3] for subsequent analysis on another device.
Info that can be sent back to Jdrop include a listing of external page resources, page source and DOM Monster performance analysis. Other tools such as Firebug Lite provide limited features but can be handy for gaining access to the console or inspecting the DOM.
As mobile performance testing and debugging tools become more sophisticated, using bookmarklets to interface with a JSON cloud like Jdrop provides a great way to share mobile browser data between devices. Having these data available in the cloud enables developers to visualize information in more usable ways. But even with these advancements there is still room for improvement. Applications I would like to see developed in the future include remote script debugging, script error monitoring and client-side performance metric logging.
[1]: http://www.stevesouders.com/blog/2011/02/16/jdrop-json-in-the-cloud/
[2]: http://stevesouders.com/mobileperf/
[3]: http://jdrop.org/
*[JSON]: JavaScript Object Notation
| {
"content_hash": "28d6ed219c765c7d572fe7a2766e0967",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 538,
"avg_line_length": 68.54838709677419,
"alnum_prop": 0.7896470588235294,
"repo_name": "jhabdas/habd.as",
"id": "f7bb984a20c816d44fe0ccd2515375803818ba4d",
"size": "2133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2011-03-06-optimize-mobile-performance-with-jdrop.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "64224"
},
{
"name": "HTML",
"bytes": "52774"
},
{
"name": "JavaScript",
"bytes": "5244"
},
{
"name": "Ruby",
"bytes": "9499"
}
],
"symlink_target": ""
} |
This is a project under development.
Goal: Develop a reservation system for cloud virtual machines.
The documentation is maintained at
* http://cloudmesh.github.io/reservation
| {
"content_hash": "be85e793d66a7a556d6711229cb967f8",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 62,
"avg_line_length": 25.571428571428573,
"alnum_prop": 0.8044692737430168,
"repo_name": "cloudmesh/reservation",
"id": "c97d1247d53eae59f995cec71c89bed048bef2b0",
"size": "204",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "34964"
},
{
"name": "JavaScript",
"bytes": "494454"
},
{
"name": "Python",
"bytes": "90001"
},
{
"name": "Shell",
"bytes": "1739"
}
],
"symlink_target": ""
} |
/* $NetBSD: ccos.c,v 1.1 2007/08/20 16:01:32 drochner Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software written by Stephen L. Moshier.
* It is redistributed by the NetBSD Foundation by permission of the author.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include "../src/namespace.h"
#include <complex.h>
#include <math.h>
#include "cephes_subr.h"
double complex
ccos(double complex z)
{
double complex w;
double ch, sh;
_cchsh(cimag(z), &ch, &sh);
w = cos(creal(z)) * ch - (sin(creal(z)) * sh) * I;
return w;
}
| {
"content_hash": "a30e9cd7d76bf64260751c06f0014e08",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 40.630434782608695,
"alnum_prop": 0.7394328517924024,
"repo_name": "execunix/vinos",
"id": "755d712acb19b17d2cc5cec580482092f3c83fa0",
"size": "1869",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "lib/libm/complex/ccos.c",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
module Paperclip
# 截图的paperclip processer
# TODO 不直接调用ffmpeg,用rvideo封装截图命令
# TODO 截图后用thumbnail里的方法调整图片尺寸
class VideoThumbnail < Processor
# The VideoThumbnail processor accepts three options:
### :time_offset
# The number of seconds into the video to capture as a thumbnail
# (this should be a negative number and corresponds to the itsoffset option for FFmpeg).
### :geometry
# Accepts a wxh geometry string, ideally both the width
# and height should be even numbers however
# if they aren’t the processor will adjust them automatically.
### :whiny
# Determines whether or not thumbnailing errors are to be reported.
attr_accessor :time_offset, :geometry, :whiny
def initialize(file, options = {}, attachment = nil)
super
@time_offset = options[:time_offset] || '-4'
unless options[:geometry].nil? || (@geometry = Geometry.parse(options[:geometry])).nil?
@geometry.width = (@geometry.width / 2.0).floor * 2.0
@geometry.height = (@geometry.height / 2.0).floor * 2.0
@geometry.modifier = ''
end
@whiny = options[:whiny].nil? ? true : options[:whiny]
@basename = File.basename(file.path, File.extname(file.path))
end
def make
dst = Tempfile.new([ @basename, 'jpg' ].compact.join("."))
dst.binmode
cmd = %Q[-itsoffset #{time_offset} -i "#{File.expand_path(file.path)}" -y -vcodec mjpeg -vframes 1 -an -f rawvideo ]
cmd << "-s #{geometry.to_s} " unless geometry.nil?
cmd << %Q["#{File.expand_path(dst.path)}"]
begin
success = Paperclip.run('ffmpeg', cmd)
rescue PaperclipCommandLineError
raise PaperclipError, "There was an error processing the thumbnail for #{@basename}" if whiny
end
dst
end
end
end | {
"content_hash": "d0fe95cbfff878c264320447f8722537",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 122,
"avg_line_length": 38.38297872340426,
"alnum_prop": 0.6524390243902439,
"repo_name": "johnson/shadowgraph",
"id": "c4cacff0dbaf4a21d97a33aedadb532c43bdca23",
"size": "1866",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/paperclip_processors/video_thumbnail.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "68337"
}
],
"symlink_target": ""
} |
DROP SEQUENCE IF EXISTS "account"."account_id_seq" CASCADE;
CREATE SEQUENCE "account"."account_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
GRANT USAGE ON SEQUENCE "account"."account_id_seq" TO "twitter_db_role"; | {
"content_hash": "7dcbd7dd359d4c1d419f956046b4101d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 111,
"avg_line_length": 81.33333333333333,
"alnum_prop": 0.7827868852459017,
"repo_name": "Zenithar/gene",
"id": "5d02600fbec40e5438bcb3d41b440b0ad33eff6f",
"size": "354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example/twitter/db/account/005-account-sequence.sql",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "192029"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
Chionachne sclerachne F.M.Bailey
### Remarks
null | {
"content_hash": "f279573d989ddf62fd69132af3d19078",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 12.461538461538462,
"alnum_prop": 0.7222222222222222,
"repo_name": "mdoering/backbone",
"id": "935ca6a9136f0bce9afdf7c42e545238e90492a4",
"size": "232",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Cleistochloa/Cleistochloa sclerachne/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package io.webfolder.ui4j.api.dom;
import java.util.List;
public class Form {
private Element element;
public Form(Element element) {
this.element = element;
}
public void clear() {
List<Element> inputs = element.find("input, select, textarea");
for (Element next : inputs) {
String tag = next.getTagName();
if (tag.equals("input")) {
String attribute = next.getAttribute("type");
if (attribute != null) {
String type = attribute.trim();
if (type.equalsIgnoreCase("radio")) {
next.getRadioButton().setChecked(false);
} else if (type.equalsIgnoreCase("checkbox")) {
next.getCheckBox().setChecked(false);
} else if (type.equalsIgnoreCase("text")) {
next.setValue("");
}
} else {
next.setValue("");
}
} else if (tag.equals("select")) {
next.getSelect().clearSelection();
} else if (tag.equals("textarea")) {
next.setText("");
}
}
}
public Element getElement() {
return element;
}
public void submit() {
element.eval("this.submit()");
}
}
| {
"content_hash": "eb5eaa759dae4349260e6db996b31394",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 71,
"avg_line_length": 29.804347826086957,
"alnum_prop": 0.4777534646243618,
"repo_name": "ui4j/ui4j",
"id": "dafe58b09db080c0ca196cedf261566b31cce1bd",
"size": "1371",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ui4j-api/src/main/java/io/webfolder/ui4j/api/dom/Form.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "8876"
},
{
"name": "Java",
"bytes": "250883"
},
{
"name": "JavaScript",
"bytes": "59097"
}
],
"symlink_target": ""
} |
/*************************************************************************************************/
#ifndef BOOST_GIL_EXTENSION_IO_BMP_WRITE_HPP
#define BOOST_GIL_EXTENSION_IO_BMP_WRITE_HPP
////////////////////////////////////////////////////////////////////////////////////////
/// \file
/// \brief
/// \author Christian Henning \n
///
/// \date 2008 \n
///
////////////////////////////////////////////////////////////////////////////////////////
#include "bmp_tags.hpp"
#include "formats/bmp/supported_types.hpp"
#include "formats/bmp/write.hpp"
#include "detail/make_writer.hpp"
#include "detail/make_dynamic_image_writer.hpp"
#include "detail/write_view.hpp"
#endif // BOOST_GIL_EXTENSION_IO_BMP_WRITE_HPP
| {
"content_hash": "863c498958fc97293ebe5cdbbf6e6d74",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 99,
"avg_line_length": 28.53846153846154,
"alnum_prop": 0.42183288409703507,
"repo_name": "darklost/darkforce",
"id": "37a8e752ff02f5a67b4d2591103511b4b037be7f",
"size": "976",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "third_party/boost/boost/gil/extension/io/bmp_write.hpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "1920"
},
{
"name": "C#",
"bytes": "12787"
},
{
"name": "C++",
"bytes": "186310"
},
{
"name": "CMake",
"bytes": "10698"
},
{
"name": "Python",
"bytes": "22561"
}
],
"symlink_target": ""
} |
"""Adds Chromaprint/Acoustid acoustic fingerprinting support to the
autotagger. Requires the pyacoustid library.
"""
from __future__ import division, absolute_import, print_function
from beets import plugins
from beets import ui
from beets import util
from beets import config
from beets.util import confit
from beets.autotag import hooks
import acoustid
from collections import defaultdict
API_KEY = '1vOwZtEn'
SCORE_THRESH = 0.5
TRACK_ID_WEIGHT = 10.0
COMMON_REL_THRESH = 0.6 # How many tracks must have an album in common?
MAX_RECORDINGS = 5
MAX_RELEASES = 5
# Stores the Acoustid match information for each track. This is
# populated when an import task begins and then used when searching for
# candidates. It maps audio file paths to (recording_ids, release_ids)
# pairs. If a given path is not present in the mapping, then no match
# was found.
_matches = {}
# Stores the fingerprint and Acoustid ID for each track. This is stored
# as metadata for each track for later use but is not relevant for
# autotagging.
_fingerprints = {}
_acoustids = {}
def prefix(it, count):
"""Truncate an iterable to at most `count` items.
"""
for i, v in enumerate(it):
if i >= count:
break
yield v
def acoustid_match(log, path):
"""Gets metadata for a file from Acoustid and populates the
_matches, _fingerprints, and _acoustids dictionaries accordingly.
"""
try:
duration, fp = acoustid.fingerprint_file(util.syspath(path))
except acoustid.FingerprintGenerationError as exc:
log.error(u'fingerprinting of {0} failed: {1}',
util.displayable_path(repr(path)), exc)
return None
_fingerprints[path] = fp
try:
res = acoustid.lookup(API_KEY, fp, duration,
meta='recordings releases')
except acoustid.AcoustidError as exc:
log.debug(u'fingerprint matching {0} failed: {1}',
util.displayable_path(repr(path)), exc)
return None
log.debug(u'chroma: fingerprinted {0}',
util.displayable_path(repr(path)))
# Ensure the response is usable and parse it.
if res['status'] != 'ok' or not res.get('results'):
log.debug(u'no match found')
return None
result = res['results'][0] # Best match.
if result['score'] < SCORE_THRESH:
log.debug(u'no results above threshold')
return None
_acoustids[path] = result['id']
# Get recording and releases from the result.
if not result.get('recordings'):
log.debug(u'no recordings found')
return None
recording_ids = []
release_ids = []
for recording in result['recordings']:
recording_ids.append(recording['id'])
if 'releases' in recording:
release_ids += [rel['id'] for rel in recording['releases']]
log.debug(u'matched recordings {0} on releases {1}',
recording_ids, release_ids)
_matches[path] = recording_ids, release_ids
# Plugin structure and autotagging logic.
def _all_releases(items):
"""Given an iterable of Items, determines (according to Acoustid)
which releases the items have in common. Generates release IDs.
"""
# Count the number of "hits" for each release.
relcounts = defaultdict(int)
for item in items:
if item.path not in _matches:
continue
_, release_ids = _matches[item.path]
for release_id in release_ids:
relcounts[release_id] += 1
for release_id, count in relcounts.items():
if float(count) / len(items) > COMMON_REL_THRESH:
yield release_id
class AcoustidPlugin(plugins.BeetsPlugin):
def __init__(self):
super(AcoustidPlugin, self).__init__()
self.config.add({
'auto': True,
})
config['acoustid']['apikey'].redact = True
if self.config['auto']:
self.register_listener('import_task_start', self.fingerprint_task)
self.register_listener('import_task_apply', apply_acoustid_metadata)
def fingerprint_task(self, task, session):
return fingerprint_task(self._log, task, session)
def track_distance(self, item, info):
dist = hooks.Distance()
if item.path not in _matches or not info.track_id:
# Match failed or no track ID.
return dist
recording_ids, _ = _matches[item.path]
dist.add_expr('track_id', info.track_id not in recording_ids)
return dist
def candidates(self, items, artist, album, va_likely):
albums = []
for relid in prefix(_all_releases(items), MAX_RELEASES):
album = hooks.album_for_mbid(relid)
if album:
albums.append(album)
self._log.debug(u'acoustid album candidates: {0}', len(albums))
return albums
def item_candidates(self, item, artist, title):
if item.path not in _matches:
return []
recording_ids, _ = _matches[item.path]
tracks = []
for recording_id in prefix(recording_ids, MAX_RECORDINGS):
track = hooks.track_for_mbid(recording_id)
if track:
tracks.append(track)
self._log.debug(u'acoustid item candidates: {0}', len(tracks))
return tracks
def commands(self):
submit_cmd = ui.Subcommand('submit',
help=u'submit Acoustid fingerprints')
def submit_cmd_func(lib, opts, args):
try:
apikey = config['acoustid']['apikey'].as_str()
except confit.NotFoundError:
raise ui.UserError(u'no Acoustid user API key provided')
submit_items(self._log, apikey, lib.items(ui.decargs(args)))
submit_cmd.func = submit_cmd_func
fingerprint_cmd = ui.Subcommand(
'fingerprint',
help=u'generate fingerprints for items without them'
)
def fingerprint_cmd_func(lib, opts, args):
for item in lib.items(ui.decargs(args)):
fingerprint_item(self._log, item, write=ui.should_write())
fingerprint_cmd.func = fingerprint_cmd_func
return [submit_cmd, fingerprint_cmd]
# Hooks into import process.
def fingerprint_task(log, task, session):
"""Fingerprint each item in the task for later use during the
autotagging candidate search.
"""
items = task.items if task.is_album else [task.item]
for item in items:
acoustid_match(log, item.path)
def apply_acoustid_metadata(task, session):
"""Apply Acoustid metadata (fingerprint and ID) to the task's items.
"""
for item in task.imported_items():
if item.path in _fingerprints:
item.acoustid_fingerprint = _fingerprints[item.path]
if item.path in _acoustids:
item.acoustid_id = _acoustids[item.path]
# UI commands.
def submit_items(log, userkey, items, chunksize=64):
"""Submit fingerprints for the items to the Acoustid server.
"""
data = [] # The running list of dictionaries to submit.
def submit_chunk():
"""Submit the current accumulated fingerprint data."""
log.info(u'submitting {0} fingerprints', len(data))
try:
acoustid.submit(API_KEY, userkey, data)
except acoustid.AcoustidError as exc:
log.warn(u'acoustid submission error: {0}', exc)
del data[:]
for item in items:
fp = fingerprint_item(log, item)
# Construct a submission dictionary for this item.
item_data = {
'duration': int(item.length),
'fingerprint': fp,
}
if item.mb_trackid:
item_data['mbid'] = item.mb_trackid
log.debug(u'submitting MBID')
else:
item_data.update({
'track': item.title,
'artist': item.artist,
'album': item.album,
'albumartist': item.albumartist,
'year': item.year,
'trackno': item.track,
'discno': item.disc,
})
log.debug(u'submitting textual metadata')
data.append(item_data)
# If we have enough data, submit a chunk.
if len(data) >= chunksize:
submit_chunk()
# Submit remaining data in a final chunk.
if data:
submit_chunk()
def fingerprint_item(log, item, write=False):
"""Get the fingerprint for an Item. If the item already has a
fingerprint, it is not regenerated. If fingerprint generation fails,
return None. If the items are associated with a library, they are
saved to the database. If `write` is set, then the new fingerprints
are also written to files' metadata.
"""
# Get a fingerprint and length for this track.
if not item.length:
log.info(u'{0}: no duration available',
util.displayable_path(item.path))
elif item.acoustid_fingerprint:
if write:
log.info(u'{0}: fingerprint exists, skipping',
util.displayable_path(item.path))
else:
log.info(u'{0}: using existing fingerprint',
util.displayable_path(item.path))
return item.acoustid_fingerprint
else:
log.info(u'{0}: fingerprinting',
util.displayable_path(item.path))
try:
_, fp = acoustid.fingerprint_file(item.path)
item.acoustid_fingerprint = fp
if write:
log.info(u'{0}: writing fingerprint',
util.displayable_path(item.path))
item.try_write()
if item._db:
item.store()
return item.acoustid_fingerprint
except acoustid.FingerprintGenerationError as exc:
log.info(u'fingerprint generation failed: {0}', exc)
| {
"content_hash": "ed9502f2f4606897f958d411ac57824c",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 78,
"avg_line_length": 33.75085324232082,
"alnum_prop": 0.6093639397310142,
"repo_name": "jcoady9/beets",
"id": "b45bcfe3e4e1ea50d697c799bb43dcbcffa44975",
"size": "10560",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "beetsplug/chroma.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2951"
},
{
"name": "HTML",
"bytes": "3307"
},
{
"name": "JavaScript",
"bytes": "85950"
},
{
"name": "Python",
"bytes": "1767900"
},
{
"name": "Shell",
"bytes": "7413"
}
],
"symlink_target": ""
} |
namespace OrderFulfillment.Notifier.Infrastructure
{
/// <summary>
/// Serves as a pseudo-enumeration for the replacement tokens found in an email
/// body emplate.
/// </summary>
public static class EmailBodyTokens
{
/// <summary>The location of a dead letter message. For example, the queue name</summary>
public const string DeadLetterLocation = "{location}";
/// <summary>The partner code associated with an order.</summary>
public const string Partner = "{partner}";
/// <summary>The identifier associated with an order.</summary>
public const string Order = "{orderId}";
/// <summary>The correlation identifier associated with an order operation.</summary>
public const string Correlation = "{correlationId}";
}
}
| {
"content_hash": "611320217db9cfb74cef427f79a7a064",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 98,
"avg_line_length": 39.142857142857146,
"alnum_prop": 0.6605839416058394,
"repo_name": "jsquire/Portfolio",
"id": "1f7a51db005e5660e5b42b02d51f7e05ea4f3caa",
"size": "824",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/OrderFulfillment/Notifier/Infrastructure/EmailBodyTokens.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2804"
},
{
"name": "C",
"bytes": "993"
},
{
"name": "C#",
"bytes": "1667348"
},
{
"name": "C++",
"bytes": "25755"
},
{
"name": "CSS",
"bytes": "718"
},
{
"name": "HTML",
"bytes": "13119"
},
{
"name": "JavaScript",
"bytes": "61345"
},
{
"name": "PHP",
"bytes": "3323"
},
{
"name": "PowerShell",
"bytes": "40977"
},
{
"name": "Python",
"bytes": "10744"
},
{
"name": "Shell",
"bytes": "2793"
}
],
"symlink_target": ""
} |
using OpenLiveWriter.ApplicationFramework;
using System.ComponentModel;
namespace OpenLiveWriter.PostEditor.Commands
{
/// <summary>
/// Summary description for CommandForceWatson.
/// </summary>
public class CommandForceWatson : Command
{
/// <summary>
/// Required designer variable.
/// </summary>
private Container components = null;
public CommandForceWatson(IContainer container)
{
///
/// Required for Windows.Forms Class Composition Designer support
///
container.Add(this);
InitializeComponent();
//
//
//
}
public CommandForceWatson()
{
///
/// Required for Windows.Forms Class Composition Designer support
///
InitializeComponent();
//
//
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component 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()
{
//
// CommandForceWatson
//
this.Identifier = "OpenLiveWriter.PostEditor.Commands.ForceWatson";
this.MenuText = "Force Watson";
this.Text = "Force Watson";
}
#endregion
}
}
| {
"content_hash": "4439b5ba480fffabb8e442428cd910b3",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 70,
"avg_line_length": 19.283783783783782,
"alnum_prop": 0.649614576033637,
"repo_name": "timheuer/OpenLiveWriter-1",
"id": "104572e1b08be293bede0fc7b9752319741ed2de",
"size": "1568",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/managed/OpenLiveWriter.PostEditor/Commands/CommandForceWatson.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "4499"
},
{
"name": "C",
"bytes": "3658"
},
{
"name": "C#",
"bytes": "17275134"
},
{
"name": "C++",
"bytes": "47615"
},
{
"name": "CSS",
"bytes": "1124"
},
{
"name": "HTML",
"bytes": "44830"
},
{
"name": "JavaScript",
"bytes": "432"
},
{
"name": "Smalltalk",
"bytes": "18056"
},
{
"name": "XSLT",
"bytes": "6823"
}
],
"symlink_target": ""
} |
<?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:id="@+id/noteAddCoordinatorLayout"
tools:context="br.com.mobileti.mynotes.activitys.NoteAddActivity">
<include layout="@layout/appbar_layout"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/noteAddContentLayout"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/content_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/noteTitleEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/title"
android:inputType="textPersonName"
android:textSize="@dimen/card_title_size"
android:textStyle="bold" />
<EditText
android:id="@+id/noteContentEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/edit_text_margin_top"
android:ems="10"
android:hint="@string/note"
android:inputType="textMultiLine"
android:textSize="@dimen/card_content_size" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
| {
"content_hash": "fa20b96b6121400bceafba9492a31bc1",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 107,
"avg_line_length": 39.574074074074076,
"alnum_prop": 0.5872718764623304,
"repo_name": "feliperce/MyNotes",
"id": "75fee657d320bcc20868f6e429afdf7420648f93",
"size": "2137",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/activity_note_widget.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "96200"
},
{
"name": "Makefile",
"bytes": "886"
}
],
"symlink_target": ""
} |
module Nyaplot
module Layers
class Accessor < LayerBase
define_args :scale, :label, :type
end
class D2c < LayerBase
define_args :label, :scale
end
class Data < LayerBase
define_args :data
end
class Position2d < LayerBase
define_args :x, :y
end
class Scale < LayerBase
define_args :domain, :range, :type
end
end
end
| {
"content_hash": "984e12d35191e1b71cc327452b799504",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 40,
"avg_line_length": 17.08695652173913,
"alnum_prop": 0.6132315521628499,
"repo_name": "domitry/nyaplot",
"id": "937b04cf85d31b25ada081d447c032fd7920386e",
"size": "393",
"binary": false,
"copies": "1",
"ref": "refs/heads/v2",
"path": "lib/nyaplot/layers/tools.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2212"
},
{
"name": "Ruby",
"bytes": "60622"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Dreams.Core.ViewModels.Third;
using Dreams.Droid.Views.Common;
using MvvmCross.Binding.Droid.BindingContext;
using Android.Support.V7.Widget;
using MvvmCross.Droid.Support.V7.RecyclerView;
using MvvmCross.Droid.Support.V4;
namespace Dreams.Droid.Views.Third
{
[Activity]
public class ThirdView : DreamsViewBase<ThirdView, ThirdViewModel>
{
protected override int ResourceLayoutId
{
get
{
return Resource.Layout.activity_thirdview;
}
}
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
PrepareUI();
}
private void PrepareUI()
{
PrepareRecyclerView();
}
private void PrepareRecyclerView()
{
var recyclerView = FindViewById<MvxRecyclerView>(Resource.Id.my_recycler_view);
recyclerView.ItemTemplateId = Resource.Layout.listitem_thirdview_recyclerview;
BindingSet.Bind(recyclerView).For(x => x.ItemsSource).To(vm => vm.Data);
BindingSet.Bind(recyclerView).For(x => x.ItemClick).To(vm => vm.ItemSelectedCommand);
BindingSet.Apply();
}
}
} | {
"content_hash": "e9c4779d8354c05c752e65950dbe424b",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 97,
"avg_line_length": 27.653846153846153,
"alnum_prop": 0.652990264255911,
"repo_name": "mgj/MvvmCross-Dreams",
"id": "beb3e984bd50dc710bc87f8dcdfde30220aeba9e",
"size": "1438",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "Dreams.Droid/Views/Third/ThirdView.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "40533"
},
{
"name": "CSS",
"bytes": "1868"
},
{
"name": "HTML",
"bytes": "3517"
}
],
"symlink_target": ""
} |
import test = require('blue-tape');
import { join, relative } from 'path';
import { getFiles } from './utils';
test('utils', t => {
t.test('list files', t => {
const FIXTURE_DIR = join(__dirname, '__test__/utils-file-list');
return getFiles(FIXTURE_DIR)
.then(paths => {
let filenames = paths.map(filename => relative(FIXTURE_DIR, filename)).sort();
t.deepEqual(filenames, [
'src/simple.txt',
'pipe.js'
].sort());
});
});
});
| {
"content_hash": "a66dd1cd2c4674ed4c693cea1345f2ad",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 86,
"avg_line_length": 24.9,
"alnum_prop": 0.5502008032128514,
"repo_name": "paked/pipe-ist",
"id": "5e79f452589189a75be386c573ae010c72915226",
"size": "498",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/utils.spec.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "994"
},
{
"name": "TypeScript",
"bytes": "9551"
}
],
"symlink_target": ""
} |
<?php
namespace Symbiote\AdvancedWorkflow\FormFields;
use SilverStripe\Control\Controller;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Security\SecurityToken;
/**
* Handles individual record data editing or deleting.
*
* @package silverstripe-advancedworkflow
*/
class WorkflowFieldItemController extends Controller
{
private static $allowed_actions = array(
'index',
'edit',
'delete',
'Form'
);
protected $parent;
protected $name;
public function __construct($parent, $name, $record)
{
$this->parent = $parent;
$this->name = $name;
$this->record = $record;
parent::__construct();
}
public function index()
{
return $this->edit();
}
public function edit()
{
return $this->Form()->forTemplate();
}
public function Form()
{
$record = $this->record;
$fields = $record->getCMSFields();
$validator = $record->hasMethod('getValidator') ? $record->getValidator() : null;
$save = FormAction::create('doSave', _t('WorkflowReminderTask.SAVE', 'Save'));
$save->addExtraClass('btn btn-primary font-icon-save')
->setUseButtonTag(true);
/** @skipUpgrade */
$form = Form::create($this, 'Form', $fields, FieldList::create($save), $validator);
if ($record && $record instanceof DataObject && $record->exists()) {
$form->loadDataFrom($record);
}
return $form;
}
public function doSave($data, $form)
{
$record = $form->getRecord();
if (!$record || !$record->exists()) {
$record = $this->record;
}
if (!$record->canEdit()) {
$this->httpError(403);
}
if (!$record->isInDb()) {
$record->write();
}
$form->saveInto($record);
$record->write();
return $this->RootField()->forTemplate();
}
public function delete($request)
{
if (!SecurityToken::inst()->checkRequest($request)) {
$this->httpError(400);
}
if (!$request->isPOST()) {
$this->httpError(400);
}
if (!$this->record->canDelete()) {
$this->httpError(403);
}
$this->record->delete();
return $this->RootField()->forTemplate();
}
public function RootField()
{
return $this->parent->RootField();
}
public function Link($action = null)
{
return Controller::join_links($this->parent->Link(), $this->name, $action);
}
}
| {
"content_hash": "b482f50c332f390342e1ec69f5708ec7",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 91,
"avg_line_length": 23.591304347826085,
"alnum_prop": 0.5547364541098415,
"repo_name": "silverstripe-terraformers/advancedworkflow",
"id": "6737b086d8657d9da10b3d791628af3f93ef3727",
"size": "2713",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/FormFields/WorkflowFieldItemController.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "6624"
},
{
"name": "JavaScript",
"bytes": "119099"
},
{
"name": "PHP",
"bytes": "299756"
},
{
"name": "Scheme",
"bytes": "9451"
}
],
"symlink_target": ""
} |
"""
This module contains Cellular Affinity tests.
"""
import math
from enum import IntEnum
from ducktape.mark import matrix
from jinja2 import Template
from ignitetest.services.ignite import IgniteService
from ignitetest.services.ignite_app import IgniteApplicationService
from ignitetest.services.utils.control_utility import ControlUtility
from ignitetest.services.utils.ignite_configuration import IgniteConfiguration, IgniteClientConfiguration
from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster, from_zookeeper_cluster, \
TcpDiscoverySpi
from ignitetest.services.zk.zookeeper import ZookeeperSettings, ZookeeperService
from ignitetest.utils import ignite_versions, cluster
from ignitetest.utils.enum import constructible
from ignitetest.utils.ignite_test import IgniteTest
from ignitetest.utils.version import DEV_BRANCH, IgniteVersion, LATEST
@constructible
class StopType(IntEnum):
"""
Node stop method type.
"""
SIGTERM = 0
SIGKILL = 1
DROP_NETWORK = 2
@constructible
class DiscoreryType(IntEnum):
"""
Discovery type.
"""
ZooKeeper = 0
TCP = 1
@constructible
class TxPrepType(IntEnum):
"""
Transaction preparation type.
"""
CELL_COLOCATED = 0
CELL_NONCOLOCATED = 1
MULTIKEY = 2
class CellularAffinity(IgniteTest):
"""
Tests Cellular Affinity scenarios.
"""
NODES_PER_CELL = 3
ZOOKEPER_CLUSTER_SIZE = 3
FAILURE_DETECTION_TIMEOUT = 2000
ZOOKEPER_SESSION_TIMEOUT = FAILURE_DETECTION_TIMEOUT
ATTRIBUTE = "CELL"
CACHE_NAME = "test-cache"
PREPARED_TX_CNT = 500 # possible amount at real cluster under load (per cell).
CONFIG_TEMPLATE = """
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="affinity">
<bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
<property name="affinityBackupFilter">
<bean class="org.apache.ignite.internal.ducktest.tests.cellular_affinity_test.CellularAffinityBackupFilter">
<constructor-arg value="{{ attr }}"/>
</bean>
</property>
</bean>
</property>
<property name="name" value="{{ cacheName }}"/>
<property name="backups" value="{{ backups }}"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
</bean>
</list>
</property>
""" # noqa: E501
@staticmethod
def properties():
"""
:return: Configuration properties.
"""
return Template(CellularAffinity.CONFIG_TEMPLATE) \
.render(
backups=CellularAffinity.NODES_PER_CELL, # bigger than cell capacity (to handle single cell useless test)
attr=CellularAffinity.ATTRIBUTE,
cacheName=CellularAffinity.CACHE_NAME)
@cluster(num_nodes=NODES_PER_CELL * 3 + 1)
@ignite_versions(str(DEV_BRANCH))
def test_distribution(self, ignite_version):
"""
Tests Cellular Affinity scenario (partition distribution).
"""
cell1 = self.start_cell(ignite_version, ['-D' + CellularAffinity.ATTRIBUTE + '=1'])
discovery_spi = from_ignite_cluster(cell1)
cell2 = self.start_cell(ignite_version, ['-D' + CellularAffinity.ATTRIBUTE + '=2'], discovery_spi)
cell3 = self.start_cell(ignite_version, ['-D' + CellularAffinity.ATTRIBUTE + '=XXX', '-DRANDOM=42'],
discovery_spi)
for cell in [cell1, cell2, cell3]:
cell.await_started()
ControlUtility(cell1).activate()
checker = IgniteApplicationService(
self.test_context,
IgniteClientConfiguration(version=IgniteVersion(ignite_version), discovery_spi=from_ignite_cluster(cell1)),
java_class_name="org.apache.ignite.internal.ducktest.tests.cellular_affinity_test.DistributionChecker",
params={"cacheName": CellularAffinity.CACHE_NAME,
"attr": CellularAffinity.ATTRIBUTE,
"nodesPerCell": self.NODES_PER_CELL})
checker.run()
@cluster(num_nodes=2 * (NODES_PER_CELL + 1) + 3) # cell_cnt * (srv_per_cell + cell_streamer) + zookeper_cluster
@ignite_versions(str(DEV_BRANCH), str(LATEST))
@matrix(stop_type=[StopType.DROP_NETWORK, StopType.SIGKILL, StopType.SIGTERM],
discovery_type=[DiscoreryType.ZooKeeper, DiscoreryType.TCP],
prep_type=[TxPrepType.CELL_COLOCATED])
def test_latency(self, ignite_version, stop_type, discovery_type, prep_type):
"""
Tests Cellular switch tx latency.
"""
cluster_size = self.available_cluster_size
cells_amount = math.floor((cluster_size - self.ZOOKEPER_CLUSTER_SIZE) / (self.NODES_PER_CELL + 1))
assert cells_amount >= 2
self.test_context.logger.info(
"Cells amount calculated as %d at cluster with %d nodes in total" % (cells_amount, cluster_size))
data = {}
discovery_spi = None
modules = []
d_type = DiscoreryType.construct_from(discovery_type)
if d_type is DiscoreryType.ZooKeeper:
zk_settings = ZookeeperSettings(min_session_timeout=self.ZOOKEPER_SESSION_TIMEOUT)
zk_quorum = ZookeeperService(self.test_context, self.ZOOKEPER_CLUSTER_SIZE, settings=zk_settings)
zk_quorum.start()
modules.append('zookeeper')
discovery_spi = from_zookeeper_cluster(zk_quorum)
cell0, prepared_tx_loader1 = \
self.start_cell_with_prepared_txs(ignite_version, f'C{0}', discovery_spi, modules)
if d_type is DiscoreryType.TCP:
discovery_spi = from_ignite_cluster(cell0)
assert discovery_spi is not None
loaders = [prepared_tx_loader1]
nodes = [cell0]
failed_cell_id = 1
for cell_id in range(1, cells_amount):
# per cell
coll_cnt = self.PREPARED_TX_CNT if prep_type == TxPrepType.CELL_COLOCATED else 0
# should not affect switch speed dramatically, cause recovery but not waiting
# avoiding C0 (as not affected) & C1
noncoll_cnt = self.PREPARED_TX_CNT * (cells_amount - 2) \
if cell_id == failed_cell_id and prep_type == TxPrepType.CELL_NONCOLOCATED else 0
# cause waiting for txs with failed primary (~ 3/(cells-1) of prepared tx amount)
# avoiding C0 (as not affected)
multi_cnt = self.PREPARED_TX_CNT * (cells_amount - 1) \
if cell_id == failed_cell_id and prep_type == TxPrepType.MULTIKEY else 0
node, prepared_tx_loader = \
self.start_cell_with_prepared_txs(
ignite_version, f'C{cell_id}', discovery_spi, modules, coll_cnt, noncoll_cnt, multi_cnt)
loaders.append(prepared_tx_loader)
nodes.append(node)
failed_loader = loaders[failed_cell_id]
for node in [*nodes, *loaders]:
node.await_started()
streamers = []
for cell in range(0, cells_amount):
streamers.append(self.start_tx_streamer(ignite_version, "C%d" % cell, discovery_spi, modules))
for streamer in streamers: # starts tx streaming with latency record (with some warmup).
streamer.start_async()
for streamer in streamers:
streamer.await_started()
ControlUtility(cell0).disable_baseline_auto_adjust() # baseline set.
ControlUtility(cell0).activate()
for loader in loaders:
loader.await_event("ALL_TRANSACTIONS_PREPARED", 180, from_the_beginning=True)
for streamer in streamers:
streamer.await_event("WARMUP_FINISHED", 180, from_the_beginning=True)
# node left with prepared txs.
with StopType.construct_from(stop_type) as s_type:
if s_type is StopType.SIGTERM:
failed_loader.stop_async()
elif s_type is StopType.SIGKILL:
failed_loader.kill()
elif s_type is StopType.DROP_NETWORK:
failed_loader.drop_network()
for streamer in streamers:
streamer.await_event("Node left topology\\|Node FAILED", 60, from_the_beginning=True)
for streamer in streamers: # just an assertion that we have PME-free switch.
streamer.await_event("exchangeFreeSwitch=true", 60, from_the_beginning=True)
for streamer in streamers: # waiting for streaming continuation.
streamer.await_event("APPLICATION_STREAMED", 60)
for streamer in streamers: # stops streaming and records results.
streamer.stop_async()
for streamer in streamers:
streamer.await_stopped()
cell = streamer.params["cell"]
data["[%s cell %s]" % ("alive" if cell != failed_loader.params["cell"] else "broken", cell)] = \
"worst_latency=%s, tx_streamed=%s, measure_duration=%s" % (
streamer.extract_result("WORST_LATENCY"), streamer.extract_result("STREAMED"),
streamer.extract_result("MEASURE_DURATION"))
return data
def start_tx_streamer(self, version, cell, discovery_spi, modules):
"""
Starts transaction streamer.
"""
return IgniteApplicationService(
self.test_context,
IgniteClientConfiguration(version=IgniteVersion(version), properties=self.properties(),
discovery_spi=discovery_spi),
java_class_name="org.apache.ignite.internal.ducktest.tests.cellular_affinity_test.CellularTxStreamer",
params={"cacheName": CellularAffinity.CACHE_NAME,
"attr": CellularAffinity.ATTRIBUTE,
"cell": cell,
"warmup": 10000},
modules=modules, startup_timeout_sec=180)
def start_cell_with_prepared_txs(
self, version, cell_id, discovery_spi, modules, col_cnt=0, noncol_cnt=0, multi_cnt=0):
"""
Starts cell with prepared transactions.
"""
nodes = self.start_cell(version, ['-D' + CellularAffinity.ATTRIBUTE + '=' + cell_id], discovery_spi, modules,
CellularAffinity.NODES_PER_CELL - 1)
prepared_tx_streamer = IgniteApplicationService( # last server node at the cell.
self.test_context,
IgniteConfiguration(version=IgniteVersion(version), properties=self.properties(),
failure_detection_timeout=self.FAILURE_DETECTION_TIMEOUT,
discovery_spi=from_ignite_cluster(nodes) if discovery_spi is None else discovery_spi),
java_class_name="org.apache.ignite.internal.ducktest.tests.cellular_affinity_test."
"CellularPreparedTxStreamer",
params={"cacheName": CellularAffinity.CACHE_NAME,
"attr": CellularAffinity.ATTRIBUTE,
"cell": cell_id,
"colocatedTxCnt": col_cnt,
"multiTxCnt": multi_cnt,
"noncolocatedTxCnt": noncol_cnt},
jvm_opts=['-D' + CellularAffinity.ATTRIBUTE + '=' + cell_id], modules=modules, startup_timeout_sec=180)
prepared_tx_streamer.start_async() # starts last server node and creates prepared txs on it.
return nodes, prepared_tx_streamer
def start_cell(self, version, jvm_opts, discovery_spi=None, modules=None, nodes_cnt=NODES_PER_CELL):
"""
Starts cell.
"""
ignites = IgniteService(
self.test_context,
IgniteConfiguration(version=IgniteVersion(version), properties=self.properties(),
cluster_state="INACTIVE",
failure_detection_timeout=self.FAILURE_DETECTION_TIMEOUT,
discovery_spi=TcpDiscoverySpi() if discovery_spi is None else discovery_spi),
num_nodes=nodes_cnt, modules=modules, jvm_opts=jvm_opts, startup_timeout_sec=180)
ignites.start_async()
return ignites
| {
"content_hash": "860fc9262cf7bbdd365f11d7257c35a1",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 144,
"avg_line_length": 40.208333333333336,
"alnum_prop": 0.6117178158628935,
"repo_name": "NSAmelchev/ignite",
"id": "e6e2bed1a3f859c18366db6894a79043a0297e0b",
"size": "13326",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "modules/ducktests/tests/ignitetest/tests/cellular_affinity_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "54788"
},
{
"name": "C",
"bytes": "7601"
},
{
"name": "C#",
"bytes": "7740054"
},
{
"name": "C++",
"bytes": "4487801"
},
{
"name": "CMake",
"bytes": "54473"
},
{
"name": "Dockerfile",
"bytes": "11909"
},
{
"name": "FreeMarker",
"bytes": "15591"
},
{
"name": "HTML",
"bytes": "14341"
},
{
"name": "Java",
"bytes": "50117357"
},
{
"name": "JavaScript",
"bytes": "1085"
},
{
"name": "Jinja",
"bytes": "32958"
},
{
"name": "Makefile",
"bytes": "932"
},
{
"name": "PHP",
"bytes": "11079"
},
{
"name": "PowerShell",
"bytes": "9247"
},
{
"name": "Python",
"bytes": "330115"
},
{
"name": "Scala",
"bytes": "425434"
},
{
"name": "Shell",
"bytes": "311510"
}
],
"symlink_target": ""
} |
package io.reactivesw.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* Created by Davis on 16/12/19.
*/
@Configuration
public class RestTemplateConfig {
/**
* Rest template bean.
*
* @return the rest template
*/
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
| {
"content_hash": "0f92612a04d09aad1ac875d5ec86924f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 60,
"avg_line_length": 21.476190476190474,
"alnum_prop": 0.7361419068736141,
"repo_name": "reactivesw/customer_server",
"id": "7c266e337d11b4676bd4b22d41e00fbbee38c874",
"size": "451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/io/reactivesw/configuration/RestTemplateConfig.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "158793"
},
{
"name": "Java",
"bytes": "945633"
}
],
"symlink_target": ""
} |
namespace tap {
struct OpaqueObject {
PyObject_HEAD
};
static PyObject *opaque_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) noexcept
{
return type->tp_alloc(type, 0);
}
static void opaque_dealloc(PyObject *opaque) noexcept
{
Py_TYPE(opaque)->tp_free(opaque);
}
struct OpaqueTypeObject: public PyTypeObject {
OpaqueTypeObject(const std::string &name)
{
size_t prefix_len = strlen(TAP_OPAQUE_PREFIX);
auto opaque_name_len = prefix_len + name.length();
auto opaque_name = new char[opaque_name_len + 1];
memcpy(opaque_name, TAP_OPAQUE_PREFIX, prefix_len);
memcpy(opaque_name + prefix_len, name.data(), name.length());
opaque_name[opaque_name_len] = '\0';
memset(static_cast<PyTypeObject *> (this), 0, sizeof (PyTypeObject));
ob_base.ob_base.ob_refcnt = 1;
tp_name = opaque_name;
tp_basicsize = sizeof (OpaqueTypeObject);
tp_dealloc = opaque_dealloc;
tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE;
tp_new = opaque_new;
}
~OpaqueTypeObject() noexcept
{
delete[] tp_name;
}
private:
OpaqueTypeObject(const OpaqueTypeObject &);
void operator=(const OpaqueTypeObject &);
};
PyTypeObject *opaque_type_for_name(const std::string &name) noexcept
{
auto &types = instance_opaque_types();
PyTypeObject *type = nullptr;
auto i = types.find(name);
if (i != types.end()) {
type = i->second;
} else {
OpaqueTypeObject *opaque_type;
try {
opaque_type = new OpaqueTypeObject(name);
if (PyType_Ready(opaque_type) < 0) {
delete opaque_type;
return nullptr;
}
try {
types.insert(std::make_pair(name, opaque_type));
} catch (...) {
delete opaque_type;
return nullptr;
}
} catch (...) {
return nullptr;
}
type = opaque_type;
}
return type;
}
static int opaque_traverse(PyObject *object, visitproc visit, void *arg) noexcept
{
return 0;
}
static Py_ssize_t opaque_marshaled_size(PyObject *object) noexcept
{
return strlen(Py_TYPE(object)->tp_name);
}
static int opaque_marshal(PyObject *object, void *buf, Py_ssize_t size, PeerObject &peer) noexcept
{
const char *name = Py_TYPE(object)->tp_name;
memcpy(buf, name, strlen(name));
return 0;
}
static PyObject *opaque_unmarshal_alloc(const void *data, Py_ssize_t size, PeerObject &peer) noexcept
{
if (size == 0)
return nullptr;
auto text = reinterpret_cast <const char *> (data);
for (int i = 0; i < size; i++) {
if (text[i] == '\0')
return nullptr;
}
if (!unicode_verify_utf8(text, size)) {
fprintf(stderr, "tap opaque unmarshal: bad UTF-8\n");
return nullptr;
}
PyTypeObject *type = nullptr;
try {
type = opaque_type_for_name(std::string(text, size));
} catch (...) {
}
if (type == nullptr)
return nullptr;
return type->tp_alloc(type, 0);
}
static int opaque_unmarshal_init(PyObject *object, const void *data, Py_ssize_t size, PeerObject &peer) noexcept
{
return 0;
}
const TypeHandler opaque_type_handler = {
OPAQUE_TYPE_ID,
opaque_traverse,
opaque_marshaled_size,
opaque_marshal,
opaque_unmarshal_alloc,
opaque_unmarshal_init,
};
} // namespace tap
| {
"content_hash": "76d8c244bbf72707e16992daf5a8379d",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 112,
"avg_line_length": 21.556338028169016,
"alnum_prop": 0.6811499509964064,
"repo_name": "tsavola/tap",
"id": "ef8346d451ad23ace572d565ad2d628c0519b374",
"size": "3149",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tap/core/opaque.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C++",
"bytes": "71043"
},
{
"name": "Makefile",
"bytes": "255"
},
{
"name": "Python",
"bytes": "4780"
}
],
"symlink_target": ""
} |
title: Telerik.Web.UI.DiagramGradientStop
page_title: Telerik.Web.UI.DiagramGradientStop
description: Telerik.Web.UI.DiagramGradientStop
---
# Telerik.Web.UI.DiagramGradientStop
The array of gradient color stops.
## Inheritance Hierarchy
* System.Object
* Telerik.Web.StateManager : IMarkableStateManager, IStateManager
* Telerik.Web.UI.DiagramGradientStop
## Properties
### Color `String`
The color in any of the following formats.| Format | Description | --- | --- | --- | red | Basic or Extended CSS Color name | #ff0000 | Hex RGB value | rgb(255, 0, 0) | RGB valueSpecifying 'none', 'transparent' or '' (empty string) will clear the fill.
### Offset `Double`
The stop offset from the start of the element. Ranges from 0 (start of gradient) to 1 (end of gradient).
### Opacity `Double`
The fill opacity. Ranges from 0 (completely transparent) to 1 (completely opaque).
| {
"content_hash": "b51bf1678ca179b019eae7743dbea3f1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 289,
"avg_line_length": 31.862068965517242,
"alnum_prop": 0.7077922077922078,
"repo_name": "telerik/ajax-docs",
"id": "1514257c8aa23add8941a3debdb52fd75282f961",
"size": "928",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/server/Telerik.Web.UI/DiagramGradientStop.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP.NET",
"bytes": "2253"
},
{
"name": "C#",
"bytes": "6026"
},
{
"name": "HTML",
"bytes": "2240"
},
{
"name": "JavaScript",
"bytes": "3052"
},
{
"name": "Ruby",
"bytes": "3275"
}
],
"symlink_target": ""
} |
$(document).ready(function() {
$('[data-org-select=select-org]').click(function(){
clickOrg(this);
return false;
});
var clickOrg = function(click)
{
var id = $(click).attr('data-org-id');
console.log("Going to id " + id);
location.href = goToOrg.replace("0", id);
};
$('[data-save-state=create-new-org]').click(function() {
$('[data-save-state=create-new-org]').attr('disabled', 'disabled');
$('[data-save-state=create-new-org-cancel]').attr('disabled', 'disabled');
var removeDisabledOrg = function () {
$('[data-save-state=create-new-org]').removeAttr('disabled');
$('[data-save-state=create-new-org-cancel]').removeAttr('disabled');
};
var hideCreateNewOrg = function()
{
$('#createNewOrg').modal('hide');
removeDisabledOrg();
};
var name = $('[data-save-state=create-new-org-name]').val();
if (!name)
{
$("#name-error").show();
setTimeout(function() { $("#name-error").hide(); }, 2000);
removeDisabledOrg();
}
else
{
$.ajax({
type: "POST",
url: createOrg,
data: {
name: name
},
success: function(data, textStatus, resp)
{
var id = resp.getResponseHeader("X-new-id");
hideCreateNewOrg();
var el = $("<a href='#' data-org-select='select-org' data-org-id='" + id + "' class='list-group-item'>" + name + "</a>");
el.click(function()
{
clickOrg(this);
return false;
});
$("#add-org").parent().append(el);
}
});
}
});
}); | {
"content_hash": "4cfeba52f74c426a2aac7bf993e6ae3a",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 141,
"avg_line_length": 28.970149253731343,
"alnum_prop": 0.43791859866048427,
"repo_name": "vrbh/site",
"id": "4971762f413e0f212a2d3f0bf04482fcaf3b8aa2",
"size": "1941",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Vrbh/SiteBundle/Resources/public/org.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2458"
},
{
"name": "JavaScript",
"bytes": "11448"
},
{
"name": "PHP",
"bytes": "139133"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>persistent-union-find: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.11.0 / persistent-union-find - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
persistent-union-find
<small>
8.6.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-12-12 17:32:44 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-12 17:32:44 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.11.0 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.09.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.09.1 Official release 4.09.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/persistent-union-find"
license: "Unknown"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/PersistentUnionFind"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [ "keyword: program verification" "keyword: union-find" "keyword: data structures" "keyword: Tarjan" "category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms" ]
authors: [ "Jean-Christophe Filliâtre" ]
bug-reports: "https://github.com/coq-contribs/persistent-union-find/issues"
dev-repo: "git+https://github.com/coq-contribs/persistent-union-find.git"
synopsis: "Persistent Union Find"
description: """
http://www.lri.fr/~filliatr/puf/
Correctness proof of the Ocaml implementation of a persistent union-find
data structure. See http://www.lri.fr/~filliatr/puf/ for more details."""
flags: light-uninstall
url {
src:
"https://github.com/coq-contribs/persistent-union-find/archive/v8.6.0.tar.gz"
checksum: "md5=1a1b9fc184e0d23e1fd01ff4b845d01e"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-persistent-union-find.8.6.0 coq.8.11.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.11.0).
The following dependencies couldn't be met:
- coq-persistent-union-find -> coq < 8.7~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-persistent-union-find.8.6.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "84f1667d66eb4f7a85da4ea956a3eaec",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 265,
"avg_line_length": 42.75609756097561,
"alnum_prop": 0.5506274957216201,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "a6a1eaa89271c2cf7c0545a336bfff79156d91d1",
"size": "7038",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.09.1-2.0.6/released/8.11.0/persistent-union-find/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
using System;
using System.Linq;
using System.Windows.Forms;
using Microsoft.PythonTools.Interpreter;
using Microsoft.VisualStudioTools;
namespace Microsoft.PythonTools.Project {
public partial class PythonGeneralPropertyPageControl : UserControl {
static readonly IPythonInterpreterFactory Separator =
new InterpreterPlaceholder("", Strings.PythonGeneralPropertyPageControl_OtherInterpretersSeparator);
static readonly IPythonInterpreterFactory GlobalDefault =
new InterpreterPlaceholder("", Strings.PythonGeneralPropertyPageControl_UseGlobalDefaultInterpreter);
private IInterpreterRegistryService _service;
private readonly PythonGeneralPropertyPage _propPage;
internal PythonGeneralPropertyPageControl(PythonGeneralPropertyPage newPythonGeneralPropertyPage) {
InitializeComponent();
_propPage = newPythonGeneralPropertyPage;
}
internal void LoadSettings() {
_service = _propPage.Project.Site.GetComponentModel().GetService<IInterpreterRegistryService>();
StartupFile = _propPage.Project.GetProjectProperty(CommonConstants.StartupFile, false);
WorkingDirectory = _propPage.Project.GetProjectProperty(CommonConstants.WorkingDirectory, false);
if (string.IsNullOrEmpty(WorkingDirectory)) {
WorkingDirectory = ".";
}
IsWindowsApplication = Convert.ToBoolean(_propPage.Project.GetProjectProperty(CommonConstants.IsWindowsApplication, false));
OnInterpretersChanged();
if (_propPage.PythonProject.IsActiveInterpreterGlobalDefault) {
// ActiveInterpreter will never be null, so we need to check
// the property to find out if it's following the global
// default.
SetDefaultInterpreter(null);
} else {
SetDefaultInterpreter(_propPage.PythonProject.ActiveInterpreter);
}
}
private void InitializeInterpreters() {
_defaultInterpreter.BeginUpdate();
try {
var selection = _defaultInterpreter.SelectedItem;
_defaultInterpreter.Items.Clear();
var available = _propPage.PythonProject.InterpreterFactories.ToArray();
var globalInterpreters = _service.Interpreters.Where(f => f.IsUIVisible() && f.CanBeDefault()).ToList();
if (available != null && available.Length > 0) {
foreach (var interpreter in available) {
_defaultInterpreter.Items.Add(interpreter);
globalInterpreters.Remove(interpreter);
}
if (globalInterpreters.Any()) {
_defaultInterpreter.Items.Add(Separator);
foreach (var interpreter in globalInterpreters) {
_defaultInterpreter.Items.Add(interpreter);
}
}
} else {
_defaultInterpreter.Items.Add(GlobalDefault);
foreach (var interpreter in globalInterpreters) {
_defaultInterpreter.Items.Add(interpreter);
}
}
if (_propPage.PythonProject.IsActiveInterpreterGlobalDefault) {
// ActiveInterpreter will never be null, so we need to check
// the property to find out if it's following the global
// default.
SetDefaultInterpreter(null);
} else if (selection != null) {
SetDefaultInterpreter((IPythonInterpreterFactory)selection);
} else {
SetDefaultInterpreter(_propPage.PythonProject.ActiveInterpreter);
}
} finally {
_defaultInterpreter.EndUpdate();
}
}
internal void OnInterpretersChanged() {
_defaultInterpreter.SelectedIndexChanged -= Changed;
InitializeInterpreters();
_defaultInterpreter.SelectedIndexChanged += Changed;
}
public string StartupFile {
get { return _startupFile.Text; }
set { _startupFile.Text = value; }
}
public string WorkingDirectory {
get { return _workingDirectory.Text; }
set { _workingDirectory.Text = value; }
}
public bool IsWindowsApplication {
get { return _windowsApplication.Checked; }
set { _windowsApplication.Checked = value; }
}
public IPythonInterpreterFactory DefaultInterpreter {
get {
if (_defaultInterpreter.SelectedItem == GlobalDefault) {
return null;
}
return _defaultInterpreter.SelectedItem as IPythonInterpreterFactory;
}
}
public void SetDefaultInterpreter(IPythonInterpreterFactory interpreter) {
if (interpreter == null) {
_defaultInterpreter.SelectedIndex = 0;
} else {
try {
_defaultInterpreter.SelectedItem = interpreter;
} catch (IndexOutOfRangeException) {
_defaultInterpreter.SelectedIndex = 0;
}
}
}
private void Changed(object sender, EventArgs e) {
if (_defaultInterpreter.SelectedItem == Separator) {
_defaultInterpreter.SelectedItem = _propPage.PythonProject.ActiveInterpreter;
}
_propPage.IsDirty = true;
}
private void Interpreter_Format(object sender, ListControlConvertEventArgs e) {
var factory = e.ListItem as IPythonInterpreterFactory;
e.Value = factory?.Configuration?.Description ?? e.ListItem?.ToString() ?? "-";
}
}
}
| {
"content_hash": "1fcdb6c9876b293a434305dfb4030683",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 136,
"avg_line_length": 41.44827586206897,
"alnum_prop": 0.5920133111480865,
"repo_name": "int19h/PTVS",
"id": "26bbe83636a8adc4cf72a0f80771e84109a8c269",
"size": "6731",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Python/Product/PythonTools/PythonTools/Project/PythonGeneralPropertyPageControl.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP.NET",
"bytes": "109"
},
{
"name": "Batchfile",
"bytes": "7975"
},
{
"name": "C",
"bytes": "21444"
},
{
"name": "C#",
"bytes": "11297254"
},
{
"name": "C++",
"bytes": "175131"
},
{
"name": "CSS",
"bytes": "4109"
},
{
"name": "HTML",
"bytes": "213660"
},
{
"name": "JavaScript",
"bytes": "44401"
},
{
"name": "PowerShell",
"bytes": "18157"
},
{
"name": "Pug",
"bytes": "2807"
},
{
"name": "Python",
"bytes": "620501"
},
{
"name": "Rich Text Format",
"bytes": "260880"
},
{
"name": "Smarty",
"bytes": "3663"
},
{
"name": "Tcl",
"bytes": "24968"
},
{
"name": "Vim Snippet",
"bytes": "17303"
}
],
"symlink_target": ""
} |
The first of this course is to create a Node.js application that can run on Heroku and locally (for testing).
### Creation of a Git Repository
Our source code is going to be stored in a Git repository. Heroku uses Git for deployment, and it's also a better habit to use git.
To create a new empty repository, run on a terminal:
```
$ mkdir myapp
$ cd myapp
$ git init
```
We are now going to work on this `myapp` folder.
You can also host this repository on [GitHub](https://github.com), this is optional but advised:
1. Create a repository on GitHub
2. On a terminal in the `myapp` folder run: `git remote set-url upstream <git url for the repository>`
The url for the repository on GitHub is in the format: `https://github.com/<username>/<repository>.git`.
### Creation of a base for a Node.js application
Now that our git repository is ready, we can start working on writting our node.js application.
In a terminal in the `myapp` folder, run:
```
$ npm init
```
It will ask you for multiple questions and generate a `package.json` file. This file will contain the list of your dependencies (the librairies our program will depend on) and some others descriptives informations.
### Commit our base
It's time to commit our first commit for this application:
```
$ git add package.json
$ git commit -m "Base package.json"
```
And push it to GitHub:
```
$ git push
```
| {
"content_hash": "13fa97055de8ca8b3ca6a8b0f2ca1d3d",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 214,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.7344877344877345,
"repo_name": "SamyPesse/book-heroku-node",
"id": "2e4b8e82d2c8a65c9f05226defd871b538f6d7e8",
"size": "1414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "creation.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using std::exception;
using std::runtime_error;
namespace {
class ForkException: public util::Exception<ForkException> {};
static void Usage(int who) {
struct rusage usage;
memset(&usage, 0, sizeof(usage));
if (-1 == getrusage(who, &usage)) {
throw runtime_error("failed to get self usage");
}
fprintf(stderr, "user: %ld.%06ld sys: %ld.%06ld\n", usage.ru_utime.tv_sec, usage.ru_utime.tv_usec, usage.ru_stime.tv_sec, usage.ru_stime.tv_usec);
}
} // namespace
int main(int argc, char* argv[]) try {
if (2 > argc) {
Usage(RUSAGE_SELF);
return 0;
}
pid_t chpid {fork()};
switch (chpid) {
case 0:
execvp(argv[1], argv + 1); // fall through on error
case -1:
throw ForkException() << "failed to execute command " << strerror(errno);
default:
if (-1 == waitpid(chpid, nullptr, 0)) {
throw ForkException() << strerror(errno) << " child pid " << chpid;
}
Usage(RUSAGE_CHILDREN);
}
return 0;
} catch (const exception& err) {
fprintf(stderr, "%s: %s\n", *argv, err.what());
return 1;
}
| {
"content_hash": "c4eb8e0e0fe386a6feca336b5a95f6a7",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 150,
"avg_line_length": 28.05,
"alnum_prop": 0.5855614973262032,
"repo_name": "skhal/ap_unix",
"id": "4fcd54f99206d06e54596aa55a92723fc0d026a3",
"size": "1366",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/ch8/rusage_main.cc",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "96027"
},
{
"name": "CMake",
"bytes": "4102"
},
{
"name": "Shell",
"bytes": "2418"
}
],
"symlink_target": ""
} |
FROM balenalib/etcher-pro-debian:jessie-run
ENV GO_VERSION 1.15.7
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
git \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& fetchDeps=' \
curl \
' \
&& apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/local/go \
&& curl -SLO "https://storage.googleapis.com/golang/go$GO_VERSION.linux-arm64.tar.gz" \
&& echo "bca4af0c20f86521dfabf3b39fa2f1ceeeb11cebf7e90bdf1de2618c40628539 go$GO_VERSION.linux-arm64.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.linux-arm64.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.linux-arm64.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Jessie \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.15.7 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "a0024448a78851775e21ebd55555635c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 672,
"avg_line_length": 50.08695652173913,
"alnum_prop": 0.7048611111111112,
"repo_name": "nghiant2710/base-images",
"id": "ce4b9d6d11153b847dda69cd6588f7ee8b466e02",
"size": "2325",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/golang/etcher-pro/debian/jessie/1.15.7/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
struct retroSprite;
struct retroSpriteObject;
typedef int (*cust_fread_t) (void *ptr, int size,int elements, void *fd);
//------------ video -------------
struct retroRGB
{
unsigned short r;
unsigned short g;
unsigned short b;
};
struct retroRainbow
{
int color; // color to change.
struct retroRGB *table; // set Rainbow
int tableSize; // set Rainbow
int offset; // rainbow
int verticalOffset; // rainbow (vertical offset)
int height; // height of copper
};
struct retroScanline
{
int beamStart;
int pixels;
int videoWidth;
unsigned char *data[2];
struct retroScreen *screen;
struct retroRGB *orgPalette;
struct retroRGB *rowPalette;
void (*mode) ( struct retroScanline *line, int beamY, unsigned int *video_buffer );
};
struct retroParallax
{
int beamStart;
struct retroScanline scanline[2];
};
struct retroFlash
{
int delay;
struct retroRGB rgb;
};
struct retroFlashTable
{
int color;
int colors;
int index;
int countDelay; // counts up to delay, increments value.
struct retroFlash *table;
};
struct retroShiftColors
{
int delay;
int countDelay; // counts up to delay, increments value.
unsigned char firstColor;
unsigned char lastColor;
unsigned char flags;
};
struct retroEngine
{
struct RastPort rp;
struct Window *window;
unsigned int width;
unsigned int height;
BOOL limit_mouse;
unsigned int limit_mouse_x0;
unsigned int limit_mouse_y0;
unsigned int limit_mouse_x1;
unsigned int limit_mouse_y1;
};
struct retroVideo
{
struct retroScreen *attachedScreens[256];
struct retroScreen **attachedScreens_end;
int screensAttached;
struct retroRainbow rainbow[4]; // 0..3 is 4
struct retroParallax scanlines[480];
unsigned int *Memory;
unsigned int BytesPerRow;
unsigned int width;
unsigned int height;
BOOL refreshAllScanlines;
BOOL refreshSomeScanlines;
// Sprites
struct retroSpriteObject *sprites;
struct retroSpriteObject *sprites_end;
int spriteObjectsAllocated;
};
enum
{
flag_block_vrev = 1,
flag_block_hrev = 2
};
struct retroBlock
{
int id;
int x;
int y;
int w;
int h;
int mask;
unsigned char *mem;
int flag;
};
struct retroMemFd
{
char *mem;
unsigned int off;
unsigned int size;
};
struct p
{
double x ; double y ;
};
#define retroscreen_flag_hide 1
struct retroTextWindow
{
int id;
int locateX;
int locateY;
int x,y;
int charsPerRow;
int rows;
int border;
int set;
struct retroBlock *saved;
char *title_top;
char *title_bottom;
};
// retro screen event_flags
enum
{
rs_force_swap = 1,
rs_bob_moved = 2,
rs_force_update = 4
};
struct retroScreen
{
int scanline_x;
int scanline_y;
int offset_x;
int offset_y;
union {
int bytesPerRow;
int realWidth;
};
int realHeight;
int displayWidth;
int displayHeight;
int clip_x0;
int clip_y0;
int clip_x1;
int clip_y1;
unsigned int videomode;
unsigned char *Memory[2];
// color palette and copper palette
struct retroRGB orgPalette[256];
struct retroRGB rowPalette[256];
struct retroRGB fadePalette[256];
// keeping track of what video its attached to.
struct retroVideo *attachedToVideo;
// typical classic effects flash and color shifting
struct retroFlashTable *allocatedFlashs[256];
struct retroFlashTable **allocatedFlashs_end;
int flashsAllocated;
struct retroShiftColors *allocatedShifts[256]; // you can't shift more colors then there is on the screen.
struct retroShiftColors **allocatedShifts_end;
int shiftsAllocated;
int clones;
BOOL refreshScanlines;
struct retroScreen *cloneOfScreen;
struct retroScreen *dualScreen;
struct retroTextWindow *currentTextWindow;
struct retroTextWindow **textWindows;
int allocatedTextWindows;
unsigned int pen;
unsigned int paper;
unsigned int ink0;
unsigned int ink1;
unsigned int ink2;
BOOL coopered_last;
unsigned int flags;
int fade_speed; // fade_speed 0, disabled.
int fade_count; // count up to speed, then change color by one step -0x11 or +0x11
int double_buffer_draw_frame;
int autoback;
unsigned int event_flags;
};
struct retroMask
{
unsigned short int16PerRow;
unsigned short height;
unsigned short *data;
};
struct retroFrame
{
struct retroScreen *screen;
int x1;
int y1;
int x2;
int y2;
int hotspotX;
int hotspotY;
};
struct retroFrameHeaderShort
{
unsigned short planarXSize; // (divided by 16)
unsigned short height;
unsigned short numberOfPlains;
short XHotSpot;
short YHotSpot;
};
struct retroFrameHeader
{
unsigned short planarXSize; // (divided by 16)
unsigned short height;
unsigned short numberOfPlains;
short XHotSpot;
short YHotSpot;
short retroFlag;
union
{
int bytesPerRow;
int width;
};
char *data;
struct retroMask *mask;
int alpha;
};
enum
{
retro_flag_solid,
retro_flag_transparent = 1,
retro_flag_multicolor = 2,
retro_flag_scaned = 4
};
struct retroSprite
{
short number_of_frames;
struct retroFrameHeader *frames;
struct retroRGB palette[256];
};
struct retroSpriteClear
{
int x,y,image;
int w,h;
char *mem;
int size;
int drawn;
};
struct retroSpriteObject
{
unsigned int id;
int x;
int y;
int image;
int screen_id;
struct retroSpriteClear clear[2];
struct retroSprite *sprite; // optional
struct retroFrameHeader *frame; // optional
int background;
int plains;
int mask;
int limitXmin;
int limitYmin;
int limitXmax;
int limitYmax;
};
#define retroLowres 1
#define retroLowres_pixeld 2
#define retroHires 4
#define retroInterlaced 8
#define retroHam6 16
#define retroHam8 32
// so for va_list / va_start / va_arg, don't give you a count, so need to tell ... arg this is the end.
#define retroEnd (~(1<<31))
#define ECSColorToRGB32( ecs, color ) \
color.r =(( ecs & 0xF00) >> 8) * 0x11; \
color.g =(( ecs & 0x0F0) >> 4) * 0x11; \
color.b =( ecs & 0x00F) * 0x11;
#define RGB32ColorToECS( color, ecs ) \
ecs = ( color.r & 0xF00000) >> 20 ; \
ecs |=( color.g & 0x00F000) >> 12; \
ecs |=( color.b & 0x0000F0) >> 4;
#endif
| {
"content_hash": "0c1f57ccefc3630053abde82fad77991",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 107,
"avg_line_length": 17.96385542168675,
"alnum_prop": 0.7131120053655265,
"repo_name": "khval/RetroMode-AmigaOS-GFXLIB",
"id": "4034e397d0b89ac3c5c15e176182fedff224d751",
"size": "6112",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/libraries/retroMode.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "279"
},
{
"name": "C",
"bytes": "238123"
},
{
"name": "C++",
"bytes": "133921"
},
{
"name": "Makefile",
"bytes": "3409"
}
],
"symlink_target": ""
} |
new project
| {
"content_hash": "4bc1a4fe41318035da98cc484224c3c5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 11,
"avg_line_length": 12,
"alnum_prop": 0.8333333333333334,
"repo_name": "pmemegithub/WiWi",
"id": "f6e85c722af7abe8b59fb09167ead4314e097434",
"size": "19",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package org.deviceconnect.android.manager.core.plugin;
import android.content.Context;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* プラグインとの通信機能を実装する基底クラス.
*
* @author NTT DOCOMO, INC.
*/
abstract class AbstractConnection implements Connection {
/** コンテキスト. */
protected final Context mContext;
/** 接続先のプラグインID. */
private final String mPluginId;
/** 接続状態変更を通知するスレッド. */
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
/** 接続状態変更リスナーのリスト. */
private final List<ConnectionStateListener> mConnectionStateListeners = new ArrayList<>();
/** 接続状態. */
private ConnectionState mState = ConnectionState.DISCONNECTED;
/**
* 連携停止の原因となったエラー.
*
* 接続状態が {@link ConnectionState#SUSPENDED} に遷移する時に設定し、
* それ以外の状態に遷移する時は<code>null</code>を設定すること.
*/
private ConnectionError mError;
/**
* コンストラクタ.
* @param context コンテキスト
* @param pluginId 接続先のプラグインID
*/
protected AbstractConnection(final Context context, final String pluginId) {
if (context == null) {
throw new IllegalArgumentException("context is null.");
}
if (pluginId == null) {
throw new IllegalArgumentException("pluginId is null.");
}
mContext = context;
mPluginId = pluginId;
}
@Override
public String getPluginId() {
return mPluginId;
}
@Override
public ConnectionState getState() {
return mState;
}
@Override
public ConnectionError getCurrentError() {
return mError;
}
/**
* 接続状態を設定する.
* @param state 遷移先の接続状態
*/
private void setState(final ConnectionState state) {
mState = state;
notifyStateChange(state, getCurrentError());
}
protected void setSuspendedState(final ConnectionError error) {
mError = error;
setState(ConnectionState.SUSPENDED);
}
protected void setConnectedState() {
mError = null;
setState(ConnectionState.CONNECTED);
}
protected void setConnectingState() {
setState(ConnectionState.CONNECTING);
}
protected void setDisconnectedState() {
mError = null;
setState(ConnectionState.DISCONNECTED);
}
@Override
public void addConnectionStateListener(final ConnectionStateListener listener) {
synchronized (mConnectionStateListeners) {
for (ConnectionStateListener cache : mConnectionStateListeners) {
if (cache == listener) {
return;
}
}
mConnectionStateListeners.add(listener);
}
}
@Override
public void removeConnectionStateListener(ConnectionStateListener listener) {
synchronized (mConnectionStateListeners) {
for (Iterator<ConnectionStateListener> it = mConnectionStateListeners.iterator(); it.hasNext(); ) {
ConnectionStateListener cache = it.next();
if (cache == listener) {
it.remove();
return;
}
}
}
}
/**
* 接続状態変更を通知する.
* @param state 遷移先の接続状態
* @param error 接続エラー
*/
private void notifyStateChange(final ConnectionState state,
final ConnectionError error) {
synchronized (mConnectionStateListeners) {
if (mConnectionStateListeners.size() > 0) {
for (final ConnectionStateListener l : mConnectionStateListeners) {
mExecutor.execute(() -> {
sendLocalBroadcast(state, error);
l.onConnectionStateChanged(mPluginId, state);
});
}
}
}
}
private void sendLocalBroadcast(final ConnectionState state,
final ConnectionError error) {
Intent notification = new Intent(ACTION_CONNECTION_STATE_CHANGED);
notification.putExtra(EXTRA_PLUGIN_ID, mPluginId);
notification.putExtra(EXTRA_CONNECTION_STATE, state);
notification.putExtra(EXTRA_CONNECTION_ERROR, error);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(notification);
}
}
| {
"content_hash": "e597b7eadce324d16e72d4895fe0c77d",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 111,
"avg_line_length": 28.738853503184714,
"alnum_prop": 0.6216755319148937,
"repo_name": "TakayukiHoshi1984/DeviceConnect-Android",
"id": "5a1819b34271decadabbc6122615d08a981e667e",
"size": "5025",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "dConnectManager/dConnectManager/dconnect-manager-core/src/main/java/org/deviceconnect/android/manager/core/plugin/AbstractConnection.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "AIDL",
"bytes": "678"
},
{
"name": "C",
"bytes": "186682"
},
{
"name": "C++",
"bytes": "63628"
},
{
"name": "CMake",
"bytes": "3472"
},
{
"name": "CSS",
"bytes": "12886"
},
{
"name": "HTML",
"bytes": "59976"
},
{
"name": "Java",
"bytes": "7280246"
},
{
"name": "JavaScript",
"bytes": "357443"
},
{
"name": "Makefile",
"bytes": "1525"
}
],
"symlink_target": ""
} |
namespace Core.Blocks.Input
{
partial class SystemParameterOptionsWindow
{
/// <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.comboBox_Variable = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// comboBox_Variable
//
this.comboBox_Variable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox_Variable.FormattingEnabled = true;
this.comboBox_Variable.Location = new System.Drawing.Point(36, 33);
this.comboBox_Variable.Name = "comboBox_Variable";
this.comboBox_Variable.Size = new System.Drawing.Size(232, 21);
this.comboBox_Variable.TabIndex = 2;
//
// SystemParameterOptionsWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 462);
this.Controls.Add(this.comboBox_Variable);
this.Name = "SystemParameterOptionsWindow";
this.Text = "SystemParameterOptionsWindow";
this.Controls.SetChildIndex(this.comboBox_Variable, 0);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox comboBox_Variable;
}
} | {
"content_hash": "36c60315560e64fcd1cf37b4214d37fe",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 107,
"avg_line_length": 37.916666666666664,
"alnum_prop": 0.5753846153846154,
"repo_name": "code-google-com/visual-shader-editor",
"id": "50a38c9e04db1c2dc60dc3f6854a96f8de8eaf63",
"size": "2277",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Core/Blocks/Input/SystemParameterOptionsWindow.Designer.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "563674"
},
{
"name": "FLUX",
"bytes": "2358"
}
],
"symlink_target": ""
} |
<?php
namespace Lle\PdfReportBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder->root('lle_pdf_report');
return $treeBuilder;
}
}
| {
"content_hash": "74b9fa085afe1f9a40df111beb3e0064",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 131,
"avg_line_length": 28.458333333333332,
"alnum_prop": 0.7291361639824304,
"repo_name": "2lenet/LlePdfReportBundle",
"id": "0a638c05e37833d2af78fdcd5ab3ccf1a5d30cf4",
"size": "683",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DependencyInjection/Configuration.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "9590"
},
{
"name": "PHP",
"bytes": "201889"
}
],
"symlink_target": ""
} |
package org.apache.metamodel.excel;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
import org.apache.metamodel.DataContext;
import org.apache.metamodel.MetaModelHelper;
import org.apache.metamodel.UpdateCallback;
import org.apache.metamodel.UpdateScript;
import org.apache.metamodel.data.DataSet;
import org.apache.metamodel.data.Row;
import org.apache.metamodel.data.Style;
import org.apache.metamodel.data.StyleBuilder;
import org.apache.metamodel.query.Query;
import org.apache.metamodel.schema.Column;
import org.apache.metamodel.schema.Schema;
import org.apache.metamodel.schema.Table;
import org.apache.metamodel.util.DateUtils;
import org.apache.metamodel.util.FileHelper;
import org.apache.metamodel.util.Month;
public class ExcelDataContextTest extends TestCase {
/**
* Creates a copy of a particular file - to avoid changing of Excel files
* under source control
*
* @param path
* @return
*/
private File copyOf(String path) {
final File srcFile = new File(path);
final File destFile = new File("target/" + getName() + "-" + srcFile.getName());
FileHelper.copy(srcFile, destFile);
return destFile;
}
public void testErrornousConstructors() throws Exception {
try {
new ExcelDataContext(null);
fail("Exception expected");
} catch (IllegalArgumentException e) {
assertEquals("File cannot be null", e.getMessage());
}
File file = copyOf("src/test/resources/empty_file.xls");
try {
new ExcelDataContext(file, null);
fail("Exception expected");
} catch (IllegalArgumentException e) {
assertEquals("ExcelConfiguration cannot be null", e.getMessage());
}
}
@SuppressWarnings("deprecation")
public void testEmptyFile() throws Exception {
File file = copyOf("src/test/resources/empty_file.xls");
ExcelDataContext dc = new ExcelDataContext(file);
assertNull(dc.getSpreadsheetReaderDelegateClass());
assertEquals(1, dc.getDefaultSchema().getTableCount());
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("sheet", table.getName());
assertEquals(0, table.getColumnCount());
assertSame(file, dc.getFile());
}
public void testEmptyFileNoHeaderLine() throws Exception {
DataContext dc = new ExcelDataContext(copyOf("src/test/resources/empty_file.xls"), new ExcelConfiguration(
ExcelConfiguration.NO_COLUMN_NAME_LINE, false, false));
assertEquals(1, dc.getDefaultSchema().getTableCount());
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("sheet", table.getName());
assertEquals(0, table.getColumnCount());
}
public void testUnexistingHeaderLine() throws Exception {
DataContext dc = new ExcelDataContext(copyOf("src/test/resources/xls_people.xls"), new ExcelConfiguration(20,
true, false));
assertEquals(1, dc.getDefaultSchema().getTableCount());
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("xls_people", table.getName());
assertEquals(0, table.getColumnCount());
}
public void testSkipEmptyColumns() throws Exception {
ExcelConfiguration conf = new ExcelConfiguration(ExcelConfiguration.DEFAULT_COLUMN_NAME_LINE, true, true);
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/skipped_lines.xlsx"), conf);
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("[hello, world]", Arrays.toString(table.getColumnNames()));
DataSet ds = dc.executeQuery(dc.query().from(table).select("hello").toQuery());
assertTrue(ds.next());
assertEquals("1", ds.getRow().getValue(0));
}
public void testDontSkipEmptyLinesNoHeader() throws Exception {
ExcelConfiguration conf = new ExcelConfiguration(ExcelConfiguration.NO_COLUMN_NAME_LINE, false, true);
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/skipped_lines.xlsx"), conf);
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("[G, H]", Arrays.toString(table.getColumnNames()));
assertEquals(6, table.getColumnByName("G").getColumnNumber());
assertEquals(7, table.getColumnByName("H").getColumnNumber());
DataSet ds = dc.executeQuery(dc.query().from(table).select("G").toQuery());
// 5 empty lines
for (int i = 0; i < 5; i++) {
assertTrue(ds.next());
Object value = ds.getRow().getValue(0);
assertNull("Values was: " + value + " at row " + i, value);
}
assertTrue(ds.next());
assertEquals("hello", ds.getRow().getValue(0));
assertTrue(ds.next());
assertEquals("1", ds.getRow().getValue(0));
}
public void testDontSkipEmptyLinesAbsoluteHeader() throws Exception {
ExcelConfiguration conf = new ExcelConfiguration(6, false, true);
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/skipped_lines.xlsx"), conf);
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("[hello, world]", Arrays.toString(table.getColumnNames()));
assertEquals(6, table.getColumnByName("hello").getColumnNumber());
assertEquals(7, table.getColumnByName("world").getColumnNumber());
DataSet ds = dc.executeQuery(dc.query().from(table).select("hello").toQuery());
assertTrue(ds.next());
assertEquals("1", ds.getRow().getValue(0));
}
public void testInvalidFormula() throws Exception {
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/invalid_formula.xls"));
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("[name]", Arrays.toString(table.getColumnNames()));
Query q = dc.query().from(table).select("name").toQuery();
DataSet ds = dc.executeQuery(dc.query().from(table).selectCount().toQuery());
assertTrue(ds.next());
assertEquals(3, Integer.parseInt(ds.getRow().getValue(0).toString()));
assertFalse(ds.next());
assertFalse(ds.next());
ds.close();
ds = dc.executeQuery(q);
Row row;
assertTrue(ds.next());
row = ds.getRow();
assertEquals("TismmerswerskisMFSTLandsmeers ", row
.getValue(0).toString());
assertTrue(ds.next());
row = ds.getRow();
assertEquals("-\"t\" \"houetismfsthueiss\"", row.getValue(0).toString());
assertTrue(ds.next());
row = ds.getRow();
assertEquals("TismmerswerskisMFSTLandsmeers ", row
.getValue(0).toString());
assertFalse(ds.next());
ds.close();
}
public void testEvaluateFormula() throws Exception {
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/xls_formulas.xls"));
Table table = dc.getDefaultSchema().getTables()[0];
Column[] columns = table.getColumns();
assertEquals("[some number, some mixed formula, some int only formula]",
Arrays.toString(table.getColumnNames()));
Query q = dc.query().from(table).select(columns).toQuery();
DataSet ds = dc.executeQuery(q);
Object value;
assertTrue(ds.next());
assertEquals("1", ds.getRow().getValue(columns[0]));
value = ds.getRow().getValue(columns[1]);
assertEquals(String.class, value.getClass());
assertEquals("1", value);
value = ds.getRow().getValue(columns[2]);
assertEquals(String.class, value.getClass());
assertEquals("1", value);
assertTrue(ds.next());
assertEquals("2", ds.getRow().getValue(columns[0]));
value = ds.getRow().getValue(columns[1]);
assertEquals(String.class, value.getClass());
assertEquals("3", value);
value = ds.getRow().getValue(columns[2]);
assertEquals(String.class, value.getClass());
assertEquals("3", value);
assertTrue(ds.next());
assertEquals("3", ds.getRow().getValue(columns[0]));
value = ds.getRow().getValue(columns[1]);
assertEquals(String.class, value.getClass());
assertEquals("8", value);
value = ds.getRow().getValue(columns[2]);
assertEquals(String.class, value.getClass());
assertEquals("8", value);
assertTrue(ds.next());
assertEquals("4", ds.getRow().getValue(columns[0]));
value = ds.getRow().getValue(columns[1]);
assertEquals(String.class, value.getClass());
assertEquals("12", value);
value = ds.getRow().getValue(columns[2]);
assertEquals(String.class, value.getClass());
assertEquals("12", value);
assertTrue(ds.next());
assertEquals("5", ds.getRow().getValue(columns[0]));
value = ds.getRow().getValue(columns[1]);
assertEquals(String.class, value.getClass());
assertEquals("yes", value);
value = ds.getRow().getValue(columns[2]);
assertEquals(String.class, value.getClass());
assertEquals("5", value);
assertTrue(ds.next());
assertEquals("6", ds.getRow().getValue(columns[0]));
value = ds.getRow().getValue(columns[1]);
assertEquals(String.class, value.getClass());
assertEquals("no", value);
value = ds.getRow().getValue(columns[2]);
assertEquals(String.class, value.getClass());
assertEquals("6", value);
assertFalse(ds.next());
}
public void testSingleCellSheet() throws Exception {
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/xls_single_cell_sheet.xls"));
Table table = dc.getDefaultSchema().getTableByName("Sheet1");
assertNotNull(table);
assertEquals("[A, hello]", Arrays.toString(table.getColumnNames()));
Query q = dc.query().from(table).select(table.getColumns()).toQuery();
DataSet ds = dc.executeQuery(q);
assertFalse(ds.next());
}
public void testOpenXlsxFormat() throws Exception {
ExcelDataContext dc = new ExcelDataContext(copyOf("src/test/resources/Spreadsheet2007.xlsx"));
Schema schema = dc.getDefaultSchema();
assertEquals("Schema[name=testOpenXlsxFormat-Spreadsheet2007.xlsx]", schema.toString());
assertEquals("[Sheet1, Sheet2, Sheet3]", Arrays.toString(schema.getTableNames()));
assertEquals(0, schema.getTableByName("Sheet2").getColumnCount());
assertEquals(0, schema.getTableByName("Sheet3").getColumnCount());
Table table = schema.getTableByName("Sheet1");
assertEquals("[string, number, date]", Arrays.toString(table.getColumnNames()));
Query q = dc.query().from(table).select(table.getColumns()).orderBy(table.getColumnByName("number")).toQuery();
DataSet ds = dc.executeQuery(q);
List<Object[]> objectArrays = ds.toObjectArrays();
assertEquals(4, objectArrays.size());
assertEquals("[hello, 1, 2010-01-01 00:00:00]", Arrays.toString(objectArrays.get(0)));
assertEquals("[world, 2, 2010-01-02 00:00:00]", Arrays.toString(objectArrays.get(1)));
assertEquals("[foo, 3, 2010-01-03 00:00:00]", Arrays.toString(objectArrays.get(2)));
assertEquals("[bar, 4, 2010-01-04 00:00:00]", Arrays.toString(objectArrays.get(3)));
}
public void testConfigurationWithoutHeader() throws Exception {
File file = copyOf("src/test/resources/xls_people.xls");
DataContext dc = new ExcelDataContext(file, new ExcelConfiguration(ExcelConfiguration.NO_COLUMN_NAME_LINE,
true, true));
Table table = dc.getDefaultSchema().getTables()[0];
String[] columnNames = table.getColumnNames();
assertEquals("[A, B, C, D]", Arrays.toString(columnNames));
Query q = dc.query().from(table).select(table.getColumnByName("A")).toQuery();
assertEquals("SELECT xls_people.A FROM testConfigurationWithoutHeader-xls_people.xls.xls_people", q.toSql());
DataSet dataSet = dc.executeQuery(q);
assertTrue(dataSet.next());
assertEquals("id", dataSet.getRow().getValue(0));
for (int i = 1; i <= 9; i++) {
assertTrue(dataSet.next());
assertEquals(i + "", dataSet.getRow().getValue(0));
}
assertFalse(dataSet.next());
}
public void testConfigurationNonDefaultColumnNameLineNumber() throws Exception {
File file = copyOf("src/test/resources/xls_people.xls");
DataContext dc = new ExcelDataContext(file, new ExcelConfiguration(2, true, true));
Table table = dc.getDefaultSchema().getTables()[0];
String[] columnNames = table.getColumnNames();
assertEquals("[1, mike, male, 18]", Arrays.toString(columnNames));
Query q = dc.query().from(table).select(table.getColumnByName("1")).toQuery();
assertEquals("SELECT xls_people.1 FROM testConfigurationNonDefaultColumnNameLineNumber-xls_people.xls.xls_people", q.toSql());
DataSet dataSet = dc.executeQuery(q);
assertTrue(dataSet.next());
assertEquals("2", dataSet.getRow().getValue(0));
for (int i = 3; i <= 9; i++) {
assertTrue(dataSet.next());
assertEquals(i + "", dataSet.getRow().getValue(0));
}
assertFalse(dataSet.next());
}
public void testGetSchemas() throws Exception {
File file = copyOf("src/test/resources/xls_people.xls");
DataContext dc = new ExcelDataContext(file);
Schema[] schemas = dc.getSchemas();
assertEquals(2, schemas.length);
Schema schema = schemas[1];
assertEquals("testGetSchemas-xls_people.xls", schema.getName());
assertEquals(1, schema.getTableCount());
Table table = schema.getTables()[0];
assertEquals("xls_people", table.getName());
assertEquals(4, table.getColumnCount());
assertEquals(0, table.getRelationshipCount());
Column[] columns = table.getColumns();
assertEquals("id", columns[0].getName());
assertEquals("name", columns[1].getName());
assertEquals("gender", columns[2].getName());
assertEquals("age", columns[3].getName());
}
public void testMaterializeTable() throws Exception {
File file = copyOf("src/test/resources/xls_people.xls");
ExcelDataContext dc = new ExcelDataContext(file);
Table table = dc.getDefaultSchema().getTables()[0];
DataSet dataSet = dc.materializeMainSchemaTable(table, table.getColumns(), -1);
assertTrue(dataSet.next());
assertEquals("Row[values=[1, mike, male, 18]]", dataSet.getRow().toString());
assertTrue(dataSet.next());
assertEquals("Row[values=[2, michael, male, 19]]", dataSet.getRow().toString());
assertTrue(dataSet.next());
assertEquals("Row[values=[3, peter, male, 18]]", dataSet.getRow().toString());
assertTrue(dataSet.next());
assertTrue(dataSet.next());
assertTrue(dataSet.next());
assertTrue(dataSet.next());
assertTrue(dataSet.next());
assertTrue(dataSet.next());
assertEquals("Row[values=[9, carrie, female, 17]]", dataSet.getRow().toString());
assertFalse(dataSet.next());
assertNull(dataSet.getRow());
}
public void testMissingValues() throws Exception {
File file = copyOf("src/test/resources/xls_missing_values.xls");
DataContext dc = new ExcelDataContext(file);
Schema schema = dc.getDefaultSchema();
assertEquals(1, schema.getTableCount());
Table table = schema.getTables()[0];
assertEquals("[Column[name=a,columnNumber=0,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=b,columnNumber=1,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=c,columnNumber=2,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=d,columnNumber=3,type=VARCHAR,nullable=true,nativeType=null,columnSize=null]]",
Arrays.toString(table.getColumns()));
Query q = new Query().select(table.getColumns()).from(table);
DataSet ds = dc.executeQuery(q);
assertTrue(ds.next());
assertEquals("[1, 2, 3, null]", Arrays.toString(ds.getRow().getValues()));
assertTrue(ds.next());
assertEquals("[5, null, 7, 8]", Arrays.toString(ds.getRow().getValues()));
assertTrue(ds.next());
assertEquals("[9, 10, 11, 12]", Arrays.toString(ds.getRow().getValues()));
assertFalse(ds.next());
}
public void testMissingColumnHeader() throws Exception {
File file = copyOf("src/test/resources/xls_missing_column_header.xls");
DataContext dc = new ExcelDataContext(file);
Schema schema = dc.getDefaultSchema();
assertEquals(1, schema.getTableCount());
Table table = schema.getTables()[0];
assertEquals("[Column[name=a,columnNumber=0,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=b,columnNumber=1,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=A,columnNumber=2,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=d,columnNumber=3,type=VARCHAR,nullable=true,nativeType=null,columnSize=null]]",
Arrays.toString(table.getColumns()));
Query q = new Query().select(table.getColumns()).from(table);
DataSet ds = dc.executeQuery(q);
assertTrue(ds.next());
assertEquals("[1, 2, 3, 4]", Arrays.toString(ds.getRow().getValues()));
assertTrue(ds.next());
assertEquals("[5, 6, 7, 8]", Arrays.toString(ds.getRow().getValues()));
assertTrue(ds.next());
assertEquals("[9, 10, 11, 12]", Arrays.toString(ds.getRow().getValues()));
assertFalse(ds.next());
}
public void testXlsxFormulas() throws Exception {
File file = copyOf("src/test/resources/formulas.xlsx");
ExcelDataContext dc = new ExcelDataContext(file);
assertEquals("[sh1]", Arrays.toString(dc.getDefaultSchema().getTableNames()));
assertEquals(XlsxSpreadsheetReaderDelegate.class, dc.getSpreadsheetReaderDelegateClass());
Table table = dc.getDefaultSchema().getTableByName("sh1");
assertEquals("[Foo, Bar]", Arrays.toString(table.getColumnNames()));
Query q = dc.query().from(table).select("Foo").toQuery();
DataSet ds = dc.executeQuery(q);
assertTrue(ds.next());
assertEquals("1", ds.getRow().getValue(0).toString());
assertEquals("", ds.getRow().getStyle(0).toString());
assertTrue(ds.next());
assertEquals("2", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("3", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("4", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("5", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("6", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("7", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("8", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("9", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("10", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("11", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("12", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("13", ds.getRow().getValue(0).toString());
assertFalse(ds.next());
q = dc.query().from(table).select("Bar").toQuery();
ds = dc.executeQuery(q);
assertTrue(ds.next());
assertEquals("lorem", ds.getRow().getValue(0).toString());
assertEquals("", ds.getRow().getStyle(0).toString());
assertTrue(ds.next());
assertEquals("ipsum", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("21", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("foo", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("bar", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("baz", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals(null, ds.getRow().getValue(0));
assertNotNull(null, ds.getRow().getStyle(0));
assertTrue(ds.next());
assertEquals("!\"#¤%&/()<>=?", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("here are", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("some invalid", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("formulas:", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("#DIV/0!", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("0", ds.getRow().getValue(0).toString());
assertFalse(ds.next());
}
public void testTicket99defect() throws Exception {
File file = copyOf("src/test/resources/ticket_199_inventory.xls");
DataContext dc = new ExcelDataContext(file);
Schema schema = dc.getDefaultSchema();
assertEquals(
"[Table[name=Sheet1,type=null,remarks=null], Table[name=Sheet2,type=null,remarks=null], Table[name=Sheet3,type=null,remarks=null]]",
Arrays.toString(schema.getTables()));
assertEquals(0, schema.getTableByName("Sheet2").getColumnCount());
assertEquals(0, schema.getTableByName("Sheet3").getColumnCount());
Table table = schema.getTableByName("Sheet1");
assertEquals(
"[Column[name=Pkg No.,columnNumber=0,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=Description,columnNumber=1,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=Room,columnNumber=2,type=VARCHAR,nullable=true,nativeType=null,columnSize=null], "
+ "Column[name=Level,columnNumber=3,type=VARCHAR,nullable=true,nativeType=null,columnSize=null]]",
Arrays.toString(table.getColumns()));
}
public void testInsertInto() throws Exception {
final File file = copyOf("src/test/resources/xls_people.xls");
final ExcelDataContext dc = new ExcelDataContext(file);
final Table table = dc.getDefaultSchema().getTables()[0];
final Column nameColumn = table.getColumnByName("name");
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback cb) {
Style clownStyle = new StyleBuilder().bold().foreground(255, 0, 0).background(0, 0, 255).create();
Style thirtyStyle = new StyleBuilder().italic().underline().centerAligned().foreground(10, 10, 200)
.create();
cb.insertInto(table).value("id", 1000).value(nameColumn, "pennywise the [clown]", clownStyle)
.value("gender", "male").value("age", 30, thirtyStyle).execute();
}
});
DataSet ds = dc.query().from(table).select(nameColumn).orderBy(nameColumn).execute();
assertTrue(ds.next());
assertEquals("barbara", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("bob", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("carrie", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("charlotte", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("hillary", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("michael", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("mike", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("pennywise the [clown]", ds.getRow().getValue(0).toString());
assertEquals("font-weight: bold;color: rgb(255,0,0);background-color: rgb(0,0,255);", ds.getRow().getStyle(0)
.toString());
assertTrue(ds.next());
assertEquals("peter", ds.getRow().getValue(0).toString());
assertTrue(ds.next());
assertEquals("vera", ds.getRow().getValue(0).toString());
assertFalse(ds.next());
ds.close();
ds = dc.query().from(table).select("age").where("age").eq(30).execute();
assertTrue(ds.next());
assertEquals("30", ds.getRow().getValue(0));
assertEquals("font-style: italic;text-decoration: underline;text-align: center;color: rgb(0,0,255);", ds
.getRow().getStyle(0).toCSS());
assertFalse(ds.next());
}
public void testCreateTableXls() throws Exception {
// run the same test with both XLS and XLSX (because of different
// workbook implementations)
runCreateTableTest(new File("target/xls_people_created.xls"));
}
public void testCreateTableXlsx() throws Exception {
// run the same test with both XLS and XLSX (because of different
// workbook implementations)
runCreateTableTest(new File("target/xls_people_created.xlsx"));
}
private void runCreateTableTest(File file) {
if (file.exists()) {
assertTrue(file.delete());
}
final ExcelDataContext dc = new ExcelDataContext(file);
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback cb) {
Schema schema = dc.getDefaultSchema();
Table table1 = cb.createTable(schema, "my_table_1").withColumn("foo").withColumn("bar")
.withColumn("baz").execute();
assertEquals(1, schema.getTableCount());
assertSame(table1.getSchema(), schema);
assertSame(table1, schema.getTables()[0]);
Table table2 = cb.createTable(schema, "my_table_2").withColumn("foo").withColumn("bar")
.withColumn("baz").execute();
assertSame(table2.getSchema(), schema);
assertSame(table2, schema.getTables()[1]);
assertEquals(2, schema.getTableCount());
cb.insertInto(table1).value("foo", 123.0).value("bar", "str 1").value("baz", true).execute();
}
});
dc.refreshSchemas();
Schema schema = dc.getDefaultSchema();
assertEquals(2, schema.getTableCount());
assertEquals("[my_table_1, my_table_2]", Arrays.toString(schema.getTableNames()));
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback cb) {
cb.insertInto(dc.getTableByQualifiedLabel("my_table_1")).value("foo", 456.2)
.value("bar", "парфюмерия +и косметика").value("baz", false).execute();
}
});
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback cb) {
cb.insertInto("my_table_1").value("foo", 789).value("bar", DateUtils.get(2011, Month.JULY, 8))
.value("baz", false).execute();
}
});
DataSet ds = dc.query().from("my_table_1").select("foo").and("bar").and("baz").execute();
assertTrue(ds.next());
assertEquals("Row[values=[123, str 1, true]]", ds.getRow().toString());
assertTrue(ds.next());
assertEquals("Row[values=[456.2, парфюмерия +и косметика, false]]", ds.getRow().toString());
assertTrue(ds.next());
assertEquals("Row[values=[789, 2011-07-08 00:00:00, false]]", ds.getRow().toString());
assertFalse(ds.next());
ds.close();
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback callback) {
callback.deleteFrom("my_table_1").where("foo").greaterThan("124").execute();
}
});
assertEquals("1",
MetaModelHelper.executeSingleRowQuery(dc, dc.query().from("my_table_1").selectCount().toQuery())
.getValue(0).toString());
ds = dc.query().from("my_table_1").select("foo").and("bar").and("baz").execute();
assertTrue(ds.next());
assertEquals("Row[values=[123, str 1, true]]", ds.getRow().toString());
assertFalse(ds.next());
ds.close();
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback callback) {
callback.dropTable("my_table_1").execute();
}
});
assertEquals("[my_table_2]", Arrays.toString(schema.getTableNames()));
dc.refreshSchemas();
assertEquals("[my_table_2]", Arrays.toString(dc.getDefaultSchema().getTableNames()));
assertEquals(1, dc.getDefaultSchema().getTableCount());
}
public void testGetStyles() throws Exception {
DataContext dc = new ExcelDataContext(copyOf("src/test/resources/styles.xlsx"));
Table table = dc.getDefaultSchema().getTables()[0];
assertEquals("[style name, example]", Arrays.toString(table.getColumnNames()));
DataSet ds = dc.query().from(table).select(table.getColumns()).execute();
assertTrue(ds.next());
assertEquals("Row[values=[bold, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("font-weight: bold;", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[italic, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("font-style: italic;", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[underline, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("text-decoration: underline;", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[custom text col, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("color: rgb(138,67,143);", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[yellow text col, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("color: rgb(255,255,0);", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[custom bg, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("background-color: rgb(136,228,171);", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[yellow bg, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("background-color: rgb(255,255,0);", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[center align, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("text-align: center;", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[font size 8, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("font-size: 8pt;", ds.getRow().getStyle(1).toCSS());
assertTrue(ds.next());
assertEquals("Row[values=[font size 16, foo]]", ds.getRow().toString());
assertEquals("", ds.getRow().getStyle(0).toCSS());
assertEquals("font-size: 16pt;", ds.getRow().getStyle(1).toCSS());
assertFalse(ds.next());
}
/**
* Tests that you can execute a query on a ExcelDataContext even though the
* schema has not yet been (explicitly) loaded.
*/
public void testExecuteQueryBeforeLoadingSchema() throws Exception {
// first use one DataContext to retreive the schema/table/column objects
ExcelDataContext dc1 = new ExcelDataContext(copyOf("src/test/resources/Spreadsheet2007.xlsx"));
Schema schema = dc1.getDefaultSchema();
Table table = schema.getTable(0);
Column column = table.getColumn(0);
// query another DataContext using the schemas of the one above
ExcelDataContext dc2 = new ExcelDataContext(copyOf("src/test/resources/Spreadsheet2007.xlsx"));
DataSet ds = dc2.executeQuery(new Query().from(table).select(column));
// previously we would crash at this point!
assertNotNull(ds);
ds.close();
}
} | {
"content_hash": "a47d0aaac93a1091d33b9f9740b7886f",
"timestamp": "",
"source": "github",
"line_count": 761,
"max_line_length": 148,
"avg_line_length": 44.155059132720105,
"alnum_prop": 0.6191893339682162,
"repo_name": "ardlema/metamodel",
"id": "3b69290d6fdae3c8c339c28b299a3de483fe51e4",
"size": "34451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "excel/src/test/java/org/apache/metamodel/excel/ExcelDataContextTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3050047"
}
],
"symlink_target": ""
} |
Simple little HTML/JavaScript page which allows you to make a leaderboard for Stack Overflow.
You will need to know the numeric user ids of some of your friends. I'll use Spolsky (uid:4), Jeff Atwood (uid:1) and Jon Skeet (uid:22656). I'll add us two as well: Neil (uid:13678) and Matthew (uid:268619).
Then we can create a URL like:
[http://neilprosser.github.com/so-leaderboard/index.html?ids=1,4,22656,13678,268619](http://neilprosser.github.com/so-leaderboard/index.html?ids=1,4,22656,13678,268619)
| {
"content_hash": "5463215bc2a708d6a6f51293a3cbe47a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 211,
"avg_line_length": 73,
"alnum_prop": 0.7553816046966731,
"repo_name": "neilprosser/so-leaderboard",
"id": "396e372d3139df0a90293ac9e02f9311d590350c",
"size": "541",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2950"
},
{
"name": "JavaScript",
"bytes": "84361"
}
],
"symlink_target": ""
} |
<?php
namespace Omnipay\Vindicia\Message;
use Omnipay\Vindicia\TestFramework\Mocker;
use Omnipay\Vindicia\TestFramework\DataFaker;
use Omnipay\Vindicia\TestFramework\SoapTestCase;
use Omnipay\Common\CreditCard;
use Omnipay\Vindicia\VindiciaItemBag;
class CalculateSalesTaxRequestTest extends SoapTestCase
{
/**
* @return void
*/
public function setUp()
{
$this->faker = new DataFaker();
$this->currency = $this->faker->currency();
$this->amount = $this->faker->monetaryAmount($this->currency);
$this->tax_amount = $this->faker->monetaryAmount($this->currency);
// make tax_amount less
if ($this->tax_amount > $this->amount) {
$temp = $this->amount;
$this->amount = $this->tax_amount;
$this->tax_amount = $temp;
}
$this->country = $this->faker->region();
$this->postcode = $this->faker->postcode();
$this->customerId = $this->faker->customerId();
$this->customerReference = $this->faker->customerReference();
$this->card = array(
'country' => $this->country,
'postcode' => $this->postcode
);
$this->taxClassification = $this->faker->taxClassification();
$this->request = new CalculateSalesTaxRequest($this->getHttpClient(), $this->getHttpRequest());
$this->request->initialize(
array(
'amount' => $this->amount,
'currency' => $this->currency,
'card' => $this->card,
'taxClassification' => $this->taxClassification,
'customerId' => $this->customerId,
'customerReference' => $this->customerReference
)
);
$this->items = $this->faker->itemsAsArray($this->currency);
}
/**
* @return void
*/
public function testAmount()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$request->setCurrency($this->currency);
$this->assertSame($request, $request->setAmount($this->amount));
$this->assertSame($this->amount, $request->getAmount());
}
/**
* @return void
*/
public function testCurrency()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$this->assertSame($request, $request->setCurrency($this->currency));
$this->assertSame($this->currency, $request->getCurrency());
}
/**
* @return void
*/
public function testTaxClassification()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$this->assertSame($request, $request->setTaxClassification($this->taxClassification));
$this->assertSame($this->taxClassification, $request->getTaxClassification());
}
/**
* @return void
*/
public function testCard()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$this->assertSame($request, $request->setCard($this->card));
$this->assertEquals(new CreditCard($this->card), $request->getCard());
}
/**
* @return void
*/
public function testCustomerId()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$this->assertSame($request, $request->setCustomerId($this->customerId));
$this->assertEquals($this->customerId, $request->getCustomerId());
}
/**
* @return void
*/
public function testCustomerReference()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$this->assertSame($request, $request->setCustomerReference($this->customerReference));
$this->assertEquals($this->customerReference, $request->getCustomerReference());
}
/**
* @return void
*/
public function testItems()
{
$request = Mocker::mock('\Omnipay\Vindicia\Message\CalculateSalesTaxRequest')->makePartial();
$request->initialize();
$this->assertSame($request, $request->setItems($this->items));
$this->assertEquals(new VindiciaItemBag($this->items), $request->getItems());
}
/**
* @return void
*/
public function testGetData()
{
$data = $this->request->getData();
$this->assertSame($this->amount, $data['transaction']->transactionItems[0]->price);
$this->assertSame($this->currency, $data['transaction']->currency);
$this->assertSame($this->taxClassification, $data['transaction']->transactionItems[0]->taxClassification);
$this->assertSame($this->card['country'], $data['transaction']->shippingAddress->country);
$this->assertSame($this->customerId, $data['transaction']->account->merchantAccountId);
$this->assertSame($this->customerReference, $data['transaction']->account->VID);
$this->assertFalse(isset($data['transaction']->sourcePaymentMethod));
$this->assertSame('calculateSalesTax', $data['action']);
}
/**
* @return void
*/
public function testGetDataMultipleItems()
{
$this->request->setAmount(null)->setItems($this->items);
$data = $this->request->getData();
$numItems = count($this->items);
$this->assertSame($numItems, count($data['transaction']->transactionItems));
for ($i = 0; $i < $numItems; $i++) {
$this->assertSame($this->items[$i]['price'], $data['transaction']->transactionItems[$i]->price);
$this->assertSame($this->items[$i]['quantity'], $data['transaction']->transactionItems[$i]->quantity);
$this->assertSame($this->items[$i]['sku'], $data['transaction']->transactionItems[$i]->sku);
$this->assertSame($this->items[$i]['taxClassification'], $data['transaction']->transactionItems[$i]->taxClassification);
}
$this->assertSame($this->currency, $data['transaction']->currency);
$this->assertSame($this->card['country'], $data['transaction']->shippingAddress->country);
$this->assertSame($this->customerId, $data['transaction']->account->merchantAccountId);
$this->assertSame($this->customerReference, $data['transaction']->account->VID);
$this->assertFalse(isset($data['transaction']->sourcePaymentMethod));
$this->assertSame('calculateSalesTax', $data['action']);
}
/**
* @expectedException \Omnipay\Common\Exception\InvalidRequestException
* @expectedExceptionMessage Either the amount or items parameter is required.
* @return void
*/
public function testAmountRequired()
{
$this->request->setAmount(null);
$this->request->getData();
}
/**
* @return void
*/
public function testSendSuccess()
{
$this->setMockSoapResponse('CalculateSalesTaxSuccess.xml', array(
'CURRENCY' => $this->currency,
'AMOUNT' => $this->amount,
'COUNTRY' => $this->country,
'TAX_CLASSIFICATION' => $this->taxClassification,
'TAX_AMOUNT' => $this->tax_amount
));
$response = $this->request->send();
$this->assertTrue($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertFalse($response->isPending());
$this->assertSame('OK', $response->getMessage());
$this->assertSame($this->tax_amount, $response->getSalesTax());
$this->assertSame(AbstractRequest::TEST_ENDPOINT . '/18.0/Transaction.wsdl', $this->getLastEndpoint());
}
/**
* @return void
*/
public function testSendFailure()
{
$this->setMockSoapResponse('CalculateSalesTaxFailure.xml', array(
'TAX_CLASSIFICATION' => $this->taxClassification
));
$response = $this->request->send();
$this->assertFalse($response->isSuccessful());
$this->assertFalse($response->isRedirect());
$this->assertFalse($response->isPending());
$this->assertSame('400', $response->getCode());
$this->assertSame('Error validating transaction: The value you provided in the TaxClassification field (' . $this->taxClassification . ') is not an accepted value (sku: 0): Not a Vindicia tax classification', $response->getMessage());
// no id or reference since Vindicia creates them both
$this->assertNull($response->getTransactionId());
$this->assertNull($response->getTransactionReference());
}
}
| {
"content_hash": "e34b4a7e7d4da2a74230b7092b3ad41c",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 243,
"avg_line_length": 36.858333333333334,
"alnum_prop": 0.6098801718290753,
"repo_name": "vimeo/omnipay-vindicia",
"id": "04fd1550a4e87b02971185a79c5e655e4748e1a7",
"size": "8846",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/Message/CalculateSalesTaxRequestTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "576"
},
{
"name": "PHP",
"bytes": "1120969"
}
],
"symlink_target": ""
} |
struct ALCcontext_struct;
typedef struct ALCcontext_struct ALCcontext;
struct ALCdevice_struct;
typedef struct ALCdevice_struct ALCdevice;
namespace Shiny {
class AudioBuffer;
class AudioSource;
class Sound;
class Stream;
class StreamDataSource;
class AudioSystem {
public:
enum class Result {
kOK,
kDevice,
kContext,
kContextCurrent
};
enum class DistanceModel {
kNone,
kInverseDistance,
kInverseDistanceClamped,
kLinearDistance,
kLinearDistanceClamped,
kExponentDistance,
kExponentDistanceClamped
};
static const char* errorString(Result result);
protected:
SPtr<ALCdevice> device;
UPtr<ALCcontext, std::function<void(ALCcontext*)>> context;
std::vector<WPtr<Sound>> sounds;
void move(AudioSystem &&other);
public:
AudioSystem() = default;
AudioSystem(AudioSystem &&other);
AudioSystem& operator=(AudioSystem &&other);
virtual ~AudioSystem();
Result startUp();
void shutDown();
virtual void tick(const float dt);
SPtr<AudioBuffer> generateBuffer() const;
SPtr<AudioSource> generateSource() const;
SPtr<Sound> generateSound(const SPtr<AudioSource> &source);
SPtr<Stream> generateStream(const SPtr<AudioSource> &source, UPtr<StreamDataSource> dataSource);
bool isContextCurrent() const;
Result makeContextCurrent();
DistanceModel getDistanceModel() const;
void setDistanceModel(DistanceModel distanceModel);
float getDopplerFactor() const;
void setDopplerFactor(float dopplerFactor);
float getSpeedOfSound() const;
void setSpeedOfSound(float speedOfSound);
glm::vec3 getListenerPosition() const;
void setListenerPosition(const glm::vec3 &position);
glm::vec3 getListenerVelocity() const;
void setListenerVelocity(const glm::vec3 &velocity);
glm::quat getListenerOrientation() const;
void setListenerOrientation(const glm::quat &orientation);
float getListenerGain() const;
void setListenerGain(float gain);
};
} // namespace Shiny
#endif
| {
"content_hash": "c139c1db1e3af3bc91fbbead1733d7d9",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 99,
"avg_line_length": 20.48,
"alnum_prop": 0.7275390625,
"repo_name": "aaronmjacobs/Shiny",
"id": "988b4bb58777eec7c76ba8e13fc75bea52f890f9",
"size": "2235",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Include/Shiny/Audio/AudioSystem.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "535595"
},
{
"name": "C++",
"bytes": "288346"
},
{
"name": "CMake",
"bytes": "9573"
}
],
"symlink_target": ""
} |
/******************************************************************************
*
* Module Name: tbfadt - FADT table utilities
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************
*
* Alternatively, you may choose to be licensed under the terms of the
* following license:
*
* 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,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any 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.
*
* Alternatively, you may choose to be licensed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbfadt")
/* Local prototypes */
static void
AcpiTbInitGenericAddress (
ACPI_GENERIC_ADDRESS *GenericAddress,
UINT8 SpaceId,
UINT8 ByteWidth,
UINT64 Address,
const char *RegisterName,
UINT8 Flags);
static void
AcpiTbConvertFadt (
void);
static void
AcpiTbSetupFadtRegisters (
void);
static UINT64
AcpiTbSelectAddress (
char *RegisterName,
UINT32 Address32,
UINT64 Address64);
/* Table for conversion of FADT to common internal format and FADT validation */
typedef struct acpi_fadt_info
{
const char *Name;
UINT16 Address64;
UINT16 Address32;
UINT16 Length;
UINT8 DefaultLength;
UINT8 Flags;
} ACPI_FADT_INFO;
#define ACPI_FADT_OPTIONAL 0
#define ACPI_FADT_REQUIRED 1
#define ACPI_FADT_SEPARATE_LENGTH 2
#define ACPI_FADT_GPE_REGISTER 4
static ACPI_FADT_INFO FadtInfoTable[] =
{
{"Pm1aEventBlock",
ACPI_FADT_OFFSET (XPm1aEventBlock),
ACPI_FADT_OFFSET (Pm1aEventBlock),
ACPI_FADT_OFFSET (Pm1EventLength),
ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
ACPI_FADT_REQUIRED},
{"Pm1bEventBlock",
ACPI_FADT_OFFSET (XPm1bEventBlock),
ACPI_FADT_OFFSET (Pm1bEventBlock),
ACPI_FADT_OFFSET (Pm1EventLength),
ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
ACPI_FADT_OPTIONAL},
{"Pm1aControlBlock",
ACPI_FADT_OFFSET (XPm1aControlBlock),
ACPI_FADT_OFFSET (Pm1aControlBlock),
ACPI_FADT_OFFSET (Pm1ControlLength),
ACPI_PM1_REGISTER_WIDTH,
ACPI_FADT_REQUIRED},
{"Pm1bControlBlock",
ACPI_FADT_OFFSET (XPm1bControlBlock),
ACPI_FADT_OFFSET (Pm1bControlBlock),
ACPI_FADT_OFFSET (Pm1ControlLength),
ACPI_PM1_REGISTER_WIDTH,
ACPI_FADT_OPTIONAL},
{"Pm2ControlBlock",
ACPI_FADT_OFFSET (XPm2ControlBlock),
ACPI_FADT_OFFSET (Pm2ControlBlock),
ACPI_FADT_OFFSET (Pm2ControlLength),
ACPI_PM2_REGISTER_WIDTH,
ACPI_FADT_SEPARATE_LENGTH},
{"PmTimerBlock",
ACPI_FADT_OFFSET (XPmTimerBlock),
ACPI_FADT_OFFSET (PmTimerBlock),
ACPI_FADT_OFFSET (PmTimerLength),
ACPI_PM_TIMER_WIDTH,
ACPI_FADT_SEPARATE_LENGTH}, /* ACPI 5.0A: Timer is optional */
{"Gpe0Block",
ACPI_FADT_OFFSET (XGpe0Block),
ACPI_FADT_OFFSET (Gpe0Block),
ACPI_FADT_OFFSET (Gpe0BlockLength),
0,
ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER},
{"Gpe1Block",
ACPI_FADT_OFFSET (XGpe1Block),
ACPI_FADT_OFFSET (Gpe1Block),
ACPI_FADT_OFFSET (Gpe1BlockLength),
0,
ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}
};
#define ACPI_FADT_INFO_ENTRIES \
(sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
/* Table used to split Event Blocks into separate status/enable registers */
typedef struct acpi_fadt_pm_info
{
ACPI_GENERIC_ADDRESS *Target;
UINT16 Source;
UINT8 RegisterNum;
} ACPI_FADT_PM_INFO;
static ACPI_FADT_PM_INFO FadtPmInfoTable[] =
{
{&AcpiGbl_XPm1aStatus,
ACPI_FADT_OFFSET (XPm1aEventBlock),
0},
{&AcpiGbl_XPm1aEnable,
ACPI_FADT_OFFSET (XPm1aEventBlock),
1},
{&AcpiGbl_XPm1bStatus,
ACPI_FADT_OFFSET (XPm1bEventBlock),
0},
{&AcpiGbl_XPm1bEnable,
ACPI_FADT_OFFSET (XPm1bEventBlock),
1}
};
#define ACPI_FADT_PM_INFO_ENTRIES \
(sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))
/*******************************************************************************
*
* FUNCTION: AcpiTbInitGenericAddress
*
* PARAMETERS: GenericAddress - GAS struct to be initialized
* SpaceId - ACPI Space ID for this register
* ByteWidth - Width of this register
* Address - Address of the register
* RegisterName - ASCII name of the ACPI register
*
* RETURN: None
*
* DESCRIPTION: Initialize a Generic Address Structure (GAS)
* See the ACPI specification for a full description and
* definition of this structure.
*
******************************************************************************/
static void
AcpiTbInitGenericAddress (
ACPI_GENERIC_ADDRESS *GenericAddress,
UINT8 SpaceId,
UINT8 ByteWidth,
UINT64 Address,
const char *RegisterName,
UINT8 Flags)
{
UINT8 BitWidth;
/*
* Bit width field in the GAS is only one byte long, 255 max.
* Check for BitWidth overflow in GAS.
*/
BitWidth = (UINT8) (ByteWidth * 8);
if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */
{
/*
* No error for GPE blocks, because we do not use the BitWidth
* for GPEs, the legacy length (ByteWidth) is used instead to
* allow for a large number of GPEs.
*/
if (!(Flags & ACPI_FADT_GPE_REGISTER))
{
ACPI_ERROR ((AE_INFO,
"%s - 32-bit FADT register is too long (%u bytes, %u bits) "
"to convert to GAS struct - 255 bits max, truncating",
RegisterName, ByteWidth, (ByteWidth * 8)));
}
BitWidth = 255;
}
/*
* The 64-bit Address field is non-aligned in the byte packed
* GAS struct.
*/
ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
/* All other fields are byte-wide */
GenericAddress->SpaceId = SpaceId;
GenericAddress->BitWidth = BitWidth;
GenericAddress->BitOffset = 0;
GenericAddress->AccessWidth = 0; /* Access width ANY */
}
/*******************************************************************************
*
* FUNCTION: AcpiTbSelectAddress
*
* PARAMETERS: RegisterName - ASCII name of the ACPI register
* Address32 - 32-bit address of the register
* Address64 - 64-bit address of the register
*
* RETURN: The resolved 64-bit address
*
* DESCRIPTION: Select between 32-bit and 64-bit versions of addresses within
* the FADT. Used for the FACS and DSDT addresses.
*
* NOTES:
*
* Check for FACS and DSDT address mismatches. An address mismatch between
* the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and
* DSDT/X_DSDT) could be a corrupted address field or it might indicate
* the presence of two FACS or two DSDT tables.
*
* November 2013:
* By default, as per the ACPICA specification, a valid 64-bit address is
* used regardless of the value of the 32-bit address. However, this
* behavior can be overridden via the AcpiGbl_Use32BitFadtAddresses flag.
*
******************************************************************************/
static UINT64
AcpiTbSelectAddress (
char *RegisterName,
UINT32 Address32,
UINT64 Address64)
{
if (!Address64)
{
/* 64-bit address is zero, use 32-bit address */
return ((UINT64) Address32);
}
if (Address32 &&
(Address64 != (UINT64) Address32))
{
/* Address mismatch between 32-bit and 64-bit versions */
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X %s address mismatch in FADT: "
"0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64),
AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
/* 32-bit address override */
if (AcpiGbl_Use32BitFadtAddresses)
{
return ((UINT64) Address32);
}
}
/* Default is to use the 64-bit address */
return (Address64);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbParseFadt
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Initialize the FADT, DSDT and FACS tables
* (FADT contains the addresses of the DSDT and FACS)
*
******************************************************************************/
void
AcpiTbParseFadt (
void)
{
UINT32 Length;
ACPI_TABLE_HEADER *Table;
ACPI_TABLE_DESC *FadtDesc;
ACPI_STATUS Status;
/*
* The FADT has multiple versions with different lengths,
* and it contains pointers to both the DSDT and FACS tables.
*
* Get a local copy of the FADT and convert it to a common format
* Map entire FADT, assumed to be smaller than one page.
*/
FadtDesc = &AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex];
Status = AcpiTbGetTable (FadtDesc, &Table);
if (ACPI_FAILURE (Status))
{
return;
}
Length = FadtDesc->Length;
/*
* Validate the FADT checksum before we copy the table. Ignore
* checksum error as we want to try to get the DSDT and FACS.
*/
(void) AcpiTbVerifyChecksum (Table, Length);
/* Create a local copy of the FADT in common ACPI 2.0+ format */
AcpiTbCreateLocalFadt (Table, Length);
/* All done with the real FADT, unmap it */
AcpiTbPutTable (FadtDesc);
/* Obtain the DSDT and FACS tables via their addresses within the FADT */
AcpiTbInstallStandardTable (
(ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
&AcpiGbl_DsdtIndex);
/* If Hardware Reduced flag is set, there is no FACS */
if (!AcpiGbl_ReducedHardware)
{
if (AcpiGbl_FADT.Facs)
{
AcpiTbInstallStandardTable (
(ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
&AcpiGbl_FacsIndex);
}
if (AcpiGbl_FADT.XFacs)
{
AcpiTbInstallStandardTable (
(ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
&AcpiGbl_XFacsIndex);
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbCreateLocalFadt
*
* PARAMETERS: Table - Pointer to BIOS FADT
* Length - Length of the table
*
* RETURN: None
*
* DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
* Performs validation on some important FADT fields.
*
* NOTE: We create a local copy of the FADT regardless of the version.
*
******************************************************************************/
void
AcpiTbCreateLocalFadt (
ACPI_TABLE_HEADER *Table,
UINT32 Length)
{
/*
* Check if the FADT is larger than the largest table that we expect
* (typically the current ACPI specification version). If so, truncate
* the table, and issue a warning.
*/
if (Length > sizeof (ACPI_TABLE_FADT))
{
ACPI_BIOS_WARNING ((AE_INFO,
"FADT (revision %u) is longer than %s length, "
"truncating length %u to %u",
Table->Revision, ACPI_FADT_CONFORMANCE, Length,
(UINT32) sizeof (ACPI_TABLE_FADT)));
}
/* Clear the entire local FADT */
memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
/* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
memcpy (&AcpiGbl_FADT, Table,
ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
/* Take a copy of the Hardware Reduced flag */
AcpiGbl_ReducedHardware = FALSE;
if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED)
{
AcpiGbl_ReducedHardware = TRUE;
}
/* Convert the local copy of the FADT to the common internal format */
AcpiTbConvertFadt ();
/* Initialize the global ACPI register structures */
AcpiTbSetupFadtRegisters ();
}
/*******************************************************************************
*
* FUNCTION: AcpiTbConvertFadt
*
* PARAMETERS: None - AcpiGbl_FADT is used.
*
* RETURN: None
*
* DESCRIPTION: Converts all versions of the FADT to a common internal format.
* Expand 32-bit addresses to 64-bit as necessary. Also validate
* important fields within the FADT.
*
* NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), and must
* contain a copy of the actual BIOS-provided FADT.
*
* Notes on 64-bit register addresses:
*
* After this FADT conversion, later ACPICA code will only use the 64-bit "X"
* fields of the FADT for all ACPI register addresses.
*
* The 64-bit X fields are optional extensions to the original 32-bit FADT
* V1.0 fields. Even if they are present in the FADT, they are optional and
* are unused if the BIOS sets them to zero. Therefore, we must copy/expand
* 32-bit V1.0 fields to the 64-bit X fields if the 64-bit X field is originally
* zero.
*
* For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address
* fields are expanded to the corresponding 64-bit X fields in the internal
* common FADT.
*
* For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded
* to the corresponding 64-bit X fields, if the 64-bit field is originally
* zero. Adhering to the ACPI specification, we completely ignore the 32-bit
* field if the 64-bit field is valid, regardless of whether the host OS is
* 32-bit or 64-bit.
*
* Possible additional checks:
* (AcpiGbl_FADT.Pm1EventLength >= 4)
* (AcpiGbl_FADT.Pm1ControlLength >= 2)
* (AcpiGbl_FADT.PmTimerLength >= 4)
* Gpe block lengths must be multiple of 2
*
******************************************************************************/
static void
AcpiTbConvertFadt (
void)
{
const char *Name;
ACPI_GENERIC_ADDRESS *Address64;
UINT32 Address32;
UINT8 Length;
UINT8 Flags;
UINT32 i;
/*
* For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
* should be zero are indeed zero. This will workaround BIOSs that
* inadvertently place values in these fields.
*
* The ACPI 1.0 reserved fields that will be zeroed are the bytes located
* at offset 45, 55, 95, and the word located at offset 109, 110.
*
* Note: The FADT revision value is unreliable. Only the length can be
* trusted.
*/
if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
{
AcpiGbl_FADT.PreferredProfile = 0;
AcpiGbl_FADT.PstateControl = 0;
AcpiGbl_FADT.CstControl = 0;
AcpiGbl_FADT.BootFlags = 0;
}
/*
* Now we can update the local FADT length to the length of the
* current FADT version as defined by the ACPI specification.
* Thus, we will have a common FADT internally.
*/
AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
/*
* Expand the 32-bit DSDT addresses to 64-bit as necessary.
* Later ACPICA code will always use the X 64-bit field.
*/
AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
/* If Hardware Reduced flag is set, we are all done */
if (AcpiGbl_ReducedHardware)
{
return;
}
/* Examine all of the 64-bit extended address fields (X fields) */
for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
{
/*
* Get the 32-bit and 64-bit addresses, as well as the register
* length and register name.
*/
Address32 = *ACPI_ADD_PTR (UINT32,
&AcpiGbl_FADT, FadtInfoTable[i].Address32);
Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
&AcpiGbl_FADT, FadtInfoTable[i].Address64);
Length = *ACPI_ADD_PTR (UINT8,
&AcpiGbl_FADT, FadtInfoTable[i].Length);
Name = FadtInfoTable[i].Name;
Flags = FadtInfoTable[i].Flags;
/*
* Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
* generic address structures as necessary. Later code will always use
* the 64-bit address structures.
*
* November 2013:
* Now always use the 64-bit address if it is valid (non-zero), in
* accordance with the ACPI specification which states that a 64-bit
* address supersedes the 32-bit version. This behavior can be
* overridden by the AcpiGbl_Use32BitFadtAddresses flag.
*
* During 64-bit address construction and verification,
* these cases are handled:
*
* Address32 zero, Address64 [don't care] - Use Address64
*
* No override: if AcpiGbl_Use32BitFadtAddresses is FALSE, and:
* Address32 non-zero, Address64 zero - Copy/use Address32
* Address32 non-zero == Address64 non-zero - Use Address64
* Address32 non-zero != Address64 non-zero - Warning, use Address64
*
* Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and:
* Address32 non-zero, Address64 zero - Copy/use Address32
* Address32 non-zero == Address64 non-zero - Copy/use Address32
* Address32 non-zero != Address64 non-zero - Warning, copy/use Address32
*
* Note: SpaceId is always I/O for 32-bit legacy address fields
*/
if (Address32)
{
if (Address64->Address)
{
if (Address64->Address != (UINT64) Address32)
{
/* Address mismatch */
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X address mismatch in FADT/%s: "
"0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
Name, Address32,
ACPI_FORMAT_UINT64 (Address64->Address),
AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
}
/*
* For each extended field, check for length mismatch
* between the legacy length field and the corresponding
* 64-bit X length field.
* Note: If the legacy length field is > 0xFF bits, ignore
* this check. (GPE registers can be larger than the
* 64-bit GAS structure can accommodate, 0xFF bits).
*/
if ((ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
(Address64->BitWidth != ACPI_MUL_8 (Length)))
{
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X length mismatch in FADT/%s: %u/%u",
Name, ACPI_MUL_8 (Length), Address64->BitWidth));
}
}
/*
* Hardware register access code always uses the 64-bit fields.
* So if the 64-bit field is zero or is to be overridden,
* initialize it with the 32-bit fields.
* Note that when the 32-bit address favor is specified, the
* 64-bit fields are always re-initialized so that
* AccessSize/BitWidth/BitOffset fields can be correctly
* configured to the values to trigger a 32-bit compatible
* access mode in the hardware register access code.
*/
if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
{
AcpiTbInitGenericAddress (Address64,
ACPI_ADR_SPACE_SYSTEM_IO, Length,
(UINT64) Address32, Name, Flags);
}
}
if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED)
{
/*
* Field is required (PM1aEvent, PM1aControl).
* Both the address and length must be non-zero.
*/
if (!Address64->Address || !Length)
{
ACPI_BIOS_ERROR ((AE_INFO,
"Required FADT field %s has zero address and/or length: "
"0x%8.8X%8.8X/0x%X",
Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
}
}
else if (FadtInfoTable[i].Flags & ACPI_FADT_SEPARATE_LENGTH)
{
/*
* Field is optional (PM2Control, GPE0, GPE1) AND has its own
* length field. If present, both the address and length must
* be valid.
*/
if ((Address64->Address && !Length) ||
(!Address64->Address && Length))
{
ACPI_BIOS_WARNING ((AE_INFO,
"Optional FADT field %s has valid %s but zero %s: "
"0x%8.8X%8.8X/0x%X", Name,
(Length ? "Length" : "Address"),
(Length ? "Address": "Length"),
ACPI_FORMAT_UINT64 (Address64->Address), Length));
}
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbSetupFadtRegisters
*
* PARAMETERS: None, uses AcpiGbl_FADT.
*
* RETURN: None
*
* DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally,
* force FADT register definitions to their default lengths.
*
******************************************************************************/
static void
AcpiTbSetupFadtRegisters (
void)
{
ACPI_GENERIC_ADDRESS *Target64;
ACPI_GENERIC_ADDRESS *Source64;
UINT8 Pm1RegisterByteWidth;
UINT32 i;
/*
* Optionally check all register lengths against the default values and
* update them if they are incorrect.
*/
if (AcpiGbl_UseDefaultRegisterWidths)
{
for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
{
Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
FadtInfoTable[i].Address64);
/*
* If a valid register (Address != 0) and the (DefaultLength > 0)
* (Not a GPE register), then check the width against the default.
*/
if ((Target64->Address) &&
(FadtInfoTable[i].DefaultLength > 0) &&
(FadtInfoTable[i].DefaultLength != Target64->BitWidth))
{
ACPI_BIOS_WARNING ((AE_INFO,
"Invalid length for FADT/%s: %u, using default %u",
FadtInfoTable[i].Name, Target64->BitWidth,
FadtInfoTable[i].DefaultLength));
/* Incorrect size, set width to the default */
Target64->BitWidth = FadtInfoTable[i].DefaultLength;
}
}
}
/*
* Get the length of the individual PM1 registers (enable and status).
* Each register is defined to be (event block length / 2). Extra divide
* by 8 converts bits to bytes.
*/
Pm1RegisterByteWidth = (UINT8)
ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);
/*
* Calculate separate GAS structs for the PM1x (A/B) Status and Enable
* registers. These addresses do not appear (directly) in the FADT, so it
* is useful to pre-calculate them from the PM1 Event Block definitions.
*
* The PM event blocks are split into two register blocks, first is the
* PM Status Register block, followed immediately by the PM Enable
* Register block. Each is of length (Pm1EventLength/2)
*
* Note: The PM1A event block is required by the ACPI specification.
* However, the PM1B event block is optional and is rarely, if ever,
* used.
*/
for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)
{
Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
FadtPmInfoTable[i].Source);
if (Source64->Address)
{
AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
Source64->SpaceId, Pm1RegisterByteWidth,
Source64->Address +
(FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
"PmRegisters", 0);
}
}
}
| {
"content_hash": "5fcb485ed681c1c8c34e2beb56a2f27a",
"timestamp": "",
"source": "github",
"line_count": 898,
"max_line_length": 81,
"avg_line_length": 36.69933184855234,
"alnum_prop": 0.6035016385483675,
"repo_name": "heatd/Onyx",
"id": "8196e7afbaa2efe9154f6aee06faad7d58f3db30",
"size": "32956",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kernel/acpica/components/tables/tbfadt.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "477578"
},
{
"name": "Awk",
"bytes": "12416"
},
{
"name": "C",
"bytes": "10315124"
},
{
"name": "C++",
"bytes": "3445896"
},
{
"name": "CMake",
"bytes": "17965"
},
{
"name": "M4",
"bytes": "5825"
},
{
"name": "Makefile",
"bytes": "102106"
},
{
"name": "Max",
"bytes": "3812"
},
{
"name": "Python",
"bytes": "19594"
},
{
"name": "Roff",
"bytes": "90442"
},
{
"name": "Shell",
"bytes": "37452"
},
{
"name": "sed",
"bytes": "451"
}
],
"symlink_target": ""
} |
namespace FloydPink.Flickr.Downloadr.UI.Windows
{
public partial class BrowserWindow
{
private global::Gtk.VBox vboxRoot;
private global::Gtk.HBox hboxSpinner;
private global::Gtk.HBox hbox6;
private global::Gtk.ScrolledWindow scrolledwindowPhotos;
private global::FloydPink.Flickr.Downloadr.UI.Widgets.GridWidget photosGrid;
private global::Gtk.HBox hboxBottom;
private global::Gtk.HBox hboxButtons;
private global::Gtk.HBox hboxLeft;
private global::Gtk.Button buttonBack;
private global::Gtk.HBox hbox5;
private global::Gtk.Button buttonSelectAll;
private global::Gtk.Button buttonUnSelectAll;
private global::Gtk.Label labelSelectedPhotoset;
private global::Gtk.HBox hboxCenter;
private global::Gtk.Button buttonFirstPage;
private global::Gtk.Button buttonPreviousPage;
private global::Gtk.HBox hbox2;
private global::Gtk.VBox vbox2;
private global::Gtk.Label labelPhotos;
private global::Gtk.Label labelPages;
private global::Gtk.ComboBox comboboxPage;
private global::Gtk.Button buttonNextPage;
private global::Gtk.Button buttonLastPage;
private global::Gtk.HBox hboxRight;
private global::Gtk.Label label1;
private global::Gtk.Button buttonDownloadSelection;
private global::Gtk.Button buttonDownloadThisPage;
private global::Gtk.Button buttonDownloadAllPages;
protected virtual void Build()
{
global::Stetic.Gui.Initialize(this);
// Widget FloydPink.Flickr.Downloadr.UI.Windows.BrowserWindow
this.HeightRequest = 600;
this.Name = "FloydPink.Flickr.Downloadr.UI.Windows.BrowserWindow";
this.Title = global::Mono.Unix.Catalog.GetString("Photo Browser - flickr downloadr");
this.Icon = global::Gdk.Pixbuf.LoadFromResource("FloydPink.Flickr.Downloadr.UI.Assets.icon.png");
this.WindowPosition = ((global::Gtk.WindowPosition)(3));
this.Resizable = false;
this.AllowGrow = false;
// Container child FloydPink.Flickr.Downloadr.UI.Windows.BrowserWindow.Gtk.Container+ContainerChild
this.vboxRoot = new global::Gtk.VBox();
this.vboxRoot.Name = "vboxRoot";
this.vboxRoot.Spacing = 6;
this.vboxRoot.BorderWidth = ((uint)(10));
// Container child vboxRoot.Gtk.Box+BoxChild
this.hboxSpinner = new global::Gtk.HBox();
this.hboxSpinner.Name = "hboxSpinner";
this.hboxSpinner.Spacing = 6;
this.vboxRoot.Add(this.hboxSpinner);
global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vboxRoot[this.hboxSpinner]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child vboxRoot.Gtk.Box+BoxChild
this.hbox6 = new global::Gtk.HBox();
this.hbox6.Name = "hbox6";
this.hbox6.Spacing = 6;
// Container child hbox6.Gtk.Box+BoxChild
this.scrolledwindowPhotos = new global::Gtk.ScrolledWindow();
this.scrolledwindowPhotos.CanFocus = true;
this.scrolledwindowPhotos.Name = "scrolledwindowPhotos";
this.scrolledwindowPhotos.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindowPhotos.Gtk.Container+ContainerChild
global::Gtk.Viewport w2 = new global::Gtk.Viewport();
w2.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child GtkViewport.Gtk.Container+ContainerChild
this.photosGrid = new global::FloydPink.Flickr.Downloadr.UI.Widgets.GridWidget();
this.photosGrid.Events = ((global::Gdk.EventMask)(256));
this.photosGrid.Name = "photosGrid";
this.photosGrid.DoNotFireSelectionChanged = false;
this.photosGrid.NumberOfItemsInARow = 5;
w2.Add(this.photosGrid);
this.scrolledwindowPhotos.Add(w2);
this.hbox6.Add(this.scrolledwindowPhotos);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox6[this.scrolledwindowPhotos]));
w5.Position = 0;
this.vboxRoot.Add(this.hbox6);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vboxRoot[this.hbox6]));
w6.Position = 1;
// Container child vboxRoot.Gtk.Box+BoxChild
this.hboxBottom = new global::Gtk.HBox();
this.hboxBottom.Name = "hboxBottom";
this.hboxBottom.Spacing = 6;
// Container child hboxBottom.Gtk.Box+BoxChild
this.hboxButtons = new global::Gtk.HBox();
this.hboxButtons.Name = "hboxButtons";
this.hboxButtons.Homogeneous = true;
this.hboxButtons.Spacing = 6;
// Container child hboxButtons.Gtk.Box+BoxChild
this.hboxLeft = new global::Gtk.HBox();
this.hboxLeft.Name = "hboxLeft";
this.hboxLeft.Spacing = 6;
// Container child hboxLeft.Gtk.Box+BoxChild
this.buttonBack = new global::Gtk.Button();
this.buttonBack.WidthRequest = 65;
this.buttonBack.CanFocus = true;
this.buttonBack.Name = "buttonBack";
this.buttonBack.UseUnderline = true;
this.buttonBack.Label = global::Mono.Unix.Catalog.GetString("Back");
this.hboxLeft.Add(this.buttonBack);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hboxLeft[this.buttonBack]));
w7.Position = 0;
w7.Expand = false;
w7.Fill = false;
// Container child hboxLeft.Gtk.Box+BoxChild
this.hbox5 = new global::Gtk.HBox();
this.hbox5.Name = "hbox5";
this.hbox5.Spacing = 6;
// Container child hbox5.Gtk.Box+BoxChild
this.buttonSelectAll = new global::Gtk.Button();
this.buttonSelectAll.WidthRequest = 35;
this.buttonSelectAll.CanFocus = true;
this.buttonSelectAll.Name = "buttonSelectAll";
this.buttonSelectAll.UseUnderline = true;
this.buttonSelectAll.FocusOnClick = false;
this.buttonSelectAll.Label = global::Mono.Unix.Catalog.GetString("✓");
this.hbox5.Add(this.buttonSelectAll);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox5[this.buttonSelectAll]));
w8.Position = 0;
w8.Expand = false;
w8.Fill = false;
// Container child hbox5.Gtk.Box+BoxChild
this.buttonUnSelectAll = new global::Gtk.Button();
this.buttonUnSelectAll.WidthRequest = 35;
this.buttonUnSelectAll.Sensitive = false;
this.buttonUnSelectAll.CanFocus = true;
this.buttonUnSelectAll.Name = "buttonUnSelectAll";
this.buttonUnSelectAll.UseUnderline = true;
this.buttonUnSelectAll.FocusOnClick = false;
this.buttonUnSelectAll.Label = global::Mono.Unix.Catalog.GetString("X");
this.hbox5.Add(this.buttonUnSelectAll);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox5[this.buttonUnSelectAll]));
w9.Position = 1;
w9.Expand = false;
w9.Fill = false;
// Container child hbox5.Gtk.Box+BoxChild
this.labelSelectedPhotoset = new global::Gtk.Label();
this.labelSelectedPhotoset.Name = "labelSelectedPhotoset";
this.labelSelectedPhotoset.Xalign = 0F;
this.labelSelectedPhotoset.LabelProp = global::Mono.Unix.Catalog.GetString("Selected Photoset");
this.labelSelectedPhotoset.UseMarkup = true;
this.hbox5.Add(this.labelSelectedPhotoset);
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox5[this.labelSelectedPhotoset]));
w10.Position = 2;
this.hboxLeft.Add(this.hbox5);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hboxLeft[this.hbox5]));
w11.Position = 1;
this.hboxButtons.Add(this.hboxLeft);
global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hboxButtons[this.hboxLeft]));
w12.Position = 0;
// Container child hboxButtons.Gtk.Box+BoxChild
this.hboxCenter = new global::Gtk.HBox();
this.hboxCenter.Name = "hboxCenter";
this.hboxCenter.Spacing = 6;
// Container child hboxCenter.Gtk.Box+BoxChild
this.buttonFirstPage = new global::Gtk.Button();
this.buttonFirstPage.WidthRequest = 35;
this.buttonFirstPage.CanFocus = true;
this.buttonFirstPage.Name = "buttonFirstPage";
this.buttonFirstPage.UseUnderline = true;
this.buttonFirstPage.FocusOnClick = false;
this.buttonFirstPage.Label = global::Mono.Unix.Catalog.GetString("|<<");
this.hboxCenter.Add(this.buttonFirstPage);
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hboxCenter[this.buttonFirstPage]));
w13.Position = 0;
w13.Expand = false;
w13.Fill = false;
// Container child hboxCenter.Gtk.Box+BoxChild
this.buttonPreviousPage = new global::Gtk.Button();
this.buttonPreviousPage.WidthRequest = 35;
this.buttonPreviousPage.CanFocus = true;
this.buttonPreviousPage.Name = "buttonPreviousPage";
this.buttonPreviousPage.UseUnderline = true;
this.buttonPreviousPage.FocusOnClick = false;
this.buttonPreviousPage.Label = global::Mono.Unix.Catalog.GetString("<");
this.hboxCenter.Add(this.buttonPreviousPage);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hboxCenter[this.buttonPreviousPage]));
w14.Position = 1;
w14.Expand = false;
w14.Fill = false;
// Container child hboxCenter.Gtk.Box+BoxChild
this.hbox2 = new global::Gtk.HBox();
this.hbox2.Name = "hbox2";
this.hbox2.Spacing = 6;
// Container child hbox2.Gtk.Box+BoxChild
this.vbox2 = new global::Gtk.VBox();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
// Container child vbox2.Gtk.Box+BoxChild
this.labelPhotos = new global::Gtk.Label();
this.labelPhotos.Name = "labelPhotos";
this.labelPhotos.LabelProp = global::Mono.Unix.Catalog.GetString("<small> </small>");
this.labelPhotos.UseMarkup = true;
this.vbox2.Add(this.labelPhotos);
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.labelPhotos]));
w15.Position = 0;
w15.Expand = false;
w15.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.labelPages = new global::Gtk.Label();
this.labelPages.Name = "labelPages";
this.labelPages.LabelProp = global::Mono.Unix.Catalog.GetString("<small> </small>");
this.labelPages.UseMarkup = true;
this.vbox2.Add(this.labelPages);
global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.labelPages]));
w16.Position = 1;
w16.Expand = false;
w16.Fill = false;
this.hbox2.Add(this.vbox2);
global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.vbox2]));
w17.Position = 0;
w17.Expand = false;
w17.Fill = false;
// Container child hbox2.Gtk.Box+BoxChild
this.comboboxPage = global::Gtk.ComboBox.NewText();
this.comboboxPage.AppendText(global::Mono.Unix.Catalog.GetString("1"));
this.comboboxPage.Name = "comboboxPage";
this.comboboxPage.Active = 0;
this.hbox2.Add(this.comboboxPage);
global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.comboboxPage]));
w18.Position = 1;
w18.Expand = false;
w18.Fill = false;
this.hboxCenter.Add(this.hbox2);
global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hboxCenter[this.hbox2]));
w19.Position = 2;
w19.Expand = false;
w19.Fill = false;
// Container child hboxCenter.Gtk.Box+BoxChild
this.buttonNextPage = new global::Gtk.Button();
this.buttonNextPage.WidthRequest = 35;
this.buttonNextPage.CanFocus = true;
this.buttonNextPage.Name = "buttonNextPage";
this.buttonNextPage.UseUnderline = true;
this.buttonNextPage.FocusOnClick = false;
this.buttonNextPage.Label = global::Mono.Unix.Catalog.GetString(">");
this.hboxCenter.Add(this.buttonNextPage);
global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hboxCenter[this.buttonNextPage]));
w20.Position = 3;
w20.Expand = false;
w20.Fill = false;
// Container child hboxCenter.Gtk.Box+BoxChild
this.buttonLastPage = new global::Gtk.Button();
this.buttonLastPage.WidthRequest = 35;
this.buttonLastPage.CanFocus = true;
this.buttonLastPage.Name = "buttonLastPage";
this.buttonLastPage.UseUnderline = true;
this.buttonLastPage.FocusOnClick = false;
this.buttonLastPage.Label = global::Mono.Unix.Catalog.GetString(">>|");
this.hboxCenter.Add(this.buttonLastPage);
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hboxCenter[this.buttonLastPage]));
w21.Position = 4;
w21.Expand = false;
w21.Fill = false;
this.hboxButtons.Add(this.hboxCenter);
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.hboxButtons[this.hboxCenter]));
w22.Position = 1;
w22.Expand = false;
w22.Fill = false;
// Container child hboxButtons.Gtk.Box+BoxChild
this.hboxRight = new global::Gtk.HBox();
this.hboxRight.Name = "hboxRight";
this.hboxRight.Spacing = 6;
// Container child hboxRight.Gtk.Box+BoxChild
this.label1 = new global::Gtk.Label();
this.label1.Name = "label1";
this.label1.LabelProp = global::Mono.Unix.Catalog.GetString("<b>Download</b>");
this.label1.UseMarkup = true;
this.hboxRight.Add(this.label1);
global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.hboxRight[this.label1]));
w23.Position = 0;
w23.Expand = false;
w23.Fill = false;
// Container child hboxRight.Gtk.Box+BoxChild
this.buttonDownloadSelection = new global::Gtk.Button();
this.buttonDownloadSelection.WidthRequest = 125;
this.buttonDownloadSelection.CanFocus = true;
this.buttonDownloadSelection.Name = "buttonDownloadSelection";
this.buttonDownloadSelection.UseUnderline = true;
this.buttonDownloadSelection.FocusOnClick = false;
this.buttonDownloadSelection.Label = global::Mono.Unix.Catalog.GetString("Selection");
this.hboxRight.Add(this.buttonDownloadSelection);
global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.hboxRight[this.buttonDownloadSelection]));
w24.Position = 1;
w24.Expand = false;
w24.Fill = false;
// Container child hboxRight.Gtk.Box+BoxChild
this.buttonDownloadThisPage = new global::Gtk.Button();
this.buttonDownloadThisPage.WidthRequest = 76;
this.buttonDownloadThisPage.CanFocus = true;
this.buttonDownloadThisPage.Name = "buttonDownloadThisPage";
this.buttonDownloadThisPage.UseUnderline = true;
this.buttonDownloadThisPage.FocusOnClick = false;
this.buttonDownloadThisPage.Label = global::Mono.Unix.Catalog.GetString("This Page");
this.hboxRight.Add(this.buttonDownloadThisPage);
global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.hboxRight[this.buttonDownloadThisPage]));
w25.Position = 2;
w25.Expand = false;
w25.Fill = false;
// Container child hboxRight.Gtk.Box+BoxChild
this.buttonDownloadAllPages = new global::Gtk.Button();
this.buttonDownloadAllPages.WidthRequest = 75;
this.buttonDownloadAllPages.CanFocus = true;
this.buttonDownloadAllPages.Name = "buttonDownloadAllPages";
this.buttonDownloadAllPages.UseUnderline = true;
this.buttonDownloadAllPages.FocusOnClick = false;
this.buttonDownloadAllPages.Label = global::Mono.Unix.Catalog.GetString("All Pages");
this.hboxRight.Add(this.buttonDownloadAllPages);
global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.hboxRight[this.buttonDownloadAllPages]));
w26.Position = 3;
w26.Expand = false;
w26.Fill = false;
this.hboxButtons.Add(this.hboxRight);
global::Gtk.Box.BoxChild w27 = ((global::Gtk.Box.BoxChild)(this.hboxButtons[this.hboxRight]));
w27.Position = 2;
w27.Fill = false;
this.hboxBottom.Add(this.hboxButtons);
global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.hboxBottom[this.hboxButtons]));
w28.Position = 0;
w28.Expand = false;
w28.Fill = false;
this.vboxRoot.Add(this.hboxBottom);
global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.vboxRoot[this.hboxBottom]));
w29.Position = 2;
w29.Expand = false;
w29.Fill = false;
this.Add(this.vboxRoot);
if ((this.Child != null))
{
this.Child.ShowAll();
}
this.DefaultWidth = 1119;
this.DefaultHeight = 600;
this.Show();
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
this.buttonBack.Clicked += new global::System.EventHandler(this.buttonBackClick);
this.buttonSelectAll.Clicked += new global::System.EventHandler(this.buttonSelectAllClick);
this.buttonUnSelectAll.Clicked += new global::System.EventHandler(this.buttonUnSelectAllClick);
this.buttonFirstPage.Clicked += new global::System.EventHandler(this.buttonFirstPageClick);
this.buttonPreviousPage.Clicked += new global::System.EventHandler(this.buttonPreviousPageClick);
this.comboboxPage.Changed += new global::System.EventHandler(this.comboboxPageChange);
this.buttonNextPage.Clicked += new global::System.EventHandler(this.buttonNextPageClick);
this.buttonLastPage.Clicked += new global::System.EventHandler(this.buttonLastPageClick);
this.buttonDownloadSelection.Clicked += new global::System.EventHandler(this.buttonDownloadSelectionClick);
this.buttonDownloadThisPage.Clicked += new global::System.EventHandler(this.buttonDownloadThisPageClick);
this.buttonDownloadAllPages.Clicked += new global::System.EventHandler(this.buttonDownloadAllPagesClick);
}
}
}
| {
"content_hash": "e1abe05d93aca4e447a1b2ddf0e710f0",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 110,
"avg_line_length": 43.732283464566926,
"alnum_prop": 0.7305845636778298,
"repo_name": "flickr-downloadr/flickr-downloadr-gtk",
"id": "b35a6be65464a1f36eb631518129f16fb6ead3f7",
"size": "16733",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "source/FloydPink.Flickr.Downloadr.UI/gtk-gui/FloydPink.Flickr.Downloadr.UI.Windows.BrowserWindow.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "310"
},
{
"name": "C",
"bytes": "527"
},
{
"name": "C#",
"bytes": "344750"
},
{
"name": "C++",
"bytes": "4451"
},
{
"name": "JavaScript",
"bytes": "39"
},
{
"name": "PowerShell",
"bytes": "2405"
},
{
"name": "Shell",
"bytes": "9897"
},
{
"name": "Visual Basic .NET",
"bytes": "4476"
},
{
"name": "XSLT",
"bytes": "457"
}
],
"symlink_target": ""
} |
using System.Data.Entity;
namespace MVCMovie.Models
{
public class BookDBContext : DbContext
{
public DbSet<Book> Books { get; set; }
}
} | {
"content_hash": "ba853e5d44915c220d4a64d733a78767",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 46,
"avg_line_length": 17.666666666666668,
"alnum_prop": 0.6477987421383647,
"repo_name": "komitoff/Software-Technologies",
"id": "969e156924f6ea674afb7c20ef1b11df16338f6c",
"size": "161",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MVC Movie Tutorial/MVCMovie/MVCMovie/Models/BookDBContext.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "397"
},
{
"name": "ApacheConf",
"bytes": "5814"
},
{
"name": "Batchfile",
"bytes": "10012"
},
{
"name": "C#",
"bytes": "285519"
},
{
"name": "CSS",
"bytes": "1225382"
},
{
"name": "HTML",
"bytes": "100175"
},
{
"name": "Java",
"bytes": "34217"
},
{
"name": "JavaScript",
"bytes": "324270"
},
{
"name": "PHP",
"bytes": "107226"
},
{
"name": "PowerShell",
"bytes": "442010"
},
{
"name": "Shell",
"bytes": "14116"
}
],
"symlink_target": ""
} |
/// <reference path="../range.ts" />
/// <reference path="./fold_line.ts" />
namespace Monaka {
/*
* Simple fold-data struct.
**/
export class Fold {
public foldLine: FoldLine = null;
public start: IPosition;
public end: IPosition;
public sameRow: boolean;
public subFolds: Fold[] = [];
constructor(public range: _Range, public placeholder: string) {
this.start = range.start;
this.end = range.end;
this.sameRow = range.start.row === range.end.row;
}
public toString() {
return '"' + this.placeholder + '" ' + this.range.toString();
}
public setFoldLine(foldLine: FoldLine) {
this.foldLine = foldLine;
this.subFolds.forEach(function (fold) {
fold.setFoldLine(foldLine);
});
}
public clone() {
var range = this.range.clone();
var fold = new Fold(range, this.placeholder);
this.subFolds.forEach(function (subFold) {
fold.subFolds.push(subFold.clone());
});
return fold;
}
public addSubFold(fold: Fold): Fold {
if (this.range.isEqual(fold.range))
return this;
if (!this.range.containsRange(fold.range))
throw "A fold can't intersect already existing fold" + fold.range + this.range;
var row = fold.range.start.row;
var column = fold.range.start.column;
for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
cmp = this.subFolds[i].range.compare(row, column);
if (cmp != 1)
break;
}
let afterStart = this.subFolds[i];
if (cmp == 0)
return afterStart.addSubFold(fold);
// cmp == -1
var row = fold.range.end.row, column = fold.range.end.column;
for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
cmp = this.subFolds[j].range.compare(row, column);
if (cmp != 1)
break;
}
var afterEnd = this.subFolds[j];
if (cmp == 0)
throw "A fold can't intersect already existing fold" + fold.range + this.range;
var consumedFolds = this.subFolds.splice(i, j - i, fold);
fold.setFoldLine(this.foldLine);
return fold;
}
}
} | {
"content_hash": "a0eaed2562310122462d08bb1f557dfb",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 95,
"avg_line_length": 32.64935064935065,
"alnum_prop": 0.5015910898965792,
"repo_name": "SuperZako/Monaka",
"id": "25b1f1a0f367af01c7e5ef983ac93ec7a0a6ed77",
"size": "2514",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Monaka/edit_session/fold.ts",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "83"
},
{
"name": "C++",
"bytes": "193"
},
{
"name": "CSS",
"bytes": "2003"
},
{
"name": "Clojure",
"bytes": "794"
},
{
"name": "CoffeeScript",
"bytes": "403"
},
{
"name": "ColdFusion",
"bytes": "86"
},
{
"name": "GLSL",
"bytes": "512"
},
{
"name": "Go",
"bytes": "641"
},
{
"name": "Groovy",
"bytes": "1080"
},
{
"name": "HTML",
"bytes": "10499"
},
{
"name": "Haxe",
"bytes": "447"
},
{
"name": "Java",
"bytes": "396"
},
{
"name": "JavaScript",
"bytes": "631920"
},
{
"name": "Liquid",
"bytes": "1883"
},
{
"name": "Lua",
"bytes": "959"
},
{
"name": "OCaml",
"bytes": "539"
},
{
"name": "OpenSCAD",
"bytes": "333"
},
{
"name": "PHP",
"bytes": "351"
},
{
"name": "Perl",
"bytes": "637"
},
{
"name": "PowerShell",
"bytes": "418"
},
{
"name": "Python",
"bytes": "478"
},
{
"name": "Ruby",
"bytes": "164"
},
{
"name": "Scala",
"bytes": "1541"
},
{
"name": "Shell",
"bytes": "1142"
},
{
"name": "Tcl",
"bytes": "899"
},
{
"name": "TeX",
"bytes": "875"
},
{
"name": "TypeScript",
"bytes": "718958"
},
{
"name": "XQuery",
"bytes": "114"
}
],
"symlink_target": ""
} |
namespace Google.Cloud.AppEngine.V1.Snippets
{
// [START appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async]
using Google.Cloud.AppEngine.V1;
using System.Threading.Tasks;
public sealed partial class GeneratedAuthorizedCertificatesClientSnippets
{
/// <summary>Snippet for GetAuthorizedCertificateAsync</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public async Task GetAuthorizedCertificateRequestObjectAsync()
{
// Create client
AuthorizedCertificatesClient authorizedCertificatesClient = await AuthorizedCertificatesClient.CreateAsync();
// Initialize request argument(s)
GetAuthorizedCertificateRequest request = new GetAuthorizedCertificateRequest
{
Name = "",
View = AuthorizedCertificateView.BasicCertificate,
};
// Make the request
AuthorizedCertificate response = await authorizedCertificatesClient.GetAuthorizedCertificateAsync(request);
}
}
// [END appengine_v1_generated_AuthorizedCertificates_GetAuthorizedCertificate_async]
}
| {
"content_hash": "7b0d042b93d3047a0409146d5f209d97",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 121,
"avg_line_length": 45.6551724137931,
"alnum_prop": 0.6948640483383686,
"repo_name": "jskeet/google-cloud-dotnet",
"id": "cce003cdfc2d83206d2d8d6ae10af520601ade88",
"size": "1946",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "apis/Google.Cloud.AppEngine.V1/Google.Cloud.AppEngine.V1.GeneratedSnippets/AuthorizedCertificatesClient.GetAuthorizedCertificateRequestObjectAsyncSnippet.g.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "767"
},
{
"name": "C#",
"bytes": "268415427"
},
{
"name": "CSS",
"bytes": "1346"
},
{
"name": "Dockerfile",
"bytes": "3173"
},
{
"name": "HTML",
"bytes": "3823"
},
{
"name": "JavaScript",
"bytes": "226"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Python",
"bytes": "2744"
},
{
"name": "Shell",
"bytes": "65260"
},
{
"name": "sed",
"bytes": "1030"
}
],
"symlink_target": ""
} |
<?php
namespace Nette\Latte\Macros;
use Nette,
Nette\Latte,
Nette\Latte\MacroNode,
Nette\Latte\PhpWriter,
Nette\Latte\CompileException,
Nette\Forms\Form;
/**
* Macros for Nette\Forms.
*
* - {form name} ... {/form}
* - {input name}
* - {label name /} or {label name}... {/label}
* - {inputError name}
* - {formContainer name} ... {/formContainer}
*
* @author David Grudl
*/
class FormMacros extends MacroSet
{
public static function install(Latte\Compiler $compiler)
{
$me = new static($compiler);
$me->addMacro('form', array($me, 'macroForm'), 'Nette\Latte\Macros\FormMacros::renderFormEnd($_form)');
$me->addMacro('formContainer', array($me, 'macroFormContainer'), '$_form = array_pop($_formStack)');
$me->addMacro('label', array($me, 'macroLabel'), array($me, 'macroLabelEnd'));
$me->addMacro('input', array($me, 'macroInput'), NULL, array($me, 'macroInputAttr'));
$me->addMacro('name', array($me, 'macroName'), array($me, 'macroNameEnd'), array($me, 'macroNameAttr'));
$me->addMacro('inputError', array($me, 'macroInputError'));
}
/********************* macros ****************d*g**/
/**
* {form ...}
*/
public function macroForm(MacroNode $node, PhpWriter $writer)
{
if ($node->htmlNode && strtolower($node->htmlNode->name) === 'form') {
throw new CompileException('Did you mean <form n:name=...> ?');
}
$name = $node->tokenizer->fetchWord();
if ($name === FALSE) {
throw new CompileException("Missing form name in {{$node->name}}.");
}
$node->tokenizer->reset();
return $writer->write(
'Nette\Latte\Macros\FormMacros::renderFormBegin($form = $_form = '
. ($name[0] === '$' ? 'is_object(%node.word) ? %node.word : ' : '')
. '$_control[%node.word], %node.array)'
);
}
/**
* {formContainer ...}
*/
public function macroFormContainer(MacroNode $node, PhpWriter $writer)
{
$name = $node->tokenizer->fetchWord();
if ($name === FALSE) {
throw new CompileException("Missing form name in {{$node->name}}.");
}
$node->tokenizer->reset();
return $writer->write(
'$_formStack[] = $_form; $formContainer = $_form = ' . ($name[0] === '$' ? 'is_object(%node.word) ? %node.word : ' : '') . '$_form[%node.word]'
);
}
/**
* {label ...}
*/
public function macroLabel(MacroNode $node, PhpWriter $writer)
{
$words = $node->tokenizer->fetchWords();
if (!$words) {
throw new CompileException("Missing name in {{$node->name}}.");
}
$name = array_shift($words);
return $writer->write(
($name[0] === '$' ? '$_input = is_object(%0.word) ? %0.word : $_form[%0.word]; if ($_label = $_input' : 'if ($_label = $_form[%0.word]')
. '->%1.raw) echo $_label'
. ($node->tokenizer->isNext() ? '->addAttributes(%node.array)' : ''),
$name,
$words ? ('getLabelPart(' . implode(', ', array_map(array($writer, 'formatWord'), $words)) . ')') : 'getLabel()'
);
}
/**
* {/label}
*/
public function macroLabelEnd(MacroNode $node, PhpWriter $writer)
{
if ($node->content != NULL) {
$node->openingCode = rtrim($node->openingCode, '?> ') . '->startTag() ?>';
return $writer->write('if ($_label) echo $_label->endTag()');
}
}
/**
* {input ...}
*/
public function macroInput(MacroNode $node, PhpWriter $writer)
{
$words = $node->tokenizer->fetchWords();
if (!$words) {
throw new CompileException("Missing name in {{$node->name}}.");
}
$name = array_shift($words);
return $writer->write(
($name[0] === '$' ? '$_input = is_object(%0.word) ? %0.word : $_form[%0.word]; echo $_input' : 'echo $_form[%0.word]')
. '->%1.raw'
. ($node->tokenizer->isNext() ? '->addAttributes(%node.array)' : ''),
$name,
$words ? 'getControlPart(' . implode(', ', array_map(array($writer, 'formatWord'), $words)) . ')' : 'getControl()'
);
}
/**
* deprecated n:input
*/
public function macroInputAttr(MacroNode $node, PhpWriter $writer)
{
if (strtolower($node->htmlNode->name) === 'input') {
return $this->macroNameAttr($node, $writer);
} else {
throw new CompileException("Use n:name instead of n:input.");
}
}
/**
* <form n:name>, <input n:name>, <select n:name>, <textarea n:name> and <label n:name>
*/
public function macroNameAttr(MacroNode $node, PhpWriter $writer)
{
$words = $node->tokenizer->fetchWords();
if (!$words) {
throw new CompileException("Missing name in n:{$node->name}.");
}
$name = array_shift($words);
$tagName = strtolower($node->htmlNode->name);
$node->isEmpty = !in_array($tagName, array('form', 'select', 'textarea'));
if ($tagName === 'form') {
return $writer->write(
'Nette\Latte\Macros\FormMacros::renderFormBegin($form = $_form = '
. ($name[0] === '$' ? 'is_object(%0.word) ? %0.word : ' : '')
. '$_control[%0.word], %1.var, FALSE)',
$name,
array_fill_keys(array_keys($node->htmlNode->attrs), NULL)
);
} else {
$method = $tagName === 'label' ? 'getLabel' : 'getControl';
return $writer->write(
'$_input = ' . ($name[0] === '$' ? 'is_object(%0.word) ? %0.word : ' : '')
. '$_form[%0.word]; echo $_input->%1.raw'
. ($node->htmlNode->attrs ? '->addAttributes(%2.var)' : '') . '->attributes()',
$name,
$words
? $method . 'Part(' . implode(', ', array_map(array($writer, 'formatWord'), $words)) . ')'
: "{method_exists(\$_input, '{$method}Part')?'{$method}Part':'{$method}'}()",
array_fill_keys(array_keys($node->htmlNode->attrs), NULL)
);
}
}
public function macroName(MacroNode $node, PhpWriter $writer)
{
if (!$node->htmlNode) {
throw new CompileException("Unknown macro {{$node->name}}, use n:{$node->name} attribute.");
} elseif ($node->prefix !== MacroNode::PREFIX_NONE) {
throw new CompileException("Unknown attribute n:{$node->prefix}-{$node->name}, use n:{$node->name} attribute.");
}
}
public function macroNameEnd(MacroNode $node, PhpWriter $writer)
{
preg_match('#^(.*? n:\w+>)(.*)(<[^?].*)\z#s', $node->content, $parts);
if (strtolower($node->htmlNode->name) === 'form') {
$node->content = $parts[1] . $parts[2] . '<?php Nette\Latte\Macros\FormMacros::renderFormEnd($_form, FALSE) ?>' . $parts[3];
} else { // select, textarea
$node->content = $parts[1] . '<?php echo $_input->getControl()->getHtml() ?>' . $parts[3];
}
}
/**
* {inputError ...}
*/
public function macroInputError(MacroNode $node, PhpWriter $writer)
{
$name = $node->tokenizer->fetchWord();
if (!$name) {
return $writer->write('echo %escape($_input->getError())');
} elseif ($name[0] === '$') {
return $writer->write('$_input = is_object(%0.word) ? %0.word : $_form[%0.word]; echo %escape($_input->getError())', $name);
} else {
return $writer->write('echo %escape($_form[%0.word]->getError())', $name);
}
}
/********************* run-time writers ****************d*g**/
/**
* Renders form begin.
* @return void
*/
public static function renderFormBegin(Form $form, array $attrs, $withTags = TRUE)
{
foreach ($form->getControls() as $control) {
$control->setOption('rendered', FALSE);
}
$el = $form->getElementPrototype();
$el->action = $action = (string) $el->action;
$el = clone $el;
if (strcasecmp($form->getMethod(), 'get') === 0) {
$el->action = preg_replace('~\?[^#]*~', '', $el->action, 1);
}
$el->addAttributes($attrs);
echo $withTags ? $el->startTag() : $el->attributes();
}
/**
* Renders form end.
* @return string
*/
public static function renderFormEnd(Form $form, $withTags = TRUE)
{
$s = '';
if (strcasecmp($form->getMethod(), 'get') === 0) {
foreach (preg_split('#[;&]#', parse_url($form->getElementPrototype()->action, PHP_URL_QUERY), NULL, PREG_SPLIT_NO_EMPTY) as $param) {
$parts = explode('=', $param, 2);
$name = urldecode($parts[0]);
if (!isset($form[$name])) {
$s .= Nette\Utils\Html::el('input', array('type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])));
}
}
}
foreach ($form->getComponents(TRUE, 'Nette\Forms\Controls\HiddenField') as $control) {
if (!$control->getOption('rendered')) {
$s .= $control->getControl();
}
}
if (iterator_count($form->getComponents(TRUE, 'Nette\Forms\Controls\TextInput')) < 2) {
$s .= '<!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->';
}
echo ($s ? "<div>$s</div>\n" : '') . ($withTags ? $form->getElementPrototype()->endTag() . "\n" : '');
}
}
| {
"content_hash": "1800cbf13bcc21b7335c2e34dd023c20",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 146,
"avg_line_length": 31.761904761904763,
"alnum_prop": 0.5632568331219006,
"repo_name": "rebendajirijr/framework-comparison",
"id": "fc8e8d7cb0d4d2c5b535b44868ef11c116ec64e4",
"size": "8802",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "performance_tests/nette/vendor/nette/nette/Nette/Latte/Macros/FormMacros.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "4696"
},
{
"name": "JavaScript",
"bytes": "28490"
},
{
"name": "PHP",
"bytes": "82165"
},
{
"name": "Volt",
"bytes": "1416"
}
],
"symlink_target": ""
} |
@interface FLAssetsLibraryGroupBrowser : FLAssetsLibraryBrowserBase {
}
+ (FLAssetsLibraryGroupBrowser*) assetsLibraryGroupBrowser:(FLAssetQueue*) queue;
@end
| {
"content_hash": "3b933660c7f84a37d36338a1a1eab520",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 81,
"avg_line_length": 26.833333333333332,
"alnum_prop": 0.8322981366459627,
"repo_name": "fishlamp-released/FishLamp2",
"id": "d05eb07f231feb1604af60fad3145ced48f4d521",
"size": "531",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Frameworks/iOS/Classes/AssetsLibrary/FLAssetsLibraryGroupBrowser.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "56278"
},
{
"name": "C++",
"bytes": "3770"
},
{
"name": "Matlab",
"bytes": "2104"
},
{
"name": "Objective-C",
"bytes": "6583424"
},
{
"name": "Shell",
"bytes": "38669"
}
],
"symlink_target": ""
} |
grobal.deadlinkSourcemapPath = function() {
this.ok(true)
throw new Error("deadlink sourcemap path error")
}
| {
"content_hash": "75ac91a45d59c85fed1dee09ceb2e594",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 52,
"avg_line_length": 29.25,
"alnum_prop": 0.717948717948718,
"repo_name": "fresheneesz/deadunitCore",
"id": "69f1b3da8c49f2ad573a5826831cd057b38db4fd",
"size": "117",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/tests/deadlinkSourcemapPath.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "254"
},
{
"name": "HTML",
"bytes": "2297"
},
{
"name": "JavaScript",
"bytes": "733049"
}
],
"symlink_target": ""
} |
/* [R 19] Interrupt register #0 read */
#define BRB1_REG_BRB1_INT_STS 0x6011c
/* [RW 4] Parity mask register #0 read/write */
#define BRB1_REG_BRB1_PRTY_MASK 0x60138
/* [R 4] Parity register #0 read */
#define BRB1_REG_BRB1_PRTY_STS 0x6012c
/* [RW 10] At address BRB1_IND_FREE_LIST_PRS_CRDT initialize free head. At
address BRB1_IND_FREE_LIST_PRS_CRDT+1 initialize free tail. At address
BRB1_IND_FREE_LIST_PRS_CRDT+2 initialize parser initial credit. */
#define BRB1_REG_FREE_LIST_PRS_CRDT 0x60200
/* [RW 10] The number of free blocks above which the High_llfc signal to
interface #n is de-asserted. */
#define BRB1_REG_HIGH_LLFC_HIGH_THRESHOLD_0 0x6014c
/* [RW 10] The number of free blocks below which the High_llfc signal to
interface #n is asserted. */
#define BRB1_REG_HIGH_LLFC_LOW_THRESHOLD_0 0x6013c
/* [RW 23] LL RAM data. */
#define BRB1_REG_LL_RAM 0x61000
/* [RW 10] The number of free blocks above which the Low_llfc signal to
interface #n is de-asserted. */
#define BRB1_REG_LOW_LLFC_HIGH_THRESHOLD_0 0x6016c
/* [RW 10] The number of free blocks below which the Low_llfc signal to
interface #n is asserted. */
#define BRB1_REG_LOW_LLFC_LOW_THRESHOLD_0 0x6015c
/* [R 24] The number of full blocks. */
#define BRB1_REG_NUM_OF_FULL_BLOCKS 0x60090
/* [ST 32] The number of cycles that the write_full signal towards MAC #0
was asserted. */
#define BRB1_REG_NUM_OF_FULL_CYCLES_0 0x600c8
#define BRB1_REG_NUM_OF_FULL_CYCLES_1 0x600cc
#define BRB1_REG_NUM_OF_FULL_CYCLES_4 0x600d8
/* [ST 32] The number of cycles that the pause signal towards MAC #0 was
asserted. */
#define BRB1_REG_NUM_OF_PAUSE_CYCLES_0 0x600b8
#define BRB1_REG_NUM_OF_PAUSE_CYCLES_1 0x600bc
/* [RW 10] Write client 0: De-assert pause threshold. */
#define BRB1_REG_PAUSE_HIGH_THRESHOLD_0 0x60078
#define BRB1_REG_PAUSE_HIGH_THRESHOLD_1 0x6007c
/* [RW 10] Write client 0: Assert pause threshold. */
#define BRB1_REG_PAUSE_LOW_THRESHOLD_0 0x60068
#define BRB1_REG_PAUSE_LOW_THRESHOLD_1 0x6006c
/* [R 24] The number of full blocks occupied by port. */
#define BRB1_REG_PORT_NUM_OCC_BLOCKS_0 0x60094
/* [RW 1] Reset the design by software. */
#define BRB1_REG_SOFT_RESET 0x600dc
/* [R 5] Used to read the value of the XX protection CAM occupancy counter. */
#define CCM_REG_CAM_OCCUP 0xd0188
/* [RW 1] CM - CFC Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_CCM_CFC_IFEN 0xd003c
/* [RW 1] CM - QM Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_CCM_CQM_IFEN 0xd000c
/* [RW 1] If set the Q index; received from the QM is inserted to event ID.
Otherwise 0 is inserted. */
#define CCM_REG_CCM_CQM_USE_Q 0xd00c0
/* [RW 11] Interrupt mask register #0 read/write */
#define CCM_REG_CCM_INT_MASK 0xd01e4
/* [R 11] Interrupt register #0 read */
#define CCM_REG_CCM_INT_STS 0xd01d8
/* [R 27] Parity register #0 read */
#define CCM_REG_CCM_PRTY_STS 0xd01e8
/* [RW 3] The size of AG context region 0 in REG-pairs. Designates the MS
REG-pair number (e.g. if region 0 is 6 REG-pairs; the value should be 5).
Is used to determine the number of the AG context REG-pairs written back;
when the input message Reg1WbFlg isn't set. */
#define CCM_REG_CCM_REG0_SZ 0xd00c4
/* [RW 1] CM - STORM 0 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_CCM_STORM0_IFEN 0xd0004
/* [RW 1] CM - STORM 1 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_CCM_STORM1_IFEN 0xd0008
/* [RW 1] CDU AG read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define CCM_REG_CDU_AG_RD_IFEN 0xd0030
/* [RW 1] CDU AG write Interface enable. If 0 - the request and valid input
are disregarded; all other signals are treated as usual; if 1 - normal
activity. */
#define CCM_REG_CDU_AG_WR_IFEN 0xd002c
/* [RW 1] CDU STORM read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define CCM_REG_CDU_SM_RD_IFEN 0xd0038
/* [RW 1] CDU STORM write Interface enable. If 0 - the request and valid
input is disregarded; all other signals are treated as usual; if 1 -
normal activity. */
#define CCM_REG_CDU_SM_WR_IFEN 0xd0034
/* [RW 4] CFC output initial credit. Max credit available - 15.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 1 at start-up. */
#define CCM_REG_CFC_INIT_CRD 0xd0204
/* [RW 2] Auxillary counter flag Q number 1. */
#define CCM_REG_CNT_AUX1_Q 0xd00c8
/* [RW 2] Auxillary counter flag Q number 2. */
#define CCM_REG_CNT_AUX2_Q 0xd00cc
/* [RW 28] The CM header value for QM request (primary). */
#define CCM_REG_CQM_CCM_HDR_P 0xd008c
/* [RW 28] The CM header value for QM request (secondary). */
#define CCM_REG_CQM_CCM_HDR_S 0xd0090
/* [RW 1] QM - CM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_CQM_CCM_IFEN 0xd0014
/* [RW 6] QM output initial credit. Max credit available - 32. Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 32 at start-up. */
#define CCM_REG_CQM_INIT_CRD 0xd020c
/* [RW 3] The weight of the QM (primary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_CQM_P_WEIGHT 0xd00b8
/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_CQM_S_WEIGHT 0xd00bc
/* [RW 1] Input SDM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_CSDM_IFEN 0xd0018
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the SDM interface is detected. */
#define CCM_REG_CSDM_LENGTH_MIS 0xd0170
/* [RW 3] The weight of the SDM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_CSDM_WEIGHT 0xd00b4
/* [RW 28] The CM header for QM formatting in case of an error in the QM
inputs. */
#define CCM_REG_ERR_CCM_HDR 0xd0094
/* [RW 8] The Event ID in case the input message ErrorFlg is set. */
#define CCM_REG_ERR_EVNT_ID 0xd0098
/* [RW 8] FIC0 output initial credit. Max credit available - 255. Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define CCM_REG_FIC0_INIT_CRD 0xd0210
/* [RW 8] FIC1 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define CCM_REG_FIC1_INIT_CRD 0xd0214
/* [RW 1] Arbitration between Input Arbiter groups: 0 - fair Round-Robin; 1
- strict priority defined by ~ccm_registers_gr_ag_pr.gr_ag_pr;
~ccm_registers_gr_ld0_pr.gr_ld0_pr and
~ccm_registers_gr_ld1_pr.gr_ld1_pr. Groups are according to channels and
outputs to STORM: aggregation; load FIC0; load FIC1 and store. */
#define CCM_REG_GR_ARB_TYPE 0xd015c
/* [RW 2] Load (FIC0) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed; that the Store channel priority is
the compliment to 4 of the rest priorities - Aggregation channel; Load
(FIC0) channel and Load (FIC1). */
#define CCM_REG_GR_LD0_PR 0xd0164
/* [RW 2] Load (FIC1) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed; that the Store channel priority is
the compliment to 4 of the rest priorities - Aggregation channel; Load
(FIC0) channel and Load (FIC1). */
#define CCM_REG_GR_LD1_PR 0xd0168
/* [RW 2] General flags index. */
#define CCM_REG_INV_DONE_Q 0xd0108
/* [RW 4] The number of double REG-pairs(128 bits); loaded from the STORM
context and sent to STORM; for a specific connection type. The double
REG-pairs are used in order to align to STORM context row size of 128
bits. The offset of these data in the STORM context is always 0. Index
_(0..15) stands for the connection type (one of 16). */
#define CCM_REG_N_SM_CTX_LD_0 0xd004c
#define CCM_REG_N_SM_CTX_LD_1 0xd0050
#define CCM_REG_N_SM_CTX_LD_2 0xd0054
#define CCM_REG_N_SM_CTX_LD_3 0xd0058
#define CCM_REG_N_SM_CTX_LD_4 0xd005c
/* [RW 1] Input pbf Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define CCM_REG_PBF_IFEN 0xd0028
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the pbf interface is detected. */
#define CCM_REG_PBF_LENGTH_MIS 0xd0180
/* [RW 3] The weight of the input pbf in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_PBF_WEIGHT 0xd00ac
#define CCM_REG_PHYS_QNUM1_0 0xd0134
#define CCM_REG_PHYS_QNUM1_1 0xd0138
#define CCM_REG_PHYS_QNUM2_0 0xd013c
#define CCM_REG_PHYS_QNUM2_1 0xd0140
#define CCM_REG_PHYS_QNUM3_0 0xd0144
#define CCM_REG_PHYS_QNUM3_1 0xd0148
#define CCM_REG_QOS_PHYS_QNUM0_0 0xd0114
#define CCM_REG_QOS_PHYS_QNUM0_1 0xd0118
#define CCM_REG_QOS_PHYS_QNUM1_0 0xd011c
#define CCM_REG_QOS_PHYS_QNUM1_1 0xd0120
#define CCM_REG_QOS_PHYS_QNUM2_0 0xd0124
#define CCM_REG_QOS_PHYS_QNUM2_1 0xd0128
#define CCM_REG_QOS_PHYS_QNUM3_0 0xd012c
#define CCM_REG_QOS_PHYS_QNUM3_1 0xd0130
/* [RW 1] STORM - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define CCM_REG_STORM_CCM_IFEN 0xd0010
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the STORM interface is detected. */
#define CCM_REG_STORM_LENGTH_MIS 0xd016c
/* [RW 3] The weight of the STORM input in the WRR (Weighted Round robin)
mechanism. 0 stands for weight 8 (the most prioritised); 1 stands for
weight 1(least prioritised); 2 stands for weight 2 (more prioritised);
tc. */
#define CCM_REG_STORM_WEIGHT 0xd009c
/* [RW 1] Input tsem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define CCM_REG_TSEM_IFEN 0xd001c
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the tsem interface is detected. */
#define CCM_REG_TSEM_LENGTH_MIS 0xd0174
/* [RW 3] The weight of the input tsem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_TSEM_WEIGHT 0xd00a0
/* [RW 1] Input usem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define CCM_REG_USEM_IFEN 0xd0024
/* [RC 1] Set when message length mismatch (relative to last indication) at
the usem interface is detected. */
#define CCM_REG_USEM_LENGTH_MIS 0xd017c
/* [RW 3] The weight of the input usem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_USEM_WEIGHT 0xd00a8
/* [RW 1] Input xsem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define CCM_REG_XSEM_IFEN 0xd0020
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the xsem interface is detected. */
#define CCM_REG_XSEM_LENGTH_MIS 0xd0178
/* [RW 3] The weight of the input xsem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define CCM_REG_XSEM_WEIGHT 0xd00a4
/* [RW 19] Indirect access to the descriptor table of the XX protection
mechanism. The fields are: [5:0] - message length; [12:6] - message
pointer; 18:13] - next pointer. */
#define CCM_REG_XX_DESCR_TABLE 0xd0300
#define CCM_REG_XX_DESCR_TABLE_SIZE 36
/* [R 7] Used to read the value of XX protection Free counter. */
#define CCM_REG_XX_FREE 0xd0184
/* [RW 6] Initial value for the credit counter; responsible for fulfilling
of the Input Stage XX protection buffer by the XX protection pending
messages. Max credit available - 127. Write writes the initial credit
value; read returns the current value of the credit counter. Must be
initialized to maximum XX protected message size - 2 at start-up. */
#define CCM_REG_XX_INIT_CRD 0xd0220
/* [RW 7] The maximum number of pending messages; which may be stored in XX
protection. At read the ~ccm_registers_xx_free.xx_free counter is read.
At write comprises the start value of the ~ccm_registers_xx_free.xx_free
counter. */
#define CCM_REG_XX_MSG_NUM 0xd0224
/* [RW 8] The Event ID; sent to the STORM in case of XX overflow. */
#define CCM_REG_XX_OVFL_EVNT_ID 0xd0044
/* [RW 18] Indirect access to the XX table of the XX protection mechanism.
The fields are: [5:0] - tail pointer; 11:6] - Link List size; 17:12] -
header pointer. */
#define CCM_REG_XX_TABLE 0xd0280
#define CDU_REG_CDU_CHK_MASK0 0x101000
#define CDU_REG_CDU_CHK_MASK1 0x101004
#define CDU_REG_CDU_CONTROL0 0x101008
#define CDU_REG_CDU_DEBUG 0x101010
#define CDU_REG_CDU_GLOBAL_PARAMS 0x101020
/* [RW 7] Interrupt mask register #0 read/write */
#define CDU_REG_CDU_INT_MASK 0x10103c
/* [R 7] Interrupt register #0 read */
#define CDU_REG_CDU_INT_STS 0x101030
/* [RW 5] Parity mask register #0 read/write */
#define CDU_REG_CDU_PRTY_MASK 0x10104c
/* [R 5] Parity register #0 read */
#define CDU_REG_CDU_PRTY_STS 0x101040
/* [RC 32] logging of error data in case of a CDU load error:
{expected_cid[15:0]; xpected_type[2:0]; xpected_region[2:0]; ctive_error;
ype_error; ctual_active; ctual_compressed_context}; */
#define CDU_REG_ERROR_DATA 0x101014
/* [WB 216] L1TT ram access. each entry has the following format :
{mrege_regions[7:0]; ffset12[5:0]...offset0[5:0];
ength12[5:0]...length0[5:0]; d12[3:0]...id0[3:0]} */
#define CDU_REG_L1TT 0x101800
/* [WB 24] MATT ram access. each entry has the following
format:{RegionLength[11:0]; egionOffset[11:0]} */
#define CDU_REG_MATT 0x101100
/* [RW 1] when this bit is set the CDU operates in e1hmf mode */
#define CDU_REG_MF_MODE 0x101050
/* [R 1] indication the initializing the activity counter by the hardware
was done. */
#define CFC_REG_AC_INIT_DONE 0x104078
/* [RW 13] activity counter ram access */
#define CFC_REG_ACTIVITY_COUNTER 0x104400
#define CFC_REG_ACTIVITY_COUNTER_SIZE 256
/* [R 1] indication the initializing the cams by the hardware was done. */
#define CFC_REG_CAM_INIT_DONE 0x10407c
/* [RW 2] Interrupt mask register #0 read/write */
#define CFC_REG_CFC_INT_MASK 0x104108
/* [R 2] Interrupt register #0 read */
#define CFC_REG_CFC_INT_STS 0x1040fc
/* [RC 2] Interrupt register #0 read clear */
#define CFC_REG_CFC_INT_STS_CLR 0x104100
/* [RW 4] Parity mask register #0 read/write */
#define CFC_REG_CFC_PRTY_MASK 0x104118
/* [R 4] Parity register #0 read */
#define CFC_REG_CFC_PRTY_STS 0x10410c
/* [RW 21] CID cam access (21:1 - Data; alid - 0) */
#define CFC_REG_CID_CAM 0x104800
#define CFC_REG_CONTROL0 0x104028
#define CFC_REG_DEBUG0 0x104050
/* [RW 14] indicates per error (in #cfc_registers_cfc_error_vector.cfc_error
vector) whether the cfc should be disabled upon it */
#define CFC_REG_DISABLE_ON_ERROR 0x104044
/* [RC 14] CFC error vector. when the CFC detects an internal error it will
set one of these bits. the bit description can be found in CFC
specifications */
#define CFC_REG_ERROR_VECTOR 0x10403c
/* [WB 93] LCID info ram access */
#define CFC_REG_INFO_RAM 0x105000
#define CFC_REG_INFO_RAM_SIZE 1024
#define CFC_REG_INIT_REG 0x10404c
#define CFC_REG_INTERFACES 0x104058
/* [RW 24] {weight_load_client7[2:0] to weight_load_client0[2:0]}. this
field allows changing the priorities of the weighted-round-robin arbiter
which selects which CFC load client should be served next */
#define CFC_REG_LCREQ_WEIGHTS 0x104084
/* [RW 16] Link List ram access; data = {prev_lcid; ext_lcid} */
#define CFC_REG_LINK_LIST 0x104c00
#define CFC_REG_LINK_LIST_SIZE 256
/* [R 1] indication the initializing the link list by the hardware was done. */
#define CFC_REG_LL_INIT_DONE 0x104074
/* [R 9] Number of allocated LCIDs which are at empty state */
#define CFC_REG_NUM_LCIDS_ALLOC 0x104020
/* [R 9] Number of Arriving LCIDs in Link List Block */
#define CFC_REG_NUM_LCIDS_ARRIVING 0x104004
/* [R 9] Number of Leaving LCIDs in Link List Block */
#define CFC_REG_NUM_LCIDS_LEAVING 0x104018
/* [RW 8] The event id for aggregated interrupt 0 */
#define CSDM_REG_AGG_INT_EVENT_0 0xc2038
#define CSDM_REG_AGG_INT_EVENT_10 0xc2060
#define CSDM_REG_AGG_INT_EVENT_11 0xc2064
#define CSDM_REG_AGG_INT_EVENT_12 0xc2068
#define CSDM_REG_AGG_INT_EVENT_13 0xc206c
#define CSDM_REG_AGG_INT_EVENT_14 0xc2070
#define CSDM_REG_AGG_INT_EVENT_15 0xc2074
#define CSDM_REG_AGG_INT_EVENT_16 0xc2078
#define CSDM_REG_AGG_INT_EVENT_2 0xc2040
#define CSDM_REG_AGG_INT_EVENT_3 0xc2044
#define CSDM_REG_AGG_INT_EVENT_4 0xc2048
#define CSDM_REG_AGG_INT_EVENT_5 0xc204c
#define CSDM_REG_AGG_INT_EVENT_6 0xc2050
#define CSDM_REG_AGG_INT_EVENT_7 0xc2054
#define CSDM_REG_AGG_INT_EVENT_8 0xc2058
#define CSDM_REG_AGG_INT_EVENT_9 0xc205c
/* [RW 1] For each aggregated interrupt index whether the mode is normal (0)
or auto-mask-mode (1) */
#define CSDM_REG_AGG_INT_MODE_10 0xc21e0
#define CSDM_REG_AGG_INT_MODE_11 0xc21e4
#define CSDM_REG_AGG_INT_MODE_12 0xc21e8
#define CSDM_REG_AGG_INT_MODE_13 0xc21ec
#define CSDM_REG_AGG_INT_MODE_14 0xc21f0
#define CSDM_REG_AGG_INT_MODE_15 0xc21f4
#define CSDM_REG_AGG_INT_MODE_16 0xc21f8
#define CSDM_REG_AGG_INT_MODE_6 0xc21d0
#define CSDM_REG_AGG_INT_MODE_7 0xc21d4
#define CSDM_REG_AGG_INT_MODE_8 0xc21d8
#define CSDM_REG_AGG_INT_MODE_9 0xc21dc
/* [RW 13] The start address in the internal RAM for the cfc_rsp lcid */
#define CSDM_REG_CFC_RSP_START_ADDR 0xc2008
/* [RW 16] The maximum value of the competion counter #0 */
#define CSDM_REG_CMP_COUNTER_MAX0 0xc201c
/* [RW 16] The maximum value of the competion counter #1 */
#define CSDM_REG_CMP_COUNTER_MAX1 0xc2020
/* [RW 16] The maximum value of the competion counter #2 */
#define CSDM_REG_CMP_COUNTER_MAX2 0xc2024
/* [RW 16] The maximum value of the competion counter #3 */
#define CSDM_REG_CMP_COUNTER_MAX3 0xc2028
/* [RW 13] The start address in the internal RAM for the completion
counters. */
#define CSDM_REG_CMP_COUNTER_START_ADDR 0xc200c
/* [RW 32] Interrupt mask register #0 read/write */
#define CSDM_REG_CSDM_INT_MASK_0 0xc229c
#define CSDM_REG_CSDM_INT_MASK_1 0xc22ac
/* [R 32] Interrupt register #0 read */
#define CSDM_REG_CSDM_INT_STS_0 0xc2290
#define CSDM_REG_CSDM_INT_STS_1 0xc22a0
/* [RW 11] Parity mask register #0 read/write */
#define CSDM_REG_CSDM_PRTY_MASK 0xc22bc
/* [R 11] Parity register #0 read */
#define CSDM_REG_CSDM_PRTY_STS 0xc22b0
#define CSDM_REG_ENABLE_IN1 0xc2238
#define CSDM_REG_ENABLE_IN2 0xc223c
#define CSDM_REG_ENABLE_OUT1 0xc2240
#define CSDM_REG_ENABLE_OUT2 0xc2244
/* [RW 4] The initial number of messages that can be sent to the pxp control
interface without receiving any ACK. */
#define CSDM_REG_INIT_CREDIT_PXP_CTRL 0xc24bc
/* [ST 32] The number of ACK after placement messages received */
#define CSDM_REG_NUM_OF_ACK_AFTER_PLACE 0xc227c
/* [ST 32] The number of packet end messages received from the parser */
#define CSDM_REG_NUM_OF_PKT_END_MSG 0xc2274
/* [ST 32] The number of requests received from the pxp async if */
#define CSDM_REG_NUM_OF_PXP_ASYNC_REQ 0xc2278
/* [ST 32] The number of commands received in queue 0 */
#define CSDM_REG_NUM_OF_Q0_CMD 0xc2248
/* [ST 32] The number of commands received in queue 10 */
#define CSDM_REG_NUM_OF_Q10_CMD 0xc226c
/* [ST 32] The number of commands received in queue 11 */
#define CSDM_REG_NUM_OF_Q11_CMD 0xc2270
/* [ST 32] The number of commands received in queue 1 */
#define CSDM_REG_NUM_OF_Q1_CMD 0xc224c
/* [ST 32] The number of commands received in queue 3 */
#define CSDM_REG_NUM_OF_Q3_CMD 0xc2250
/* [ST 32] The number of commands received in queue 4 */
#define CSDM_REG_NUM_OF_Q4_CMD 0xc2254
/* [ST 32] The number of commands received in queue 5 */
#define CSDM_REG_NUM_OF_Q5_CMD 0xc2258
/* [ST 32] The number of commands received in queue 6 */
#define CSDM_REG_NUM_OF_Q6_CMD 0xc225c
/* [ST 32] The number of commands received in queue 7 */
#define CSDM_REG_NUM_OF_Q7_CMD 0xc2260
/* [ST 32] The number of commands received in queue 8 */
#define CSDM_REG_NUM_OF_Q8_CMD 0xc2264
/* [ST 32] The number of commands received in queue 9 */
#define CSDM_REG_NUM_OF_Q9_CMD 0xc2268
/* [RW 13] The start address in the internal RAM for queue counters */
#define CSDM_REG_Q_COUNTER_START_ADDR 0xc2010
/* [R 1] pxp_ctrl rd_data fifo empty in sdm_dma_rsp block */
#define CSDM_REG_RSP_PXP_CTRL_RDATA_EMPTY 0xc2548
/* [R 1] parser fifo empty in sdm_sync block */
#define CSDM_REG_SYNC_PARSER_EMPTY 0xc2550
/* [R 1] parser serial fifo empty in sdm_sync block */
#define CSDM_REG_SYNC_SYNC_EMPTY 0xc2558
/* [RW 32] Tick for timer counter. Applicable only when
~csdm_registers_timer_tick_enable.timer_tick_enable =1 */
#define CSDM_REG_TIMER_TICK 0xc2000
/* [RW 5] The number of time_slots in the arbitration cycle */
#define CSEM_REG_ARB_CYCLE_SIZE 0x200034
/* [RW 3] The source that is associated with arbitration element 0. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2 */
#define CSEM_REG_ARB_ELEMENT0 0x200020
/* [RW 3] The source that is associated with arbitration element 1. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~csem_registers_arb_element0.arb_element0 */
#define CSEM_REG_ARB_ELEMENT1 0x200024
/* [RW 3] The source that is associated with arbitration element 2. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~csem_registers_arb_element0.arb_element0
and ~csem_registers_arb_element1.arb_element1 */
#define CSEM_REG_ARB_ELEMENT2 0x200028
/* [RW 3] The source that is associated with arbitration element 3. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.Could
not be equal to register ~csem_registers_arb_element0.arb_element0 and
~csem_registers_arb_element1.arb_element1 and
~csem_registers_arb_element2.arb_element2 */
#define CSEM_REG_ARB_ELEMENT3 0x20002c
/* [RW 3] The source that is associated with arbitration element 4. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~csem_registers_arb_element0.arb_element0
and ~csem_registers_arb_element1.arb_element1 and
~csem_registers_arb_element2.arb_element2 and
~csem_registers_arb_element3.arb_element3 */
#define CSEM_REG_ARB_ELEMENT4 0x200030
/* [RW 32] Interrupt mask register #0 read/write */
#define CSEM_REG_CSEM_INT_MASK_0 0x200110
#define CSEM_REG_CSEM_INT_MASK_1 0x200120
/* [R 32] Interrupt register #0 read */
#define CSEM_REG_CSEM_INT_STS_0 0x200104
#define CSEM_REG_CSEM_INT_STS_1 0x200114
/* [RW 32] Parity mask register #0 read/write */
#define CSEM_REG_CSEM_PRTY_MASK_0 0x200130
#define CSEM_REG_CSEM_PRTY_MASK_1 0x200140
/* [R 32] Parity register #0 read */
#define CSEM_REG_CSEM_PRTY_STS_0 0x200124
#define CSEM_REG_CSEM_PRTY_STS_1 0x200134
#define CSEM_REG_ENABLE_IN 0x2000a4
#define CSEM_REG_ENABLE_OUT 0x2000a8
/* [RW 32] This address space contains all registers and memories that are
placed in SEM_FAST block. The SEM_FAST registers are described in
appendix B. In order to access the sem_fast registers the base address
~fast_memory.fast_memory should be added to eachsem_fast register offset. */
#define CSEM_REG_FAST_MEMORY 0x220000
/* [RW 1] Disables input messages from FIC0 May be updated during run_time
by the microcode */
#define CSEM_REG_FIC0_DISABLE 0x200224
/* [RW 1] Disables input messages from FIC1 May be updated during run_time
by the microcode */
#define CSEM_REG_FIC1_DISABLE 0x200234
/* [RW 15] Interrupt table Read and write access to it is not possible in
the middle of the work */
#define CSEM_REG_INT_TABLE 0x200400
/* [ST 24] Statistics register. The number of messages that entered through
FIC0 */
#define CSEM_REG_MSG_NUM_FIC0 0x200000
/* [ST 24] Statistics register. The number of messages that entered through
FIC1 */
#define CSEM_REG_MSG_NUM_FIC1 0x200004
/* [ST 24] Statistics register. The number of messages that were sent to
FOC0 */
#define CSEM_REG_MSG_NUM_FOC0 0x200008
/* [ST 24] Statistics register. The number of messages that were sent to
FOC1 */
#define CSEM_REG_MSG_NUM_FOC1 0x20000c
/* [ST 24] Statistics register. The number of messages that were sent to
FOC2 */
#define CSEM_REG_MSG_NUM_FOC2 0x200010
/* [ST 24] Statistics register. The number of messages that were sent to
FOC3 */
#define CSEM_REG_MSG_NUM_FOC3 0x200014
/* [RW 1] Disables input messages from the passive buffer May be updated
during run_time by the microcode */
#define CSEM_REG_PAS_DISABLE 0x20024c
/* [WB 128] Debug only. Passive buffer memory */
#define CSEM_REG_PASSIVE_BUFFER 0x202000
/* [WB 46] pram memory. B45 is parity; b[44:0] - data. */
#define CSEM_REG_PRAM 0x240000
/* [R 16] Valid sleeping threads indication have bit per thread */
#define CSEM_REG_SLEEP_THREADS_VALID 0x20026c
/* [R 1] EXT_STORE FIFO is empty in sem_slow_ls_ext */
#define CSEM_REG_SLOW_EXT_STORE_EMPTY 0x2002a0
/* [RW 16] List of free threads . There is a bit per thread. */
#define CSEM_REG_THREADS_LIST 0x2002e4
/* [RW 3] The arbitration scheme of time_slot 0 */
#define CSEM_REG_TS_0_AS 0x200038
/* [RW 3] The arbitration scheme of time_slot 10 */
#define CSEM_REG_TS_10_AS 0x200060
/* [RW 3] The arbitration scheme of time_slot 11 */
#define CSEM_REG_TS_11_AS 0x200064
/* [RW 3] The arbitration scheme of time_slot 12 */
#define CSEM_REG_TS_12_AS 0x200068
/* [RW 3] The arbitration scheme of time_slot 13 */
#define CSEM_REG_TS_13_AS 0x20006c
/* [RW 3] The arbitration scheme of time_slot 14 */
#define CSEM_REG_TS_14_AS 0x200070
/* [RW 3] The arbitration scheme of time_slot 15 */
#define CSEM_REG_TS_15_AS 0x200074
/* [RW 3] The arbitration scheme of time_slot 16 */
#define CSEM_REG_TS_16_AS 0x200078
/* [RW 3] The arbitration scheme of time_slot 17 */
#define CSEM_REG_TS_17_AS 0x20007c
/* [RW 3] The arbitration scheme of time_slot 18 */
#define CSEM_REG_TS_18_AS 0x200080
/* [RW 3] The arbitration scheme of time_slot 1 */
#define CSEM_REG_TS_1_AS 0x20003c
/* [RW 3] The arbitration scheme of time_slot 2 */
#define CSEM_REG_TS_2_AS 0x200040
/* [RW 3] The arbitration scheme of time_slot 3 */
#define CSEM_REG_TS_3_AS 0x200044
/* [RW 3] The arbitration scheme of time_slot 4 */
#define CSEM_REG_TS_4_AS 0x200048
/* [RW 3] The arbitration scheme of time_slot 5 */
#define CSEM_REG_TS_5_AS 0x20004c
/* [RW 3] The arbitration scheme of time_slot 6 */
#define CSEM_REG_TS_6_AS 0x200050
/* [RW 3] The arbitration scheme of time_slot 7 */
#define CSEM_REG_TS_7_AS 0x200054
/* [RW 3] The arbitration scheme of time_slot 8 */
#define CSEM_REG_TS_8_AS 0x200058
/* [RW 3] The arbitration scheme of time_slot 9 */
#define CSEM_REG_TS_9_AS 0x20005c
/* [RW 1] Parity mask register #0 read/write */
#define DBG_REG_DBG_PRTY_MASK 0xc0a8
/* [R 1] Parity register #0 read */
#define DBG_REG_DBG_PRTY_STS 0xc09c
/* [RW 32] Commands memory. The address to command X; row Y is to calculated
as 14*X+Y. */
#define DMAE_REG_CMD_MEM 0x102400
#define DMAE_REG_CMD_MEM_SIZE 224
/* [RW 1] If 0 - the CRC-16c initial value is all zeroes; if 1 - the CRC-16c
initial value is all ones. */
#define DMAE_REG_CRC16C_INIT 0x10201c
/* [RW 1] If 0 - the CRC-16 T10 initial value is all zeroes; if 1 - the
CRC-16 T10 initial value is all ones. */
#define DMAE_REG_CRC16T10_INIT 0x102020
/* [RW 2] Interrupt mask register #0 read/write */
#define DMAE_REG_DMAE_INT_MASK 0x102054
/* [RW 4] Parity mask register #0 read/write */
#define DMAE_REG_DMAE_PRTY_MASK 0x102064
/* [R 4] Parity register #0 read */
#define DMAE_REG_DMAE_PRTY_STS 0x102058
/* [RW 1] Command 0 go. */
#define DMAE_REG_GO_C0 0x102080
/* [RW 1] Command 1 go. */
#define DMAE_REG_GO_C1 0x102084
/* [RW 1] Command 10 go. */
#define DMAE_REG_GO_C10 0x102088
/* [RW 1] Command 11 go. */
#define DMAE_REG_GO_C11 0x10208c
/* [RW 1] Command 12 go. */
#define DMAE_REG_GO_C12 0x102090
/* [RW 1] Command 13 go. */
#define DMAE_REG_GO_C13 0x102094
/* [RW 1] Command 14 go. */
#define DMAE_REG_GO_C14 0x102098
/* [RW 1] Command 15 go. */
#define DMAE_REG_GO_C15 0x10209c
/* [RW 1] Command 2 go. */
#define DMAE_REG_GO_C2 0x1020a0
/* [RW 1] Command 3 go. */
#define DMAE_REG_GO_C3 0x1020a4
/* [RW 1] Command 4 go. */
#define DMAE_REG_GO_C4 0x1020a8
/* [RW 1] Command 5 go. */
#define DMAE_REG_GO_C5 0x1020ac
/* [RW 1] Command 6 go. */
#define DMAE_REG_GO_C6 0x1020b0
/* [RW 1] Command 7 go. */
#define DMAE_REG_GO_C7 0x1020b4
/* [RW 1] Command 8 go. */
#define DMAE_REG_GO_C8 0x1020b8
/* [RW 1] Command 9 go. */
#define DMAE_REG_GO_C9 0x1020bc
/* [RW 1] DMAE GRC Interface (Target; aster) enable. If 0 - the acknowledge
input is disregarded; valid is deasserted; all other signals are treated
as usual; if 1 - normal activity. */
#define DMAE_REG_GRC_IFEN 0x102008
/* [RW 1] DMAE PCI Interface (Request; ead; rite) enable. If 0 - the
acknowledge input is disregarded; valid is deasserted; full is asserted;
all other signals are treated as usual; if 1 - normal activity. */
#define DMAE_REG_PCI_IFEN 0x102004
/* [RW 4] DMAE- PCI Request Interface initial credit. Write writes the
initial value to the credit counter; related to the address. Read returns
the current value of the counter. */
#define DMAE_REG_PXP_REQ_INIT_CRD 0x1020c0
/* [RW 8] Aggregation command. */
#define DORQ_REG_AGG_CMD0 0x170060
/* [RW 8] Aggregation command. */
#define DORQ_REG_AGG_CMD1 0x170064
/* [RW 8] Aggregation command. */
#define DORQ_REG_AGG_CMD2 0x170068
/* [RW 8] Aggregation command. */
#define DORQ_REG_AGG_CMD3 0x17006c
/* [RW 28] UCM Header. */
#define DORQ_REG_CMHEAD_RX 0x170050
/* [RW 32] Doorbell address for RBC doorbells (function 0). */
#define DORQ_REG_DB_ADDR0 0x17008c
/* [RW 5] Interrupt mask register #0 read/write */
#define DORQ_REG_DORQ_INT_MASK 0x170180
/* [R 5] Interrupt register #0 read */
#define DORQ_REG_DORQ_INT_STS 0x170174
/* [RC 5] Interrupt register #0 read clear */
#define DORQ_REG_DORQ_INT_STS_CLR 0x170178
/* [RW 2] Parity mask register #0 read/write */
#define DORQ_REG_DORQ_PRTY_MASK 0x170190
/* [R 2] Parity register #0 read */
#define DORQ_REG_DORQ_PRTY_STS 0x170184
/* [RW 8] The address to write the DPM CID to STORM. */
#define DORQ_REG_DPM_CID_ADDR 0x170044
/* [RW 5] The DPM mode CID extraction offset. */
#define DORQ_REG_DPM_CID_OFST 0x170030
/* [RW 12] The threshold of the DQ FIFO to send the almost full interrupt. */
#define DORQ_REG_DQ_FIFO_AFULL_TH 0x17007c
/* [RW 12] The threshold of the DQ FIFO to send the full interrupt. */
#define DORQ_REG_DQ_FIFO_FULL_TH 0x170078
/* [R 13] Current value of the DQ FIFO fill level according to following
pointer. The range is 0 - 256 FIFO rows; where each row stands for the
doorbell. */
#define DORQ_REG_DQ_FILL_LVLF 0x1700a4
/* [R 1] DQ FIFO full status. Is set; when FIFO filling level is more or
equal to full threshold; reset on full clear. */
#define DORQ_REG_DQ_FULL_ST 0x1700c0
/* [RW 28] The value sent to CM header in the case of CFC load error. */
#define DORQ_REG_ERR_CMHEAD 0x170058
#define DORQ_REG_IF_EN 0x170004
#define DORQ_REG_MODE_ACT 0x170008
/* [RW 5] The normal mode CID extraction offset. */
#define DORQ_REG_NORM_CID_OFST 0x17002c
/* [RW 28] TCM Header when only TCP context is loaded. */
#define DORQ_REG_NORM_CMHEAD_TX 0x17004c
/* [RW 3] The number of simultaneous outstanding requests to Context Fetch
Interface. */
#define DORQ_REG_OUTST_REQ 0x17003c
#define DORQ_REG_REGN 0x170038
/* [R 4] Current value of response A counter credit. Initial credit is
configured through write to ~dorq_registers_rsp_init_crd.rsp_init_crd
register. */
#define DORQ_REG_RSPA_CRD_CNT 0x1700ac
/* [R 4] Current value of response B counter credit. Initial credit is
configured through write to ~dorq_registers_rsp_init_crd.rsp_init_crd
register. */
#define DORQ_REG_RSPB_CRD_CNT 0x1700b0
/* [RW 4] The initial credit at the Doorbell Response Interface. The write
writes the same initial credit to the rspa_crd_cnt and rspb_crd_cnt. The
read reads this written value. */
#define DORQ_REG_RSP_INIT_CRD 0x170048
/* [RW 4] Initial activity counter value on the load request; when the
shortcut is done. */
#define DORQ_REG_SHRT_ACT_CNT 0x170070
/* [RW 28] TCM Header when both ULP and TCP context is loaded. */
#define DORQ_REG_SHRT_CMHEAD 0x170054
#define HC_CONFIG_0_REG_ATTN_BIT_EN_0 (0x1<<4)
#define HC_CONFIG_0_REG_INT_LINE_EN_0 (0x1<<3)
#define HC_CONFIG_0_REG_MSI_ATTN_EN_0 (0x1<<7)
#define HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 (0x1<<2)
#define HC_CONFIG_0_REG_SINGLE_ISR_EN_0 (0x1<<1)
#define HC_REG_AGG_INT_0 0x108050
#define HC_REG_AGG_INT_1 0x108054
#define HC_REG_ATTN_BIT 0x108120
#define HC_REG_ATTN_IDX 0x108100
#define HC_REG_ATTN_MSG0_ADDR_L 0x108018
#define HC_REG_ATTN_MSG1_ADDR_L 0x108020
#define HC_REG_ATTN_NUM_P0 0x108038
#define HC_REG_ATTN_NUM_P1 0x10803c
#define HC_REG_COMMAND_REG 0x108180
#define HC_REG_CONFIG_0 0x108000
#define HC_REG_CONFIG_1 0x108004
#define HC_REG_FUNC_NUM_P0 0x1080ac
#define HC_REG_FUNC_NUM_P1 0x1080b0
/* [RW 3] Parity mask register #0 read/write */
#define HC_REG_HC_PRTY_MASK 0x1080a0
/* [R 3] Parity register #0 read */
#define HC_REG_HC_PRTY_STS 0x108094
#define HC_REG_INT_MASK 0x108108
#define HC_REG_LEADING_EDGE_0 0x108040
#define HC_REG_LEADING_EDGE_1 0x108048
#define HC_REG_P0_PROD_CONS 0x108200
#define HC_REG_P1_PROD_CONS 0x108400
#define HC_REG_PBA_COMMAND 0x108140
#define HC_REG_PCI_CONFIG_0 0x108010
#define HC_REG_PCI_CONFIG_1 0x108014
#define HC_REG_STATISTIC_COUNTERS 0x109000
#define HC_REG_TRAILING_EDGE_0 0x108044
#define HC_REG_TRAILING_EDGE_1 0x10804c
#define HC_REG_UC_RAM_ADDR_0 0x108028
#define HC_REG_UC_RAM_ADDR_1 0x108030
#define HC_REG_USTORM_ADDR_FOR_COALESCE 0x108068
#define HC_REG_VQID_0 0x108008
#define HC_REG_VQID_1 0x10800c
#define MCP_REG_MCPR_NVM_ACCESS_ENABLE 0x86424
#define MCP_REG_MCPR_NVM_ADDR 0x8640c
#define MCP_REG_MCPR_NVM_CFG4 0x8642c
#define MCP_REG_MCPR_NVM_COMMAND 0x86400
#define MCP_REG_MCPR_NVM_READ 0x86410
#define MCP_REG_MCPR_NVM_SW_ARB 0x86420
#define MCP_REG_MCPR_NVM_WRITE 0x86408
#define MCP_REG_MCPR_SCRATCH 0xa0000
/* [R 32] read first 32 bit after inversion of function 0. mapped as
follows: [0] NIG attention for function0; [1] NIG attention for
function1; [2] GPIO1 mcp; [3] GPIO2 mcp; [4] GPIO3 mcp; [5] GPIO4 mcp;
[6] GPIO1 function 1; [7] GPIO2 function 1; [8] GPIO3 function 1; [9]
GPIO4 function 1; [10] PCIE glue/PXP VPD event function0; [11] PCIE
glue/PXP VPD event function1; [12] PCIE glue/PXP Expansion ROM event0;
[13] PCIE glue/PXP Expansion ROM event1; [14] SPIO4; [15] SPIO5; [16]
MSI/X indication for mcp; [17] MSI/X indication for function 1; [18] BRB
Parity error; [19] BRB Hw interrupt; [20] PRS Parity error; [21] PRS Hw
interrupt; [22] SRC Parity error; [23] SRC Hw interrupt; [24] TSDM Parity
error; [25] TSDM Hw interrupt; [26] TCM Parity error; [27] TCM Hw
interrupt; [28] TSEMI Parity error; [29] TSEMI Hw interrupt; [30] PBF
Parity error; [31] PBF Hw interrupt; */
#define MISC_REG_AEU_AFTER_INVERT_1_FUNC_0 0xa42c
#define MISC_REG_AEU_AFTER_INVERT_1_FUNC_1 0xa430
/* [R 32] read first 32 bit after inversion of mcp. mapped as follows: [0]
NIG attention for function0; [1] NIG attention for function1; [2] GPIO1
mcp; [3] GPIO2 mcp; [4] GPIO3 mcp; [5] GPIO4 mcp; [6] GPIO1 function 1;
[7] GPIO2 function 1; [8] GPIO3 function 1; [9] GPIO4 function 1; [10]
PCIE glue/PXP VPD event function0; [11] PCIE glue/PXP VPD event
function1; [12] PCIE glue/PXP Expansion ROM event0; [13] PCIE glue/PXP
Expansion ROM event1; [14] SPIO4; [15] SPIO5; [16] MSI/X indication for
mcp; [17] MSI/X indication for function 1; [18] BRB Parity error; [19]
BRB Hw interrupt; [20] PRS Parity error; [21] PRS Hw interrupt; [22] SRC
Parity error; [23] SRC Hw interrupt; [24] TSDM Parity error; [25] TSDM Hw
interrupt; [26] TCM Parity error; [27] TCM Hw interrupt; [28] TSEMI
Parity error; [29] TSEMI Hw interrupt; [30] PBF Parity error; [31] PBF Hw
interrupt; */
#define MISC_REG_AEU_AFTER_INVERT_1_MCP 0xa434
/* [R 32] read second 32 bit after inversion of function 0. mapped as
follows: [0] PBClient Parity error; [1] PBClient Hw interrupt; [2] QM
Parity error; [3] QM Hw interrupt; [4] Timers Parity error; [5] Timers Hw
interrupt; [6] XSDM Parity error; [7] XSDM Hw interrupt; [8] XCM Parity
error; [9] XCM Hw interrupt; [10] XSEMI Parity error; [11] XSEMI Hw
interrupt; [12] DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14]
NIG Parity error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error;
[17] Vaux PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw
interrupt; [20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM
Parity error; [23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI
Hw interrupt; [26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM
Parity error; [29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw
interrupt; */
#define MISC_REG_AEU_AFTER_INVERT_2_FUNC_0 0xa438
#define MISC_REG_AEU_AFTER_INVERT_2_FUNC_1 0xa43c
/* [R 32] read second 32 bit after inversion of mcp. mapped as follows: [0]
PBClient Parity error; [1] PBClient Hw interrupt; [2] QM Parity error;
[3] QM Hw interrupt; [4] Timers Parity error; [5] Timers Hw interrupt;
[6] XSDM Parity error; [7] XSDM Hw interrupt; [8] XCM Parity error; [9]
XCM Hw interrupt; [10] XSEMI Parity error; [11] XSEMI Hw interrupt; [12]
DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14] NIG Parity
error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error; [17] Vaux
PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw interrupt;
[20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM Parity error;
[23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI Hw interrupt;
[26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM Parity error;
[29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw interrupt; */
#define MISC_REG_AEU_AFTER_INVERT_2_MCP 0xa440
/* [R 32] read third 32 bit after inversion of function 0. mapped as
follows: [0] CSEMI Parity error; [1] CSEMI Hw interrupt; [2] PXP Parity
error; [3] PXP Hw interrupt; [4] PXPpciClockClient Parity error; [5]
PXPpciClockClient Hw interrupt; [6] CFC Parity error; [7] CFC Hw
interrupt; [8] CDU Parity error; [9] CDU Hw interrupt; [10] DMAE Parity
error; [11] DMAE Hw interrupt; [12] IGU (HC) Parity error; [13] IGU (HC)
Hw interrupt; [14] MISC Parity error; [15] MISC Hw interrupt; [16]
pxp_misc_mps_attn; [17] Flash event; [18] SMB event; [19] MCP attn0; [20]
MCP attn1; [21] SW timers attn_1 func0; [22] SW timers attn_2 func0; [23]
SW timers attn_3 func0; [24] SW timers attn_4 func0; [25] PERST; [26] SW
timers attn_1 func1; [27] SW timers attn_2 func1; [28] SW timers attn_3
func1; [29] SW timers attn_4 func1; [30] General attn0; [31] General
attn1; */
#define MISC_REG_AEU_AFTER_INVERT_3_FUNC_0 0xa444
#define MISC_REG_AEU_AFTER_INVERT_3_FUNC_1 0xa448
/* [R 32] read third 32 bit after inversion of mcp. mapped as follows: [0]
CSEMI Parity error; [1] CSEMI Hw interrupt; [2] PXP Parity error; [3] PXP
Hw interrupt; [4] PXPpciClockClient Parity error; [5] PXPpciClockClient
Hw interrupt; [6] CFC Parity error; [7] CFC Hw interrupt; [8] CDU Parity
error; [9] CDU Hw interrupt; [10] DMAE Parity error; [11] DMAE Hw
interrupt; [12] IGU (HC) Parity error; [13] IGU (HC) Hw interrupt; [14]
MISC Parity error; [15] MISC Hw interrupt; [16] pxp_misc_mps_attn; [17]
Flash event; [18] SMB event; [19] MCP attn0; [20] MCP attn1; [21] SW
timers attn_1 func0; [22] SW timers attn_2 func0; [23] SW timers attn_3
func0; [24] SW timers attn_4 func0; [25] PERST; [26] SW timers attn_1
func1; [27] SW timers attn_2 func1; [28] SW timers attn_3 func1; [29] SW
timers attn_4 func1; [30] General attn0; [31] General attn1; */
#define MISC_REG_AEU_AFTER_INVERT_3_MCP 0xa44c
/* [R 32] read fourth 32 bit after inversion of function 0. mapped as
follows: [0] General attn2; [1] General attn3; [2] General attn4; [3]
General attn5; [4] General attn6; [5] General attn7; [6] General attn8;
[7] General attn9; [8] General attn10; [9] General attn11; [10] General
attn12; [11] General attn13; [12] General attn14; [13] General attn15;
[14] General attn16; [15] General attn17; [16] General attn18; [17]
General attn19; [18] General attn20; [19] General attn21; [20] Main power
interrupt; [21] RBCR Latched attn; [22] RBCT Latched attn; [23] RBCN
Latched attn; [24] RBCU Latched attn; [25] RBCP Latched attn; [26] GRC
Latched timeout attention; [27] GRC Latched reserved access attention;
[28] MCP Latched rom_parity; [29] MCP Latched ump_rx_parity; [30] MCP
Latched ump_tx_parity; [31] MCP Latched scpad_parity; */
#define MISC_REG_AEU_AFTER_INVERT_4_FUNC_0 0xa450
#define MISC_REG_AEU_AFTER_INVERT_4_FUNC_1 0xa454
/* [R 32] read fourth 32 bit after inversion of mcp. mapped as follows: [0]
General attn2; [1] General attn3; [2] General attn4; [3] General attn5;
[4] General attn6; [5] General attn7; [6] General attn8; [7] General
attn9; [8] General attn10; [9] General attn11; [10] General attn12; [11]
General attn13; [12] General attn14; [13] General attn15; [14] General
attn16; [15] General attn17; [16] General attn18; [17] General attn19;
[18] General attn20; [19] General attn21; [20] Main power interrupt; [21]
RBCR Latched attn; [22] RBCT Latched attn; [23] RBCN Latched attn; [24]
RBCU Latched attn; [25] RBCP Latched attn; [26] GRC Latched timeout
attention; [27] GRC Latched reserved access attention; [28] MCP Latched
rom_parity; [29] MCP Latched ump_rx_parity; [30] MCP Latched
ump_tx_parity; [31] MCP Latched scpad_parity; */
#define MISC_REG_AEU_AFTER_INVERT_4_MCP 0xa458
/* [W 14] write to this register results with the clear of the latched
signals; one in d0 clears RBCR latch; one in d1 clears RBCT latch; one in
d2 clears RBCN latch; one in d3 clears RBCU latch; one in d4 clears RBCP
latch; one in d5 clears GRC Latched timeout attention; one in d6 clears
GRC Latched reserved access attention; one in d7 clears Latched
rom_parity; one in d8 clears Latched ump_rx_parity; one in d9 clears
Latched ump_tx_parity; one in d10 clears Latched scpad_parity (both
ports); one in d11 clears pxpv_misc_mps_attn; one in d12 clears
pxp_misc_exp_rom_attn0; one in d13 clears pxp_misc_exp_rom_attn1; read
from this register return zero */
#define MISC_REG_AEU_CLR_LATCH_SIGNAL 0xa45c
/* [RW 32] first 32b for enabling the output for function 0 output0. mapped
as follows: [0] NIG attention for function0; [1] NIG attention for
function1; [2] GPIO1 function 0; [3] GPIO2 function 0; [4] GPIO3 function
0; [5] GPIO4 function 0; [6] GPIO1 function 1; [7] GPIO2 function 1; [8]
GPIO3 function 1; [9] GPIO4 function 1; [10] PCIE glue/PXP VPD event
function0; [11] PCIE glue/PXP VPD event function1; [12] PCIE glue/PXP
Expansion ROM event0; [13] PCIE glue/PXP Expansion ROM event1; [14]
SPIO4; [15] SPIO5; [16] MSI/X indication for function 0; [17] MSI/X
indication for function 1; [18] BRB Parity error; [19] BRB Hw interrupt;
[20] PRS Parity error; [21] PRS Hw interrupt; [22] SRC Parity error; [23]
SRC Hw interrupt; [24] TSDM Parity error; [25] TSDM Hw interrupt; [26]
TCM Parity error; [27] TCM Hw interrupt; [28] TSEMI Parity error; [29]
TSEMI Hw interrupt; [30] PBF Parity error; [31] PBF Hw interrupt; */
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0 0xa06c
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_1 0xa07c
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_2 0xa08c
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_3 0xa09c
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_5 0xa0bc
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_6 0xa0cc
#define MISC_REG_AEU_ENABLE1_FUNC_0_OUT_7 0xa0dc
/* [RW 32] first 32b for enabling the output for function 1 output0. mapped
as follows: [0] NIG attention for function0; [1] NIG attention for
function1; [2] GPIO1 function 1; [3] GPIO2 function 1; [4] GPIO3 function
1; [5] GPIO4 function 1; [6] GPIO1 function 1; [7] GPIO2 function 1; [8]
GPIO3 function 1; [9] GPIO4 function 1; [10] PCIE glue/PXP VPD event
function0; [11] PCIE glue/PXP VPD event function1; [12] PCIE glue/PXP
Expansion ROM event0; [13] PCIE glue/PXP Expansion ROM event1; [14]
SPIO4; [15] SPIO5; [16] MSI/X indication for function 1; [17] MSI/X
indication for function 1; [18] BRB Parity error; [19] BRB Hw interrupt;
[20] PRS Parity error; [21] PRS Hw interrupt; [22] SRC Parity error; [23]
SRC Hw interrupt; [24] TSDM Parity error; [25] TSDM Hw interrupt; [26]
TCM Parity error; [27] TCM Hw interrupt; [28] TSEMI Parity error; [29]
TSEMI Hw interrupt; [30] PBF Parity error; [31] PBF Hw interrupt; */
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 0xa10c
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_1 0xa11c
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_2 0xa12c
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_3 0xa13c
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_5 0xa15c
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_6 0xa16c
#define MISC_REG_AEU_ENABLE1_FUNC_1_OUT_7 0xa17c
/* [RW 32] first 32b for enabling the output for close the gate nig. mapped
as follows: [0] NIG attention for function0; [1] NIG attention for
function1; [2] GPIO1 function 0; [3] GPIO2 function 0; [4] GPIO3 function
0; [5] GPIO4 function 0; [6] GPIO1 function 1; [7] GPIO2 function 1; [8]
GPIO3 function 1; [9] GPIO4 function 1; [10] PCIE glue/PXP VPD event
function0; [11] PCIE glue/PXP VPD event function1; [12] PCIE glue/PXP
Expansion ROM event0; [13] PCIE glue/PXP Expansion ROM event1; [14]
SPIO4; [15] SPIO5; [16] MSI/X indication for function 0; [17] MSI/X
indication for function 1; [18] BRB Parity error; [19] BRB Hw interrupt;
[20] PRS Parity error; [21] PRS Hw interrupt; [22] SRC Parity error; [23]
SRC Hw interrupt; [24] TSDM Parity error; [25] TSDM Hw interrupt; [26]
TCM Parity error; [27] TCM Hw interrupt; [28] TSEMI Parity error; [29]
TSEMI Hw interrupt; [30] PBF Parity error; [31] PBF Hw interrupt; */
#define MISC_REG_AEU_ENABLE1_NIG_0 0xa0ec
#define MISC_REG_AEU_ENABLE1_NIG_1 0xa18c
/* [RW 32] first 32b for enabling the output for close the gate pxp. mapped
as follows: [0] NIG attention for function0; [1] NIG attention for
function1; [2] GPIO1 function 0; [3] GPIO2 function 0; [4] GPIO3 function
0; [5] GPIO4 function 0; [6] GPIO1 function 1; [7] GPIO2 function 1; [8]
GPIO3 function 1; [9] GPIO4 function 1; [10] PCIE glue/PXP VPD event
function0; [11] PCIE glue/PXP VPD event function1; [12] PCIE glue/PXP
Expansion ROM event0; [13] PCIE glue/PXP Expansion ROM event1; [14]
SPIO4; [15] SPIO5; [16] MSI/X indication for function 0; [17] MSI/X
indication for function 1; [18] BRB Parity error; [19] BRB Hw interrupt;
[20] PRS Parity error; [21] PRS Hw interrupt; [22] SRC Parity error; [23]
SRC Hw interrupt; [24] TSDM Parity error; [25] TSDM Hw interrupt; [26]
TCM Parity error; [27] TCM Hw interrupt; [28] TSEMI Parity error; [29]
TSEMI Hw interrupt; [30] PBF Parity error; [31] PBF Hw interrupt; */
#define MISC_REG_AEU_ENABLE1_PXP_0 0xa0fc
#define MISC_REG_AEU_ENABLE1_PXP_1 0xa19c
/* [RW 32] second 32b for enabling the output for function 0 output0. mapped
as follows: [0] PBClient Parity error; [1] PBClient Hw interrupt; [2] QM
Parity error; [3] QM Hw interrupt; [4] Timers Parity error; [5] Timers Hw
interrupt; [6] XSDM Parity error; [7] XSDM Hw interrupt; [8] XCM Parity
error; [9] XCM Hw interrupt; [10] XSEMI Parity error; [11] XSEMI Hw
interrupt; [12] DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14]
NIG Parity error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error;
[17] Vaux PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw
interrupt; [20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM
Parity error; [23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI
Hw interrupt; [26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM
Parity error; [29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw
interrupt; */
#define MISC_REG_AEU_ENABLE2_FUNC_0_OUT_0 0xa070
#define MISC_REG_AEU_ENABLE2_FUNC_0_OUT_1 0xa080
/* [RW 32] second 32b for enabling the output for function 1 output0. mapped
as follows: [0] PBClient Parity error; [1] PBClient Hw interrupt; [2] QM
Parity error; [3] QM Hw interrupt; [4] Timers Parity error; [5] Timers Hw
interrupt; [6] XSDM Parity error; [7] XSDM Hw interrupt; [8] XCM Parity
error; [9] XCM Hw interrupt; [10] XSEMI Parity error; [11] XSEMI Hw
interrupt; [12] DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14]
NIG Parity error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error;
[17] Vaux PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw
interrupt; [20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM
Parity error; [23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI
Hw interrupt; [26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM
Parity error; [29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw
interrupt; */
#define MISC_REG_AEU_ENABLE2_FUNC_1_OUT_0 0xa110
#define MISC_REG_AEU_ENABLE2_FUNC_1_OUT_1 0xa120
/* [RW 32] second 32b for enabling the output for close the gate nig. mapped
as follows: [0] PBClient Parity error; [1] PBClient Hw interrupt; [2] QM
Parity error; [3] QM Hw interrupt; [4] Timers Parity error; [5] Timers Hw
interrupt; [6] XSDM Parity error; [7] XSDM Hw interrupt; [8] XCM Parity
error; [9] XCM Hw interrupt; [10] XSEMI Parity error; [11] XSEMI Hw
interrupt; [12] DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14]
NIG Parity error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error;
[17] Vaux PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw
interrupt; [20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM
Parity error; [23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI
Hw interrupt; [26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM
Parity error; [29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw
interrupt; */
#define MISC_REG_AEU_ENABLE2_NIG_0 0xa0f0
#define MISC_REG_AEU_ENABLE2_NIG_1 0xa190
/* [RW 32] second 32b for enabling the output for close the gate pxp. mapped
as follows: [0] PBClient Parity error; [1] PBClient Hw interrupt; [2] QM
Parity error; [3] QM Hw interrupt; [4] Timers Parity error; [5] Timers Hw
interrupt; [6] XSDM Parity error; [7] XSDM Hw interrupt; [8] XCM Parity
error; [9] XCM Hw interrupt; [10] XSEMI Parity error; [11] XSEMI Hw
interrupt; [12] DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14]
NIG Parity error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error;
[17] Vaux PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw
interrupt; [20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM
Parity error; [23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI
Hw interrupt; [26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM
Parity error; [29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw
interrupt; */
#define MISC_REG_AEU_ENABLE2_PXP_0 0xa100
#define MISC_REG_AEU_ENABLE2_PXP_1 0xa1a0
/* [RW 32] third 32b for enabling the output for function 0 output0. mapped
as follows: [0] CSEMI Parity error; [1] CSEMI Hw interrupt; [2] PXP
Parity error; [3] PXP Hw interrupt; [4] PXPpciClockClient Parity error;
[5] PXPpciClockClient Hw interrupt; [6] CFC Parity error; [7] CFC Hw
interrupt; [8] CDU Parity error; [9] CDU Hw interrupt; [10] DMAE Parity
error; [11] DMAE Hw interrupt; [12] IGU (HC) Parity error; [13] IGU (HC)
Hw interrupt; [14] MISC Parity error; [15] MISC Hw interrupt; [16]
pxp_misc_mps_attn; [17] Flash event; [18] SMB event; [19] MCP attn0; [20]
MCP attn1; [21] SW timers attn_1 func0; [22] SW timers attn_2 func0; [23]
SW timers attn_3 func0; [24] SW timers attn_4 func0; [25] PERST; [26] SW
timers attn_1 func1; [27] SW timers attn_2 func1; [28] SW timers attn_3
func1; [29] SW timers attn_4 func1; [30] General attn0; [31] General
attn1; */
#define MISC_REG_AEU_ENABLE3_FUNC_0_OUT_0 0xa074
#define MISC_REG_AEU_ENABLE3_FUNC_0_OUT_1 0xa084
/* [RW 32] third 32b for enabling the output for function 1 output0. mapped
as follows: [0] CSEMI Parity error; [1] CSEMI Hw interrupt; [2] PXP
Parity error; [3] PXP Hw interrupt; [4] PXPpciClockClient Parity error;
[5] PXPpciClockClient Hw interrupt; [6] CFC Parity error; [7] CFC Hw
interrupt; [8] CDU Parity error; [9] CDU Hw interrupt; [10] DMAE Parity
error; [11] DMAE Hw interrupt; [12] IGU (HC) Parity error; [13] IGU (HC)
Hw interrupt; [14] MISC Parity error; [15] MISC Hw interrupt; [16]
pxp_misc_mps_attn; [17] Flash event; [18] SMB event; [19] MCP attn0; [20]
MCP attn1; [21] SW timers attn_1 func0; [22] SW timers attn_2 func0; [23]
SW timers attn_3 func0; [24] SW timers attn_4 func0; [25] PERST; [26] SW
timers attn_1 func1; [27] SW timers attn_2 func1; [28] SW timers attn_3
func1; [29] SW timers attn_4 func1; [30] General attn0; [31] General
attn1; */
#define MISC_REG_AEU_ENABLE3_FUNC_1_OUT_0 0xa114
#define MISC_REG_AEU_ENABLE3_FUNC_1_OUT_1 0xa124
/* [RW 32] third 32b for enabling the output for close the gate nig. mapped
as follows: [0] CSEMI Parity error; [1] CSEMI Hw interrupt; [2] PXP
Parity error; [3] PXP Hw interrupt; [4] PXPpciClockClient Parity error;
[5] PXPpciClockClient Hw interrupt; [6] CFC Parity error; [7] CFC Hw
interrupt; [8] CDU Parity error; [9] CDU Hw interrupt; [10] DMAE Parity
error; [11] DMAE Hw interrupt; [12] IGU (HC) Parity error; [13] IGU (HC)
Hw interrupt; [14] MISC Parity error; [15] MISC Hw interrupt; [16]
pxp_misc_mps_attn; [17] Flash event; [18] SMB event; [19] MCP attn0; [20]
MCP attn1; [21] SW timers attn_1 func0; [22] SW timers attn_2 func0; [23]
SW timers attn_3 func0; [24] SW timers attn_4 func0; [25] PERST; [26] SW
timers attn_1 func1; [27] SW timers attn_2 func1; [28] SW timers attn_3
func1; [29] SW timers attn_4 func1; [30] General attn0; [31] General
attn1; */
#define MISC_REG_AEU_ENABLE3_NIG_0 0xa0f4
#define MISC_REG_AEU_ENABLE3_NIG_1 0xa194
/* [RW 32] third 32b for enabling the output for close the gate pxp. mapped
as follows: [0] CSEMI Parity error; [1] CSEMI Hw interrupt; [2] PXP
Parity error; [3] PXP Hw interrupt; [4] PXPpciClockClient Parity error;
[5] PXPpciClockClient Hw interrupt; [6] CFC Parity error; [7] CFC Hw
interrupt; [8] CDU Parity error; [9] CDU Hw interrupt; [10] DMAE Parity
error; [11] DMAE Hw interrupt; [12] IGU (HC) Parity error; [13] IGU (HC)
Hw interrupt; [14] MISC Parity error; [15] MISC Hw interrupt; [16]
pxp_misc_mps_attn; [17] Flash event; [18] SMB event; [19] MCP attn0; [20]
MCP attn1; [21] SW timers attn_1 func0; [22] SW timers attn_2 func0; [23]
SW timers attn_3 func0; [24] SW timers attn_4 func0; [25] PERST; [26] SW
timers attn_1 func1; [27] SW timers attn_2 func1; [28] SW timers attn_3
func1; [29] SW timers attn_4 func1; [30] General attn0; [31] General
attn1; */
#define MISC_REG_AEU_ENABLE3_PXP_0 0xa104
#define MISC_REG_AEU_ENABLE3_PXP_1 0xa1a4
/* [RW 32] fourth 32b for enabling the output for function 0 output0.mapped
as follows: [0] General attn2; [1] General attn3; [2] General attn4; [3]
General attn5; [4] General attn6; [5] General attn7; [6] General attn8;
[7] General attn9; [8] General attn10; [9] General attn11; [10] General
attn12; [11] General attn13; [12] General attn14; [13] General attn15;
[14] General attn16; [15] General attn17; [16] General attn18; [17]
General attn19; [18] General attn20; [19] General attn21; [20] Main power
interrupt; [21] RBCR Latched attn; [22] RBCT Latched attn; [23] RBCN
Latched attn; [24] RBCU Latched attn; [25] RBCP Latched attn; [26] GRC
Latched timeout attention; [27] GRC Latched reserved access attention;
[28] MCP Latched rom_parity; [29] MCP Latched ump_rx_parity; [30] MCP
Latched ump_tx_parity; [31] MCP Latched scpad_parity; */
#define MISC_REG_AEU_ENABLE4_FUNC_0_OUT_0 0xa078
#define MISC_REG_AEU_ENABLE4_FUNC_0_OUT_2 0xa098
#define MISC_REG_AEU_ENABLE4_FUNC_0_OUT_4 0xa0b8
#define MISC_REG_AEU_ENABLE4_FUNC_0_OUT_5 0xa0c8
#define MISC_REG_AEU_ENABLE4_FUNC_0_OUT_6 0xa0d8
#define MISC_REG_AEU_ENABLE4_FUNC_0_OUT_7 0xa0e8
/* [RW 32] fourth 32b for enabling the output for function 1 output0.mapped
as follows: [0] General attn2; [1] General attn3; [2] General attn4; [3]
General attn5; [4] General attn6; [5] General attn7; [6] General attn8;
[7] General attn9; [8] General attn10; [9] General attn11; [10] General
attn12; [11] General attn13; [12] General attn14; [13] General attn15;
[14] General attn16; [15] General attn17; [16] General attn18; [17]
General attn19; [18] General attn20; [19] General attn21; [20] Main power
interrupt; [21] RBCR Latched attn; [22] RBCT Latched attn; [23] RBCN
Latched attn; [24] RBCU Latched attn; [25] RBCP Latched attn; [26] GRC
Latched timeout attention; [27] GRC Latched reserved access attention;
[28] MCP Latched rom_parity; [29] MCP Latched ump_rx_parity; [30] MCP
Latched ump_tx_parity; [31] MCP Latched scpad_parity; */
#define MISC_REG_AEU_ENABLE4_FUNC_1_OUT_0 0xa118
#define MISC_REG_AEU_ENABLE4_FUNC_1_OUT_2 0xa138
#define MISC_REG_AEU_ENABLE4_FUNC_1_OUT_4 0xa158
#define MISC_REG_AEU_ENABLE4_FUNC_1_OUT_5 0xa168
#define MISC_REG_AEU_ENABLE4_FUNC_1_OUT_6 0xa178
#define MISC_REG_AEU_ENABLE4_FUNC_1_OUT_7 0xa188
/* [RW 32] fourth 32b for enabling the output for close the gate nig.mapped
as follows: [0] General attn2; [1] General attn3; [2] General attn4; [3]
General attn5; [4] General attn6; [5] General attn7; [6] General attn8;
[7] General attn9; [8] General attn10; [9] General attn11; [10] General
attn12; [11] General attn13; [12] General attn14; [13] General attn15;
[14] General attn16; [15] General attn17; [16] General attn18; [17]
General attn19; [18] General attn20; [19] General attn21; [20] Main power
interrupt; [21] RBCR Latched attn; [22] RBCT Latched attn; [23] RBCN
Latched attn; [24] RBCU Latched attn; [25] RBCP Latched attn; [26] GRC
Latched timeout attention; [27] GRC Latched reserved access attention;
[28] MCP Latched rom_parity; [29] MCP Latched ump_rx_parity; [30] MCP
Latched ump_tx_parity; [31] MCP Latched scpad_parity; */
#define MISC_REG_AEU_ENABLE4_NIG_0 0xa0f8
#define MISC_REG_AEU_ENABLE4_NIG_1 0xa198
/* [RW 32] fourth 32b for enabling the output for close the gate pxp.mapped
as follows: [0] General attn2; [1] General attn3; [2] General attn4; [3]
General attn5; [4] General attn6; [5] General attn7; [6] General attn8;
[7] General attn9; [8] General attn10; [9] General attn11; [10] General
attn12; [11] General attn13; [12] General attn14; [13] General attn15;
[14] General attn16; [15] General attn17; [16] General attn18; [17]
General attn19; [18] General attn20; [19] General attn21; [20] Main power
interrupt; [21] RBCR Latched attn; [22] RBCT Latched attn; [23] RBCN
Latched attn; [24] RBCU Latched attn; [25] RBCP Latched attn; [26] GRC
Latched timeout attention; [27] GRC Latched reserved access attention;
[28] MCP Latched rom_parity; [29] MCP Latched ump_rx_parity; [30] MCP
Latched ump_tx_parity; [31] MCP Latched scpad_parity; */
#define MISC_REG_AEU_ENABLE4_PXP_0 0xa108
#define MISC_REG_AEU_ENABLE4_PXP_1 0xa1a8
/* [RW 1] set/clr general attention 0; this will set/clr bit 94 in the aeu
128 bit vector */
#define MISC_REG_AEU_GENERAL_ATTN_0 0xa000
#define MISC_REG_AEU_GENERAL_ATTN_1 0xa004
#define MISC_REG_AEU_GENERAL_ATTN_10 0xa028
#define MISC_REG_AEU_GENERAL_ATTN_11 0xa02c
#define MISC_REG_AEU_GENERAL_ATTN_12 0xa030
#define MISC_REG_AEU_GENERAL_ATTN_2 0xa008
#define MISC_REG_AEU_GENERAL_ATTN_3 0xa00c
#define MISC_REG_AEU_GENERAL_ATTN_4 0xa010
#define MISC_REG_AEU_GENERAL_ATTN_5 0xa014
#define MISC_REG_AEU_GENERAL_ATTN_6 0xa018
#define MISC_REG_AEU_GENERAL_ATTN_7 0xa01c
#define MISC_REG_AEU_GENERAL_ATTN_8 0xa020
#define MISC_REG_AEU_GENERAL_ATTN_9 0xa024
#define MISC_REG_AEU_GENERAL_MASK 0xa61c
/* [RW 32] first 32b for inverting the input for function 0; for each bit:
0= do not invert; 1= invert; mapped as follows: [0] NIG attention for
function0; [1] NIG attention for function1; [2] GPIO1 mcp; [3] GPIO2 mcp;
[4] GPIO3 mcp; [5] GPIO4 mcp; [6] GPIO1 function 1; [7] GPIO2 function 1;
[8] GPIO3 function 1; [9] GPIO4 function 1; [10] PCIE glue/PXP VPD event
function0; [11] PCIE glue/PXP VPD event function1; [12] PCIE glue/PXP
Expansion ROM event0; [13] PCIE glue/PXP Expansion ROM event1; [14]
SPIO4; [15] SPIO5; [16] MSI/X indication for mcp; [17] MSI/X indication
for function 1; [18] BRB Parity error; [19] BRB Hw interrupt; [20] PRS
Parity error; [21] PRS Hw interrupt; [22] SRC Parity error; [23] SRC Hw
interrupt; [24] TSDM Parity error; [25] TSDM Hw interrupt; [26] TCM
Parity error; [27] TCM Hw interrupt; [28] TSEMI Parity error; [29] TSEMI
Hw interrupt; [30] PBF Parity error; [31] PBF Hw interrupt; */
#define MISC_REG_AEU_INVERTER_1_FUNC_0 0xa22c
#define MISC_REG_AEU_INVERTER_1_FUNC_1 0xa23c
/* [RW 32] second 32b for inverting the input for function 0; for each bit:
0= do not invert; 1= invert. mapped as follows: [0] PBClient Parity
error; [1] PBClient Hw interrupt; [2] QM Parity error; [3] QM Hw
interrupt; [4] Timers Parity error; [5] Timers Hw interrupt; [6] XSDM
Parity error; [7] XSDM Hw interrupt; [8] XCM Parity error; [9] XCM Hw
interrupt; [10] XSEMI Parity error; [11] XSEMI Hw interrupt; [12]
DoorbellQ Parity error; [13] DoorbellQ Hw interrupt; [14] NIG Parity
error; [15] NIG Hw interrupt; [16] Vaux PCI core Parity error; [17] Vaux
PCI core Hw interrupt; [18] Debug Parity error; [19] Debug Hw interrupt;
[20] USDM Parity error; [21] USDM Hw interrupt; [22] UCM Parity error;
[23] UCM Hw interrupt; [24] USEMI Parity error; [25] USEMI Hw interrupt;
[26] UPB Parity error; [27] UPB Hw interrupt; [28] CSDM Parity error;
[29] CSDM Hw interrupt; [30] CCM Parity error; [31] CCM Hw interrupt; */
#define MISC_REG_AEU_INVERTER_2_FUNC_0 0xa230
#define MISC_REG_AEU_INVERTER_2_FUNC_1 0xa240
/* [RW 10] [7:0] = mask 8 attention output signals toward IGU function0;
[9:8] = raserved. Zero = mask; one = unmask */
#define MISC_REG_AEU_MASK_ATTN_FUNC_0 0xa060
#define MISC_REG_AEU_MASK_ATTN_FUNC_1 0xa064
/* [RW 1] If set a system kill occurred */
#define MISC_REG_AEU_SYS_KILL_OCCURRED 0xa610
/* [RW 32] Represent the status of the input vector to the AEU when a system
kill occurred. The register is reset in por reset. Mapped as follows: [0]
NIG attention for function0; [1] NIG attention for function1; [2] GPIO1
mcp; [3] GPIO2 mcp; [4] GPIO3 mcp; [5] GPIO4 mcp; [6] GPIO1 function 1;
[7] GPIO2 function 1; [8] GPIO3 function 1; [9] GPIO4 function 1; [10]
PCIE glue/PXP VPD event function0; [11] PCIE glue/PXP VPD event
function1; [12] PCIE glue/PXP Expansion ROM event0; [13] PCIE glue/PXP
Expansion ROM event1; [14] SPIO4; [15] SPIO5; [16] MSI/X indication for
mcp; [17] MSI/X indication for function 1; [18] BRB Parity error; [19]
BRB Hw interrupt; [20] PRS Parity error; [21] PRS Hw interrupt; [22] SRC
Parity error; [23] SRC Hw interrupt; [24] TSDM Parity error; [25] TSDM Hw
interrupt; [26] TCM Parity error; [27] TCM Hw interrupt; [28] TSEMI
Parity error; [29] TSEMI Hw interrupt; [30] PBF Parity error; [31] PBF Hw
interrupt; */
#define MISC_REG_AEU_SYS_KILL_STATUS_0 0xa600
#define MISC_REG_AEU_SYS_KILL_STATUS_1 0xa604
#define MISC_REG_AEU_SYS_KILL_STATUS_2 0xa608
#define MISC_REG_AEU_SYS_KILL_STATUS_3 0xa60c
/* [R 4] This field indicates the type of the device. '0' - 2 Ports; '1' - 1
Port. */
#define MISC_REG_BOND_ID 0xa400
/* [R 8] These bits indicate the metal revision of the chip. This value
starts at 0x00 for each all-layer tape-out and increments by one for each
tape-out. */
#define MISC_REG_CHIP_METAL 0xa404
/* [R 16] These bits indicate the part number for the chip. */
#define MISC_REG_CHIP_NUM 0xa408
/* [R 4] These bits indicate the base revision of the chip. This value
starts at 0x0 for the A0 tape-out and increments by one for each
all-layer tape-out. */
#define MISC_REG_CHIP_REV 0xa40c
/* [RW 32] The following driver registers(1...16) represent 16 drivers and
32 clients. Each client can be controlled by one driver only. One in each
bit represent that this driver control the appropriate client (Ex: bit 5
is set means this driver control client number 5). addr1 = set; addr0 =
clear; read from both addresses will give the same result = status. write
to address 1 will set a request to control all the clients that their
appropriate bit (in the write command) is set. if the client is free (the
appropriate bit in all the other drivers is clear) one will be written to
that driver register; if the client isn't free the bit will remain zero.
if the appropriate bit is set (the driver request to gain control on a
client it already controls the ~MISC_REGISTERS_INT_STS.GENERIC_SW
interrupt will be asserted). write to address 0 will set a request to
free all the clients that their appropriate bit (in the write command) is
set. if the appropriate bit is clear (the driver request to free a client
it doesn't controls the ~MISC_REGISTERS_INT_STS.GENERIC_SW interrupt will
be asserted). */
#define MISC_REG_DRIVER_CONTROL_1 0xa510
#define MISC_REG_DRIVER_CONTROL_7 0xa3c8
/* [RW 1] e1hmf for WOL. If clr WOL signal o the PXP will be send on bit 0
only. */
#define MISC_REG_E1HMF_MODE 0xa5f8
/* [RW 32] Debug only: spare RW register reset by core reset */
#define MISC_REG_GENERIC_CR_0 0xa460
/* [RW 32] GPIO. [31-28] FLOAT port 0; [27-24] FLOAT port 0; When any of
these bits is written as a '1'; the corresponding SPIO bit will turn off
it's drivers and become an input. This is the reset state of all GPIO
pins. The read value of these bits will be a '1' if that last command
(#SET; #CLR; or #FLOAT) for this bit was a #FLOAT. (reset value 0xff).
[23-20] CLR port 1; 19-16] CLR port 0; When any of these bits is written
as a '1'; the corresponding GPIO bit will drive low. The read value of
these bits will be a '1' if that last command (#SET; #CLR; or #FLOAT) for
this bit was a #CLR. (reset value 0). [15-12] SET port 1; 11-8] port 0;
SET When any of these bits is written as a '1'; the corresponding GPIO
bit will drive high (if it has that capability). The read value of these
bits will be a '1' if that last command (#SET; #CLR; or #FLOAT) for this
bit was a #SET. (reset value 0). [7-4] VALUE port 1; [3-0] VALUE port 0;
RO; These bits indicate the read value of each of the eight GPIO pins.
This is the result value of the pin; not the drive value. Writing these
bits will have not effect. */
#define MISC_REG_GPIO 0xa490
/* [RW 8] These bits enable the GPIO_INTs to signals event to the
IGU/MCP.according to the following map: [0] p0_gpio_0; [1] p0_gpio_1; [2]
p0_gpio_2; [3] p0_gpio_3; [4] p1_gpio_0; [5] p1_gpio_1; [6] p1_gpio_2;
[7] p1_gpio_3; */
#define MISC_REG_GPIO_EVENT_EN 0xa2bc
/* [RW 32] GPIO INT. [31-28] OLD_CLR port1; [27-24] OLD_CLR port0; Writing a
'1' to these bit clears the corresponding bit in the #OLD_VALUE register.
This will acknowledge an interrupt on the falling edge of corresponding
GPIO input (reset value 0). [23-16] OLD_SET [23-16] port1; OLD_SET port0;
Writing a '1' to these bit sets the corresponding bit in the #OLD_VALUE
register. This will acknowledge an interrupt on the rising edge of
corresponding SPIO input (reset value 0). [15-12] OLD_VALUE [11-8] port1;
OLD_VALUE port0; RO; These bits indicate the old value of the GPIO input
value. When the ~INT_STATE bit is set; this bit indicates the OLD value
of the pin such that if ~INT_STATE is set and this bit is '0'; then the
interrupt is due to a low to high edge. If ~INT_STATE is set and this bit
is '1'; then the interrupt is due to a high to low edge (reset value 0).
[7-4] INT_STATE port1; [3-0] INT_STATE RO port0; These bits indicate the
current GPIO interrupt state for each GPIO pin. This bit is cleared when
the appropriate #OLD_SET or #OLD_CLR command bit is written. This bit is
set when the GPIO input does not match the current value in #OLD_VALUE
(reset value 0). */
#define MISC_REG_GPIO_INT 0xa494
/* [R 28] this field hold the last information that caused reserved
attention. bits [19:0] - address; [22:20] function; [23] reserved;
[27:24] the master that caused the attention - according to the following
encodeing:1 = pxp; 2 = mcp; 3 = usdm; 4 = tsdm; 5 = xsdm; 6 = csdm; 7 =
dbu; 8 = dmae */
#define MISC_REG_GRC_RSV_ATTN 0xa3c0
/* [R 28] this field hold the last information that caused timeout
attention. bits [19:0] - address; [22:20] function; [23] reserved;
[27:24] the master that caused the attention - according to the following
encodeing:1 = pxp; 2 = mcp; 3 = usdm; 4 = tsdm; 5 = xsdm; 6 = csdm; 7 =
dbu; 8 = dmae */
#define MISC_REG_GRC_TIMEOUT_ATTN 0xa3c4
/* [RW 1] Setting this bit enables a timer in the GRC block to timeout any
access that does not finish within
~misc_registers_grc_timout_val.grc_timeout_val cycles. When this bit is
cleared; this timeout is disabled. If this timeout occurs; the GRC shall
assert it attention output. */
#define MISC_REG_GRC_TIMEOUT_EN 0xa280
/* [RW 28] 28 LSB of LCPLL first register; reset val = 521. inside order of
the bits is: [2:0] OAC reset value 001) CML output buffer bias control;
111 for +40%; 011 for +20%; 001 for 0%; 000 for -20%. [5:3] Icp_ctrl
(reset value 001) Charge pump current control; 111 for 720u; 011 for
600u; 001 for 480u and 000 for 360u. [7:6] Bias_ctrl (reset value 00)
Global bias control; When bit 7 is high bias current will be 10 0gh; When
bit 6 is high bias will be 100w; Valid values are 00; 10; 01. [10:8]
Pll_observe (reset value 010) Bits to control observability. bit 10 is
for test bias; bit 9 is for test CK; bit 8 is test Vc. [12:11] Vth_ctrl
(reset value 00) Comparator threshold control. 00 for 0.6V; 01 for 0.54V
and 10 for 0.66V. [13] pllSeqStart (reset value 0) Enables VCO tuning
sequencer: 1= sequencer disabled; 0= sequencer enabled (inverted
internally). [14] reserved (reset value 0) Reset for VCO sequencer is
connected to RESET input directly. [15] capRetry_en (reset value 0)
enable retry on cap search failure (inverted). [16] freqMonitor_e (reset
value 0) bit to continuously monitor vco freq (inverted). [17]
freqDetRestart_en (reset value 0) bit to enable restart when not freq
locked (inverted). [18] freqDetRetry_en (reset value 0) bit to enable
retry on freq det failure(inverted). [19] pllForceFdone_en (reset value
0) bit to enable pllForceFdone & pllForceFpass into pllSeq. [20]
pllForceFdone (reset value 0) bit to force freqDone. [21] pllForceFpass
(reset value 0) bit to force freqPass. [22] pllForceDone_en (reset value
0) bit to enable pllForceCapDone. [23] pllForceCapDone (reset value 0)
bit to force capDone. [24] pllForceCapPass_en (reset value 0) bit to
enable pllForceCapPass. [25] pllForceCapPass (reset value 0) bit to force
capPass. [26] capRestart (reset value 0) bit to force cap sequencer to
restart. [27] capSelectM_en (reset value 0) bit to enable cap select
register bits. */
#define MISC_REG_LCPLL_CTRL_1 0xa2a4
#define MISC_REG_LCPLL_CTRL_REG_2 0xa2a8
/* [RW 4] Interrupt mask register #0 read/write */
#define MISC_REG_MISC_INT_MASK 0xa388
/* [RW 1] Parity mask register #0 read/write */
#define MISC_REG_MISC_PRTY_MASK 0xa398
/* [R 1] Parity register #0 read */
#define MISC_REG_MISC_PRTY_STS 0xa38c
#define MISC_REG_NIG_WOL_P0 0xa270
#define MISC_REG_NIG_WOL_P1 0xa274
/* [R 1] If set indicate that the pcie_rst_b was asserted without perst
assertion */
#define MISC_REG_PCIE_HOT_RESET 0xa618
/* [RW 32] 32 LSB of storm PLL first register; reset val = 0x 071d2911.
inside order of the bits is: [0] P1 divider[0] (reset value 1); [1] P1
divider[1] (reset value 0); [2] P1 divider[2] (reset value 0); [3] P1
divider[3] (reset value 0); [4] P2 divider[0] (reset value 1); [5] P2
divider[1] (reset value 0); [6] P2 divider[2] (reset value 0); [7] P2
divider[3] (reset value 0); [8] ph_det_dis (reset value 1); [9]
freq_det_dis (reset value 0); [10] Icpx[0] (reset value 0); [11] Icpx[1]
(reset value 1); [12] Icpx[2] (reset value 0); [13] Icpx[3] (reset value
1); [14] Icpx[4] (reset value 0); [15] Icpx[5] (reset value 0); [16]
Rx[0] (reset value 1); [17] Rx[1] (reset value 0); [18] vc_en (reset
value 1); [19] vco_rng[0] (reset value 1); [20] vco_rng[1] (reset value
1); [21] Kvco_xf[0] (reset value 0); [22] Kvco_xf[1] (reset value 0);
[23] Kvco_xf[2] (reset value 0); [24] Kvco_xs[0] (reset value 1); [25]
Kvco_xs[1] (reset value 1); [26] Kvco_xs[2] (reset value 1); [27]
testd_en (reset value 0); [28] testd_sel[0] (reset value 0); [29]
testd_sel[1] (reset value 0); [30] testd_sel[2] (reset value 0); [31]
testa_en (reset value 0); */
#define MISC_REG_PLL_STORM_CTRL_1 0xa294
#define MISC_REG_PLL_STORM_CTRL_2 0xa298
#define MISC_REG_PLL_STORM_CTRL_3 0xa29c
#define MISC_REG_PLL_STORM_CTRL_4 0xa2a0
/* [RW 32] reset reg#2; rite/read one = the specific block is out of reset;
write/read zero = the specific block is in reset; addr 0-wr- the write
value will be written to the register; addr 1-set - one will be written
to all the bits that have the value of one in the data written (bits that
have the value of zero will not be change) ; addr 2-clear - zero will be
written to all the bits that have the value of one in the data written
(bits that have the value of zero will not be change); addr 3-ignore;
read ignore from all addr except addr 00; inside order of the bits is:
[0] rst_bmac0; [1] rst_bmac1; [2] rst_emac0; [3] rst_emac1; [4] rst_grc;
[5] rst_mcp_n_reset_reg_hard_core; [6] rst_ mcp_n_hard_core_rst_b; [7]
rst_ mcp_n_reset_cmn_cpu; [8] rst_ mcp_n_reset_cmn_core; [9] rst_rbcn;
[10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13]
Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16]
rst_pxp_rq_rd_wr; 31:17] reserved */
#define MISC_REG_RESET_REG_2 0xa590
/* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is
shared with the driver resides */
#define MISC_REG_SHARED_MEM_ADDR 0xa2b4
/* [RW 32] SPIO. [31-24] FLOAT When any of these bits is written as a '1';
the corresponding SPIO bit will turn off it's drivers and become an
input. This is the reset state of all SPIO pins. The read value of these
bits will be a '1' if that last command (#SET; #CL; or #FLOAT) for this
bit was a #FLOAT. (reset value 0xff). [23-16] CLR When any of these bits
is written as a '1'; the corresponding SPIO bit will drive low. The read
value of these bits will be a '1' if that last command (#SET; #CLR; or
#FLOAT) for this bit was a #CLR. (reset value 0). [15-8] SET When any of
these bits is written as a '1'; the corresponding SPIO bit will drive
high (if it has that capability). The read value of these bits will be a
'1' if that last command (#SET; #CLR; or #FLOAT) for this bit was a #SET.
(reset value 0). [7-0] VALUE RO; These bits indicate the read value of
each of the eight SPIO pins. This is the result value of the pin; not the
drive value. Writing these bits will have not effect. Each 8 bits field
is divided as follows: [0] VAUX Enable; when pulsed low; enables supply
from VAUX. (This is an output pin only; the FLOAT field is not applicable
for this pin); [1] VAUX Disable; when pulsed low; disables supply form
VAUX. (This is an output pin only; FLOAT field is not applicable for this
pin); [2] SEL_VAUX_B - Control to power switching logic. Drive low to
select VAUX supply. (This is an output pin only; it is not controlled by
the SET and CLR fields; it is controlled by the Main Power SM; the FLOAT
field is not applicable for this pin; only the VALUE fields is relevant -
it reflects the output value); [3] port swap [4] spio_4; [5] spio_5; [6]
Bit 0 of UMP device ID select; read by UMP firmware; [7] Bit 1 of UMP
device ID select; read by UMP firmware. */
#define MISC_REG_SPIO 0xa4fc
/* [RW 8] These bits enable the SPIO_INTs to signals event to the IGU/MC.
according to the following map: [3:0] reserved; [4] spio_4 [5] spio_5;
[7:0] reserved */
#define MISC_REG_SPIO_EVENT_EN 0xa2b8
/* [RW 32] SPIO INT. [31-24] OLD_CLR Writing a '1' to these bit clears the
corresponding bit in the #OLD_VALUE register. This will acknowledge an
interrupt on the falling edge of corresponding SPIO input (reset value
0). [23-16] OLD_SET Writing a '1' to these bit sets the corresponding bit
in the #OLD_VALUE register. This will acknowledge an interrupt on the
rising edge of corresponding SPIO input (reset value 0). [15-8] OLD_VALUE
RO; These bits indicate the old value of the SPIO input value. When the
~INT_STATE bit is set; this bit indicates the OLD value of the pin such
that if ~INT_STATE is set and this bit is '0'; then the interrupt is due
to a low to high edge. If ~INT_STATE is set and this bit is '1'; then the
interrupt is due to a high to low edge (reset value 0). [7-0] INT_STATE
RO; These bits indicate the current SPIO interrupt state for each SPIO
pin. This bit is cleared when the appropriate #OLD_SET or #OLD_CLR
command bit is written. This bit is set when the SPIO input does not
match the current value in #OLD_VALUE (reset value 0). */
#define MISC_REG_SPIO_INT 0xa500
/* [RW 32] reload value for counter 4 if reload; the value will be reload if
the counter reached zero and the reload bit
(~misc_registers_sw_timer_cfg_4.sw_timer_cfg_4[1] ) is set */
#define MISC_REG_SW_TIMER_RELOAD_VAL_4 0xa2fc
/* [RW 32] the value of the counter for sw timers1-8. there are 8 addresses
in this register. addres 0 - timer 1; address - timer 2�address 7 -
timer 8 */
#define MISC_REG_SW_TIMER_VAL 0xa5c0
/* [RW 1] Set by the MCP to remember if one or more of the drivers is/are
loaded; 0-prepare; -unprepare */
#define MISC_REG_UNPREPARED 0xa424
#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_BRCST (0x1<<0)
#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_MLCST (0x1<<1)
#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_NO_VLAN (0x1<<4)
#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_UNCST (0x1<<2)
#define NIG_LLH0_BRB1_DRV_MASK_REG_LLH0_BRB1_DRV_MASK_VLAN (0x1<<3)
#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_EMAC0_MISC_MI_INT (0x1<<0)
#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_SERDES0_LINK_STATUS (0x1<<9)
#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_XGXS0_LINK10G (0x1<<15)
#define NIG_MASK_INTERRUPT_PORT0_REG_MASK_XGXS0_LINK_STATUS (0xf<<18)
/* [RW 1] Input enable for RX_BMAC0 IF */
#define NIG_REG_BMAC0_IN_EN 0x100ac
/* [RW 1] output enable for TX_BMAC0 IF */
#define NIG_REG_BMAC0_OUT_EN 0x100e0
/* [RW 1] output enable for TX BMAC pause port 0 IF */
#define NIG_REG_BMAC0_PAUSE_OUT_EN 0x10110
/* [RW 1] output enable for RX_BMAC0_REGS IF */
#define NIG_REG_BMAC0_REGS_OUT_EN 0x100e8
/* [RW 1] output enable for RX BRB1 port0 IF */
#define NIG_REG_BRB0_OUT_EN 0x100f8
/* [RW 1] Input enable for TX BRB1 pause port 0 IF */
#define NIG_REG_BRB0_PAUSE_IN_EN 0x100c4
/* [RW 1] output enable for RX BRB1 port1 IF */
#define NIG_REG_BRB1_OUT_EN 0x100fc
/* [RW 1] Input enable for TX BRB1 pause port 1 IF */
#define NIG_REG_BRB1_PAUSE_IN_EN 0x100c8
/* [RW 1] output enable for RX BRB1 LP IF */
#define NIG_REG_BRB_LB_OUT_EN 0x10100
/* [WB_W 82] Debug packet to LP from RBC; Data spelling:[63:0] data; 64]
error; [67:65]eop_bvalid; [68]eop; [69]sop; [70]port_id; 71]flush;
72:73]-vnic_num; 81:74]-sideband_info */
#define NIG_REG_DEBUG_PACKET_LB 0x10800
/* [RW 1] Input enable for TX Debug packet */
#define NIG_REG_EGRESS_DEBUG_IN_EN 0x100dc
/* [RW 1] If 1 - egress drain mode for port0 is active. In this mode all
packets from PBFare not forwarded to the MAC and just deleted from FIFO.
First packet may be deleted from the middle. And last packet will be
always deleted till the end. */
#define NIG_REG_EGRESS_DRAIN0_MODE 0x10060
/* [RW 1] Output enable to EMAC0 */
#define NIG_REG_EGRESS_EMAC0_OUT_EN 0x10120
/* [RW 1] MAC configuration for packets of port0. If 1 - all packet outputs
to emac for port0; other way to bmac for port0 */
#define NIG_REG_EGRESS_EMAC0_PORT 0x10058
/* [RW 1] Input enable for TX PBF user packet port0 IF */
#define NIG_REG_EGRESS_PBF0_IN_EN 0x100cc
/* [RW 1] Input enable for TX PBF user packet port1 IF */
#define NIG_REG_EGRESS_PBF1_IN_EN 0x100d0
/* [RW 1] Input enable for TX UMP management packet port0 IF */
#define NIG_REG_EGRESS_UMP0_IN_EN 0x100d4
/* [RW 1] Input enable for RX_EMAC0 IF */
#define NIG_REG_EMAC0_IN_EN 0x100a4
/* [RW 1] output enable for TX EMAC pause port 0 IF */
#define NIG_REG_EMAC0_PAUSE_OUT_EN 0x10118
/* [R 1] status from emac0. This bit is set when MDINT from either the
EXT_MDINT pin or from the Copper PHY is driven low. This condition must
be cleared in the attached PHY device that is driving the MINT pin. */
#define NIG_REG_EMAC0_STATUS_MISC_MI_INT 0x10494
/* [WB 48] This address space contains BMAC0 registers. The BMAC registers
are described in appendix A. In order to access the BMAC0 registers; the
base address; NIG_REGISTERS_INGRESS_BMAC0_MEM; Offset: 0x10c00; should be
added to each BMAC register offset */
#define NIG_REG_INGRESS_BMAC0_MEM 0x10c00
/* [WB 48] This address space contains BMAC1 registers. The BMAC registers
are described in appendix A. In order to access the BMAC0 registers; the
base address; NIG_REGISTERS_INGRESS_BMAC1_MEM; Offset: 0x11000; should be
added to each BMAC register offset */
#define NIG_REG_INGRESS_BMAC1_MEM 0x11000
/* [R 1] FIFO empty in EOP descriptor FIFO of LP in NIG_RX_EOP */
#define NIG_REG_INGRESS_EOP_LB_EMPTY 0x104e0
/* [RW 17] Debug only. RX_EOP_DSCR_lb_FIFO in NIG_RX_EOP. Data
packet_length[13:0]; mac_error[14]; trunc_error[15]; parity[16] */
#define NIG_REG_INGRESS_EOP_LB_FIFO 0x104e4
/* [RW 27] 0 - must be active for Everest A0; 1- for Everest B0 when latch
logic for interrupts must be used. Enable per bit of interrupt of
~latch_status.latch_status */
#define NIG_REG_LATCH_BC_0 0x16210
/* [RW 27] Latch for each interrupt from Unicore.b[0]
status_emac0_misc_mi_int; b[1] status_emac0_misc_mi_complete;
b[2]status_emac0_misc_cfg_change; b[3]status_emac0_misc_link_status;
b[4]status_emac0_misc_link_change; b[5]status_emac0_misc_attn;
b[6]status_serdes0_mac_crs; b[7]status_serdes0_autoneg_complete;
b[8]status_serdes0_fiber_rxact; b[9]status_serdes0_link_status;
b[10]status_serdes0_mr_page_rx; b[11]status_serdes0_cl73_an_complete;
b[12]status_serdes0_cl73_mr_page_rx; b[13]status_serdes0_rx_sigdet;
b[14]status_xgxs0_remotemdioreq; b[15]status_xgxs0_link10g;
b[16]status_xgxs0_autoneg_complete; b[17]status_xgxs0_fiber_rxact;
b[21:18]status_xgxs0_link_status; b[22]status_xgxs0_mr_page_rx;
b[23]status_xgxs0_cl73_an_complete; b[24]status_xgxs0_cl73_mr_page_rx;
b[25]status_xgxs0_rx_sigdet; b[26]status_xgxs0_mac_crs */
#define NIG_REG_LATCH_STATUS_0 0x18000
/* [RW 1] led 10g for port 0 */
#define NIG_REG_LED_10G_P0 0x10320
/* [RW 1] led 10g for port 1 */
#define NIG_REG_LED_10G_P1 0x10324
/* [RW 1] Port0: This bit is set to enable the use of the
~nig_registers_led_control_blink_rate_p0.led_control_blink_rate_p0 field
defined below. If this bit is cleared; then the blink rate will be about
8Hz. */
#define NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 0x10318
/* [RW 12] Port0: Specifies the period of each blink cycle (on + off) for
Traffic LED in milliseconds. Must be a non-zero value. This 12-bit field
is reset to 0x080; giving a default blink period of approximately 8Hz. */
#define NIG_REG_LED_CONTROL_BLINK_RATE_P0 0x10310
/* [RW 1] Port0: If set along with the
~nig_registers_led_control_override_traffic_p0.led_control_override_traffic_p0
bit and ~nig_registers_led_control_traffic_p0.led_control_traffic_p0 LED
bit; the Traffic LED will blink with the blink rate specified in
~nig_registers_led_control_blink_rate_p0.led_control_blink_rate_p0 and
~nig_registers_led_control_blink_rate_ena_p0.led_control_blink_rate_ena_p0
fields. */
#define NIG_REG_LED_CONTROL_BLINK_TRAFFIC_P0 0x10308
/* [RW 1] Port0: If set overrides hardware control of the Traffic LED. The
Traffic LED will then be controlled via bit ~nig_registers_
led_control_traffic_p0.led_control_traffic_p0 and bit
~nig_registers_led_control_blink_traffic_p0.led_control_blink_traffic_p0 */
#define NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 0x102f8
/* [RW 1] Port0: If set along with the led_control_override_trafic_p0 bit;
turns on the Traffic LED. If the led_control_blink_traffic_p0 bit is also
set; the LED will blink with blink rate specified in
~nig_registers_led_control_blink_rate_p0.led_control_blink_rate_p0 and
~nig_regsters_led_control_blink_rate_ena_p0.led_control_blink_rate_ena_p0
fields. */
#define NIG_REG_LED_CONTROL_TRAFFIC_P0 0x10300
/* [RW 4] led mode for port0: 0 MAC; 1-3 PHY1; 4 MAC2; 5-7 PHY4; 8-MAC3;
9-11PHY7; 12 MAC4; 13-15 PHY10; */
#define NIG_REG_LED_MODE_P0 0x102f0
/* [RW 3] for port0 enable for llfc ppp and pause. b0 - brb1 enable; b1-
tsdm enable; b2- usdm enable */
#define NIG_REG_LLFC_EGRESS_SRC_ENABLE_0 0x16070
#define NIG_REG_LLFC_EGRESS_SRC_ENABLE_1 0x16074
/* [RW 1] SAFC enable for port0. This register may get 1 only when
~ppp_enable.ppp_enable = 0 and pause_enable.pause_enable =0 for the same
port */
#define NIG_REG_LLFC_ENABLE_0 0x16208
/* [RW 16] classes are high-priority for port0 */
#define NIG_REG_LLFC_HIGH_PRIORITY_CLASSES_0 0x16058
/* [RW 16] classes are low-priority for port0 */
#define NIG_REG_LLFC_LOW_PRIORITY_CLASSES_0 0x16060
/* [RW 1] Output enable of message to LLFC BMAC IF for port0 */
#define NIG_REG_LLFC_OUT_EN_0 0x160c8
#define NIG_REG_LLH0_ACPI_PAT_0_CRC 0x1015c
#define NIG_REG_LLH0_ACPI_PAT_6_LEN 0x10154
#define NIG_REG_LLH0_BRB1_DRV_MASK 0x10244
#define NIG_REG_LLH0_BRB1_DRV_MASK_MF 0x16048
/* [RW 1] send to BRB1 if no match on any of RMP rules. */
#define NIG_REG_LLH0_BRB1_NOT_MCP 0x1025c
/* [RW 2] Determine the classification participants. 0: no classification.1:
classification upon VLAN id. 2: classification upon MAC address. 3:
classification upon both VLAN id & MAC addr. */
#define NIG_REG_LLH0_CLS_TYPE 0x16080
/* [RW 32] cm header for llh0 */
#define NIG_REG_LLH0_CM_HEADER 0x1007c
#define NIG_REG_LLH0_DEST_IP_0_1 0x101dc
#define NIG_REG_LLH0_DEST_MAC_0_0 0x101c0
/* [RW 16] destination TCP address 1. The LLH will look for this address in
all incoming packets. */
#define NIG_REG_LLH0_DEST_TCP_0 0x10220
/* [RW 16] destination UDP address 1 The LLH will look for this address in
all incoming packets. */
#define NIG_REG_LLH0_DEST_UDP_0 0x10214
#define NIG_REG_LLH0_ERROR_MASK 0x1008c
/* [RW 8] event id for llh0 */
#define NIG_REG_LLH0_EVENT_ID 0x10084
#define NIG_REG_LLH0_FUNC_EN 0x160fc
#define NIG_REG_LLH0_FUNC_VLAN_ID 0x16100
/* [RW 1] Determine the IP version to look for in
~nig_registers_llh0_dest_ip_0.llh0_dest_ip_0. 0 - IPv6; 1-IPv4 */
#define NIG_REG_LLH0_IPV4_IPV6_0 0x10208
/* [RW 1] t bit for llh0 */
#define NIG_REG_LLH0_T_BIT 0x10074
/* [RW 12] VLAN ID 1. In case of VLAN packet the LLH will look for this ID. */
#define NIG_REG_LLH0_VLAN_ID_0 0x1022c
/* [RW 8] init credit counter for port0 in LLH */
#define NIG_REG_LLH0_XCM_INIT_CREDIT 0x10554
#define NIG_REG_LLH0_XCM_MASK 0x10130
#define NIG_REG_LLH1_BRB1_DRV_MASK 0x10248
/* [RW 1] send to BRB1 if no match on any of RMP rules. */
#define NIG_REG_LLH1_BRB1_NOT_MCP 0x102dc
/* [RW 2] Determine the classification participants. 0: no classification.1:
classification upon VLAN id. 2: classification upon MAC address. 3:
classification upon both VLAN id & MAC addr. */
#define NIG_REG_LLH1_CLS_TYPE 0x16084
/* [RW 32] cm header for llh1 */
#define NIG_REG_LLH1_CM_HEADER 0x10080
#define NIG_REG_LLH1_ERROR_MASK 0x10090
/* [RW 8] event id for llh1 */
#define NIG_REG_LLH1_EVENT_ID 0x10088
/* [RW 8] init credit counter for port1 in LLH */
#define NIG_REG_LLH1_XCM_INIT_CREDIT 0x10564
#define NIG_REG_LLH1_XCM_MASK 0x10134
/* [RW 1] When this bit is set; the LLH will expect all packets to be with
e1hov */
#define NIG_REG_LLH_E1HOV_MODE 0x160d8
/* [RW 1] When this bit is set; the LLH will classify the packet before
sending it to the BRB or calculating WoL on it. */
#define NIG_REG_LLH_MF_MODE 0x16024
#define NIG_REG_MASK_INTERRUPT_PORT0 0x10330
#define NIG_REG_MASK_INTERRUPT_PORT1 0x10334
/* [RW 1] Output signal from NIG to EMAC0. When set enables the EMAC0 block. */
#define NIG_REG_NIG_EMAC0_EN 0x1003c
/* [RW 1] Output signal from NIG to EMAC1. When set enables the EMAC1 block. */
#define NIG_REG_NIG_EMAC1_EN 0x10040
/* [RW 1] Output signal from NIG to TX_EMAC0. When set indicates to the
EMAC0 to strip the CRC from the ingress packets. */
#define NIG_REG_NIG_INGRESS_EMAC0_NO_CRC 0x10044
/* [R 32] Interrupt register #0 read */
#define NIG_REG_NIG_INT_STS_0 0x103b0
#define NIG_REG_NIG_INT_STS_1 0x103c0
/* [R 32] Parity register #0 read */
#define NIG_REG_NIG_PRTY_STS 0x103d0
/* [RW 1] Pause enable for port0. This register may get 1 only when
~safc_enable.safc_enable = 0 and ppp_enable.ppp_enable =0 for the same
port */
#define NIG_REG_PAUSE_ENABLE_0 0x160c0
/* [RW 1] Input enable for RX PBF LP IF */
#define NIG_REG_PBF_LB_IN_EN 0x100b4
/* [RW 1] Value of this register will be transmitted to port swap when
~nig_registers_strap_override.strap_override =1 */
#define NIG_REG_PORT_SWAP 0x10394
/* [RW 1] output enable for RX parser descriptor IF */
#define NIG_REG_PRS_EOP_OUT_EN 0x10104
/* [RW 1] Input enable for RX parser request IF */
#define NIG_REG_PRS_REQ_IN_EN 0x100b8
/* [RW 5] control to serdes - CL45 DEVAD */
#define NIG_REG_SERDES0_CTRL_MD_DEVAD 0x10370
/* [RW 1] control to serdes; 0 - clause 45; 1 - clause 22 */
#define NIG_REG_SERDES0_CTRL_MD_ST 0x1036c
/* [RW 5] control to serdes - CL22 PHY_ADD and CL45 PRTAD */
#define NIG_REG_SERDES0_CTRL_PHY_ADDR 0x10374
/* [R 1] status from serdes0 that inputs to interrupt logic of link status */
#define NIG_REG_SERDES0_STATUS_LINK_STATUS 0x10578
/* [R 32] Rx statistics : In user packets discarded due to BRB backpressure
for port0 */
#define NIG_REG_STAT0_BRB_DISCARD 0x105f0
/* [R 32] Rx statistics : In user packets truncated due to BRB backpressure
for port0 */
#define NIG_REG_STAT0_BRB_TRUNCATE 0x105f8
/* [WB_R 36] Tx statistics : Number of packets from emac0 or bmac0 that
between 1024 and 1522 bytes for port0 */
#define NIG_REG_STAT0_EGRESS_MAC_PKT0 0x10750
/* [WB_R 36] Tx statistics : Number of packets from emac0 or bmac0 that
between 1523 bytes and above for port0 */
#define NIG_REG_STAT0_EGRESS_MAC_PKT1 0x10760
/* [R 32] Rx statistics : In user packets discarded due to BRB backpressure
for port1 */
#define NIG_REG_STAT1_BRB_DISCARD 0x10628
/* [WB_R 36] Tx statistics : Number of packets from emac1 or bmac1 that
between 1024 and 1522 bytes for port1 */
#define NIG_REG_STAT1_EGRESS_MAC_PKT0 0x107a0
/* [WB_R 36] Tx statistics : Number of packets from emac1 or bmac1 that
between 1523 bytes and above for port1 */
#define NIG_REG_STAT1_EGRESS_MAC_PKT1 0x107b0
/* [WB_R 64] Rx statistics : User octets received for LP */
#define NIG_REG_STAT2_BRB_OCTET 0x107e0
#define NIG_REG_STATUS_INTERRUPT_PORT0 0x10328
#define NIG_REG_STATUS_INTERRUPT_PORT1 0x1032c
/* [RW 1] port swap mux selection. If this register equal to 0 then port
swap is equal to SPIO pin that inputs from ifmux_serdes_swap. If 1 then
ort swap is equal to ~nig_registers_port_swap.port_swap */
#define NIG_REG_STRAP_OVERRIDE 0x10398
/* [RW 1] output enable for RX_XCM0 IF */
#define NIG_REG_XCM0_OUT_EN 0x100f0
/* [RW 1] output enable for RX_XCM1 IF */
#define NIG_REG_XCM1_OUT_EN 0x100f4
/* [RW 1] control to xgxs - remote PHY in-band MDIO */
#define NIG_REG_XGXS0_CTRL_EXTREMOTEMDIOST 0x10348
/* [RW 5] control to xgxs - CL45 DEVAD */
#define NIG_REG_XGXS0_CTRL_MD_DEVAD 0x1033c
/* [RW 1] control to xgxs; 0 - clause 45; 1 - clause 22 */
#define NIG_REG_XGXS0_CTRL_MD_ST 0x10338
/* [RW 5] control to xgxs - CL22 PHY_ADD and CL45 PRTAD */
#define NIG_REG_XGXS0_CTRL_PHY_ADDR 0x10340
/* [R 1] status from xgxs0 that inputs to interrupt logic of link10g. */
#define NIG_REG_XGXS0_STATUS_LINK10G 0x10680
/* [R 4] status from xgxs0 that inputs to interrupt logic of link status */
#define NIG_REG_XGXS0_STATUS_LINK_STATUS 0x10684
/* [RW 2] selection for XGXS lane of port 0 in NIG_MUX block */
#define NIG_REG_XGXS_LANE_SEL_P0 0x102e8
/* [RW 1] selection for port0 for NIG_MUX block : 0 = SerDes; 1 = XGXS */
#define NIG_REG_XGXS_SERDES0_MODE_SEL 0x102e0
#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_EMAC0_MISC_MI_INT (0x1<<0)
#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_SERDES0_LINK_STATUS (0x1<<9)
#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK10G (0x1<<15)
#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK_STATUS (0xf<<18)
#define NIG_STATUS_INTERRUPT_PORT0_REG_STATUS_XGXS0_LINK_STATUS_SIZE 18
/* [RW 1] Disable processing further tasks from port 0 (after ending the
current task in process). */
#define PBF_REG_DISABLE_NEW_TASK_PROC_P0 0x14005c
/* [RW 1] Disable processing further tasks from port 1 (after ending the
current task in process). */
#define PBF_REG_DISABLE_NEW_TASK_PROC_P1 0x140060
/* [RW 1] Disable processing further tasks from port 4 (after ending the
current task in process). */
#define PBF_REG_DISABLE_NEW_TASK_PROC_P4 0x14006c
#define PBF_REG_IF_ENABLE_REG 0x140044
/* [RW 1] Init bit. When set the initial credits are copied to the credit
registers (except the port credits). Should be set and then reset after
the configuration of the block has ended. */
#define PBF_REG_INIT 0x140000
/* [RW 1] Init bit for port 0. When set the initial credit of port 0 is
copied to the credit register. Should be set and then reset after the
configuration of the port has ended. */
#define PBF_REG_INIT_P0 0x140004
/* [RW 1] Init bit for port 1. When set the initial credit of port 1 is
copied to the credit register. Should be set and then reset after the
configuration of the port has ended. */
#define PBF_REG_INIT_P1 0x140008
/* [RW 1] Init bit for port 4. When set the initial credit of port 4 is
copied to the credit register. Should be set and then reset after the
configuration of the port has ended. */
#define PBF_REG_INIT_P4 0x14000c
/* [RW 1] Enable for mac interface 0. */
#define PBF_REG_MAC_IF0_ENABLE 0x140030
/* [RW 1] Enable for mac interface 1. */
#define PBF_REG_MAC_IF1_ENABLE 0x140034
/* [RW 1] Enable for the loopback interface. */
#define PBF_REG_MAC_LB_ENABLE 0x140040
/* [RW 10] Port 0 threshold used by arbiter in 16 byte lines used when pause
not suppoterd. */
#define PBF_REG_P0_ARB_THRSH 0x1400e4
/* [R 11] Current credit for port 0 in the tx port buffers in 16 byte lines. */
#define PBF_REG_P0_CREDIT 0x140200
/* [RW 11] Initial credit for port 0 in the tx port buffers in 16 byte
lines. */
#define PBF_REG_P0_INIT_CRD 0x1400d0
/* [RW 1] Indication that pause is enabled for port 0. */
#define PBF_REG_P0_PAUSE_ENABLE 0x140014
/* [R 8] Number of tasks in port 0 task queue. */
#define PBF_REG_P0_TASK_CNT 0x140204
/* [R 11] Current credit for port 1 in the tx port buffers in 16 byte lines. */
#define PBF_REG_P1_CREDIT 0x140208
/* [RW 11] Initial credit for port 1 in the tx port buffers in 16 byte
lines. */
#define PBF_REG_P1_INIT_CRD 0x1400d4
/* [R 8] Number of tasks in port 1 task queue. */
#define PBF_REG_P1_TASK_CNT 0x14020c
/* [R 11] Current credit for port 4 in the tx port buffers in 16 byte lines. */
#define PBF_REG_P4_CREDIT 0x140210
/* [RW 11] Initial credit for port 4 in the tx port buffers in 16 byte
lines. */
#define PBF_REG_P4_INIT_CRD 0x1400e0
/* [R 8] Number of tasks in port 4 task queue. */
#define PBF_REG_P4_TASK_CNT 0x140214
/* [RW 5] Interrupt mask register #0 read/write */
#define PBF_REG_PBF_INT_MASK 0x1401d4
/* [R 5] Interrupt register #0 read */
#define PBF_REG_PBF_INT_STS 0x1401c8
#define PB_REG_CONTROL 0
/* [RW 2] Interrupt mask register #0 read/write */
#define PB_REG_PB_INT_MASK 0x28
/* [R 2] Interrupt register #0 read */
#define PB_REG_PB_INT_STS 0x1c
/* [RW 4] Parity mask register #0 read/write */
#define PB_REG_PB_PRTY_MASK 0x38
/* [R 4] Parity register #0 read */
#define PB_REG_PB_PRTY_STS 0x2c
#define PRS_REG_A_PRSU_20 0x40134
/* [R 8] debug only: CFC load request current credit. Transaction based. */
#define PRS_REG_CFC_LD_CURRENT_CREDIT 0x40164
/* [R 8] debug only: CFC search request current credit. Transaction based. */
#define PRS_REG_CFC_SEARCH_CURRENT_CREDIT 0x40168
/* [RW 6] The initial credit for the search message to the CFC interface.
Credit is transaction based. */
#define PRS_REG_CFC_SEARCH_INITIAL_CREDIT 0x4011c
/* [RW 24] CID for port 0 if no match */
#define PRS_REG_CID_PORT_0 0x400fc
/* [RW 32] The CM header for flush message where 'load existed' bit in CFC
load response is reset and packet type is 0. Used in packet start message
to TCM. */
#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_0 0x400dc
#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_1 0x400e0
#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_2 0x400e4
#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_3 0x400e8
#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_4 0x400ec
#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_5 0x400f0
/* [RW 32] The CM header for flush message where 'load existed' bit in CFC
load response is set and packet type is 0. Used in packet start message
to TCM. */
#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_0 0x400bc
#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_1 0x400c0
#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_2 0x400c4
#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_3 0x400c8
#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_4 0x400cc
#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_5 0x400d0
/* [RW 32] The CM header for a match and packet type 1 for loopback port.
Used in packet start message to TCM. */
#define PRS_REG_CM_HDR_LOOPBACK_TYPE_1 0x4009c
#define PRS_REG_CM_HDR_LOOPBACK_TYPE_2 0x400a0
#define PRS_REG_CM_HDR_LOOPBACK_TYPE_3 0x400a4
#define PRS_REG_CM_HDR_LOOPBACK_TYPE_4 0x400a8
/* [RW 32] The CM header for a match and packet type 0. Used in packet start
message to TCM. */
#define PRS_REG_CM_HDR_TYPE_0 0x40078
#define PRS_REG_CM_HDR_TYPE_1 0x4007c
#define PRS_REG_CM_HDR_TYPE_2 0x40080
#define PRS_REG_CM_HDR_TYPE_3 0x40084
#define PRS_REG_CM_HDR_TYPE_4 0x40088
/* [RW 32] The CM header in case there was not a match on the connection */
#define PRS_REG_CM_NO_MATCH_HDR 0x400b8
/* [RW 1] Indicates if in e1hov mode. 0=non-e1hov mode; 1=e1hov mode. */
#define PRS_REG_E1HOV_MODE 0x401c8
/* [RW 8] The 8-bit event ID for a match and packet type 1. Used in packet
start message to TCM. */
#define PRS_REG_EVENT_ID_1 0x40054
#define PRS_REG_EVENT_ID_2 0x40058
#define PRS_REG_EVENT_ID_3 0x4005c
/* [RW 16] The Ethernet type value for FCoE */
#define PRS_REG_FCOE_TYPE 0x401d0
/* [RW 8] Context region for flush packet with packet type 0. Used in CFC
load request message. */
#define PRS_REG_FLUSH_REGIONS_TYPE_0 0x40004
#define PRS_REG_FLUSH_REGIONS_TYPE_1 0x40008
#define PRS_REG_FLUSH_REGIONS_TYPE_2 0x4000c
#define PRS_REG_FLUSH_REGIONS_TYPE_3 0x40010
#define PRS_REG_FLUSH_REGIONS_TYPE_4 0x40014
#define PRS_REG_FLUSH_REGIONS_TYPE_5 0x40018
#define PRS_REG_FLUSH_REGIONS_TYPE_6 0x4001c
#define PRS_REG_FLUSH_REGIONS_TYPE_7 0x40020
/* [RW 4] The increment value to send in the CFC load request message */
#define PRS_REG_INC_VALUE 0x40048
/* [RW 1] If set indicates not to send messages to CFC on received packets */
#define PRS_REG_NIC_MODE 0x40138
/* [RW 8] The 8-bit event ID for cases where there is no match on the
connection. Used in packet start message to TCM. */
#define PRS_REG_NO_MATCH_EVENT_ID 0x40070
/* [ST 24] The number of input CFC flush packets */
#define PRS_REG_NUM_OF_CFC_FLUSH_MESSAGES 0x40128
/* [ST 32] The number of cycles the Parser halted its operation since it
could not allocate the next serial number */
#define PRS_REG_NUM_OF_DEAD_CYCLES 0x40130
/* [ST 24] The number of input packets */
#define PRS_REG_NUM_OF_PACKETS 0x40124
/* [ST 24] The number of input transparent flush packets */
#define PRS_REG_NUM_OF_TRANSPARENT_FLUSH_MESSAGES 0x4012c
/* [RW 8] Context region for received Ethernet packet with a match and
packet type 0. Used in CFC load request message */
#define PRS_REG_PACKET_REGIONS_TYPE_0 0x40028
#define PRS_REG_PACKET_REGIONS_TYPE_1 0x4002c
#define PRS_REG_PACKET_REGIONS_TYPE_2 0x40030
#define PRS_REG_PACKET_REGIONS_TYPE_3 0x40034
#define PRS_REG_PACKET_REGIONS_TYPE_4 0x40038
#define PRS_REG_PACKET_REGIONS_TYPE_5 0x4003c
#define PRS_REG_PACKET_REGIONS_TYPE_6 0x40040
#define PRS_REG_PACKET_REGIONS_TYPE_7 0x40044
/* [R 2] debug only: Number of pending requests for CAC on port 0. */
#define PRS_REG_PENDING_BRB_CAC0_RQ 0x40174
/* [R 2] debug only: Number of pending requests for header parsing. */
#define PRS_REG_PENDING_BRB_PRS_RQ 0x40170
/* [R 1] Interrupt register #0 read */
#define PRS_REG_PRS_INT_STS 0x40188
/* [RW 8] Parity mask register #0 read/write */
#define PRS_REG_PRS_PRTY_MASK 0x401a4
/* [R 8] Parity register #0 read */
#define PRS_REG_PRS_PRTY_STS 0x40198
/* [RW 8] Context region for pure acknowledge packets. Used in CFC load
request message */
#define PRS_REG_PURE_REGIONS 0x40024
/* [R 32] debug only: Serial number status lsb 32 bits. '1' indicates this
serail number was released by SDM but cannot be used because a previous
serial number was not released. */
#define PRS_REG_SERIAL_NUM_STATUS_LSB 0x40154
/* [R 32] debug only: Serial number status msb 32 bits. '1' indicates this
serail number was released by SDM but cannot be used because a previous
serial number was not released. */
#define PRS_REG_SERIAL_NUM_STATUS_MSB 0x40158
/* [R 4] debug only: SRC current credit. Transaction based. */
#define PRS_REG_SRC_CURRENT_CREDIT 0x4016c
/* [R 8] debug only: TCM current credit. Cycle based. */
#define PRS_REG_TCM_CURRENT_CREDIT 0x40160
/* [R 8] debug only: TSDM current credit. Transaction based. */
#define PRS_REG_TSDM_CURRENT_CREDIT 0x4015c
/* [R 6] Debug only: Number of used entries in the data FIFO */
#define PXP2_REG_HST_DATA_FIFO_STATUS 0x12047c
/* [R 7] Debug only: Number of used entries in the header FIFO */
#define PXP2_REG_HST_HEADER_FIFO_STATUS 0x120478
#define PXP2_REG_PGL_ADDR_88_F0 0x120534
#define PXP2_REG_PGL_ADDR_8C_F0 0x120538
#define PXP2_REG_PGL_ADDR_90_F0 0x12053c
#define PXP2_REG_PGL_ADDR_94_F0 0x120540
#define PXP2_REG_PGL_CONTROL0 0x120490
#define PXP2_REG_PGL_CONTROL1 0x120514
#define PXP2_REG_PGL_DEBUG 0x120520
/* [RW 32] third dword data of expansion rom request. this register is
special. reading from it provides a vector outstanding read requests. if
a bit is zero it means that a read request on the corresponding tag did
not finish yet (not all completions have arrived for it) */
#define PXP2_REG_PGL_EXP_ROM2 0x120808
/* [RW 32] Inbound interrupt table for CSDM: bits[31:16]-mask;
its[15:0]-address */
#define PXP2_REG_PGL_INT_CSDM_0 0x1204f4
#define PXP2_REG_PGL_INT_CSDM_1 0x1204f8
#define PXP2_REG_PGL_INT_CSDM_2 0x1204fc
#define PXP2_REG_PGL_INT_CSDM_3 0x120500
#define PXP2_REG_PGL_INT_CSDM_4 0x120504
#define PXP2_REG_PGL_INT_CSDM_5 0x120508
#define PXP2_REG_PGL_INT_CSDM_6 0x12050c
#define PXP2_REG_PGL_INT_CSDM_7 0x120510
/* [RW 32] Inbound interrupt table for TSDM: bits[31:16]-mask;
its[15:0]-address */
#define PXP2_REG_PGL_INT_TSDM_0 0x120494
#define PXP2_REG_PGL_INT_TSDM_1 0x120498
#define PXP2_REG_PGL_INT_TSDM_2 0x12049c
#define PXP2_REG_PGL_INT_TSDM_3 0x1204a0
#define PXP2_REG_PGL_INT_TSDM_4 0x1204a4
#define PXP2_REG_PGL_INT_TSDM_5 0x1204a8
#define PXP2_REG_PGL_INT_TSDM_6 0x1204ac
#define PXP2_REG_PGL_INT_TSDM_7 0x1204b0
/* [RW 32] Inbound interrupt table for USDM: bits[31:16]-mask;
its[15:0]-address */
#define PXP2_REG_PGL_INT_USDM_0 0x1204b4
#define PXP2_REG_PGL_INT_USDM_1 0x1204b8
#define PXP2_REG_PGL_INT_USDM_2 0x1204bc
#define PXP2_REG_PGL_INT_USDM_3 0x1204c0
#define PXP2_REG_PGL_INT_USDM_4 0x1204c4
#define PXP2_REG_PGL_INT_USDM_5 0x1204c8
#define PXP2_REG_PGL_INT_USDM_6 0x1204cc
#define PXP2_REG_PGL_INT_USDM_7 0x1204d0
/* [RW 32] Inbound interrupt table for XSDM: bits[31:16]-mask;
its[15:0]-address */
#define PXP2_REG_PGL_INT_XSDM_0 0x1204d4
#define PXP2_REG_PGL_INT_XSDM_1 0x1204d8
#define PXP2_REG_PGL_INT_XSDM_2 0x1204dc
#define PXP2_REG_PGL_INT_XSDM_3 0x1204e0
#define PXP2_REG_PGL_INT_XSDM_4 0x1204e4
#define PXP2_REG_PGL_INT_XSDM_5 0x1204e8
#define PXP2_REG_PGL_INT_XSDM_6 0x1204ec
#define PXP2_REG_PGL_INT_XSDM_7 0x1204f0
/* [RW 3] this field allows one function to pretend being another function
when accessing any BAR mapped resource within the device. the value of
the field is the number of the function that will be accessed
effectively. after software write to this bit it must read it in order to
know that the new value is updated */
#define PXP2_REG_PGL_PRETEND_FUNC_F0 0x120674
#define PXP2_REG_PGL_PRETEND_FUNC_F1 0x120678
#define PXP2_REG_PGL_PRETEND_FUNC_F2 0x12067c
#define PXP2_REG_PGL_PRETEND_FUNC_F3 0x120680
#define PXP2_REG_PGL_PRETEND_FUNC_F4 0x120684
#define PXP2_REG_PGL_PRETEND_FUNC_F5 0x120688
#define PXP2_REG_PGL_PRETEND_FUNC_F6 0x12068c
#define PXP2_REG_PGL_PRETEND_FUNC_F7 0x120690
/* [R 1] this bit indicates that a read request was blocked because of
bus_master_en was deasserted */
#define PXP2_REG_PGL_READ_BLOCKED 0x120568
#define PXP2_REG_PGL_TAGS_LIMIT 0x1205a8
/* [R 18] debug only */
#define PXP2_REG_PGL_TXW_CDTS 0x12052c
/* [R 1] this bit indicates that a write request was blocked because of
bus_master_en was deasserted */
#define PXP2_REG_PGL_WRITE_BLOCKED 0x120564
#define PXP2_REG_PSWRQ_BW_ADD1 0x1201c0
#define PXP2_REG_PSWRQ_BW_ADD10 0x1201e4
#define PXP2_REG_PSWRQ_BW_ADD11 0x1201e8
#define PXP2_REG_PSWRQ_BW_ADD2 0x1201c4
#define PXP2_REG_PSWRQ_BW_ADD28 0x120228
#define PXP2_REG_PSWRQ_BW_ADD3 0x1201c8
#define PXP2_REG_PSWRQ_BW_ADD6 0x1201d4
#define PXP2_REG_PSWRQ_BW_ADD7 0x1201d8
#define PXP2_REG_PSWRQ_BW_ADD8 0x1201dc
#define PXP2_REG_PSWRQ_BW_ADD9 0x1201e0
#define PXP2_REG_PSWRQ_BW_CREDIT 0x12032c
#define PXP2_REG_PSWRQ_BW_L1 0x1202b0
#define PXP2_REG_PSWRQ_BW_L10 0x1202d4
#define PXP2_REG_PSWRQ_BW_L11 0x1202d8
#define PXP2_REG_PSWRQ_BW_L2 0x1202b4
#define PXP2_REG_PSWRQ_BW_L28 0x120318
#define PXP2_REG_PSWRQ_BW_L3 0x1202b8
#define PXP2_REG_PSWRQ_BW_L6 0x1202c4
#define PXP2_REG_PSWRQ_BW_L7 0x1202c8
#define PXP2_REG_PSWRQ_BW_L8 0x1202cc
#define PXP2_REG_PSWRQ_BW_L9 0x1202d0
#define PXP2_REG_PSWRQ_BW_RD 0x120324
#define PXP2_REG_PSWRQ_BW_UB1 0x120238
#define PXP2_REG_PSWRQ_BW_UB10 0x12025c
#define PXP2_REG_PSWRQ_BW_UB11 0x120260
#define PXP2_REG_PSWRQ_BW_UB2 0x12023c
#define PXP2_REG_PSWRQ_BW_UB28 0x1202a0
#define PXP2_REG_PSWRQ_BW_UB3 0x120240
#define PXP2_REG_PSWRQ_BW_UB6 0x12024c
#define PXP2_REG_PSWRQ_BW_UB7 0x120250
#define PXP2_REG_PSWRQ_BW_UB8 0x120254
#define PXP2_REG_PSWRQ_BW_UB9 0x120258
#define PXP2_REG_PSWRQ_BW_WR 0x120328
#define PXP2_REG_PSWRQ_CDU0_L2P 0x120000
#define PXP2_REG_PSWRQ_QM0_L2P 0x120038
#define PXP2_REG_PSWRQ_SRC0_L2P 0x120054
#define PXP2_REG_PSWRQ_TM0_L2P 0x12001c
#define PXP2_REG_PSWRQ_TSDM0_L2P 0x1200e0
/* [RW 32] Interrupt mask register #0 read/write */
#define PXP2_REG_PXP2_INT_MASK_0 0x120578
/* [R 32] Interrupt register #0 read */
#define PXP2_REG_PXP2_INT_STS_0 0x12056c
#define PXP2_REG_PXP2_INT_STS_1 0x120608
/* [RC 32] Interrupt register #0 read clear */
#define PXP2_REG_PXP2_INT_STS_CLR_0 0x120570
/* [RW 32] Parity mask register #0 read/write */
#define PXP2_REG_PXP2_PRTY_MASK_0 0x120588
#define PXP2_REG_PXP2_PRTY_MASK_1 0x120598
/* [R 32] Parity register #0 read */
#define PXP2_REG_PXP2_PRTY_STS_0 0x12057c
#define PXP2_REG_PXP2_PRTY_STS_1 0x12058c
/* [R 1] Debug only: The 'almost full' indication from each fifo (gives
indication about backpressure) */
#define PXP2_REG_RD_ALMOST_FULL_0 0x120424
/* [R 8] Debug only: The blocks counter - number of unused block ids */
#define PXP2_REG_RD_BLK_CNT 0x120418
/* [RW 8] Debug only: Total number of available blocks in Tetris Buffer.
Must be bigger than 6. Normally should not be changed. */
#define PXP2_REG_RD_BLK_NUM_CFG 0x12040c
/* [RW 2] CDU byte swapping mode configuration for master read requests */
#define PXP2_REG_RD_CDURD_SWAP_MODE 0x120404
/* [RW 1] When '1'; inputs to the PSWRD block are ignored */
#define PXP2_REG_RD_DISABLE_INPUTS 0x120374
/* [R 1] PSWRD internal memories initialization is done */
#define PXP2_REG_RD_INIT_DONE 0x120370
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq10 */
#define PXP2_REG_RD_MAX_BLKS_VQ10 0x1203a0
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq11 */
#define PXP2_REG_RD_MAX_BLKS_VQ11 0x1203a4
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq17 */
#define PXP2_REG_RD_MAX_BLKS_VQ17 0x1203bc
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq18 */
#define PXP2_REG_RD_MAX_BLKS_VQ18 0x1203c0
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq19 */
#define PXP2_REG_RD_MAX_BLKS_VQ19 0x1203c4
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq22 */
#define PXP2_REG_RD_MAX_BLKS_VQ22 0x1203d0
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq25 */
#define PXP2_REG_RD_MAX_BLKS_VQ25 0x1203dc
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq6 */
#define PXP2_REG_RD_MAX_BLKS_VQ6 0x120390
/* [RW 8] The maximum number of blocks in Tetris Buffer that can be
allocated for vq9 */
#define PXP2_REG_RD_MAX_BLKS_VQ9 0x12039c
/* [RW 2] PBF byte swapping mode configuration for master read requests */
#define PXP2_REG_RD_PBF_SWAP_MODE 0x1203f4
/* [R 1] Debug only: Indication if delivery ports are idle */
#define PXP2_REG_RD_PORT_IS_IDLE_0 0x12041c
#define PXP2_REG_RD_PORT_IS_IDLE_1 0x120420
/* [RW 2] QM byte swapping mode configuration for master read requests */
#define PXP2_REG_RD_QM_SWAP_MODE 0x1203f8
/* [R 7] Debug only: The SR counter - number of unused sub request ids */
#define PXP2_REG_RD_SR_CNT 0x120414
/* [RW 2] SRC byte swapping mode configuration for master read requests */
#define PXP2_REG_RD_SRC_SWAP_MODE 0x120400
/* [RW 7] Debug only: Total number of available PCI read sub-requests. Must
be bigger than 1. Normally should not be changed. */
#define PXP2_REG_RD_SR_NUM_CFG 0x120408
/* [RW 1] Signals the PSWRD block to start initializing internal memories */
#define PXP2_REG_RD_START_INIT 0x12036c
/* [RW 2] TM byte swapping mode configuration for master read requests */
#define PXP2_REG_RD_TM_SWAP_MODE 0x1203fc
/* [RW 10] Bandwidth addition to VQ0 write requests */
#define PXP2_REG_RQ_BW_RD_ADD0 0x1201bc
/* [RW 10] Bandwidth addition to VQ12 read requests */
#define PXP2_REG_RQ_BW_RD_ADD12 0x1201ec
/* [RW 10] Bandwidth addition to VQ13 read requests */
#define PXP2_REG_RQ_BW_RD_ADD13 0x1201f0
/* [RW 10] Bandwidth addition to VQ14 read requests */
#define PXP2_REG_RQ_BW_RD_ADD14 0x1201f4
/* [RW 10] Bandwidth addition to VQ15 read requests */
#define PXP2_REG_RQ_BW_RD_ADD15 0x1201f8
/* [RW 10] Bandwidth addition to VQ16 read requests */
#define PXP2_REG_RQ_BW_RD_ADD16 0x1201fc
/* [RW 10] Bandwidth addition to VQ17 read requests */
#define PXP2_REG_RQ_BW_RD_ADD17 0x120200
/* [RW 10] Bandwidth addition to VQ18 read requests */
#define PXP2_REG_RQ_BW_RD_ADD18 0x120204
/* [RW 10] Bandwidth addition to VQ19 read requests */
#define PXP2_REG_RQ_BW_RD_ADD19 0x120208
/* [RW 10] Bandwidth addition to VQ20 read requests */
#define PXP2_REG_RQ_BW_RD_ADD20 0x12020c
/* [RW 10] Bandwidth addition to VQ22 read requests */
#define PXP2_REG_RQ_BW_RD_ADD22 0x120210
/* [RW 10] Bandwidth addition to VQ23 read requests */
#define PXP2_REG_RQ_BW_RD_ADD23 0x120214
/* [RW 10] Bandwidth addition to VQ24 read requests */
#define PXP2_REG_RQ_BW_RD_ADD24 0x120218
/* [RW 10] Bandwidth addition to VQ25 read requests */
#define PXP2_REG_RQ_BW_RD_ADD25 0x12021c
/* [RW 10] Bandwidth addition to VQ26 read requests */
#define PXP2_REG_RQ_BW_RD_ADD26 0x120220
/* [RW 10] Bandwidth addition to VQ27 read requests */
#define PXP2_REG_RQ_BW_RD_ADD27 0x120224
/* [RW 10] Bandwidth addition to VQ4 read requests */
#define PXP2_REG_RQ_BW_RD_ADD4 0x1201cc
/* [RW 10] Bandwidth addition to VQ5 read requests */
#define PXP2_REG_RQ_BW_RD_ADD5 0x1201d0
/* [RW 10] Bandwidth Typical L for VQ0 Read requests */
#define PXP2_REG_RQ_BW_RD_L0 0x1202ac
/* [RW 10] Bandwidth Typical L for VQ12 Read requests */
#define PXP2_REG_RQ_BW_RD_L12 0x1202dc
/* [RW 10] Bandwidth Typical L for VQ13 Read requests */
#define PXP2_REG_RQ_BW_RD_L13 0x1202e0
/* [RW 10] Bandwidth Typical L for VQ14 Read requests */
#define PXP2_REG_RQ_BW_RD_L14 0x1202e4
/* [RW 10] Bandwidth Typical L for VQ15 Read requests */
#define PXP2_REG_RQ_BW_RD_L15 0x1202e8
/* [RW 10] Bandwidth Typical L for VQ16 Read requests */
#define PXP2_REG_RQ_BW_RD_L16 0x1202ec
/* [RW 10] Bandwidth Typical L for VQ17 Read requests */
#define PXP2_REG_RQ_BW_RD_L17 0x1202f0
/* [RW 10] Bandwidth Typical L for VQ18 Read requests */
#define PXP2_REG_RQ_BW_RD_L18 0x1202f4
/* [RW 10] Bandwidth Typical L for VQ19 Read requests */
#define PXP2_REG_RQ_BW_RD_L19 0x1202f8
/* [RW 10] Bandwidth Typical L for VQ20 Read requests */
#define PXP2_REG_RQ_BW_RD_L20 0x1202fc
/* [RW 10] Bandwidth Typical L for VQ22 Read requests */
#define PXP2_REG_RQ_BW_RD_L22 0x120300
/* [RW 10] Bandwidth Typical L for VQ23 Read requests */
#define PXP2_REG_RQ_BW_RD_L23 0x120304
/* [RW 10] Bandwidth Typical L for VQ24 Read requests */
#define PXP2_REG_RQ_BW_RD_L24 0x120308
/* [RW 10] Bandwidth Typical L for VQ25 Read requests */
#define PXP2_REG_RQ_BW_RD_L25 0x12030c
/* [RW 10] Bandwidth Typical L for VQ26 Read requests */
#define PXP2_REG_RQ_BW_RD_L26 0x120310
/* [RW 10] Bandwidth Typical L for VQ27 Read requests */
#define PXP2_REG_RQ_BW_RD_L27 0x120314
/* [RW 10] Bandwidth Typical L for VQ4 Read requests */
#define PXP2_REG_RQ_BW_RD_L4 0x1202bc
/* [RW 10] Bandwidth Typical L for VQ5 Read- currently not used */
#define PXP2_REG_RQ_BW_RD_L5 0x1202c0
/* [RW 7] Bandwidth upper bound for VQ0 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND0 0x120234
/* [RW 7] Bandwidth upper bound for VQ12 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND12 0x120264
/* [RW 7] Bandwidth upper bound for VQ13 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND13 0x120268
/* [RW 7] Bandwidth upper bound for VQ14 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND14 0x12026c
/* [RW 7] Bandwidth upper bound for VQ15 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND15 0x120270
/* [RW 7] Bandwidth upper bound for VQ16 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND16 0x120274
/* [RW 7] Bandwidth upper bound for VQ17 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND17 0x120278
/* [RW 7] Bandwidth upper bound for VQ18 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND18 0x12027c
/* [RW 7] Bandwidth upper bound for VQ19 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND19 0x120280
/* [RW 7] Bandwidth upper bound for VQ20 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND20 0x120284
/* [RW 7] Bandwidth upper bound for VQ22 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND22 0x120288
/* [RW 7] Bandwidth upper bound for VQ23 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND23 0x12028c
/* [RW 7] Bandwidth upper bound for VQ24 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND24 0x120290
/* [RW 7] Bandwidth upper bound for VQ25 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND25 0x120294
/* [RW 7] Bandwidth upper bound for VQ26 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND26 0x120298
/* [RW 7] Bandwidth upper bound for VQ27 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND27 0x12029c
/* [RW 7] Bandwidth upper bound for VQ4 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND4 0x120244
/* [RW 7] Bandwidth upper bound for VQ5 read requests */
#define PXP2_REG_RQ_BW_RD_UBOUND5 0x120248
/* [RW 10] Bandwidth addition to VQ29 write requests */
#define PXP2_REG_RQ_BW_WR_ADD29 0x12022c
/* [RW 10] Bandwidth addition to VQ30 write requests */
#define PXP2_REG_RQ_BW_WR_ADD30 0x120230
/* [RW 10] Bandwidth Typical L for VQ29 Write requests */
#define PXP2_REG_RQ_BW_WR_L29 0x12031c
/* [RW 10] Bandwidth Typical L for VQ30 Write requests */
#define PXP2_REG_RQ_BW_WR_L30 0x120320
/* [RW 7] Bandwidth upper bound for VQ29 */
#define PXP2_REG_RQ_BW_WR_UBOUND29 0x1202a4
/* [RW 7] Bandwidth upper bound for VQ30 */
#define PXP2_REG_RQ_BW_WR_UBOUND30 0x1202a8
/* [RW 18] external first_mem_addr field in L2P table for CDU module port 0 */
#define PXP2_REG_RQ_CDU0_EFIRST_MEM_ADDR 0x120008
/* [RW 2] Endian mode for cdu */
#define PXP2_REG_RQ_CDU_ENDIAN_M 0x1201a0
#define PXP2_REG_RQ_CDU_FIRST_ILT 0x12061c
#define PXP2_REG_RQ_CDU_LAST_ILT 0x120620
/* [RW 3] page size in L2P table for CDU module; -4k; -8k; -16k; -32k; -64k;
-128k */
#define PXP2_REG_RQ_CDU_P_SIZE 0x120018
/* [R 1] 1' indicates that the requester has finished its internal
configuration */
#define PXP2_REG_RQ_CFG_DONE 0x1201b4
/* [RW 2] Endian mode for debug */
#define PXP2_REG_RQ_DBG_ENDIAN_M 0x1201a4
/* [RW 1] When '1'; requests will enter input buffers but wont get out
towards the glue */
#define PXP2_REG_RQ_DISABLE_INPUTS 0x120330
/* [RW 1] 1 - SR will be aligned by 64B; 0 - SR will be aligned by 8B */
#define PXP2_REG_RQ_DRAM_ALIGN 0x1205b0
/* [RW 1] If 1 ILT failiue will not result in ELT access; An interrupt will
be asserted */
#define PXP2_REG_RQ_ELT_DISABLE 0x12066c
/* [RW 2] Endian mode for hc */
#define PXP2_REG_RQ_HC_ENDIAN_M 0x1201a8
/* [RW 1] when '0' ILT logic will work as in A0; otherwise B0; for back
compatibility needs; Note that different registers are used per mode */
#define PXP2_REG_RQ_ILT_MODE 0x1205b4
/* [WB 53] Onchip address table */
#define PXP2_REG_RQ_ONCHIP_AT 0x122000
/* [WB 53] Onchip address table - B0 */
#define PXP2_REG_RQ_ONCHIP_AT_B0 0x128000
/* [RW 13] Pending read limiter threshold; in Dwords */
#define PXP2_REG_RQ_PDR_LIMIT 0x12033c
/* [RW 2] Endian mode for qm */
#define PXP2_REG_RQ_QM_ENDIAN_M 0x120194
#define PXP2_REG_RQ_QM_FIRST_ILT 0x120634
#define PXP2_REG_RQ_QM_LAST_ILT 0x120638
/* [RW 3] page size in L2P table for QM module; -4k; -8k; -16k; -32k; -64k;
-128k */
#define PXP2_REG_RQ_QM_P_SIZE 0x120050
/* [RW 1] 1' indicates that the RBC has finished configuring the PSWRQ */
#define PXP2_REG_RQ_RBC_DONE 0x1201b0
/* [RW 3] Max burst size filed for read requests port 0; 000 - 128B;
001:256B; 010: 512B; 11:1K:100:2K; 01:4K */
#define PXP2_REG_RQ_RD_MBS0 0x120160
/* [RW 3] Max burst size filed for read requests port 1; 000 - 128B;
001:256B; 010: 512B; 11:1K:100:2K; 01:4K */
#define PXP2_REG_RQ_RD_MBS1 0x120168
/* [RW 2] Endian mode for src */
#define PXP2_REG_RQ_SRC_ENDIAN_M 0x12019c
#define PXP2_REG_RQ_SRC_FIRST_ILT 0x12063c
#define PXP2_REG_RQ_SRC_LAST_ILT 0x120640
/* [RW 3] page size in L2P table for SRC module; -4k; -8k; -16k; -32k; -64k;
-128k */
#define PXP2_REG_RQ_SRC_P_SIZE 0x12006c
/* [RW 2] Endian mode for tm */
#define PXP2_REG_RQ_TM_ENDIAN_M 0x120198
#define PXP2_REG_RQ_TM_FIRST_ILT 0x120644
#define PXP2_REG_RQ_TM_LAST_ILT 0x120648
/* [RW 3] page size in L2P table for TM module; -4k; -8k; -16k; -32k; -64k;
-128k */
#define PXP2_REG_RQ_TM_P_SIZE 0x120034
/* [R 5] Number of entries in the ufifo; his fifo has l2p completions */
#define PXP2_REG_RQ_UFIFO_NUM_OF_ENTRY 0x12080c
/* [RW 18] external first_mem_addr field in L2P table for USDM module port 0 */
#define PXP2_REG_RQ_USDM0_EFIRST_MEM_ADDR 0x120094
/* [R 8] Number of entries occupied by vq 0 in pswrq memory */
#define PXP2_REG_RQ_VQ0_ENTRY_CNT 0x120810
/* [R 8] Number of entries occupied by vq 10 in pswrq memory */
#define PXP2_REG_RQ_VQ10_ENTRY_CNT 0x120818
/* [R 8] Number of entries occupied by vq 11 in pswrq memory */
#define PXP2_REG_RQ_VQ11_ENTRY_CNT 0x120820
/* [R 8] Number of entries occupied by vq 12 in pswrq memory */
#define PXP2_REG_RQ_VQ12_ENTRY_CNT 0x120828
/* [R 8] Number of entries occupied by vq 13 in pswrq memory */
#define PXP2_REG_RQ_VQ13_ENTRY_CNT 0x120830
/* [R 8] Number of entries occupied by vq 14 in pswrq memory */
#define PXP2_REG_RQ_VQ14_ENTRY_CNT 0x120838
/* [R 8] Number of entries occupied by vq 15 in pswrq memory */
#define PXP2_REG_RQ_VQ15_ENTRY_CNT 0x120840
/* [R 8] Number of entries occupied by vq 16 in pswrq memory */
#define PXP2_REG_RQ_VQ16_ENTRY_CNT 0x120848
/* [R 8] Number of entries occupied by vq 17 in pswrq memory */
#define PXP2_REG_RQ_VQ17_ENTRY_CNT 0x120850
/* [R 8] Number of entries occupied by vq 18 in pswrq memory */
#define PXP2_REG_RQ_VQ18_ENTRY_CNT 0x120858
/* [R 8] Number of entries occupied by vq 19 in pswrq memory */
#define PXP2_REG_RQ_VQ19_ENTRY_CNT 0x120860
/* [R 8] Number of entries occupied by vq 1 in pswrq memory */
#define PXP2_REG_RQ_VQ1_ENTRY_CNT 0x120868
/* [R 8] Number of entries occupied by vq 20 in pswrq memory */
#define PXP2_REG_RQ_VQ20_ENTRY_CNT 0x120870
/* [R 8] Number of entries occupied by vq 21 in pswrq memory */
#define PXP2_REG_RQ_VQ21_ENTRY_CNT 0x120878
/* [R 8] Number of entries occupied by vq 22 in pswrq memory */
#define PXP2_REG_RQ_VQ22_ENTRY_CNT 0x120880
/* [R 8] Number of entries occupied by vq 23 in pswrq memory */
#define PXP2_REG_RQ_VQ23_ENTRY_CNT 0x120888
/* [R 8] Number of entries occupied by vq 24 in pswrq memory */
#define PXP2_REG_RQ_VQ24_ENTRY_CNT 0x120890
/* [R 8] Number of entries occupied by vq 25 in pswrq memory */
#define PXP2_REG_RQ_VQ25_ENTRY_CNT 0x120898
/* [R 8] Number of entries occupied by vq 26 in pswrq memory */
#define PXP2_REG_RQ_VQ26_ENTRY_CNT 0x1208a0
/* [R 8] Number of entries occupied by vq 27 in pswrq memory */
#define PXP2_REG_RQ_VQ27_ENTRY_CNT 0x1208a8
/* [R 8] Number of entries occupied by vq 28 in pswrq memory */
#define PXP2_REG_RQ_VQ28_ENTRY_CNT 0x1208b0
/* [R 8] Number of entries occupied by vq 29 in pswrq memory */
#define PXP2_REG_RQ_VQ29_ENTRY_CNT 0x1208b8
/* [R 8] Number of entries occupied by vq 2 in pswrq memory */
#define PXP2_REG_RQ_VQ2_ENTRY_CNT 0x1208c0
/* [R 8] Number of entries occupied by vq 30 in pswrq memory */
#define PXP2_REG_RQ_VQ30_ENTRY_CNT 0x1208c8
/* [R 8] Number of entries occupied by vq 31 in pswrq memory */
#define PXP2_REG_RQ_VQ31_ENTRY_CNT 0x1208d0
/* [R 8] Number of entries occupied by vq 3 in pswrq memory */
#define PXP2_REG_RQ_VQ3_ENTRY_CNT 0x1208d8
/* [R 8] Number of entries occupied by vq 4 in pswrq memory */
#define PXP2_REG_RQ_VQ4_ENTRY_CNT 0x1208e0
/* [R 8] Number of entries occupied by vq 5 in pswrq memory */
#define PXP2_REG_RQ_VQ5_ENTRY_CNT 0x1208e8
/* [R 8] Number of entries occupied by vq 6 in pswrq memory */
#define PXP2_REG_RQ_VQ6_ENTRY_CNT 0x1208f0
/* [R 8] Number of entries occupied by vq 7 in pswrq memory */
#define PXP2_REG_RQ_VQ7_ENTRY_CNT 0x1208f8
/* [R 8] Number of entries occupied by vq 8 in pswrq memory */
#define PXP2_REG_RQ_VQ8_ENTRY_CNT 0x120900
/* [R 8] Number of entries occupied by vq 9 in pswrq memory */
#define PXP2_REG_RQ_VQ9_ENTRY_CNT 0x120908
/* [RW 3] Max burst size filed for write requests port 0; 000 - 128B;
001:256B; 010: 512B; */
#define PXP2_REG_RQ_WR_MBS0 0x12015c
/* [RW 3] Max burst size filed for write requests port 1; 000 - 128B;
001:256B; 010: 512B; */
#define PXP2_REG_RQ_WR_MBS1 0x120164
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_CDU_MPS 0x1205f0
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_CSDM_MPS 0x1205d0
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_DBG_MPS 0x1205e8
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_DMAE_MPS 0x1205ec
/* [RW 10] if Number of entries in dmae fifo will be higher than this
threshold then has_payload indication will be asserted; the default value
should be equal to > write MBS size! */
#define PXP2_REG_WR_DMAE_TH 0x120368
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_HC_MPS 0x1205c8
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_QM_MPS 0x1205dc
/* [RW 1] 0 - working in A0 mode; - working in B0 mode */
#define PXP2_REG_WR_REV_MODE 0x120670
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_SRC_MPS 0x1205e4
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_TM_MPS 0x1205e0
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_TSDM_MPS 0x1205d4
/* [RW 10] if Number of entries in usdmdp fifo will be higher than this
threshold then has_payload indication will be asserted; the default value
should be equal to > write MBS size! */
#define PXP2_REG_WR_USDMDP_TH 0x120348
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_USDM_MPS 0x1205cc
/* [RW 2] 0 - 128B; - 256B; - 512B; - 1024B; when the payload in the
buffer reaches this number has_payload will be asserted */
#define PXP2_REG_WR_XSDM_MPS 0x1205d8
/* [R 1] debug only: Indication if PSWHST arbiter is idle */
#define PXP_REG_HST_ARB_IS_IDLE 0x103004
/* [R 8] debug only: A bit mask for all PSWHST arbiter clients. '1' means
this client is waiting for the arbiter. */
#define PXP_REG_HST_CLIENTS_WAITING_TO_ARB 0x103008
/* [R 1] debug only: '1' means this PSWHST is discarding doorbells. This bit
should update accoring to 'hst_discard_doorbells' register when the state
machine is idle */
#define PXP_REG_HST_DISCARD_DOORBELLS_STATUS 0x1030a0
/* [R 6] debug only: A bit mask for all PSWHST internal write clients. '1'
means this PSWHST is discarding inputs from this client. Each bit should
update accoring to 'hst_discard_internal_writes' register when the state
machine is idle. */
#define PXP_REG_HST_DISCARD_INTERNAL_WRITES_STATUS 0x10309c
/* [WB 160] Used for initialization of the inbound interrupts memory */
#define PXP_REG_HST_INBOUND_INT 0x103800
/* [RW 32] Interrupt mask register #0 read/write */
#define PXP_REG_PXP_INT_MASK_0 0x103074
#define PXP_REG_PXP_INT_MASK_1 0x103084
/* [R 32] Interrupt register #0 read */
#define PXP_REG_PXP_INT_STS_0 0x103068
#define PXP_REG_PXP_INT_STS_1 0x103078
/* [RC 32] Interrupt register #0 read clear */
#define PXP_REG_PXP_INT_STS_CLR_0 0x10306c
/* [RW 26] Parity mask register #0 read/write */
#define PXP_REG_PXP_PRTY_MASK 0x103094
/* [R 26] Parity register #0 read */
#define PXP_REG_PXP_PRTY_STS 0x103088
/* [RW 4] The activity counter initial increment value sent in the load
request */
#define QM_REG_ACTCTRINITVAL_0 0x168040
#define QM_REG_ACTCTRINITVAL_1 0x168044
#define QM_REG_ACTCTRINITVAL_2 0x168048
#define QM_REG_ACTCTRINITVAL_3 0x16804c
/* [RW 32] The base logical address (in bytes) of each physical queue. The
index I represents the physical queue number. The 12 lsbs are ignore and
considered zero so practically there are only 20 bits in this register;
queues 63-0 */
#define QM_REG_BASEADDR 0x168900
/* [RW 32] The base logical address (in bytes) of each physical queue. The
index I represents the physical queue number. The 12 lsbs are ignore and
considered zero so practically there are only 20 bits in this register;
queues 127-64 */
#define QM_REG_BASEADDR_EXT_A 0x16e100
/* [RW 16] The byte credit cost for each task. This value is for both ports */
#define QM_REG_BYTECRDCOST 0x168234
/* [RW 16] The initial byte credit value for both ports. */
#define QM_REG_BYTECRDINITVAL 0x168238
/* [RW 32] A bit per physical queue. If the bit is cleared then the physical
queue uses port 0 else it uses port 1; queues 31-0 */
#define QM_REG_BYTECRDPORT_LSB 0x168228
/* [RW 32] A bit per physical queue. If the bit is cleared then the physical
queue uses port 0 else it uses port 1; queues 95-64 */
#define QM_REG_BYTECRDPORT_LSB_EXT_A 0x16e520
/* [RW 32] A bit per physical queue. If the bit is cleared then the physical
queue uses port 0 else it uses port 1; queues 63-32 */
#define QM_REG_BYTECRDPORT_MSB 0x168224
/* [RW 32] A bit per physical queue. If the bit is cleared then the physical
queue uses port 0 else it uses port 1; queues 127-96 */
#define QM_REG_BYTECRDPORT_MSB_EXT_A 0x16e51c
/* [RW 16] The byte credit value that if above the QM is considered almost
full */
#define QM_REG_BYTECREDITAFULLTHR 0x168094
/* [RW 4] The initial credit for interface */
#define QM_REG_CMINITCRD_0 0x1680cc
#define QM_REG_CMINITCRD_1 0x1680d0
#define QM_REG_CMINITCRD_2 0x1680d4
#define QM_REG_CMINITCRD_3 0x1680d8
#define QM_REG_CMINITCRD_4 0x1680dc
#define QM_REG_CMINITCRD_5 0x1680e0
#define QM_REG_CMINITCRD_6 0x1680e4
#define QM_REG_CMINITCRD_7 0x1680e8
/* [RW 8] A mask bit per CM interface. If this bit is 0 then this interface
is masked */
#define QM_REG_CMINTEN 0x1680ec
/* [RW 12] A bit vector which indicates which one of the queues are tied to
interface 0 */
#define QM_REG_CMINTVOQMASK_0 0x1681f4
#define QM_REG_CMINTVOQMASK_1 0x1681f8
#define QM_REG_CMINTVOQMASK_2 0x1681fc
#define QM_REG_CMINTVOQMASK_3 0x168200
#define QM_REG_CMINTVOQMASK_4 0x168204
#define QM_REG_CMINTVOQMASK_5 0x168208
#define QM_REG_CMINTVOQMASK_6 0x16820c
#define QM_REG_CMINTVOQMASK_7 0x168210
/* [RW 20] The number of connections divided by 16 which dictates the size
of each queue which belongs to even function number. */
#define QM_REG_CONNNUM_0 0x168020
/* [R 6] Keep the fill level of the fifo from write client 4 */
#define QM_REG_CQM_WRC_FIFOLVL 0x168018
/* [RW 8] The context regions sent in the CFC load request */
#define QM_REG_CTXREG_0 0x168030
#define QM_REG_CTXREG_1 0x168034
#define QM_REG_CTXREG_2 0x168038
#define QM_REG_CTXREG_3 0x16803c
/* [RW 12] The VOQ mask used to select the VOQs which needs to be full for
bypass enable */
#define QM_REG_ENBYPVOQMASK 0x16823c
/* [RW 32] A bit mask per each physical queue. If a bit is set then the
physical queue uses the byte credit; queues 31-0 */
#define QM_REG_ENBYTECRD_LSB 0x168220
/* [RW 32] A bit mask per each physical queue. If a bit is set then the
physical queue uses the byte credit; queues 95-64 */
#define QM_REG_ENBYTECRD_LSB_EXT_A 0x16e518
/* [RW 32] A bit mask per each physical queue. If a bit is set then the
physical queue uses the byte credit; queues 63-32 */
#define QM_REG_ENBYTECRD_MSB 0x16821c
/* [RW 32] A bit mask per each physical queue. If a bit is set then the
physical queue uses the byte credit; queues 127-96 */
#define QM_REG_ENBYTECRD_MSB_EXT_A 0x16e514
/* [RW 4] If cleared then the secondary interface will not be served by the
RR arbiter */
#define QM_REG_ENSEC 0x1680f0
/* [RW 32] NA */
#define QM_REG_FUNCNUMSEL_LSB 0x168230
/* [RW 32] NA */
#define QM_REG_FUNCNUMSEL_MSB 0x16822c
/* [RW 32] A mask register to mask the Almost empty signals which will not
be use for the almost empty indication to the HW block; queues 31:0 */
#define QM_REG_HWAEMPTYMASK_LSB 0x168218
/* [RW 32] A mask register to mask the Almost empty signals which will not
be use for the almost empty indication to the HW block; queues 95-64 */
#define QM_REG_HWAEMPTYMASK_LSB_EXT_A 0x16e510
/* [RW 32] A mask register to mask the Almost empty signals which will not
be use for the almost empty indication to the HW block; queues 63:32 */
#define QM_REG_HWAEMPTYMASK_MSB 0x168214
/* [RW 32] A mask register to mask the Almost empty signals which will not
be use for the almost empty indication to the HW block; queues 127-96 */
#define QM_REG_HWAEMPTYMASK_MSB_EXT_A 0x16e50c
/* [RW 4] The number of outstanding request to CFC */
#define QM_REG_OUTLDREQ 0x168804
/* [RC 1] A flag to indicate that overflow error occurred in one of the
queues. */
#define QM_REG_OVFERROR 0x16805c
/* [RC 7] the Q were the qverflow occurs */
#define QM_REG_OVFQNUM 0x168058
/* [R 16] Pause state for physical queues 15-0 */
#define QM_REG_PAUSESTATE0 0x168410
/* [R 16] Pause state for physical queues 31-16 */
#define QM_REG_PAUSESTATE1 0x168414
/* [R 16] Pause state for physical queues 47-32 */
#define QM_REG_PAUSESTATE2 0x16e684
/* [R 16] Pause state for physical queues 63-48 */
#define QM_REG_PAUSESTATE3 0x16e688
/* [R 16] Pause state for physical queues 79-64 */
#define QM_REG_PAUSESTATE4 0x16e68c
/* [R 16] Pause state for physical queues 95-80 */
#define QM_REG_PAUSESTATE5 0x16e690
/* [R 16] Pause state for physical queues 111-96 */
#define QM_REG_PAUSESTATE6 0x16e694
/* [R 16] Pause state for physical queues 127-112 */
#define QM_REG_PAUSESTATE7 0x16e698
/* [RW 2] The PCI attributes field used in the PCI request. */
#define QM_REG_PCIREQAT 0x168054
/* [R 16] The byte credit of port 0 */
#define QM_REG_PORT0BYTECRD 0x168300
/* [R 16] The byte credit of port 1 */
#define QM_REG_PORT1BYTECRD 0x168304
/* [RW 3] pci function number of queues 15-0 */
#define QM_REG_PQ2PCIFUNC_0 0x16e6bc
#define QM_REG_PQ2PCIFUNC_1 0x16e6c0
#define QM_REG_PQ2PCIFUNC_2 0x16e6c4
#define QM_REG_PQ2PCIFUNC_3 0x16e6c8
#define QM_REG_PQ2PCIFUNC_4 0x16e6cc
#define QM_REG_PQ2PCIFUNC_5 0x16e6d0
#define QM_REG_PQ2PCIFUNC_6 0x16e6d4
#define QM_REG_PQ2PCIFUNC_7 0x16e6d8
/* [WB 54] Pointer Table Memory for queues 63-0; The mapping is as follow:
ptrtbl[53:30] read pointer; ptrtbl[29:6] write pointer; ptrtbl[5:4] read
bank0; ptrtbl[3:2] read bank 1; ptrtbl[1:0] write bank; */
#define QM_REG_PTRTBL 0x168a00
/* [WB 54] Pointer Table Memory for queues 127-64; The mapping is as follow:
ptrtbl[53:30] read pointer; ptrtbl[29:6] write pointer; ptrtbl[5:4] read
bank0; ptrtbl[3:2] read bank 1; ptrtbl[1:0] write bank; */
#define QM_REG_PTRTBL_EXT_A 0x16e200
/* [RW 2] Interrupt mask register #0 read/write */
#define QM_REG_QM_INT_MASK 0x168444
/* [R 2] Interrupt register #0 read */
#define QM_REG_QM_INT_STS 0x168438
/* [RW 12] Parity mask register #0 read/write */
#define QM_REG_QM_PRTY_MASK 0x168454
/* [R 12] Parity register #0 read */
#define QM_REG_QM_PRTY_STS 0x168448
/* [R 32] Current queues in pipeline: Queues from 32 to 63 */
#define QM_REG_QSTATUS_HIGH 0x16802c
/* [R 32] Current queues in pipeline: Queues from 96 to 127 */
#define QM_REG_QSTATUS_HIGH_EXT_A 0x16e408
/* [R 32] Current queues in pipeline: Queues from 0 to 31 */
#define QM_REG_QSTATUS_LOW 0x168028
/* [R 32] Current queues in pipeline: Queues from 64 to 95 */
#define QM_REG_QSTATUS_LOW_EXT_A 0x16e404
/* [R 24] The number of tasks queued for each queue; queues 63-0 */
#define QM_REG_QTASKCTR_0 0x168308
/* [R 24] The number of tasks queued for each queue; queues 127-64 */
#define QM_REG_QTASKCTR_EXT_A_0 0x16e584
/* [RW 4] Queue tied to VOQ */
#define QM_REG_QVOQIDX_0 0x1680f4
#define QM_REG_QVOQIDX_10 0x16811c
#define QM_REG_QVOQIDX_100 0x16e49c
#define QM_REG_QVOQIDX_101 0x16e4a0
#define QM_REG_QVOQIDX_102 0x16e4a4
#define QM_REG_QVOQIDX_103 0x16e4a8
#define QM_REG_QVOQIDX_104 0x16e4ac
#define QM_REG_QVOQIDX_105 0x16e4b0
#define QM_REG_QVOQIDX_106 0x16e4b4
#define QM_REG_QVOQIDX_107 0x16e4b8
#define QM_REG_QVOQIDX_108 0x16e4bc
#define QM_REG_QVOQIDX_109 0x16e4c0
#define QM_REG_QVOQIDX_11 0x168120
#define QM_REG_QVOQIDX_110 0x16e4c4
#define QM_REG_QVOQIDX_111 0x16e4c8
#define QM_REG_QVOQIDX_112 0x16e4cc
#define QM_REG_QVOQIDX_113 0x16e4d0
#define QM_REG_QVOQIDX_114 0x16e4d4
#define QM_REG_QVOQIDX_115 0x16e4d8
#define QM_REG_QVOQIDX_116 0x16e4dc
#define QM_REG_QVOQIDX_117 0x16e4e0
#define QM_REG_QVOQIDX_118 0x16e4e4
#define QM_REG_QVOQIDX_119 0x16e4e8
#define QM_REG_QVOQIDX_12 0x168124
#define QM_REG_QVOQIDX_120 0x16e4ec
#define QM_REG_QVOQIDX_121 0x16e4f0
#define QM_REG_QVOQIDX_122 0x16e4f4
#define QM_REG_QVOQIDX_123 0x16e4f8
#define QM_REG_QVOQIDX_124 0x16e4fc
#define QM_REG_QVOQIDX_125 0x16e500
#define QM_REG_QVOQIDX_126 0x16e504
#define QM_REG_QVOQIDX_127 0x16e508
#define QM_REG_QVOQIDX_13 0x168128
#define QM_REG_QVOQIDX_14 0x16812c
#define QM_REG_QVOQIDX_15 0x168130
#define QM_REG_QVOQIDX_16 0x168134
#define QM_REG_QVOQIDX_17 0x168138
#define QM_REG_QVOQIDX_21 0x168148
#define QM_REG_QVOQIDX_22 0x16814c
#define QM_REG_QVOQIDX_23 0x168150
#define QM_REG_QVOQIDX_24 0x168154
#define QM_REG_QVOQIDX_25 0x168158
#define QM_REG_QVOQIDX_26 0x16815c
#define QM_REG_QVOQIDX_27 0x168160
#define QM_REG_QVOQIDX_28 0x168164
#define QM_REG_QVOQIDX_29 0x168168
#define QM_REG_QVOQIDX_30 0x16816c
#define QM_REG_QVOQIDX_31 0x168170
#define QM_REG_QVOQIDX_32 0x168174
#define QM_REG_QVOQIDX_33 0x168178
#define QM_REG_QVOQIDX_34 0x16817c
#define QM_REG_QVOQIDX_35 0x168180
#define QM_REG_QVOQIDX_36 0x168184
#define QM_REG_QVOQIDX_37 0x168188
#define QM_REG_QVOQIDX_38 0x16818c
#define QM_REG_QVOQIDX_39 0x168190
#define QM_REG_QVOQIDX_40 0x168194
#define QM_REG_QVOQIDX_41 0x168198
#define QM_REG_QVOQIDX_42 0x16819c
#define QM_REG_QVOQIDX_43 0x1681a0
#define QM_REG_QVOQIDX_44 0x1681a4
#define QM_REG_QVOQIDX_45 0x1681a8
#define QM_REG_QVOQIDX_46 0x1681ac
#define QM_REG_QVOQIDX_47 0x1681b0
#define QM_REG_QVOQIDX_48 0x1681b4
#define QM_REG_QVOQIDX_49 0x1681b8
#define QM_REG_QVOQIDX_5 0x168108
#define QM_REG_QVOQIDX_50 0x1681bc
#define QM_REG_QVOQIDX_51 0x1681c0
#define QM_REG_QVOQIDX_52 0x1681c4
#define QM_REG_QVOQIDX_53 0x1681c8
#define QM_REG_QVOQIDX_54 0x1681cc
#define QM_REG_QVOQIDX_55 0x1681d0
#define QM_REG_QVOQIDX_56 0x1681d4
#define QM_REG_QVOQIDX_57 0x1681d8
#define QM_REG_QVOQIDX_58 0x1681dc
#define QM_REG_QVOQIDX_59 0x1681e0
#define QM_REG_QVOQIDX_6 0x16810c
#define QM_REG_QVOQIDX_60 0x1681e4
#define QM_REG_QVOQIDX_61 0x1681e8
#define QM_REG_QVOQIDX_62 0x1681ec
#define QM_REG_QVOQIDX_63 0x1681f0
#define QM_REG_QVOQIDX_64 0x16e40c
#define QM_REG_QVOQIDX_65 0x16e410
#define QM_REG_QVOQIDX_69 0x16e420
#define QM_REG_QVOQIDX_7 0x168110
#define QM_REG_QVOQIDX_70 0x16e424
#define QM_REG_QVOQIDX_71 0x16e428
#define QM_REG_QVOQIDX_72 0x16e42c
#define QM_REG_QVOQIDX_73 0x16e430
#define QM_REG_QVOQIDX_74 0x16e434
#define QM_REG_QVOQIDX_75 0x16e438
#define QM_REG_QVOQIDX_76 0x16e43c
#define QM_REG_QVOQIDX_77 0x16e440
#define QM_REG_QVOQIDX_78 0x16e444
#define QM_REG_QVOQIDX_79 0x16e448
#define QM_REG_QVOQIDX_8 0x168114
#define QM_REG_QVOQIDX_80 0x16e44c
#define QM_REG_QVOQIDX_81 0x16e450
#define QM_REG_QVOQIDX_85 0x16e460
#define QM_REG_QVOQIDX_86 0x16e464
#define QM_REG_QVOQIDX_87 0x16e468
#define QM_REG_QVOQIDX_88 0x16e46c
#define QM_REG_QVOQIDX_89 0x16e470
#define QM_REG_QVOQIDX_9 0x168118
#define QM_REG_QVOQIDX_90 0x16e474
#define QM_REG_QVOQIDX_91 0x16e478
#define QM_REG_QVOQIDX_92 0x16e47c
#define QM_REG_QVOQIDX_93 0x16e480
#define QM_REG_QVOQIDX_94 0x16e484
#define QM_REG_QVOQIDX_95 0x16e488
#define QM_REG_QVOQIDX_96 0x16e48c
#define QM_REG_QVOQIDX_97 0x16e490
#define QM_REG_QVOQIDX_98 0x16e494
#define QM_REG_QVOQIDX_99 0x16e498
/* [RW 1] Initialization bit command */
#define QM_REG_SOFT_RESET 0x168428
/* [RW 8] The credit cost per every task in the QM. A value per each VOQ */
#define QM_REG_TASKCRDCOST_0 0x16809c
#define QM_REG_TASKCRDCOST_1 0x1680a0
#define QM_REG_TASKCRDCOST_2 0x1680a4
#define QM_REG_TASKCRDCOST_4 0x1680ac
#define QM_REG_TASKCRDCOST_5 0x1680b0
/* [R 6] Keep the fill level of the fifo from write client 3 */
#define QM_REG_TQM_WRC_FIFOLVL 0x168010
/* [R 6] Keep the fill level of the fifo from write client 2 */
#define QM_REG_UQM_WRC_FIFOLVL 0x168008
/* [RC 32] Credit update error register */
#define QM_REG_VOQCRDERRREG 0x168408
/* [R 16] The credit value for each VOQ */
#define QM_REG_VOQCREDIT_0 0x1682d0
#define QM_REG_VOQCREDIT_1 0x1682d4
#define QM_REG_VOQCREDIT_4 0x1682e0
/* [RW 16] The credit value that if above the QM is considered almost full */
#define QM_REG_VOQCREDITAFULLTHR 0x168090
/* [RW 16] The init and maximum credit for each VoQ */
#define QM_REG_VOQINITCREDIT_0 0x168060
#define QM_REG_VOQINITCREDIT_1 0x168064
#define QM_REG_VOQINITCREDIT_2 0x168068
#define QM_REG_VOQINITCREDIT_4 0x168070
#define QM_REG_VOQINITCREDIT_5 0x168074
/* [RW 1] The port of which VOQ belongs */
#define QM_REG_VOQPORT_0 0x1682a0
#define QM_REG_VOQPORT_1 0x1682a4
#define QM_REG_VOQPORT_2 0x1682a8
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_0_LSB 0x168240
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_0_LSB_EXT_A 0x16e524
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_0_MSB 0x168244
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_0_MSB_EXT_A 0x16e528
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_10_LSB 0x168290
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_10_LSB_EXT_A 0x16e574
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_10_MSB 0x168294
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_10_MSB_EXT_A 0x16e578
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_11_LSB 0x168298
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_11_LSB_EXT_A 0x16e57c
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_11_MSB 0x16829c
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_11_MSB_EXT_A 0x16e580
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_1_LSB 0x168248
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_1_LSB_EXT_A 0x16e52c
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_1_MSB 0x16824c
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_1_MSB_EXT_A 0x16e530
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_2_LSB 0x168250
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_2_LSB_EXT_A 0x16e534
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_2_MSB 0x168254
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_2_MSB_EXT_A 0x16e538
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_3_LSB 0x168258
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_3_LSB_EXT_A 0x16e53c
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_3_MSB_EXT_A 0x16e540
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_4_LSB 0x168260
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_4_LSB_EXT_A 0x16e544
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_4_MSB 0x168264
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_4_MSB_EXT_A 0x16e548
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_5_LSB 0x168268
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_5_LSB_EXT_A 0x16e54c
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_5_MSB 0x16826c
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_5_MSB_EXT_A 0x16e550
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_6_LSB 0x168270
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_6_LSB_EXT_A 0x16e554
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_6_MSB 0x168274
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_6_MSB_EXT_A 0x16e558
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_7_LSB 0x168278
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_7_LSB_EXT_A 0x16e55c
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_7_MSB 0x16827c
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_7_MSB_EXT_A 0x16e560
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_8_LSB 0x168280
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_8_LSB_EXT_A 0x16e564
/* [RW 32] The physical queue number associated with each VOQ; queues 63-32 */
#define QM_REG_VOQQMASK_8_MSB 0x168284
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_8_MSB_EXT_A 0x16e568
/* [RW 32] The physical queue number associated with each VOQ; queues 31-0 */
#define QM_REG_VOQQMASK_9_LSB 0x168288
/* [RW 32] The physical queue number associated with each VOQ; queues 95-64 */
#define QM_REG_VOQQMASK_9_LSB_EXT_A 0x16e56c
/* [RW 32] The physical queue number associated with each VOQ; queues 127-96 */
#define QM_REG_VOQQMASK_9_MSB_EXT_A 0x16e570
/* [RW 32] Wrr weights */
#define QM_REG_WRRWEIGHTS_0 0x16880c
#define QM_REG_WRRWEIGHTS_1 0x168810
#define QM_REG_WRRWEIGHTS_10 0x168814
#define QM_REG_WRRWEIGHTS_11 0x168818
#define QM_REG_WRRWEIGHTS_12 0x16881c
#define QM_REG_WRRWEIGHTS_13 0x168820
#define QM_REG_WRRWEIGHTS_14 0x168824
#define QM_REG_WRRWEIGHTS_15 0x168828
#define QM_REG_WRRWEIGHTS_16 0x16e000
#define QM_REG_WRRWEIGHTS_17 0x16e004
#define QM_REG_WRRWEIGHTS_18 0x16e008
#define QM_REG_WRRWEIGHTS_19 0x16e00c
#define QM_REG_WRRWEIGHTS_2 0x16882c
#define QM_REG_WRRWEIGHTS_20 0x16e010
#define QM_REG_WRRWEIGHTS_21 0x16e014
#define QM_REG_WRRWEIGHTS_22 0x16e018
#define QM_REG_WRRWEIGHTS_23 0x16e01c
#define QM_REG_WRRWEIGHTS_24 0x16e020
#define QM_REG_WRRWEIGHTS_25 0x16e024
#define QM_REG_WRRWEIGHTS_26 0x16e028
#define QM_REG_WRRWEIGHTS_27 0x16e02c
#define QM_REG_WRRWEIGHTS_28 0x16e030
#define QM_REG_WRRWEIGHTS_29 0x16e034
#define QM_REG_WRRWEIGHTS_3 0x168830
#define QM_REG_WRRWEIGHTS_30 0x16e038
#define QM_REG_WRRWEIGHTS_31 0x16e03c
#define QM_REG_WRRWEIGHTS_4 0x168834
#define QM_REG_WRRWEIGHTS_5 0x168838
#define QM_REG_WRRWEIGHTS_6 0x16883c
#define QM_REG_WRRWEIGHTS_7 0x168840
#define QM_REG_WRRWEIGHTS_8 0x168844
#define QM_REG_WRRWEIGHTS_9 0x168848
/* [R 6] Keep the fill level of the fifo from write client 1 */
#define QM_REG_XQM_WRC_FIFOLVL 0x168000
#define SRC_REG_COUNTFREE0 0x40500
/* [RW 1] If clr the searcher is compatible to E1 A0 - support only two
ports. If set the searcher support 8 functions. */
#define SRC_REG_E1HMF_ENABLE 0x404cc
#define SRC_REG_FIRSTFREE0 0x40510
#define SRC_REG_KEYRSS0_0 0x40408
#define SRC_REG_KEYRSS0_7 0x40424
#define SRC_REG_KEYRSS1_9 0x40454
#define SRC_REG_KEYSEARCH_0 0x40458
#define SRC_REG_KEYSEARCH_1 0x4045c
#define SRC_REG_KEYSEARCH_2 0x40460
#define SRC_REG_KEYSEARCH_3 0x40464
#define SRC_REG_KEYSEARCH_4 0x40468
#define SRC_REG_KEYSEARCH_5 0x4046c
#define SRC_REG_KEYSEARCH_6 0x40470
#define SRC_REG_KEYSEARCH_7 0x40474
#define SRC_REG_KEYSEARCH_8 0x40478
#define SRC_REG_KEYSEARCH_9 0x4047c
#define SRC_REG_LASTFREE0 0x40530
#define SRC_REG_NUMBER_HASH_BITS0 0x40400
/* [RW 1] Reset internal state machines. */
#define SRC_REG_SOFT_RST 0x4049c
/* [R 3] Interrupt register #0 read */
#define SRC_REG_SRC_INT_STS 0x404ac
/* [RW 3] Parity mask register #0 read/write */
#define SRC_REG_SRC_PRTY_MASK 0x404c8
/* [R 3] Parity register #0 read */
#define SRC_REG_SRC_PRTY_STS 0x404bc
/* [R 4] Used to read the value of the XX protection CAM occupancy counter. */
#define TCM_REG_CAM_OCCUP 0x5017c
/* [RW 1] CDU AG read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define TCM_REG_CDU_AG_RD_IFEN 0x50034
/* [RW 1] CDU AG write Interface enable. If 0 - the request and valid input
are disregarded; all other signals are treated as usual; if 1 - normal
activity. */
#define TCM_REG_CDU_AG_WR_IFEN 0x50030
/* [RW 1] CDU STORM read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define TCM_REG_CDU_SM_RD_IFEN 0x5003c
/* [RW 1] CDU STORM write Interface enable. If 0 - the request and valid
input is disregarded; all other signals are treated as usual; if 1 -
normal activity. */
#define TCM_REG_CDU_SM_WR_IFEN 0x50038
/* [RW 4] CFC output initial credit. Max credit available - 15.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 1 at start-up. */
#define TCM_REG_CFC_INIT_CRD 0x50204
/* [RW 3] The weight of the CP input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_CP_WEIGHT 0x500c0
/* [RW 1] Input csem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define TCM_REG_CSEM_IFEN 0x5002c
/* [RC 1] Message length mismatch (relative to last indication) at the In#9
interface. */
#define TCM_REG_CSEM_LENGTH_MIS 0x50174
/* [RW 3] The weight of the input csem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_CSEM_WEIGHT 0x500bc
/* [RW 8] The Event ID in case of ErrorFlg is set in the input message. */
#define TCM_REG_ERR_EVNT_ID 0x500a0
/* [RW 28] The CM erroneous header for QM and Timers formatting. */
#define TCM_REG_ERR_TCM_HDR 0x5009c
/* [RW 8] The Event ID for Timers expiration. */
#define TCM_REG_EXPR_EVNT_ID 0x500a4
/* [RW 8] FIC0 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define TCM_REG_FIC0_INIT_CRD 0x5020c
/* [RW 8] FIC1 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define TCM_REG_FIC1_INIT_CRD 0x50210
/* [RW 1] Arbitration between Input Arbiter groups: 0 - fair Round-Robin; 1
- strict priority defined by ~tcm_registers_gr_ag_pr.gr_ag_pr;
~tcm_registers_gr_ld0_pr.gr_ld0_pr and
~tcm_registers_gr_ld1_pr.gr_ld1_pr. */
#define TCM_REG_GR_ARB_TYPE 0x50114
/* [RW 2] Load (FIC0) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed that the Store channel is the
compliment of the other 3 groups. */
#define TCM_REG_GR_LD0_PR 0x5011c
/* [RW 2] Load (FIC1) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed that the Store channel is the
compliment of the other 3 groups. */
#define TCM_REG_GR_LD1_PR 0x50120
/* [RW 4] The number of double REG-pairs; loaded from the STORM context and
sent to STORM; for a specific connection type. The double REG-pairs are
used to align to STORM context row size of 128 bits. The offset of these
data in the STORM context is always 0. Index _i stands for the connection
type (one of 16). */
#define TCM_REG_N_SM_CTX_LD_0 0x50050
#define TCM_REG_N_SM_CTX_LD_1 0x50054
#define TCM_REG_N_SM_CTX_LD_2 0x50058
#define TCM_REG_N_SM_CTX_LD_3 0x5005c
#define TCM_REG_N_SM_CTX_LD_4 0x50060
#define TCM_REG_N_SM_CTX_LD_5 0x50064
/* [RW 1] Input pbf Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_PBF_IFEN 0x50024
/* [RC 1] Message length mismatch (relative to last indication) at the In#7
interface. */
#define TCM_REG_PBF_LENGTH_MIS 0x5016c
/* [RW 3] The weight of the input pbf in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_PBF_WEIGHT 0x500b4
#define TCM_REG_PHYS_QNUM0_0 0x500e0
#define TCM_REG_PHYS_QNUM0_1 0x500e4
#define TCM_REG_PHYS_QNUM1_0 0x500e8
#define TCM_REG_PHYS_QNUM1_1 0x500ec
#define TCM_REG_PHYS_QNUM2_0 0x500f0
#define TCM_REG_PHYS_QNUM2_1 0x500f4
#define TCM_REG_PHYS_QNUM3_0 0x500f8
#define TCM_REG_PHYS_QNUM3_1 0x500fc
/* [RW 1] Input prs Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_PRS_IFEN 0x50020
/* [RC 1] Message length mismatch (relative to last indication) at the In#6
interface. */
#define TCM_REG_PRS_LENGTH_MIS 0x50168
/* [RW 3] The weight of the input prs in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_PRS_WEIGHT 0x500b0
/* [RW 8] The Event ID for Timers formatting in case of stop done. */
#define TCM_REG_STOP_EVNT_ID 0x500a8
/* [RC 1] Message length mismatch (relative to last indication) at the STORM
interface. */
#define TCM_REG_STORM_LENGTH_MIS 0x50160
/* [RW 1] STORM - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define TCM_REG_STORM_TCM_IFEN 0x50010
/* [RW 3] The weight of the STORM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_STORM_WEIGHT 0x500ac
/* [RW 1] CM - CFC Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_TCM_CFC_IFEN 0x50040
/* [RW 11] Interrupt mask register #0 read/write */
#define TCM_REG_TCM_INT_MASK 0x501dc
/* [R 11] Interrupt register #0 read */
#define TCM_REG_TCM_INT_STS 0x501d0
/* [R 27] Parity register #0 read */
#define TCM_REG_TCM_PRTY_STS 0x501e0
/* [RW 3] The size of AG context region 0 in REG-pairs. Designates the MS
REG-pair number (e.g. if region 0 is 6 REG-pairs; the value should be 5).
Is used to determine the number of the AG context REG-pairs written back;
when the input message Reg1WbFlg isn't set. */
#define TCM_REG_TCM_REG0_SZ 0x500d8
/* [RW 1] CM - STORM 0 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_TCM_STORM0_IFEN 0x50004
/* [RW 1] CM - STORM 1 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_TCM_STORM1_IFEN 0x50008
/* [RW 1] CM - QM Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_TCM_TQM_IFEN 0x5000c
/* [RW 1] If set the Q index; received from the QM is inserted to event ID. */
#define TCM_REG_TCM_TQM_USE_Q 0x500d4
/* [RW 28] The CM header for Timers expiration command. */
#define TCM_REG_TM_TCM_HDR 0x50098
/* [RW 1] Timers - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define TCM_REG_TM_TCM_IFEN 0x5001c
/* [RW 3] The weight of the Timers input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_TM_WEIGHT 0x500d0
/* [RW 6] QM output initial credit. Max credit available - 32.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 32 at start-up. */
#define TCM_REG_TQM_INIT_CRD 0x5021c
/* [RW 3] The weight of the QM (primary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_TQM_P_WEIGHT 0x500c8
/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_TQM_S_WEIGHT 0x500cc
/* [RW 28] The CM header value for QM request (primary). */
#define TCM_REG_TQM_TCM_HDR_P 0x50090
/* [RW 28] The CM header value for QM request (secondary). */
#define TCM_REG_TQM_TCM_HDR_S 0x50094
/* [RW 1] QM - CM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_TQM_TCM_IFEN 0x50014
/* [RW 1] Input SDM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define TCM_REG_TSDM_IFEN 0x50018
/* [RC 1] Message length mismatch (relative to last indication) at the SDM
interface. */
#define TCM_REG_TSDM_LENGTH_MIS 0x50164
/* [RW 3] The weight of the SDM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_TSDM_WEIGHT 0x500c4
/* [RW 1] Input usem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define TCM_REG_USEM_IFEN 0x50028
/* [RC 1] Message length mismatch (relative to last indication) at the In#8
interface. */
#define TCM_REG_USEM_LENGTH_MIS 0x50170
/* [RW 3] The weight of the input usem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define TCM_REG_USEM_WEIGHT 0x500b8
/* [RW 21] Indirect access to the descriptor table of the XX protection
mechanism. The fields are: [5:0] - length of the message; 15:6] - message
pointer; 20:16] - next pointer. */
#define TCM_REG_XX_DESCR_TABLE 0x50280
#define TCM_REG_XX_DESCR_TABLE_SIZE 32
/* [R 6] Use to read the value of XX protection Free counter. */
#define TCM_REG_XX_FREE 0x50178
/* [RW 6] Initial value for the credit counter; responsible for fulfilling
of the Input Stage XX protection buffer by the XX protection pending
messages. Max credit available - 127.Write writes the initial credit
value; read returns the current value of the credit counter. Must be
initialized to 19 at start-up. */
#define TCM_REG_XX_INIT_CRD 0x50220
/* [RW 6] Maximum link list size (messages locked) per connection in the XX
protection. */
#define TCM_REG_XX_MAX_LL_SZ 0x50044
/* [RW 6] The maximum number of pending messages; which may be stored in XX
protection. ~tcm_registers_xx_free.xx_free is read on read. */
#define TCM_REG_XX_MSG_NUM 0x50224
/* [RW 8] The Event ID; sent to the STORM in case of XX overflow. */
#define TCM_REG_XX_OVFL_EVNT_ID 0x50048
/* [RW 16] Indirect access to the XX table of the XX protection mechanism.
The fields are:[4:0] - tail pointer; [10:5] - Link List size; 15:11] -
header pointer. */
#define TCM_REG_XX_TABLE 0x50240
/* [RW 4] Load value for cfc ac credit cnt. */
#define TM_REG_CFC_AC_CRDCNT_VAL 0x164208
/* [RW 4] Load value for cfc cld credit cnt. */
#define TM_REG_CFC_CLD_CRDCNT_VAL 0x164210
/* [RW 8] Client0 context region. */
#define TM_REG_CL0_CONT_REGION 0x164030
/* [RW 8] Client1 context region. */
#define TM_REG_CL1_CONT_REGION 0x164034
/* [RW 8] Client2 context region. */
#define TM_REG_CL2_CONT_REGION 0x164038
/* [RW 2] Client in High priority client number. */
#define TM_REG_CLIN_PRIOR0_CLIENT 0x164024
/* [RW 4] Load value for clout0 cred cnt. */
#define TM_REG_CLOUT_CRDCNT0_VAL 0x164220
/* [RW 4] Load value for clout1 cred cnt. */
#define TM_REG_CLOUT_CRDCNT1_VAL 0x164228
/* [RW 4] Load value for clout2 cred cnt. */
#define TM_REG_CLOUT_CRDCNT2_VAL 0x164230
/* [RW 1] Enable client0 input. */
#define TM_REG_EN_CL0_INPUT 0x164008
/* [RW 1] Enable client1 input. */
#define TM_REG_EN_CL1_INPUT 0x16400c
/* [RW 1] Enable client2 input. */
#define TM_REG_EN_CL2_INPUT 0x164010
#define TM_REG_EN_LINEAR0_TIMER 0x164014
/* [RW 1] Enable real time counter. */
#define TM_REG_EN_REAL_TIME_CNT 0x1640d8
/* [RW 1] Enable for Timers state machines. */
#define TM_REG_EN_TIMERS 0x164000
/* [RW 4] Load value for expiration credit cnt. CFC max number of
outstanding load requests for timers (expiration) context loading. */
#define TM_REG_EXP_CRDCNT_VAL 0x164238
/* [RW 32] Linear0 logic address. */
#define TM_REG_LIN0_LOGIC_ADDR 0x164240
/* [RW 18] Linear0 Max active cid (in banks of 32 entries). */
#define TM_REG_LIN0_MAX_ACTIVE_CID 0x164048
/* [WB 64] Linear0 phy address. */
#define TM_REG_LIN0_PHY_ADDR 0x164270
/* [RW 1] Linear0 physical address valid. */
#define TM_REG_LIN0_PHY_ADDR_VALID 0x164248
#define TM_REG_LIN0_SCAN_ON 0x1640d0
/* [RW 24] Linear0 array scan timeout. */
#define TM_REG_LIN0_SCAN_TIME 0x16403c
/* [RW 32] Linear1 logic address. */
#define TM_REG_LIN1_LOGIC_ADDR 0x164250
/* [WB 64] Linear1 phy address. */
#define TM_REG_LIN1_PHY_ADDR 0x164280
/* [RW 1] Linear1 physical address valid. */
#define TM_REG_LIN1_PHY_ADDR_VALID 0x164258
/* [RW 6] Linear timer set_clear fifo threshold. */
#define TM_REG_LIN_SETCLR_FIFO_ALFULL_THR 0x164070
/* [RW 2] Load value for pci arbiter credit cnt. */
#define TM_REG_PCIARB_CRDCNT_VAL 0x164260
/* [RW 20] The amount of hardware cycles for each timer tick. */
#define TM_REG_TIMER_TICK_SIZE 0x16401c
/* [RW 8] Timers Context region. */
#define TM_REG_TM_CONTEXT_REGION 0x164044
/* [RW 1] Interrupt mask register #0 read/write */
#define TM_REG_TM_INT_MASK 0x1640fc
/* [R 1] Interrupt register #0 read */
#define TM_REG_TM_INT_STS 0x1640f0
/* [RW 8] The event id for aggregated interrupt 0 */
#define TSDM_REG_AGG_INT_EVENT_0 0x42038
#define TSDM_REG_AGG_INT_EVENT_1 0x4203c
#define TSDM_REG_AGG_INT_EVENT_2 0x42040
#define TSDM_REG_AGG_INT_EVENT_3 0x42044
#define TSDM_REG_AGG_INT_EVENT_4 0x42048
/* [RW 1] The T bit for aggregated interrupt 0 */
#define TSDM_REG_AGG_INT_T_0 0x420b8
#define TSDM_REG_AGG_INT_T_1 0x420bc
/* [RW 13] The start address in the internal RAM for the cfc_rsp lcid */
#define TSDM_REG_CFC_RSP_START_ADDR 0x42008
/* [RW 16] The maximum value of the competion counter #0 */
#define TSDM_REG_CMP_COUNTER_MAX0 0x4201c
/* [RW 16] The maximum value of the competion counter #1 */
#define TSDM_REG_CMP_COUNTER_MAX1 0x42020
/* [RW 16] The maximum value of the competion counter #2 */
#define TSDM_REG_CMP_COUNTER_MAX2 0x42024
/* [RW 16] The maximum value of the competion counter #3 */
#define TSDM_REG_CMP_COUNTER_MAX3 0x42028
/* [RW 13] The start address in the internal RAM for the completion
counters. */
#define TSDM_REG_CMP_COUNTER_START_ADDR 0x4200c
#define TSDM_REG_ENABLE_IN1 0x42238
#define TSDM_REG_ENABLE_IN2 0x4223c
#define TSDM_REG_ENABLE_OUT1 0x42240
#define TSDM_REG_ENABLE_OUT2 0x42244
/* [RW 4] The initial number of messages that can be sent to the pxp control
interface without receiving any ACK. */
#define TSDM_REG_INIT_CREDIT_PXP_CTRL 0x424bc
/* [ST 32] The number of ACK after placement messages received */
#define TSDM_REG_NUM_OF_ACK_AFTER_PLACE 0x4227c
/* [ST 32] The number of packet end messages received from the parser */
#define TSDM_REG_NUM_OF_PKT_END_MSG 0x42274
/* [ST 32] The number of requests received from the pxp async if */
#define TSDM_REG_NUM_OF_PXP_ASYNC_REQ 0x42278
/* [ST 32] The number of commands received in queue 0 */
#define TSDM_REG_NUM_OF_Q0_CMD 0x42248
/* [ST 32] The number of commands received in queue 10 */
#define TSDM_REG_NUM_OF_Q10_CMD 0x4226c
/* [ST 32] The number of commands received in queue 11 */
#define TSDM_REG_NUM_OF_Q11_CMD 0x42270
/* [ST 32] The number of commands received in queue 1 */
#define TSDM_REG_NUM_OF_Q1_CMD 0x4224c
/* [ST 32] The number of commands received in queue 3 */
#define TSDM_REG_NUM_OF_Q3_CMD 0x42250
/* [ST 32] The number of commands received in queue 4 */
#define TSDM_REG_NUM_OF_Q4_CMD 0x42254
/* [ST 32] The number of commands received in queue 5 */
#define TSDM_REG_NUM_OF_Q5_CMD 0x42258
/* [ST 32] The number of commands received in queue 6 */
#define TSDM_REG_NUM_OF_Q6_CMD 0x4225c
/* [ST 32] The number of commands received in queue 7 */
#define TSDM_REG_NUM_OF_Q7_CMD 0x42260
/* [ST 32] The number of commands received in queue 8 */
#define TSDM_REG_NUM_OF_Q8_CMD 0x42264
/* [ST 32] The number of commands received in queue 9 */
#define TSDM_REG_NUM_OF_Q9_CMD 0x42268
/* [RW 13] The start address in the internal RAM for the packet end message */
#define TSDM_REG_PCK_END_MSG_START_ADDR 0x42014
/* [RW 13] The start address in the internal RAM for queue counters */
#define TSDM_REG_Q_COUNTER_START_ADDR 0x42010
/* [R 1] pxp_ctrl rd_data fifo empty in sdm_dma_rsp block */
#define TSDM_REG_RSP_PXP_CTRL_RDATA_EMPTY 0x42548
/* [R 1] parser fifo empty in sdm_sync block */
#define TSDM_REG_SYNC_PARSER_EMPTY 0x42550
/* [R 1] parser serial fifo empty in sdm_sync block */
#define TSDM_REG_SYNC_SYNC_EMPTY 0x42558
/* [RW 32] Tick for timer counter. Applicable only when
~tsdm_registers_timer_tick_enable.timer_tick_enable =1 */
#define TSDM_REG_TIMER_TICK 0x42000
/* [RW 32] Interrupt mask register #0 read/write */
#define TSDM_REG_TSDM_INT_MASK_0 0x4229c
#define TSDM_REG_TSDM_INT_MASK_1 0x422ac
/* [R 32] Interrupt register #0 read */
#define TSDM_REG_TSDM_INT_STS_0 0x42290
#define TSDM_REG_TSDM_INT_STS_1 0x422a0
/* [RW 11] Parity mask register #0 read/write */
#define TSDM_REG_TSDM_PRTY_MASK 0x422bc
/* [R 11] Parity register #0 read */
#define TSDM_REG_TSDM_PRTY_STS 0x422b0
/* [RW 5] The number of time_slots in the arbitration cycle */
#define TSEM_REG_ARB_CYCLE_SIZE 0x180034
/* [RW 3] The source that is associated with arbitration element 0. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2 */
#define TSEM_REG_ARB_ELEMENT0 0x180020
/* [RW 3] The source that is associated with arbitration element 1. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~tsem_registers_arb_element0.arb_element0 */
#define TSEM_REG_ARB_ELEMENT1 0x180024
/* [RW 3] The source that is associated with arbitration element 2. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~tsem_registers_arb_element0.arb_element0
and ~tsem_registers_arb_element1.arb_element1 */
#define TSEM_REG_ARB_ELEMENT2 0x180028
/* [RW 3] The source that is associated with arbitration element 3. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.Could
not be equal to register ~tsem_registers_arb_element0.arb_element0 and
~tsem_registers_arb_element1.arb_element1 and
~tsem_registers_arb_element2.arb_element2 */
#define TSEM_REG_ARB_ELEMENT3 0x18002c
/* [RW 3] The source that is associated with arbitration element 4. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~tsem_registers_arb_element0.arb_element0
and ~tsem_registers_arb_element1.arb_element1 and
~tsem_registers_arb_element2.arb_element2 and
~tsem_registers_arb_element3.arb_element3 */
#define TSEM_REG_ARB_ELEMENT4 0x180030
#define TSEM_REG_ENABLE_IN 0x1800a4
#define TSEM_REG_ENABLE_OUT 0x1800a8
/* [RW 32] This address space contains all registers and memories that are
placed in SEM_FAST block. The SEM_FAST registers are described in
appendix B. In order to access the sem_fast registers the base address
~fast_memory.fast_memory should be added to eachsem_fast register offset. */
#define TSEM_REG_FAST_MEMORY 0x1a0000
/* [RW 1] Disables input messages from FIC0 May be updated during run_time
by the microcode */
#define TSEM_REG_FIC0_DISABLE 0x180224
/* [RW 1] Disables input messages from FIC1 May be updated during run_time
by the microcode */
#define TSEM_REG_FIC1_DISABLE 0x180234
/* [RW 15] Interrupt table Read and write access to it is not possible in
the middle of the work */
#define TSEM_REG_INT_TABLE 0x180400
/* [ST 24] Statistics register. The number of messages that entered through
FIC0 */
#define TSEM_REG_MSG_NUM_FIC0 0x180000
/* [ST 24] Statistics register. The number of messages that entered through
FIC1 */
#define TSEM_REG_MSG_NUM_FIC1 0x180004
/* [ST 24] Statistics register. The number of messages that were sent to
FOC0 */
#define TSEM_REG_MSG_NUM_FOC0 0x180008
/* [ST 24] Statistics register. The number of messages that were sent to
FOC1 */
#define TSEM_REG_MSG_NUM_FOC1 0x18000c
/* [ST 24] Statistics register. The number of messages that were sent to
FOC2 */
#define TSEM_REG_MSG_NUM_FOC2 0x180010
/* [ST 24] Statistics register. The number of messages that were sent to
FOC3 */
#define TSEM_REG_MSG_NUM_FOC3 0x180014
/* [RW 1] Disables input messages from the passive buffer May be updated
during run_time by the microcode */
#define TSEM_REG_PAS_DISABLE 0x18024c
/* [WB 128] Debug only. Passive buffer memory */
#define TSEM_REG_PASSIVE_BUFFER 0x181000
/* [WB 46] pram memory. B45 is parity; b[44:0] - data. */
#define TSEM_REG_PRAM 0x1c0000
/* [R 8] Valid sleeping threads indication have bit per thread */
#define TSEM_REG_SLEEP_THREADS_VALID 0x18026c
/* [R 1] EXT_STORE FIFO is empty in sem_slow_ls_ext */
#define TSEM_REG_SLOW_EXT_STORE_EMPTY 0x1802a0
/* [RW 8] List of free threads . There is a bit per thread. */
#define TSEM_REG_THREADS_LIST 0x1802e4
/* [RW 3] The arbitration scheme of time_slot 0 */
#define TSEM_REG_TS_0_AS 0x180038
/* [RW 3] The arbitration scheme of time_slot 10 */
#define TSEM_REG_TS_10_AS 0x180060
/* [RW 3] The arbitration scheme of time_slot 11 */
#define TSEM_REG_TS_11_AS 0x180064
/* [RW 3] The arbitration scheme of time_slot 12 */
#define TSEM_REG_TS_12_AS 0x180068
/* [RW 3] The arbitration scheme of time_slot 13 */
#define TSEM_REG_TS_13_AS 0x18006c
/* [RW 3] The arbitration scheme of time_slot 14 */
#define TSEM_REG_TS_14_AS 0x180070
/* [RW 3] The arbitration scheme of time_slot 15 */
#define TSEM_REG_TS_15_AS 0x180074
/* [RW 3] The arbitration scheme of time_slot 16 */
#define TSEM_REG_TS_16_AS 0x180078
/* [RW 3] The arbitration scheme of time_slot 17 */
#define TSEM_REG_TS_17_AS 0x18007c
/* [RW 3] The arbitration scheme of time_slot 18 */
#define TSEM_REG_TS_18_AS 0x180080
/* [RW 3] The arbitration scheme of time_slot 1 */
#define TSEM_REG_TS_1_AS 0x18003c
/* [RW 3] The arbitration scheme of time_slot 2 */
#define TSEM_REG_TS_2_AS 0x180040
/* [RW 3] The arbitration scheme of time_slot 3 */
#define TSEM_REG_TS_3_AS 0x180044
/* [RW 3] The arbitration scheme of time_slot 4 */
#define TSEM_REG_TS_4_AS 0x180048
/* [RW 3] The arbitration scheme of time_slot 5 */
#define TSEM_REG_TS_5_AS 0x18004c
/* [RW 3] The arbitration scheme of time_slot 6 */
#define TSEM_REG_TS_6_AS 0x180050
/* [RW 3] The arbitration scheme of time_slot 7 */
#define TSEM_REG_TS_7_AS 0x180054
/* [RW 3] The arbitration scheme of time_slot 8 */
#define TSEM_REG_TS_8_AS 0x180058
/* [RW 3] The arbitration scheme of time_slot 9 */
#define TSEM_REG_TS_9_AS 0x18005c
/* [RW 32] Interrupt mask register #0 read/write */
#define TSEM_REG_TSEM_INT_MASK_0 0x180100
#define TSEM_REG_TSEM_INT_MASK_1 0x180110
/* [R 32] Interrupt register #0 read */
#define TSEM_REG_TSEM_INT_STS_0 0x1800f4
#define TSEM_REG_TSEM_INT_STS_1 0x180104
/* [RW 32] Parity mask register #0 read/write */
#define TSEM_REG_TSEM_PRTY_MASK_0 0x180120
#define TSEM_REG_TSEM_PRTY_MASK_1 0x180130
/* [R 32] Parity register #0 read */
#define TSEM_REG_TSEM_PRTY_STS_0 0x180114
#define TSEM_REG_TSEM_PRTY_STS_1 0x180124
/* [R 5] Used to read the XX protection CAM occupancy counter. */
#define UCM_REG_CAM_OCCUP 0xe0170
/* [RW 1] CDU AG read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define UCM_REG_CDU_AG_RD_IFEN 0xe0038
/* [RW 1] CDU AG write Interface enable. If 0 - the request and valid input
are disregarded; all other signals are treated as usual; if 1 - normal
activity. */
#define UCM_REG_CDU_AG_WR_IFEN 0xe0034
/* [RW 1] CDU STORM read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define UCM_REG_CDU_SM_RD_IFEN 0xe0040
/* [RW 1] CDU STORM write Interface enable. If 0 - the request and valid
input is disregarded; all other signals are treated as usual; if 1 -
normal activity. */
#define UCM_REG_CDU_SM_WR_IFEN 0xe003c
/* [RW 4] CFC output initial credit. Max credit available - 15.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 1 at start-up. */
#define UCM_REG_CFC_INIT_CRD 0xe0204
/* [RW 3] The weight of the CP input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_CP_WEIGHT 0xe00c4
/* [RW 1] Input csem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_CSEM_IFEN 0xe0028
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the csem interface is detected. */
#define UCM_REG_CSEM_LENGTH_MIS 0xe0160
/* [RW 3] The weight of the input csem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_CSEM_WEIGHT 0xe00b8
/* [RW 1] Input dorq Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_DORQ_IFEN 0xe0030
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the dorq interface is detected. */
#define UCM_REG_DORQ_LENGTH_MIS 0xe0168
/* [RW 3] The weight of the input dorq in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_DORQ_WEIGHT 0xe00c0
/* [RW 8] The Event ID in case ErrorFlg input message bit is set. */
#define UCM_REG_ERR_EVNT_ID 0xe00a4
/* [RW 28] The CM erroneous header for QM and Timers formatting. */
#define UCM_REG_ERR_UCM_HDR 0xe00a0
/* [RW 8] The Event ID for Timers expiration. */
#define UCM_REG_EXPR_EVNT_ID 0xe00a8
/* [RW 8] FIC0 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define UCM_REG_FIC0_INIT_CRD 0xe020c
/* [RW 8] FIC1 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define UCM_REG_FIC1_INIT_CRD 0xe0210
/* [RW 1] Arbitration between Input Arbiter groups: 0 - fair Round-Robin; 1
- strict priority defined by ~ucm_registers_gr_ag_pr.gr_ag_pr;
~ucm_registers_gr_ld0_pr.gr_ld0_pr and
~ucm_registers_gr_ld1_pr.gr_ld1_pr. */
#define UCM_REG_GR_ARB_TYPE 0xe0144
/* [RW 2] Load (FIC0) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed that the Store channel group is
compliment to the others. */
#define UCM_REG_GR_LD0_PR 0xe014c
/* [RW 2] Load (FIC1) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed that the Store channel group is
compliment to the others. */
#define UCM_REG_GR_LD1_PR 0xe0150
/* [RW 2] The queue index for invalidate counter flag decision. */
#define UCM_REG_INV_CFLG_Q 0xe00e4
/* [RW 5] The number of double REG-pairs; loaded from the STORM context and
sent to STORM; for a specific connection type. the double REG-pairs are
used in order to align to STORM context row size of 128 bits. The offset
of these data in the STORM context is always 0. Index _i stands for the
connection type (one of 16). */
#define UCM_REG_N_SM_CTX_LD_0 0xe0054
#define UCM_REG_N_SM_CTX_LD_1 0xe0058
#define UCM_REG_N_SM_CTX_LD_2 0xe005c
#define UCM_REG_N_SM_CTX_LD_3 0xe0060
#define UCM_REG_N_SM_CTX_LD_4 0xe0064
#define UCM_REG_N_SM_CTX_LD_5 0xe0068
#define UCM_REG_PHYS_QNUM0_0 0xe0110
#define UCM_REG_PHYS_QNUM0_1 0xe0114
#define UCM_REG_PHYS_QNUM1_0 0xe0118
#define UCM_REG_PHYS_QNUM1_1 0xe011c
#define UCM_REG_PHYS_QNUM2_0 0xe0120
#define UCM_REG_PHYS_QNUM2_1 0xe0124
#define UCM_REG_PHYS_QNUM3_0 0xe0128
#define UCM_REG_PHYS_QNUM3_1 0xe012c
/* [RW 8] The Event ID for Timers formatting in case of stop done. */
#define UCM_REG_STOP_EVNT_ID 0xe00ac
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the STORM interface is detected. */
#define UCM_REG_STORM_LENGTH_MIS 0xe0154
/* [RW 1] STORM - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_STORM_UCM_IFEN 0xe0010
/* [RW 3] The weight of the STORM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_STORM_WEIGHT 0xe00b0
/* [RW 4] Timers output initial credit. Max credit available - 15.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 4 at start-up. */
#define UCM_REG_TM_INIT_CRD 0xe021c
/* [RW 28] The CM header for Timers expiration command. */
#define UCM_REG_TM_UCM_HDR 0xe009c
/* [RW 1] Timers - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_TM_UCM_IFEN 0xe001c
/* [RW 3] The weight of the Timers input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_TM_WEIGHT 0xe00d4
/* [RW 1] Input tsem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_TSEM_IFEN 0xe0024
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the tsem interface is detected. */
#define UCM_REG_TSEM_LENGTH_MIS 0xe015c
/* [RW 3] The weight of the input tsem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_TSEM_WEIGHT 0xe00b4
/* [RW 1] CM - CFC Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define UCM_REG_UCM_CFC_IFEN 0xe0044
/* [RW 11] Interrupt mask register #0 read/write */
#define UCM_REG_UCM_INT_MASK 0xe01d4
/* [R 11] Interrupt register #0 read */
#define UCM_REG_UCM_INT_STS 0xe01c8
/* [R 27] Parity register #0 read */
#define UCM_REG_UCM_PRTY_STS 0xe01d8
/* [RW 2] The size of AG context region 0 in REG-pairs. Designates the MS
REG-pair number (e.g. if region 0 is 6 REG-pairs; the value should be 5).
Is used to determine the number of the AG context REG-pairs written back;
when the Reg1WbFlg isn't set. */
#define UCM_REG_UCM_REG0_SZ 0xe00dc
/* [RW 1] CM - STORM 0 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define UCM_REG_UCM_STORM0_IFEN 0xe0004
/* [RW 1] CM - STORM 1 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define UCM_REG_UCM_STORM1_IFEN 0xe0008
/* [RW 1] CM - Timers Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_UCM_TM_IFEN 0xe0020
/* [RW 1] CM - QM Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define UCM_REG_UCM_UQM_IFEN 0xe000c
/* [RW 1] If set the Q index; received from the QM is inserted to event ID. */
#define UCM_REG_UCM_UQM_USE_Q 0xe00d8
/* [RW 6] QM output initial credit. Max credit available - 32.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 32 at start-up. */
#define UCM_REG_UQM_INIT_CRD 0xe0220
/* [RW 3] The weight of the QM (primary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_UQM_P_WEIGHT 0xe00cc
/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_UQM_S_WEIGHT 0xe00d0
/* [RW 28] The CM header value for QM request (primary). */
#define UCM_REG_UQM_UCM_HDR_P 0xe0094
/* [RW 28] The CM header value for QM request (secondary). */
#define UCM_REG_UQM_UCM_HDR_S 0xe0098
/* [RW 1] QM - CM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define UCM_REG_UQM_UCM_IFEN 0xe0014
/* [RW 1] Input SDM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define UCM_REG_USDM_IFEN 0xe0018
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the SDM interface is detected. */
#define UCM_REG_USDM_LENGTH_MIS 0xe0158
/* [RW 3] The weight of the SDM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_USDM_WEIGHT 0xe00c8
/* [RW 1] Input xsem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define UCM_REG_XSEM_IFEN 0xe002c
/* [RC 1] Set when the message length mismatch (relative to last indication)
at the xsem interface isdetected. */
#define UCM_REG_XSEM_LENGTH_MIS 0xe0164
/* [RW 3] The weight of the input xsem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define UCM_REG_XSEM_WEIGHT 0xe00bc
/* [RW 20] Indirect access to the descriptor table of the XX protection
mechanism. The fields are:[5:0] - message length; 14:6] - message
pointer; 19:15] - next pointer. */
#define UCM_REG_XX_DESCR_TABLE 0xe0280
#define UCM_REG_XX_DESCR_TABLE_SIZE 32
/* [R 6] Use to read the XX protection Free counter. */
#define UCM_REG_XX_FREE 0xe016c
/* [RW 6] Initial value for the credit counter; responsible for fulfilling
of the Input Stage XX protection buffer by the XX protection pending
messages. Write writes the initial credit value; read returns the current
value of the credit counter. Must be initialized to 12 at start-up. */
#define UCM_REG_XX_INIT_CRD 0xe0224
/* [RW 6] The maximum number of pending messages; which may be stored in XX
protection. ~ucm_registers_xx_free.xx_free read on read. */
#define UCM_REG_XX_MSG_NUM 0xe0228
/* [RW 8] The Event ID; sent to the STORM in case of XX overflow. */
#define UCM_REG_XX_OVFL_EVNT_ID 0xe004c
/* [RW 16] Indirect access to the XX table of the XX protection mechanism.
The fields are: [4:0] - tail pointer; 10:5] - Link List size; 15:11] -
header pointer. */
#define UCM_REG_XX_TABLE 0xe0300
/* [RW 8] The event id for aggregated interrupt 0 */
#define USDM_REG_AGG_INT_EVENT_0 0xc4038
#define USDM_REG_AGG_INT_EVENT_1 0xc403c
#define USDM_REG_AGG_INT_EVENT_2 0xc4040
#define USDM_REG_AGG_INT_EVENT_4 0xc4048
#define USDM_REG_AGG_INT_EVENT_5 0xc404c
#define USDM_REG_AGG_INT_EVENT_6 0xc4050
/* [RW 1] For each aggregated interrupt index whether the mode is normal (0)
or auto-mask-mode (1) */
#define USDM_REG_AGG_INT_MODE_0 0xc41b8
#define USDM_REG_AGG_INT_MODE_1 0xc41bc
#define USDM_REG_AGG_INT_MODE_4 0xc41c8
#define USDM_REG_AGG_INT_MODE_5 0xc41cc
#define USDM_REG_AGG_INT_MODE_6 0xc41d0
/* [RW 1] The T bit for aggregated interrupt 5 */
#define USDM_REG_AGG_INT_T_5 0xc40cc
#define USDM_REG_AGG_INT_T_6 0xc40d0
/* [RW 13] The start address in the internal RAM for the cfc_rsp lcid */
#define USDM_REG_CFC_RSP_START_ADDR 0xc4008
/* [RW 16] The maximum value of the competion counter #0 */
#define USDM_REG_CMP_COUNTER_MAX0 0xc401c
/* [RW 16] The maximum value of the competion counter #1 */
#define USDM_REG_CMP_COUNTER_MAX1 0xc4020
/* [RW 16] The maximum value of the competion counter #2 */
#define USDM_REG_CMP_COUNTER_MAX2 0xc4024
/* [RW 16] The maximum value of the competion counter #3 */
#define USDM_REG_CMP_COUNTER_MAX3 0xc4028
/* [RW 13] The start address in the internal RAM for the completion
counters. */
#define USDM_REG_CMP_COUNTER_START_ADDR 0xc400c
#define USDM_REG_ENABLE_IN1 0xc4238
#define USDM_REG_ENABLE_IN2 0xc423c
#define USDM_REG_ENABLE_OUT1 0xc4240
#define USDM_REG_ENABLE_OUT2 0xc4244
/* [RW 4] The initial number of messages that can be sent to the pxp control
interface without receiving any ACK. */
#define USDM_REG_INIT_CREDIT_PXP_CTRL 0xc44c0
/* [ST 32] The number of ACK after placement messages received */
#define USDM_REG_NUM_OF_ACK_AFTER_PLACE 0xc4280
/* [ST 32] The number of packet end messages received from the parser */
#define USDM_REG_NUM_OF_PKT_END_MSG 0xc4278
/* [ST 32] The number of requests received from the pxp async if */
#define USDM_REG_NUM_OF_PXP_ASYNC_REQ 0xc427c
/* [ST 32] The number of commands received in queue 0 */
#define USDM_REG_NUM_OF_Q0_CMD 0xc4248
/* [ST 32] The number of commands received in queue 10 */
#define USDM_REG_NUM_OF_Q10_CMD 0xc4270
/* [ST 32] The number of commands received in queue 11 */
#define USDM_REG_NUM_OF_Q11_CMD 0xc4274
/* [ST 32] The number of commands received in queue 1 */
#define USDM_REG_NUM_OF_Q1_CMD 0xc424c
/* [ST 32] The number of commands received in queue 2 */
#define USDM_REG_NUM_OF_Q2_CMD 0xc4250
/* [ST 32] The number of commands received in queue 3 */
#define USDM_REG_NUM_OF_Q3_CMD 0xc4254
/* [ST 32] The number of commands received in queue 4 */
#define USDM_REG_NUM_OF_Q4_CMD 0xc4258
/* [ST 32] The number of commands received in queue 5 */
#define USDM_REG_NUM_OF_Q5_CMD 0xc425c
/* [ST 32] The number of commands received in queue 6 */
#define USDM_REG_NUM_OF_Q6_CMD 0xc4260
/* [ST 32] The number of commands received in queue 7 */
#define USDM_REG_NUM_OF_Q7_CMD 0xc4264
/* [ST 32] The number of commands received in queue 8 */
#define USDM_REG_NUM_OF_Q8_CMD 0xc4268
/* [ST 32] The number of commands received in queue 9 */
#define USDM_REG_NUM_OF_Q9_CMD 0xc426c
/* [RW 13] The start address in the internal RAM for the packet end message */
#define USDM_REG_PCK_END_MSG_START_ADDR 0xc4014
/* [RW 13] The start address in the internal RAM for queue counters */
#define USDM_REG_Q_COUNTER_START_ADDR 0xc4010
/* [R 1] pxp_ctrl rd_data fifo empty in sdm_dma_rsp block */
#define USDM_REG_RSP_PXP_CTRL_RDATA_EMPTY 0xc4550
/* [R 1] parser fifo empty in sdm_sync block */
#define USDM_REG_SYNC_PARSER_EMPTY 0xc4558
/* [R 1] parser serial fifo empty in sdm_sync block */
#define USDM_REG_SYNC_SYNC_EMPTY 0xc4560
/* [RW 32] Tick for timer counter. Applicable only when
~usdm_registers_timer_tick_enable.timer_tick_enable =1 */
#define USDM_REG_TIMER_TICK 0xc4000
/* [RW 32] Interrupt mask register #0 read/write */
#define USDM_REG_USDM_INT_MASK_0 0xc42a0
#define USDM_REG_USDM_INT_MASK_1 0xc42b0
/* [R 32] Interrupt register #0 read */
#define USDM_REG_USDM_INT_STS_0 0xc4294
#define USDM_REG_USDM_INT_STS_1 0xc42a4
/* [RW 11] Parity mask register #0 read/write */
#define USDM_REG_USDM_PRTY_MASK 0xc42c0
/* [R 11] Parity register #0 read */
#define USDM_REG_USDM_PRTY_STS 0xc42b4
/* [RW 5] The number of time_slots in the arbitration cycle */
#define USEM_REG_ARB_CYCLE_SIZE 0x300034
/* [RW 3] The source that is associated with arbitration element 0. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2 */
#define USEM_REG_ARB_ELEMENT0 0x300020
/* [RW 3] The source that is associated with arbitration element 1. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~usem_registers_arb_element0.arb_element0 */
#define USEM_REG_ARB_ELEMENT1 0x300024
/* [RW 3] The source that is associated with arbitration element 2. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~usem_registers_arb_element0.arb_element0
and ~usem_registers_arb_element1.arb_element1 */
#define USEM_REG_ARB_ELEMENT2 0x300028
/* [RW 3] The source that is associated with arbitration element 3. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.Could
not be equal to register ~usem_registers_arb_element0.arb_element0 and
~usem_registers_arb_element1.arb_element1 and
~usem_registers_arb_element2.arb_element2 */
#define USEM_REG_ARB_ELEMENT3 0x30002c
/* [RW 3] The source that is associated with arbitration element 4. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~usem_registers_arb_element0.arb_element0
and ~usem_registers_arb_element1.arb_element1 and
~usem_registers_arb_element2.arb_element2 and
~usem_registers_arb_element3.arb_element3 */
#define USEM_REG_ARB_ELEMENT4 0x300030
#define USEM_REG_ENABLE_IN 0x3000a4
#define USEM_REG_ENABLE_OUT 0x3000a8
/* [RW 32] This address space contains all registers and memories that are
placed in SEM_FAST block. The SEM_FAST registers are described in
appendix B. In order to access the sem_fast registers the base address
~fast_memory.fast_memory should be added to eachsem_fast register offset. */
#define USEM_REG_FAST_MEMORY 0x320000
/* [RW 1] Disables input messages from FIC0 May be updated during run_time
by the microcode */
#define USEM_REG_FIC0_DISABLE 0x300224
/* [RW 1] Disables input messages from FIC1 May be updated during run_time
by the microcode */
#define USEM_REG_FIC1_DISABLE 0x300234
/* [RW 15] Interrupt table Read and write access to it is not possible in
the middle of the work */
#define USEM_REG_INT_TABLE 0x300400
/* [ST 24] Statistics register. The number of messages that entered through
FIC0 */
#define USEM_REG_MSG_NUM_FIC0 0x300000
/* [ST 24] Statistics register. The number of messages that entered through
FIC1 */
#define USEM_REG_MSG_NUM_FIC1 0x300004
/* [ST 24] Statistics register. The number of messages that were sent to
FOC0 */
#define USEM_REG_MSG_NUM_FOC0 0x300008
/* [ST 24] Statistics register. The number of messages that were sent to
FOC1 */
#define USEM_REG_MSG_NUM_FOC1 0x30000c
/* [ST 24] Statistics register. The number of messages that were sent to
FOC2 */
#define USEM_REG_MSG_NUM_FOC2 0x300010
/* [ST 24] Statistics register. The number of messages that were sent to
FOC3 */
#define USEM_REG_MSG_NUM_FOC3 0x300014
/* [RW 1] Disables input messages from the passive buffer May be updated
during run_time by the microcode */
#define USEM_REG_PAS_DISABLE 0x30024c
/* [WB 128] Debug only. Passive buffer memory */
#define USEM_REG_PASSIVE_BUFFER 0x302000
/* [WB 46] pram memory. B45 is parity; b[44:0] - data. */
#define USEM_REG_PRAM 0x340000
/* [R 16] Valid sleeping threads indication have bit per thread */
#define USEM_REG_SLEEP_THREADS_VALID 0x30026c
/* [R 1] EXT_STORE FIFO is empty in sem_slow_ls_ext */
#define USEM_REG_SLOW_EXT_STORE_EMPTY 0x3002a0
/* [RW 16] List of free threads . There is a bit per thread. */
#define USEM_REG_THREADS_LIST 0x3002e4
/* [RW 3] The arbitration scheme of time_slot 0 */
#define USEM_REG_TS_0_AS 0x300038
/* [RW 3] The arbitration scheme of time_slot 10 */
#define USEM_REG_TS_10_AS 0x300060
/* [RW 3] The arbitration scheme of time_slot 11 */
#define USEM_REG_TS_11_AS 0x300064
/* [RW 3] The arbitration scheme of time_slot 12 */
#define USEM_REG_TS_12_AS 0x300068
/* [RW 3] The arbitration scheme of time_slot 13 */
#define USEM_REG_TS_13_AS 0x30006c
/* [RW 3] The arbitration scheme of time_slot 14 */
#define USEM_REG_TS_14_AS 0x300070
/* [RW 3] The arbitration scheme of time_slot 15 */
#define USEM_REG_TS_15_AS 0x300074
/* [RW 3] The arbitration scheme of time_slot 16 */
#define USEM_REG_TS_16_AS 0x300078
/* [RW 3] The arbitration scheme of time_slot 17 */
#define USEM_REG_TS_17_AS 0x30007c
/* [RW 3] The arbitration scheme of time_slot 18 */
#define USEM_REG_TS_18_AS 0x300080
/* [RW 3] The arbitration scheme of time_slot 1 */
#define USEM_REG_TS_1_AS 0x30003c
/* [RW 3] The arbitration scheme of time_slot 2 */
#define USEM_REG_TS_2_AS 0x300040
/* [RW 3] The arbitration scheme of time_slot 3 */
#define USEM_REG_TS_3_AS 0x300044
/* [RW 3] The arbitration scheme of time_slot 4 */
#define USEM_REG_TS_4_AS 0x300048
/* [RW 3] The arbitration scheme of time_slot 5 */
#define USEM_REG_TS_5_AS 0x30004c
/* [RW 3] The arbitration scheme of time_slot 6 */
#define USEM_REG_TS_6_AS 0x300050
/* [RW 3] The arbitration scheme of time_slot 7 */
#define USEM_REG_TS_7_AS 0x300054
/* [RW 3] The arbitration scheme of time_slot 8 */
#define USEM_REG_TS_8_AS 0x300058
/* [RW 3] The arbitration scheme of time_slot 9 */
#define USEM_REG_TS_9_AS 0x30005c
/* [RW 32] Interrupt mask register #0 read/write */
#define USEM_REG_USEM_INT_MASK_0 0x300110
#define USEM_REG_USEM_INT_MASK_1 0x300120
/* [R 32] Interrupt register #0 read */
#define USEM_REG_USEM_INT_STS_0 0x300104
#define USEM_REG_USEM_INT_STS_1 0x300114
/* [RW 32] Parity mask register #0 read/write */
#define USEM_REG_USEM_PRTY_MASK_0 0x300130
#define USEM_REG_USEM_PRTY_MASK_1 0x300140
/* [R 32] Parity register #0 read */
#define USEM_REG_USEM_PRTY_STS_0 0x300124
#define USEM_REG_USEM_PRTY_STS_1 0x300134
/* [RW 2] The queue index for registration on Aux1 counter flag. */
#define XCM_REG_AUX1_Q 0x20134
/* [RW 2] Per each decision rule the queue index to register to. */
#define XCM_REG_AUX_CNT_FLG_Q_19 0x201b0
/* [R 5] Used to read the XX protection CAM occupancy counter. */
#define XCM_REG_CAM_OCCUP 0x20244
/* [RW 1] CDU AG read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define XCM_REG_CDU_AG_RD_IFEN 0x20044
/* [RW 1] CDU AG write Interface enable. If 0 - the request and valid input
are disregarded; all other signals are treated as usual; if 1 - normal
activity. */
#define XCM_REG_CDU_AG_WR_IFEN 0x20040
/* [RW 1] CDU STORM read Interface enable. If 0 - the request input is
disregarded; valid output is deasserted; all other signals are treated as
usual; if 1 - normal activity. */
#define XCM_REG_CDU_SM_RD_IFEN 0x2004c
/* [RW 1] CDU STORM write Interface enable. If 0 - the request and valid
input is disregarded; all other signals are treated as usual; if 1 -
normal activity. */
#define XCM_REG_CDU_SM_WR_IFEN 0x20048
/* [RW 4] CFC output initial credit. Max credit available - 15.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 1 at start-up. */
#define XCM_REG_CFC_INIT_CRD 0x20404
/* [RW 3] The weight of the CP input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_CP_WEIGHT 0x200dc
/* [RW 1] Input csem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_CSEM_IFEN 0x20028
/* [RC 1] Set at message length mismatch (relative to last indication) at
the csem interface. */
#define XCM_REG_CSEM_LENGTH_MIS 0x20228
/* [RW 3] The weight of the input csem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_CSEM_WEIGHT 0x200c4
/* [RW 1] Input dorq Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_DORQ_IFEN 0x20030
/* [RC 1] Set at message length mismatch (relative to last indication) at
the dorq interface. */
#define XCM_REG_DORQ_LENGTH_MIS 0x20230
/* [RW 3] The weight of the input dorq in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_DORQ_WEIGHT 0x200cc
/* [RW 8] The Event ID in case the ErrorFlg input message bit is set. */
#define XCM_REG_ERR_EVNT_ID 0x200b0
/* [RW 28] The CM erroneous header for QM and Timers formatting. */
#define XCM_REG_ERR_XCM_HDR 0x200ac
/* [RW 8] The Event ID for Timers expiration. */
#define XCM_REG_EXPR_EVNT_ID 0x200b4
/* [RW 8] FIC0 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define XCM_REG_FIC0_INIT_CRD 0x2040c
/* [RW 8] FIC1 output initial credit. Max credit available - 255.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 64 at start-up. */
#define XCM_REG_FIC1_INIT_CRD 0x20410
#define XCM_REG_GLB_DEL_ACK_MAX_CNT_0 0x20118
#define XCM_REG_GLB_DEL_ACK_MAX_CNT_1 0x2011c
#define XCM_REG_GLB_DEL_ACK_TMR_VAL_0 0x20108
#define XCM_REG_GLB_DEL_ACK_TMR_VAL_1 0x2010c
/* [RW 1] Arbitratiojn between Input Arbiter groups: 0 - fair Round-Robin; 1
- strict priority defined by ~xcm_registers_gr_ag_pr.gr_ag_pr;
~xcm_registers_gr_ld0_pr.gr_ld0_pr and
~xcm_registers_gr_ld1_pr.gr_ld1_pr. */
#define XCM_REG_GR_ARB_TYPE 0x2020c
/* [RW 2] Load (FIC0) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed that the Channel group is the
compliment of the other 3 groups. */
#define XCM_REG_GR_LD0_PR 0x20214
/* [RW 2] Load (FIC1) channel group priority. The lowest priority is 0; the
highest priority is 3. It is supposed that the Channel group is the
compliment of the other 3 groups. */
#define XCM_REG_GR_LD1_PR 0x20218
/* [RW 1] Input nig0 Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_NIG0_IFEN 0x20038
/* [RC 1] Set at message length mismatch (relative to last indication) at
the nig0 interface. */
#define XCM_REG_NIG0_LENGTH_MIS 0x20238
/* [RW 3] The weight of the input nig0 in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_NIG0_WEIGHT 0x200d4
/* [RW 1] Input nig1 Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_NIG1_IFEN 0x2003c
/* [RC 1] Set at message length mismatch (relative to last indication) at
the nig1 interface. */
#define XCM_REG_NIG1_LENGTH_MIS 0x2023c
/* [RW 5] The number of double REG-pairs; loaded from the STORM context and
sent to STORM; for a specific connection type. The double REG-pairs are
used in order to align to STORM context row size of 128 bits. The offset
of these data in the STORM context is always 0. Index _i stands for the
connection type (one of 16). */
#define XCM_REG_N_SM_CTX_LD_0 0x20060
#define XCM_REG_N_SM_CTX_LD_1 0x20064
#define XCM_REG_N_SM_CTX_LD_2 0x20068
#define XCM_REG_N_SM_CTX_LD_3 0x2006c
#define XCM_REG_N_SM_CTX_LD_4 0x20070
#define XCM_REG_N_SM_CTX_LD_5 0x20074
/* [RW 1] Input pbf Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_PBF_IFEN 0x20034
/* [RC 1] Set at message length mismatch (relative to last indication) at
the pbf interface. */
#define XCM_REG_PBF_LENGTH_MIS 0x20234
/* [RW 3] The weight of the input pbf in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_PBF_WEIGHT 0x200d0
#define XCM_REG_PHYS_QNUM3_0 0x20100
#define XCM_REG_PHYS_QNUM3_1 0x20104
/* [RW 8] The Event ID for Timers formatting in case of stop done. */
#define XCM_REG_STOP_EVNT_ID 0x200b8
/* [RC 1] Set at message length mismatch (relative to last indication) at
the STORM interface. */
#define XCM_REG_STORM_LENGTH_MIS 0x2021c
/* [RW 3] The weight of the STORM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_STORM_WEIGHT 0x200bc
/* [RW 1] STORM - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_STORM_XCM_IFEN 0x20010
/* [RW 4] Timers output initial credit. Max credit available - 15.Write
writes the initial credit value; read returns the current value of the
credit counter. Must be initialized to 4 at start-up. */
#define XCM_REG_TM_INIT_CRD 0x2041c
/* [RW 3] The weight of the Timers input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_TM_WEIGHT 0x200ec
/* [RW 28] The CM header for Timers expiration command. */
#define XCM_REG_TM_XCM_HDR 0x200a8
/* [RW 1] Timers - CM Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_TM_XCM_IFEN 0x2001c
/* [RW 1] Input tsem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_TSEM_IFEN 0x20024
/* [RC 1] Set at message length mismatch (relative to last indication) at
the tsem interface. */
#define XCM_REG_TSEM_LENGTH_MIS 0x20224
/* [RW 3] The weight of the input tsem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_TSEM_WEIGHT 0x200c0
/* [RW 2] The queue index for registration on UNA greater NXT decision rule. */
#define XCM_REG_UNA_GT_NXT_Q 0x20120
/* [RW 1] Input usem Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_USEM_IFEN 0x2002c
/* [RC 1] Message length mismatch (relative to last indication) at the usem
interface. */
#define XCM_REG_USEM_LENGTH_MIS 0x2022c
/* [RW 3] The weight of the input usem in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_USEM_WEIGHT 0x200c8
#define XCM_REG_WU_DA_CNT_CMD00 0x201d4
#define XCM_REG_WU_DA_CNT_CMD01 0x201d8
#define XCM_REG_WU_DA_CNT_CMD10 0x201dc
#define XCM_REG_WU_DA_CNT_CMD11 0x201e0
#define XCM_REG_WU_DA_CNT_UPD_VAL00 0x201e4
#define XCM_REG_WU_DA_CNT_UPD_VAL01 0x201e8
#define XCM_REG_WU_DA_CNT_UPD_VAL10 0x201ec
#define XCM_REG_WU_DA_CNT_UPD_VAL11 0x201f0
#define XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00 0x201c4
#define XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD01 0x201c8
#define XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD10 0x201cc
#define XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD11 0x201d0
/* [RW 1] CM - CFC Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_XCM_CFC_IFEN 0x20050
/* [RW 14] Interrupt mask register #0 read/write */
#define XCM_REG_XCM_INT_MASK 0x202b4
/* [R 14] Interrupt register #0 read */
#define XCM_REG_XCM_INT_STS 0x202a8
/* [R 30] Parity register #0 read */
#define XCM_REG_XCM_PRTY_STS 0x202b8
/* [RW 4] The size of AG context region 0 in REG-pairs. Designates the MS
REG-pair number (e.g. if region 0 is 6 REG-pairs; the value should be 5).
Is used to determine the number of the AG context REG-pairs written back;
when the Reg1WbFlg isn't set. */
#define XCM_REG_XCM_REG0_SZ 0x200f4
/* [RW 1] CM - STORM 0 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_XCM_STORM0_IFEN 0x20004
/* [RW 1] CM - STORM 1 Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_XCM_STORM1_IFEN 0x20008
/* [RW 1] CM - Timers Interface enable. If 0 - the valid input is
disregarded; acknowledge output is deasserted; all other signals are
treated as usual; if 1 - normal activity. */
#define XCM_REG_XCM_TM_IFEN 0x20020
/* [RW 1] CM - QM Interface enable. If 0 - the acknowledge input is
disregarded; valid is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_XCM_XQM_IFEN 0x2000c
/* [RW 1] If set the Q index; received from the QM is inserted to event ID. */
#define XCM_REG_XCM_XQM_USE_Q 0x200f0
/* [RW 4] The value by which CFC updates the activity counter at QM bypass. */
#define XCM_REG_XQM_BYP_ACT_UPD 0x200fc
/* [RW 6] QM output initial credit. Max credit available - 32.Write writes
the initial credit value; read returns the current value of the credit
counter. Must be initialized to 32 at start-up. */
#define XCM_REG_XQM_INIT_CRD 0x20420
/* [RW 3] The weight of the QM (primary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_XQM_P_WEIGHT 0x200e4
/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
stands for weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_XQM_S_WEIGHT 0x200e8
/* [RW 28] The CM header value for QM request (primary). */
#define XCM_REG_XQM_XCM_HDR_P 0x200a0
/* [RW 28] The CM header value for QM request (secondary). */
#define XCM_REG_XQM_XCM_HDR_S 0x200a4
/* [RW 1] QM - CM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_XQM_XCM_IFEN 0x20014
/* [RW 1] Input SDM Interface enable. If 0 - the valid input is disregarded;
acknowledge output is deasserted; all other signals are treated as usual;
if 1 - normal activity. */
#define XCM_REG_XSDM_IFEN 0x20018
/* [RC 1] Set at message length mismatch (relative to last indication) at
the SDM interface. */
#define XCM_REG_XSDM_LENGTH_MIS 0x20220
/* [RW 3] The weight of the SDM input in the WRR mechanism. 0 stands for
weight 8 (the most prioritised); 1 stands for weight 1(least
prioritised); 2 stands for weight 2; tc. */
#define XCM_REG_XSDM_WEIGHT 0x200e0
/* [RW 17] Indirect access to the descriptor table of the XX protection
mechanism. The fields are: [5:0] - message length; 11:6] - message
pointer; 16:12] - next pointer. */
#define XCM_REG_XX_DESCR_TABLE 0x20480
#define XCM_REG_XX_DESCR_TABLE_SIZE 32
/* [R 6] Used to read the XX protection Free counter. */
#define XCM_REG_XX_FREE 0x20240
/* [RW 6] Initial value for the credit counter; responsible for fulfilling
of the Input Stage XX protection buffer by the XX protection pending
messages. Max credit available - 3.Write writes the initial credit value;
read returns the current value of the credit counter. Must be initialized
to 2 at start-up. */
#define XCM_REG_XX_INIT_CRD 0x20424
/* [RW 6] The maximum number of pending messages; which may be stored in XX
protection. ~xcm_registers_xx_free.xx_free read on read. */
#define XCM_REG_XX_MSG_NUM 0x20428
/* [RW 8] The Event ID; sent to the STORM in case of XX overflow. */
#define XCM_REG_XX_OVFL_EVNT_ID 0x20058
/* [RW 16] Indirect access to the XX table of the XX protection mechanism.
The fields are:[4:0] - tail pointer; 9:5] - Link List size; 14:10] -
header pointer. */
#define XCM_REG_XX_TABLE 0x20500
/* [RW 8] The event id for aggregated interrupt 0 */
#define XSDM_REG_AGG_INT_EVENT_0 0x166038
#define XSDM_REG_AGG_INT_EVENT_1 0x16603c
#define XSDM_REG_AGG_INT_EVENT_10 0x166060
#define XSDM_REG_AGG_INT_EVENT_11 0x166064
#define XSDM_REG_AGG_INT_EVENT_12 0x166068
#define XSDM_REG_AGG_INT_EVENT_13 0x16606c
#define XSDM_REG_AGG_INT_EVENT_14 0x166070
#define XSDM_REG_AGG_INT_EVENT_2 0x166040
#define XSDM_REG_AGG_INT_EVENT_3 0x166044
#define XSDM_REG_AGG_INT_EVENT_4 0x166048
#define XSDM_REG_AGG_INT_EVENT_5 0x16604c
#define XSDM_REG_AGG_INT_EVENT_6 0x166050
#define XSDM_REG_AGG_INT_EVENT_7 0x166054
#define XSDM_REG_AGG_INT_EVENT_8 0x166058
#define XSDM_REG_AGG_INT_EVENT_9 0x16605c
/* [RW 1] For each aggregated interrupt index whether the mode is normal (0)
or auto-mask-mode (1) */
#define XSDM_REG_AGG_INT_MODE_0 0x1661b8
#define XSDM_REG_AGG_INT_MODE_1 0x1661bc
/* [RW 13] The start address in the internal RAM for the cfc_rsp lcid */
#define XSDM_REG_CFC_RSP_START_ADDR 0x166008
/* [RW 16] The maximum value of the competion counter #0 */
#define XSDM_REG_CMP_COUNTER_MAX0 0x16601c
/* [RW 16] The maximum value of the competion counter #1 */
#define XSDM_REG_CMP_COUNTER_MAX1 0x166020
/* [RW 16] The maximum value of the competion counter #2 */
#define XSDM_REG_CMP_COUNTER_MAX2 0x166024
/* [RW 16] The maximum value of the competion counter #3 */
#define XSDM_REG_CMP_COUNTER_MAX3 0x166028
/* [RW 13] The start address in the internal RAM for the completion
counters. */
#define XSDM_REG_CMP_COUNTER_START_ADDR 0x16600c
#define XSDM_REG_ENABLE_IN1 0x166238
#define XSDM_REG_ENABLE_IN2 0x16623c
#define XSDM_REG_ENABLE_OUT1 0x166240
#define XSDM_REG_ENABLE_OUT2 0x166244
/* [RW 4] The initial number of messages that can be sent to the pxp control
interface without receiving any ACK. */
#define XSDM_REG_INIT_CREDIT_PXP_CTRL 0x1664bc
/* [ST 32] The number of ACK after placement messages received */
#define XSDM_REG_NUM_OF_ACK_AFTER_PLACE 0x16627c
/* [ST 32] The number of packet end messages received from the parser */
#define XSDM_REG_NUM_OF_PKT_END_MSG 0x166274
/* [ST 32] The number of requests received from the pxp async if */
#define XSDM_REG_NUM_OF_PXP_ASYNC_REQ 0x166278
/* [ST 32] The number of commands received in queue 0 */
#define XSDM_REG_NUM_OF_Q0_CMD 0x166248
/* [ST 32] The number of commands received in queue 10 */
#define XSDM_REG_NUM_OF_Q10_CMD 0x16626c
/* [ST 32] The number of commands received in queue 11 */
#define XSDM_REG_NUM_OF_Q11_CMD 0x166270
/* [ST 32] The number of commands received in queue 1 */
#define XSDM_REG_NUM_OF_Q1_CMD 0x16624c
/* [ST 32] The number of commands received in queue 3 */
#define XSDM_REG_NUM_OF_Q3_CMD 0x166250
/* [ST 32] The number of commands received in queue 4 */
#define XSDM_REG_NUM_OF_Q4_CMD 0x166254
/* [ST 32] The number of commands received in queue 5 */
#define XSDM_REG_NUM_OF_Q5_CMD 0x166258
/* [ST 32] The number of commands received in queue 6 */
#define XSDM_REG_NUM_OF_Q6_CMD 0x16625c
/* [ST 32] The number of commands received in queue 7 */
#define XSDM_REG_NUM_OF_Q7_CMD 0x166260
/* [ST 32] The number of commands received in queue 8 */
#define XSDM_REG_NUM_OF_Q8_CMD 0x166264
/* [ST 32] The number of commands received in queue 9 */
#define XSDM_REG_NUM_OF_Q9_CMD 0x166268
/* [RW 13] The start address in the internal RAM for queue counters */
#define XSDM_REG_Q_COUNTER_START_ADDR 0x166010
/* [R 1] pxp_ctrl rd_data fifo empty in sdm_dma_rsp block */
#define XSDM_REG_RSP_PXP_CTRL_RDATA_EMPTY 0x166548
/* [R 1] parser fifo empty in sdm_sync block */
#define XSDM_REG_SYNC_PARSER_EMPTY 0x166550
/* [R 1] parser serial fifo empty in sdm_sync block */
#define XSDM_REG_SYNC_SYNC_EMPTY 0x166558
/* [RW 32] Tick for timer counter. Applicable only when
~xsdm_registers_timer_tick_enable.timer_tick_enable =1 */
#define XSDM_REG_TIMER_TICK 0x166000
/* [RW 32] Interrupt mask register #0 read/write */
#define XSDM_REG_XSDM_INT_MASK_0 0x16629c
#define XSDM_REG_XSDM_INT_MASK_1 0x1662ac
/* [R 32] Interrupt register #0 read */
#define XSDM_REG_XSDM_INT_STS_0 0x166290
#define XSDM_REG_XSDM_INT_STS_1 0x1662a0
/* [RW 11] Parity mask register #0 read/write */
#define XSDM_REG_XSDM_PRTY_MASK 0x1662bc
/* [R 11] Parity register #0 read */
#define XSDM_REG_XSDM_PRTY_STS 0x1662b0
/* [RW 5] The number of time_slots in the arbitration cycle */
#define XSEM_REG_ARB_CYCLE_SIZE 0x280034
/* [RW 3] The source that is associated with arbitration element 0. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2 */
#define XSEM_REG_ARB_ELEMENT0 0x280020
/* [RW 3] The source that is associated with arbitration element 1. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~xsem_registers_arb_element0.arb_element0 */
#define XSEM_REG_ARB_ELEMENT1 0x280024
/* [RW 3] The source that is associated with arbitration element 2. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~xsem_registers_arb_element0.arb_element0
and ~xsem_registers_arb_element1.arb_element1 */
#define XSEM_REG_ARB_ELEMENT2 0x280028
/* [RW 3] The source that is associated with arbitration element 3. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.Could
not be equal to register ~xsem_registers_arb_element0.arb_element0 and
~xsem_registers_arb_element1.arb_element1 and
~xsem_registers_arb_element2.arb_element2 */
#define XSEM_REG_ARB_ELEMENT3 0x28002c
/* [RW 3] The source that is associated with arbitration element 4. Source
decoding is: 0- foc0; 1-fic1; 2-sleeping thread with priority 0; 3-
sleeping thread with priority 1; 4- sleeping thread with priority 2.
Could not be equal to register ~xsem_registers_arb_element0.arb_element0
and ~xsem_registers_arb_element1.arb_element1 and
~xsem_registers_arb_element2.arb_element2 and
~xsem_registers_arb_element3.arb_element3 */
#define XSEM_REG_ARB_ELEMENT4 0x280030
#define XSEM_REG_ENABLE_IN 0x2800a4
#define XSEM_REG_ENABLE_OUT 0x2800a8
/* [RW 32] This address space contains all registers and memories that are
placed in SEM_FAST block. The SEM_FAST registers are described in
appendix B. In order to access the sem_fast registers the base address
~fast_memory.fast_memory should be added to eachsem_fast register offset. */
#define XSEM_REG_FAST_MEMORY 0x2a0000
/* [RW 1] Disables input messages from FIC0 May be updated during run_time
by the microcode */
#define XSEM_REG_FIC0_DISABLE 0x280224
/* [RW 1] Disables input messages from FIC1 May be updated during run_time
by the microcode */
#define XSEM_REG_FIC1_DISABLE 0x280234
/* [RW 15] Interrupt table Read and write access to it is not possible in
the middle of the work */
#define XSEM_REG_INT_TABLE 0x280400
/* [ST 24] Statistics register. The number of messages that entered through
FIC0 */
#define XSEM_REG_MSG_NUM_FIC0 0x280000
/* [ST 24] Statistics register. The number of messages that entered through
FIC1 */
#define XSEM_REG_MSG_NUM_FIC1 0x280004
/* [ST 24] Statistics register. The number of messages that were sent to
FOC0 */
#define XSEM_REG_MSG_NUM_FOC0 0x280008
/* [ST 24] Statistics register. The number of messages that were sent to
FOC1 */
#define XSEM_REG_MSG_NUM_FOC1 0x28000c
/* [ST 24] Statistics register. The number of messages that were sent to
FOC2 */
#define XSEM_REG_MSG_NUM_FOC2 0x280010
/* [ST 24] Statistics register. The number of messages that were sent to
FOC3 */
#define XSEM_REG_MSG_NUM_FOC3 0x280014
/* [RW 1] Disables input messages from the passive buffer May be updated
during run_time by the microcode */
#define XSEM_REG_PAS_DISABLE 0x28024c
/* [WB 128] Debug only. Passive buffer memory */
#define XSEM_REG_PASSIVE_BUFFER 0x282000
/* [WB 46] pram memory. B45 is parity; b[44:0] - data. */
#define XSEM_REG_PRAM 0x2c0000
/* [R 16] Valid sleeping threads indication have bit per thread */
#define XSEM_REG_SLEEP_THREADS_VALID 0x28026c
/* [R 1] EXT_STORE FIFO is empty in sem_slow_ls_ext */
#define XSEM_REG_SLOW_EXT_STORE_EMPTY 0x2802a0
/* [RW 16] List of free threads . There is a bit per thread. */
#define XSEM_REG_THREADS_LIST 0x2802e4
/* [RW 3] The arbitration scheme of time_slot 0 */
#define XSEM_REG_TS_0_AS 0x280038
/* [RW 3] The arbitration scheme of time_slot 10 */
#define XSEM_REG_TS_10_AS 0x280060
/* [RW 3] The arbitration scheme of time_slot 11 */
#define XSEM_REG_TS_11_AS 0x280064
/* [RW 3] The arbitration scheme of time_slot 12 */
#define XSEM_REG_TS_12_AS 0x280068
/* [RW 3] The arbitration scheme of time_slot 13 */
#define XSEM_REG_TS_13_AS 0x28006c
/* [RW 3] The arbitration scheme of time_slot 14 */
#define XSEM_REG_TS_14_AS 0x280070
/* [RW 3] The arbitration scheme of time_slot 15 */
#define XSEM_REG_TS_15_AS 0x280074
/* [RW 3] The arbitration scheme of time_slot 16 */
#define XSEM_REG_TS_16_AS 0x280078
/* [RW 3] The arbitration scheme of time_slot 17 */
#define XSEM_REG_TS_17_AS 0x28007c
/* [RW 3] The arbitration scheme of time_slot 18 */
#define XSEM_REG_TS_18_AS 0x280080
/* [RW 3] The arbitration scheme of time_slot 1 */
#define XSEM_REG_TS_1_AS 0x28003c
/* [RW 3] The arbitration scheme of time_slot 2 */
#define XSEM_REG_TS_2_AS 0x280040
/* [RW 3] The arbitration scheme of time_slot 3 */
#define XSEM_REG_TS_3_AS 0x280044
/* [RW 3] The arbitration scheme of time_slot 4 */
#define XSEM_REG_TS_4_AS 0x280048
/* [RW 3] The arbitration scheme of time_slot 5 */
#define XSEM_REG_TS_5_AS 0x28004c
/* [RW 3] The arbitration scheme of time_slot 6 */
#define XSEM_REG_TS_6_AS 0x280050
/* [RW 3] The arbitration scheme of time_slot 7 */
#define XSEM_REG_TS_7_AS 0x280054
/* [RW 3] The arbitration scheme of time_slot 8 */
#define XSEM_REG_TS_8_AS 0x280058
/* [RW 3] The arbitration scheme of time_slot 9 */
#define XSEM_REG_TS_9_AS 0x28005c
/* [RW 32] Interrupt mask register #0 read/write */
#define XSEM_REG_XSEM_INT_MASK_0 0x280110
#define XSEM_REG_XSEM_INT_MASK_1 0x280120
/* [R 32] Interrupt register #0 read */
#define XSEM_REG_XSEM_INT_STS_0 0x280104
#define XSEM_REG_XSEM_INT_STS_1 0x280114
/* [RW 32] Parity mask register #0 read/write */
#define XSEM_REG_XSEM_PRTY_MASK_0 0x280130
#define XSEM_REG_XSEM_PRTY_MASK_1 0x280140
/* [R 32] Parity register #0 read */
#define XSEM_REG_XSEM_PRTY_STS_0 0x280124
#define XSEM_REG_XSEM_PRTY_STS_1 0x280134
#define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0)
#define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1)
#define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0)
#define MCPR_NVM_CFG4_FLASH_SIZE (0x7L<<0)
#define MCPR_NVM_COMMAND_DOIT (1L<<4)
#define MCPR_NVM_COMMAND_DONE (1L<<3)
#define MCPR_NVM_COMMAND_FIRST (1L<<7)
#define MCPR_NVM_COMMAND_LAST (1L<<8)
#define MCPR_NVM_COMMAND_WR (1L<<5)
#define MCPR_NVM_SW_ARB_ARB_ARB1 (1L<<9)
#define MCPR_NVM_SW_ARB_ARB_REQ_CLR1 (1L<<5)
#define MCPR_NVM_SW_ARB_ARB_REQ_SET1 (1L<<1)
#define BIGMAC_REGISTER_BMAC_CONTROL (0x00<<3)
#define BIGMAC_REGISTER_BMAC_XGXS_CONTROL (0x01<<3)
#define BIGMAC_REGISTER_CNT_MAX_SIZE (0x05<<3)
#define BIGMAC_REGISTER_RX_CONTROL (0x21<<3)
#define BIGMAC_REGISTER_RX_LLFC_MSG_FLDS (0x46<<3)
#define BIGMAC_REGISTER_RX_MAX_SIZE (0x23<<3)
#define BIGMAC_REGISTER_RX_STAT_GR64 (0x26<<3)
#define BIGMAC_REGISTER_RX_STAT_GRIPJ (0x42<<3)
#define BIGMAC_REGISTER_TX_CONTROL (0x07<<3)
#define BIGMAC_REGISTER_TX_MAX_SIZE (0x09<<3)
#define BIGMAC_REGISTER_TX_PAUSE_THRESHOLD (0x0A<<3)
#define BIGMAC_REGISTER_TX_SOURCE_ADDR (0x08<<3)
#define BIGMAC_REGISTER_TX_STAT_GTBYT (0x20<<3)
#define BIGMAC_REGISTER_TX_STAT_GTPKT (0x0C<<3)
#define EMAC_LED_1000MB_OVERRIDE (1L<<1)
#define EMAC_LED_100MB_OVERRIDE (1L<<2)
#define EMAC_LED_10MB_OVERRIDE (1L<<3)
#define EMAC_LED_2500MB_OVERRIDE (1L<<12)
#define EMAC_LED_OVERRIDE (1L<<0)
#define EMAC_LED_TRAFFIC (1L<<6)
#define EMAC_MDIO_COMM_COMMAND_ADDRESS (0L<<26)
#define EMAC_MDIO_COMM_COMMAND_READ_45 (3L<<26)
#define EMAC_MDIO_COMM_COMMAND_WRITE_45 (1L<<26)
#define EMAC_MDIO_COMM_DATA (0xffffL<<0)
#define EMAC_MDIO_COMM_START_BUSY (1L<<29)
#define EMAC_MDIO_MODE_AUTO_POLL (1L<<4)
#define EMAC_MDIO_MODE_CLAUSE_45 (1L<<31)
#define EMAC_MDIO_MODE_CLOCK_CNT (0x3fL<<16)
#define EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT 16
#define EMAC_MODE_25G_MODE (1L<<5)
#define EMAC_MODE_HALF_DUPLEX (1L<<1)
#define EMAC_MODE_PORT_GMII (2L<<2)
#define EMAC_MODE_PORT_MII (1L<<2)
#define EMAC_MODE_PORT_MII_10M (3L<<2)
#define EMAC_MODE_RESET (1L<<0)
#define EMAC_REG_EMAC_LED 0xc
#define EMAC_REG_EMAC_MAC_MATCH 0x10
#define EMAC_REG_EMAC_MDIO_COMM 0xac
#define EMAC_REG_EMAC_MDIO_MODE 0xb4
#define EMAC_REG_EMAC_MODE 0x0
#define EMAC_REG_EMAC_RX_MODE 0xc8
#define EMAC_REG_EMAC_RX_MTU_SIZE 0x9c
#define EMAC_REG_EMAC_RX_STAT_AC 0x180
#define EMAC_REG_EMAC_RX_STAT_AC_28 0x1f4
#define EMAC_REG_EMAC_RX_STAT_AC_COUNT 23
#define EMAC_REG_EMAC_TX_MODE 0xbc
#define EMAC_REG_EMAC_TX_STAT_AC 0x280
#define EMAC_REG_EMAC_TX_STAT_AC_COUNT 22
#define EMAC_RX_MODE_FLOW_EN (1L<<2)
#define EMAC_RX_MODE_KEEP_VLAN_TAG (1L<<10)
#define EMAC_RX_MODE_PROMISCUOUS (1L<<8)
#define EMAC_RX_MODE_RESET (1L<<0)
#define EMAC_RX_MTU_SIZE_JUMBO_ENA (1L<<31)
#define EMAC_TX_MODE_EXT_PAUSE_EN (1L<<3)
#define EMAC_TX_MODE_FLOW_EN (1L<<4)
#define EMAC_TX_MODE_RESET (1L<<0)
#define MISC_REGISTERS_GPIO_0 0
#define MISC_REGISTERS_GPIO_1 1
#define MISC_REGISTERS_GPIO_2 2
#define MISC_REGISTERS_GPIO_3 3
#define MISC_REGISTERS_GPIO_CLR_POS 16
#define MISC_REGISTERS_GPIO_FLOAT (0xffL<<24)
#define MISC_REGISTERS_GPIO_FLOAT_POS 24
#define MISC_REGISTERS_GPIO_HIGH 1
#define MISC_REGISTERS_GPIO_INPUT_HI_Z 2
#define MISC_REGISTERS_GPIO_INT_CLR_POS 24
#define MISC_REGISTERS_GPIO_INT_OUTPUT_CLR 0
#define MISC_REGISTERS_GPIO_INT_OUTPUT_SET 1
#define MISC_REGISTERS_GPIO_INT_SET_POS 16
#define MISC_REGISTERS_GPIO_LOW 0
#define MISC_REGISTERS_GPIO_OUTPUT_HIGH 1
#define MISC_REGISTERS_GPIO_OUTPUT_LOW 0
#define MISC_REGISTERS_GPIO_PORT_SHIFT 4
#define MISC_REGISTERS_GPIO_SET_POS 8
#define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588
#define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7)
#define MISC_REGISTERS_RESET_REG_1_SET 0x584
#define MISC_REGISTERS_RESET_REG_2_CLEAR 0x598
#define MISC_REGISTERS_RESET_REG_2_RST_BMAC0 (0x1<<0)
#define MISC_REGISTERS_RESET_REG_2_RST_EMAC0_HARD_CORE (0x1<<14)
#define MISC_REGISTERS_RESET_REG_2_SET 0x594
#define MISC_REGISTERS_RESET_REG_3_CLEAR 0x5a8
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_SERDES0_IDDQ (0x1<<1)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_SERDES0_PWRDWN (0x1<<2)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_SERDES0_PWRDWN_SD (0x1<<3)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_SERDES0_RSTB_HW (0x1<<0)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_IDDQ (0x1<<5)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_PWRDWN (0x1<<6)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_PWRDWN_SD (0x1<<7)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_RSTB_HW (0x1<<4)
#define MISC_REGISTERS_RESET_REG_3_MISC_NIG_MUX_XGXS0_TXD_FIFO_RSTB (0x1<<8)
#define MISC_REGISTERS_RESET_REG_3_SET 0x5a4
#define MISC_REGISTERS_SPIO_4 4
#define MISC_REGISTERS_SPIO_5 5
#define MISC_REGISTERS_SPIO_7 7
#define MISC_REGISTERS_SPIO_CLR_POS 16
#define MISC_REGISTERS_SPIO_FLOAT (0xffL<<24)
#define MISC_REGISTERS_SPIO_FLOAT_POS 24
#define MISC_REGISTERS_SPIO_INPUT_HI_Z 2
#define MISC_REGISTERS_SPIO_INT_OLD_SET_POS 16
#define MISC_REGISTERS_SPIO_OUTPUT_HIGH 1
#define MISC_REGISTERS_SPIO_OUTPUT_LOW 0
#define MISC_REGISTERS_SPIO_SET_POS 8
#define HW_LOCK_MAX_RESOURCE_VALUE 31
#define HW_LOCK_RESOURCE_GPIO 1
#define HW_LOCK_RESOURCE_MDIO 0
#define HW_LOCK_RESOURCE_PORT0_ATT_MASK 3
#define HW_LOCK_RESOURCE_SPIO 2
#define HW_LOCK_RESOURCE_UNDI 5
#define PRS_FLAG_OVERETH_IPV4 1
#define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR (1<<18)
#define AEU_INPUTS_ATTN_BITS_CCM_HW_INTERRUPT (1<<31)
#define AEU_INPUTS_ATTN_BITS_CDU_HW_INTERRUPT (1<<9)
#define AEU_INPUTS_ATTN_BITS_CDU_PARITY_ERROR (1<<8)
#define AEU_INPUTS_ATTN_BITS_CFC_HW_INTERRUPT (1<<7)
#define AEU_INPUTS_ATTN_BITS_CFC_PARITY_ERROR (1<<6)
#define AEU_INPUTS_ATTN_BITS_CSDM_HW_INTERRUPT (1<<29)
#define AEU_INPUTS_ATTN_BITS_CSDM_PARITY_ERROR (1<<28)
#define AEU_INPUTS_ATTN_BITS_CSEMI_HW_INTERRUPT (1<<1)
#define AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR (1<<0)
#define AEU_INPUTS_ATTN_BITS_DEBUG_PARITY_ERROR (1<<18)
#define AEU_INPUTS_ATTN_BITS_DMAE_HW_INTERRUPT (1<<11)
#define AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT (1<<13)
#define AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR (1<<12)
#define AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_0 (1<<5)
#define AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_1 (1<<9)
#define AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR (1<<12)
#define AEU_INPUTS_ATTN_BITS_MISC_HW_INTERRUPT (1<<15)
#define AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR (1<<14)
#define AEU_INPUTS_ATTN_BITS_PARSER_PARITY_ERROR (1<<20)
#define AEU_INPUTS_ATTN_BITS_PBCLIENT_PARITY_ERROR (1<<0)
#define AEU_INPUTS_ATTN_BITS_PBF_HW_INTERRUPT (1<<31)
#define AEU_INPUTS_ATTN_BITS_PXP_HW_INTERRUPT (1<<3)
#define AEU_INPUTS_ATTN_BITS_PXP_PARITY_ERROR (1<<2)
#define AEU_INPUTS_ATTN_BITS_PXPPCICLOCKCLIENT_HW_INTERRUPT (1<<5)
#define AEU_INPUTS_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR (1<<4)
#define AEU_INPUTS_ATTN_BITS_QM_HW_INTERRUPT (1<<3)
#define AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR (1<<2)
#define AEU_INPUTS_ATTN_BITS_SEARCHER_PARITY_ERROR (1<<22)
#define AEU_INPUTS_ATTN_BITS_SPIO5 (1<<15)
#define AEU_INPUTS_ATTN_BITS_TCM_HW_INTERRUPT (1<<27)
#define AEU_INPUTS_ATTN_BITS_TIMERS_HW_INTERRUPT (1<<5)
#define AEU_INPUTS_ATTN_BITS_TSDM_HW_INTERRUPT (1<<25)
#define AEU_INPUTS_ATTN_BITS_TSDM_PARITY_ERROR (1<<24)
#define AEU_INPUTS_ATTN_BITS_TSEMI_HW_INTERRUPT (1<<29)
#define AEU_INPUTS_ATTN_BITS_TSEMI_PARITY_ERROR (1<<28)
#define AEU_INPUTS_ATTN_BITS_UCM_HW_INTERRUPT (1<<23)
#define AEU_INPUTS_ATTN_BITS_UPB_HW_INTERRUPT (1<<27)
#define AEU_INPUTS_ATTN_BITS_UPB_PARITY_ERROR (1<<26)
#define AEU_INPUTS_ATTN_BITS_USDM_HW_INTERRUPT (1<<21)
#define AEU_INPUTS_ATTN_BITS_USDM_PARITY_ERROR (1<<20)
#define AEU_INPUTS_ATTN_BITS_USEMI_HW_INTERRUPT (1<<25)
#define AEU_INPUTS_ATTN_BITS_USEMI_PARITY_ERROR (1<<24)
#define AEU_INPUTS_ATTN_BITS_VAUX_PCI_CORE_PARITY_ERROR (1<<16)
#define AEU_INPUTS_ATTN_BITS_XCM_HW_INTERRUPT (1<<9)
#define AEU_INPUTS_ATTN_BITS_XSDM_HW_INTERRUPT (1<<7)
#define AEU_INPUTS_ATTN_BITS_XSDM_PARITY_ERROR (1<<6)
#define AEU_INPUTS_ATTN_BITS_XSEMI_HW_INTERRUPT (1<<11)
#define AEU_INPUTS_ATTN_BITS_XSEMI_PARITY_ERROR (1<<10)
#define RESERVED_GENERAL_ATTENTION_BIT_0 0
#define EVEREST_GEN_ATTN_IN_USE_MASK 0x3ffe0
#define EVEREST_LATCHED_ATTN_IN_USE_MASK 0xffe00000
#define RESERVED_GENERAL_ATTENTION_BIT_6 6
#define RESERVED_GENERAL_ATTENTION_BIT_7 7
#define RESERVED_GENERAL_ATTENTION_BIT_8 8
#define RESERVED_GENERAL_ATTENTION_BIT_9 9
#define RESERVED_GENERAL_ATTENTION_BIT_10 10
#define RESERVED_GENERAL_ATTENTION_BIT_11 11
#define RESERVED_GENERAL_ATTENTION_BIT_12 12
#define RESERVED_GENERAL_ATTENTION_BIT_13 13
#define RESERVED_GENERAL_ATTENTION_BIT_14 14
#define RESERVED_GENERAL_ATTENTION_BIT_15 15
#define RESERVED_GENERAL_ATTENTION_BIT_16 16
#define RESERVED_GENERAL_ATTENTION_BIT_17 17
#define RESERVED_GENERAL_ATTENTION_BIT_18 18
#define RESERVED_GENERAL_ATTENTION_BIT_19 19
#define RESERVED_GENERAL_ATTENTION_BIT_20 20
#define RESERVED_GENERAL_ATTENTION_BIT_21 21
/* storm asserts attention bits */
#define TSTORM_FATAL_ASSERT_ATTENTION_BIT RESERVED_GENERAL_ATTENTION_BIT_7
#define USTORM_FATAL_ASSERT_ATTENTION_BIT RESERVED_GENERAL_ATTENTION_BIT_8
#define CSTORM_FATAL_ASSERT_ATTENTION_BIT RESERVED_GENERAL_ATTENTION_BIT_9
#define XSTORM_FATAL_ASSERT_ATTENTION_BIT RESERVED_GENERAL_ATTENTION_BIT_10
/* mcp error attention bit */
#define MCP_FATAL_ASSERT_ATTENTION_BIT RESERVED_GENERAL_ATTENTION_BIT_11
/*E1H NIG status sync attention mapped to group 4-7*/
#define LINK_SYNC_ATTENTION_BIT_FUNC_0 RESERVED_GENERAL_ATTENTION_BIT_12
#define LINK_SYNC_ATTENTION_BIT_FUNC_1 RESERVED_GENERAL_ATTENTION_BIT_13
#define LINK_SYNC_ATTENTION_BIT_FUNC_2 RESERVED_GENERAL_ATTENTION_BIT_14
#define LINK_SYNC_ATTENTION_BIT_FUNC_3 RESERVED_GENERAL_ATTENTION_BIT_15
#define LINK_SYNC_ATTENTION_BIT_FUNC_4 RESERVED_GENERAL_ATTENTION_BIT_16
#define LINK_SYNC_ATTENTION_BIT_FUNC_5 RESERVED_GENERAL_ATTENTION_BIT_17
#define LINK_SYNC_ATTENTION_BIT_FUNC_6 RESERVED_GENERAL_ATTENTION_BIT_18
#define LINK_SYNC_ATTENTION_BIT_FUNC_7 RESERVED_GENERAL_ATTENTION_BIT_19
#define LATCHED_ATTN_RBCR 23
#define LATCHED_ATTN_RBCT 24
#define LATCHED_ATTN_RBCN 25
#define LATCHED_ATTN_RBCU 26
#define LATCHED_ATTN_RBCP 27
#define LATCHED_ATTN_TIMEOUT_GRC 28
#define LATCHED_ATTN_RSVD_GRC 29
#define LATCHED_ATTN_ROM_PARITY_MCP 30
#define LATCHED_ATTN_UM_RX_PARITY_MCP 31
#define LATCHED_ATTN_UM_TX_PARITY_MCP 32
#define LATCHED_ATTN_SCPAD_PARITY_MCP 33
#define GENERAL_ATTEN_WORD(atten_name) ((94 + atten_name) / 32)
#define GENERAL_ATTEN_OFFSET(atten_name)\
(1UL << ((94 + atten_name) % 32))
/*
* This file defines GRC base address for every block.
* This file is included by chipsim, asm microcode and cpp microcode.
* These values are used in Design.xml on regBase attribute
* Use the base with the generated offsets of specific registers.
*/
#define GRCBASE_PXPCS 0x000000
#define GRCBASE_PCICONFIG 0x002000
#define GRCBASE_PCIREG 0x002400
#define GRCBASE_EMAC0 0x008000
#define GRCBASE_EMAC1 0x008400
#define GRCBASE_DBU 0x008800
#define GRCBASE_MISC 0x00A000
#define GRCBASE_DBG 0x00C000
#define GRCBASE_NIG 0x010000
#define GRCBASE_XCM 0x020000
#define GRCBASE_PRS 0x040000
#define GRCBASE_SRCH 0x040400
#define GRCBASE_TSDM 0x042000
#define GRCBASE_TCM 0x050000
#define GRCBASE_BRB1 0x060000
#define GRCBASE_MCP 0x080000
#define GRCBASE_UPB 0x0C1000
#define GRCBASE_CSDM 0x0C2000
#define GRCBASE_USDM 0x0C4000
#define GRCBASE_CCM 0x0D0000
#define GRCBASE_UCM 0x0E0000
#define GRCBASE_CDU 0x101000
#define GRCBASE_DMAE 0x102000
#define GRCBASE_PXP 0x103000
#define GRCBASE_CFC 0x104000
#define GRCBASE_HC 0x108000
#define GRCBASE_PXP2 0x120000
#define GRCBASE_PBF 0x140000
#define GRCBASE_XPB 0x161000
#define GRCBASE_TIMERS 0x164000
#define GRCBASE_XSDM 0x166000
#define GRCBASE_QM 0x168000
#define GRCBASE_DQ 0x170000
#define GRCBASE_TSEM 0x180000
#define GRCBASE_CSEM 0x200000
#define GRCBASE_XSEM 0x280000
#define GRCBASE_USEM 0x300000
#define GRCBASE_MISC_AEU GRCBASE_MISC
/* offset of configuration space in the pci core register */
#define PCICFG_OFFSET 0x2000
#define PCICFG_VENDOR_ID_OFFSET 0x00
#define PCICFG_DEVICE_ID_OFFSET 0x02
#define PCICFG_COMMAND_OFFSET 0x04
#define PCICFG_COMMAND_IO_SPACE (1<<0)
#define PCICFG_COMMAND_MEM_SPACE (1<<1)
#define PCICFG_COMMAND_BUS_MASTER (1<<2)
#define PCICFG_COMMAND_SPECIAL_CYCLES (1<<3)
#define PCICFG_COMMAND_MWI_CYCLES (1<<4)
#define PCICFG_COMMAND_VGA_SNOOP (1<<5)
#define PCICFG_COMMAND_PERR_ENA (1<<6)
#define PCICFG_COMMAND_STEPPING (1<<7)
#define PCICFG_COMMAND_SERR_ENA (1<<8)
#define PCICFG_COMMAND_FAST_B2B (1<<9)
#define PCICFG_COMMAND_INT_DISABLE (1<<10)
#define PCICFG_COMMAND_RESERVED (0x1f<<11)
#define PCICFG_STATUS_OFFSET 0x06
#define PCICFG_REVESION_ID_OFFSET 0x08
#define PCICFG_CACHE_LINE_SIZE 0x0c
#define PCICFG_LATENCY_TIMER 0x0d
#define PCICFG_BAR_1_LOW 0x10
#define PCICFG_BAR_1_HIGH 0x14
#define PCICFG_BAR_2_LOW 0x18
#define PCICFG_BAR_2_HIGH 0x1c
#define PCICFG_SUBSYSTEM_VENDOR_ID_OFFSET 0x2c
#define PCICFG_SUBSYSTEM_ID_OFFSET 0x2e
#define PCICFG_INT_LINE 0x3c
#define PCICFG_INT_PIN 0x3d
#define PCICFG_PM_CAPABILITY 0x48
#define PCICFG_PM_CAPABILITY_VERSION (0x3<<16)
#define PCICFG_PM_CAPABILITY_CLOCK (1<<19)
#define PCICFG_PM_CAPABILITY_RESERVED (1<<20)
#define PCICFG_PM_CAPABILITY_DSI (1<<21)
#define PCICFG_PM_CAPABILITY_AUX_CURRENT (0x7<<22)
#define PCICFG_PM_CAPABILITY_D1_SUPPORT (1<<25)
#define PCICFG_PM_CAPABILITY_D2_SUPPORT (1<<26)
#define PCICFG_PM_CAPABILITY_PME_IN_D0 (1<<27)
#define PCICFG_PM_CAPABILITY_PME_IN_D1 (1<<28)
#define PCICFG_PM_CAPABILITY_PME_IN_D2 (1<<29)
#define PCICFG_PM_CAPABILITY_PME_IN_D3_HOT (1<<30)
#define PCICFG_PM_CAPABILITY_PME_IN_D3_COLD (1<<31)
#define PCICFG_PM_CSR_OFFSET 0x4c
#define PCICFG_PM_CSR_STATE (0x3<<0)
#define PCICFG_PM_CSR_PME_ENABLE (1<<8)
#define PCICFG_PM_CSR_PME_STATUS (1<<15)
#define PCICFG_MSI_CAP_ID_OFFSET 0x58
#define PCICFG_MSI_CONTROL_ENABLE (0x1<<16)
#define PCICFG_MSI_CONTROL_MCAP (0x7<<17)
#define PCICFG_MSI_CONTROL_MENA (0x7<<20)
#define PCICFG_MSI_CONTROL_64_BIT_ADDR_CAP (0x1<<23)
#define PCICFG_MSI_CONTROL_MSI_PVMASK_CAPABLE (0x1<<24)
#define PCICFG_GRC_ADDRESS 0x78
#define PCICFG_GRC_DATA 0x80
#define PCICFG_MSIX_CAP_ID_OFFSET 0xa0
#define PCICFG_MSIX_CONTROL_TABLE_SIZE (0x7ff<<16)
#define PCICFG_MSIX_CONTROL_RESERVED (0x7<<27)
#define PCICFG_MSIX_CONTROL_FUNC_MASK (0x1<<30)
#define PCICFG_MSIX_CONTROL_MSIX_ENABLE (0x1<<31)
#define PCICFG_DEVICE_CONTROL 0xb4
#define PCICFG_DEVICE_STATUS 0xb6
#define PCICFG_DEVICE_STATUS_CORR_ERR_DET (1<<0)
#define PCICFG_DEVICE_STATUS_NON_FATAL_ERR_DET (1<<1)
#define PCICFG_DEVICE_STATUS_FATAL_ERR_DET (1<<2)
#define PCICFG_DEVICE_STATUS_UNSUP_REQ_DET (1<<3)
#define PCICFG_DEVICE_STATUS_AUX_PWR_DET (1<<4)
#define PCICFG_DEVICE_STATUS_NO_PEND (1<<5)
#define PCICFG_LINK_CONTROL 0xbc
#define BAR_USTRORM_INTMEM 0x400000
#define BAR_CSTRORM_INTMEM 0x410000
#define BAR_XSTRORM_INTMEM 0x420000
#define BAR_TSTRORM_INTMEM 0x430000
/* for accessing the IGU in case of status block ACK */
#define BAR_IGU_INTMEM 0x440000
#define BAR_DOORBELL_OFFSET 0x800000
#define BAR_ME_REGISTER 0x450000
/* config_2 offset */
#define GRC_CONFIG_2_SIZE_REG 0x408
#define PCI_CONFIG_2_BAR1_SIZE (0xfL<<0)
#define PCI_CONFIG_2_BAR1_SIZE_DISABLED (0L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_64K (1L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_128K (2L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_256K (3L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_512K (4L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_1M (5L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_2M (6L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_4M (7L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_8M (8L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_16M (9L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_32M (10L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_64M (11L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_128M (12L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_256M (13L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_512M (14L<<0)
#define PCI_CONFIG_2_BAR1_SIZE_1G (15L<<0)
#define PCI_CONFIG_2_BAR1_64ENA (1L<<4)
#define PCI_CONFIG_2_EXP_ROM_RETRY (1L<<5)
#define PCI_CONFIG_2_CFG_CYCLE_RETRY (1L<<6)
#define PCI_CONFIG_2_FIRST_CFG_DONE (1L<<7)
#define PCI_CONFIG_2_EXP_ROM_SIZE (0xffL<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_DISABLED (0L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_2K (1L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_4K (2L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_8K (3L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_16K (4L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_32K (5L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_64K (6L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_128K (7L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_256K (8L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_512K (9L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_1M (10L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_2M (11L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_4M (12L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_8M (13L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_16M (14L<<8)
#define PCI_CONFIG_2_EXP_ROM_SIZE_32M (15L<<8)
#define PCI_CONFIG_2_BAR_PREFETCH (1L<<16)
#define PCI_CONFIG_2_RESERVED0 (0x7fffL<<17)
/* config_3 offset */
#define GRC_CONFIG_3_SIZE_REG 0x40c
#define PCI_CONFIG_3_STICKY_BYTE (0xffL<<0)
#define PCI_CONFIG_3_FORCE_PME (1L<<24)
#define PCI_CONFIG_3_PME_STATUS (1L<<25)
#define PCI_CONFIG_3_PME_ENABLE (1L<<26)
#define PCI_CONFIG_3_PM_STATE (0x3L<<27)
#define PCI_CONFIG_3_VAUX_PRESET (1L<<30)
#define PCI_CONFIG_3_PCI_POWER (1L<<31)
#define GRC_BAR2_CONFIG 0x4e0
#define PCI_CONFIG_2_BAR2_SIZE (0xfL<<0)
#define PCI_CONFIG_2_BAR2_SIZE_DISABLED (0L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_64K (1L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_128K (2L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_256K (3L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_512K (4L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_1M (5L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_2M (6L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_4M (7L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_8M (8L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_16M (9L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_32M (10L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_64M (11L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_128M (12L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_256M (13L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_512M (14L<<0)
#define PCI_CONFIG_2_BAR2_SIZE_1G (15L<<0)
#define PCI_CONFIG_2_BAR2_64ENA (1L<<4)
#define PCI_PM_DATA_A 0x410
#define PCI_PM_DATA_B 0x414
#define PCI_ID_VAL1 0x434
#define PCI_ID_VAL2 0x438
#define MDIO_REG_BANK_CL73_IEEEB0 0x0
#define MDIO_CL73_IEEEB0_CL73_AN_CONTROL 0x0
#define MDIO_CL73_IEEEB0_CL73_AN_CONTROL_RESTART_AN 0x0200
#define MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN 0x1000
#define MDIO_CL73_IEEEB0_CL73_AN_CONTROL_MAIN_RST 0x8000
#define MDIO_REG_BANK_CL73_IEEEB1 0x10
#define MDIO_CL73_IEEEB1_AN_ADV2 0x01
#define MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M 0x0000
#define MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX 0x0020
#define MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KX4 0x0040
#define MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KR 0x0080
#define MDIO_REG_BANK_RX0 0x80b0
#define MDIO_RX0_RX_STATUS 0x10
#define MDIO_RX0_RX_STATUS_SIGDET 0x8000
#define MDIO_RX0_RX_STATUS_RX_SEQ_DONE 0x1000
#define MDIO_RX0_RX_EQ_BOOST 0x1c
#define MDIO_RX0_RX_EQ_BOOST_EQUALIZER_CTRL_MASK 0x7
#define MDIO_RX0_RX_EQ_BOOST_OFFSET_CTRL 0x10
#define MDIO_REG_BANK_RX1 0x80c0
#define MDIO_RX1_RX_EQ_BOOST 0x1c
#define MDIO_RX1_RX_EQ_BOOST_EQUALIZER_CTRL_MASK 0x7
#define MDIO_RX1_RX_EQ_BOOST_OFFSET_CTRL 0x10
#define MDIO_REG_BANK_RX2 0x80d0
#define MDIO_RX2_RX_EQ_BOOST 0x1c
#define MDIO_RX2_RX_EQ_BOOST_EQUALIZER_CTRL_MASK 0x7
#define MDIO_RX2_RX_EQ_BOOST_OFFSET_CTRL 0x10
#define MDIO_REG_BANK_RX3 0x80e0
#define MDIO_RX3_RX_EQ_BOOST 0x1c
#define MDIO_RX3_RX_EQ_BOOST_EQUALIZER_CTRL_MASK 0x7
#define MDIO_RX3_RX_EQ_BOOST_OFFSET_CTRL 0x10
#define MDIO_REG_BANK_RX_ALL 0x80f0
#define MDIO_RX_ALL_RX_EQ_BOOST 0x1c
#define MDIO_RX_ALL_RX_EQ_BOOST_EQUALIZER_CTRL_MASK 0x7
#define MDIO_RX_ALL_RX_EQ_BOOST_OFFSET_CTRL 0x10
#define MDIO_REG_BANK_TX0 0x8060
#define MDIO_TX0_TX_DRIVER 0x17
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK 0xf000
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT 12
#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK 0x0f00
#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT 8
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK 0x00f0
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT 4
#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK 0x000e
#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT 1
#define MDIO_TX0_TX_DRIVER_ICBUF1T 1
#define MDIO_REG_BANK_TX1 0x8070
#define MDIO_TX1_TX_DRIVER 0x17
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK 0xf000
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT 12
#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK 0x0f00
#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT 8
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK 0x00f0
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT 4
#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK 0x000e
#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT 1
#define MDIO_TX0_TX_DRIVER_ICBUF1T 1
#define MDIO_REG_BANK_TX2 0x8080
#define MDIO_TX2_TX_DRIVER 0x17
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK 0xf000
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT 12
#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK 0x0f00
#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT 8
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK 0x00f0
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT 4
#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK 0x000e
#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT 1
#define MDIO_TX0_TX_DRIVER_ICBUF1T 1
#define MDIO_REG_BANK_TX3 0x8090
#define MDIO_TX3_TX_DRIVER 0x17
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK 0xf000
#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT 12
#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK 0x0f00
#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT 8
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK 0x00f0
#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT 4
#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK 0x000e
#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT 1
#define MDIO_TX0_TX_DRIVER_ICBUF1T 1
#define MDIO_REG_BANK_XGXS_BLOCK0 0x8000
#define MDIO_BLOCK0_XGXS_CONTROL 0x10
#define MDIO_REG_BANK_XGXS_BLOCK1 0x8010
#define MDIO_BLOCK1_LANE_CTRL0 0x15
#define MDIO_BLOCK1_LANE_CTRL1 0x16
#define MDIO_BLOCK1_LANE_CTRL2 0x17
#define MDIO_BLOCK1_LANE_PRBS 0x19
#define MDIO_REG_BANK_XGXS_BLOCK2 0x8100
#define MDIO_XGXS_BLOCK2_RX_LN_SWAP 0x10
#define MDIO_XGXS_BLOCK2_RX_LN_SWAP_ENABLE 0x8000
#define MDIO_XGXS_BLOCK2_RX_LN_SWAP_FORCE_ENABLE 0x4000
#define MDIO_XGXS_BLOCK2_TX_LN_SWAP 0x11
#define MDIO_XGXS_BLOCK2_TX_LN_SWAP_ENABLE 0x8000
#define MDIO_XGXS_BLOCK2_UNICORE_MODE_10G 0x14
#define MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_CX4_XGXS 0x0001
#define MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_HIGIG_XGXS 0x0010
#define MDIO_XGXS_BLOCK2_TEST_MODE_LANE 0x15
#define MDIO_REG_BANK_GP_STATUS 0x8120
#define MDIO_GP_STATUS_TOP_AN_STATUS1 0x1B
#define MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_AUTONEG_COMPLETE 0x0001
#define MDIO_GP_STATUS_TOP_AN_STATUS1_CL37_AUTONEG_COMPLETE 0x0002
#define MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS 0x0004
#define MDIO_GP_STATUS_TOP_AN_STATUS1_DUPLEX_STATUS 0x0008
#define MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_MR_LP_NP_AN_ABLE 0x0010
#define MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_LP_NP_BAM_ABLE 0x0020
#define MDIO_GP_STATUS_TOP_AN_STATUS1_PAUSE_RSOLUTION_TXSIDE 0x0040
#define MDIO_GP_STATUS_TOP_AN_STATUS1_PAUSE_RSOLUTION_RXSIDE 0x0080
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_MASK 0x3f00
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10M 0x0000
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_100M 0x0100
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_1G 0x0200
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_2_5G 0x0300
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_5G 0x0400
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_6G 0x0500
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_HIG 0x0600
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_CX4 0x0700
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_12G_HIG 0x0800
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_12_5G 0x0900
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_13G 0x0A00
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_15G 0x0B00
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_16G 0x0C00
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_1G_KX 0x0D00
#define MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_KX4 0x0E00
#define MDIO_REG_BANK_10G_PARALLEL_DETECT 0x8130
#define MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL 0x11
#define MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL_PARDET10G_EN 0x1
#define MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK 0x13
#define MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK_CNT (0xb71<<1)
#define MDIO_REG_BANK_SERDES_DIGITAL 0x8300
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1 0x10
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_FIBER_MODE 0x0001
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_TBI_IF 0x0002
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_SIGNAL_DETECT_EN 0x0004
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_INVERT_SIGNAL_DETECT 0x0008
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_AUTODET 0x0010
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_MSTR_MODE 0x0020
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL2 0x11
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN 0x0001
#define MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_AN_FST_TMR 0x0040
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1 0x14
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_DUPLEX 0x0004
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_SPEED_MASK 0x0018
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_SPEED_SHIFT 3
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_SPEED_2_5G 0x0018
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_SPEED_1G 0x0010
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_SPEED_100M 0x0008
#define MDIO_SERDES_DIGITAL_A_1000X_STATUS1_SPEED_10M 0x0000
#define MDIO_SERDES_DIGITAL_MISC1 0x18
#define MDIO_SERDES_DIGITAL_MISC1_REFCLK_SEL_MASK 0xE000
#define MDIO_SERDES_DIGITAL_MISC1_REFCLK_SEL_25M 0x0000
#define MDIO_SERDES_DIGITAL_MISC1_REFCLK_SEL_100M 0x2000
#define MDIO_SERDES_DIGITAL_MISC1_REFCLK_SEL_125M 0x4000
#define MDIO_SERDES_DIGITAL_MISC1_REFCLK_SEL_156_25M 0x6000
#define MDIO_SERDES_DIGITAL_MISC1_REFCLK_SEL_187_5M 0x8000
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_SEL 0x0010
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_MASK 0x000f
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_2_5G 0x0000
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_5G 0x0001
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_6G 0x0002
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_10G_HIG 0x0003
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_10G_CX4 0x0004
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_12G 0x0005
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_12_5G 0x0006
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_13G 0x0007
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_15G 0x0008
#define MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_16G 0x0009
#define MDIO_REG_BANK_OVER_1G 0x8320
#define MDIO_OVER_1G_DIGCTL_3_4 0x14
#define MDIO_OVER_1G_DIGCTL_3_4_MP_ID_MASK 0xffe0
#define MDIO_OVER_1G_DIGCTL_3_4_MP_ID_SHIFT 5
#define MDIO_OVER_1G_UP1 0x19
#define MDIO_OVER_1G_UP1_2_5G 0x0001
#define MDIO_OVER_1G_UP1_5G 0x0002
#define MDIO_OVER_1G_UP1_6G 0x0004
#define MDIO_OVER_1G_UP1_10G 0x0010
#define MDIO_OVER_1G_UP1_10GH 0x0008
#define MDIO_OVER_1G_UP1_12G 0x0020
#define MDIO_OVER_1G_UP1_12_5G 0x0040
#define MDIO_OVER_1G_UP1_13G 0x0080
#define MDIO_OVER_1G_UP1_15G 0x0100
#define MDIO_OVER_1G_UP1_16G 0x0200
#define MDIO_OVER_1G_UP2 0x1A
#define MDIO_OVER_1G_UP2_IPREDRIVER_MASK 0x0007
#define MDIO_OVER_1G_UP2_IDRIVER_MASK 0x0038
#define MDIO_OVER_1G_UP2_PREEMPHASIS_MASK 0x03C0
#define MDIO_OVER_1G_UP3 0x1B
#define MDIO_OVER_1G_UP3_HIGIG2 0x0001
#define MDIO_OVER_1G_LP_UP1 0x1C
#define MDIO_OVER_1G_LP_UP2 0x1D
#define MDIO_OVER_1G_LP_UP2_MR_ADV_OVER_1G_MASK 0x03ff
#define MDIO_OVER_1G_LP_UP2_PREEMPHASIS_MASK 0x0780
#define MDIO_OVER_1G_LP_UP2_PREEMPHASIS_SHIFT 7
#define MDIO_OVER_1G_LP_UP3 0x1E
#define MDIO_REG_BANK_REMOTE_PHY 0x8330
#define MDIO_REMOTE_PHY_MISC_RX_STATUS 0x10
#define MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_OVER1G_MSG 0x0010
#define MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_BRCM_OUI_MSG 0x0600
#define MDIO_REG_BANK_BAM_NEXT_PAGE 0x8350
#define MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL 0x10
#define MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL_BAM_MODE 0x0001
#define MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL_TETON_AN 0x0002
#define MDIO_REG_BANK_CL73_USERB0 0x8370
#define MDIO_CL73_USERB0_CL73_UCTRL 0x10
#define MDIO_CL73_USERB0_CL73_UCTRL_USTAT1_MUXSEL 0x0002
#define MDIO_CL73_USERB0_CL73_USTAT1 0x11
#define MDIO_CL73_USERB0_CL73_USTAT1_LINK_STATUS_CHECK 0x0100
#define MDIO_CL73_USERB0_CL73_USTAT1_AN_GOOD_CHECK_BAM37 0x0400
#define MDIO_CL73_USERB0_CL73_BAM_CTRL1 0x12
#define MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_EN 0x8000
#define MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_STATION_MNGR_EN 0x4000
#define MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_NP_AFTER_BP_EN 0x2000
#define MDIO_CL73_USERB0_CL73_BAM_CTRL3 0x14
#define MDIO_CL73_USERB0_CL73_BAM_CTRL3_USE_CL73_HCD_MR 0x0001
#define MDIO_REG_BANK_AER_BLOCK 0xFFD0
#define MDIO_AER_BLOCK_AER_REG 0x1E
#define MDIO_REG_BANK_COMBO_IEEE0 0xFFE0
#define MDIO_COMBO_IEEE0_MII_CONTROL 0x10
#define MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_MASK 0x2040
#define MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_10 0x0000
#define MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_100 0x2000
#define MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_1000 0x0040
#define MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX 0x0100
#define MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN 0x0200
#define MDIO_COMBO_IEEO_MII_CONTROL_AN_EN 0x1000
#define MDIO_COMBO_IEEO_MII_CONTROL_LOOPBACK 0x4000
#define MDIO_COMBO_IEEO_MII_CONTROL_RESET 0x8000
#define MDIO_COMBO_IEEE0_MII_STATUS 0x11
#define MDIO_COMBO_IEEE0_MII_STATUS_LINK_PASS 0x0004
#define MDIO_COMBO_IEEE0_MII_STATUS_AUTONEG_COMPLETE 0x0020
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV 0x14
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_FULL_DUPLEX 0x0020
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_HALF_DUPLEX 0x0040
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK 0x0180
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_NONE 0x0000
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_SYMMETRIC 0x0080
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC 0x0100
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH 0x0180
#define MDIO_COMBO_IEEE0_AUTO_NEG_ADV_NEXT_PAGE 0x8000
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1 0x15
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_NEXT_PAGE 0x8000
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_ACK 0x4000
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_PAUSE_MASK 0x0180
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_PAUSE_NONE 0x0000
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_PAUSE_BOTH 0x0180
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_HALF_DUP_CAP 0x0040
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_FULL_DUP_CAP 0x0020
/*WhenthelinkpartnerisinSGMIImode(bit0=1),then
bit15=link,bit12=duplex,bits11:10=speed,bit14=acknowledge.
Theotherbitsarereservedandshouldbezero*/
#define MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1_SGMII_MODE 0x0001
#define MDIO_PMA_DEVAD 0x1
/*ieee*/
#define MDIO_PMA_REG_CTRL 0x0
#define MDIO_PMA_REG_STATUS 0x1
#define MDIO_PMA_REG_10G_CTRL2 0x7
#define MDIO_PMA_REG_RX_SD 0xa
/*bcm*/
#define MDIO_PMA_REG_BCM_CTRL 0x0096
#define MDIO_PMA_REG_FEC_CTRL 0x00ab
#define MDIO_PMA_REG_RX_ALARM_CTRL 0x9000
#define MDIO_PMA_REG_LASI_CTRL 0x9002
#define MDIO_PMA_REG_RX_ALARM 0x9003
#define MDIO_PMA_REG_TX_ALARM 0x9004
#define MDIO_PMA_REG_LASI_STATUS 0x9005
#define MDIO_PMA_REG_PHY_IDENTIFIER 0xc800
#define MDIO_PMA_REG_DIGITAL_CTRL 0xc808
#define MDIO_PMA_REG_DIGITAL_STATUS 0xc809
#define MDIO_PMA_REG_TX_POWER_DOWN 0xca02
#define MDIO_PMA_REG_CMU_PLL_BYPASS 0xca09
#define MDIO_PMA_REG_MISC_CTRL 0xca0a
#define MDIO_PMA_REG_GEN_CTRL 0xca10
#define MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP 0x0188
#define MDIO_PMA_REG_GEN_CTRL_ROM_MICRO_RESET 0x018a
#define MDIO_PMA_REG_M8051_MSGIN_REG 0xca12
#define MDIO_PMA_REG_M8051_MSGOUT_REG 0xca13
#define MDIO_PMA_REG_ROM_VER1 0xca19
#define MDIO_PMA_REG_ROM_VER2 0xca1a
#define MDIO_PMA_REG_EDC_FFE_MAIN 0xca1b
#define MDIO_PMA_REG_PLL_BANDWIDTH 0xca1d
#define MDIO_PMA_REG_PLL_CTRL 0xca1e
#define MDIO_PMA_REG_MISC_CTRL0 0xca23
#define MDIO_PMA_REG_LRM_MODE 0xca3f
#define MDIO_PMA_REG_CDR_BANDWIDTH 0xca46
#define MDIO_PMA_REG_MISC_CTRL1 0xca85
#define MDIO_PMA_REG_SFP_TWO_WIRE_CTRL 0x8000
#define MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK 0x000c
#define MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE 0x0000
#define MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_COMPLETE 0x0004
#define MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IN_PROGRESS 0x0008
#define MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_FAILED 0x000c
#define MDIO_PMA_REG_SFP_TWO_WIRE_BYTE_CNT 0x8002
#define MDIO_PMA_REG_SFP_TWO_WIRE_MEM_ADDR 0x8003
#define MDIO_PMA_REG_8726_TWO_WIRE_DATA_BUF 0xc820
#define MDIO_PMA_REG_8726_TWO_WIRE_DATA_MASK 0xff
#define MDIO_PMA_REG_8726_TX_CTRL1 0xca01
#define MDIO_PMA_REG_8726_TX_CTRL2 0xca05
#define MDIO_PMA_REG_8727_TWO_WIRE_SLAVE_ADDR 0x8005
#define MDIO_PMA_REG_8727_TWO_WIRE_DATA_BUF 0x8007
#define MDIO_PMA_REG_8727_TWO_WIRE_DATA_MASK 0xff
#define MDIO_PMA_REG_8727_MISC_CTRL 0x8309
#define MDIO_PMA_REG_8727_TX_CTRL1 0xca02
#define MDIO_PMA_REG_8727_TX_CTRL2 0xca05
#define MDIO_PMA_REG_8727_PCS_OPT_CTRL 0xc808
#define MDIO_PMA_REG_8727_GPIO_CTRL 0xc80e
#define MDIO_PMA_REG_8073_CHIP_REV 0xc801
#define MDIO_PMA_REG_8073_SPEED_LINK_STATUS 0xc820
#define MDIO_PMA_REG_8073_XAUI_WA 0xc841
#define MDIO_PMA_REG_7101_RESET 0xc000
#define MDIO_PMA_REG_7107_LED_CNTL 0xc007
#define MDIO_PMA_REG_7101_VER1 0xc026
#define MDIO_PMA_REG_7101_VER2 0xc027
#define MDIO_PMA_REG_8481_PMD_SIGNAL 0xa811
#define MDIO_PMA_REG_8481_LED1_MASK 0xa82c
#define MDIO_PMA_REG_8481_LED2_MASK 0xa82f
#define MDIO_PMA_REG_8481_LED3_MASK 0xa832
#define MDIO_PMA_REG_8481_SIGNAL_MASK 0xa835
#define MDIO_PMA_REG_8481_LINK_SIGNAL 0xa83b
#define MDIO_WIS_DEVAD 0x2
/*bcm*/
#define MDIO_WIS_REG_LASI_CNTL 0x9002
#define MDIO_WIS_REG_LASI_STATUS 0x9005
#define MDIO_PCS_DEVAD 0x3
#define MDIO_PCS_REG_STATUS 0x0020
#define MDIO_PCS_REG_LASI_STATUS 0x9005
#define MDIO_PCS_REG_7101_DSP_ACCESS 0xD000
#define MDIO_PCS_REG_7101_SPI_MUX 0xD008
#define MDIO_PCS_REG_7101_SPI_CTRL_ADDR 0xE12A
#define MDIO_PCS_REG_7101_SPI_RESET_BIT (5)
#define MDIO_PCS_REG_7101_SPI_FIFO_ADDR 0xE02A
#define MDIO_PCS_REG_7101_SPI_FIFO_ADDR_WRITE_ENABLE_CMD (6)
#define MDIO_PCS_REG_7101_SPI_FIFO_ADDR_BULK_ERASE_CMD (0xC7)
#define MDIO_PCS_REG_7101_SPI_FIFO_ADDR_PAGE_PROGRAM_CMD (2)
#define MDIO_PCS_REG_7101_SPI_BYTES_TO_TRANSFER_ADDR 0xE028
#define MDIO_XS_DEVAD 0x4
#define MDIO_XS_PLL_SEQUENCER 0x8000
#define MDIO_XS_SFX7101_XGXS_TEST1 0xc00a
#define MDIO_XS_8706_REG_BANK_RX0 0x80bc
#define MDIO_XS_8706_REG_BANK_RX1 0x80cc
#define MDIO_XS_8706_REG_BANK_RX2 0x80dc
#define MDIO_XS_8706_REG_BANK_RX3 0x80ec
#define MDIO_XS_8706_REG_BANK_RXA 0x80fc
#define MDIO_AN_DEVAD 0x7
/*ieee*/
#define MDIO_AN_REG_CTRL 0x0000
#define MDIO_AN_REG_STATUS 0x0001
#define MDIO_AN_REG_STATUS_AN_COMPLETE 0x0020
#define MDIO_AN_REG_ADV_PAUSE 0x0010
#define MDIO_AN_REG_ADV_PAUSE_PAUSE 0x0400
#define MDIO_AN_REG_ADV_PAUSE_ASYMMETRIC 0x0800
#define MDIO_AN_REG_ADV_PAUSE_BOTH 0x0C00
#define MDIO_AN_REG_ADV_PAUSE_MASK 0x0C00
#define MDIO_AN_REG_ADV 0x0011
#define MDIO_AN_REG_ADV2 0x0012
#define MDIO_AN_REG_LP_AUTO_NEG 0x0013
#define MDIO_AN_REG_MASTER_STATUS 0x0021
/*bcm*/
#define MDIO_AN_REG_LINK_STATUS 0x8304
#define MDIO_AN_REG_CL37_CL73 0x8370
#define MDIO_AN_REG_CL37_AN 0xffe0
#define MDIO_AN_REG_CL37_FC_LD 0xffe4
#define MDIO_AN_REG_CL37_FC_LP 0xffe5
#define MDIO_AN_REG_8073_2_5G 0x8329
#define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0
#define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4
#define MDIO_AN_REG_8481_1000T_CTRL 0xffe9
#define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5
#define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7
#define MDIO_AN_REG_8481_LEGACY_SHADOW 0xfffc
#define IGU_FUNC_BASE 0x0400
#define IGU_ADDR_MSIX 0x0000
#define IGU_ADDR_INT_ACK 0x0200
#define IGU_ADDR_PROD_UPD 0x0201
#define IGU_ADDR_ATTN_BITS_UPD 0x0202
#define IGU_ADDR_ATTN_BITS_SET 0x0203
#define IGU_ADDR_ATTN_BITS_CLR 0x0204
#define IGU_ADDR_COALESCE_NOW 0x0205
#define IGU_ADDR_SIMD_MASK 0x0206
#define IGU_ADDR_SIMD_NOMASK 0x0207
#define IGU_ADDR_MSI_CTL 0x0210
#define IGU_ADDR_MSI_ADDR_LO 0x0211
#define IGU_ADDR_MSI_ADDR_HI 0x0212
#define IGU_ADDR_MSI_DATA 0x0213
#define IGU_INT_ENABLE 0
#define IGU_INT_DISABLE 1
#define IGU_INT_NOP 2
#define IGU_INT_NOP2 3
#define COMMAND_REG_INT_ACK 0x0
#define COMMAND_REG_PROD_UPD 0x4
#define COMMAND_REG_ATTN_BITS_UPD 0x8
#define COMMAND_REG_ATTN_BITS_SET 0xc
#define COMMAND_REG_ATTN_BITS_CLR 0x10
#define COMMAND_REG_COALESCE_NOW 0x14
#define COMMAND_REG_SIMD_MASK 0x18
#define COMMAND_REG_SIMD_NOMASK 0x1c
#define IGU_MEM_BASE 0x0000
#define IGU_MEM_MSIX_BASE 0x0000
#define IGU_MEM_MSIX_UPPER 0x007f
#define IGU_MEM_MSIX_RESERVED_UPPER 0x01ff
#define IGU_MEM_PBA_MSIX_BASE 0x0200
#define IGU_MEM_PBA_MSIX_UPPER 0x0200
#define IGU_CMD_BACKWARD_COMP_PROD_UPD 0x0201
#define IGU_MEM_PBA_MSIX_RESERVED_UPPER 0x03ff
#define IGU_CMD_INT_ACK_BASE 0x0400
#define IGU_CMD_INT_ACK_UPPER\
(IGU_CMD_INT_ACK_BASE + MAX_SB_PER_PORT * NUM_OF_PORTS_PER_PATH - 1)
#define IGU_CMD_INT_ACK_RESERVED_UPPER 0x04ff
#define IGU_CMD_E2_PROD_UPD_BASE 0x0500
#define IGU_CMD_E2_PROD_UPD_UPPER\
(IGU_CMD_E2_PROD_UPD_BASE + MAX_SB_PER_PORT * NUM_OF_PORTS_PER_PATH - 1)
#define IGU_CMD_E2_PROD_UPD_RESERVED_UPPER 0x059f
#define IGU_CMD_ATTN_BIT_UPD_UPPER 0x05a0
#define IGU_CMD_ATTN_BIT_SET_UPPER 0x05a1
#define IGU_CMD_ATTN_BIT_CLR_UPPER 0x05a2
#define IGU_REG_SISR_MDPC_WMASK_UPPER 0x05a3
#define IGU_REG_SISR_MDPC_WMASK_LSB_UPPER 0x05a4
#define IGU_REG_SISR_MDPC_WMASK_MSB_UPPER 0x05a5
#define IGU_REG_SISR_MDPC_WOMASK_UPPER 0x05a6
#define IGU_REG_RESERVED_UPPER 0x05ff
#define CDU_REGION_NUMBER_XCM_AG 2
#define CDU_REGION_NUMBER_UCM_AG 4
/**
* String-to-compress [31:8] = CID (all 24 bits)
* String-to-compress [7:4] = Region
* String-to-compress [3:0] = Type
*/
#define CDU_VALID_DATA(_cid, _region, _type)\
(((_cid) << 8) | (((_region)&0xf)<<4) | (((_type)&0xf)))
#define CDU_CRC8(_cid, _region, _type)\
(calc_crc8(CDU_VALID_DATA(_cid, _region, _type), 0xff))
#define CDU_RSRVD_VALUE_TYPE_A(_cid, _region, _type)\
(0x80 | ((CDU_CRC8(_cid, _region, _type)) & 0x7f))
#define CDU_RSRVD_VALUE_TYPE_B(_crc, _type)\
(0x80 | ((_type)&0xf << 3) | ((CDU_CRC8(_cid, _region, _type)) & 0x7))
#define CDU_RSRVD_INVALIDATE_CONTEXT_VALUE(_val) ((_val) & ~0x80)
/******************************************************************************
* Description:
* Calculates crc 8 on a word value: polynomial 0-1-2-8
* Code was translated from Verilog.
* Return:
*****************************************************************************/
static inline u8 calc_crc8(u32 data, u8 crc)
{
u8 D[32];
u8 NewCRC[8];
u8 C[8];
u8 crc_res;
u8 i;
/* split the data into 31 bits */
for (i = 0; i < 32; i++) {
D[i] = (u8)(data & 1);
data = data >> 1;
}
/* split the crc into 8 bits */
for (i = 0; i < 8; i++) {
C[i] = crc & 1;
crc = crc >> 1;
}
NewCRC[0] = D[31] ^ D[30] ^ D[28] ^ D[23] ^ D[21] ^ D[19] ^ D[18] ^
D[16] ^ D[14] ^ D[12] ^ D[8] ^ D[7] ^ D[6] ^ D[0] ^ C[4] ^
C[6] ^ C[7];
NewCRC[1] = D[30] ^ D[29] ^ D[28] ^ D[24] ^ D[23] ^ D[22] ^ D[21] ^
D[20] ^ D[18] ^ D[17] ^ D[16] ^ D[15] ^ D[14] ^ D[13] ^
D[12] ^ D[9] ^ D[6] ^ D[1] ^ D[0] ^ C[0] ^ C[4] ^ C[5] ^
C[6];
NewCRC[2] = D[29] ^ D[28] ^ D[25] ^ D[24] ^ D[22] ^ D[17] ^ D[15] ^
D[13] ^ D[12] ^ D[10] ^ D[8] ^ D[6] ^ D[2] ^ D[1] ^ D[0] ^
C[0] ^ C[1] ^ C[4] ^ C[5];
NewCRC[3] = D[30] ^ D[29] ^ D[26] ^ D[25] ^ D[23] ^ D[18] ^ D[16] ^
D[14] ^ D[13] ^ D[11] ^ D[9] ^ D[7] ^ D[3] ^ D[2] ^ D[1] ^
C[1] ^ C[2] ^ C[5] ^ C[6];
NewCRC[4] = D[31] ^ D[30] ^ D[27] ^ D[26] ^ D[24] ^ D[19] ^ D[17] ^
D[15] ^ D[14] ^ D[12] ^ D[10] ^ D[8] ^ D[4] ^ D[3] ^ D[2] ^
C[0] ^ C[2] ^ C[3] ^ C[6] ^ C[7];
NewCRC[5] = D[31] ^ D[28] ^ D[27] ^ D[25] ^ D[20] ^ D[18] ^ D[16] ^
D[15] ^ D[13] ^ D[11] ^ D[9] ^ D[5] ^ D[4] ^ D[3] ^ C[1] ^
C[3] ^ C[4] ^ C[7];
NewCRC[6] = D[29] ^ D[28] ^ D[26] ^ D[21] ^ D[19] ^ D[17] ^ D[16] ^
D[14] ^ D[12] ^ D[10] ^ D[6] ^ D[5] ^ D[4] ^ C[2] ^ C[4] ^
C[5];
NewCRC[7] = D[30] ^ D[29] ^ D[27] ^ D[22] ^ D[20] ^ D[18] ^ D[17] ^
D[15] ^ D[13] ^ D[11] ^ D[7] ^ D[6] ^ D[5] ^ C[3] ^ C[5] ^
C[6];
crc_res = 0;
for (i = 0; i < 8; i++)
crc_res |= (NewCRC[i] << i);
return crc_res;
}
| {
"content_hash": "a71d12240c06e5ca120c4c24728ff601",
"timestamp": "",
"source": "github",
"line_count": 5305,
"max_line_length": 79,
"avg_line_length": 51.74665409990575,
"alnum_prop": 0.7041374637543896,
"repo_name": "lunaczp/learning",
"id": "aa76cbada5e2ad4adbdbc45e15aa2b6e70f76395",
"size": "275235",
"binary": false,
"copies": "455",
"ref": "refs/heads/master",
"path": "category/os/linux/linux-2.6.32/linux/drivers/net/bnx2x_reg.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "4526"
},
{
"name": "Assembly",
"bytes": "14500403"
},
{
"name": "Awk",
"bytes": "21252"
},
{
"name": "Batchfile",
"bytes": "2526"
},
{
"name": "C",
"bytes": "381839655"
},
{
"name": "C++",
"bytes": "10162228"
},
{
"name": "CMake",
"bytes": "68196"
},
{
"name": "CSS",
"bytes": "3943"
},
{
"name": "D",
"bytes": "1022"
},
{
"name": "DTrace",
"bytes": "4528"
},
{
"name": "Fortran",
"bytes": "1834"
},
{
"name": "GAP",
"bytes": "4344"
},
{
"name": "GDB",
"bytes": "31864"
},
{
"name": "Gnuplot",
"bytes": "148"
},
{
"name": "Go",
"bytes": "732"
},
{
"name": "HTML",
"bytes": "86756"
},
{
"name": "Java",
"bytes": "8286"
},
{
"name": "JavaScript",
"bytes": "238365"
},
{
"name": "Lex",
"bytes": "121233"
},
{
"name": "Limbo",
"bytes": "1609"
},
{
"name": "Lua",
"bytes": "96"
},
{
"name": "M4",
"bytes": "483288"
},
{
"name": "Makefile",
"bytes": "1915601"
},
{
"name": "Nix",
"bytes": "180099"
},
{
"name": "Objective-C",
"bytes": "1742504"
},
{
"name": "OpenEdge ABL",
"bytes": "4238"
},
{
"name": "PHP",
"bytes": "27984629"
},
{
"name": "Pascal",
"bytes": "74868"
},
{
"name": "Perl",
"bytes": "317465"
},
{
"name": "Perl 6",
"bytes": "6916"
},
{
"name": "Python",
"bytes": "21547"
},
{
"name": "R",
"bytes": "1112"
},
{
"name": "Roff",
"bytes": "435717"
},
{
"name": "Scilab",
"bytes": "22980"
},
{
"name": "Shell",
"bytes": "468206"
},
{
"name": "UnrealScript",
"bytes": "20840"
},
{
"name": "Vue",
"bytes": "563"
},
{
"name": "XSLT",
"bytes": "7946"
},
{
"name": "Yacc",
"bytes": "172805"
},
{
"name": "sed",
"bytes": "2073"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "15909bdaa841168335cc1dd3c12732e0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 10.923076923076923,
"alnum_prop": 0.7183098591549296,
"repo_name": "mdoering/backbone",
"id": "55293265b31a31d3eeff8e3cf9e802e06e32f8ad",
"size": "214",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Protozoa/Granuloreticulosea/Foraminiferida/Glandulinidae/Laryngosigma/Laryngosigma hyalascidia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.forms import PasswordChangeForm as EditProfileForm
class CreateProfileForm(UserCreationForm):
class Meta:
model = User
fields = ("username", "email") | {
"content_hash": "696df81da5dcbfcc237cfa6cf28d7cab",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 75,
"avg_line_length": 34.875,
"alnum_prop": 0.8136200716845878,
"repo_name": "aldencolerain/boringmanclan",
"id": "fa5b6509ad9d45630d1cad04931921b8df8ec5b3",
"size": "279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "project/forms/profile_forms.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "3622"
},
{
"name": "Python",
"bytes": "20425"
},
{
"name": "Shell",
"bytes": "840"
}
],
"symlink_target": ""
} |
package ru.matevosyan.servlet;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.matevosyan.database.DBConnection;
import ru.matevosyan.model.User;
import ru.matevosyan.model.UserRole;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* InsertServletTest class to test user insertion.
*/
public class InsertServletTest {
private static final Logger LOG = LoggerFactory.getLogger(InsertServletTest.class.getName());
/**
* Delete added user from the database.
*/
@After
public void tearDown() {
try (Connection connection = DBConnection.getInstance().getDBConnection();
Statement ps = connection.createStatement()) {
String query = "DELETE FROM users WHERE login='UserMock'";
ps.execute(query);
} catch (SQLException sqlEx) {
LOG.warn("Problem with execution query invoke by get method {}", sqlEx);
}
}
/**
* When insert user to database than get the same data from the database.
* For country Россия id = 4 and for city Ростов id = 7.
* @throws ServletException servletException.
* @throws IOException IOException.
*/
@Test
@Ignore
public void whenInsertToDBThanGetGetTheTheSameDataFromTheDB() throws ServletException, IOException {
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
HttpSession session = mock(HttpSession.class);
RequestDispatcher dispatcher = mock(RequestDispatcher.class);
InsertServlet insert = new InsertServlet();
String expected = "UserMock";
when(request.getParameter("user")).thenReturn("UserMock");
when(request.getParameter("login")).thenReturn("UserMock");
when(request.getParameter("password")).thenReturn("UserMock");
when(request.getParameter("email")).thenReturn("UserMock@UserMock");
when(request.getParameter("userRole")).thenReturn("user");
when(request.getParameter("countrySelect")).thenReturn("4");
when(request.getParameter("citySelect")).thenReturn("7");
when(request.getSession()).thenReturn(session);
when(request.getRequestDispatcher("/WEB-INF/views/index.jsp")).thenReturn(dispatcher);
insert.doPost(request, response);
User user = this.getResult(request);
assertThat(expected, is(user.getName()));
}
/**
* get user info from the database to represent to the browser.
* @param request use request.
* @return list with user value.
*/
private User getResult(HttpServletRequest request) {
User user = new User("", "", "", "", new UserRole(0, ""),
"", "");
try (Connection connection = DBConnection.getInstance().getDBConnection();
Statement ps = connection.createStatement()) {
Statement countryPS = connection.createStatement();
Statement cityPS = connection.createStatement();
String query = "SELECT u.name, u.login, "
+ "u.createDate, u.password, u.email, r.id, r.name FROM users AS u "
+ "INNER JOIN roles AS r "
+ "ON u.fk_role=r.id";
String getCountryQuery = "SELECT c.name FROM country AS c "
+ "INNER JOIN users AS u "
+ " ON c.country_id_pk=u.fk_country";
String getCityQuery = "SELECT c.name FROM city AS c "
+ "INNER JOIN users AS u "
+ " ON c.city_id_pk=u.fk_city";
ResultSet resultSet = ps.executeQuery(query);
while (resultSet.next()) {
ResultSet country = countryPS.executeQuery(getCountryQuery);
ResultSet city = cityPS.executeQuery(getCityQuery);
city.next();
country.next();
user = new User(resultSet.getString("name"),
resultSet.getString("login"),
resultSet.getTimestamp("createDate"),
resultSet.getString("password"),
resultSet.getString("email"),
new UserRole(resultSet.getInt(6), resultSet.getString(7)),
country.getString(1), city.getString(1));
}
connection.close();
} catch (SQLException sqlExp) {
LOG.warn("Problem with execution query invoke by get method {}", sqlExp);
}
return user;
}
}
| {
"content_hash": "8018dacaae7f96ab29820159c209b8a9",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 104,
"avg_line_length": 41.064516129032256,
"alnum_prop": 0.6351139041633935,
"repo_name": "VardanMatevosyan/Vardan-Git-Repository",
"id": "ef0bad1cd3c0791bd9ac8c1451f50c5bcc7895b4",
"size": "5104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Servlet_JSP/securityAndFilter/src/test/java/ru/matevosyan/servlet/InsertServletTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "15764"
},
{
"name": "HTML",
"bytes": "72720"
},
{
"name": "Java",
"bytes": "1300488"
},
{
"name": "JavaScript",
"bytes": "110302"
},
{
"name": "PLpgSQL",
"bytes": "2713"
},
{
"name": "TSQL",
"bytes": "1285"
},
{
"name": "XSLT",
"bytes": "594"
}
],
"symlink_target": ""
} |
#ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__
#define __ZMQ_PGM_SENDER_HPP_INCLUDED__
#if defined ZMQ_HAVE_OPENPGM
#include "stdint.hpp"
#include "io_object.hpp"
#include "i_engine.hpp"
#include "options.hpp"
#include "pgm_socket.hpp"
#include "v1_encoder.hpp"
#include "msg.hpp"
namespace zmq
{
class io_thread_t;
class session_base_t;
class pgm_sender_t : public io_object_t, public i_engine
{
public:
pgm_sender_t (zmq::io_thread_t *parent_, const options_t &options_);
~pgm_sender_t ();
int init (bool udp_encapsulation_, const char *network_);
// i_engine interface implementation.
void plug (zmq::io_thread_t *io_thread_, zmq::session_base_t *session_);
void terminate ();
bool restart_input ();
void restart_output ();
void zap_msg_available () {}
const endpoint_uri_pair_t &get_endpoint () const;
// i_poll_events interface implementation.
void in_event ();
void out_event ();
void timer_event (int token);
private:
// Unplug the engine from the session.
void unplug ();
// TX and RX timeout timer ID's.
enum
{
tx_timer_id = 0xa0,
rx_timer_id = 0xa1
};
const endpoint_uri_pair_t _empty_endpoint;
// Timers are running.
bool has_tx_timer;
bool has_rx_timer;
session_base_t *session;
// Message encoder.
v1_encoder_t encoder;
msg_t msg;
// Keeps track of message boundaries.
bool more_flag;
// PGM socket.
pgm_socket_t pgm_socket;
// Socket options.
options_t options;
// Poll handle associated with PGM socket.
handle_t handle;
handle_t uplink_handle;
handle_t rdata_notify_handle;
handle_t pending_notify_handle;
// Output buffer from pgm_socket.
unsigned char *out_buffer;
// Output buffer size.
size_t out_buffer_size;
// Number of bytes in the buffer to be written to the socket.
// If zero, there are no data to be sent.
size_t write_size;
pgm_sender_t (const pgm_sender_t &);
const pgm_sender_t &operator= (const pgm_sender_t &);
};
}
#endif
#endif
| {
"content_hash": "3d128f7827028726b461112ca7aea167",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 76,
"avg_line_length": 21.721649484536083,
"alnum_prop": 0.6359753203607024,
"repo_name": "DweebsUnited/CodeMonkey",
"id": "671b3f3de3beaa85e879e517a5a3a302fed34fa1",
"size": "3525",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "resources/libzmq-master/src/pgm_sender.hpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "718"
},
{
"name": "C++",
"bytes": "2748240"
},
{
"name": "CMake",
"bytes": "11221"
},
{
"name": "CSS",
"bytes": "896"
},
{
"name": "GLSL",
"bytes": "1116"
},
{
"name": "HTML",
"bytes": "887"
},
{
"name": "Java",
"bytes": "132732"
},
{
"name": "Makefile",
"bytes": "23824"
},
{
"name": "Meson",
"bytes": "246"
},
{
"name": "Objective-C",
"bytes": "810"
},
{
"name": "Processing",
"bytes": "205574"
},
{
"name": "Python",
"bytes": "65902"
},
{
"name": "Shell",
"bytes": "6253"
}
],
"symlink_target": ""
} |
package com.google.api.gax.core;
import com.google.auth.Credentials;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.auto.value.AutoValue;
import java.io.IOException;
import java.util.List;
/**
* GoogleCredentialsProvider acquires credentials using Application Default Credentials.
*
* <p>
* For more information on Application Default Credentials, see <a
* href="https://developers.google.com/identity/protocols/application-default-credentials">
* https://developers.google.com/identity/protocols/application-default-credentials</a>.
*/
@AutoValue
public abstract class GoogleCredentialsProvider implements CredentialsProvider {
public abstract List<String> getScopesToApply();
@Override
public Credentials getCredentials() throws IOException {
GoogleCredentials credentials = GoogleCredentials.getApplicationDefault();
if (credentials.createScopedRequired()) {
credentials = credentials.createScoped(getScopesToApply());
}
return credentials;
}
public static Builder newBuilder() {
return new AutoValue_GoogleCredentialsProvider.Builder();
}
public Builder toBuilder() {
return new AutoValue_GoogleCredentialsProvider.Builder(this);
}
@AutoValue.Builder
public abstract static class Builder {
/**
* Sets the scopes to apply to the credentials that are acquired from Application Default
* Credentials, before the credentials are sent to the service.
*/
public abstract Builder setScopesToApply(List<String> val);
/**
* The scopes previously provided.
*/
public abstract List<String> getScopesToApply();
public abstract GoogleCredentialsProvider build();
}
}
| {
"content_hash": "4095ab706d39355cdc188403d29c2646",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 93,
"avg_line_length": 30.232142857142858,
"alnum_prop": 0.7560543414057885,
"repo_name": "shinfan/gax-java",
"id": "5a88736e12cbc3a4a3b707b2aa6009476e9569be",
"size": "3252",
"binary": false,
"copies": "2",
"ref": "refs/heads/dev",
"path": "src/main/java/com/google/api/gax/core/GoogleCredentialsProvider.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "716080"
}
],
"symlink_target": ""
} |
body {
margin: 0;
}
.container {
margin: 15px;
}
*:focus {
outline: none !important;
}
/***********************************/
.img-responsive {
max-width: 100%;
height: auto;
}
.solid-border {
border: solid 15px white;
}
img.solid-border {
top: -15px;
left: -15px;
}
.center-block {
margin-left: auto;
margin-right: auto;
}
/***********************************/
.section {
position: relative;
padding: 80px;
}
.color-blue1 {
background-color: #cadae6;
}
.color-pink1 {
background-color: #ffd6d6;
}
.color-green1 {
background-color: #81b883;
}
.color-yellow1 {
background-color: #faf7af;
}
.card {
position: relative;
width: 312px;
height: 312px;
margin: 0 auto;
}
/***********************************/
.fade-effect img {
position: absolute;
-webkit-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
.fade-effect img.front {
opacity: 1;
}
.fade-effect.active img.front,
.no-touch .fade-effect:hover img.front {
opacity: 0;
}
.fade-effect img.back {
opacity: 0;
}
.fade-effect.active img.back,
.no-touch .fade-effect:hover img.back {
opacity: 1;
}
/***********************************/
.flip-effect img {
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 1s;
transition: transform 1s;
}
.flip-effect img.front {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
.flip-effect.active img.front,
.no-touch .flip-effect:hover img.front {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.flip-effect img.back {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.flip-effect.active img.back,
.no-touch .flip-effect:hover img.back {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
/***********************************/
.door-effect {
-webkit-perspective: 1200px;
perspective: 1200px;
}
.door-effect img {
position: absolute;
-webkit-transition: -webkit-transform 1s;
-webkit-transform-style: preserve-3d;
-webkit-transform-origin: 0 50%;
transition: transform 1s;
transform-style: preserve-3d;
transform-origin: 0 50%;
}
.door-effect img.front {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
z-index: 999 !important;
}
.door-effect.active img.front,
.no-touch .door-effect:hover img.front {
-webkit-transform: rotateY(-115deg);
transform: rotateY(-115deg);
}
/***********************************/
.pulse-effect img {
-webkit-transition: -webkit-transform 0.2s;
transition: transform 0.2s;
}
.pulse-effect.active img.front,
.no-touch .pulse-effect:hover img.front {
-webkit-animation: pulse 1s ease infinite;
animation: pulse 1s ease infinite;
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
}
50% {
-webkit-transform: scale(1.1);
}
100% {
-webkit-transform: scale(1);
}
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
/***********************************/
.shake-effect img {
-webkit-transition: -webkit-transform 0.2s;
transition: transform 0.2s;
}
.shake-effect.active img.front,
.no-touch .shake-effect:hover img.front {
-webkit-animation: shake 0.5s ease infinite;
animation: shake 0.5s ease infinite;
}
@-webkit-keyframes shake {
0% {
-webkit-transform: translateX(0);
}
20% {
-webkit-transform: translateX(-10px);
}
40% {
-webkit-transform: translateX(10px);
}
60% {
-webkit-transform: translateX(-10px);
}
80% {
-webkit-transform: translateX(10px);
}
100% {
-webkit-transform: translateX(0);
}
}
@keyframes shake {
0% {
transform: translateX(0);
}
20% {
transform: translateX(-10px);
}
40% {
transform: translateX(10px);
}
60% {
transform: translateX(-10px);
}
80% {
transform: translateX(10px);
}
100% {
transform: translateX(0);
}
}
/***********************************/
.rotate-effect img {
position: absolute;
}
.rotate-effect img.front {
-webkit-animation: rotate 2s linear infinite;
animation: rotate 2s linear infinite;
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.rotate-effect.active img.front,
.no-touch .rotate-effect:hover img.front {;
-webkit-animation-play-state: running;
animation-play-state: running;
}
@-webkit-keyframes rotate {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/***********************************/
.translate-effect img {
position: absolute;
}
.translate-effect img.back {
-webkit-transition: -webkit-transform 0.2s ease-in;
transition: transform 0.2s ease-in;
}
.translate-effect.active img.back,
.no-touch .translate-effect:hover img.back {
-webkit-transition: -webkit-transform 1s ease-out;
transition: transform 1s ease-out;
-webkit-transform: translateY(-140px);
transform: translateY(-140px);
}
/***********************************/
footer {
font-family: Consolas, Verdana, Arial, sans-serif;
font-size: 0.9em;
text-align: center;
padding: 30px 5px 30px 5px;
margin-right: auto;
margin-left: auto;
}
footer a {
text-decoration: none;
color: #808080;
}
footer a:hover {
text-decoration: none;
color: #000000;
}
/***********************************/
@media screen and (max-width: 767px) {
.container {
margin: 10px;
}
.card {
width: 212px;
height: 212px;
}
.solid-border {
border: solid 10px white;
}
img.solid-border {
top: -10px;
left: -10px;
}
.section {
padding: 30px 20px 30px 20px;
}
} | {
"content_hash": "5aeba261256dd268eed8d14dfed8cabb",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 55,
"avg_line_length": 17.238888888888887,
"alnum_prop": 0.5700934579439252,
"repo_name": "rymbau/css-cards-effects",
"id": "b0b8a6ab92c6b14ac1e447028cad1fad86e57056",
"size": "6206",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "css/cards-effects.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6206"
},
{
"name": "HTML",
"bytes": "3323"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "fef77325b1f82330b416be465b353d07",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "68290fea237f3c58fc7484f641018f057db4edfd",
"size": "177",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Glyceria/Glyceria lithuanica/Glyceria lithuanica lithuanica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/sass/main.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="alternate" type="application/rss+xml" title="RSS Feed for dmacleod.ca" href="https://dmacleod.ca/ra/index.xml" />
</head>
<body>
<header class="site-header">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://StackSquirrel.github.io/">Readers' Advisory blog</a>
</div>
<div class="collapse navbar-collapse " id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://StackSquirrel.github.io/pages/about/">About this blog</a></li>
<li><a href="https://StackSquirrel.github.io/pages/topics/">Browse by topics</a></li>
<li><a href="https://StackSquirrel.github.io/pages/contact/">Contact</a></li>
<li><a href="https://StackSquirrel.github.io/pages/publications/">Publications</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<div class="wrapper">
<div class="home">
<div class="row pack">
<div class="col-md-4 card">
<a href="https://StackSquirrel.github.io/posts/natural-order-by-brian-francis/" class="index-anchor">
<div class="panel panel-default">
<img width="50%" style="display: block;margin-left: auto;margin-right: auto;" src="https://StackSquirrel.github.io/images/natural-order-by-brian-francis.jpg"
alt="Book cover: An adult and child are silhouetted against the a sea on a sandy beach."
>
<div class="panel-body">
<h3 class="panel-title pull-left">Natural order by Brian …</h3><span class="post-meta pull-right"><small>August 5, 2017</small></span>
</div>
<div class="panel-body"><small>
About the book Author: Francis, Brian, 1971-
Title: Natural order
Publication: Toronto : Doubleday Canada, 2011. ISBN 9780385671538.
DAISY audio format narrated by Bennett …</small>
</div>
</div>
</a>
</div>
</div>
<div class="row">
<div class="col-md-4"> </div>
<div class="col-md-4">
</div>
<div class="col-md-4"> </div>
</div>
</div>
</div>
</div>
<footer>
<div class="container">
<div class="row p20">
<div class="col-md-4 text-center mt25">
<a target="_blank" href="https://StackSquirrel.github.io/index.xml"><li class="social email"><i class="fa fa-rss-square"></i></li></a>
<a target="_blank" href="https://twitter.com/thepsammead"><li class="social twitter"><i class="fa fa-twitter-square"></i></li></a>
<a target="_blank" href="https://github.com/StackSquirrel"><li class="social github"><i class="fa fa-github-square"></i></li></a>
<a target="_blank" href="mailto:info@dmacleod.ca"><li class="social email"><i class="fa fa-envelope"></i></li></a>
<a target="_blank" href="https://www.instagram.com/laddiethedog/"><li class="social email"><i class="fa fa-instagram"></i></li></a>
</div>
<div class="col-md-4 text-center mt25"><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a> by <a target="_blank" href="https://dmacleod.ca/">Donna MacLeod</a>.</div>
</div>
</div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="https://StackSquirrel.github.io//js/bootstrap.min.js"></script>
</body>
</html> | {
"content_hash": "a56962cf88992e4bb0f067ed3702cb87",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 500,
"avg_line_length": 33.70666666666666,
"alnum_prop": 0.5526107594936709,
"repo_name": "StackSquirrel/StackSquirrel.github.io",
"id": "62caa132537b8ef48f38c8b3adde6f134ce273d0",
"size": "5060",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags/ontario/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "11054"
},
{
"name": "Python",
"bytes": "4844"
}
],
"symlink_target": ""
} |
<?php
class DummyClass
{
public function coveredMethod()
{
return null;
}
public function uncoveredMethod()
{
return null;
}
}
| {
"content_hash": "290172d322b7de8b5898e54deadbb33e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 34,
"avg_line_length": 8.8125,
"alnum_prop": 0.6666666666666666,
"repo_name": "stof/phpunit-mink",
"id": "11389a98195892fe828a56f7cc96b1c1d523994b",
"size": "141",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tests/aik099/PHPUnit/Fixture/DummyClass.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "189976"
}
],
"symlink_target": ""
} |
package com.github.anba.es6draft.runtime.language;
import static com.github.anba.es6draft.runtime.AbstractOperations.SetIntegrityLevel;
import static com.github.anba.es6draft.runtime.types.Undefined.UNDEFINED;
import static com.github.anba.es6draft.runtime.types.builtins.ArrayObject.ArrayCreate;
import java.lang.invoke.MethodHandle;
import java.util.Map;
import com.github.anba.es6draft.compiler.CompiledObject;
import com.github.anba.es6draft.runtime.ExecutionContext;
import com.github.anba.es6draft.runtime.internal.CompatibilityOption;
import com.github.anba.es6draft.runtime.types.IntegrityLevel;
import com.github.anba.es6draft.runtime.types.PropertyDescriptor;
import com.github.anba.es6draft.runtime.types.builtins.ArrayObject;
/**
*
*/
public final class TemplateOperations {
private TemplateOperations() {
}
/**
* 12.2.9 Template Literals
* <p>
* 12.2.9.3 Runtime Semantics: GetTemplateObject ( templateLiteral )
*
* @param key
* the template literal key
* @param handle
* the method handle for the template literal data
* @param cx
* the execution context
* @return the template call site object
*/
public static ArrayObject GetTemplateObject(int key, MethodHandle handle, ExecutionContext cx) {
assert cx.getCurrentExecutable() instanceof CompiledObject : cx.getCurrentExecutable();
CompiledObject compiledObject = (CompiledObject) cx.getCurrentExecutable();
ArrayObject template = compiledObject.getTemplateObject(key);
if (template == null) {
template = GetTemplateObject(handle, cx);
compiledObject.setTemplateObject(key, template);
}
return template;
}
/**
* 12.2.9 Template Literals
* <p>
* 12.2.9.3 Runtime Semantics: GetTemplateObject ( templateLiteral )
*
* @param handle
* the method handle for the template literal data
* @param cx
* the execution context
* @return the template call site object
*/
private static ArrayObject GetTemplateObject(MethodHandle handle, ExecutionContext cx) {
/* steps 1, 5 */
String[] strings = evaluateTemplateStrings(handle);
assert (strings.length & 1) == 0;
boolean templateParseNodeCache = cx.getRuntimeContext().isEnabled(CompatibilityOption.TemplateParseNodeCache);
Map<String, ArrayObject> templateRegistry;
String templateKey;
if (!templateParseNodeCache) {
/* steps 2-3 */
templateRegistry = cx.getRealm().getTemplateMap();
/* step 4 */
templateKey = templateStringKey(strings);
if (templateRegistry.containsKey(templateKey)) {
return templateRegistry.get(templateKey);
}
} else {
templateRegistry = null;
templateKey = null;
}
/* step 6 */
int count = strings.length >>> 1;
/* steps 7-8 */
ArrayObject template = ArrayCreate(cx, count);
ArrayObject rawObj = ArrayCreate(cx, count);
/* steps 9-10 */
for (int i = 0, n = strings.length; i < n; i += 2) {
int index = i >>> 1;
int prop = index;
String cookedString = strings[i];
Object cookedValue = cookedString != null ? cookedString : UNDEFINED;
template.defineOwnProperty(cx, prop, new PropertyDescriptor(cookedValue, false, true, false));
String rawValue = strings[i + 1];
assert rawValue != null;
rawObj.defineOwnProperty(cx, prop, new PropertyDescriptor(rawValue, false, true, false));
}
/* steps 11-13 */
SetIntegrityLevel(cx, rawObj, IntegrityLevel.Frozen);
template.defineOwnProperty(cx, "raw", new PropertyDescriptor(rawObj, false, false, false));
SetIntegrityLevel(cx, template, IntegrityLevel.Frozen);
/* step 14 */
if (!templateParseNodeCache) {
templateRegistry.put(templateKey, template);
}
/* step 15 */
return template;
}
private static String templateStringKey(String[] strings) {
assert (strings.length & 1) == 0;
StringBuilder raw = new StringBuilder();
for (int i = 0, n = strings.length; i < n; i += 2) {
// Template string normalization removes any \r character in the source string, so it's
// safe to use that character as a delimiter here.
String rawValue = strings[i + 1];
raw.append(rawValue).append('\r');
}
return raw.toString();
}
private static String[] evaluateTemplateStrings(MethodHandle handle) {
try {
return (String[]) handle.invokeExact();
} catch (Throwable e) {
throw TemplateOperations.<RuntimeException> rethrow(e);
}
}
@SuppressWarnings("unchecked")
private static <E extends Throwable> E rethrow(Throwable e) throws E {
throw (E) e;
}
}
| {
"content_hash": "f2e4c905f4eedfcc20020a2b3e84fa6d",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 118,
"avg_line_length": 38.18796992481203,
"alnum_prop": 0.6335892892301634,
"repo_name": "anba/es6draft",
"id": "c7a850cc6758cf189eb9319bc77b5b4d905583fc",
"size": "5243",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/github/anba/es6draft/runtime/language/TemplateOperations.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1554"
},
{
"name": "FreeMarker",
"bytes": "2627"
},
{
"name": "Java",
"bytes": "7090661"
},
{
"name": "JavaScript",
"bytes": "1796470"
},
{
"name": "Shell",
"bytes": "3027"
}
],
"symlink_target": ""
} |
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);
client.conferences('AgentConf12')
.participants.create({
to: '+15624421212',
from: '+18180021216'
})
.then((participant) => console.log(participant.sid));
| {
"content_hash": "380e71cf7475c9d2eefc54bb82413fab",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 56,
"avg_line_length": 32.1,
"alnum_prop": 0.7227414330218068,
"repo_name": "teoreteetik/api-snippets",
"id": "e3205461379b2683b985a2cbe8625ea64a1cb84c",
"size": "477",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rest/participant/list-post-example-1/list-post-example-1.3.x.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "643369"
},
{
"name": "HTML",
"bytes": "335"
},
{
"name": "Java",
"bytes": "943336"
},
{
"name": "JavaScript",
"bytes": "539577"
},
{
"name": "M",
"bytes": "117"
},
{
"name": "Mathematica",
"bytes": "93"
},
{
"name": "Objective-C",
"bytes": "46198"
},
{
"name": "PHP",
"bytes": "538312"
},
{
"name": "Python",
"bytes": "467248"
},
{
"name": "Ruby",
"bytes": "470316"
},
{
"name": "Shell",
"bytes": "1564"
},
{
"name": "Swift",
"bytes": "36563"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals, division, absolute_import
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
class ExternalPlugin(object):
schema = {'type': 'boolean'}
def on_task_input(self, task, config):
return [Entry('test entry', 'fake url')]
@event('plugin.register')
def register_plugin():
plugin.register(ExternalPlugin, 'external_plugin', api_ver=2)
| {
"content_hash": "3563b8391aa3e6f6699d9ec2b50a8c4b",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 27.0625,
"alnum_prop": 0.7205542725173211,
"repo_name": "Pretagonist/Flexget",
"id": "f4029cf990d59da8f6668183e5274642ed83ec0f",
"size": "433",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "tests/external_plugins/external_plugin.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6197"
},
{
"name": "HTML",
"bytes": "38747"
},
{
"name": "JavaScript",
"bytes": "64717"
},
{
"name": "Python",
"bytes": "2462608"
}
],
"symlink_target": ""
} |
JSFiddle Example
http://jsfiddle.net/ck6en/
These files were created to assist in your development prototyping or learning how to work with JSON. The images and JSON can be used for mapping applications, jQuery sliders, or whatever you can think of. Each state has a single image in the images folder that is referenced in the JSON file, along with credits to the author and authors site.
This idea
- Original JSON for Starting Project
https://gist.github.com/mshafrir/2646763
- Original post with images and inspiration
http://twistedsifter.com/2013/06/america-the-beautiful-in-photos/
# license
The MIT License (MIT)
Copyright (c) 2015 Joshua Tanner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| {
"content_hash": "34d2025301b7664f1d805a85abf2ed41",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 346,
"avg_line_length": 48.142857142857146,
"alnum_prop": 0.8,
"repo_name": "tannerjt/state_images.json",
"id": "c90ad4f8496dcd4e2f39012890f62e35b65cd727",
"size": "1765",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "16556"
}
],
"symlink_target": ""
} |
<?php
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Catalog\Ui\DataProvider\Product\Form\ProductDataProvider;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Ui\DataProvider\Modifier\Pool;
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
/**
* Class ProductDataProviderTest
*/
class ProductDataProviderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ObjectManager
*/
protected $objectManager;
/**
* @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $collectionFactoryMock;
/**
* @var Collection|\PHPUnit_Framework_MockObject_MockObject
*/
protected $collectionMock;
/**
* @var ModifierInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $modifierMockOne;
/**
* @var Pool|\PHPUnit_Framework_MockObject_MockObject
*/
protected $poolMock;
/**
* @var ProductDataProvider
*/
protected $model;
protected function setUp()
{
$this->objectManager = new ObjectManager($this);
$this->collectionMock = $this->getMockBuilder(Collection::class)
->disableOriginalConstructor()
->getMock();
$this->collectionFactoryMock = $this->getMockBuilder(CollectionFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
$this->collectionFactoryMock->expects($this->once())
->method('create')
->willReturn($this->collectionMock);
$this->poolMock = $this->getMockBuilder(Pool::class)
->disableOriginalConstructor()
->getMock();
$this->modifierMockOne = $this->getMockBuilder(ModifierInterface::class)
->setMethods(['getData', 'getMeta'])
->getMockForAbstractClass();
$this->model = $this->objectManager->getObject(ProductDataProvider::class, [
'name' => 'testName',
'primaryFieldName' => 'testPrimaryFieldName',
'requestFieldName' => 'testRequestFieldName',
'collectionFactory' => $this->collectionFactoryMock,
'pool' => $this->poolMock,
]);
}
public function testGetMeta()
{
$expectedMeta = ['meta_key' => 'meta_value'];
$this->poolMock->expects($this->once())
->method('getModifiersInstances')
->willReturn([$this->modifierMockOne]);
$this->modifierMockOne->expects($this->once())
->method('modifyMeta')
->willReturn($expectedMeta);
$this->assertSame($expectedMeta, $this->model->getMeta());
}
public function testGetData()
{
$expectedMeta = ['data_key' => 'data_value'];
$this->poolMock->expects($this->once())
->method('getModifiersInstances')
->willReturn([$this->modifierMockOne]);
$this->modifierMockOne->expects($this->once())
->method('modifyData')
->willReturn($expectedMeta);
$this->assertSame($expectedMeta, $this->model->getData());
}
}
| {
"content_hash": "b65ff7e2aa38b427bb22eaf561e02644",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 86,
"avg_line_length": 31.718446601941746,
"alnum_prop": 0.6262626262626263,
"repo_name": "j-froehlich/magento2_wk",
"id": "56f172a57cf9112569281cb7a95157a6bae5230f",
"size": "3375",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/magento/module-catalog/Test/Unit/Ui/DataProvider/Product/Form/ProductDataProviderTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "13636"
},
{
"name": "CSS",
"bytes": "2076720"
},
{
"name": "HTML",
"bytes": "6151072"
},
{
"name": "JavaScript",
"bytes": "2488727"
},
{
"name": "PHP",
"bytes": "12466046"
},
{
"name": "Shell",
"bytes": "6088"
},
{
"name": "XSLT",
"bytes": "19979"
}
],
"symlink_target": ""
} |
/* Author: Ioan Sucan, Acorn Pooley */
#include <moveit/robot_interaction/locked_robot_state.h>
robot_interaction::LockedRobotState::LockedRobotState(const moveit::core::RobotState& state)
: state_(new moveit::core::RobotState(state))
{
state_->update();
}
robot_interaction::LockedRobotState::LockedRobotState(const moveit::core::RobotModelPtr& model)
: state_(new moveit::core::RobotState(model))
{
state_->setToDefaultValues();
state_->update();
}
robot_interaction::LockedRobotState::~LockedRobotState() = default;
moveit::core::RobotStateConstPtr robot_interaction::LockedRobotState::getState() const
{
boost::mutex::scoped_lock lock(state_lock_);
return state_;
}
void robot_interaction::LockedRobotState::setState(const moveit::core::RobotState& state)
{
{
boost::mutex::scoped_lock lock(state_lock_);
// If someone else has a reference to the state, then make a new copy.
// The old state is orphaned (does not change, but is now out of date).
if (state_.unique())
*state_ = state;
else
state_ = std::make_shared<moveit::core::RobotState>(state);
state_->update();
}
robotStateChanged();
}
void robot_interaction::LockedRobotState::modifyState(const ModifyStateFunction& modify)
{
{
boost::mutex::scoped_lock lock(state_lock_);
// If someone else has a reference to the state, then make a copy.
// The old state is orphaned (does not change, but is now out of date).
if (!state_.unique())
state_ = std::make_shared<moveit::core::RobotState>(*state_);
modify(state_.get());
state_->update();
}
robotStateChanged();
}
void robot_interaction::LockedRobotState::robotStateChanged()
{
}
| {
"content_hash": "ff590ff69e4ec29a5a7b804252f41eeb",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 95,
"avg_line_length": 26.92063492063492,
"alnum_prop": 0.6975235849056604,
"repo_name": "ros-planning/moveit",
"id": "27ed768cb87421866ee0e0858ec41d8cbd4e6254",
"size": "3578",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "moveit_ros/robot_interaction/src/locked_robot_state.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2268"
},
{
"name": "C++",
"bytes": "7614097"
},
{
"name": "CMake",
"bytes": "157245"
},
{
"name": "Dockerfile",
"bytes": "5483"
},
{
"name": "GDB",
"bytes": "376"
},
{
"name": "HTML",
"bytes": "1171"
},
{
"name": "Makefile",
"bytes": "252"
},
{
"name": "NASL",
"bytes": "2404"
},
{
"name": "Python",
"bytes": "276327"
},
{
"name": "Shell",
"bytes": "15782"
},
{
"name": "TeX",
"bytes": "7222"
}
],
"symlink_target": ""
} |
/* MACHINE GENERATED FILE, DO NOT EDIT */
#include <jni.h>
#include "extgl.h"
typedef void (APIENTRY *glProgramParameteriARBPROC) (GLuint program, GLenum pname, GLint value);
typedef void (APIENTRY *glFramebufferTextureARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
typedef void (APIENTRY *glFramebufferTextureLayerARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
typedef void (APIENTRY *glFramebufferTextureFaceARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBGeometryShader4_nglProgramParameteriARB(JNIEnv *env, jclass clazz, jint program, jint pname, jint value, jlong function_pointer) {
glProgramParameteriARBPROC glProgramParameteriARB = (glProgramParameteriARBPROC)((intptr_t)function_pointer);
glProgramParameteriARB(program, pname, value);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBGeometryShader4_nglFramebufferTextureARB(JNIEnv *env, jclass clazz, jint target, jint attachment, jint texture, jint level, jlong function_pointer) {
glFramebufferTextureARBPROC glFramebufferTextureARB = (glFramebufferTextureARBPROC)((intptr_t)function_pointer);
glFramebufferTextureARB(target, attachment, texture, level);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBGeometryShader4_nglFramebufferTextureLayerARB(JNIEnv *env, jclass clazz, jint target, jint attachment, jint texture, jint level, jint layer, jlong function_pointer) {
glFramebufferTextureLayerARBPROC glFramebufferTextureLayerARB = (glFramebufferTextureLayerARBPROC)((intptr_t)function_pointer);
glFramebufferTextureLayerARB(target, attachment, texture, level, layer);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBGeometryShader4_nglFramebufferTextureFaceARB(JNIEnv *env, jclass clazz, jint target, jint attachment, jint texture, jint level, jint face, jlong function_pointer) {
glFramebufferTextureFaceARBPROC glFramebufferTextureFaceARB = (glFramebufferTextureFaceARBPROC)((intptr_t)function_pointer);
glFramebufferTextureFaceARB(target, attachment, texture, level, face);
}
| {
"content_hash": "25279c7eea7af84472425df99778ea0f",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 214,
"avg_line_length": 70.66666666666667,
"alnum_prop": 0.8245283018867925,
"repo_name": "Craigspaz/Flying-Ferris-Wheel-Engine",
"id": "71b1356a48ce337455b8d45e481a450a826df1ff",
"size": "2120",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Tables/lwjgl-2.9.1/src/src/native/generated/opengl/org_lwjgl_opengl_ARBGeometryShader4.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2169472"
},
{
"name": "C++",
"bytes": "2996"
},
{
"name": "GLSL",
"bytes": "3562"
},
{
"name": "HTML",
"bytes": "5582"
},
{
"name": "Java",
"bytes": "8428535"
},
{
"name": "Objective-C",
"bytes": "85891"
},
{
"name": "Shell",
"bytes": "128"
}
],
"symlink_target": ""
} |
package xyz.mcex.plugin.equity.database;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import xyz.mcex.plugin.DatabaseManager;
import xyz.mcex.plugin.message.BufferedDatabasePages;
import java.sql.SQLException;
public class OrderListPages extends BufferedDatabasePages
{
private final String _itemName;
private final boolean _viewBuy;
private final EquityDatabase _eqDb;
public OrderListPages(DatabaseManager manager, String itemName, boolean viewBuy)
{
super(manager);
this._itemName = itemName;
this._viewBuy = viewBuy;
this._eqDb = new EquityDatabase(manager);
}
@Override
public String getPage(int index)
{
GetOrderResponse response = null;
try
{
response = this._eqDb.getOrders(this._itemName, index * 6, 6, this._viewBuy);
} catch (SQLException e)
{
e.printStackTrace();
return null;
}
if (response.code != GetOrderResponse.ResponseCode.OK)
return null;
StringBuilder builder = new StringBuilder();
for (Order o : response.orders)
{
// TODO: Is Bukkit.getOfflinePlayer threadsafe?
builder.append(ChatColor.GOLD);
builder.append("$").append(Math.round(o.price * 100) / 100.0);
builder.append(" x ").append(o.quantity).append(" : ").append(ChatColor.AQUA)
.append(Bukkit.getOfflinePlayer(o.playerUuid).getName());
builder.append("\n");
}
return builder.toString();
}
}
| {
"content_hash": "d8dc51beb1040743d1b1d5f25e1ed498",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 83,
"avg_line_length": 27.11320754716981,
"alnum_prop": 0.6889352818371608,
"repo_name": "daemon/mcex-plugin",
"id": "b8b805c7472e4d15a768303a2095c41833293e45",
"size": "1437",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/xyz/mcex/plugin/equity/database/OrderListPages.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2898"
},
{
"name": "Java",
"bytes": "154243"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using Kf.Numaris.Api.Formatting.Fields;
using Kf.Numaris.Api.Specifications.Numbers;
namespace Kf.Numaris.Api.Formatting.Numbers
{
public interface INumberFormatter<TNumberSpecification> : IFormatter
where TNumberSpecification : INumberSpecification
{
IReadOnlyDictionary<int, IFieldFormatter<TNumberSpecification>> FieldFormatters { get; }
string Format(string[] input);
string Format(string input);
}
}
| {
"content_hash": "b49d71446e2eb7305e4c3f6eb653c933",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 96,
"avg_line_length": 34.642857142857146,
"alnum_prop": 0.7525773195876289,
"repo_name": "KodeFoxx/Numaris",
"id": "e05081156627b3a0b35b9389ddadad4d086ba2c6",
"size": "487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Backend/Kf.Numaris.Api/Formatting/Numbers/INumberFormatter.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "63303"
}
],
"symlink_target": ""
} |
@interface ViewController : UIViewController
@end
| {
"content_hash": "00c47db8f0cb37ad6137ca5fb070b1a4",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 10.6,
"alnum_prop": 0.7924528301886793,
"repo_name": "ixx1232/ixxWaterFlow",
"id": "f27eba92713db8fba3fa9aba62a20e88d2389a69",
"size": "224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ixxWaterFlow/ixxWaterFlow/ViewController.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "4279"
}
],
"symlink_target": ""
} |
sap.ui.define(['jquery.sap.global', 'sap/ui/commons/CalloutBaseRenderer', 'sap/ui/core/Renderer', 'sap/ui/core/IconPool'],
function(jQuery, CalloutBaseRenderer, Renderer, IconPool) {
"use strict";
/**
* QuickView renderer.
* @namespace
*/
var QuickViewRenderer = Renderer.extend(CalloutBaseRenderer);
/**
* Renders the HTML for the CalloutBase content, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRenderManager the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
QuickViewRenderer.renderContent = function(oRenderManager, oControl){
var rm = oRenderManager;
// accessibility
var bAcc = sap.ui.getCore().getConfiguration().getAccessibility();
// control properties
var sType = oControl.getType(),
sName = oControl.getFirstTitle(),
sHref = oControl.getFirstTitleHref(),
sIcon = oControl.getIcon(),
sDesc = oControl.getSecondTitle(),
sWidth = oControl.getWidth(),
sId = oControl.getId(),
tooltip = oControl.getTooltip_AsString(),
oIconAttr;
// container for the QuickView header and content
rm.write("<div");
if (tooltip) {
rm.writeAttributeEscaped("title", tooltip);
}
if (bAcc) {
rm.writeAttribute("role", "dialog");
rm.writeAttribute("aria-labelledby",sId + "-title");
}
rm.addClass("sapUiUx3QV");
rm.writeClasses();
if (sWidth) {
rm.addStyle("width", sWidth);
rm.writeStyles();
}
rm.write(">");
//header (Thing Type) is mandatory
rm.write("<div");
rm.writeAttribute("id", sId + "-title");
rm.writeAttribute("tabindex", "-1"); // ItemNavigation can only handle focusable items
rm.addClass("sapUiUx3QVHeader");
rm.writeClasses();
rm.write(">");
rm.writeEscaped(sType);
rm.write("</div>");
//heading: icon, title1, title2
if (sIcon || sName || sDesc) {
rm.write("<div");
if (bAcc) {
rm.writeAttribute("role", "heading");
}
rm.addClass("sapUiUx3QVHeading");
rm.writeClasses();
rm.write(">");
//icon
if (sIcon) {
if (IconPool.isIconURI(sIcon)) {
//setting title & tabindex here
//alt, src and role=presentation are set by writeIcon
oIconAttr = {
title : sName,
tabindex: "-1"
};
}
rm.writeIcon(sIcon, "sapUiUx3QVIcon", oIconAttr);
}
//name
rm.write("<span");
rm.writeAttribute("id", sId + "-name");
if (bAcc && sDesc) {
rm.writeAttribute("aria-describedby",sId + "-descr");
}
rm.addClass("sapUiUx3QVTitle1");
rm.writeClasses();
rm.write(">");
if (sHref) {
rm.write("<a");
rm.writeAttribute("id", sId + "-link");
rm.writeAttributeEscaped("href", sHref);
rm.writeAttribute("tabindex", "-1"); // ItemNavigation can only handle focusable items
rm.write(">");
}
rm.writeEscaped(sName || "");
if (sHref) {
rm.write("</a>");
}
rm.write("</span>");
//title2
if (sDesc) {
rm.write("<br><span");
rm.writeAttribute("id", sId + "-descr");
rm.writeAttribute("tabindex", "-1"); // ItemNavigation can only handle focusable items
rm.addClass("sapUiUx3QVTitle2");
rm.writeClasses();
rm.write(">");
rm.writeEscaped(sDesc);
rm.write("</span>");
}
rm.write("</div>"); // heading
}
// content
// render Header Content
rm.write("<div id=\"" + sId + "-content\">");
this.renderBody(rm, oControl);
rm.write("</div>");
rm.write("</div>"); // container
// render the action bar
if (oControl.getShowActionBar() && oControl.getActionBar()) {
rm.renderControl(oControl.getActionBar());
}
};
/**
* Renders the HTML for the QuickView body content (form or )
*
* @param {sap.ui.core.RenderManager}
* oRenderManager the RenderManager that can be used for writing to
* the Render-Output-Buffer
* @param {sap.ui.core.Control}
* oControl an object representation of the control that should be
* rendered
*/
QuickViewRenderer.renderBody = function(rm, oControl) {
var aContent = oControl.getContent();
for ( var i = 0; i < aContent.length; i++) {
rm.write("<div class=\"sapUiUx3QVBody\">");
if (aContent[i] instanceof sap.ui.core.Control) {
rm.renderControl(aContent[i]);
} else if (aContent[i].getContent && typeof aContent[i].getContent == "function") {
// ThingGroups with own content are also allowed
var aChildContent = aContent[i].getContent();
for (var j = 0; j < aChildContent.length; j++) {
if (aChildContent[j] instanceof sap.ui.core.Control) {
rm.renderControl(aChildContent[j]);
}
}
}
rm.write("</div>");
}
};
return QuickViewRenderer;
}, /* bExport= */ true);
| {
"content_hash": "3eff2190949c9f20c744e3f4334841bd",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 128,
"avg_line_length": 27.670520231213874,
"alnum_prop": 0.6360977647796114,
"repo_name": "openui5/packaged-sap.ui.ux3",
"id": "c16ddfc6b664111a9e49993c80a7ce2e2ab96919",
"size": "4972",
"binary": false,
"copies": "1",
"ref": "refs/heads/rel-1.44",
"path": "resources/sap/ui/ux3/QuickViewRenderer.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "561621"
},
{
"name": "HTML",
"bytes": "651581"
},
{
"name": "JavaScript",
"bytes": "721623"
}
],
"symlink_target": ""
} |
In Norse mythology, Snotra (Old Norse "clever") is a goddess associated with wisdom.
Snotra-backup is a backup script that uses *duplicity* and *mysqldump* to back up and encrypt files, folders and databases.
It supports multiple backends, and it can synchronize the backups with Google Cloud Storage and/or Amazon AWS (untested).
In addition you can write your own command that is executed when all backup definitions are done, that way you can move,
copy or upload the files wherever. It is up to you.
## Requirements
* [Python](https://www.python.org/)
* [duplicity](http://duplicity.nongnu.org/)
* [mysqldump](http://www.linuxcommand.org/man_pages/mysqldump1.html) (if backing up databases)
* [NcFTP](http://www.ncftp.com/) (if backend 'ftp')
* [gsutil](https://developers.google.com/storage/docs/gsutil) (if sync with Google Cloud Storage)
* [s3cmd](http://s3tools.org/s3cmd) (if sync with Amazon AWS)
### Python packages
* configparser
## Supported backends
* file
* ftp
* rsync
## Installation
Create symbolic link for shared library files:
```bash
$ sudo ln -s /path/to/snotra/share/ /usr/local/share/snotra
```
Create symbolic link in `/usr/local/sbin` folder, this is not required but will make Snotra system-wide available for the root user:
```bash
$ sudo ln -s /path/to/snotra/snotra.py /usr/local/sbin/snotra.py
```
## Command-line arguments
Argument | Action
--- | ---
`-s, --show` | Show all commands, but do nothing.
`-n, --dry-run` | Show that would have been done, but do nothing.
`-c, --config <file>` | Run with the spesified config file.
`-v` | Print version.
## Config file
The config file is read from `/etc/snotra/snotra.conf`. A sample config is provided, make your changes and copy it to `/etc/snotra/snotra.conf`.
See comments in [snotra.conf.sample](snotra.conf.sample) for parameters.
## Cron job
Create file `/etc/cron.d/snotra` with the content below, this make will make Snotra run every night at 3:30:
```cron
MAILTO=root
# Run daily backup
30 3 * * * root [ -x /usr/local/sbin/snotra.py ] && /usr/local/sbin/snotra.py > /dev/null
```
## Log file
Snotra-backup logs to `/var/log/snotra.log` by default, but this can be changed in the config file.
### Log rotate
Since the log file can get pretty big over time it's wise to rotate it every now and then.
Create file `/etc/logrotate.d/snotra` with the content below, this will make logrotate pick up the logfile:
```logrotate
/var/log/snotra.log {
weekly
rotate 4
missingok
compress
delaycompress
notifempty
create 640 root adm
}
```
## Duplicity operations
### Verify
```
duplicity verify rsync://user@your.domain:1234//backup/etc /etc
```
### List files
```
duplicity list-current-files rsync://user@your.domain:1234//backup/etc /etc
```
### Restore
```
# Get latest
duplicity --file-to-restore apt/sources.list rsync://user@your.domain:1234//backup/etc /home/user/sources.list
# Get file from 4 days ago
duplicity -t 3D --file-to-restore apt/sources.list rsync://user@your.domain:1234//backup/etc /home/user/sources.list
```
## Issues
The application is still work in progress so there may be bugs. Please report all bugs to the issue tracker on this
repository.
## Author
Thomas Jensen | {
"content_hash": "25fc41a542c9ac4cdbfe4e42853937ea",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 144,
"avg_line_length": 32.15841584158416,
"alnum_prop": 0.7185960591133005,
"repo_name": "HebronNor/Snotra-backup",
"id": "e4b1936dbf033c92a50056276ab9a01293c51387",
"size": "3264",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "9466"
}
],
"symlink_target": ""
} |
layout: post
title: "Contact WFCA"
date: 2017-05-23 10:00:00 -0600
categories: contact-info
---
{::comment}
Rich Blackwell\\
Chapter Administrator\\
Wisconsin Finishing Contractor Association\\
[Rich@richblackwell.com][mail-to]\\
[800-000-0000][phone-num]\\
1300 Regent Street\\
Madison WI 53715
{:/comment}
Greg Wolf\\
902 Stewart Street
Madison WI 53713\\
Chapter Administrator\\
Rich Blackwell\\
[833-649-WFCA (9322)][phone-num]\\
[wfcamadison@gmail.com][mail-to]
[mail-to]: mailto:wfcamadison@gmail.com?Subject=WFCA%20Contact%20Form%20Submission
[phone-num]: tel:833-649-9322
| {
"content_hash": "be56f35d5c7d39ade8d8ea16030967fe",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 82,
"avg_line_length": 22.923076923076923,
"alnum_prop": 0.7332214765100671,
"repo_name": "alexkademan/wfca",
"id": "d07b5414a0564f51ca778b9c9e280aec9532901d",
"size": "600",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2017-04-25-contact-info.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "133413"
},
{
"name": "HTML",
"bytes": "18531"
},
{
"name": "JavaScript",
"bytes": "35668"
}
],
"symlink_target": ""
} |
using System;
using System.Windows.Forms;
namespace V1TaskManager
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
private static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
} | {
"content_hash": "25a9f12068e71efcc3c17c9d480ffd48",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 24.473684210526315,
"alnum_prop": 0.5655913978494623,
"repo_name": "versionone/V1TaskManager",
"id": "9ada0bd40a07230745588b15c25d9750029f62c6",
"size": "465",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "V1TaskManager/Program.cs",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "51326"
},
{
"name": "Shell",
"bytes": "4085"
}
],
"symlink_target": ""
} |
#ifndef itkAnchorDilateImageFilter_h
#define itkAnchorDilateImageFilter_h
#include "itkAnchorErodeDilateImageFilter.h"
#include <functional>
namespace itk
{
template <typename TImage, typename TKernel>
class AnchorDilateImageFilter
: public AnchorErodeDilateImageFilter<TImage, TKernel, std::greater<typename TImage::PixelType>>
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(AnchorDilateImageFilter);
using Self = AnchorDilateImageFilter;
using Superclass = AnchorErodeDilateImageFilter<TImage, TKernel, std::less<typename TImage::PixelType>>;
/** Runtime information support. */
itkTypeMacro(AnchorDilateImageFilter, AnchorErodeDilateImageFilter);
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
using PixelType = typename TImage::PixelType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
protected:
AnchorDilateImageFilter() { this->m_Boundary = NumericTraits<PixelType>::NonpositiveMin(); }
~AnchorDilateImageFilter() override = default;
private:
};
} // namespace itk
#endif
| {
"content_hash": "582b2bc0d322009afb8b3f33b55cc382",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 106,
"avg_line_length": 26.8,
"alnum_prop": 0.7826492537313433,
"repo_name": "malaterre/ITK",
"id": "b2de6a2963995a4b42aae711bf745fd10aa44d0b",
"size": "1828",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/Filtering/MathematicalMorphology/include/itkAnchorDilateImageFilter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "435417"
},
{
"name": "C++",
"bytes": "34591024"
},
{
"name": "CMake",
"bytes": "1452219"
},
{
"name": "CSS",
"bytes": "17428"
},
{
"name": "HTML",
"bytes": "8263"
},
{
"name": "Java",
"bytes": "28585"
},
{
"name": "JavaScript",
"bytes": "1522"
},
{
"name": "Objective-C++",
"bytes": "5773"
},
{
"name": "Perl",
"bytes": "6029"
},
{
"name": "Python",
"bytes": "448031"
},
{
"name": "Ruby",
"bytes": "296"
},
{
"name": "Shell",
"bytes": "162676"
},
{
"name": "Tcl",
"bytes": "72988"
},
{
"name": "XSLT",
"bytes": "8634"
}
],
"symlink_target": ""
} |
#include <sys/types.h>
#include <sys/event.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <poll.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <zlib.h>
#if 0
#include <md5.h>
#endif
#include <fsyscall.h>
#include <fsyscall/private.h>
#include <fsyscall/private/atoi_or_die.h>
#include <fsyscall/private/close_or_die.h>
#include <fsyscall/private/command.h>
#include <fsyscall/private/die.h>
#include <fsyscall/private/encode.h>
#include <fsyscall/private/fork_or_die.h>
#include <fsyscall/private/fslave.h>
#include <fsyscall/private/fslave/dir_entries_cache.h>
#include <fsyscall/private/fslave/proto.h>
#include <fsyscall/private/fslave/stream.h>
#include <fsyscall/private/geterrorname.h>
#include <fsyscall/private/io.h>
#include <fsyscall/private/io_or_die.h>
#include <fsyscall/private/log.h>
#include <fsyscall/private/malloc_or_die.h>
#include <fsyscall/private/payload.h>
#include <fsyscall/private/read_sockaddr.h>
#include <fsyscall/private/select.h>
struct memory {
SLIST_ENTRY(memory) mem_next;
char mem_data[0];
};
static int mainloop(struct slave_thread *);
static int sigs[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGEMT,
SIGFPE, SIGBUS, /*SIGSEGV,*/ SIGSYS, SIGPIPE, SIGALRM,
SIGTERM, SIGURG, SIGTSTP, SIGCONT, SIGCHLD, SIGTTIN,
SIGTTOU, SIGIO, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF,
SIGWINCH, SIGINFO, SIGUSR1, SIGUSR2, /*SIGTHR*/ };
static int nsigs = array_sizeof(sigs);
static struct io sigw;
#if 0
static void
sighandler(int sig)
{
syslog(LOG_DEBUG, "signaled (default): SIG%s", sys_signame[sig]);
}
#endif
static void
reset_signal_handler()
{
struct sigaction act;
int i;
act.sa_handler = SIG_DFL;
#if 0
act.sa_handler = sighandler;
#endif
act.sa_flags = 0;
sigfillset(&act.sa_mask);
for (i = 0; i < nsigs; i++)
sigaction(sigs[i], &act, NULL);
}
static void
destroy_slave(struct slave *slave)
{
free(slave->fork_sock);
reset_signal_handler();
if (io_close(&sigw) == -1)
diec(1, sigw.io_error, "cannot close sigw");
if (io_close(&slave->fsla_sigr) == -1)
diec(1, slave->fsla_sigr.io_error, "cannot close sigr");
dir_entries_cache_dispose(slave->fsla_dir_entries_cache);
pthread_rwlock_destroy(&slave->fsla_lock);
free(slave);
}
static void
unlock_slave(struct slave *slave)
{
int error;
error = pthread_rwlock_unlock(&slave->fsla_lock);
if (error != 0)
diex(error, "cannot pthread_rwlock_unlock(3)");
}
static void
readlock_slave(struct slave *slave)
{
int error;
error = pthread_rwlock_rdlock(&slave->fsla_lock);
if (error != 0)
diex(error, "cannot pthread_rwlock_rdlock(3)");
}
static void
writelock_slave(struct slave *slave)
{
int error;
error = pthread_rwlock_wrlock(&slave->fsla_lock);
if (error != 0)
diex(error, "cannot pthread_rwlock_wrlock(3)");
}
static void
close_slave_thread(struct slave_thread *slave_thread)
{
struct io *io;
io = &slave_thread->fsth_io;
if (io_close(io) == -1)
diec(1, io->io_error, "cannot close slave thread");
}
static void
release_slave_thread(struct slave_thread *slave_thread)
{
struct slave *slave;
bool empty;
close_slave_thread(slave_thread);
slave = slave_thread->fsth_slave;
writelock_slave(slave);
SLIST_REMOVE(&slave->fsla_slaves, slave_thread, slave_thread,
fsth_next);
empty = SLIST_EMPTY(&slave->fsla_slaves);
unlock_slave(slave);
free(slave_thread);
if (empty)
destroy_slave(slave);
}
static void *
mem_alloc(struct slave_thread *slave_thread, size_t size)
{
struct memory *memory;
size_t totalsize;
totalsize = sizeof(struct memory) + size;
memory = (struct memory *)malloc_or_die(totalsize);
SLIST_INSERT_HEAD(&slave_thread->fsth_memory, memory, mem_next);
return (&memory->mem_data[0]);
}
static void
mem_freeall(struct slave_thread *slave_thread)
{
struct memory *memory, *tmp;
SLIST_FOREACH_SAFE(memory, &slave_thread->fsth_memory, mem_next, tmp) {
SLIST_REMOVE(&slave_thread->fsth_memory, memory, memory,
mem_next);
free(memory);
}
}
static void
process_signal(struct slave_thread *slave_thread)
{
struct io *dst;
int n;
char sig;
read_or_die(&slave_thread->fsth_slave->fsla_sigr, &sig, sizeof(sig));
n = (int)sig;
syslog(LOG_DEBUG, "signaled: %d (SIG%s)", n, sys_signame[n]);
dst = &slave_thread->fsth_io;
write_command(dst, SIGNALED);
write_or_die(dst, &sig, sizeof(sig));
}
void
suspend_signal(struct slave_thread *slave_thread, sigset_t *oset)
{
struct slave *slave;
slave = slave_thread->fsth_slave;
readlock_slave(slave);
if (sigprocmask(SIG_SETMASK, &slave->mask, oset) == -1)
die(1, "failed sigprocmask(2) to suspend signal");
unlock_slave(slave);
}
void
resume_signal(struct slave_thread *slave_thread, sigset_t *set)
{
struct io *ios[1];
struct timeval timeout;
int error, n;
if (sigprocmask(SIG_SETMASK, set, NULL) == -1)
die(1, "failed sigprocmask(2) to resume signal");
if (!slave_thread->fsth_signal_watcher)
return;
ios[0] = &slave_thread->fsth_slave->fsla_sigr;
timeout.tv_sec = timeout.tv_usec = 0;
for (;;) {
n = io_select(array_sizeof(ios), ios, &timeout, &error);
if (n == -1) {
if (error != EINTR)
die(1, "failed select(2)");
continue;
}
if (n == 0)
return;
process_signal(slave_thread);
}
}
static void
usage()
{
puts("fslave rfd wfd fork_sock");
}
void
die_if_payload_size_mismatched(int expected, int actual)
{
if (expected == actual)
return;
diec(-1, EPROTO, "payload size mismatched");
}
static void
negotiate_version(struct slave_thread *slave_thread)
{
uint8_t request_ver = 0;
uint8_t response;
write_or_die(&slave_thread->fsth_io, &request_ver, sizeof(request_ver));
read_or_die(&slave_thread->fsth_io, &response, sizeof(response));
assert(response == 0);
syslog(LOG_INFO, "protocol version for shub is %d.", response);
}
static bool
is_alive_fd(struct slave_thread *slave_thread, int fd)
{
if (io_get_rfd(&slave_thread->fsth_io) == fd)
return (false);
if (io_get_wfd(&slave_thread->fsth_io) == fd)
return (false);
if (io_get_rfd(&slave_thread->fsth_slave->fsla_sigr) == fd)
return (false);
if (io_get_wfd(&sigw) == fd)
return (false);
if (fcntl(fd, F_GETFL) != -1)
return (true);
if (errno != EBADF)
die(-1, "cannot fcntl(%d, F_GETFL)", fd);
return (false);
}
static int
count_alive_fds(struct slave_thread *slave_thread)
{
int i, n = 0, size;
size = getdtablesize();
for (i = 0; i < size; i++)
n += is_alive_fd(slave_thread, i) ? 1 : 0;
return (n);
}
static int
encode_alive_fd(struct slave_thread *slave_thread, int fd, char *dest, int size)
{
if (is_alive_fd(slave_thread, fd))
return (encode_int32(fd, dest, size));
return (0);
}
static void
write_open_fds(struct slave_thread *slave_thread)
{
struct io *io;
size_t buf_size;
int i, nfds, pos;
char *buf;
buf_size = count_alive_fds(slave_thread) * FSYSCALL_BUFSIZE_INT32;
buf = (char *)alloca(buf_size);
pos = 0;
nfds = getdtablesize();
for (i = 0; i < nfds; i++)
pos += encode_alive_fd(slave_thread, i, buf + pos,
buf_size - pos);
assert(0 <= pos);
io = &slave_thread->fsth_io;
write_int32(io, pos);
write_or_die(io, buf, pos);
}
static void
return_generic(struct slave_thread *slave_thread, command_t cmd, char *ret_buf,
int ret_len, char *errnum_buf, int errnum_len)
{
struct io *io;
io = &slave_thread->fsth_io;
write_command(io, cmd);
write_payload_size(io, ret_len + errnum_len);
write_or_die(io, ret_buf, ret_len);
write_or_die(io, errnum_buf, errnum_len);
}
void
return_int(struct slave_thread *slave_thread, command_t cmd, int ret,
int errnum)
{
int errnum_len, ret_len;
char errnum_buf[FSYSCALL_BUFSIZE_INT32];
char ret_buf[FSYSCALL_BUFSIZE_INT32];
const char *cmdname, *errname, *fmt = "%s: ret=%d, error=%d (%s: %s)";
cmdname = get_command_name(cmd);
errname = geterrorname(errnum);
syslog(LOG_DEBUG, fmt, cmdname, ret, errnum, errname, strerror(errnum));
ret_len = encode_int32(ret, ret_buf, array_sizeof(ret_buf));
errnum_len = (ret == -1) ? encode_int32(
errnum,
errnum_buf,
array_sizeof(errnum_buf)) : 0;
return_generic(slave_thread, cmd, ret_buf, ret_len, errnum_buf,
errnum_len);
}
void
return_ssize(struct slave_thread *slave_thread, command_t cmd, ssize_t ret,
int errnum)
{
int errnum_len, ret_len;
char errnum_buf[FSYSCALL_BUFSIZE_INT32];
char ret_buf[FSYSCALL_BUFSIZE_INT64];
const char *cmdname, *errname, *fmt = "%s: ret=%zd, error=%d (%s: %s)";
cmdname = get_command_name(cmd);
errname = geterrorname(errnum);
syslog(LOG_DEBUG, fmt, cmdname, ret, errnum, errname, strerror(errnum));
ret_len = encode_int64(ret, ret_buf, array_sizeof(ret_buf));
errnum_len = (ret == -1) ? encode_int32(
errnum,
errnum_buf,
array_sizeof(errnum_buf)) : 0;
return_generic(slave_thread, cmd, ret_buf, ret_len, errnum_buf,
errnum_len);
}
#define MAX(a, b) ((a) < (b) ? (b) : (a))
static void
read_fds(struct slave_thread *slave_thread, int *maxfd, fd_set *fds,
payload_size_t *len)
{
struct io *io;
payload_size_t fd_len, nfds_len, payload_size;
int fd, i, nfds;
io = &slave_thread->fsth_io;
nfds = read_int32(io, &nfds_len);
payload_size = nfds_len;
for (i = 0; i < nfds; i++) {
fd = read_int32(io, &fd_len);
payload_size += fd_len;
FD_SET(fd, fds);
*maxfd = MAX(*maxfd, fd);
}
*len = payload_size;
}
static void
read_select_parameters(struct slave_thread *slave_thread, int *nfds,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout, struct timeval **ptimeout)
{
struct io *io;
payload_size_t actual_payload_size, exceptfds_len, payload_size;
payload_size_t readfds_len, timeout_len, timeout_status_len;
payload_size_t writefds_len;
int maxfd, timeout_status;
io = &slave_thread->fsth_io;
actual_payload_size = 0;
payload_size = read_payload_size(io);
maxfd = 0;
read_fds(slave_thread, &maxfd, readfds, &readfds_len);
actual_payload_size += readfds_len;
read_fds(slave_thread, &maxfd, writefds, &writefds_len);
actual_payload_size += writefds_len;
read_fds(slave_thread, &maxfd, exceptfds, &exceptfds_len);
actual_payload_size += exceptfds_len;
timeout_status = read_int32(io, &timeout_status_len);
actual_payload_size += timeout_status_len;
if (timeout_status == 0)
*ptimeout = NULL;
else {
assert(timeout_status == 1);
read_timeval(io, timeout, &timeout_len);
actual_payload_size += timeout_len;
*ptimeout = timeout;
}
die_if_payload_size_mismatched(payload_size, actual_payload_size);
*nfds = maxfd + 1;
}
static size_t
encode_fds(int nfds, fd_set *fds, char *buf, size_t bufsize)
{
size_t pos;
int i;
pos = 0;
for (i = 0; i < nfds; i++) {
if (!FD_ISSET(i, fds))
continue;
pos += fsyscall_encode_int32(i, buf + pos, bufsize - pos);
}
return (pos);
}
static void
write_select_timeout(struct slave_thread *slave_thread)
{
struct io *io;
payload_size_t retval_len;
char retval_buf[FSYSCALL_BUFSIZE_INT32];
retval_len = fsyscall_encode_int32(0, retval_buf, sizeof(retval_buf));
io = &slave_thread->fsth_io;
write_command(io, SELECT_RETURN);
write_payload_size(io, retval_len);
write_or_die(io, retval_buf, retval_len);
}
static void
write_select_ready(struct slave_thread *slave_thread, int retval, int nfds,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
{
struct io *io;
payload_size_t exceptfds_len, nexceptfds_len, nreadfds_len;
payload_size_t nwritefds_len, payload_size, readfds_len, retval_len;
payload_size_t writefds_len;
size_t exceptfds_buf_len, readfds_buf_len, writefds_buf_len;
int nexceptfds, nreadfds, nwritefds;
char *exceptfds_buf, nexceptfds_buf[FSYSCALL_BUFSIZE_INT32];
char nreadfds_buf[FSYSCALL_BUFSIZE_INT32];
char nwritefds_buf[FSYSCALL_BUFSIZE_INT32], *readfds_buf;
char retval_buf[FSYSCALL_BUFSIZE_INT32], *writefds_buf;
nreadfds = fsyscall_count_fds(nfds, readfds);
nwritefds = fsyscall_count_fds(nfds, writefds);
nexceptfds = fsyscall_count_fds(nfds, exceptfds);
readfds_buf_len = fsyscall_compute_fds_bufsize(nreadfds);
writefds_buf_len = fsyscall_compute_fds_bufsize(nwritefds);
exceptfds_buf_len = fsyscall_compute_fds_bufsize(nexceptfds);
readfds_buf = (char *)malloc_or_die(readfds_buf_len);
writefds_buf = (char *)malloc_or_die(writefds_buf_len);
exceptfds_buf = (char *)malloc_or_die(exceptfds_buf_len);
#define ENCODE_INT32(len, n, buf) do { \
len = fsyscall_encode_int32((n), (buf), sizeof(buf)); \
} while (0)
ENCODE_INT32(retval_len, retval, retval_buf);
ENCODE_INT32(nreadfds_len, nreadfds, nreadfds_buf);
ENCODE_INT32(nwritefds_len, nwritefds, nwritefds_buf);
ENCODE_INT32(nexceptfds_len, nexceptfds, nexceptfds_buf);
#undef ENCODE_INT32
#define ENCODE_FDS(len, fds, buf, bufsize) do { \
len = encode_fds(nfds, (fds), (buf), (bufsize)); \
} while (0)
ENCODE_FDS(readfds_len, readfds, readfds_buf, readfds_buf_len);
ENCODE_FDS(writefds_len, writefds, writefds_buf, writefds_buf_len);
ENCODE_FDS(exceptfds_len, exceptfds, exceptfds_buf, exceptfds_buf_len);
#undef ENCODE_FDS
io = &slave_thread->fsth_io;
payload_size = retval_len + nreadfds_len + readfds_len + nwritefds_len +
writefds_len + nexceptfds_len + exceptfds_len;
write_command(io, SELECT_RETURN);
write_payload_size(io, payload_size);
write_or_die(io, retval_buf, retval_len);
write_or_die(io, nreadfds_buf, nreadfds_len);
write_or_die(io, readfds_buf, readfds_len);
write_or_die(io, nwritefds_buf, nwritefds_len);
write_or_die(io, writefds_buf, writefds_len);
write_or_die(io, nexceptfds_buf, nexceptfds_len);
write_or_die(io, exceptfds_buf, exceptfds_len);
}
static void
read_accept_protocol_request(struct slave_thread *slave_thread, int *s)
{
struct io *io;
payload_size_t actual_payload_size, namelen_len, payload_size, s_len;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
*s = read_int(io, &s_len);
read_socklen(io, &namelen_len); /* namelen. unused */
actual_payload_size = s_len + namelen_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
}
static void
write_payloaded_command(struct slave_thread *slave_thread, command_t command,
struct payload *payload)
{
struct io *io;
payload_size_t payload_size;
io = &slave_thread->fsth_io;
payload_size = payload_get_size(payload);
write_command(io, command);
write_payload_size(io, payload_size);
write_or_die(io, payload_get(payload), payload_size);
}
static void
write_accept_protocol_response(struct slave_thread *slave_thread,
command_t return_command, int retval,
struct sockaddr *addr, socklen_t namelen)
{
struct payload *payload;
payload = payload_create();
payload_add_int(payload, retval);
payload_add_socklen(payload, namelen);
payload_add_sockaddr(payload, addr);
write_payloaded_command(slave_thread, return_command, payload);
payload_dispose(payload);
}
static void
read_accept4_args(struct slave_thread *slave_thread, int *s, int *flags)
{
struct io *io;
payload_size_t actual_payload_size, flags_len, namelen_len;
payload_size_t payload_size, s_len;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
*s = read_int(io, &s_len);
read_socklen(io, &namelen_len); /* namelen. unused */
*flags = read_int(io, &flags_len);
actual_payload_size = s_len + namelen_len + flags_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
}
static void
process_accept4(struct slave_thread *slave_thread)
{
struct sockaddr_storage addr;
struct sockaddr *paddr;
sigset_t oset;
socklen_t namelen;
command_t return_command;
int e, flags, retval, s;
read_accept4_args(slave_thread, &s, &flags);
paddr = (struct sockaddr *)&addr;
namelen = sizeof(addr);
suspend_signal(slave_thread, &oset);
retval = accept4(s, paddr, &namelen, flags);
e = errno;
resume_signal(slave_thread, &oset);
return_command = ACCEPT4_RETURN;
if (retval == -1) {
return_int(slave_thread, return_command, retval, e);
return;
}
write_accept_protocol_response(slave_thread, return_command, retval,
paddr, namelen);
}
typedef int (*accept_syscall)(int, struct sockaddr *, socklen_t *);
static void
process_accept_protocol(struct slave_thread *slave_thread,
command_t call_command, command_t return_command,
accept_syscall syscall)
{
struct sockaddr_storage addr;
struct sockaddr *paddr;
sigset_t oset;
socklen_t namelen;
int e, retval, s;
read_accept_protocol_request(slave_thread, &s);
paddr = (struct sockaddr *)&addr;
namelen = sizeof(addr);
suspend_signal(slave_thread, &oset);
retval = syscall(s, paddr, &namelen);
e = errno;
resume_signal(slave_thread, &oset);
if (retval == -1) {
return_int(slave_thread, return_command, retval, e);
return;
}
write_accept_protocol_response(slave_thread, return_command, retval,
paddr, namelen);
}
static int
rs_read_socklen(struct rsopts *opts, socklen_t *socklen, payload_size_t *len)
{
struct slave_thread *slave_thread;
slave_thread = (struct slave_thread *)opts->rs_bonus;
*socklen = read_socklen(&slave_thread->fsth_io, len);
return (0);
}
static int
rs_read_uint8(struct rsopts *opts, uint8_t *n, payload_size_t *len)
{
struct slave_thread *slave_thread;
slave_thread = (struct slave_thread *)opts->rs_bonus;
*n = read_uint8(&slave_thread->fsth_io, len);
return (0);
}
static int
rs_read_uint64(struct rsopts *opts, uint64_t *n, payload_size_t *len)
{
struct slave_thread *slave_thread;
slave_thread = (struct slave_thread *)opts->rs_bonus;
*n = read_uint64(&slave_thread->fsth_io, len);
return (0);
}
static int
rs_read(struct rsopts *opts, char *buf, int len)
{
struct slave_thread *slave_thread;
slave_thread = (struct slave_thread *)opts->rs_bonus;
read_or_die(&slave_thread->fsth_io, buf, len);
return (0);
}
static void *
rs_malloc(struct rsopts *opts, size_t size)
{
return malloc(size);
}
static void
rs_free(struct rsopts *opts, void *ptr)
{
free(ptr);
}
static void
read_sockaddr(struct slave_thread *slave_thread, struct sockaddr *addr,
payload_size_t *addrlen)
{
struct rsopts opts;
int error;
opts.rs_bonus = slave_thread;
opts.rs_read_socklen = rs_read_socklen;
opts.rs_read_uint8 = rs_read_uint8;
opts.rs_read_uint64 = rs_read_uint64;
opts.rs_read = rs_read;
opts.rs_malloc = rs_malloc;
opts.rs_free = rs_free;
error = fsyscall_read_sockaddr(&opts, (struct sockaddr_storage *)addr,
addrlen);
if (error != 0)
die(1, "failed to read sockaddr");
}
typedef int (*connect_syscall)(int, const struct sockaddr *, socklen_t);
static void
process_connect_protocol(struct slave_thread *slave_thread,
command_t call_command, command_t return_command,
connect_syscall syscall)
{
struct io *io;
struct sockaddr *name;
sigset_t oset;
payload_size_t actual_payload_size, namelen_len, payload_size, s_len;
payload_size_t sockaddr_len;
socklen_t namelen;
int e, retval, s;
io = &slave_thread->fsth_io;
actual_payload_size = 0;
payload_size = read_payload_size(io);
s = read_int32(io, &s_len);
actual_payload_size += s_len;
namelen = read_uint32(io, &namelen_len);
actual_payload_size += namelen_len;
name = (struct sockaddr *)alloca(namelen);
read_sockaddr(slave_thread, name, &sockaddr_len);
actual_payload_size += sockaddr_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
suspend_signal(slave_thread, &oset);
retval = syscall(s, name, namelen);
e = errno;
resume_signal(slave_thread, &oset);
return_int(slave_thread, return_command, retval, e);
}
struct poll_args {
struct pollfd *fds;
nfds_t nfds;
int timeout;
};
static void
read_poll_args(struct slave_thread *slave_thread, struct poll_args *dest,
int nfdsopts)
{
struct io *io;
struct pollfd *fds;
payload_size_t actual_payload_size, events_len, fd_len, nfds_len;
payload_size_t payload_size, timeout_len;
int i, nfds, timeout;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
actual_payload_size = 0;
nfds = read_int32(io, &nfds_len);
actual_payload_size += nfds_len;
fds = (struct pollfd *)malloc(sizeof(*fds) * (nfds + nfdsopts));
for (i = 0; i < nfds; i++) {
fds[i].fd = read_int32(io, &fd_len);
actual_payload_size += fd_len;
fds[i].events = read_int16(io, &events_len);
actual_payload_size += events_len;
fds[i].revents = 0;
}
timeout = read_int32(io, &timeout_len);
actual_payload_size += timeout_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
dest->fds = fds;
dest->nfds = nfds;
dest->timeout = timeout;
}
static void
write_poll_result(struct slave_thread *slave_thread, command_t cmd, int retval,
int e, struct pollfd *fds, nfds_t nfds)
{
struct io *io;
payload_size_t return_payload_size;
size_t rest_size;
int i, retval_len, revents_len;
char buf[256], *p;
if ((retval == 0) || (retval == -1)) {
return_int(slave_thread, cmd, retval, e);
return;
}
p = buf;
rest_size = sizeof(buf);
retval_len = encode_int32(retval, p, rest_size);
p += retval_len;
rest_size -= retval_len;
for (i = 0; i < nfds; i++) {
revents_len = encode_int16(fds[i].revents, p, rest_size);
p += revents_len;
rest_size -= revents_len;
}
return_payload_size = sizeof(buf) - rest_size;
io = &slave_thread->fsth_io;
write_command(io, cmd);
write_payload_size(io, return_payload_size);
write_or_die(io, buf, return_payload_size);
}
static void
process_poll(struct slave_thread *slave_thread)
{
struct poll_args args;
struct pollfd *fds;
sigset_t oset;
nfds_t nfds;
int e, retval;
read_poll_args(slave_thread, &args, 0);
fds = args.fds;
nfds = args.nfds;
suspend_signal(slave_thread, &oset);
retval = poll(fds, nfds, args.timeout);
e = errno;
resume_signal(slave_thread, &oset);
write_poll_result(slave_thread, POLL_RETURN, retval, e, fds, nfds);
free(fds);
}
static void
process_poll_start(struct slave_thread *slave_thread)
{
struct poll_args args;
struct pollfd *fds, *shubfd;
sigset_t oset;
nfds_t nfds;
command_t cmd;
int e, n, retval;
read_poll_args(slave_thread, &args, 1);
fds = args.fds;
nfds = args.nfds;
shubfd = &fds[nfds];
shubfd->fd = io_get_rfd(&slave_thread->fsth_io);
shubfd->events = POLLIN;
shubfd->revents = 0;
suspend_signal(slave_thread, &oset);
retval = poll(fds, nfds + 1, INFTIM);
e = errno;
resume_signal(slave_thread, &oset);
n = (retval != -1) && ((shubfd->revents & POLLIN) != 0) ? 1 : 0;
write_poll_result(slave_thread, POLL_ENDED, retval - n, e, fds, nfds);
free(fds);
cmd = read_command(&slave_thread->fsth_io);
if (cmd != POLL_END)
diex(1, "protocol error: %s (%d)", get_command_name(cmd), cmd);
}
static void
merge_sigset(struct slave *slave, sigset_t *set, int (*f)(sigset_t *, int),
int *retval, int *errnum)
{
int i, sig;
for (i = 0; i < nsigs; i++) {
sig = sigs[i];
if (sigismember(set, sig))
if (f(&slave->mask, sig) == -1) {
*retval = -1;
*errnum = errno;
return;
}
}
*retval = 0;
}
static void
drop_payload_to_error(struct slave_thread *slave_thread, command_t cmd,
payload_size_t len, int e)
{
char *buf;
buf = (char *)alloca(len);
read_or_die(&slave_thread->fsth_io, buf, len);
return_int(slave_thread, cmd, -1, e);
}
static int
read_recvmsg_args(struct slave_thread *slave_thread, int *fd,
struct msghdr *msg, int *flags)
{
struct io *io;
struct iovec *iov, *piov;
payload_size_t actual_payload_size, controllen_len, fd_len, flags_len;
payload_size_t iovlen_len, len_len, msg_flags_len, namecode_len;
payload_size_t payload_size, rest_size;
socklen_t controllen;
command_t return_command;
int i, iovlen, len, namecode;
return_command = RECVMSG_RETURN;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
*fd = read_int(io, &fd_len);
actual_payload_size = fd_len;
namecode = read_int(io, &namecode_len);
actual_payload_size += namecode_len;
switch (namecode) {
case MSGHDR_MSG_NAME_NOT_NULL:
rest_size = payload_size - actual_payload_size;
drop_payload_to_error(slave_thread, return_command, rest_size,
EOPNOTSUPP);
return (-1);
case MSGHDR_MSG_NAME_NULL:
break;
default:
rest_size = payload_size - actual_payload_size;
drop_payload_to_error(slave_thread, return_command, rest_size,
EINVAL);
return (-1);
}
msg->msg_name = NULL;
msg->msg_namelen = 0;
iovlen = read_int(io, &iovlen_len);
actual_payload_size += iovlen_len;
iov = (struct iovec *)mem_alloc(slave_thread, sizeof(*iov) * iovlen);
for (i = 0; i < iovlen; i++) {
piov = &iov[i];
len = read_int(io, &len_len);
actual_payload_size += len_len;
piov->iov_base = (char *)mem_alloc(slave_thread, len);
piov->iov_len = len;
}
msg->msg_iov = iov;
msg->msg_iovlen = iovlen;
controllen = read_socklen(io, &controllen_len);
actual_payload_size += controllen_len;
msg->msg_control = 0 < controllen ? mem_alloc(slave_thread, controllen)
: NULL;
msg->msg_controllen = controllen;
msg->msg_flags = read_int(io, &msg_flags_len);
actual_payload_size += msg_flags_len;
*flags = read_int(io, &flags_len);
actual_payload_size += flags_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
return (0);
}
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static int
count_cmsghdrs(struct msghdr *msg)
{
struct cmsghdr *cmsghdr;
int n;
n = 0;
for (cmsghdr = CMSG_FIRSTHDR(msg);
cmsghdr != NULL;
cmsghdr = CMSG_NXTHDR(msg, cmsghdr))
n++;
return (n);
}
static void
add_control_size_info_to_payload(struct payload *payload, struct msghdr *msg)
{
struct cmsghdr *cmsghdr;
uintptr_t delta;
int level, type;
char *p, *pend;
for (cmsghdr = CMSG_FIRSTHDR(msg);
cmsghdr != NULL;
cmsghdr = CMSG_NXTHDR(msg, cmsghdr)) {
level = cmsghdr->cmsg_level;
type = cmsghdr->cmsg_type;
payload_add_int(payload, level);
payload_add_int(payload, type);
switch (level) {
case SOL_SOCKET:
switch (type) {
case SCM_CREDS:
/* nothing */
break;
case SCM_RIGHTS:
p = (char *)CMSG_DATA(cmsghdr);
pend = (char *)cmsghdr + cmsghdr->cmsg_len;
delta = (uintptr_t)pend - (uintptr_t)p;
payload_add_int(payload, delta / sizeof(int));
break;
default:
break;
}
break;
default:
break;
}
}
}
static void
add_passed_fds_to_payload(struct payload *payload, struct cmsghdr *cmsghdr)
{
int *pfd;
char *p, *pend;
assert(cmsghdr->cmsg_level == SOL_SOCKET);
assert(cmsghdr->cmsg_type == SCM_RIGHTS);
p = (char *)CMSG_DATA(cmsghdr);
pend = (char *)cmsghdr + cmsghdr->cmsg_len;
for (pfd = (int *)p; pfd != (int *)pend; pfd++)
payload_add_int(payload, *pfd);
}
static void
write_recvmsg_result(struct slave_thread *slave_thread, ssize_t retval, int e,
struct msghdr *msg)
{
struct msghdr *control;
struct cmsghdr *cmsghdr;
struct cmsgcred *cred;
struct payload *payload;
struct iovec *iov, *piov;
size_t len;
ssize_t rest;
command_t return_command;
gid_t *groups;
int i, ncmsghdr;
short ngroups;
void *data;
return_command = RECVMSG_RETURN;
if (retval == -1) {
return_ssize(slave_thread, return_command, retval, e);
return;
}
payload = payload_create();
payload_add_ssize(payload, retval);
iov = msg->msg_iov;
for (i = 0, rest = retval; 0 < rest; i++, rest -= len) {
piov = &iov[i];
len = MIN(piov->iov_len, rest);
payload_add(payload, piov->iov_base, len);
}
control = (struct msghdr *)msg->msg_control;
if (control != NULL) {
ncmsghdr = count_cmsghdrs(msg);
payload_add_int(payload, ncmsghdr);
add_control_size_info_to_payload(payload, msg);
for (cmsghdr = CMSG_FIRSTHDR(msg);
cmsghdr != NULL;
cmsghdr = CMSG_NXTHDR(msg, cmsghdr)) {
data = CMSG_DATA(cmsghdr);
switch (cmsghdr->cmsg_level) {
case SOL_SOCKET:
switch (cmsghdr->cmsg_type) {
case SCM_CREDS:
cred = (struct cmsgcred *)data;
payload_add_pid(payload,
cred->cmcred_pid);
payload_add_uid(payload,
cred->cmcred_uid);
payload_add_uid(payload,
cred->cmcred_euid);
payload_add_gid(payload,
cred->cmcred_gid);
ngroups = cred->cmcred_ngroups;
payload_add_short(payload, ngroups);
groups = cred->cmcred_groups;
for (i = 0; i < ngroups; i++)
payload_add_gid(payload,
groups[i]);
break;
case SCM_RIGHTS:
add_passed_fds_to_payload(payload,
cmsghdr);
break;
default:
break;
}
break;
default:
break;
}
}
}
write_payloaded_command(slave_thread, return_command, payload);
payload_dispose(payload);
}
static void
process_recvmsg(struct slave_thread *slave_thread)
{
struct msghdr msg;
sigset_t oset;
ssize_t retval;
int e, error, fd, flags;
error = read_recvmsg_args(slave_thread, &fd, &msg, &flags);
if (error != 0)
return;
suspend_signal(slave_thread, &oset);
retval = recvmsg(fd, &msg, flags);
e = errno;
resume_signal(slave_thread, &oset);
write_recvmsg_result(slave_thread, retval, e, &msg);
}
static int
read_cmsghdrs(struct slave_thread *slave_thread, struct cmsghdr **control,
socklen_t *controllen, payload_size_t *actual_payload_size)
{
struct cmsgspec {
int cmsgspec_level;
int cmsgspec_type;
socklen_t cmsgspec_len;
socklen_t cmsgspec_space;
int cmsgspec_nfds; /* for SCM_RIGHTS */
};
struct cmsghdr *cmsghdr, *cmsghdrs;
struct cmsgspec *spec, *specs;
struct io *io;
payload_size_t fd_len, level_len, ncmsghdr_len, nfds_len, payload_size;
payload_size_t type_len;
size_t cmsgspace, datasize;
socklen_t len;
int i, j, level, ncmsghdr, nfds, *pfd, type;
char *p;
payload_size = 0;
io = &slave_thread->fsth_io;
ncmsghdr = read_int(io, &ncmsghdr_len);
payload_size += ncmsghdr_len;
/* The master gives level and type at first to compute controllen */
len = 0;
specs = (struct cmsgspec *)alloca(sizeof(specs[0]) * ncmsghdr);
for (i = 0; i < ncmsghdr; i++) {
spec = &specs[i];
level = read_int(io, &level_len);
payload_size += level_len;
type = read_int(io, &type_len);
payload_size += type_len;
spec->cmsgspec_level = level;
spec->cmsgspec_type = type;
switch (level) {
case SOL_SOCKET:
switch (type) {
case SCM_CREDS:
datasize = 0;
break;
case SCM_RIGHTS:
nfds = read_int(io, &nfds_len);
payload_size += nfds_len;
spec->cmsgspec_nfds = nfds;
datasize = sizeof(int) * nfds;
break;
default:
return (ENOPROTOOPT);
}
break;
default:
return (ENOPROTOOPT);
}
cmsgspace = CMSG_SPACE(datasize);
spec->cmsgspec_len = CMSG_LEN(datasize);
spec->cmsgspec_space = cmsgspace;
len += cmsgspace;
}
cmsghdrs = (struct cmsghdr *)mem_alloc(slave_thread, len);
p = (char *)cmsghdrs;
for (i = 0; i < ncmsghdr; i++) {
cmsghdr = (struct cmsghdr *)p;
spec = &specs[i];
level = spec->cmsgspec_level;
type = spec->cmsgspec_type;
cmsghdr->cmsg_len = spec->cmsgspec_len;
cmsghdr->cmsg_level = level;
cmsghdr->cmsg_type = type;
switch (level) {
case SOL_SOCKET:
switch (type) {
case SCM_CREDS:
/* nothing */
break;
case SCM_RIGHTS:
pfd = (int *)CMSG_DATA(cmsghdr);
nfds = spec->cmsgspec_nfds;
for (j = 0; j < nfds; j++, pfd++) {
*pfd = read_int(io, &fd_len);
payload_size += fd_len;
}
break;
default:
break;
}
break;
default:
break;
}
p += spec->cmsgspec_space;
}
*control = cmsghdrs;
*controllen = len;
*actual_payload_size = payload_size;
return (0);
}
static void
process_sendmsg(struct slave_thread *slave_thread)
{
struct msghdr msg;
struct iovec *iov;
struct io *io;
sigset_t oset;
payload_size_t actual_payload_size, cmsghdrs_len, controlcode_len;
payload_size_t fd_len, flags_len, iovlen_len, len_len, msg_flags_len;
payload_size_t namecode_len, payload_size, rest_size;
size_t len;
ssize_t retval;
socklen_t controllen;
command_t return_command;
int controlcode, e, error, fd, flags, i, iovlen, namecode;
const char *fmt, *sysname = "sendmsg";
void *base, *control;
return_command = SENDMSG_RETURN;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
fd = read_int(io, &fd_len);
actual_payload_size = fd_len;
namecode = read_int(io, &namecode_len);
actual_payload_size += namecode_len;
switch (namecode) {
case MSGHDR_MSG_NAME_NOT_NULL:
assert(actual_payload_size <= payload_size);
rest_size = payload_size - actual_payload_size;
drop_payload_to_error(slave_thread, return_command, rest_size,
EOPNOTSUPP);
return;
case MSGHDR_MSG_NAME_NULL:
msg.msg_name = NULL;
msg.msg_namelen = 0;
break;
default:
assert(actual_payload_size <= payload_size);
fmt = "%s: invalid namecode: %d";
syslog(LOG_DEBUG, fmt, sysname, namecode);
rest_size = payload_size - actual_payload_size;
drop_payload_to_error(slave_thread, return_command, rest_size,
EINVAL);
return;
}
iovlen = read_int(io, &iovlen_len);
actual_payload_size += iovlen_len;
msg.msg_iovlen = iovlen;
msg.msg_iov = (struct iovec *)alloca(sizeof(struct iovec) * iovlen);
for (i = 0; i < iovlen; i++) {
iov = &msg.msg_iov[i];
len = read_int(io, &len_len);
actual_payload_size += len_len;
iov->iov_len = len;
base = (char *)alloca(len);
read_or_die(io, base, len);
actual_payload_size += len;
iov->iov_base = base;
}
controlcode = read_int(io, &controlcode_len);
actual_payload_size += controlcode_len;
switch (controlcode) {
case MSGHDR_MSG_CONTROL_NOT_NULL:
error = read_cmsghdrs(slave_thread, (struct cmsghdr **)&control,
&controllen, &cmsghdrs_len);
if (error != 0) {
syslog(LOG_DEBUG, "%s: cannot read cmsghdr", sysname);
rest_size = payload_size - actual_payload_size;
drop_payload_to_error(slave_thread, return_command,
rest_size, error);
return;
}
actual_payload_size += cmsghdrs_len;
break;
case MSGHDR_MSG_CONTROL_NULL:
control = NULL;
controllen = 0;
break;
default:
fmt = "%s: invalid controlcode: %d";
syslog(LOG_DEBUG, fmt, sysname, controlcode);
rest_size = payload_size - actual_payload_size;
drop_payload_to_error(slave_thread, return_command, rest_size,
EINVAL);
return;
}
msg.msg_control = control;
msg.msg_controllen = controllen;
msg.msg_flags = read_int(io, &msg_flags_len);
actual_payload_size += msg_flags_len;
flags = read_int(io, &flags_len);
actual_payload_size += flags_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
suspend_signal(slave_thread, &oset);
retval = sendmsg(fd, &msg, flags);
e = errno;
resume_signal(slave_thread, &oset);
return_ssize(slave_thread, return_command, retval, e);
}
static void
process_sigprocmask(struct slave_thread *slave_thread)
{
struct slave *slave;
struct io *io;
sigset_t *pset, set;
payload_size_t actual_payload_size, how_len, payload_size, set_len;
int errnum, how, retval;
pset = &set;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
how = read_int(io, &how_len);
actual_payload_size = how_len;
read_sigset(io, pset, &set_len);
actual_payload_size += set_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
slave = slave_thread->fsth_slave;
writelock_slave(slave);
switch (how) {
case SIG_BLOCK:
merge_sigset(slave, pset, sigaddset, &retval, &errnum);
break;
case SIG_UNBLOCK:
merge_sigset(slave, pset, sigdelset, &retval, &errnum);
break;
case SIG_SETMASK:
memcpy(&slave->mask, pset, sizeof(slave->mask));
retval = errnum = 0;
break;
default:
retval = -1;
errnum = EINVAL;
break;
}
unlock_slave(slave);
return_int(slave_thread, SIGPROCMASK_RETURN, retval, errnum);
}
static void
signal_handler(int sig)
{
char c = (char)sig;
write_or_die(&sigw, &c, sizeof(c));
}
static void
initialize_signal_handling(struct slave *slave)
{
int fds[2];
const char *fmt = "initialized signal handling: sigr=%s, sigw=%s";
char s1[256], s2[256];
if (pipe(fds) == -1)
die(1, "cannot pipe(2) in initializing signal handling");
io_init_nossl(&slave->fsla_sigr, fds[0], -1, vsyslog);
io_init_nossl(&sigw, -1, fds[1], vsyslog);
io_dump(&slave->fsla_sigr, s1, sizeof(s1));
io_dump(&sigw, s2, sizeof(s2));
syslog(LOG_DEBUG, fmt, s1, s2);
}
static int
connect_to_shub(struct slave *slave, const char *token, size_t token_size)
{
struct sockaddr_storage sockaddr;
struct sockaddr_un *addr;
struct io io;
int sock;
char len;
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock == -1)
die(1, "Cannot socket(2)");
addr = (struct sockaddr_un *)&sockaddr;
addr->sun_family = AF_LOCAL;
strncpy(addr->sun_path, slave->fork_sock, sizeof(addr->sun_path));
addr->sun_len = len = SUN_LEN(addr);
if (connect(sock, (struct sockaddr *)addr, len) != 0)
die(1, "Cannot connect(2)");
syslog(LOG_DEBUG, "connected to fshub: socket=%d", sock);
io_init_nossl(&io, sock, sock, vsyslog);
write_or_die(&io, token, token_size);
return (sock);
}
static void
child_main(struct slave_thread *slave_thread, const char *token,
size_t token_size, pid_t parent, sigset_t *sigset)
{
struct slave_thread *thread, *tmp;
struct slave *slave;
int sock;
char s[256];
slave = slave_thread->fsth_slave;
SLIST_FOREACH_SAFE(thread, &slave->fsla_slaves, fsth_next, tmp)
if (thread != slave_thread)
release_slave_thread(thread);
close_slave_thread(slave_thread);
sock = connect_to_shub(slave, token, token_size);
io_init_nossl(&slave_thread->fsth_io, sock, sock, vsyslog);
slave_thread->fsth_signal_watcher = true;
if (io_close(&slave->fsla_sigr) != 0)
diec(1, slave->fsla_sigr.io_error, "Cannot close(2) for sigr");
if (io_close(&sigw) != 0)
diec(1, sigw.io_error, "Cannot close(2) for sigw");
initialize_signal_handling(slave);
if (sigprocmask(SIG_SETMASK, sigset, NULL) == -1)
die(1, "sigprocmask(2) to recover failed");
io_dump(&slave_thread->fsth_io, s, sizeof(s));
syslog(LOG_INFO, "A new child process has started: io=%s", s);
}
static void
read_token(struct slave_thread *slave_thread, char **token,
payload_size_t *token_size)
{
struct io *io;
payload_size_t payload_size;
char *s;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
s = (char *)mem_alloc(slave_thread, payload_size);
read_or_die(io, s, payload_size);
*token = s;
*token_size = payload_size;
}
static void *
thread_main(void *arg)
{
struct slave_thread *slave_thread;
syslog(LOG_DEBUG, "new thread started");
slave_thread = (struct slave_thread *)arg;
mainloop(slave_thread);
release_slave_thread(slave_thread);
return (NULL);
}
static void
add_thread(struct slave *slave, struct slave_thread *slave_thread)
{
writelock_slave(slave);
SLIST_INSERT_HEAD(&slave->fsla_slaves, slave_thread, fsth_next);
unlock_slave(slave);
}
static struct slave_thread *
malloc_slave_thread()
{
size_t size;
size = sizeof(struct slave_thread);
return (struct slave_thread *)malloc_or_die(size);
}
static void
start_new_thread(struct slave *slave, const char *token, size_t token_size)
{
struct slave_thread *new_thread;
pthread_t thread;
int error, sock;
sock = connect_to_shub(slave, token, token_size);
new_thread = malloc_slave_thread();
new_thread->fsth_slave = slave;
SLIST_INIT(&new_thread->fsth_memory);
io_init_nossl(&new_thread->fsth_io, sock, sock, vsyslog);
new_thread->fsth_signal_watcher = false;
add_thread(slave, new_thread);
error = pthread_create(&thread, NULL, thread_main, new_thread);
if (error != 0)
diec(1, error, "pthread_create(3) failed");
}
static void
process_thr_new(struct slave_thread *slave_thread)
{
payload_size_t token_size;
char *token;
read_token(slave_thread, &token, &token_size);
start_new_thread(slave_thread->fsth_slave, token, token_size);
return_int(slave_thread, THR_NEW_RETURN, 0, 0);
}
static void
process_fork(struct slave_thread *slave_thread)
{
struct io *io;
sigset_t oset, set;
payload_size_t len, token_size;
pid_t parent_pid, pid;
char buf[FSYSCALL_BUFSIZE_INT32], *token;
read_token(slave_thread, &token, &token_size);
if (sigfillset(&set) == -1)
die(1, "sigfillset(3) failed");
if (sigprocmask(SIG_BLOCK, &set, &oset) == -1)
die(1, "sigprocmask(2) to block all signals failed");
parent_pid = getpid();
pid = fork_or_die();
if (pid == 0) {
child_main(slave_thread, token, token_size, parent_pid, &oset);
return;
}
syslog(LOG_DEBUG, "forked: pid=%d", pid);
if (sigprocmask(SIG_SETMASK, &oset, NULL) == -1)
die(1, "sigprocmask(2) to recover failed");
len = encode_int32(pid, buf, sizeof(buf));
io = &slave_thread->fsth_io;
write_command(io, FORK_RETURN);
write_payload_size(io, len);
write_or_die(io, buf, len);
}
static void
process_kevent(struct slave_thread *slave_thread)
{
struct io *io;
struct kevent *changelist, *eventlist, *kev;
struct payload *payload;
struct timespec timeout, *ptimeout;
sigset_t oset;
payload_size_t actual_payload_size, len, payload_size;
size_t size;
command_t return_command;
int changelist_code, e, i, kq, nchanges, nevents, retval;
int timeout_code, udata_code;
const char *fmt = "Invalid kevent(2) changelist code: %d";
const char *fmt2 = "Invalid kevent(2) timeout code: %d";
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
kq = read_int(io, &len);
actual_payload_size = len;
nchanges = read_int(io, &len);
actual_payload_size += len;
changelist_code = read_int(io, &len);
actual_payload_size += len;
switch (changelist_code) {
case KEVENT_CHANGELIST_NOT_NULL:
size = sizeof(*changelist) * nchanges;
changelist = (struct kevent *)alloca(size);
for (i = 0; i < nchanges; i++) {
kev = &changelist[i];
kev->ident = read_ulong(io, &len);
actual_payload_size += len;
kev->filter = read_short(io, &len);
actual_payload_size += len;
kev->flags = read_ushort(io, &len);
actual_payload_size += len;
kev->fflags = read_uint(io, &len);
actual_payload_size += len;
kev->data = read_long(io, &len);
actual_payload_size += len;
udata_code = read_int(io, &len);
actual_payload_size += len;
switch (udata_code) {
case KEVENT_UDATA_NULL:
kev->udata = NULL;
break;
case KEVENT_UDATA_NOT_NULL:
default:
die(1, "Invalid udata code: %d", udata_code);
break;
}
}
break;
case KEVENT_CHANGELIST_NULL:
changelist = NULL;
break;
default:
changelist = NULL; /* for -Wsometimes-uninitialized */
die(1, fmt, changelist_code);
break;
}
nevents = read_int(io, &len);
actual_payload_size += len;
eventlist = (struct kevent *)alloca(sizeof(*eventlist) * nevents);
timeout_code = read_int(io, &len);
actual_payload_size += len;
switch (timeout_code) {
case KEVENT_TIMEOUT_NOT_NULL:
timeout.tv_sec = read_int64(io, &len);
actual_payload_size += len;
timeout.tv_nsec = read_int64(io, &len);
actual_payload_size += len;
ptimeout = &timeout;
break;
case KEVENT_TIMEOUT_NULL:
ptimeout = NULL;
break;
default:
ptimeout = NULL; /* for -Wsometimes-uninitialized */
die(1, fmt2, timeout_code);
break;
}
die_if_payload_size_mismatched(payload_size, actual_payload_size);
suspend_signal(slave_thread, &oset);
retval = kevent(kq, changelist, nchanges, eventlist, nevents, ptimeout);
e = errno;
resume_signal(slave_thread, &oset);
syslog(LOG_DEBUG,
"kevent: kq=%d, nchanges=%d, nevents=%d, retval=%d",
kq, nchanges, nevents, retval);
return_command = KEVENT_RETURN;
if (retval == -1) {
return_int(slave_thread, return_command, retval, e);
return;
}
payload = payload_create();
payload_add_int(payload, retval);
for (i = 0; i < retval; i++)
payload_add_kevent(payload, &eventlist[i]);
write_payloaded_command(slave_thread, return_command, payload);
payload_dispose(payload);
}
static void
process_setsockopt(struct slave_thread *slave_thread)
{
struct io *io;
sigset_t oset;
payload_size_t actual_payload_size, level_len, optname_len, optlen_len;
payload_size_t optval_len, payload_size, s_len;
socklen_t optlen;
int e, level, n, optname, retval, s;
void *optval;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
s = read_int32(io, &s_len);
actual_payload_size = s_len;
level = read_int32(io, &level_len);
actual_payload_size += level_len;
optname = read_int32(io, &optname_len);
actual_payload_size += optname_len;
optlen = read_socklen(io, &optlen_len);
actual_payload_size += optlen_len;
switch (optname) {
case SO_REUSEADDR:
n = read_int(io, &optval_len);
actual_payload_size += optval_len;
break;
default:
die(1, "Unsupported socket option specified: %s", optname);
break;
}
optval = &n;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
suspend_signal(slave_thread, &oset);
retval = setsockopt(s, level, optname, optval, optlen);
e = errno;
resume_signal(slave_thread, &oset);
return_int(slave_thread, SETSOCKOPT_RETURN, retval, e);
}
static void
process_getsockopt(struct slave_thread *slave_thread)
{
struct io *io;
struct payload *payload;
sigset_t oset;
payload_size_t actual_payload_size, level_len, optname_len, optlen_len;
payload_size_t payload_size, s_len;
socklen_t optlen;
int e, level, optname, retval, s;
void *optval;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
s = read_int32(io, &s_len);
actual_payload_size = s_len;
level = read_int32(io, &level_len);
actual_payload_size += level_len;
optname = read_int32(io, &optname_len);
actual_payload_size += optname_len;
optlen = read_socklen(io, &optlen_len);
actual_payload_size += optlen_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
optval = alloca(optlen);
suspend_signal(slave_thread, &oset);
retval = getsockopt(s, level, optname, optval, &optlen);
e = errno;
resume_signal(slave_thread, &oset);
if (retval == -1) {
return_int(slave_thread, GETSOCKOPT_RETURN, retval, e);
return;
}
payload = payload_create();
payload_add_int(payload, retval);
switch (optname) {
case SO_REUSEADDR:
payload_add_socklen(payload, optlen);
payload_add_int(payload, *((int *)optval));
break;
default:
return_int(slave_thread, GETSOCKOPT_RETURN, -1, ENOPROTOOPT);
goto exit;
}
write_payloaded_command(slave_thread, GETSOCKOPT_RETURN, payload);
exit:
payload_dispose(payload);
}
static void
process_select(struct slave_thread *slave_thread)
{
sigset_t oset;
struct timeval *ptimeout, timeout;
fd_set exceptfds, readfds, writefds;
int e, nfds, retval;
FD_ZERO(&exceptfds);
FD_ZERO(&readfds);
FD_ZERO(&writefds);
read_select_parameters(slave_thread, &nfds, &readfds, &writefds,
&exceptfds, &timeout, &ptimeout);
suspend_signal(slave_thread, &oset);
retval = select(nfds, &readfds, &writefds, &exceptfds, ptimeout);
e = errno;
resume_signal(slave_thread, &oset);
switch (retval) {
case -1:
return_int(slave_thread, SELECT_RETURN, retval, e);
break;
case 0:
write_select_timeout(slave_thread);
break;
default:
write_select_ready(slave_thread, retval, nfds, &readfds,
&writefds, &exceptfds);
break;
}
}
static void
process_thr_exit(struct slave_thread *slave_thread)
{
pthread_exit(NULL);
/* NOTREACHED */
die(2, "pthread_exit(3) returned???");
}
static int
process_exit(struct slave_thread *slave_thread)
{
payload_size_t _;
int status;
status = read_int32(&slave_thread->fsth_io, &_);
syslog(LOG_DEBUG, "EXIT_CALL: status=%d", status);
return (status);
}
static void
process_utimes(struct slave_thread *slave_thread)
{
struct io *io;
sigset_t oset;
struct timeval *ptimes, times[2];
payload_size_t actual_payload_size, path_len, payload_size;
payload_size_t times_code_len, times_len;
int e, i, ntimes, retval;
const char *path;
uint8_t times_code;
io = &slave_thread->fsth_io;
actual_payload_size = 0;
payload_size = read_payload_size(io);
path = read_string(io, &path_len);
actual_payload_size += path_len;
times_code = read_uint8(io, ×_code_len);
actual_payload_size += times_code_len;
switch (times_code) {
case UTIMES_TIMES_NULL:
ptimes = NULL;
break;
case UTIMES_TIMES_NOT_NULL:
ntimes = array_sizeof(times);
for (i = 0; i < ntimes; i++) {
read_timeval(io, ×[i], ×_len);
actual_payload_size += times_len;
}
ptimes = times;
break;
default:
ptimes = NULL; /* for -Wsometimes-uninitialized */
die(1, "invalid utimes(2) times code: %d", times_code);
break;
}
die_if_payload_size_mismatched(payload_size, actual_payload_size);
suspend_signal(slave_thread, &oset);
retval = utimes(path, ptimes);
e = errno;
resume_signal(slave_thread, &oset);
return_int(slave_thread, UTIMES_RETURN, retval, e);
}
struct getdirentries_args {
int fd;
int nentmax;
};
static void
read_getdirentries_args(struct slave_thread *slave_thread,
struct getdirentries_args *args)
{
struct io *io;
payload_size_t actual_payload_size, fd_len, nentmax_len, payload_size;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
args->fd = read_int(io, &fd_len);
actual_payload_size = fd_len;
args->nentmax = read_int(io, &nentmax_len);
actual_payload_size += nentmax_len;
die_if_payload_size_mismatched(payload_size, actual_payload_size);
}
static int
count_dirent(const char *buf, int bufsize, int nentmax)
{
const struct dirent *dirent;
int nent;
const char *bufend, *p;
bufend = buf + bufsize;
for (p = buf, nent = 0;
(p < bufend) && (nent < nentmax);
p += dirent->d_reclen, nent++)
dirent = (const struct dirent *)p;
return (nent);
}
static void
write_getdirentries_result(struct slave_thread *slave_thread, int retval, int e,
int nentmax, const char *buf, long base)
{
struct payload *payload;
const struct dirent *dirent;
command_t return_command;
int i, nent;
const char *p;
return_command = GETDIRENTRIES_RETURN;
if (retval == -1) {
return_int(slave_thread, return_command, retval, e);
return;
}
nent = count_dirent(buf, retval, nentmax);
payload = payload_create();
payload_add_int(payload, retval);
payload_add_int(payload, nent);
for (i = 0, p = buf; i < nent; i++, p += dirent->d_reclen) {
dirent = (const struct dirent *)p;
payload_add_dirent(payload, dirent);
}
payload_add_long(payload, base);
write_payloaded_command(slave_thread, return_command, payload);
payload_dispose(payload);
}
static int
do_getdirentries(struct slave_thread *slave_thread, int fd, char *buf,
int nbytes, int nentmax)
{
struct dir_entries_cache *cache;
sigset_t oset;
long base;
int e, retval, status;
cache = slave_thread->fsth_slave->fsla_dir_entries_cache;
dir_entries_cache_lock(cache, fd);
status = dir_entries_cache_get(cache, fd, buf, nbytes, nentmax);
if (0 < status)
goto exit;
suspend_signal(slave_thread, &oset);
retval = getdirentries(fd, buf, nbytes, &base);
e = errno;
resume_signal(slave_thread, &oset);
dir_entries_cache_put(cache, fd, buf, nbytes, nentmax);
status = retval != -1 ? retval : - e;
exit:
dir_entries_cache_unlock(cache, fd);
return (status);
}
static void
process_getdirentries(struct slave_thread *slave_thread)
{
struct getdirentries_args args;
int e, nbytes, nentmax, retval, status;
char *buf;
read_getdirentries_args(slave_thread, &args);
nentmax = args.nentmax;
nbytes = sizeof(struct dirent) * nentmax;
buf = mem_alloc(slave_thread, nbytes);
status = do_getdirentries(slave_thread, args.fd, buf, nbytes, nentmax);
if (0 <= status) {
retval = status;
e = 0; /* clang rejects when this statement does not exist */
}
else {
retval = -1;
e = - status;
}
write_getdirentries_result(slave_thread, retval, e, nentmax, buf, 0L);
}
static void
process_openat(struct slave_thread *slave_thread)
{
struct io *io;
sigset_t oset;
payload_size_t actual_payload_size, fd_len, flags_len, mode_len;
payload_size_t path_len, payload_size;
int e, fd, flags, retval;
mode_t mode;
char *path;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
fd = read_int(io, &fd_len);
actual_payload_size = fd_len;
path = read_string(io, &path_len);
actual_payload_size += path_len;
flags = read_int(io, &flags_len);
actual_payload_size += flags_len;
if ((flags & O_CREAT) != 0) {
mode = read_mode(io, &mode_len);
actual_payload_size += mode_len;
}
else
mode = 0;
suspend_signal(slave_thread, &oset);
retval = openat(fd, path, flags, mode);
e = errno;
resume_signal(slave_thread, &oset);
return_int(slave_thread, OPENAT_RETURN, retval, e);
free(path);
}
static void
process_fcntl(struct slave_thread *slave_thread)
{
struct io *io;
sigset_t oset;
payload_size_t actual_payload_size, arg_len, cmd_len, fd_len;
payload_size_t payload_size;
long arg;
int cmd, e, fd, retval;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
fd = read_int(io, &fd_len);
actual_payload_size = fd_len;
cmd = read_int(io, &cmd_len);
actual_payload_size += cmd_len;
switch (cmd) {
case F_GETFD:
case F_GETFL:
arg = 42L; /* for -Wsometimes-uninitialized. unused */
break;
case F_SETFD:
case F_SETFL:
default:
arg = read_long(io, &arg_len);
actual_payload_size += arg_len;
break;
}
suspend_signal(slave_thread, &oset);
retval = fcntl(fd, cmd, arg);
e = errno;
resume_signal(slave_thread, &oset);
return_int(slave_thread, FCNTL_RETURN, retval, e);
}
static const char *
zlib_errno(int e)
{
#define CASE(n) case n: return #n
switch (e) {
CASE(Z_OK);
CASE(Z_STREAM_END);
CASE(Z_NEED_DICT);
CASE(Z_ERRNO);
CASE(Z_STREAM_ERROR);
CASE(Z_DATA_ERROR);
CASE(Z_MEM_ERROR);
CASE(Z_BUF_ERROR);
CASE(Z_VERSION_ERROR);
default:
return "unknown error";
}
#undef CASE
}
static void
decompress(struct slave_thread *slave_thread, char **out,
payload_size_t *outsize, char *in, size_t insize)
{
z_stream z;
size_t bufsize, size, tmpsize;
int zerror;
Bytef *tmp;
char *buf, *p;
bzero(&z, sizeof(z));
z.next_in = Z_NULL;
z.avail_in = 0;
z.zalloc = Z_NULL;
z.zfree = Z_NULL;
z.opaque = Z_NULL;
z.data_type = Z_BINARY;
zerror = inflateInit(&z);
if (zerror != Z_OK)
diex(1, "inflateInit() failed with %d (%s)",
zerror, zlib_errno(zerror));
buf = NULL;
bufsize = 0;
z.next_in = (Bytef *)in;
z.avail_in = insize;
tmpsize = 8192;
tmp = (Bytef *)mem_alloc(slave_thread, tmpsize);
while (0 < z.avail_in) {
z.next_out = tmp;
z.avail_out = tmpsize;
zerror = inflate(&z, Z_NO_FLUSH);
#if 0
syslog(LOG_DEBUG,
"inflate: zerror=%d (%s), buf=%p, bufsize=%zu, tmp=%p, t"
"mpsize=%zu, in=%p, insize=%zu, z.next_in=%p, z.avail_in"
"=%d, z.total_in=%lu, z.next_out=%p, z.avail_out=%d, z.t"
"otal_out=%lu, z.msg=%s",
zerror, zlib_errno(zerror), buf, bufsize, tmp, tmpsize,
in, insize, z.next_in, z.avail_in, z.total_in,
z.next_out, z.avail_out, z.total_out,
z.msg != NULL ? z.msg : "NULL");
#endif
switch (zerror) {
case Z_OK:
case Z_STREAM_END:
size = tmpsize - z.avail_out;
p = (char *)mem_alloc(slave_thread, bufsize + size);
memcpy(&p[0], buf, bufsize);
memcpy(&p[bufsize], tmp, size);
buf = p;
bufsize += size;
break;
case Z_BUF_ERROR:
tmpsize += 8192;
tmp = (Bytef *)mem_alloc(slave_thread, tmpsize);
break;
default:
diex(1, "inflate() failed with %d (%s)",
zerror, zlib_errno(zerror));
break;
}
}
zerror = inflateEnd(&z);
if (zerror != Z_OK)
diex(1, "inflateEnd() failed with %d (%s)",
zerror, zlib_errno(zerror));
#if 0
/*
* If you use this code, include <md5.h> and add a "-lmd" option to the
* LDADD in the Makefile.
*/
char md5[256];
MD5_CTX ctx;
MD5Init(&ctx);
MD5Update(&ctx, buf, bufsize);
MD5End(&ctx, md5);
syslog(LOG_DEBUG, "decompressed payload md5: %s", md5);
#endif
*out = buf;
*outsize = bufsize;
}
static void
process_compressed_writev(struct slave_thread *slave_thread)
{
sigset_t oset;
struct io *io;
struct stream st;
struct iovec *iovec, *iovp;
payload_size_t bufsize, payload_size;
size_t len;
int errnum, fd, i, iovcnt, retval;
char *buf, *payload;
void *base;
io = &slave_thread->fsth_io;
payload_size = read_payload_size(io);
payload = (char *)alloca(payload_size);
read_or_die(io, payload, payload_size);
decompress(slave_thread, &buf, &bufsize, payload, payload_size);
stream_init(&st, buf, bufsize);
fd = stream_get_int(&st);
iovcnt = stream_get_int(&st);
iovp = (struct iovec *)alloca(sizeof(iovp[0]) * iovcnt);
for (i = 0; i < iovcnt; i++) {
len = stream_get_size(&st);
base = alloca(len);
stream_get(&st, base, len);
iovec = &iovp[i];
iovec->iov_len = len;
iovec->iov_base = base;
}
suspend_signal(slave_thread, &oset);
retval = writev(fd, iovp, iovcnt);
errnum = errno;
resume_signal(slave_thread, &oset);
return_int(slave_thread, WRITEV_RETURN, retval, errnum);
}
static int
mainloop(struct slave_thread *slave_thread)
{
struct io *ios[2];
command_t cmd;
int error, nios;
const char *name;
for (;;) {
ios[0] = &slave_thread->fsth_io;
if (slave_thread->fsth_signal_watcher) {
ios[1] = &slave_thread->fsth_slave->fsla_sigr;
nios = 2;
}
else
nios = 1;
if (io_select(nios, ios, NULL, &error) == -1) {
if (error != EINTR)
diec(1, error, "select(2) failed");
continue;
}
if (slave_thread->fsth_signal_watcher && io_is_readable(ios[1]))
process_signal(slave_thread);
if (io_is_readable(ios[0])) {
cmd = read_command(ios[0]);
name = get_command_name(cmd);
syslog(LOG_DEBUG, "processing %s.", name);
switch (cmd) {
#include "dispatch.inc"
case CLOSE_CALL:
process_close(slave_thread);
break;
case FORK_CALL:
process_fork(slave_thread);
break;
case SELECT_CALL:
process_select(slave_thread);
break;
case CONNECT_CALL:
process_connect_protocol(slave_thread,
CONNECT_CALL,
CONNECT_RETURN,
connect);
break;
case BIND_CALL:
process_connect_protocol(slave_thread,
BIND_CALL, BIND_RETURN,
bind);
break;
case GETPEERNAME_CALL:
process_accept_protocol(slave_thread,
GETPEERNAME_CALL,
GETPEERNAME_RETURN,
getpeername);
break;
case GETSOCKNAME_CALL:
process_accept_protocol(slave_thread,
GETSOCKNAME_CALL,
GETSOCKNAME_RETURN,
getsockname);
break;
case ACCEPT_CALL:
process_accept_protocol(slave_thread,
ACCEPT_CALL,
ACCEPT_RETURN, accept);
break;
case POLL_CALL:
process_poll(slave_thread);
break;
case GETSOCKOPT_CALL:
process_getsockopt(slave_thread);
break;
case SETSOCKOPT_CALL:
process_setsockopt(slave_thread);
break;
case KEVENT_CALL:
process_kevent(slave_thread);
break;
case POLL_START:
process_poll_start(slave_thread);
break;
case SIGPROCMASK_CALL:
process_sigprocmask(slave_thread);
break;
case SENDMSG_CALL:
process_sendmsg(slave_thread);
break;
case RECVMSG_CALL:
process_recvmsg(slave_thread);
break;
case THR_NEW_CALL:
process_thr_new(slave_thread);
break;
case UTIMES_CALL:
process_utimes(slave_thread);
break;
case GETDIRENTRIES_CALL:
process_getdirentries(slave_thread);
break;
case FCNTL_CALL:
process_fcntl(slave_thread);
break;
case OPENAT_CALL:
process_openat(slave_thread);
break;
case ACCEPT4_CALL:
process_accept4(slave_thread);
break;
case COMPRESSED_WRITEV_CALL:
process_compressed_writev(slave_thread);
break;
case EXIT_CALL:
return process_exit(slave_thread);
case THR_EXIT_CALL:
process_thr_exit(slave_thread);
break;
default:
diex(-1, "unknown command (%d)", cmd);
/* NOTREACHED */
}
}
mem_freeall(slave_thread);
}
return (-1);
}
static int
slave_main(struct slave_thread *slave_thread)
{
negotiate_version(slave_thread);
//write_pid(slave->wfd, getpid());
write_open_fds(slave_thread);
return (mainloop(slave_thread));
}
static int
initialize_sigaction()
{
struct sigaction act;
int i, sig;
const char *fmt = "cannot sigaction(2) for %d (SIG%s)";
act.sa_handler = signal_handler;
act.sa_flags = SA_RESTART;
if (sigfillset(&act.sa_mask) == -1)
die(1, "cannot sigemptyset(3)");
for (i = 0; i < nsigs; i++) {
sig = sigs[i];
if (sigaction(sig, &act, NULL) == -1)
die(1, fmt, sig, sys_signame[sig]);
}
return (0);
}
static void
initialize_slave(struct slave *slave, const char *fork_sock)
{
int error;
char *s;
error = pthread_rwlock_init(&slave->fsla_lock, NULL);
if (error != 0)
diex(error, "pthread_rwlock_init(3) failed");
SLIST_INIT(&slave->fsla_slaves);
slave->fsla_dir_entries_cache = dir_entries_cache_create();
initialize_signal_handling(slave);
s = strdup(fork_sock);
if (s == NULL)
die(1, "cannot strdup(3) the fork socket: %s", fork_sock);
slave->fork_sock = s;
if (sigprocmask(SIG_BLOCK, NULL, &slave->mask) == -1)
die(1, "cannot sigprocmask(2) in initializing the slave");
}
int
main(int argc, char* argv[])
{
struct option opts[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
struct slave *slave;
struct slave_thread *slave_thread;
int opt, status;
char **args;
openlog(argv[0], LOG_PID, LOG_USER);
log_start_message(argc, argv);
while ((opt = getopt_long(argc, argv, "+", opts, NULL)) != -1)
switch (opt) {
case 'h':
usage();
return (0);
case 'v':
printf("fslave %s\n", FSYSCALL_VERSION);
return (0);
default:
usage();
return (-1);
}
if (argc - optind < 3) {
usage();
return (-1);
}
args = &argv[optind];
slave = (struct slave *)malloc_or_die(sizeof(*slave));
initialize_slave(slave, args[2]);
slave_thread = malloc_slave_thread();
slave_thread->fsth_slave = slave;
SLIST_INIT(&slave_thread->fsth_memory);
io_init_nossl(&slave_thread->fsth_io, atoi_or_die(args[0], "rfd"),
atoi_or_die(args[1], "wfd"), vsyslog);
slave_thread->fsth_signal_watcher = true;
add_thread(slave, slave_thread);
if (initialize_sigaction() != 0)
return (4);
status = slave_main(slave_thread);
release_slave_thread(slave_thread);
log_graceful_exit(status);
return (status);
}
| {
"content_hash": "087bada6352c64e490dfc750f913dd92",
"timestamp": "",
"source": "github",
"line_count": 2564,
"max_line_length": 80,
"avg_line_length": 24.233229329173167,
"alnum_prop": 0.6705507451636785,
"repo_name": "SumiTomohiko/fsyscall2",
"id": "70cf35e0baa17edf0de1b66765f6b4ba564336a0",
"size": "62134",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fslave/main.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "20301"
},
{
"name": "C",
"bytes": "663318"
},
{
"name": "C++",
"bytes": "3059"
},
{
"name": "Groovy",
"bytes": "1472"
},
{
"name": "Java",
"bytes": "398186"
},
{
"name": "Makefile",
"bytes": "23866"
},
{
"name": "Python",
"bytes": "1320"
},
{
"name": "Shell",
"bytes": "32639"
}
],
"symlink_target": ""
} |
/*
* Do not modify this file. This file is generated from the iam-2010-05-08.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.IdentityManagement.Model
{
/// <summary>
/// Container for the parameters to the DeleteAccountAlias operation.
/// Deletes the specified AWS account alias. For information about using an AWS account
/// alias, see <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/AccountAlias.html">Using
/// an Alias for Your AWS Account ID</a> in the <i>Using IAM</i> guide.
/// </summary>
public partial class DeleteAccountAliasRequest : AmazonIdentityManagementServiceRequest
{
private string _accountAlias;
/// <summary>
/// Empty constructor used to set properties independently even when a simple constructor is available
/// </summary>
public DeleteAccountAliasRequest() { }
/// <summary>
/// Instantiates DeleteAccountAliasRequest with the parameterized properties
/// </summary>
/// <param name="accountAlias">The name of the account alias to delete.</param>
public DeleteAccountAliasRequest(string accountAlias)
{
_accountAlias = accountAlias;
}
/// <summary>
/// Gets and sets the property AccountAlias.
/// <para>
/// The name of the account alias to delete.
/// </para>
/// </summary>
public string AccountAlias
{
get { return this._accountAlias; }
set { this._accountAlias = value; }
}
// Check to see if AccountAlias property is set
internal bool IsSetAccountAlias()
{
return this._accountAlias != null;
}
}
} | {
"content_hash": "0f9ad72ee16c33abbcbc7dc2c57de9ef",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 111,
"avg_line_length": 31.766666666666666,
"alnum_prop": 0.6379853095487933,
"repo_name": "mwilliamson-firefly/aws-sdk-net",
"id": "5fea86e673ce8a61ba5dfa54c7035afb5f34da48",
"size": "2493",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sdk/src/Services/IdentityManagement/Generated/Model/DeleteAccountAliasRequest.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "73553647"
},
{
"name": "CSS",
"bytes": "18119"
},
{
"name": "HTML",
"bytes": "24362"
},
{
"name": "JavaScript",
"bytes": "6576"
},
{
"name": "PowerShell",
"bytes": "12587"
},
{
"name": "XSLT",
"bytes": "7010"
}
],
"symlink_target": ""
} |
package com.alanbuttars.commons.config.eventbus;
import java.util.concurrent.Executor;
import com.alanbuttars.commons.config.event.Event;
import com.alanbuttars.commons.util.annotations.VisibleForTesting;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.SubscriberExceptionHandler;
/**
* Implements the {@link EventBus} interface by utilizing Google Guava's asynchronous
* {@link com.google.common.eventbus.AsyncEventBus}.
*
* @author Alan Buttars
*
*/
public class EventBusAsyncImpl implements EventBus {
private final AsyncEventBus eventBus;
/**
* See {@link AsyncEventBus#AsyncEventBus(Executor)}.
*/
public EventBusAsyncImpl(Executor executor) {
this.eventBus = new AsyncEventBus(executor);
}
/**
* See {@link AsyncEventBus#AsyncEventBus(String, Executor)}.
*/
public EventBusAsyncImpl(Executor executor, String eventBusId) {
this.eventBus = new AsyncEventBus(eventBusId, executor);
}
/**
* See {@link AsyncEventBus#AsyncEventBus(Executor, SubscriberExceptionHandler)}.
*/
public EventBusAsyncImpl(Executor executor, SubscriberExceptionHandler exceptionHandler) {
this.eventBus = new AsyncEventBus(executor, exceptionHandler);
}
@VisibleForTesting
protected AsyncEventBus getEventBus() {
return eventBus;
}
/**
* {@inheritDoc}
*/
@Override
public <E extends Event> void publish(E event) {
getEventBus().post(event);
}
/**
* {@inheritDoc}
*/
@Override
public void subscribe(Object object) {
getEventBus().register(object);
}
/**
* {@inheritDoc}
*/
@Override
public void unsubscribe(Object object) {
getEventBus().unregister(object);
}
}
| {
"content_hash": "eca8a16f76b8ef7c999efb9cf1bf6c8f",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 91,
"avg_line_length": 23.01388888888889,
"alnum_prop": 0.7435123717561859,
"repo_name": "alanbuttars/commons-java",
"id": "f4ae3c3ae6398b5f101468fd5f43196c45b39b48",
"size": "2247",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "commons-config/src/main/java/com/alanbuttars/commons/config/eventbus/EventBusAsyncImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "634700"
},
{
"name": "Shell",
"bytes": "260"
}
],
"symlink_target": ""
} |
package org.dcm4chex.archive.ejb.entity;
import java.sql.Timestamp;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.FinderException;
import org.apache.log4j.Logger;
import org.dcm4chex.archive.common.Availability;
/**
* @ejb.bean name="Media" type="CMP" view-type="local"
* primkey-field="pk" local-jndi-name="ejb/Media"
* @jboss.container-configuration name="Instance Per Transaction CMP 2.x EntityBean"
*
* @ejb.transaction type="Required"
*
* @ejb.persistence table-name="media"
*
* @jboss.entity-command name="hsqldb-fetch-key"
*
* @jboss.audit-created-time field-name="createdTime"
* @jboss.audit-updated-time field-name="updatedTime"
*
* @ejb.finder
* signature="java.util.Collection findByStatus(int status)"
* query="SELECT OBJECT(m) FROM Media AS m WHERE m.mediaStatus = ?1"
* transaction-type="Supports"
*
* @jboss.query
* signature="java.util.Collection findByStatus(int status)"
* strategy="on-find"
* eager-load-group="*"
*
* @ejb.finder
* signature="org.dcm4chex.archive.ejb.interface.MediaLocal findByFilesetIuid(java.lang.String uid)"
* query="SELECT OBJECT(m) FROM Media AS m WHERE m.filesetIuid = ?1"
* transaction-type="Supports"
*
* @jboss.query
* signature="org.dcm4chex.archive.ejb.interface.MediaLocal findByFilesetIuid(java.lang.String uid)"
* strategy="on-find"
* eager-load-group="*"
*
* @jboss.query
* signature="java.util.Collection ejbSelectGeneric(java.lang.String jbossQl, java.lang.Object[] args)"
* dynamic="true"
* strategy="on-load"
* page-size="20"
* eager-load-group="*"
*
* @jboss.query
* signature="int ejbSelectGenericInt(java.lang.String jbossQl, java.lang.Object[] args)"
* dynamic="true"
*
* @jboss.query signature="int ejbSelectInstanceAvailability(java.lang.Long pk)"
* query="SELECT MAX(i.availability) FROM Instance i WHERE i.media.pk = ?1"
*
* @author gunter.zeilinger@tiani.com
* @version $Revision: 12937 $ $Date: 2010-03-17 16:24:08 +0800 (周三, 17 3月 2010) $
* @since 26.11.2004
*/
public abstract class MediaBean implements EntityBean {
private static final Logger log = Logger.getLogger(MediaBean.class);
/**
* Auto-generated Primary Key
*
* @ejb.interface-method
* @ejb.pk-field
* @ejb.persistence column-name="pk"
* @jboss.persistence auto-increment="true"
*/
public abstract Long getPk();
public abstract void setPk(Long pk);
/**
* @ejb.interface-method
* @ejb.persistence
* column-name="created_time"
*/
public abstract java.sql.Timestamp getCreatedTime();
public abstract void setCreatedTime(java.sql.Timestamp time);
/**
* @ejb.interface-method
* @ejb.persistence
* column-name="updated_time"
*/
public abstract java.sql.Timestamp getUpdatedTime();
public abstract void setUpdatedTime(java.sql.Timestamp time);
/**
* @ejb.interface-method
* @ejb.persistence column-name="fileset_id"
*/
public abstract String getFilesetId();
/**
* @ejb.interface-method
*/
public abstract void setFilesetId(String id);
/**
* @ejb.interface-method
* @ejb.persistence column-name="fileset_iuid"
*/
public abstract String getFilesetIuid();
public abstract void setFilesetIuid(String iuid);
/**
* @ejb.interface-method
* @ejb.persistence column-name="media_rq_iuid"
*/
public abstract String getMediaCreationRequestIuid();
/**
* @ejb.interface-method
*/
public abstract void setMediaCreationRequestIuid(String iuid);
/**
* @ejb.interface-method
* @ejb.persistence column-name="media_usage"
*/
public abstract long getMediaUsage();
/**
* @ejb.interface-method
*/
public abstract void setMediaUsage(long mediaUsage);
/**
* @ejb.interface-method
* @ejb.persistence column-name="media_status"
*/
public abstract int getMediaStatus();
/**
* @ejb.interface-method
*/
public abstract void setMediaStatus(int mediaStatus);
/**
* @ejb.interface-method
* @ejb.persistence column-name="media_status_info"
*/
public abstract String getMediaStatusInfo();
/**
* @ejb.interface-method
*/
public abstract void setMediaStatusInfo(String info);
/**
* @throws FinderException
* @ejb.interface-method
*/
public boolean checkInstancesAvailable() throws FinderException {
return ejbSelectInstanceAvailability( getPk() ) <= Availability.NEARLINE;
}
/**
* @ejb.relation
* name="instance-media"
* role-name="media-with-instance"
*
* @ejb.interface-method
*/
public abstract java.util.Collection getInstances();
public abstract void setInstances(java.util.Collection insts);
/**
* @ejb.create-method
*/
public Long ejbCreate(String fsIuid) throws CreateException {
setFilesetIuid(fsIuid);
return null;
}
public void ejbPostCreate(String fsIuid) throws CreateException {
}
/**
* @ejb.home-method
*/
public java.util.Collection ejbHomeListByCreatedTime(int[] status,
Timestamp after, Timestamp before, Integer offset, Integer limit,
boolean desc) throws FinderException {
return findBy("m.createdTime", status, after, before, offset, limit,
desc);
}
/**
* @ejb.home-method
*/
public java.util.Collection ejbHomeListByUpdatedTime(int[] status,
Timestamp after, Timestamp before, Integer offset, Integer limit,
boolean desc) throws FinderException {
return findBy("m.updatedTime", status, after, before, offset, limit,
desc);
}
/**
* @ejb.home-method
*/
public int ejbHomeCountByCreatedTime(int[] status,
Timestamp after, Timestamp before) throws FinderException {
return countBy("m.createdTime", status, after, before);
}
/**
* @ejb.home-method
*/
public int ejbHomeCountByUpdatedTime(int[] status,
Timestamp after, Timestamp before) throws FinderException {
return countBy("m.updatedTime", status, after, before);
}
private static boolean isNull(int[] status) {
return status == null || status.length == 0;
}
private int appendWhere(StringBuffer jbossQl, Object[] args, String attrName,
int[] status, Timestamp after, Timestamp before) {
if (!isNull(status)) {
jbossQl.append(" WHERE m.mediaStatus IN (").append(status[0]);
for (int i = 1; i < status.length; i++) {
jbossQl.append(", ").append(status[i]);
}
jbossQl.append(")");
}
int i = 0;
if (after != null || before != null) {
jbossQl.append(isNull(status) ? " WHERE " : " AND ");
jbossQl.append(attrName);
if (after != null) {
args[i++] = after;
if (before == null) {
jbossQl.append(" > ?").append(i);
} else {
jbossQl.append(" BETWEEN ?").append(i);
args[i++] = before;
jbossQl.append(" AND ?").append(i);
}
} else if (before != null) {
args[i++] = before;
jbossQl.append(" < ?").append(i);
}
}
return i;
}
private Collection findBy(String attrName, int[] status, Timestamp after,
Timestamp before, Integer offset, Integer limit,
boolean desc) throws FinderException {
// generate JBossQL query
int argsCount = 0;
if (after != null)
++argsCount;
if (before != null)
++argsCount;
if (offset != null)
++argsCount;
if (limit != null)
++argsCount;
Object[] args = new Object[argsCount];
StringBuffer jbossQl = new StringBuffer("SELECT OBJECT(m) FROM Media m");
int i = appendWhere(jbossQl, args, attrName, status, after, before);
jbossQl.append(" ORDER BY ");
jbossQl.append(attrName);
jbossQl.append(desc ? " DESC" : " ASC");
if (offset != null) {
args[i++] = offset;
jbossQl.append(" OFFSET ?").append(i);
}
if (limit != null) {
args[i++] = limit;
jbossQl.append(" LIMIT ?").append(i);
}
if (log.isDebugEnabled())
log.debug("Execute JBossQL: " + jbossQl);
// call dynamic-ql query
return ejbSelectGeneric(jbossQl.toString(), args);
}
private int countBy(String attrName, int[] status, Timestamp after,
Timestamp before) throws FinderException {
// generate JBossQL query
int argsCount = 0;
if (after != null)
++argsCount;
if (before != null)
++argsCount;
Object[] args = new Object[argsCount];
StringBuffer jbossQl = new StringBuffer("SELECT COUNT(m) FROM Media m");
appendWhere(jbossQl, args, attrName, status, after, before);
// call dynamic-ql query
return ejbSelectGenericInt(jbossQl.toString(), args);
}
/**
* @ejb.select query=""
* transaction-type="Supports"
*/
public abstract Collection ejbSelectGeneric(String jbossQl, Object[] args)
throws FinderException;
/**
* @ejb.select query=""
* transaction-type="Supports"
*/
public abstract int ejbSelectGenericInt(String jbossQl, Object[] args)
throws FinderException;
/**
* @ejb.select query=""
*/
public abstract int ejbSelectInstanceAvailability(Long pk)
throws FinderException;
}
| {
"content_hash": "f2e1d1c70da223b2a20305abf2a75422",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 104,
"avg_line_length": 29.762048192771083,
"alnum_prop": 0.6081368282562494,
"repo_name": "medicayun/medicayundicom",
"id": "88ef77e9a237d655233ce31936128037d4cba0ed",
"size": "11763",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dcm4jboss-all/tags/DCM4CHEE_2_14_8/dcm4jboss-ejb/src/java/org/dcm4chex/archive/ejb/entity/MediaBean.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.hisp.dhis.calendar;
import com.google.common.collect.Lists;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.chrono.ISOChronology;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.util.List;
/**
* @author Morten Olav Hansen <mortenoh@gmail.com>
*/
public abstract class AbstractCalendar implements Calendar
{
protected static final String[] DEFAULT_I18N_MONTH_NAMES = new String[]{
"month.january",
"month.february",
"month.march",
"month.april",
"month.may",
"month.june",
"month.july",
"month.august",
"month.september",
"month.october",
"month.november",
"month.december"
};
protected static final String[] DEFAULT_I18N_MONTH_SHORT_NAMES = new String[]{
"month.short.january",
"month.short.february",
"month.short.march",
"month.short.april",
"month.short.may",
"month.short.june",
"month.short.july",
"month.short.august",
"month.short.september",
"month.short.october",
"month.short.november",
"month.short.december"
};
protected static final String[] DEFAULT_I18N_DAY_NAMES = new String[]{
"weekday.monday",
"weekday.tuesday",
"weekday.wednesday",
"weekday.thursday",
"weekday.friday",
"weekday.saturday",
"weekday.sunday"
};
protected static final String[] DEFAULT_I18N_DAY_SHORT_NAMES = new String[]{
"weekday.short.monday",
"weekday.short.tuesday",
"weekday.short.wednesday",
"weekday.short.thursday",
"weekday.short.friday",
"weekday.short.saturday",
"weekday.short.sunday"
};
protected static final String DEFAULT_ISO8601_DATE_FORMAT = "yyyy-MM-dd";
protected String dateFormat = DEFAULT_ISO8601_DATE_FORMAT;
@Override
public String getDateFormat()
{
return dateFormat;
}
@Override
public void setDateFormat( String dateFormat )
{
this.dateFormat = dateFormat;
}
@Override
public String formattedDate( DateTimeUnit dateTimeUnit )
{
return getDateFormat()
.replace( "yyyy", String.format( "%04d", dateTimeUnit.getYear() ) )
.replace( "MM", String.format( "%02d", dateTimeUnit.getMonth() ) )
.replace( "dd", String.format( "%02d", dateTimeUnit.getDay() ) );
}
@Override
public String formattedDate( String dateFormat, DateTimeUnit dateTimeUnit )
{
return dateFormat
.replace( "yyyy", String.format( "%04d", dateTimeUnit.getYear() ) )
.replace( "MM", String.format( "%02d", dateTimeUnit.getMonth() ) )
.replace( "dd", String.format( "%02d", dateTimeUnit.getDay() ) );
}
@Override
public String formattedIsoDate( DateTimeUnit dateTimeUnit )
{
dateTimeUnit = toIso( dateTimeUnit );
DateTime dateTime = dateTimeUnit.toJodaDateTime();
DateTimeFormatter format = DateTimeFormat.forPattern( getDateFormat() );
return format.print( dateTime );
}
@Override
public DateTimeUnit toIso( int year, int month, int day )
{
return toIso( new DateTimeUnit( year, month, day ) );
}
@Override
public DateTimeUnit toIso( String date )
{
DateTimeFormatter format = DateTimeFormat.forPattern( getDateFormat() );
DateTime dateTime = format.parseDateTime( date );
return toIso( DateTimeUnit.fromJodaDateTime( dateTime ) );
}
@Override
public DateTimeUnit fromIso( int year, int month, int day )
{
return fromIso( new DateTimeUnit( year, month, day, true ) );
}
@Override
public DateInterval toInterval( DateIntervalType type )
{
return toInterval( today(), type );
}
@Override
public DateInterval toInterval( DateTimeUnit dateTimeUnit, DateIntervalType type )
{
return toInterval( dateTimeUnit, type, 0, 1 );
}
@Override
public DateInterval toInterval( DateIntervalType type, int offset, int length )
{
return toInterval( today(), type, offset, length );
}
@Override
public List<DateInterval> toIntervals( DateTimeUnit dateTimeUnit, DateIntervalType type, int offset, int length, int periods )
{
List<DateInterval> dateIntervals = Lists.newArrayList();
for ( int i = offset; i <= (offset + periods - 1); i++ )
{
dateIntervals.add( toInterval( dateTimeUnit, type, i, length ) );
}
return dateIntervals;
}
@Override
public DateTimeUnit today()
{
DateTime dateTime = DateTime.now( ISOChronology.getInstance( DateTimeZone.getDefault() ) );
DateTimeUnit dateTimeUnit = new DateTimeUnit( dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), true );
return fromIso( dateTimeUnit );
}
@Override
public int monthsInYear()
{
return 12;
}
@Override
public int daysInWeek()
{
return 7;
}
@Override
public String nameOfMonth( int month )
{
if ( month > DEFAULT_I18N_MONTH_NAMES.length || month <= 0 )
{
return null;
}
return DEFAULT_I18N_MONTH_NAMES[month - 1];
}
@Override
public String shortNameOfMonth( int month )
{
if ( month > DEFAULT_I18N_MONTH_SHORT_NAMES.length || month <= 0 )
{
return null;
}
return DEFAULT_I18N_MONTH_SHORT_NAMES[month - 1];
}
@Override
public String nameOfDay( int day )
{
if ( day > DEFAULT_I18N_DAY_NAMES.length || day <= 0 )
{
return null;
}
return DEFAULT_I18N_DAY_NAMES[day - 1];
}
@Override
public String shortNameOfDay( int day )
{
if ( day > DEFAULT_I18N_DAY_SHORT_NAMES.length || day <= 0 )
{
return null;
}
return DEFAULT_I18N_DAY_SHORT_NAMES[day - 1];
}
@Override
public boolean isIso8601()
{
return false;
}
@Override
public DateTimeUnit isoStartOfYear( int year )
{
return new DateTimeUnit( year, 1, 1 );
}
@Override
public boolean isValid( DateTimeUnit dateTime )
{
if ( dateTime.getMonth() < 1 || dateTime.getMonth() > monthsInYear() )
{
return false;
}
if ( dateTime.getDay() < 1 || dateTime.getDay() > daysInMonth( dateTime.getYear(), dateTime.getMonth() ) )
{
return false;
}
return true;
}
}
| {
"content_hash": "c2f9a973e53ee8fc6a68b2c78d4a62fa",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 134,
"avg_line_length": 26.33203125,
"alnum_prop": 0.5991692627206646,
"repo_name": "jason-p-pickering/dhis2-persian-calendar",
"id": "c1348d4a6ae1650a384efd1dbf898fef42cf1d5e",
"size": "8297",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "243736"
},
{
"name": "Game Maker Language",
"bytes": "20893"
},
{
"name": "HTML",
"bytes": "68765"
},
{
"name": "Java",
"bytes": "16950773"
},
{
"name": "JavaScript",
"bytes": "1796128"
},
{
"name": "Ruby",
"bytes": "1011"
},
{
"name": "Shell",
"bytes": "394"
},
{
"name": "XSLT",
"bytes": "8281"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.