text:
import * as Common from '../common/common.js';
import * as SDK from '../sdk/sdk.js';  // eslint-disable-line no-unused-vars
import * as SourceFrame from '../source_frame/source_frame.js';
import * as TextUtils from '../text_utils/text_utils.js';
import * as UI from '../ui/ui.js';

import {RequestHTMLView} from './RequestHTMLView.js';
import {RequestResponseView} from './RequestResponseView.js';
import {SignedExchangeInfoView} from './SignedExchangeInfoView.js';

export class RequestPreviewView extends RequestResponseView {
  /**
   * @param {!SDK.NetworkRequest.NetworkRequest} request
   */
  constructor(request) {
    super(request);
  }

  /**
   * @override
   * @protected
   * @return {!Promise<!UI.Widget.Widget>}
   */
  async showPreview() {
    const view = await super.showPreview();
    if (!(view instanceof UI.View.SimpleView)) {
      return view;
    }
    const toolbar = new UI.Toolbar.Toolbar('network-item-preview-toolbar', this.element);
    view.toolbarItems().then(items => {
      items.map(item => toolbar.appendToolbarItem(item));
    });
    return view;
  }

  /**
   * @return {!Promise<?UI.Widget.Widget>}
   */
  async _htmlPreview() {
    const contentData = await this.request.contentData();
    if (contentData.error) {
      return new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('Failed to load response data'));
    }

    const whitelist = new Set(['text/html', 'text/plain', 'application/xhtml+xml']);
    if (!whitelist.has(this.request.mimeType)) {
      return null;
    }

    const content = contentData.encoded ? window.atob(/** @type {string} */ (contentData.content)) :
                                          /** @type {string} */ (contentData.content);

    // http://crbug.com/767393 - DevTools should recognize JSON regardless of the content type
    const jsonView = await SourceFrame.JSONView.JSONView.createView(content);
    if (jsonView) {
      return jsonView;
    }

    const dataURL = TextUtils.ContentProvider.contentAsDataURL(
        contentData.content, this.request.mimeType, contentData.encoded, this.request.charset());
    return dataURL ? new RequestHTMLView(dataURL) : null;
  }

  /**
   * @override
   * @protected
   * @return {!Promise<!UI.Widget.Widget>}
   */
  async createPreview() {
    if (this.request.signedExchangeInfo()) {
      return new SignedExchangeInfoView(this.request);
    }

    const htmlErrorPreview = await this._htmlPreview();
    if (htmlErrorPreview) {
      return htmlErrorPreview;
    }

    const provided = await SourceFrame.PreviewFactory.PreviewFactory.createPreview(this.request, this.request.mimeType);
    if (provided) {
      return provided;
    }

    return new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('Preview not available'));
  }
}


text:
package org.elasticsearch.xpack.sql.expression.gen.pipeline;

import org.elasticsearch.xpack.sql.execution.search.SqlSourceBuilder;
import org.elasticsearch.xpack.sql.execution.search.extractor.ScoreExtractor;
import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.gen.processor.HitExtractorProcessor;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.tree.Source;
import org.elasticsearch.xpack.sql.tree.NodeInfo;

import java.util.List;

import static java.util.Collections.emptyList;

public class ScorePipe extends Pipe {
    public ScorePipe(Source source, Expression expression) {
        super(source, expression, emptyList());
    }

    @Override
    protected NodeInfo<ScorePipe> info() {
        return NodeInfo.create(this, ScorePipe::new, expression());
    }

    @Override
    public final Pipe replaceChildren(List<Pipe> newChildren) {
        throw new UnsupportedOperationException("this type of node doesn't have any children to replace");
    }

    @Override
    public boolean resolved() {
        return true;
    }

    @Override
    public Processor asProcessor() {
        return new HitExtractorProcessor(ScoreExtractor.INSTANCE);
    }

    @Override
    public boolean supportedByAggsOnlyQuery() {
        return false;
    }

    @Override
    public Pipe resolveAttributes(AttributeResolver resolver) {
        return this;
    }

    @Override
    public void collectFields(SqlSourceBuilder sourceBuilder) {
        sourceBuilder.trackScores();
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

class getSelectionStatus
{

    /**
     * @var AuthToken $token
     * @access public
     */
    public $token = null;

    /**
     * @var int $selectionId
     * @access public
     */
    public $selectionId = null;
}


text:
<TITLE>Review for Third World Cop (1999)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Third World Cop (1999)

reviewed by
Brian Matherly

Third World Cop (2000)
Rating: 3.5 stars out of 5.0 stars

Cast: Paul Campbell, Mark Danvers, Carl Bradshaw, Audrey Reid, Winston
Bell, Lenford Salmon, Desmond Ballentine (a.k.a. Ninjaman)
Written by: Suzanne Fenn, Chris Browne, and Chris Salewicz
Directed by: Chris Browne
Running Time: 98 minutes

`We run tings. Tings don't run we.'
    -Sound advice from Capone (Paul Campbell) to his squaddie (or
partner), Floyd (Winston Bell).

Jamaican film, shot entirely on video, featuring a standard cop movie
plot mixed with a dash of John Woo-styled brotherhood morals (and a
little gunplay).  Capone, a tough as nails super cop, gets a transfer
back to his hometown of Kingston after successfully taking down some
gangsters that have broken into his home (while he was with his lady)
and killed his partner in front of him.  When he arrives, he discovers
that the ghetto where he grew up has gotten worse, thanks mainly to the
crime boss Wonie (Jamaican film veteran Carl Bradshaw), so named because
his left hand has been amputated and replaced by a grasping hook).
Capone discovers that Wonie has been smuggling guns inside shipments of
charity supplies for the area churches and, much to his disappointment,
also finds out his childhood friend Ratty (Mark Danvers) has been
helping him.  Torn between doing his job and protecting his best friend,
Capone must make some hard decisions in order to make things right
again.

Directed deftly by first time Jamaican filmmaker Chris Browne (assistant
director for such American films as How Stella Got Her Groove Back and
Instinct), one hardly notices the film was shot on video after a while.
Shots are handled so efficiently that they quickly take on the nuances
of the aforementioned John Woo films, although the action isn't as
hyperkinetic as most of Woo's films are.  The action scenes are handled
with a kind of flair though, and eventually begin to take on a life of
their own (beyond the Hong Kong films that they are obviously patterned
after).  The make-up effects are particularly good in these scenes as
well, with flawless squib work on display from the effects team.

The cast is superb and listening to their dialogue, spoken with thick
Jamaican accents (half of which have to be subtitled because of their
extensive use of slang), just adds to the interest.  Paul Campbell, as
the `loose cannon' Capone, essays his role perfectly, displaying the
right amount of menace and compassion at the right times.  Mark Danvers
evokes sympathy as Ratty, the part-time gun smuggler who is also trying
to help the community by building football fields and organizing block
parties to bring people together.  Unfortunately, Carl Bradshaw is given
the least to do and his character as the crime boss seems ineffective
(largely because his underlings seem to run all over him), but then
again, that could be the way his character was intended to be portrayed.

The music in the film is composed of all reggae songs, and the
soundtrack was produced by Grammy Award winning artists, Sly and Robbie
(who have worked with the likes of The Rolling Stones, Maxi Priest, Bob
Dylan, James Brown, Grace Jones, Herbie Hancock, Bootsy Collins, and
Carly Simon among others).  The end credit song, `We Run Tings', by the
group Red Dragon, is pretty decent and carries on the theme of the movie
established early on by the quote that opens this review.  Oddly enough,
Desmond Ballentine (who plays the character Deportee) is well known as a
pioneer in the realm of `gangsta' reggae as the performer Ninjaman, and
he doesn't contribute a single song to the film (that I could see),
which is virtually unheard of here in the US.

At the time of this writing, Third World Cop has been put into limited
theatrical release in the US, coming off of a six-month box-office
breaking run in Jamaica, where it holds the position as highest grossing
film of all time (bringing in $21 million in Jamaica, which is roughly
$500,000 US).  Palm Pictures (the company that released the offbeat, but
entertaining Six-String Samurai) is the company releasing the film and
considering that their main focus is the DVD market, I can imagine that
a disc will be available once the film has left theaters.  Chris
Blackwell, founder of Palm Pictures, was also involved in the production
of another Jamaican box-office smash in 1981 entitled Countryman, so I'd
say he has a pretty good track record.

Overall, Third World Cop is a pretty entertaining homage to the films of
John Woo, Ringo Lam, Tsui Hark, and many other action films by directors
from Hong Kong.  If action films are your thing and you don't mind
intermittent subtitles, then you can't go wrong with this film.  The
performances and the story are solid (if only a little cliched) and the
action is tight.  I'm not sure what the other Jamaican films released in
that country are like, but apparently Third World Cop's honors are well
deserved.

Brian Matherly - bmath2000@hotmail.com
The Jacksonville Film Journal - http://www.jaxfilmjournal.com/

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
require 'spec_helper'

describe Widget do
  subject(:widget) { Fabricate.build :widget }

  it { is_expected.to respond_to :dashboard }
  it { is_expected.to respond_to :title }
  it { is_expected.to respond_to :width }
  it { is_expected.to respond_to :height }
  it { is_expected.to respond_to :position }
end


text:
package storm2013.commands.LEDcommands;

/** Turn the LEDs off. */
public class TurnOff extends SetColor {
    public TurnOff(){
        super(Color.OFF);
    }
}


text:
"""A setup module for the google apis common protos

See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

import setuptools

from setuptools import setup, find_packages

install_requires = [
  'protobuf>=3.0.0'
]

extras_require = {
  'grpc': ['grpcio>=1.0.0']
}

setuptools.setup(
  name='googleapis-common-protos',
  version='1.5.2',

  author='Google Inc',
  author_email='googleapis-packages@google.com',
  classifiers=[
    'Development Status :: 5 - Production/Stable',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: Apache Software License',
    'Programming Language :: Python',
    'Programming Language :: Python :: 2',
    'Programming Language :: Python :: 2.7',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.4',
    'Programming Language :: Python :: 3.5',
    'Programming Language :: Python :: Implementation :: CPython',
  ],
  description='Common protobufs used in Google APIs',
  long_description=open('README.rst').read(),
  install_requires=install_requires,
  extras_require=extras_require,
  license='Apache-2.0',
  packages=find_packages(),
  namespace_packages=['google', 'google.logging', ],
  url='https://github.com/googleapis/googleapis'
)


text:
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using UnityEditor;
using UnityEngine.TestTools;
using Unity.Robotics.UrdfImporter;
using Object = UnityEngine.Object;
using Collision = Unity.Robotics.UrdfImporter.Link.Collision;
using Geometry = Unity.Robotics.UrdfImporter.Link.Geometry;
using Box = Unity.Robotics.UrdfImporter.Link.Geometry.Box;

namespace Unity.Robotics.UrdfImporter.Tests
{
    public class UrdfCollisionExtensionsTests
    {
        [Test]
        public void Create_GeometryBox_DefaultGeometry()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var parent = new GameObject("Parent").transform;

            var collision = UrdfCollisionExtensions.Create(parent, GeometryTypes.Box);
            Assert.IsNotNull(collision);
            Assert.IsTrue(collision.gameObject.activeInHierarchy);
            Assert.AreEqual(GeometryTypes.Box, collision.geometryType);

            Object.DestroyImmediate(parent.gameObject);
        }

        [Test]
        public void Create_GeometryBoxWithVisual_NondefaultScale()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var parent = new GameObject("Parent").transform;
            var copy = new GameObject("Copy").transform;
            copy.transform.localScale = Vector3.one * 2f;

            var collision = UrdfCollisionExtensions.Create(parent, GeometryTypes.Box, copy);
            Assert.IsNotNull(collision);
            Assert.IsTrue(collision.gameObject.activeInHierarchy);
            Assert.AreEqual(GeometryTypes.Box, collision.geometryType);
            Assert.AreEqual(Vector3.one * 2f, collision.transform.localScale);

            Object.DestroyImmediate(parent.gameObject);
        }

        [Test]
        public void Create_GeometryMesh_DefaultGeometry()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var parent = new GameObject("Parent").transform;

            var collision = UrdfCollisionExtensions.Create(parent, GeometryTypes.Mesh);
            Assert.IsNotNull(collision);
            Assert.IsTrue(collision.gameObject.activeInHierarchy);
            Assert.AreEqual(GeometryTypes.Mesh, collision.geometryType);

            Object.DestroyImmediate(parent.gameObject);
        }

        [Test]
        public void Create_GeometryMeshWithVisual_NondefaultScale()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var parent = new GameObject("Parent").transform;
            var copy = new GameObject("Copy").transform;
            copy.transform.localScale = Vector3.one * 2f;

            var collision = UrdfCollisionExtensions.Create(parent, GeometryTypes.Mesh, copy);
            Assert.IsNotNull(collision);
            Assert.IsTrue(collision.gameObject.activeInHierarchy);
            Assert.AreEqual(GeometryTypes.Mesh, collision.geometryType);
            Assert.AreEqual(Vector3.one * 2f, collision.transform.localScale);

            Object.DestroyImmediate(parent.gameObject);
        }

        [Test]
        public void Create_LinkCollision_DefaultGeometry()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var parent = new GameObject("Parent").transform;
            var geometry = new Geometry(box:new Box(new double[] {1, 1, 1}));

            var collision = UrdfCollisionExtensions.Create(parent, new Collision(geometry));
            Assert.IsNotNull(collision);
            Assert.IsTrue(collision.gameObject.activeInHierarchy);
            Assert.AreEqual(GeometryTypes.Box, collision.geometryType);
            Assert.IsTrue(collision.GetComponentsInChildren<BoxCollider>().Length > 0);

            Object.DestroyImmediate(parent.gameObject);
        }

        [Test]
        public void ExportCollisionData_DefaultGeometry_Succeeds()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var parent = new GameObject("Parent").transform;

            var collisionComponent = UrdfCollisionExtensions.Create(parent, GeometryTypes.Box);
            var exported = UrdfCollisionExtensions.ExportCollisionData(collisionComponent);
            Assert.IsNotNull(exported.geometry.box);
            Assert.AreEqual(new double[] {1,1,1}, exported.geometry.box.size);
            Assert.IsNull(exported.name);

            Object.DestroyImmediate(parent.gameObject);
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
    System Fonts

    This file lists the font families that will be used by default for all supported glyphs.
    Each entry consists of a family, various names that are supported by that family, and
    up to four font files. The font files are listed in the order of the styles which they
    support: regular, bold, italic and bold-italic. If less than four styles are listed, then
    the styles with no associated font file will be supported by the other font files listed.

    The first family is also the default font, which handles font request that have not specified
    specific font names.

    Any glyph that is not handled by the system fonts will cause a search of the fallback fonts.
    The default fallback fonts are specified in the file /system/etc/fallback_fonts.xml, and there
    is an optional file which may be supplied by vendors to specify other fallback fonts to use
    in /vendor/etc/fallback_fonts.xml.
-->
<familyset>

    <family>
        <nameset>
            <name>sans-serif</name>
            <name>arial</name>
            <name>helvetica</name>
            <name>tahoma</name>
            <name>verdana</name>
        </nameset>
        <fileset>
            <file>Roboto-Regular.ttf</file>
            <file>Roboto-Bold.ttf</file>
            <file>Roboto-Italic.ttf</file>
            <file>Roboto-BoldItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-light</name>
        </nameset>
        <fileset>
            <file>Roboto-Light.ttf</file>
            <file>Roboto-LightItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-thin</name>
        </nameset>
        <fileset>
            <file>Roboto-Thin.ttf</file>
            <file>Roboto-ThinItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-condensed</name>
        </nameset>
        <fileset>
            <file>RobotoCondensed-Regular.ttf</file>
            <file>RobotoCondensed-Bold.ttf</file>
            <file>RobotoCondensed-Italic.ttf</file>
            <file>RobotoCondensed-BoldItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-medium</name>
        </nameset>
        <fileset>
            <file>Roboto-Medium.ttf</file>
            <file>Roboto-MediumItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-black</name>
        </nameset>
        <fileset>
            <file>Roboto-Black.ttf</file>
            <file>Roboto-BlackItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-condensed-light</name>
        </nameset>
        <fileset>
            <file>RobotoCondensed-Light.ttf</file>
            <file>RobotoCondensed-LightItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>serif</name>
            <name>times</name>
            <name>times new roman</name>
            <name>palatino</name>
            <name>georgia</name>
            <name>baskerville</name>
            <name>goudy</name>
            <name>fantasy</name>
            <name>ITC Stone Serif</name>
        </nameset>
        <fileset>
            <file>NotoSerif-Regular.ttf</file>
            <file>NotoSerif-Bold.ttf</file>
            <file>NotoSerif-Italic.ttf</file>
            <file>NotoSerif-BoldItalic.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>Droid Sans</name>
        </nameset>
        <fileset>
            <file>DroidSans.ttf</file>
            <file>DroidSans-Bold.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>monospace</name>
            <name>sans-serif-monospace</name>
            <name>monaco</name>
        </nameset>
        <fileset>
            <file>DroidSansMono.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>serif-monospace</name>
            <name>courier</name>
            <name>courier new</name>
        </nameset>
        <fileset>
            <file>CutiveMono.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>casual</name>
        </nameset>
        <fileset>
            <file>ComingSoon.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>cursive</name>
        </nameset>
        <fileset>
            <file>DancingScript-Regular.ttf</file>
            <file>DancingScript-Bold.ttf</file>
        </fileset>
    </family>

    <family>
        <nameset>
            <name>sans-serif-smallcaps</name>
        </nameset>
        <fileset>
            <file>CarroisGothicSC-Regular.ttf</file>
        </fileset>
    </family>

    <!-- Added Samsung fonts for TouchWiz style -->
    <family>
        <nameset>
            <name>sec-roboto-light</name>
        </nameset>
        <fileset>
            <file>SECRobotoLight-Regular.ttf</file>
            <file>SECRobotoLight-Bold.ttf</file>
        </fileset>
    </family>

    <!-- Added Number fonts for All models -->
    <family>
        <nameset>
            <name>samsung-neo-num3T-cond</name>
        </nameset>
        <fileset>
            <file>SamsungNeoNumCond-3T.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-neo-num3T</name>
        </nameset>
        <fileset>
            <file>SamsungNeoNum-3T.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-neo-num3L</name>
        </nameset>
        <fileset>
            <file>SamsungNeoNum-3L.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-neo-num3R</name>
        </nameset>
        <fileset>
            <file>SamsungNeoNum-3R.ttf</file>
        </fileset>
    </family>

    <!-- Added Number fonts for Hero UX models -->
    <family>
        <nameset>
            <name>roboto-num3L</name>
        </nameset>
        <fileset>
            <file>RobotoNum-3L.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>roboto-num3R</name>
        </nameset>
        <fileset>
            <file>RobotoNum-3R.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>clock2016</name>
        </nameset>
        <fileset>
            <file>Clock2016.ttf</file>
        </fileset>
    </family>

    <!-- Added Number fonts for OS up models -->
    <family>
        <nameset>
            <name>samsung-sans-num3L</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num3L.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num3T</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num3T.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num4L</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num4L.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num4T</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num4T.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num35</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num35.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num45</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num45.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num3LV</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num3Lv.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num3R</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num3R.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num4Tv</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num4Tv.ttf</file>
        </fileset>
    </family>
    <family>
        <nameset>
            <name>samsung-sans-num4Lv</name>
        </nameset>
        <fileset>
            <file>SamsungSans-Num4Lv.ttf</file>
        </fileset>
    </family>
</familyset>


text:
@implementation ILA_MatchHistory

@end


text:
/* eslint-disable no-unused-expressions */
/* eslint-disable no-invalid-this */
import { expect } from 'chai'
import sinon from 'sinon'
import { shallow } from 'enzyme'
import proxyquire from 'proxyquire'
import React from 'react'
import DisabledPlugin from '../js/rendererjs/disabledplugin.js'

let running = true
const mock = {
	'react-dom': {
		render: sinon.spy(),
	},
	'rivine.js': {
		isRunning: () => new Promise((resolve) => {
			resolve(running)
		}),
		launch: sinon.spy(),
	},
	'electron': {
		remote: {
			getCurrentWindow: sinon.spy(),
			getGlobal: (name) => {
				if (name === 'config') {
					return {
						rivined: {
							path: 'testpath/rivined',
							datadir: 'testpath/datadir',
							detached: false,
						},
					}
				}
				return null
			},
			dialog: {
				showOpenDialog: sinon.spy(),
				showSaveDialog: sinon.spy(),
				showMessageBox: sinon.spy(),
				showErrorBox: sinon.spy(),
			},
		},
	},
}

proxyquire('../js/rendererjs/pluginapi.js', mock)

describe('plugin API', () => {
	it('creates a RivineAPI window object', () => {
		expect(window.RivineAPI).to.exist
	})
	it('does not mount disabled plugin component if rivined is running', function(done) {
		running = true
		this.timeout(10000)
		const poll = setInterval(() => {
			if (mock['react-dom'].render.called === false) {
				clearInterval(poll)
				done()
			}
		}, 50)
	})
	it('mounts disabled plugin if rivined is not running', function(done) {
		running = false
		this.timeout(10000)
		const poll = setInterval(() => {
			if (mock['react-dom'].render.called === true) {
				clearInterval(poll)
				done()
			}
		}, 50)
	})
	describe('DisabledPlugin component', () => {
		it('calls rivinejs.launch on click', () => {
			const component = shallow(<DisabledPlugin startRivined={mock['rivine.js'].launch} />)
			component.find('button').first().simulate('click')
			expect(mock['rivine.js'].launch.called).to.be.true
		})
	})
})
/* eslint-enable no-unused-expressions */
/* eslint-enable no-invalid-this */


text:
local ansicolors = require 'ansicolors'

local c27 = string.char(27)

describe('ansicolors', function()

  it('should add resets if no options given', function()
    assert_equal(ansicolors('foo'), c27 .. '[0m' .. 'foo' .. c27 .. '[0m' )
  end)

  it('should throw an error on invalid options', function()
    assert_error(function() ansicolors('%{blah}foo') end)
  end)

  it('should add red color to text', function()
    assert_equal(ansicolors('%{red}foo'), c27 .. '[0m' .. c27 .. '[31mfoo' .. c27 .. '[0m')
  end)

  it('should add red underlined text', function()
    assert_equal(ansicolors('%{red underline}foo'),  c27 .. '[0m' .. c27 .. '[31m' .. c27 .. '[4mfoo' .. c27 .. '[0m')
  end)

  it('should with heterogeneous attributes', function()
    assert_equal(ansicolors('%{bright white}*%{bright red}BEEP%{bright white}*'),  c27 .. '[0m' .. c27 .. '[1m' .. c27 .. '[37m*' .. c27 .. '[1m' .. c27 .. '[31mBEEP' .. c27 .. '[1m' .. c27 .. '[37m*' .. c27 .. '[0m')
  end)

  describe('noReset', function ()
    it('should do nothing if no options given', function()
      assert_equal(ansicolors.noReset('foo'), 'foo' )
    end)

    it('should throw an error on invalid options', function()
      assert_error(function() ansicolors.noReset('%{blah}foo') end)
    end)

    it('should add red color to text', function()
      assert_equal(ansicolors.noReset('%{red}foo'), c27 .. '[31mfoo')
    end)

    it('should add red underlined text', function()
      assert_equal(ansicolors.noReset('%{red underline}foo'), c27 .. '[31m' .. c27 .. '[4mfoo')
    end)

    it('should with heterogeneous attributes', function()
      assert_equal(ansicolors.noReset('%{bright white}*%{bright red}BEEP%{bright white}*'),  c27 .. '[1m' .. c27 .. '[37m*' .. c27 .. '[1m' .. c27 .. '[31mBEEP' .. c27 .. '[1m' .. c27 .. '[37m*')
    end)

  end)

  describe('support detection', function()

    it('should return a plain text string on systems with no package.config', function()
      local prevConfig = package.config
      package.config = "\\"
      local colors = dofile 'ansicolors.lua'

      assert_equal(colors('%{red underline}foo'), 'foo')

      io.popen = prevIoPopen
    end)

  end)

  describe('under Windows', function()

    describe('without ANSICON', function()
      it('should return a plain text string', function()
        package.config = "\\"
        local colors = dofile 'ansicolors.lua'
        assert_equal(colors('%{red}foo'), 'foo')
      end)
    end)

    describe('with ANSICON', function()
      it('should add ANSI escapes to text', function()
        package.config = "\\"
        os.getenv = function () return true end
        local colors = dofile 'ansicolors.lua'
        assert_equal(colors('%{red}foo'), c27 .. '[0m' .. c27 .. '[31mfoo' .. c27 .. '[0m')
      end)
    end)
  end)

end)


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Wonderful | Admin Theme</title>

    <link rel="apple-touch-icon" sizes="120x120" href="img/favicon/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
    <link rel="manifest" href="img/favicon/manifest.json">
    <link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5bbad5">
    <meta name="theme-color" content="#ffffff">

    <meta property="og:title" content="Wonderful"/>
    <meta property="og:url" content="https://muhibbudins.github.io/wonderful/"/>
    <meta property="og:image" content="https://muhibbudins.github.io/wonderful/img/preview.png"/>
    <meta property="og:description" content="Wonderful is FREE Admin template build under Bootstrap Framework with full customize and don't worry SASS/SCSS included."/>

    <meta name="twitter:site" content="Wonderful"/>
    <meta name="twitter:creator" content="Muhibbudin Suretno"/>
    <meta name="twitter:title" content="Wonderful"/>
    <meta name="twitter:url" content="https://muhibbudins.github.io/wonderful/"/>
    <meta name="twitter:description" content="Wonderful is FREE Admin template build under Bootstrap Framework with full customize and don't worry SASS/SCSS included."/>
    <meta name="twitter:image" content="https://muhibbudins.github.io/wonderful/img/preview.png"/>

    <meta itemprop="name" content="Wonderful"/>
    <meta itemprop="description" content="Wonderful is FREE Admin template build under Bootstrap Framework with full customize and don't worry SASS/SCSS included."/>
    <meta itemprop="image" content="https://muhibbudins.github.io/wonderful/img/preview.png"/>

    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/loading-bar.css">
    <link rel="stylesheet" href="css/prism.css">
    <link rel="stylesheet" href="wysiwyg/summernote.css">

    <link rel="stylesheet" href="css/default.css">

WYSIWYG Editor

Hello Summernote


text:
<?php

/**
 * @see Zend_Server_Interface
 */
#require_once 'Zend/Server/Interface.php';

/** @see Zend_Xml_Security */
#require_once 'Zend/Xml/Security.php';

/** @see Zend_Xml_Exception */
#require_once 'Zend/Xml/Exception.php';

/**
 * Zend_Soap_Server
 *
 * @category   Zend
 * @package    Zend_Soap
 * @subpackage Server
 * @uses       Zend_Server_Interface
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id$
 */
class Zend_Soap_Server implements Zend_Server_Interface
{
    /**
     * Actor URI
     * @var string URI
     */
    protected $_actor;

    /**
     * Class registered with this server
     * @var string
     */
    protected $_class;

    /**
     * Arguments to pass to {@link $_class} constructor
     * @var array
     */
    protected $_classArgs = array();

    /**
     * Object registered with this server
     */
    protected $_object;

    /**
     * Array of SOAP type => PHP class pairings for handling return/incoming values
     * @var array
     */
    protected $_classmap;

    /**
     * Encoding
     * @var string
     */
    protected $_encoding;

    /**
     * SOAP Server Features
     *
     * @var int
     */
    protected $_features;

    /**
     * WSDL Caching Options of SOAP Server
     *
     * @var mixed
     */
    protected $_wsdlCache;

    /**
     * WS-I compliant
     *
     * @var boolean
     */
    protected $_wsiCompliant;

    /**
     * Registered fault exceptions
     * @var array
     */
    protected $_faultExceptions = array();

    /**
     * Functions registered with this server; may be either an array or the SOAP_FUNCTIONS_ALL
     * constant
     * @var array|int
     */
    protected $_functions = array();

    /**
     * Persistence mode; should be one of the SOAP persistence constants
     * @var int
     */
    protected $_persistence;

    /**
     * Request XML
     * @var string
     */
    protected $_request;

    /**
     * Response XML
     * @var string
     */
    protected $_response;

    /**
     * Flag: whether or not {@link handle()} should return a response instead
     * of automatically emitting it.
     * @var boolean
     */
    protected $_returnResponse = false;

    /**
     * SOAP version to use; SOAP_1_2 by default, to allow processing of headers
     * @var int
     */
    protected $_soapVersion = SOAP_1_2;

    /**
     * URI or path to WSDL
     * @var string
     */
    protected $_wsdl;

    /**
     * URI namespace for SOAP server
     * @var string URI
     */
    protected $_uri;

    /**
     * Constructor
     *
     * Sets display_errors INI setting to off (prevent client errors due to bad
     * XML in response). Registers {@link handlePhpErrors()} as error handler
     * for E_USER_ERROR.
     *
     * If $wsdl is provided, it is passed on to {@link setWsdl()}; if any
     * options are specified, they are passed on to {@link setOptions()}.
     *
     * @param string $wsdl
     * @param array $options
     * @return void
     */
    public function __construct($wsdl = null, array $options = null)
    {
        if (!extension_loaded('soap')) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('SOAP extension is not loaded.');
        }

        if (null !== $wsdl) {
            $this->setWsdl($wsdl);
        }

        if (null !== $options) {
            $this->setOptions($options);
        }
    }

    /**
     * Set Options
     *
     * Allows setting options as an associative array of option => value pairs.
     *
     * @param  array|Zend_Config $options
     * @return Zend_Soap_Server
     */
    public function setOptions($options)
    {
        if($options instanceof Zend_Config) {
            $options = $options->toArray();
        }

        foreach ($options as $key => $value) {
            switch ($key) {
                case 'actor':
                    $this->setActor($value);
                    break;
                case 'classmap':
                case 'classMap':
                    $this->setClassmap($value);
                    break;
                case 'encoding':
                    $this->setEncoding($value);
                    break;
                case 'soapVersion':
                case 'soap_version':
                    $this->setSoapVersion($value);
                    break;
                case 'uri':
                    $this->setUri($value);
                    break;
                case 'wsdl':
                    $this->setWsdl($value);
                    break;
                case 'featues':
                    trigger_error(__METHOD__ . ': the option "featues" is deprecated as of 1.10.x and will be removed with 2.0.0; use "features" instead', E_USER_NOTICE);
                case 'features':
                    $this->setSoapFeatures($value);
                    break;
                case 'cache_wsdl':
                    $this->setWsdlCache($value);
                    break;
                case 'wsi_compliant':
                    $this->setWsiCompliant($value);
                    break;
                default:
                    break;
            }
        }

        return $this;
    }

    /**
     * Return array of options suitable for using with SoapServer constructor
     *
     * @return array
     */
    public function getOptions()
    {
        $options = array();
        if (null !== $this->_actor) {
            $options['actor'] = $this->_actor;
        }

        if (null !== $this->_classmap) {
            $options['classmap'] = $this->_classmap;
        }

        if (null !== $this->_encoding) {
            $options['encoding'] = $this->_encoding;
        }

        if (null !== $this->_soapVersion) {
            $options['soap_version'] = $this->_soapVersion;
        }

        if (null !== $this->_uri) {
            $options['uri'] = $this->_uri;
        }

        if (null !== $this->_features) {
            $options['features'] = $this->_features;
        }

        if (null !== $this->_wsdlCache) {
            $options['cache_wsdl'] = $this->_wsdlCache;
        }

        if (null !== $this->_wsiCompliant) {
            $options['wsi_compliant'] = $this->_wsiCompliant;
        }

        return $options;
    }
    /**
     * Set WS-I compliant
     *
     * @param  boolean $value
     * @return Zend_Soap_Server
     */
    public function setWsiCompliant($value)
    {
        if (is_bool($value)) {
            $this->_wsiCompliant = $value;
        }
        return $this;
    }
    /**
     * Gt WS-I compliant
     *
     * @return boolean
     */
    public function getWsiCompliant()
    {
        return $this->_wsiCompliant;
    }
    /**
     * Set encoding
     *
     * @param  string $encoding
     * @return Zend_Soap_Server
     * @throws Zend_Soap_Server_Exception with invalid encoding argument
     */
    public function setEncoding($encoding)
    {
        if (!is_string($encoding)) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid encoding specified');
        }

        $this->_encoding = $encoding;
        return $this;
    }

    /**
     * Get encoding
     *
     * @return string
     */
    public function getEncoding()
    {
        return $this->_encoding;
    }

    /**
     * Set SOAP version
     *
     * @param  int $version One of the SOAP_1_1 or SOAP_1_2 constants
     * @return Zend_Soap_Server
     * @throws Zend_Soap_Server_Exception with invalid soap version argument
     */
    public function setSoapVersion($version)
    {
        if (!in_array($version, array(SOAP_1_1, SOAP_1_2))) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid soap version specified');
        }

        $this->_soapVersion = $version;
        return $this;
    }

    /**
     * Get SOAP version
     *
     * @return int
     */
    public function getSoapVersion()
    {
        return $this->_soapVersion;
    }

    /**
     * Check for valid URN
     *
     * @param  string $urn
     * @return true
     * @throws Zend_Soap_Server_Exception on invalid URN
     */
    public function validateUrn($urn)
    {
        $scheme = parse_url($urn, PHP_URL_SCHEME);
        if ($scheme === false || $scheme === null) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid URN');
        }

        return true;
    }

    /**
     * Set actor
     *
     * Actor is the actor URI for the server.
     *
     * @param  string $actor
     * @return Zend_Soap_Server
     */
    public function setActor($actor)
    {
        $this->validateUrn($actor);
        $this->_actor = $actor;
        return $this;
    }

    /**
     * Retrieve actor
     *
     * @return string
     */
    public function getActor()
    {
        return $this->_actor;
    }

    /**
     * Set URI
     *
     * URI in SoapServer is actually the target namespace, not a URI; $uri must begin with 'urn:'.
     *
     * @param  string $uri
     * @return Zend_Soap_Server
     * @throws Zend_Soap_Server_Exception with invalid uri argument
     */
    public function setUri($uri)
    {
        $this->validateUrn($uri);
        $this->_uri = $uri;
        return $this;
    }

    /**
     * Retrieve URI
     *
     * @return string
     */
    public function getUri()
    {
        return $this->_uri;
    }

    /**
     * Set classmap
     *
     * @param  array $classmap
     * @return Zend_Soap_Server
     * @throws Zend_Soap_Server_Exception for any invalid class in the class map
     */
    public function setClassmap($classmap)
    {
        if (!is_array($classmap)) {
            /**
             * @see Zend_Soap_Server_Exception
             */
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Classmap must be an array');
        }
        foreach ($classmap as $type => $class) {
            if (!class_exists($class)) {
                /**
                 * @see Zend_Soap_Server_Exception
                 */
                #require_once 'Zend/Soap/Server/Exception.php';
                throw new Zend_Soap_Server_Exception('Invalid class in class map');
            }
        }

        $this->_classmap = $classmap;
        return $this;
    }

    /**
     * Retrieve classmap
     *
     * @return mixed
     */
    public function getClassmap()
    {
        return $this->_classmap;
    }

    /**
     * Set wsdl
     *
     * @param string $wsdl  URI or path to a WSDL
     * @return Zend_Soap_Server
     */
    public function setWsdl($wsdl)
    {
        $this->_wsdl = $wsdl;
        return $this;
    }

    /**
     * Retrieve wsdl
     *
     * @return string
     */
    public function getWsdl()
    {
        return $this->_wsdl;
    }

    /**
     * Set the SOAP Feature options.
     *
     * @param  string|int $feature
     * @return Zend_Soap_Server
     */
    public function setSoapFeatures($feature)
    {
        $this->_features = $feature;
        return $this;
    }

    /**
     * Return current SOAP Features options
     *
     * @return int
     */
    public function getSoapFeatures()
    {
        return $this->_features;
    }

    /**
     * Set the SOAP Wsdl Caching Options
     *
     * @param string|int|boolean $caching
     * @return Zend_Soap_Server
     */
    public function setWsdlCache($options)
    {
        $this->_wsdlCache = $options;
        return $this;
    }

    /**
     * Get current SOAP Wsdl Caching option
     */
    public function getWsdlCache()
    {
        return $this->_wsdlCache;
    }

    /**
     * Attach a function as a server method
     *
     * @param array|string $function Function name, array of function names to attach,
     * or SOAP_FUNCTIONS_ALL to attach all functions
     * @param  string $namespace Ignored
     * @return Zend_Soap_Server
     * @throws Zend_Soap_Server_Exception on invalid functions
     */
    public function addFunction($function, $namespace = '')
    {
        // Bail early if set to SOAP_FUNCTIONS_ALL
        if ($this->_functions == SOAP_FUNCTIONS_ALL) {
            return $this;
        }

        if (is_array($function)) {
            foreach ($function as $func) {
                if (is_string($func) && function_exists($func)) {
                    $this->_functions[] = $func;
                } else {
                    #require_once 'Zend/Soap/Server/Exception.php';
                    throw new Zend_Soap_Server_Exception('One or more invalid functions specified in array');
                }
            }
            $this->_functions = array_merge($this->_functions, $function);
        } elseif (is_string($function) && function_exists($function)) {
            $this->_functions[] = $function;
        } elseif ($function == SOAP_FUNCTIONS_ALL) {
            $this->_functions = SOAP_FUNCTIONS_ALL;
        } else {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid function specified');
        }

        if (is_array($this->_functions)) {
            $this->_functions = array_unique($this->_functions);
        }

        return $this;
    }

    /**
     * Attach a class to a server
     *
     * Accepts a class name to use when handling requests. Any additional
     * arguments will be passed to that class' constructor when instantiated.
     *
     * See {@link setObject()} to set preconfigured object instances as request handlers.
     *
     * @param string $class Class Name which executes SOAP Requests at endpoint.
     * @return Zend_Soap_Server
     * @throws Zend_Soap_Server_Exception if called more than once, or if class
     * does not exist
     */
    public function setClass($class, $namespace = '', $argv = null)
    {
        if (isset($this->_class)) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('A class has already been registered with this soap server instance');
        }

        if (!is_string($class)) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid class argument (' . gettype($class) . ')');
        }

        if (!class_exists($class)) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Class "' . $class . '" does not exist');
        }

        $this->_class = $class;
        if (1 < func_num_args()) {
            $argv = func_get_args();
            array_shift($argv);
            $this->_classArgs = $argv;
        }

        return $this;
    }

    /**
     * Attach an object to a server
     *
     * Accepts an instanciated object to use when handling requests.
     *
     * @param object $object
     * @return Zend_Soap_Server
     */
    public function setObject($object)
    {
        if(!is_object($object)) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid object argument ('.gettype($object).')');
        }

        if(isset($this->_object)) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('An object has already been registered with this soap server instance');
        }

        if ($this->_wsiCompliant) {
            #require_once 'Zend/Soap/Server/Proxy.php';
            $this->_object = new Zend_Soap_Server_Proxy($object);
        } else {
            $this->_object = $object;
        }

        return $this;
    }

    /**
     * Return a server definition array
     *
     * Returns a list of all functions registered with {@link addFunction()},
     * merged with all public methods of the class set with {@link setClass()}
     * (if any).
     *
     * @access public
     * @return array
     */
    public function getFunctions()
    {
        $functions = array();
        if (null !== $this->_class) {
            $functions = get_class_methods($this->_class);
        } elseif (null !== $this->_object) {
            $functions = get_class_methods($this->_object);
        }

        return array_merge((array) $this->_functions, $functions);
    }

    /**
     * Unimplemented: Load server definition
     *
     * @param array $array
     * @return void
     * @throws Zend_Soap_Server_Exception Unimplemented
     */
    public function loadFunctions($definition)
    {
        #require_once 'Zend/Soap/Server/Exception.php';
        throw new Zend_Soap_Server_Exception('Unimplemented');
    }

    /**
     * Set server persistence
     *
     * @param int $mode
     * @return Zend_Soap_Server
     */
    public function setPersistence($mode)
    {
        if (!in_array($mode, array(SOAP_PERSISTENCE_SESSION, SOAP_PERSISTENCE_REQUEST))) {
            #require_once 'Zend/Soap/Server/Exception.php';
            throw new Zend_Soap_Server_Exception('Invalid persistence mode specified');
        }

        $this->_persistence = $mode;
        return $this;
    }

    /**
     * Get server persistence
     *
     * @return Zend_Soap_Server
     */
    public function getPersistence()
    {
        return $this->_persistence;
    }

    /**
     * Set request
     *
     * $request may be any of:
     * - DOMDocument; if so, then cast to XML
     * - DOMNode; if so, then grab owner document and cast to XML
     * - SimpleXMLElement; if so, then cast to XML
     * - stdClass; if so, calls __toString() and verifies XML
     * - string; if so, verifies XML
     *
     * @param DOMDocument|DOMNode|SimpleXMLElement|stdClass|string $request
     * @return Zend_Soap_Server
     */
    protected function _setRequest($request)
    {
        if ($request instanceof DOMDocument) {
            $xml = $request->saveXML();
        } elseif ($request instanceof DOMNode) {
            $xml = $request->ownerDocument->saveXML();
        } elseif ($request instanceof SimpleXMLElement) {
            $xml = $request->asXML();
        } elseif (is_object($request) || is_string($request)) {
            if (is_object($request)) {
                $xml = $request->__toString();
            } else {
                $xml = $request;
            }

            $dom = new DOMDocument();
            try {
                if(strlen($xml) == 0 || (!$dom = Zend_Xml_Security::scan($xml, $dom))) {
                    #require_once 'Zend/Soap/Server/Exception.php';
                    throw new Zend_Soap_Server_Exception('Invalid XML');
                }
            } catch (Zend_Xml_Exception $e) {
                #require_once 'Zend/Soap/Server/Exception.php';
                throw new Zend_Soap_Server_Exception(
                    $e->getMessage()
                );
            }
        }
        $this->_request = $xml;
        return $this;
    }

    /**
     * Retrieve request XML
     *
     * @return string
     */
    public function getLastRequest()
    {
        return $this->_request;
    }

    /**
     * Set return response flag
     *
     * If true, {@link handle()} will return the response instead of
     * automatically sending it back to the requesting client.
     *
     * The response is always available via {@link getResponse()}.
     *
     * @param boolean $flag
     * @return Zend_Soap_Server
     */
    public function setReturnResponse($flag)
    {
        $this->_returnResponse = ($flag) ? true : false;
        return $this;
    }

    /**
     * Retrieve return response flag
     *
     * @return boolean
     */
    public function getReturnResponse()
    {
        return $this->_returnResponse;
    }

    /**
     * Get response XML
     *
     * @return string
     */
    public function getLastResponse()
    {
        return $this->_response;
    }

    /**
     * Get SoapServer object
     *
     * Uses {@link $_wsdl} and return value of {@link getOptions()} to instantiate
     * SoapServer object, and then registers any functions or class with it, as
     * well as peristence.
     *
     * @return SoapServer
     */
    protected function _getSoap()
    {
        $options = $this->getOptions();
        $server  = new SoapServer($this->_wsdl, $options);

        if (!empty($this->_functions)) {
            $server->addFunction($this->_functions);
        }

        if (!empty($this->_class)) {
            $args = $this->_classArgs;
            array_unshift($args, $this->_class);
            if ($this->_wsiCompliant) {
                #require_once 'Zend/Soap/Server/Proxy.php';
                array_unshift($args, 'Zend_Soap_Server_Proxy');
            }
            call_user_func_array(array($server, 'setClass'), $args);
        }

        if (!empty($this->_object)) {
            $server->setObject($this->_object);
        }

        if (null !== $this->_persistence) {
            $server->setPersistence($this->_persistence);
        }

        return $server;
    }

    /**
     * Handle a request
     *
     * Instantiates SoapServer object with options set in object, and
     * dispatches its handle() method.
     *
     * $request may be any of:
     * - DOMDocument; if so, then cast to XML
     * - DOMNode; if so, then grab owner document and cast to XML
     * - SimpleXMLElement; if so, then cast to XML
     * - stdClass; if so, calls __toString() and verifies XML
     * - string; if so, verifies XML
     *
     * If no request is passed, pulls request using php:://input (for
     * cross-platform compatability purposes).
     *
     * @param DOMDocument|DOMNode|SimpleXMLElement|stdClass|string $request Optional request
     * @return void|string
     */
    public function handle($request = null)
    {
        if (null === $request) {
            $request = file_get_contents('php://input');
        }

        // Set Zend_Soap_Server error handler
        $displayErrorsOriginalState = $this->_initializeSoapErrorContext();

        $setRequestException = null;
        /**
         * @see Zend_Soap_Server_Exception
         */
        #require_once 'Zend/Soap/Server/Exception.php';
        try {
            $this->_setRequest($request);
        } catch (Zend_Soap_Server_Exception $e) {
            $setRequestException = $e;
        }

        $soap = $this->_getSoap();

        $fault = false;
        ob_start();
        if ($setRequestException instanceof Exception) {
            // Create SOAP fault message if we've caught a request exception
            $fault = $this->fault($setRequestException->getMessage(), 'Sender');
        } else {
            try {
                $soap->handle($this->_request);
            } catch (Exception $e) {
                $fault = $this->fault($e);
            }
        }
        $this->_response = ob_get_clean();

        // Restore original error handler
        restore_error_handler();
        ini_set('display_errors', $displayErrorsOriginalState);

        // Send a fault, if we have one
        if ($fault) {
            $soap->fault($fault->faultcode, $fault->faultstring);
        }

        if (!$this->_returnResponse) {
            echo $this->_response;
            return;
        }

        return $this->_response;
    }

    /**
     * Method initalizes the error context that the SOAPServer enviroment will run in.
     *
     * @return boolean display_errors original value
     */
    protected function _initializeSoapErrorContext()
    {
        $displayErrorsOriginalState = ini_get('display_errors');
        ini_set('display_errors', false);
        set_error_handler(array($this, 'handlePhpErrors'), E_USER_ERROR);
        return $displayErrorsOriginalState;
    }

    /**
     * Register a valid fault exception
     *
     * @param  string|array $class Exception class or array of exception classes
     * @return Zend_Soap_Server
     */
    public function registerFaultException($class)
    {
        $this->_faultExceptions = array_merge($this->_faultExceptions, (array) $class);
        return $this;
    }

    /**
     * Deregister a fault exception from the fault exception stack
     *
     * @param  string $class
     * @return boolean
     */
    public function deregisterFaultException($class)
    {
        if (in_array($class, $this->_faultExceptions, true)) {
            $index = array_search($class, $this->_faultExceptions);
            unset($this->_faultExceptions[$index]);
            return true;
        }

        return false;
    }

    /**
     * Return fault exceptions list
     *
     * @return array
     */
    public function getFaultExceptions()
    {
        return $this->_faultExceptions;
    }

    /**
     * Generate a server fault
     *
     * Note that the arguments are reverse to those of SoapFault.
     *
     * If an exception is passed as the first argument, its message and code
     * will be used to create the fault object if it has been registered via
     * {@Link registerFaultException()}.
     *
     * @link   http://www.w3.org/TR/soap12-part1/#faultcodes
     * @param  string|Exception $fault
     * @param  string $code SOAP Fault Codes
     * @return SoapFault
     */
    public function fault($fault = null, $code = "Receiver")
    {
        if ($fault instanceof Exception) {
            $class = get_class($fault);
            if (in_array($class, $this->_faultExceptions)) {
                $message = $fault->getMessage();
                $eCode   = $fault->getCode();
                $code    = empty($eCode) ? $code : $eCode;
            } else {
                $message = 'Unknown error';
            }
        } elseif(is_string($fault)) {
            $message = $fault;
        } else {
            $message = 'Unknown error';
        }

        $allowedFaultModes = array(
            'VersionMismatch', 'MustUnderstand', 'DataEncodingUnknown',
            'Sender', 'Receiver', 'Server'
        );
        if(!in_array($code, $allowedFaultModes)) {
            $code = "Receiver";
        }

        return new SoapFault($code, $message);
    }

    /**
     * Throw PHP errors as SoapFaults
     *
     * @param int $errno
     * @param string $errstr
     * @param string $errfile
     * @param int $errline
     * @param array $errcontext
     * @return void
     * @throws SoapFault
     */
    public function handlePhpErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
    {
        throw $this->fault($errstr, "Receiver");
    }
}


text:
It is easy to include RKShowRoomModule in your [Scribite editors](https://github.com/zikula-modules/Scribite/).
RKShowRoomModule contains already the a popup for selecting show room items and other items.
Please note that Scribite 5.0+ is required for this.

To activate the popup for the editor of your choice (currently supported: CKEditor, TinyMCE)
you only need to add the plugin to the list of extra plugins in the editor configuration.

If such a configuration is not available for an editor check if the plugins for
RKShowRoomModule are in Scribite/plugins/EDITOR/vendor/plugins. If not then copy the directories from
    modules/RK/ShowRoomModule/Resources/docs//scribite/plugins into modules/Scribite/plugins.


text:
#ifndef ANDROID_GUI_CONFIG_H
#define ANDROID_GUI_CONFIG_H

#include <string>

namespace android {

// Append the libgui configuration details to configStr.
void appendGuiConfigString(std::string& configStr);

}; // namespace android

#endif /*ANDROID_GUI_CONFIG_H*/


text:
/* DO NOT EDIT!  -*- buffer-read-only: t -*- vi:set ro:  */
/* Instruction building/extraction support for or1k. -*- C -*-

   THIS FILE IS MACHINE GENERATED WITH CGEN: Cpu tools GENerator.
   - the resultant file is machine generated, cgen-ibld.in isn't

   Copyright (C) 1996-2019 Free Software Foundation, Inc.

   This file is part of libopcodes.

   This library is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.

   It is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */

/* ??? Eventually more and more of this stuff can go to cpu-independent files.
   Keep that in mind.  */

#include "sysdep.h"
#include <stdio.h>
#include "ansidecl.h"
#include "dis-asm.h"
#include "bfd.h"
#include "symcat.h"
#include "or1k-desc.h"
#include "or1k-opc.h"
#include "cgen/basic-modes.h"
#include "opintl.h"
#include "safe-ctype.h"

#undef  min
#define min(a,b) ((a) < (b) ? (a) : (b))
#undef  max
#define max(a,b) ((a) > (b) ? (a) : (b))

/* Used by the ifield rtx function.  */
#define FLD(f) (fields->f)

static const char * insert_normal
  (CGEN_CPU_DESC, long, unsigned int, unsigned int, unsigned int,
   unsigned int, unsigned int, unsigned int, CGEN_INSN_BYTES_PTR);
static const char * insert_insn_normal
  (CGEN_CPU_DESC, const CGEN_INSN *,
   CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);
static int extract_normal
  (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, CGEN_INSN_INT,
   unsigned int, unsigned int, unsigned int, unsigned int,
   unsigned int, unsigned int, bfd_vma, long *);
static int extract_insn_normal
  (CGEN_CPU_DESC, const CGEN_INSN *, CGEN_EXTRACT_INFO *,
   CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);
#if CGEN_INT_INSN_P
static void put_insn_int_value
  (CGEN_CPU_DESC, CGEN_INSN_BYTES_PTR, int, int, CGEN_INSN_INT);
#endif
#if ! CGEN_INT_INSN_P
static CGEN_INLINE void insert_1
  (CGEN_CPU_DESC, unsigned long, int, int, int, unsigned char *);
static CGEN_INLINE int fill_cache
  (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *,  int, int, bfd_vma);
static CGEN_INLINE long extract_1
  (CGEN_CPU_DESC, CGEN_EXTRACT_INFO *, int, int, int, unsigned char *, bfd_vma);
#endif

/* Operand insertion.  */

#if ! CGEN_INT_INSN_P

/* Subroutine of insert_normal.  */

static CGEN_INLINE void
insert_1 (CGEN_CPU_DESC cd,
	  unsigned long value,
	  int start,
	  int length,
	  int word_length,
	  unsigned char *bufp)
{
  unsigned long x,mask;
  int shift;

  x = cgen_get_insn_value (cd, bufp, word_length);

  /* Written this way to avoid undefined behaviour.  */
  mask = (((1L << (length - 1)) - 1) << 1) | 1;
  if (CGEN_INSN_LSB0_P)
    shift = (start + 1) - length;
  else
    shift = (word_length - (start + length));
  x = (x & ~(mask << shift)) | ((value & mask) << shift);

  cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x);
}

#endif /* ! CGEN_INT_INSN_P */

/* Default insertion routine.

   ATTRS is a mask of the boolean attributes.
   WORD_OFFSET is the offset in bits from the start of the insn of the value.
   WORD_LENGTH is the length of the word in bits in which the value resides.
   START is the starting bit number in the word, architecture origin.
   LENGTH is the length of VALUE in bits.
   TOTAL_LENGTH is the total length of the insn in bits.

   The result is an error message or NULL if success.  */

/* ??? This duplicates functionality with bfd's howto table and
   bfd_install_relocation.  */
/* ??? This doesn't handle bfd_vma's.  Create another function when
   necessary.  */

static const char *
insert_normal (CGEN_CPU_DESC cd,
	       long value,
	       unsigned int attrs,
	       unsigned int word_offset,
	       unsigned int start,
	       unsigned int length,
	       unsigned int word_length,
	       unsigned int total_length,
	       CGEN_INSN_BYTES_PTR buffer)
{
  static char errbuf[100];
  /* Written this way to avoid undefined behaviour.  */
  unsigned long mask = (((1L << (length - 1)) - 1) << 1) | 1;

  /* If LENGTH is zero, this operand doesn't contribute to the value.  */
  if (length == 0)
    return NULL;

  if (word_length > 8 * sizeof (CGEN_INSN_INT))
    abort ();

  /* For architectures with insns smaller than the base-insn-bitsize,
     word_length may be too big.  */
  if (cd->min_insn_bitsize < cd->base_insn_bitsize)
    {
      if (word_offset == 0
	  && word_length > total_length)
	word_length = total_length;
    }

  /* Ensure VALUE will fit.  */
  if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
    {
      long minval = - (1L << (length - 1));
      unsigned long maxval = mask;

      if ((value > 0 && (unsigned long) value > maxval)
	  || value < minval)
	{
	  /* xgettext:c-format */
	  sprintf (errbuf,
		   _("operand out of range (%ld not between %ld and %lu)"),
		   value, minval, maxval);
	  return errbuf;
	}
    }
  else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
    {
      unsigned long maxval = mask;
      unsigned long val = (unsigned long) value;

      /* For hosts with a word size > 32 check to see if value has been sign
	 extended beyond 32 bits.  If so then ignore these higher sign bits
	 as the user is attempting to store a 32-bit signed value into an
	 unsigned 32-bit field which is allowed.  */
      if (sizeof (unsigned long) > 4 && ((value >> 32) == -1))
	val &= 0xFFFFFFFF;

      if (val > maxval)
	{
	  /* xgettext:c-format */
	  sprintf (errbuf,
		   _("operand out of range (0x%lx not between 0 and 0x%lx)"),
		   val, maxval);
	  return errbuf;
	}
    }
  else
    {
      if (! cgen_signed_overflow_ok_p (cd))
	{
	  long minval = - (1L << (length - 1));
	  long maxval =   (1L << (length - 1)) - 1;

	  if (value < minval || value > maxval)
	    {
	      sprintf
		/* xgettext:c-format */
		(errbuf, _("operand out of range (%ld not between %ld and %ld)"),
		 value, minval, maxval);
	      return errbuf;
	    }
	}
    }

#if CGEN_INT_INSN_P

  {
    int shift_within_word, shift_to_word, shift;

    /* How to shift the value to BIT0 of the word.  */
    shift_to_word = total_length - (word_offset + word_length);

    /* How to shift the value to the field within the word.  */
    if (CGEN_INSN_LSB0_P)
      shift_within_word = start + 1 - length;
    else
      shift_within_word = word_length - start - length;

    /* The total SHIFT, then mask in the value.  */
    shift = shift_to_word + shift_within_word;
    *buffer = (*buffer & ~(mask << shift)) | ((value & mask) << shift);
  }

#else /* ! CGEN_INT_INSN_P */

  {
    unsigned char *bufp = (unsigned char *) buffer + word_offset / 8;

    insert_1 (cd, value, start, length, word_length, bufp);
  }

#endif /* ! CGEN_INT_INSN_P */

  return NULL;
}

/* Default insn builder (insert handler).
   The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
   that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
   recorded in host byte order, otherwise BUFFER is an array of bytes
   and the value is recorded in target byte order).
   The result is an error message or NULL if success.  */

static const char *
insert_insn_normal (CGEN_CPU_DESC cd,
		    const CGEN_INSN * insn,
		    CGEN_FIELDS * fields,
		    CGEN_INSN_BYTES_PTR buffer,
		    bfd_vma pc)
{
  const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
  unsigned long value;
  const CGEN_SYNTAX_CHAR_TYPE * syn;

  CGEN_INIT_INSERT (cd);
  value = CGEN_INSN_BASE_VALUE (insn);

  /* If we're recording insns as numbers (rather than a string of bytes),
     target byte order handling is deferred until later.  */

#if CGEN_INT_INSN_P

  put_insn_int_value (cd, buffer, cd->base_insn_bitsize,
		      CGEN_FIELDS_BITSIZE (fields), value);

#else

  cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize,
					(unsigned) CGEN_FIELDS_BITSIZE (fields)),
		       value);

#endif /* ! CGEN_INT_INSN_P */

  /* ??? It would be better to scan the format's fields.
     Still need to be able to insert a value based on the operand though;
     e.g. storing a branch displacement that got resolved later.
     Needs more thought first.  */

  for (syn = CGEN_SYNTAX_STRING (syntax); * syn; ++ syn)
    {
      const char *errmsg;

      if (CGEN_SYNTAX_CHAR_P (* syn))
	continue;

      errmsg = (* cd->insert_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
				       fields, buffer, pc);
      if (errmsg)
	return errmsg;
    }

  return NULL;
}

#if CGEN_INT_INSN_P
/* Cover function to store an insn value into an integral insn.  Must go here
   because it needs <prefix>-desc.h for CGEN_INT_INSN_P.  */

static void
put_insn_int_value (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
		    CGEN_INSN_BYTES_PTR buf,
		    int length,
		    int insn_length,
		    CGEN_INSN_INT value)
{
  /* For architectures with insns smaller than the base-insn-bitsize,
     length may be too big.  */
  if (length > insn_length)
    *buf = value;
  else
    {
      int shift = insn_length - length;
      /* Written this way to avoid undefined behaviour.  */
      CGEN_INSN_INT mask = (((1L << (length - 1)) - 1) << 1) | 1;

      *buf = (*buf & ~(mask << shift)) | ((value & mask) << shift);
    }
}
#endif

/* Operand extraction.  */

#if ! CGEN_INT_INSN_P

/* Subroutine of extract_normal.
   Ensure sufficient bytes are cached in EX_INFO.
   OFFSET is the offset in bytes from the start of the insn of the value.
   BYTES is the length of the needed value.
   Returns 1 for success, 0 for failure.  */

static CGEN_INLINE int
fill_cache (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
	    CGEN_EXTRACT_INFO *ex_info,
	    int offset,
	    int bytes,
	    bfd_vma pc)
{
  /* It's doubtful that the middle part has already been fetched so
     we don't optimize that case.  kiss.  */
  unsigned int mask;
  disassemble_info *info = (disassemble_info *) ex_info->dis_info;

  /* First do a quick check.  */
  mask = (1 << bytes) - 1;
  if (((ex_info->valid >> offset) & mask) == mask)
    return 1;

  /* Search for the first byte we need to read.  */
  for (mask = 1 << offset; bytes > 0; --bytes, ++offset, mask <<= 1)
    if (! (mask & ex_info->valid))
      break;

  if (bytes)
    {
      int status;

      pc += offset;
      status = (*info->read_memory_func)
	(pc, ex_info->insn_bytes + offset, bytes, info);

      if (status != 0)
	{
	  (*info->memory_error_func) (status, pc, info);
	  return 0;
	}

      ex_info->valid |= ((1 << bytes) - 1) << offset;
    }

  return 1;
}

/* Subroutine of extract_normal.  */

static CGEN_INLINE long
extract_1 (CGEN_CPU_DESC cd,
	   CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
	   int start,
	   int length,
	   int word_length,
	   unsigned char *bufp,
	   bfd_vma pc ATTRIBUTE_UNUSED)
{
  unsigned long x;
  int shift;

  x = cgen_get_insn_value (cd, bufp, word_length);

  if (CGEN_INSN_LSB0_P)
    shift = (start + 1) - length;
  else
    shift = (word_length - (start + length));
  return x >> shift;
}

#endif /* ! CGEN_INT_INSN_P */

/* Default extraction routine.

   INSN_VALUE is the first base_insn_bitsize bits of the insn in host order,
   or sometimes less for cases like the m32r where the base insn size is 32
   but some insns are 16 bits.
   ATTRS is a mask of the boolean attributes.  We only need `SIGNED',
   but for generality we take a bitmask of all of them.
   WORD_OFFSET is the offset in bits from the start of the insn of the value.
   WORD_LENGTH is the length of the word in bits in which the value resides.
   START is the starting bit number in the word, architecture origin.
   LENGTH is the length of VALUE in bits.
   TOTAL_LENGTH is the total length of the insn in bits.

   Returns 1 for success, 0 for failure.  */

/* ??? The return code isn't properly used.  wip.  */

/* ??? This doesn't handle bfd_vma's.  Create another function when
   necessary.  */

static int
extract_normal (CGEN_CPU_DESC cd,
#if ! CGEN_INT_INSN_P
		CGEN_EXTRACT_INFO *ex_info,
#else
		CGEN_EXTRACT_INFO *ex_info ATTRIBUTE_UNUSED,
#endif
		CGEN_INSN_INT insn_value,
		unsigned int attrs,
		unsigned int word_offset,
		unsigned int start,
		unsigned int length,
		unsigned int word_length,
		unsigned int total_length,
#if ! CGEN_INT_INSN_P
		bfd_vma pc,
#else
		bfd_vma pc ATTRIBUTE_UNUSED,
#endif
		long *valuep)
{
  long value, mask;

  /* If LENGTH is zero, this operand doesn't contribute to the value
     so give it a standard value of zero.  */
  if (length == 0)
    {
      *valuep = 0;
      return 1;
    }

  if (word_length > 8 * sizeof (CGEN_INSN_INT))
    abort ();

  /* For architectures with insns smaller than the insn-base-bitsize,
     word_length may be too big.  */
  if (cd->min_insn_bitsize < cd->base_insn_bitsize)
    {
      if (word_offset + word_length > total_length)
	word_length = total_length - word_offset;
    }

  /* Does the value reside in INSN_VALUE, and at the right alignment?  */

  if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
    {
      if (CGEN_INSN_LSB0_P)
	value = insn_value >> ((word_offset + start + 1) - length);
      else
	value = insn_value >> (total_length - ( word_offset + start + length));
    }

#if ! CGEN_INT_INSN_P

  else
    {
      unsigned char *bufp = ex_info->insn_bytes + word_offset / 8;

      if (word_length > 8 * sizeof (CGEN_INSN_INT))
	abort ();

      if (fill_cache (cd, ex_info, word_offset / 8, word_length / 8, pc) == 0)
	return 0;

      value = extract_1 (cd, ex_info, start, length, word_length, bufp, pc);
    }

#endif /* ! CGEN_INT_INSN_P */

  /* Written this way to avoid undefined behaviour.  */
  mask = (((1L << (length - 1)) - 1) << 1) | 1;

  value &= mask;
  /* sign extend? */
  if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED)
      && (value & (1L << (length - 1))))
    value |= ~mask;

  *valuep = value;

  return 1;
}

/* Default insn extractor.

   INSN_VALUE is the first base_insn_bitsize bits, translated to host order.
   The extracted fields are stored in FIELDS.
   EX_INFO is used to handle reading variable length insns.
   Return the length of the insn in bits, or 0 if no match,
   or -1 if an error occurs fetching data (memory_error_func will have
   been called).  */

static int
extract_insn_normal (CGEN_CPU_DESC cd,
		     const CGEN_INSN *insn,
		     CGEN_EXTRACT_INFO *ex_info,
		     CGEN_INSN_INT insn_value,
		     CGEN_FIELDS *fields,
		     bfd_vma pc)
{
  const CGEN_SYNTAX *syntax = CGEN_INSN_SYNTAX (insn);
  const CGEN_SYNTAX_CHAR_TYPE *syn;

  CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn);

  CGEN_INIT_EXTRACT (cd);

  for (syn = CGEN_SYNTAX_STRING (syntax); *syn; ++syn)
    {
      int length;

      if (CGEN_SYNTAX_CHAR_P (*syn))
	continue;

      length = (* cd->extract_operand) (cd, CGEN_SYNTAX_FIELD (*syn),
					ex_info, insn_value, fields, pc);
      if (length <= 0)
	return length;
    }

  /* We recognized and successfully extracted this insn.  */
  return CGEN_INSN_BITSIZE (insn);
}

/* Machine generated code added here.  */

const char * or1k_cgen_insert_operand
  (CGEN_CPU_DESC, int, CGEN_FIELDS *, CGEN_INSN_BYTES_PTR, bfd_vma);

/* Main entry point for operand insertion.

   This function is basically just a big switch statement.  Earlier versions
   used tables to look up the function to use, but
   - if the table contains both assembler and disassembler functions then
     the disassembler contains much of the assembler and vice-versa,
   - there's a lot of inlining possibilities as things grow,
   - using a switch statement avoids the function call overhead.

   This function could be moved into `parse_insn_normal', but keeping it
   separate makes clear the interface between `parse_insn_normal' and each of
   the handlers.  It's also needed by GAS to insert operands that couldn't be
   resolved during parsing.  */

const char *
or1k_cgen_insert_operand (CGEN_CPU_DESC cd,
			     int opindex,
			     CGEN_FIELDS * fields,
			     CGEN_INSN_BYTES_PTR buffer,
			     bfd_vma pc ATTRIBUTE_UNUSED)
{
  const char * errmsg = NULL;
  unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);

  switch (opindex)
    {
    case OR1K_OPERAND_DISP21 :
      {
        long value = fields->f_disp21;
        value = ((((DI) (value) >> (13))) - (((DI) (pc) >> (13))));
        errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_ABS_ADDR), 0, 20, 21, 32, total_length, buffer);
      }
      break;
    case OR1K_OPERAND_DISP26 :
      {
        long value = fields->f_disp26;
        value = ((DI) (((value) - (pc))) >> (2));
        errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 25, 26, 32, total_length, buffer);
      }
      break;
    case OR1K_OPERAND_RA :
      errmsg = insert_normal (cd, fields->f_r2, 0, 0, 20, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RADF :
      errmsg = insert_normal (cd, fields->f_r1, 0, 0, 25, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RASF :
      errmsg = insert_normal (cd, fields->f_r2, 0, 0, 20, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RB :
      errmsg = insert_normal (cd, fields->f_r3, 0, 0, 15, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RBDF :
      errmsg = insert_normal (cd, fields->f_r1, 0, 0, 25, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RBSF :
      errmsg = insert_normal (cd, fields->f_r3, 0, 0, 15, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RD :
      errmsg = insert_normal (cd, fields->f_r1, 0, 0, 25, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RDDF :
      errmsg = insert_normal (cd, fields->f_r1, 0, 0, 25, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_RDSF :
      errmsg = insert_normal (cd, fields->f_r1, 0, 0, 25, 5, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_SIMM16 :
      errmsg = insert_normal (cd, fields->f_simm16, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_SIGN_OPT), 0, 15, 16, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_SIMM16_SPLIT :
      {
{
  FLD (f_imm16_25_5) = ((((INT) (FLD (f_simm16_split)) >> (11))) & (31));
  FLD (f_imm16_10_11) = ((FLD (f_simm16_split)) & (2047));
}
        errmsg = insert_normal (cd, fields->f_imm16_25_5, 0, 0, 25, 5, 32, total_length, buffer);
        if (errmsg)
          break;
        errmsg = insert_normal (cd, fields->f_imm16_10_11, 0, 0, 10, 11, 32, total_length, buffer);
        if (errmsg)
          break;
      }
      break;
    case OR1K_OPERAND_UIMM16 :
      errmsg = insert_normal (cd, fields->f_uimm16, 0, 0, 15, 16, 32, total_length, buffer);
      break;
    case OR1K_OPERAND_UIMM16_SPLIT :
      {
{
  FLD (f_imm16_25_5) = ((((UINT) (FLD (f_uimm16_split)) >> (11))) & (31));
  FLD (f_imm16_10_11) = ((FLD (f_uimm16_split)) & (2047));
}
        errmsg = insert_normal (cd, fields->f_imm16_25_5, 0, 0, 25, 5, 32, total_length, buffer);
        if (errmsg)
          break;
        errmsg = insert_normal (cd, fields->f_imm16_10_11, 0, 0, 10, 11, 32, total_length, buffer);
        if (errmsg)
          break;
      }
      break;
    case OR1K_OPERAND_UIMM6 :
      errmsg = insert_normal (cd, fields->f_uimm6, 0, 0, 5, 6, 32, total_length, buffer);
      break;

    default :
      /* xgettext:c-format */
      opcodes_error_handler
	(_("internal error: unrecognized field %d while building insn"),
	 opindex);
      abort ();
  }

  return errmsg;
}

int or1k_cgen_extract_operand
  (CGEN_CPU_DESC, int, CGEN_EXTRACT_INFO *, CGEN_INSN_INT, CGEN_FIELDS *, bfd_vma);

/* Main entry point for operand extraction.
   The result is <= 0 for error, >0 for success.
   ??? Actual values aren't well defined right now.

   This function is basically just a big switch statement.  Earlier versions
   used tables to look up the function to use, but
   - if the table contains both assembler and disassembler functions then
     the disassembler contains much of the assembler and vice-versa,
   - there's a lot of inlining possibilities as things grow,
   - using a switch statement avoids the function call overhead.

   This function could be moved into `print_insn_normal', but keeping it
   separate makes clear the interface between `print_insn_normal' and each of
   the handlers.  */

int
or1k_cgen_extract_operand (CGEN_CPU_DESC cd,
			     int opindex,
			     CGEN_EXTRACT_INFO *ex_info,
			     CGEN_INSN_INT insn_value,
			     CGEN_FIELDS * fields,
			     bfd_vma pc)
{
  /* Assume success (for those operands that are nops).  */
  int length = 1;
  unsigned int total_length = CGEN_FIELDS_BITSIZE (fields);

  switch (opindex)
    {
    case OR1K_OPERAND_DISP21 :
      {
        long value;
        length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_ABS_ADDR), 0, 20, 21, 32, total_length, pc, & value);
        value = ((((value) + (((DI) (pc) >> (13))))) << (13));
        fields->f_disp21 = value;
      }
      break;
    case OR1K_OPERAND_DISP26 :
      {
        long value;
        length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 25, 26, 32, total_length, pc, & value);
        value = ((((value) << (2))) + (pc));
        fields->f_disp26 = value;
      }
      break;
    case OR1K_OPERAND_RA :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 5, 32, total_length, pc, & fields->f_r2);
      break;
    case OR1K_OPERAND_RADF :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_r1);
      break;
    case OR1K_OPERAND_RASF :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 20, 5, 32, total_length, pc, & fields->f_r2);
      break;
    case OR1K_OPERAND_RB :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 5, 32, total_length, pc, & fields->f_r3);
      break;
    case OR1K_OPERAND_RBDF :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_r1);
      break;
    case OR1K_OPERAND_RBSF :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 5, 32, total_length, pc, & fields->f_r3);
      break;
    case OR1K_OPERAND_RD :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_r1);
      break;
    case OR1K_OPERAND_RDDF :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_r1);
      break;
    case OR1K_OPERAND_RDSF :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_r1);
      break;
    case OR1K_OPERAND_SIMM16 :
      length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_SIGN_OPT), 0, 15, 16, 32, total_length, pc, & fields->f_simm16);
      break;
    case OR1K_OPERAND_SIMM16_SPLIT :
      {
        length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_imm16_25_5);
        if (length <= 0) break;
        length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 11, 32, total_length, pc, & fields->f_imm16_10_11);
        if (length <= 0) break;
  FLD (f_simm16_split) = ((HI) (UINT) (((((FLD (f_imm16_25_5)) << (11))) | (FLD (f_imm16_10_11)))));
      }
      break;
    case OR1K_OPERAND_UIMM16 :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 15, 16, 32, total_length, pc, & fields->f_uimm16);
      break;
    case OR1K_OPERAND_UIMM16_SPLIT :
      {
        length = extract_normal (cd, ex_info, insn_value, 0, 0, 25, 5, 32, total_length, pc, & fields->f_imm16_25_5);
        if (length <= 0) break;
        length = extract_normal (cd, ex_info, insn_value, 0, 0, 10, 11, 32, total_length, pc, & fields->f_imm16_10_11);
        if (length <= 0) break;
  FLD (f_uimm16_split) = ((UHI) (UINT) (((((FLD (f_imm16_25_5)) << (11))) | (FLD (f_imm16_10_11)))));
      }
      break;
    case OR1K_OPERAND_UIMM6 :
      length = extract_normal (cd, ex_info, insn_value, 0, 0, 5, 6, 32, total_length, pc, & fields->f_uimm6);
      break;

    default :
      /* xgettext:c-format */
      opcodes_error_handler
	(_("internal error: unrecognized field %d while decoding insn"),
	 opindex);
      abort ();
    }

  return length;
}

cgen_insert_fn * const or1k_cgen_insert_handlers[] =
{
  insert_insn_normal,
};

cgen_extract_fn * const or1k_cgen_extract_handlers[] =
{
  extract_insn_normal,
};

int or1k_cgen_get_int_operand     (CGEN_CPU_DESC, int, const CGEN_FIELDS *);
bfd_vma or1k_cgen_get_vma_operand (CGEN_CPU_DESC, int, const CGEN_FIELDS *);

/* Getting values from cgen_fields is handled by a collection of functions.
   They are distinguished by the type of the VALUE argument they return.
   TODO: floating point, inlining support, remove cases where result type
   not appropriate.  */

int
or1k_cgen_get_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
			     int opindex,
			     const CGEN_FIELDS * fields)
{
  int value;

  switch (opindex)
    {
    case OR1K_OPERAND_DISP21 :
      value = fields->f_disp21;
      break;
    case OR1K_OPERAND_DISP26 :
      value = fields->f_disp26;
      break;
    case OR1K_OPERAND_RA :
      value = fields->f_r2;
      break;
    case OR1K_OPERAND_RADF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RASF :
      value = fields->f_r2;
      break;
    case OR1K_OPERAND_RB :
      value = fields->f_r3;
      break;
    case OR1K_OPERAND_RBDF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RBSF :
      value = fields->f_r3;
      break;
    case OR1K_OPERAND_RD :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RDDF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RDSF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_SIMM16 :
      value = fields->f_simm16;
      break;
    case OR1K_OPERAND_SIMM16_SPLIT :
      value = fields->f_simm16_split;
      break;
    case OR1K_OPERAND_UIMM16 :
      value = fields->f_uimm16;
      break;
    case OR1K_OPERAND_UIMM16_SPLIT :
      value = fields->f_uimm16_split;
      break;
    case OR1K_OPERAND_UIMM6 :
      value = fields->f_uimm6;
      break;

    default :
      /* xgettext:c-format */
      opcodes_error_handler
	(_("internal error: unrecognized field %d while getting int operand"),
	 opindex);
      abort ();
  }

  return value;
}

bfd_vma
or1k_cgen_get_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
			     int opindex,
			     const CGEN_FIELDS * fields)
{
  bfd_vma value;

  switch (opindex)
    {
    case OR1K_OPERAND_DISP21 :
      value = fields->f_disp21;
      break;
    case OR1K_OPERAND_DISP26 :
      value = fields->f_disp26;
      break;
    case OR1K_OPERAND_RA :
      value = fields->f_r2;
      break;
    case OR1K_OPERAND_RADF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RASF :
      value = fields->f_r2;
      break;
    case OR1K_OPERAND_RB :
      value = fields->f_r3;
      break;
    case OR1K_OPERAND_RBDF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RBSF :
      value = fields->f_r3;
      break;
    case OR1K_OPERAND_RD :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RDDF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_RDSF :
      value = fields->f_r1;
      break;
    case OR1K_OPERAND_SIMM16 :
      value = fields->f_simm16;
      break;
    case OR1K_OPERAND_SIMM16_SPLIT :
      value = fields->f_simm16_split;
      break;
    case OR1K_OPERAND_UIMM16 :
      value = fields->f_uimm16;
      break;
    case OR1K_OPERAND_UIMM16_SPLIT :
      value = fields->f_uimm16_split;
      break;
    case OR1K_OPERAND_UIMM6 :
      value = fields->f_uimm6;
      break;

    default :
      /* xgettext:c-format */
      opcodes_error_handler
	(_("internal error: unrecognized field %d while getting vma operand"),
	 opindex);
      abort ();
  }

  return value;
}

void or1k_cgen_set_int_operand  (CGEN_CPU_DESC, int, CGEN_FIELDS *, int);
void or1k_cgen_set_vma_operand  (CGEN_CPU_DESC, int, CGEN_FIELDS *, bfd_vma);

/* Stuffing values in cgen_fields is handled by a collection of functions.
   They are distinguished by the type of the VALUE argument they accept.
   TODO: floating point, inlining support, remove cases where argument type
   not appropriate.  */

void
or1k_cgen_set_int_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
			     int opindex,
			     CGEN_FIELDS * fields,
			     int value)
{
  switch (opindex)
    {
    case OR1K_OPERAND_DISP21 :
      fields->f_disp21 = value;
      break;
    case OR1K_OPERAND_DISP26 :
      fields->f_disp26 = value;
      break;
    case OR1K_OPERAND_RA :
      fields->f_r2 = value;
      break;
    case OR1K_OPERAND_RADF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RASF :
      fields->f_r2 = value;
      break;
    case OR1K_OPERAND_RB :
      fields->f_r3 = value;
      break;
    case OR1K_OPERAND_RBDF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RBSF :
      fields->f_r3 = value;
      break;
    case OR1K_OPERAND_RD :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RDDF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RDSF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_SIMM16 :
      fields->f_simm16 = value;
      break;
    case OR1K_OPERAND_SIMM16_SPLIT :
      fields->f_simm16_split = value;
      break;
    case OR1K_OPERAND_UIMM16 :
      fields->f_uimm16 = value;
      break;
    case OR1K_OPERAND_UIMM16_SPLIT :
      fields->f_uimm16_split = value;
      break;
    case OR1K_OPERAND_UIMM6 :
      fields->f_uimm6 = value;
      break;

    default :
      /* xgettext:c-format */
      opcodes_error_handler
	(_("internal error: unrecognized field %d while setting int operand"),
	 opindex);
      abort ();
  }
}

void
or1k_cgen_set_vma_operand (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
			     int opindex,
			     CGEN_FIELDS * fields,
			     bfd_vma value)
{
  switch (opindex)
    {
    case OR1K_OPERAND_DISP21 :
      fields->f_disp21 = value;
      break;
    case OR1K_OPERAND_DISP26 :
      fields->f_disp26 = value;
      break;
    case OR1K_OPERAND_RA :
      fields->f_r2 = value;
      break;
    case OR1K_OPERAND_RADF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RASF :
      fields->f_r2 = value;
      break;
    case OR1K_OPERAND_RB :
      fields->f_r3 = value;
      break;
    case OR1K_OPERAND_RBDF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RBSF :
      fields->f_r3 = value;
      break;
    case OR1K_OPERAND_RD :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RDDF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_RDSF :
      fields->f_r1 = value;
      break;
    case OR1K_OPERAND_SIMM16 :
      fields->f_simm16 = value;
      break;
    case OR1K_OPERAND_SIMM16_SPLIT :
      fields->f_simm16_split = value;
      break;
    case OR1K_OPERAND_UIMM16 :
      fields->f_uimm16 = value;
      break;
    case OR1K_OPERAND_UIMM16_SPLIT :
      fields->f_uimm16_split = value;
      break;
    case OR1K_OPERAND_UIMM6 :
      fields->f_uimm6 = value;
      break;

    default :
      /* xgettext:c-format */
      opcodes_error_handler
	(_("internal error: unrecognized field %d while setting vma operand"),
	 opindex);
      abort ();
  }
}

/* Function to call before using the instruction builder tables.  */

void
or1k_cgen_init_ibld_table (CGEN_CPU_DESC cd)
{
  cd->insert_handlers = & or1k_cgen_insert_handlers[0];
  cd->extract_handlers = & or1k_cgen_extract_handlers[0];

  cd->insert_operand = or1k_cgen_insert_operand;
  cd->extract_operand = or1k_cgen_extract_operand;

  cd->get_int_operand = or1k_cgen_get_int_operand;
  cd->set_int_operand = or1k_cgen_set_int_operand;
  cd->get_vma_operand = or1k_cgen_get_vma_operand;
  cd->set_vma_operand = or1k_cgen_set_vma_operand;
}