text:
package at.salzburgresearch.stanbol.enhancer.nlp.stanford.analyser;

import static org.apache.stanbol.enhancer.nlp.NlpAnnotations.MORPHO_ANNOTATION;
import static org.apache.stanbol.enhancer.nlp.NlpAnnotations.NER_ANNOTATION;
import static org.apache.stanbol.enhancer.nlp.NlpAnnotations.POS_ANNOTATION;
import static org.apache.stanbol.enhancer.nlp.NlpAnnotations.DEPENDENCY_ANNOTATION;
import static org.apache.stanbol.enhancer.nlp.NlpAnnotations.COREF_ANNOTATION;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;

import org.apache.stanbol.enhancer.nlp.coref.CorefFeature;
import org.apache.stanbol.enhancer.nlp.dependency.DependencyRelation;
import org.apache.stanbol.enhancer.nlp.dependency.GrammaticalRelationTag;
import org.apache.stanbol.enhancer.nlp.model.AnalysedText;
import org.apache.stanbol.enhancer.nlp.model.AnalysedTextFactory;
import org.apache.stanbol.enhancer.nlp.model.Chunk;
import org.apache.stanbol.enhancer.nlp.model.Span;
import org.apache.stanbol.enhancer.nlp.model.Token;
import org.apache.stanbol.enhancer.nlp.model.annotation.Value;
import org.apache.stanbol.enhancer.nlp.model.tag.TagSet;
import org.apache.stanbol.enhancer.nlp.morpho.MorphoFeatures;
import org.apache.stanbol.enhancer.nlp.ner.NerTag;
import org.apache.stanbol.enhancer.nlp.pos.PosTag;
import org.apache.stanbol.enhancer.servicesapi.Blob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import at.salzburgresearch.stanbol.enhancer.nlp.stanford.mappings.TagSetRegistry;
import edu.stanford.nlp.dcoref.CorefChain;
import edu.stanford.nlp.dcoref.CorefChain.CorefMention;
import edu.stanford.nlp.dcoref.CorefCoreAnnotations.CorefChainAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.LemmaAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.NamedEntityTagAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.PartOfSpeechAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation;
import edu.stanford.nlp.ling.CoreAnnotations.TokensAnnotation;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.IndexedWord;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.AnnotationPipeline;
import edu.stanford.nlp.semgraph.SemanticGraph;
import edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations.BasicDependenciesAnnotation;
import edu.stanford.nlp.semgraph.SemanticGraphEdge;
import edu.stanford.nlp.trees.GrammaticalRelation;
import edu.stanford.nlp.util.CoreMap;

public class StanfordNlpAnalyzer {

    private static final Logger log = LoggerFactory.getLogger(StanfordNlpAnalyzer.class);

    protected final AnalysedTextFactory analysedTextFactory;
    private final ExecutorService executor;

    private TagSetRegistry tagSetRegistry;

    private final Map<String,AnnotationPipeline> pipelines = new HashMap<String,AnnotationPipeline>();
    private Collection<String> supported = Collections.emptyList();

    public StanfordNlpAnalyzer(ExecutorService executor, AnalysedTextFactory atf) {
        this.executor = executor;
        this.analysedTextFactory = atf == null ? AnalysedTextFactory.getDefaultInstance() : atf;
        this.tagSetRegistry = TagSetRegistry.getInstance();
    }
    /**
     * Sets the {@link AnnotationPipeline} for a language
     * @param language the language
     * @param pipeline the pipeline
     * @return the old pipeline for this language or null if none
     */
    public AnnotationPipeline setPipeline(String language, AnnotationPipeline pipeline){
        if(language == null || language.isEmpty()){
            throw new IllegalArgumentException("The parsed language MUST NOT be NULL nor empty!");
        }
        if(pipeline == null){
            throw new IllegalArgumentException("The parsed annotation pipeline MUST NOT be NULL!");
        }
        AnnotationPipeline old = pipelines.put(language.toLowerCase(Locale.ROOT), pipeline);
        if(old == null){
            List<String> supported = new ArrayList<String>(pipelines.keySet());
            Collections.sort(supported);
            this.supported = Collections.unmodifiableCollection(supported);
        } //language was already present ... no need to update supported
        return old;
    }
    /**
     * Getter for the Pipeline of a specific language
     * @param lang the language
     * @return the pipeline or null if the parsed language is not
     * supported
     */
    public AnnotationPipeline getPipeline(String lang){
        return pipelines.get(lang);
    }
    /**
     * Checks if the parsed language is supported by this Analyzer
     * @param language the language
     * @return true it texts in the parsed language are supported.
     */
    public boolean isSupported(String language){
        return pipelines.containsKey(language.toLowerCase(Locale.ROOT));
    }
    /**
     * A alphabetical sorted list of supported languages intended to be used
     * for logging.

     * NOTE: This method is not indented to be used to check if a
     * language is supported. Users should use {@link #isSupported(String)} for
     * that.
     * @return an alphabetical sorted list of supported languages
     */
    public Collection<String> getSupported(){
        return supported;
    }

    public AnalysedText analyse(String lang, Blob blob) throws IOException {
        if(lang == null || lang.isEmpty()){
            throw new IllegalStateException("The parsed Language MUST NOT be NULL nor empty!");
        }
        lang = lang.toLowerCase(Locale.ROOT); //languages are case insensitive
        if(blob == null){
            throw new IllegalStateException("The parsed Blob MUST NOT be NULL!");
        }
        final AnnotationPipeline pipeline = pipelines.get(lang);
        if(pipeline == null){
            throw new IllegalArgumentException("The parsed language '" + lang
                + "'is not supported (supported: " + supported+ ")!");
        }
        // create an empty Annotation just with the given text
        final AnalysedText at = analysedTextFactory.createAnalysedText(blob);
        TagSet<PosTag> posTagSet = tagSetRegistry.getPosTagSet(lang);
        Map<String,PosTag> adhocPosTags = tagSetRegistry.getAdhocPosTagMap(lang);
        TagSet<NerTag> nerTagSet = tagSetRegistry.getNerTagSet(lang);
        Map<String,NerTag> adhocNerTags = tagSetRegistry.getAdhocNerTagMap(lang);
        TagSet<GrammaticalRelationTag> gramRelationTagSet =
            tagSetRegistry.getGrammaticalRelationTagSet(lang);
        // run all Annotators on this text
        Annotation document;
        try { //process the text using the executor service
            document = executor.submit(new Callable<Annotation>() {

                @Override
                public Annotation call() throws Exception {
                    Annotation document = new Annotation(at.getSpan());
                    pipeline.annotate(document);
                    return document;
                }

            }).get(); //and wait for the results
        } catch (InterruptedException e) {
            throw new IllegalStateException("Interupped while processing text",e);
        } catch (ExecutionException e) {
            Throwable cause = e.getCause();
            throw new IllegalStateException(cause.getClass().getSimpleName() +
                "Exception while procesing an '"+lang+"' language text (message: "
                + cause.getMessage() + ")!",cause);
        }

        // these are all the sentences in this document
        // a CoreMap is essentially a Map that uses class objects as keys and has values with custom types
        List<CoreMap> sentences = document.get(SentencesAnnotation.class);

        for (CoreMap sentence : sentences) {
            // traversing the words in the current sentence
            // a CoreLabel is a CoreMap with additional token-specific methods
            Token sentStart = null;
            Token sentEnd = null;
            Token nerStart = null;
            Token nerEnd = null;
            NerTag nerTag = null;
            List<CoreLabel> tokens = sentence.get(TokensAnnotation.class);
            SemanticGraph dependencies = sentence.get(BasicDependenciesAnnotation.class);
            int tokenIdxInSentence = 0;

            for (CoreLabel token : tokens) {
                if(token.beginPosition() >= token.endPosition()){
                    log.warn("Illegal Token start:{}/end:{} values -> ignored", token.beginPosition(), token.endPosition());
                    continue;
                }
                Token t = at.addToken(token.beginPosition(), token.endPosition());
                // This can be used to ensure that the text indexes are correct
//              String word = token.get(OriginalTextAnnotation.class);
//              String span = t.getSpan();
//              if(!word.equals(span)){
//                  log.warn("word: '{}' != span: '{}'",word,span);
//              }
                if(sentStart == null){
                    sentStart = t;
                }
                sentEnd = t;
                // Process POS annotations
                String pos = token.get(PartOfSpeechAnnotation.class);
                PosTag posTag;
                if(pos != null){
                    posTag = posTagSet != null ? posTagSet.getTag(pos) : null;
                    if(posTag == null){
                        posTag = adhocPosTags.get(pos);
                        if(posTag == null){
                            log.info("Unmapped POS tag '{}' for language {}",pos,lang);
                            posTag = new PosTag(pos);
                            adhocPosTags.put(pos, posTag);
                        }
                    }
                    t.addAnnotation(POS_ANNOTATION, Value.value(posTag));
                } else {
                    posTag = null;
                }
                log.debug(" > '{}' pos: {}",t.getSpan(),posTag);
                // Process NER annotations
                String ne = token.get(NamedEntityTagAnnotation.class);
                //NOTE: '0' is used to indicate that the current token is no
                //      named entities
                NerTag actNerTag;
                if(ne != null && !"O".equals(ne)){
                    actNerTag = nerTagSet != null ? nerTagSet.getTag(ne) : null;
                    if(actNerTag == null){
                        actNerTag = adhocNerTags.get(ne);
                    }
                    if(actNerTag == null){
                        actNerTag = new NerTag(ne);
                        log.info("Unmapped Ner tag '{}' for language {}",ne,lang);
                        adhocNerTags.put(ne, actNerTag);
                    }
                } else {
                    actNerTag = null;
                }
                if(nerTag != null && !nerTag.equals(actNerTag)){
                    Chunk nerChunk = at.addChunk(nerStart.getStart(), nerEnd.getEnd());
                    nerChunk.addAnnotation(NER_ANNOTATION, Value.value(nerTag));
                    if(log.isDebugEnabled()){
                        log.debug(" - add Named Entity {} | tag: {}",nerChunk.getSpan(), nerTag);
                    }
                    nerTag = null;
                    nerStart = null;
                    nerEnd = null;
                }
                if(actNerTag != null){
                    if(nerStart == null){
                        nerStart = t;
                    }
                    nerTag = actNerTag;
                    nerEnd = t;
                }
                //Process the Lemma
                String lemma = token.get(LemmaAnnotation.class);
                if(lemma != null && !lemma.equals(t.getSpan())){
                    MorphoFeatures morpho = new MorphoFeatures(lemma);
                    if(posTag != null){
                        morpho.addPos(posTag);
                    }
                    t.addAnnotation(MORPHO_ANNOTATION, Value.value(morpho));
                }

                /*
                 * Add dependencies only if the parse annotator is in the
                 * pipeline and we have a grammatical relation {@link TagSet}
                 * for the given language.
                 */
                if (dependencies != null && gramRelationTagSet != null) {
                    addDependencyRelations(tokens, t, at, gramRelationTagSet, dependencies, ++tokenIdxInSentence);
                }
            } //end iterate over tokens in sentence
            //clean up sentence
            at.addSentence(sentStart.getStart(), sentEnd.getEnd());
            sentStart = null;
            sentEnd = null;
            //we might have still an open NER annotation
            if(nerTag != null){
                Chunk nerChunk = at.addChunk(nerStart.getStart(), nerEnd.getEnd());
                nerChunk.addAnnotation(NER_ANNOTATION, Value.value(nerTag));
            }
        }

        // This is the coreference link graph
        // Each chain stores a set of mentions that link to each other,
        // along with a method for getting the most representative mention
        // Both sentence and token offsets start at 1!
        Map<Integer, CorefChain> graph = document.get(CorefChainAnnotation.class);
        if (graph != null) {
            addCorefMentions(graph, at, sentences);
        }

        return at;
    }

    /**
     * Add dependency tree annotations to the current token.
     *
     * @param tokens - the list of {@link CoreLabel}s in the current sentence.
     * @param currentToken - the current {@link Token} to which the dependency relations will
     * be added.
     * @param at
     * @param relationTagSet - tag set containing {@link GrammaticalRelationTag}s.
     * @param dependencies - the {@link SemanticGraph} containing the dependency tree relations.
     */
    private void addDependencyRelations(List<CoreLabel> tokens, Token currentToken, AnalysedText at,
            TagSet<GrammaticalRelationTag> relationTagSet, SemanticGraph dependencies, int currentTokenIdx) {
        IndexedWord vertex = dependencies.getNodeByIndexSafe(currentTokenIdx);
        if (vertex == null) {
            // Usually the current token is a punctuation mark in this case.
            return;
        }

        List<SemanticGraphEdge> edges = new ArrayList<SemanticGraphEdge>();
        edges.addAll(dependencies.incomingEdgeList(vertex));
        edges.addAll(dependencies.outgoingEdgeList(vertex));

        for (SemanticGraphEdge edge : edges) {
            int govIndex = edge.getGovernor().index();
            int depIndex = edge.getDependent().index();
            GrammaticalRelation gramRel = edge.getRelation();
            GrammaticalRelationTag gramRelTag = relationTagSet.getTag(gramRel.getShortName());
            if(gramRelTag != null){
	            boolean isDependent = false;
	            Span partner = null;

	            if (govIndex == currentTokenIdx) {
	                CoreLabel dependentLabel = tokens.get(depIndex - 1);
	                partner = at.addToken(dependentLabel.beginPosition(), dependentLabel.endPosition());
	            } else if (depIndex == currentTokenIdx) {
	                isDependent = true;
	                CoreLabel governorLabel = tokens.get(govIndex - 1);
	                partner = at.addToken(governorLabel.beginPosition(), governorLabel.endPosition());
	            }

	            currentToken.addAnnotation(DEPENDENCY_ANNOTATION,
	                Value.value(new DependencyRelation(gramRelTag, isDependent, partner)));
            } else {
            	log.warn("Missing GrammaticalRelationTag for {}!",gramRel.getShortName());
            }
	    }

        // Finally add the root relation if the word has any.
        Collection<IndexedWord> roots = dependencies.getRoots();
        if (roots.contains(vertex)) {
            GrammaticalRelationTag rootRelTag = relationTagSet.getTag("root");
            currentToken.addAnnotation(DEPENDENCY_ANNOTATION,
                Value.value(new DependencyRelation(rootRelTag, false, null)));
        }
    }

    /**
     * Adds annotations for coref mentions to the {@link Span}s in the {@link AnalysedText}
     *
     * @param graph
     * @param at
     * @param sentences
     */
    private void addCorefMentions(Map<Integer, CorefChain> graph, AnalysedText at, List<CoreMap> sentences) {
        for (Map.Entry<Integer, CorefChain> entry : graph.entrySet()) {
            CorefChain chain = entry.getValue();

            CorefMention reprMention = chain.getRepresentativeMention();
            List<CorefMention> mentions = chain.getMentionsInTextualOrder();

            /*
             * We don't care about chains with only 1 mention because those contain
             * only the representative mention without any other mention in the text.
             */
            if (mentions.size() < 2) {
                continue;
            }

            for (CorefMention mention : mentions) {
                Span mentionedSpan = getSpanFromMention(at, sentences, mention);
                Set mentionsAsSpans = new HashSet();
                boolean isRepresentative = mention.equals(reprMention);

                for (CorefMention otherMention : mentions) {
                    if (!otherMention.equals(mention)) {
                        mentionsAsSpans.add(getSpanFromMention(at, sentences, otherMention));
                    }
                }

                mentionedSpan.addAnnotation(COREF_ANNOTATION,
                    Value.value(new CorefFeature(isRepresentative, mentionsAsSpans)));
            }
        }
    }

    /**
     * Returns the {@link Span} in the {@link AnalysedText} which corresponds
     * to the given {@link CorefMention}
     *
     * @param at
     * @param sentences
     * @param mention
     * @return
     */
    private Span getSpanFromMention(AnalysedText at, List<CoreMap> sentences, CorefMention mention) {
        CoreMap sentence = sentences.get(mention.sentNum - 1);
        List<CoreLabel> tokens = sentence.get(TokensAnnotation.class);

        if (mention.endIndex - mention.startIndex > 1) {
            CoreLabel startToken = tokens.get(mention.startIndex - 1);
            CoreLabel endToken = tokens.get(mention.endIndex - 2);

            return at.addChunk(startToken.beginPosition(), endToken.endPosition());
        } else {
            CoreLabel token = tokens.get(mention.startIndex - 1);

            return at.addToken(token.beginPosition(), token.endPosition());
        }
    }
}


text:
/*
 * ModeShape (http://www.modeshape.org)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.modeshape.jcr;

import org.modeshape.jcr.cache.ChildReferences;
import org.modeshape.jcr.cache.MutableCachedNode;
import org.modeshape.jcr.cache.NodeKey;
import org.modeshape.jcr.cache.RepositoryCache;
import org.modeshape.jcr.cache.SessionCache;
import org.modeshape.jcr.value.Name;
import org.modeshape.jcr.value.Property;
import org.modeshape.jcr.value.PropertyFactory;

/**
 * The {@link RepositoryCache.ContentInitializer} implementation that populates the "/jcr:system" content for a repository.
 */
class SystemContentInitializer implements RepositoryCache.ContentInitializer {

    protected static final String INDEXES_NODE_ID = "mode:indexes";
    protected static final String SYSTEM_NODE_ID = "jcr:system";

    private PropertyFactory propFactory;

    public SystemContentInitializer() {
    }

    @Override
    public void initializeSystemArea(SessionCache session,
                                     MutableCachedNode parent) {
        this.propFactory = session.getContext().getPropertyFactory();
        MutableCachedNode system = null;
        MutableCachedNode namespaces = null;

        // Create the "/jcr:system" node ...
        system = createNode(session, parent, SYSTEM_NODE_ID, JcrLexicon.SYSTEM, ModeShapeLexicon.SYSTEM);

        // Create the "/jcr:system/jcr:nodeTypes" node ...
        createNode(session, system, "jcr:nodeTypes", JcrLexicon.NODE_TYPES, ModeShapeLexicon.NODE_TYPES);

        // Create the "/jcr:system/jcr:versionStorage" node which we don't want to index
        MutableCachedNode versionStorage = createNode(session, system, "jcr:versionStorage", JcrLexicon.VERSION_STORAGE, ModeShapeLexicon.VERSION_STORAGE);
        versionStorage.excludeFromSearch();

        // Create the "/jcr:system/mode:namespaces" node ...
        namespaces = createNode(session, system, "mode:namespaces", ModeShapeLexicon.NAMESPACES, ModeShapeLexicon.NAMESPACES);

        // Create the standard namespaces ...
        // createNamespace(session, namespaces, "", ""); // Don't initialize the "" namespaces
        createNamespace(session, namespaces, JcrLexicon.Namespace.PREFIX, JcrLexicon.Namespace.URI);
        createNamespace(session, namespaces, JcrNtLexicon.Namespace.PREFIX, JcrNtLexicon.Namespace.URI);
        createNamespace(session, namespaces, JcrMixLexicon.Namespace.PREFIX, JcrMixLexicon.Namespace.URI);
        createNamespace(session, namespaces, JcrSvLexicon.Namespace.PREFIX, JcrSvLexicon.Namespace.URI);
        createNamespace(session, namespaces, ModeShapeLexicon.Namespace.PREFIX, ModeShapeLexicon.Namespace.URI);
        createNamespace(session, namespaces, JcrNamespaceRegistry.XML_NAMESPACE_PREFIX, JcrNamespaceRegistry.XML_NAMESPACE_URI);
        createNamespace(session,
                        namespaces,
                        JcrNamespaceRegistry.XMLNS_NAMESPACE_PREFIX,
                        JcrNamespaceRegistry.XMLNS_NAMESPACE_URI);
        createNamespace(session,
                        namespaces,
                        JcrNamespaceRegistry.XML_SCHEMA_NAMESPACE_PREFIX,
                        JcrNamespaceRegistry.XML_SCHEMA_NAMESPACE_URI);
        createNamespace(session,
                        namespaces,
                        JcrNamespaceRegistry.XML_SCHEMA_INSTANCE_NAMESPACE_PREFIX,
                        JcrNamespaceRegistry.XML_SCHEMA_INSTANCE_NAMESPACE_URI);

        // Create the "/jcr:system/mode:locks" node which we don't want to index
        MutableCachedNode locks = createNode(session, system, "mode:locks", ModeShapeLexicon.LOCKS, ModeShapeLexicon.LOCKS);
        locks.excludeFromSearch();

        // Create the "/jcr:system/mode:indexes" node which we don't want to index
        initializeIndexStorage(session, system);
    }

    @Override
    public boolean initializeIndexStorage(SessionCache session, MutableCachedNode systemNode) {
        this.propFactory = session.getContext().getPropertyFactory();
        assert systemNode != null;
        ChildReferences childReferences = systemNode.getChildReferences(session);
        //initializes the /jcr:system/mode:indexes node if not already present.
        NodeKey indexesNodeKey = systemNode.getKey().withId(INDEXES_NODE_ID);
        if (!childReferences.hasChild(indexesNodeKey)) {
            MutableCachedNode indexes = createNode(session, systemNode, INDEXES_NODE_ID, ModeShapeLexicon.INDEXES, ModeShapeLexicon.INDEXES);
            indexes.excludeFromSearch();
            return true;
        }
        return false;
    }

    protected MutableCachedNode createNode( SessionCache session,
                                            MutableCachedNode parent,
                                            String id,
                                            Name name,
                                            Name primaryType,
                                            Property... properties ) {
        NodeKey key = session.getRootKey().withId(id);
        return parent.createChild(session, key, name, propFactory.create(JcrLexicon.PRIMARY_TYPE, primaryType), properties);
    }

    protected MutableCachedNode createNamespace( SessionCache session,
                                                 MutableCachedNode parent,
                                                 String prefix,
                                                 String uri ) {
        Name nodeName = prefix.length() != 0 ? session.getContext().getValueFactories().getNameFactory().create(prefix) : ModeShapeLexicon.NAMESPACE;
        return createNode(session,
                          parent,
                          "mode:namespaces-" + uri,
                          nodeName,
                          ModeShapeLexicon.NAMESPACE,
                          propFactory.create(ModeShapeLexicon.URI, uri),
                          propFactory.create(ModeShapeLexicon.GENERATED, Boolean.FALSE));
    }
}

redpajama_set_name: RedPajamaGithub


text:
/*****************************************************************************/
/**
*
* @file xiicps_options.c
* @addtogroup iicps_v2_1
* @{
*
* Contains functions for the configuration of the XIccPs driver.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver   Who     Date     Changes
* ----- ------  -------- -----------------------------------------------
* 1.00a drg/jz  01/30/10 First release
* 1.02a sg	08/29/12 Updated the logic to arrive at the best divisors
*			 to achieve I2C clock with minimum error.
*			 This is a fix for CR #674195
* 1.03a hk  05/04/13 Initialized BestDivA and BestDivB to 0.
*			 This is fix for CR#704398 to remove warning.
* 2.0   hk  03/07/14 Limited frequency set when 100KHz or 400KHz is
*                    selected. This is a hardware limitation. CR#779290.
* 2.1   hk  04/24/14 Fix for CR# 761060 - provision for repeated start.
*
* </pre>
*
******************************************************************************/

/***************************** Include Files *********************************/

#include "xiicps.h"

/************************** Constant Definitions *****************************/

/**************************** Type Definitions *******************************/

/***************** Macros (Inline Functions) Definitions *********************/

/************************** Function Prototypes ******************************/

/************************** Variable Definitions *****************************/
/*
 * Create the table of options which are processed to get/set the device
 * options. These options are table driven to allow easy maintenance and
 * expansion of the options.
 */
typedef struct {
		u32 Option;
		u32 Mask;
} OptionsMap;

static OptionsMap OptionsTable[] = {
		{XIICPS_7_BIT_ADDR_OPTION, XIICPS_CR_NEA_MASK},
		{XIICPS_10_BIT_ADDR_OPTION, XIICPS_CR_NEA_MASK},
		{XIICPS_SLAVE_MON_OPTION, XIICPS_CR_SLVMON_MASK},
		{XIICPS_REP_START_OPTION, XIICPS_CR_HOLD_MASK},
};

#define XIICPS_NUM_OPTIONS      (sizeof(OptionsTable) / sizeof(OptionsMap))

/*****************************************************************************/
/**
*
* This function sets the options for the IIC device driver. The options control
* how the device behaves relative to the IIC bus. The device must be idle
* rather than busy transferring data before setting these device options.
*
* @param	InstancePtr is a pointer to the XIicPs instance.
* @param	Options contains the specified options to be set. This is a bit
*		mask where a 1 means to turn the option on. One or more bit
*		values may be contained in the mask. See the bit definitions
*		named XIICPS_*_OPTION in xiicps.h.
*
* @return
*		- XST_SUCCESS if options are successfully set.
*		- XST_DEVICE_IS_STARTED if the device is currently transferring
*		data. The transfer must complete or be aborted before setting
*		options.
*
* @note		None.
*
******************************************************************************/
int XIicPs_SetOptions(XIicPs *InstancePtr, u32 Options)
{
	u32 ControlReg;
	unsigned int Index;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	ControlReg = XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XIICPS_CR_OFFSET);

	/*
	 * If repeated start option is requested, set the flag.
	 * The hold bit in CR will be written by driver when the next transfer
	 * is initiated.
	 */
	if (Options & XIICPS_REP_START_OPTION) {
		InstancePtr->IsRepeatedStart = 1;
		Options = Options & (~XIICPS_REP_START_OPTION);
	}

	/*
	 * Loop through the options table, turning the option on.
	 */
	for (Index = 0; Index < XIICPS_NUM_OPTIONS; Index++) {
 		if (Options & OptionsTable[Index].Option) {
			/*
			 * 10-bit option is specially treated, because it is
			 * using the 7-bit option, so turning it on means
			 * turning 7-bit option off.
			 */
			if (OptionsTable[Index].Option &
				XIICPS_10_BIT_ADDR_OPTION) {
				/* Turn 7-bit off */
				ControlReg &= ~OptionsTable[Index].Mask;
 			} else {
				/* Turn 7-bit on */
				ControlReg |= OptionsTable[Index].Mask;
			}
		}
	}

	/*
	 * Now write to the control register. Leave it to the upper layers
	 * to restart the device.
	 */
	XIicPs_WriteReg(InstancePtr->Config.BaseAddress, XIICPS_CR_OFFSET,
			  ControlReg);

	/*
	 * Keep a copy of what options this instance has.
	 */
	InstancePtr->Options = XIicPs_GetOptions(InstancePtr);

	return XST_SUCCESS;
}

/*****************************************************************************/
/**
*
* This function clears the options for the IIC device driver. The options
* control how the device behaves relative to the IIC bus. The device must be
* idle rather than busy transferring data before setting these device options.
*
* @param	InstancePtr is a pointer to the XIicPs instance.
* @param	Options contains the specified options to be cleared. This is a
*		bit mask where a 1 means to turn the option off. One or more bit
*		values may be contained in the mask. See the bit definitions
*		named XIICPS_*_OPTION in xiicps.h.
*
* @return
*		- XST_SUCCESS if options are successfully set.
*		- XST_DEVICE_IS_STARTED if the device is currently transferring
*		data. The transfer must complete or be aborted before setting
*		options.
*
* @note		None
*
******************************************************************************/
int XIicPs_ClearOptions(XIicPs *InstancePtr, u32 Options)
{
	u32 ControlReg;
	unsigned int Index;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	ControlReg = XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
					XIICPS_CR_OFFSET);

	/*
	 * If repeated start option is cleared, set the flag.
	 * The hold bit in CR will be cleared by driver when the
	 * following transfer ends.
	 */
	if (Options & XIICPS_REP_START_OPTION) {
		InstancePtr->IsRepeatedStart = 0;
		Options = Options & (~XIICPS_REP_START_OPTION);
	}

	/*
	 * Loop through the options table and clear the specified options.
	 */
	for (Index = 0; Index < XIICPS_NUM_OPTIONS; Index++) {
 		if (Options & OptionsTable[Index].Option) {

			/*
			 * 10-bit option is specially treated, because it is
			 * using the 7-bit option, so clearing it means turning
			 * 7-bit option on.
			 */
			if (OptionsTable[Index].Option &
						XIICPS_10_BIT_ADDR_OPTION) {

				/* Turn 7-bit on */
				ControlReg |= OptionsTable[Index].Mask;
 			} else {

				/* Turn 7-bit off */
				ControlReg &= ~OptionsTable[Index].Mask;
			}
		}
	}

	/*
	 * Now write the control register. Leave it to the upper layers
	 * to restart the device.
	 */
	XIicPs_WriteReg(InstancePtr->Config.BaseAddress, XIICPS_CR_OFFSET,
			  ControlReg);

	/*
	 * Keep a copy of what options this instance has.
	 */
	InstancePtr->Options = XIicPs_GetOptions(InstancePtr);

	return XST_SUCCESS;
}

/*****************************************************************************/
/**
*
* This function gets the options for the IIC device. The options control how
* the device behaves relative to the IIC bus.
*
* @param	InstancePtr is a pointer to the XIicPs instance.
*
* @return	32 bit mask of the options, where a 1 means the option is on,
*		and a 0 means to the option is off. One or more bit values may
*		be contained in the mask. See the bit definitions named
* 		XIICPS_*_OPTION in the file xiicps.h.
*
* @note		None.
*
******************************************************************************/
u32 XIicPs_GetOptions(XIicPs *InstancePtr)
{
	u32 OptionsFlag = 0;
	u32 ControlReg;
	unsigned int Index;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	/*
	 * Read control register to find which options are currently set.
	 */
	ControlReg = XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
				      XIICPS_CR_OFFSET);

	/*
	 * Loop through the options table to determine which options are set.
	 */
	for (Index = 0; Index < XIICPS_NUM_OPTIONS; Index++) {
		if (ControlReg & OptionsTable[Index].Mask) {
			OptionsFlag |= OptionsTable[Index].Option;
		}
		if ((ControlReg & XIICPS_CR_NEA_MASK) == 0) {
			OptionsFlag |= XIICPS_10_BIT_ADDR_OPTION;
		}
	}

	if (InstancePtr->IsRepeatedStart) {
		OptionsFlag |= XIICPS_REP_START_OPTION;
	}
	return OptionsFlag;
}

/*****************************************************************************/
/**
*
* This function sets the serial clock rate for the IIC device. The device
* must be idle rather than busy transferring data before setting these device
* options.
*
* The data rate is set by values in the control register. The formula for
* determining the correct register values is:
* Fscl = Fpclk/(22 x (divisor_a+1) x (divisor_b+1))
* See the hardware data sheet for a full explanation of setting the serial
* clock rate.
*
* @param	InstancePtr is a pointer to the XIicPs instance.
* @param	FsclHz is the clock frequency in Hz. The two most common clock
*		rates are 100KHz and 400KHz.
*
* @return
*		- XST_SUCCESS if options are successfully set.
*		- XST_DEVICE_IS_STARTED if the device is currently transferring
*		data. The transfer must complete or be aborted before setting
*		options.
*		- XST_FAILURE if the Fscl frequency can not be set.
*
* @note		The clock can not be faster than the input clock divide by 22.
*
******************************************************************************/
int XIicPs_SetSClk(XIicPs *InstancePtr, u32 FsclHz)
{
	u32 Div_a;
	u32 Div_b;
	u32 ActualFscl;
	u32 Temp;
	u32 TempLimit;
	u32 LastError;
	u32 BestError;
	u32 CurrentError;
	u32 ControlReg;
	u32 CalcDivA;
	u32 CalcDivB;
	u32 BestDivA = 0;
	u32 BestDivB = 0;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Xil_AssertNonvoid(FsclHz > 0);

	if (0 != XIicPs_In32((InstancePtr->Config.BaseAddress) +
					XIICPS_TRANS_SIZE_OFFSET)) {
		return XST_DEVICE_IS_STARTED;
	}

	/*
	 * Assume Div_a is 0 and calculate (divisor_a+1) x (divisor_b+1).
	 */
	Temp = (InstancePtr->Config.InputClockHz) / (22 * FsclHz);

	/*
	 * If the answer is negative or 0, the Fscl input is out of range.
	 */
	if (0 == Temp) {
		return XST_FAILURE;
	}

	/*
	 * If frequency 400KHz is selected, 384.6KHz should be set.
	 * If frequency 100KHz is selected, 90KHz should be set.
	 * This is due to a hardware limitation.
	 */
	if(FsclHz > 384600) {
		FsclHz = 384600;
	}

	if((FsclHz <= 100000) && (FsclHz > 90000)) {
		FsclHz = 90000;
	}

	/*
	 * TempLimit helps in iterating over the consecutive value of Temp to
	 * find the closest clock rate achievable with divisors.
	 * Iterate over the next value only if fractional part is involved.
	 */
	TempLimit = ((InstancePtr->Config.InputClockHz) % (22 * FsclHz)) ?
							Temp + 1 : Temp;
	BestError = FsclHz;

	for ( ; Temp <= TempLimit ; Temp++)
	{
		LastError = FsclHz;
		CalcDivA = 0;
		CalcDivB = 0;
		CurrentError = 0;

		for (Div_b = 0; Div_b < 64; Div_b++) {

			Div_a = Temp / (Div_b + 1);

			if (Div_a != 0)
				Div_a = Div_a - 1;

			if (Div_a > 3)
				continue;

			ActualFscl = (InstancePtr->Config.InputClockHz) /
						(22 * (Div_a + 1) * (Div_b + 1));

			if (ActualFscl > FsclHz)
				CurrentError = (ActualFscl - FsclHz);
			else
				CurrentError = (FsclHz - ActualFscl);

			if (LastError > CurrentError) {
				CalcDivA = Div_a;
				CalcDivB = Div_b;
				LastError = CurrentError;
			}
		}

		/*
		 * Used to capture the best divisors.
		 */
		if (LastError < BestError) {
			BestError = LastError;
			BestDivA = CalcDivA;
			BestDivB = CalcDivB;
		}
	}

	/*
	 * Read the control register and mask the Divisors.
	 */
	ControlReg = XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
					  XIICPS_CR_OFFSET);
	ControlReg &= ~(XIICPS_CR_DIV_A_MASK | XIICPS_CR_DIV_B_MASK);
	ControlReg |= (BestDivA << XIICPS_CR_DIV_A_SHIFT) |
		(BestDivB << XIICPS_CR_DIV_B_SHIFT);

	XIicPs_WriteReg(InstancePtr->Config.BaseAddress, XIICPS_CR_OFFSET,
			  ControlReg);

	return XST_SUCCESS;
}

/*****************************************************************************/
/**
*
* This function gets the serial clock rate for the IIC device. The device
* must be idle rather than busy transferring data before setting these device
* options.
*
* @param	InstancePtr is a pointer to the XIicPs instance.
*
* @return	The value of the IIC clock to the nearest Hz based on the
*		control register settings. The actual value may not be exact to
*		to integer math rounding errors.
*
* @note		None.
*
******************************************************************************/
u32 XIicPs_GetSClk(XIicPs *InstancePtr)
{
	u32 ControlReg;
	u32 ActualFscl;
	u32 Div_a;
	u32 Div_b;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	ControlReg = XIicPs_ReadReg(InstancePtr->Config.BaseAddress,
					  XIICPS_CR_OFFSET);

	Div_a = (ControlReg & XIICPS_CR_DIV_A_MASK) >> XIICPS_CR_DIV_A_SHIFT;
	Div_b = (ControlReg & XIICPS_CR_DIV_B_MASK) >> XIICPS_CR_DIV_B_SHIFT;

	ActualFscl = (InstancePtr->Config.InputClockHz) /
		(22 * (Div_a + 1) * (Div_b + 1));

	return ActualFscl;
}

/** @} */


text:
require 'helper'

class TestBase < Test::Unit::TestCase
  context 'the Base class' do
    should 'use the attr_simple method to add an attribute' do
      MageHand::Base.attr_simple :test_attribute, :second_attribute
      @instance = MageHand::Base.new(nil)
      @instance.test_attribute = 'Hello'
      @instance.second_attribute = 'World'
      assert_equal 'Hello', @instance.test_attribute
      assert_equal 'World', @instance.second_attribute
    end

    should 'be able to get a list of simple attributes' do
      MageHand::Base.attr_simple :test_attribute, :second_attribute
      @instance = MageHand::Base.new(nil)

      assert MageHand::Base.simple_attributes.include?(:test_attribute)
      assert @instance.simple_attributes.include?(:test_attribute)

      assert MageHand::Base.simple_attributes.include?(:second_attribute)
      assert @instance.simple_attributes.include?(:second_attribute)
    end

    should 'be able to add an instance of another class as an attribute' do
      # MageHand::Client.set_app_keys('asdfasdf', 'asdfasdfasdfasdfasdf')
      MageHand::Base.attr_instance :test_campaign, :class_name => 'Campaign'
      @instance = MageHand::Base.new(nil)
      @instance.test_campaign = {:name => "A Great Time"}
      assert_equal "A Great Time", @instance.test_campaign.name
    end

    should 'be able to get a list of instance attributes' do
      MageHand::Base.attr_instance :test_campaign, :class_name => 'Campaign'
      @instance = MageHand::Base.new(nil)

      assert MageHand::Base.instance_attributes.include?(:test_campaign)
      assert @instance.instance_attributes.include?(:test_campaign)
    end

    should 'be able to get a list of all declared attributes' do
      MageHand::Base.attr_instance :test_campaign, :class_name => 'Campaign'
      MageHand::Base.attr_simple :test_attribute
      @instance = MageHand::Base.new(nil)

      assert MageHand::Base.attributes.include?(:test_campaign)
      assert @instance.attributes.include?(:test_campaign)
      assert MageHand::Base.attributes.include?(:test_attribute)
      assert @instance.attributes.include?(:test_attribute)
    end

    should 'have id as a simple attribute' do
      assert MageHand::Base.simple_attributes.include?(:id)
    end
  end
end


text:
package com.twitter.zipkin.storage.util

/**
 * Retry a given function up to nTries.
 *
 * All exceptions will be caught until the retry limit is met.
 *
 * No clean up between each invocation is attempted.  It's up to the user to ensue that
 * supplied function is resilient to this fact.
 */
object Retry {
  def apply[T](n: Int, sleep: Boolean = false)(f: => T) : T = {
    var result:Option[T] = None
    var throwable:Option[Throwable] = None

    for (i <- 0 until n if result.isEmpty) {
      try {
        result = Option(f)
      } catch {
        case e: Throwable => {
            if (sleep) Thread.sleep(1000)
            throwable = Some(e)
          }
      }
    }

    if (result.isEmpty && throwable.isDefined) {
      throw new RetriesExhaustedException(s"$n retries exhausted", throwable.get)
    }

    result.get
  }

  class RetriesExhaustedException(msg:String, throwable:Throwable) extends RuntimeException(msg,throwable)
}


text: basic test using selenium in nodejs


text:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'rating-demo',
  templateUrl: 'rating-demo.component.html'
})

export class RatingDemoComponent implements OnInit {

  public ratingVal = 2;

  ngOnInit() { }
}


text:
from flask import render_template
from flask import request
from identifyabill import app
from sqlalchemy import create_engine
import pandas as pd
import psycopg2
import yaml
from identifyabill.support_functions import formatted_query

ymlfile = open("../configs.yml", 'r')
cfg = yaml.load(ymlfile)
ymlfile.close()

dbname = cfg['dbname']
user = cfg['username']
host = 'localhost'
db = create_engine('postgres://%s%s/%s' % (user, host, dbname))
con = None
con = psycopg2.connect(database=dbname, user=user)

@app.route('/')
@app.route('/index')
def index():
    return render_template("index.html", title='Identifyabill.site',
                           user={'nickname': 'Joel'},)

@app.route('/us_bill_input')
def us_bills_input():
    return render_template("us_bill_input.html")

@app.route('/results')
def ny_bills_output():
    # pull 'subject' from input field and store it
    subject = request.args.get('subject')
    offset = request.args.get('offset')
    if (offset is None or int(offset) < 0):
        offset = 0
    limit = 20
    # just select the bills for which
    # have the subject that the user inputs

    score_col = cfg['score_column']
    q_str = """
    SELECT nyb.bill_num, nyb.bill_name, ts.{0}
    FROM ny_score as ts
    INNER JOIN ny_bills as nyb
    ON nyb.bill_num=ts.bill_num
    WHERE ts.subject={1}
    AND ts.{0} IS NOT NULL
    ORDER BY ts.{0} DESC
    LIMIT {2}
    OFFSET {3}
    """
    q_fill = q_str.format(score_col, subject, limit, offset)
    query_results = pd.read_sql_query(q_fill, con)

    bills = formatted_query(query_results, score_col)
    # bills = []
    # for i in range(0, query_results.shape[0]):
    #    bills.append(dict(bill_num=query_results.iloc[i]['bill_num'],
    #                      bill_name=query_results.iloc[i]['bill_name'],
    #                      score=query_results.iloc[i]['logistic']))

    conversion_dict = {"'Health'": 'Health', "'Taxation'": 'Taxation',
                       "'Competition_and_antitrust'": 'Antitrust',
                       "'Employee_benefits_and_pensions'": 'Employee Benefits',
                       "'Bankruptcy'": 'Bankruptcy',
                       "'Intellectual_property'": 'Intellectual Property',
                       "'Labor_and_employment'": 'Labor and Employment',
                       "'Securities'": 'Securities',
                       "'Bank_accounts_deposits_and_capital'": 'Banking'}
    return render_template("results.html", bills=bills, cdict=conversion_dict,
                           subject=subject, offset=offset)

@app.route('/us_bills_output')
def us_bills_output():
    # pull 'subject' from input field and store it
    subject = request.args.get('subject')
    # just select the bills for which
    # have the subject that the user inputs

    q_str = """
    SELECT usb.bill_num, usb.bill_name, ts.logistic
    FROM us_score as ts
    INNER JOIN us_bills as usb
    ON usb.bill_num=ts.bill_num
    WHERE ts.subject={0}
    AND ts.logistic IS NOT NULL
    ORDER BY ts.logistic DESC
    LIMIT 100;
    """
    q_fill = q_str.format(subject)
    query_results = pd.read_sql_query(q_fill, con)

    bills = []
    for i in range(0, query_results.shape[0]):
        bills.append(dict(bill_num=query_results.iloc[i]['bill_num'],
                          bill_name=query_results.iloc[i]['bill_name'],
                          score=query_results.iloc[i]['logistic']))

    return render_template("us_bills_output.html", bills=bills)

@app.route('/lda_topics')
def lda_topics():
    return render_template("lda_vis.html")


text:
using System;
using System.Diagnostics;
using MO.Core.Window.Api;

namespace MO.Core.Window.Core {

   public class RMemory {

      public static int ReadMemory(uint address, byte[] memory) {
         return ReadMemory(Process.GetCurrentProcess().Handle, address, memory, memory.Length);
      }

      public static int ReadMemory(uint address, byte[] memory, int length) {
         return ReadMemory(Process.GetCurrentProcess().Handle, address, memory, length);
      }

      public static int ReadMemory(IntPtr process, uint address, byte[] memory) {
         return ReadMemory(process, address, memory, memory.Length);
      }

      public static int ReadMemory(IntPtr process, uint address, byte[] memory, int length) {
         int read = 0;
         RKernel32.ReadProcessMemory(process, address, memory, length, out read);
         return read;
      }

   }

}


text:
<?php

namespace ImboUnitTest\Model;

use Imbo\Model\Groups;

/**
 * @covers Imbo\Model\Groups
 * @group unit
 * @group models
 */
class GroupsTest extends \PHPUnit_Framework_TestCase {
    /**
     * @var Groups
     */
    private $model;

    /**
     * Set up the model
     */
    public function setUp() {
        $this->model = new Groups();
    }

    /**
     * Tear down the model
     */
    public function tearDown() {
        $this->model = null;
    }

    /**
     * @covers Imbo\Model\Groups::getGroups
     * @covers Imbo\Model\Groups::setGroups
     */
    public function testSetAndGetGroups() {
        $this->assertSame([], $this->model->getGroups());
        $this->assertSame($this->model, $this->model->setGroups(['group' => [], 'group2' => []]));
        $this->assertSame(['group' => [], 'group2' => []], $this->model->getGroups());
    }

    /**
     * @covers Imbo\Model\Groups::setHits
     * @covers Imbo\Model\Groups::getHits
     */
    public function testCanSetAndGetHits() {
        $this->assertNull($this->model->getHits());
        $this->assertSame($this->model, $this->model->setHits(10));
        $this->assertSame(10, $this->model->getHits());
    }

    /**
     * @covers Imbo\Model\Groups::setPage
     * @covers Imbo\Model\Groups::getPage
     */
    public function testCanSetAndGetPage() {
        $this->assertNull($this->model->getPage());
        $this->assertSame($this->model, $this->model->setPage(10));
        $this->assertSame(10, $this->model->getPage());
    }

    /**
     * @covers Imbo\Model\Groups::setLimit
     * @covers Imbo\Model\Groups::getLimit
     */
    public function testCanSetAndGetLimit() {
        $this->assertNull($this->model->getLimit());
        $this->assertSame($this->model, $this->model->setLimit(10));
        $this->assertSame(10, $this->model->getLimit());
    }

    /**
     * @covers Imbo\Model\Groups::getCount
     */
    public function testCanCountImages() {
        $this->assertSame(0, $this->model->getCount());
        $this->assertSame($this->model, $this->model->setGroups(['group1' => [], 'group2' => []]));
        $this->assertSame(2, $this->model->getCount());
    }

    /**
     * @covers Imbo\Model\Groups::getData
     */
    public function testGetData() {
        $this->model
            ->setGroups(['group' => [], 'group2' => []])
            ->setHits(10)
            ->setPage(10)
            ->setLimit(10);

        $this->assertSame([
            'groups' => ['group' => [], 'group2' => []],
            'count' => 2,
            'hits' => 10,
            'limit' => 10,
            'page' => 10,
        ], $this->model->getData());
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
    <generated>
      <config projectName="projectfiles" targetName="projectfiles" />
      <config projectName="projectfiles" targetName="hello_image" />
    </generated>
  </component>
  <component name="CMakeSettings" AUTO_RELOAD="false" GENERATION_OPTIONS="-DTOOLCHAIN_DIR:PATH=/opt/gcc-arm-none-eabi -DCMAKE_TOOLCHAIN_FILE=/home/countzero/repos/libzero-dev/projectfiles/toolchain-arm-none-eabi-gcc.cmake" GENERATION_PASS_SYSTEM_ENVIRONMENT="true" BUILD_OUTPUT_DIR="$USER_HOME$/.clion10/system/cmake/generated/74a87d1f/74a87d1f">
    <ADDITIONAL_GENERATION_ENVIRONMENT>
      <envs />
    </ADDITIONAL_GENERATION_ENVIRONMENT>
  </component>
  <component name="ChangeListManager">
    <list default="true" id="61fc5bb1-ace8-40b6-a699-81955468638b" name="Default" comment="" />
    <ignored path="projectfiles.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ErrorTreeViewConfiguration">
    <option name="autoscrollToSource" value="true" />
    <option name="IS_AUTOSCROLL_TO_SOURCE" value="true" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="projectfiles" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.36842105">
              <caret line="71" column="40" selection-start-line="71" selection-start-column="40" selection-end-line="71" selection-end-column="40" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="zero.gdb" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/../scripts/zero.gdb">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="20" column="24" selection-start-line="20" selection-start-column="24" selection-end-line="20" selection-end-column="24" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="toolchain-arm-none-eabi-gcc.cmake" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/toolchain-arm-none-eabi-gcc.cmake">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="16" column="40" selection-start-line="16" selection-start-column="40" selection-end-line="16" selection-end-column="40" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="main.cpp" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/main.cpp">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0">
              <caret line="7" column="1" selection-start-line="7" selection-start-column="1" selection-end-line="7" selection-end-column="1" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/toolchain-arm-none-eabi-gcc.cmake" />
        <option value="$PROJECT_DIR$/CMakeLists.txt" />
        <option value="$PROJECT_DIR$/../scripts/zero.gdb" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="NamedScopeManager">
    <order />
  </component>
  <component name="ProjectFrameBounds">
    <option name="x" value="168" />
    <option name="y" value="52" />
    <option name="width" value="1641" />
    <option name="height" value="1000" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="projectfiles" />
              <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="projectfiles" />
              <option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="projectfiles" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="recentsLimit" value="5" />
    <property name="settings.editor.selected.configurable" value="CMakeSettings" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
    <property name="SearchEverywhereHistoryKey" value="CMAKE	ACTION	ActivateCMakeToolWindow
Cm	ACTION	ActivateCMakeToolWindow
cmake	ACTION	ActivateCMakeToolWindow
cma	ACTION	ActivateCMakeToolWindow
cm	ACTION	ActivateCMakeToolWindow" />
    <property name="last_opened_file_path" value="$PROJECT_DIR$/../output" />
    <property name="FullScreen" value="false" />
    <property name="js.buildTools.gulp.node_interpreter" value="" />
    <property name="js.buildTools.gulp.gulp_package_dir" value="" />
    <property name="js.buildTools.grunt.node_interpreter" value="" />
    <property name="js.buildTools.grunt.grunt-cli.package" value="" />
    <property name="restartRequiresConfirmation" value="true" />
  </component>
  <component name="RunManager" selected="Application.hello_image">
    <configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="projectfiles" TARGET_NAME="projectfiles" CONFIG_NAME="Debug">
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="XSLT" factoryName="XSLT">
      <option name="myOutputFile" />
      <option name="myOpenOutputFile" value="false" />
      <option name="myOpenInBrowser" value="false" />
      <option name="mySmartErrorHandling" value="true" />
      <option name="myRunnerPort" value="34873" />
      <option name="myVmArguments" />
      <option name="myWorkingDirectory" />
      <option name="myModule" />
      <option name="myJdk" />
      <parameters />
      <OutputType value="CONSOLE" save-to-file="false" />
      <FileType name="XML" />
      <JdkChoice value="FROM_MODULE" />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.grunt" factoryName="Grunt.js">
      <pass-parent-env-vars value="true" />
      <force value="false" />
      <verbose value="false" />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <node-options />
      <gulpfile />
      <tasks />
      <arguments />
      <pass-parent-envs>true</pass-parent-envs>
      <envs />
      <method />
    </configuration>
    <configuration default="false" name="Build All" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" CONFIG_NAME="Debug" EXPLICIT_BUILD_TARGET_NAME="all">
      <envs />
      <method />
    </configuration>
    <configuration default="false" name="projectfiles" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="projectfiles" TARGET_NAME="projectfiles" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="projectfiles" RUN_TARGET_NAME="projectfiles">
      <envs />
      <method />
    </configuration>
    <configuration default="false" name="hello_image" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="projectfiles" TARGET_NAME="hello_image" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="projectfiles" RUN_TARGET_NAME="hello_image">
      <envs />
      <method />
    </configuration>
    <list size="3">
      <item index="0" class="java.lang.String" itemvalue="Application.Build All" />
      <item index="1" class="java.lang.String" itemvalue="Application.projectfiles" />
      <item index="2" class="java.lang.String" itemvalue="Application.hello_image" />
    </list>
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="61fc5bb1-ace8-40b6-a699-81955468638b" name="Default" comment="" />
      <created>1438206706083</created>
      <option name="number" value="Default" />
      <updated>1438206706083</updated>
    </task>
    <servers />
  </component>
  <component name="TodoView">
    <todo-panel id="selected-file">
      <is-autoscroll-to-source value="true" />
    </todo-panel>
    <todo-panel id="all">
      <are-packages-shown value="true" />
      <is-autoscroll-to-source value="true" />
    </todo-panel>
  </component>
  <component name="ToolWindowManager">
    <frame x="168" y="52" width="1641" height="1000" extended-state="0" />
    <editor active="true" />
    <layout>
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.18726823" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32911393" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.50978136" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
      <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3164557" sideWeight="0.8852578" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.41542003" sideWeight="0.11474219" order="8" side_tool="true" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25344953" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32911393" sideWeight="0.49745825" order="10" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20023015" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <ignored-roots>
      <path value="$PROJECT_DIR$/.." />
    </ignored-roots>
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="15" column="8" selection-start-line="15" selection-start-column="4" selection-end-line="15" selection-end-column="89" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/toolchain-arm-none-eabi-gcc.cmake">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="21" column="20" selection-start-line="21" selection-start-column="20" selection-end-line="21" selection-end-column="20" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/main.cpp">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="7" column="1" selection-start-line="7" selection-start-column="1" selection-end-line="7" selection-end-column="1" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/toolchain-arm-none-eabi-gcc.cmake">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="15" column="18" selection-start-line="15" selection-start-column="13" selection-end-line="15" selection-end-column="26" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/main.cpp">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="7" column="1" selection-start-line="7" selection-start-column="1" selection-end-line="7" selection-end-column="1" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/toolchain-arm-none-eabi-gcc.cmake">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="12" column="50" selection-start-line="12" selection-start-column="50" selection-end-line="12" selection-end-column="50" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/main.cpp">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="jar://$APPLICATION_HOME_DIR$/lib/clion.jar!/resources/html5-schema/mml3/Makefile">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.58878505">
          <caret line="14" column="7" selection-start-line="14" selection-start-column="7" selection-end-line="14" selection-end-column="7" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/main.cpp">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="7" column="1" selection-start-line="7" selection-start-column="1" selection-end-line="7" selection-end-column="1" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/toolchain-arm-none-eabi-gcc.cmake">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="16" column="40" selection-start-line="16" selection-start-column="40" selection-end-line="16" selection-end-column="40" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/../scripts/zero.gdb">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0">
          <caret line="20" column="24" selection-start-line="20" selection-start-column="24" selection-end-line="20" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/CMakeLists.txt">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.36842105">
          <caret line="71" column="40" selection-start-line="71" selection-start-column="40" selection-end-line="71" selection-end-column="40" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
<!doctype html>

	<title>React-Select Example</title>
	<link rel="stylesheet" href="example.css">

React Select

Standalone bulid

For usage without babel / browserify / webpack

			Copyright © Jed Watson 2017. MIT Licensed.


text:
var app = require("commander");
var fuzzysearch = require("fuzzysearch");
var getLists = require("./lib/get-lists");
var printList = require("./lib/print-list");
var auth = require("./lib/auth");

app
  .description("Search tasks")
  .usage("[query]")
  .parse(process.argv);

function main() {
  var terms = app.args;

  if (terms.length < 1) {
    process.exit();
  }

  getLists(function(err, data) {
    if (err) process.exit(1);

    data.forEach(function(list) {
      list.tasks = list.tasks.filter(function(item) {
        var found = false;
        terms.forEach(function(term) {
          if (fuzzysearch(term.toLowerCase(), item.title.toLowerCase())) {
            found = true;
          }
        });
        return found;
      });

      printList(list);
    });
  });
}

auth(main);


text:
namespace Skuld
{
	namespace Protobuf
	{
		std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> CreateZeroCopyOutputStream(HandleRef<OutputStream> stream);
		std::unique_ptr<google::protobuf::io::ZeroCopyInputStream> CreateZeroCopyInputStream(HandleRef<InputStream> stream);
	}
}


text:
@interface TTSearchlightLabel : UIView {
  NSString*       _text;

  UIFont*         _font;
  UIColor*        _textColor;
  UIColor*        _spotlightColor;
  UITextAlignment _textAlignment;

  NSTimer*        _timer;
  CGFloat         _spotlightPoint;

  CGContextRef    _maskContext;
  void*           _maskData;
}

@property (nonatomic, copy)   NSString*       text;

@property (nonatomic, retain) UIFont*         font;
@property (nonatomic, retain) UIColor*        textColor;
@property (nonatomic, retain) UIColor*        spotlightColor;
@property (nonatomic)         UITextAlignment textAlignment;

- (void)startAnimating;
- (void)stopAnimating;

@end


text:
class area_data;
class room_data;
class mob_data;
class object_data;
class quest_data;

#include "Bits.h"
#include "SampleColorizer.h"
#include "CtrlToolBar.h"
#include "Interp.h"
#include "ZoneTree.h"
#include "EasySize.h"
#include "SplitterControl.h"
#include "DlgDirections.h"
#include "DlgSave.h"
#include "DlgCreateGrid.h"
#include "DlgMapEdit.h"
#include "CmdHistory.h"
#include "Alias.h"
#include "ColorEditWnd.h"
#include "DlgMapEdit.h"
#include "ShipBuilder.h"
#include "DlgAbout.h"

enum {
	//settings bits
	OPEN_AREA_FORMAT	= BV00,
	SAVE_AREA_FORMAT	= BV01,
	AUTO_SAVE			= BV02,
	WALK_CREATE			= BV03,
	SHOW_COMPAS			= BV04,
	OPEN_DE_FORMAT		= BV05,
	SAVE_DE_FORMAT		= BV06,
	ECHO_COMMANDS		= BV07,
	WINDOW_VISIBLE		= BV08,
	SHOW_MAP			= BV09,
	OPEN_AREA_V1_FORMAT = BV10,
	SAVE_AREA_V1_FORMAT = BV11,
	SAVE_ON_EXIT		= BV12,
	DISP_LINE_LEN		= BV13,

	PAGE_LEN			= 40,

	//misc
	ICON_MESSAGE	= WM_APP+1,
	TRAY_ID			= 1
};

extern unsigned int	editor_flags;

class CWinDEDlg : public CDialog
{
	DECLARE_EASYSIZE
public:
	static char		class_name[];
	static int		class_index;

public:
	friend class CZoneTree;
	friend class DlgDirections;
	friend class DlgSave;
	friend class DlgMapEdit;

public:
	CWinDEDlg(CWnd* pParent = NULL);	// standard constructor

	NOTIFYICONDATA	niData;
	HICON			tray_icon;

	unsigned int	timer;

	room_data		*in_room;

	mob_index		*user;

	CSplitterControl split;
	CStatusBar		m_Status;
	CCtrlToolBar	m_Tool;
	CZoneTree		zone_tree;
	CmdHistory		history;

	DlgDirections	dlg;
	DlgMapEdit		map;
	DlgSave			save_progress;
	AliasList		alias_list;

	HTREEITEM		m_tArea;
	HTREEITEM		m_tRooms;
	HTREEITEM		m_tObjects;
	HTREEITEM		m_tMobiles;

	COLORREF		def_color;
	COLORREF		echo_color;

	static class InterpData {
	public:
		char* keyword;
		bool needs_args;
		bool show_prompt;
		int cmd;
	}  keyword_list[];

	enum Commands {
		CMD_NONE,
		CMD_NORTH,
		CMD_SOUTH,
		CMD_WEST,
		CMD_EAST,
		CMD_UP,
		CMD_DOWN,
		CMD_NORTHWEST,
		CMD_SOUTHWEST,
		CMD_NORTHEAST,
		CMD_SOUTHEAST,
		CMD_LOOK,
		CMD_GOTO,
		CMD_NEW,
		CMD_EDIT,
		CMD_DELETE,
		CMD_GRID,
		CMD_SAVE,
		CMD_CLOSE,
		CMD_EXIT,
		CMD_COMMAND,
		CMD_STAT,
		CMD_FOLLOW,
		CMD_MOUNT,
		CMD_GIVE,
		CMD_EQUIP,
		CMD_LOAD,
		CMD_DEF_ROOM,
		CMD_ALIAS,
		CMD_UNALIAS,
		CMD_RENUMBER,
		CMD_ASK,
		CMD_LINK,
		CMD_EXITS,
		CMD_CLONE,
		CMD_PURGE,
		CMD_DROP,
		CMD_GET,
		CMD_LIST,
		CMD_SHOW,
		CMD_INV,
		CMD_TAKE,
		CMD_WHERE,
	};

	HTREEITEM InsertItem(CString &title, HTREEITEM parent, void* data, int class_index);
	void UpdateItem(CString &title, HTREEITEM item);
	void RemoveItem(HTREEITEM item);

    void UpdateStatusBar();

	void AddRoom(room_data *room);
	void AddMob(mob_data *mob);
	void AddObject(object_data *obj);
	void AddMobToRoom(mob_index *mob, room_data *room);
	void AddObjToRoom(obj_index *obj, room_data *room);

	void ShowPrompt();
	bool PromptResponse();
	void ShowRoom(bool prompt = true);
	void MoveRoom(int dir);

	void LoadSettings();
	void SaveSettings();

	void DeleteAllRooms();
	void DeleteAllMobs();
	void DeleteAllObjs();

	void CloseArea();

	void InitColorControl();
	void AdjustToolLine();
	void InitSplitter();
	void InitZoneTree();
	void InitTrayIcon();

	int LastKey();

	bool CheckPortalCommand(CString str);

	int InterpKeyWord(CString &str);

	void Look(CString args);
	void Goto(CString args);
	void New(CString args);
	void Edit(CString args);
	void Delete(CString args);
	void Grid(CString args);
	void Command(CString args);
	void Stat(CString args);
	void Follow(CString args);
	void Mount(CString args);
	void Give(CString args);
	void Equip(CString args);
	void Load(CString args);
	void Default(CString args);
	void Alias(CString args);
	void UnAlias(CString args);
	void Renumber(CString args);
	void Ask(CString args);
	void Link(CString args);
	void Exits(CString args);
	void Clone(CString args);
	void Purge(CString args);
	void Get(CString args);
	void Drop(CString args);
	void List(CString args);
	void Show(CString args);
	void Inv(CString args);
	void Take(CString args);
	void Where(CString args);

	void StatMob(int vnum);
	void StatObj(int vnum);
	void StatRoom(int vnum);
	void StatArea(int vnum);

	void DeleteMob(int vnum);
	void DeleteObj(int vnum);
	void DeleteRoom(int vnum);

	void DeleteRoom(room_data *room);

	room_data *CreateRoomGrid(int x, int y, int z);

	void ShowText(const char* str, bool show_prompt);

	void OnTrayNotify(WPARAM wParam, LPARAM lParam);

	void AreaLoaded();

	void SaveDefaults();
	void LoadDefaults();
	void OpenCommandLineFile();

	void CheckQuests(mob_index *mindex);
	void GiveQuestReward(mob_index *mob, quest_data *quest);
	void RemoveQuestItems(mob_index *mob, quest_data *quest);

	// Dialog Data
	//{{AFX_DATA(CWinDEDlg)
	enum { IDD = IDD_WINDE_DIALOG };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CWinDEDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
	//}}AFX_VIRTUAL

	void DoResize1(int delta);
	LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);

	// Implementation
protected:
	HICON m_hIcon;

	ColorEditWnd * m_pColorWnd;

    // our own special colorizer
    CAnsiColorizer m_colorizer;

	// Generated message map functions
	//{{AFX_MSG(CWinDEDlg)
	virtual void OnTimer(UINT nIDEvent);
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnEnter();
	afx_msg void OnMobilesDeletemob();
	afx_msg void OnMobilesEditmob();
	afx_msg void OnMobilesNewmob();
	afx_msg void OnObjectsDeleteobject();
	afx_msg void OnObjectsEditobject();
	afx_msg void OnObjectsNewobject();
	afx_msg void OnRoomsDeleteroom();
	afx_msg void OnRoomsEditroom();
	afx_msg void OnRoomsNewroom();
	afx_msg void OnNorthWest();
	afx_msg void OnNorth();
	afx_msg void OnNorthEast();
	afx_msg void OnWest();
	afx_msg void OnLook();
	afx_msg void OnEast();
	afx_msg void OnSouth();
	afx_msg void OnSouthWest();
	afx_msg void OnSouthEast();
	afx_msg void OnSave();
	afx_msg void OnSettings();
	afx_msg void OnHistory();
	afx_msg void OnOpen();
	afx_msg void OnExit();
	afx_msg void OnNewArea();
	afx_msg void OnAreaEdit();
	afx_msg void OnDown();
	afx_msg void OnUp();
	afx_msg void OnDirections();
	afx_msg void OnMap();
	afx_msg void OnNewRoom();
	afx_msg void OnEditRoom(int vnum);
	afx_msg void OnNewMob();
	afx_msg void OnEditMob(int vnum);
	afx_msg void OnNewObject();
	afx_msg void OnEditObject(int vnum);
	afx_msg void OnAreaProperties();
	afx_msg void OnClose();
	afx_msg void OnDestroy();
	afx_msg void OnCreateGrid();
	afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
	afx_msg void HistoryMenu(UINT id);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
	afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnShipBuilder();
	afx_msg void OnBitCalc();
	afx_msg void OnStatistics();
	afx_msg BOOL OnTrayMenu(UINT id);
	afx_msg void OnHelp();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_WINDEDLG_H__AB46590E_4717_4274_A65C_C4964C1AA139__INCLUDED_)


text:
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/*!
 * Next JS
 * Copyright (c)2011 Xenophy.CO.,LTD All rights Reserved.
 * http://www.xenophy.com
 */

// {{{ NX.app.action.Web.setCookie

module.exports = function(name, value, options) {

    var me = this;
    var cookies = this.res.cookies || (this.res.cookies = []),
        cookie = [ name, "=", value, ";" ];

    options = options || {};

    if(options.expires) {
        cookie.push(" expires=", (new Date(options.expires)).toUTCString(), ";");
    }

    if(options.path) {
        cookie.push(" path=", options.path, ";");
    }

    if(options.domain) {
        cookie.push(" domain=", options.domain, ";");
    }

    if(options.secure) {
        cookie.push(" secure", ";");
    }

    if(options.httpOnly) {
        cookie.push(" httpOnly");
    }

    cookies.push(cookie.join(""));

};

// }}}

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */


text:
package org.turbogwt.mvp.databind.client;

public class MistypedBindingException extends RuntimeException {

    public MistypedBindingException() {
    }

    public MistypedBindingException(String s) {
        super(s);
    }

    public MistypedBindingException(String s, Throwable throwable) {
        super(s, throwable);
    }

    public MistypedBindingException(Throwable throwable) {
        super(throwable);
    }
}


text:
#import <SportsVoices/CompoundSlot.h>

@interface DisjunctionSlot : CompoundSlot
{
}

+ (id)disjunctionSlotWithArray:(id)arg1;
+ (id)instanceFromPlist:(id)arg1;
- (id)reversed;
- (id)description;
- (_Bool)matches:(id)arg1;

@end


text:
ALTER TABLE `mkt_feed_app`
    DROP COLUMN `pullquote_attribution`;

ALTER TABLE `mkt_feed_app`
    ADD COLUMN `pullquote_attribution` varchar(50) NULL DEFAULT '';


text:
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fc2c86b867c54f7a927fe251bd61b4bc)](https://www.codacy.com/app/dave_9/dpn-python-library?utm_source=github.com&utm_medium=referral&utm_content=Pcolar/dpn-python-library&utm_campaign=Badge_Grade)

## Python code for DPN client functions

### API-Gateway
JSON schema files for for AWS gateway functions

### app
Contains python libraries

### scripts
Bash scripts for utility processing

### Utilities

#### append_sqs_to_file.py
Copies the contents of a queue to a local file
- if "delete_sqs" is set, the queue entries are deleted
- if "json_out" is set, a "results:" wrapper is applied for valid JSON

#### audit_bag_repl.py, audit_repl.py
Validates number  of replications meets policy

#### audit_match_repl.py
Validate replication records match between nodes

#### BagCreateUpdate.py
Encapsulates DPN API GET and POST calls to update a registry bag record via the DPN API

#### copy_file_to_SQS.py
Copies the contents of a local file to a queue

#### create-dict.py
Creates a dictionary from file input

#### create-digest.py
Creates a digest record, via the API, from file input

#### create_dpn_bag.py, create_dpn_bag_stdin.py, create_update_bag.py
Creates (or updates) a bag entry via the DPN API

#### create_dpn_member_dashboard.py
 No longer used - functionality moved to NiFi workflow engine

#### create-fixity.py
Creates a fixity record, via the API, from file input

#### create-ingest.py
Creates an ingest record, via the API, from file input

#### create_sqs_from_stdin.py
Reads a record from STDIN and creates a queue entry - single record processing only

#### create_update_bag_from_repl.py
Given a satisfied Repl record at STDIN, Create a corresponding bag record and write to STDOUT

#### create_update_member.py
Creates (or updates) a member record via the DPN API

#### create_update_repl.py
Creates (or updates) a replication record via the DPN API

#### get_api_endpoint.py
DPN API call shell

#### s3_json_to_csv.py
Retrieves a json file from an S3 bucket and converts to csv

#### snapshot_parse_csv.py
Parse the UCSD DCV 'conan' report into CSV

#### update_bag_repl_nodes.py
Given a satisfied Repl record at STDIN, Update the corresponding bag record


text:
    <app-counter-button [title]="DecrementTitle" [action]="ActionDecrement"></app-counter-button>

    <app-count></app-count>

    <app-counter-button [title]="IncrementTitle" [action]="ActionIncrement"></app-counter-button>

    <app-counter-button [title]="ResetTitle" [action]="ActionReset"></app-counter-button>


text:
from __future__ import print_function, unicode_literals

import codecs
import locale
import readline
import sys

from . import *

HOST = "localhost"

WELCOME = """\

Zerograph Shell v1β
(C) Copyright 2014, Nigel Small <nigel@nigelsmall.com>

Execute Cypher statements or meta-commands (prefixed with "!"). Multiple Cypher
statements can be separated by a semicolon and will be executed within the
same batched transaction. Type !HELP for help or type !EOF to exit the shell.

"""

HELP = """\
!HELP           display this help
!EOF            exit the shell

!OPEN <port>    open the graph on port <port>, creating it if it doesn't exist
!DROP <port>    drop the graph on port <port> and delete the files from disk

!GET <resource> [<json_object_data>]
!SET <resource> [<json_object_data>]
!PATCH <resource> [<json_object_data>]
!CREATE <resource> [<json_object_data>]
!DELETE <resource> [<json_object_data>]
!EXECUTE <resource> [<json_object_data>]
"""

if sys.version_info >= (3,):

    def get_input(prompt):
        return input(prompt)

else:

    _stdin = sys.stdin
    preferred_encoding = locale.getpreferredencoding()
    sys.stdin = codecs.getreader(preferred_encoding)(sys.stdin)
    sys.stdout = codecs.getwriter(preferred_encoding)(sys.stdout)
    sys.stderr = codecs.getwriter(preferred_encoding)(sys.stderr)

    def get_input(prompt):
        sys.stdin = _stdin
        return raw_input(prompt).decode(sys.stdin.encoding)

class Shell(object):

    def __init__(self, graph):
        self.__graph = graph
        self.__queries = {}

    @property
    def graph(self):
        return self.__graph

    @property
    def prompt(self):
        return "[Z] {0}:{1}> ".format(self.graph.host, self.graph.port)

    def print_error(self, message):
        print(message)

    def meta(self, line):
        command, args = line[1:].partition(" ")[0::2]
        command = command.upper()
        if command == "EOF":
            raise EOFError()
        elif command == "HELP":
            self.help()
        elif command == "OPEN":
            port = int(args.partition(" ")[0])
            self.__graph = Graph.open(HOST, port)
            print("Opened graph on port {0}".format(port))
        elif command == "DROP":
            port = int(args.partition(" ")[0])
            if port == 47470:
                self.print_error("Cannot drop zerograph on port 47470")
            else:
                Graph.drop(HOST, port)
                print("Dropped graph on port {0}".format(port))
        elif command == "RECORD":
            name, query = args.partition(" ")[0::2]
            self.__queries[name] = query
            print("Query {0} recorded".format(repr(name)))
        elif command == "PLAY":
            name, param_sets = args.partition(" ")[0::2]
            param_sets = json.loads(param_sets)
            try:
                query = self.__queries[name]
            except KeyError:
                self.print_error("No query named {0} recorded".format(repr(name)))
            else:
                print("Playing query {0}...\n".format(repr(name)))
                self.execute_query(query, param_sets)
        elif command in ("GET", "SET", "PATCH", "CREATE", "DELETE", "EXECUTE"):
            resource, arguments = args.partition(" ")[0::2]
            try:
                arguments = json.loads(arguments)
            except ValueError:
                self.print_error("Bad JSON: " + arguments)
            else:
                if isinstance(arguments, dict):
                    result = Batch.single(self.graph, Batch.append, command, resource, **arguments)
                    print(result)
                else:
                    self.print_error("Not a JSON object: {0}".format(arguments))
        else:
            self.print_error("Unknown meta-command: !" + command)

    def welcome(self):
        sys.stdout.write(WELCOME)

    def help(self):
        sys.stdout.write(HELP)

    def _submit(self, batch):
        try:
            results = batch.submit()
        except Error as err:
            self.print_error(err.args[0])
        else:
            for result in results:
                print(result)

    def execute_query(self, query, param_sets):
        batch = Batch(self.graph)
        for params in param_sets:
            batch.execute_cypher(query, params)
        self._submit(batch)

    def execute_queries(self, line):
        batch = Batch(self.graph)
        for query in line.split(";"):
            query = query.strip()
            if query:
                batch.execute_cypher(query.strip())
        self._submit(batch)

    def repl(self):
        while True:
            try:
                line = get_input(self.prompt)
                if line.startswith("!"):
                    self.meta(line)
                elif all(map(lambda ch: ch.isdigit(), line.strip())):
                    print(self.graph.node(int(line.strip())))
                else:
                    self.execute_queries(line)
            except EOFError:
                print("⌁")
                break
            except Exception as err:
                self.print_error(err)
            print()

def main():
    shell = Shell(Graph.open(HOST))
    shell.welcome()
    shell.repl()


text:
package golisp

import (
	"encoding/json"
	"fmt"
	"math"
	"strings"
)

func JsonToLispWithFrames(json interface{}) (result *Data) {
	mapValue, ok := json.(map[string]interface{})
	if ok {
		var m = make(FrameMap, len(mapValue))
		for key, val := range mapValue {
			value := JsonToLispWithFrames(val)
			m[fmt.Sprintf("%s:", key)] = value
		}
		return FrameWithValue(&m)
	}

	arrayValue, ok := json.([]interface{})
	if ok {
		var ary *Data
		for _, val := range arrayValue {
			value := JsonToLispWithFrames(val)
			ary = Cons(value, ary)
		}
		return Reverse(ary)
	}

	numValue, ok := json.(float64)
	if ok {
		if math.Trunc(numValue) == numValue {
			return IntegerWithValue(int64(numValue))
		} else {
			return FloatWithValue(float32(numValue))
		}
	}

	floatValue, ok := json.(float64)
	if ok {
		if math.Mod(floatValue, 1) == 0 {
			return IntegerWithValue(int64(floatValue))
		} else {
			return FloatWithValue(float32(floatValue))
		}
	}

	strValue, ok := json.(string)
	if ok {
		return StringWithValue(strValue)
	}

	boolValue, ok := json.(bool)
	if ok {
		return BooleanWithValue(boolValue)
	}

	return
}

func JsonStringToLispWithFrames(jsonData string) (result *Data) {
	b := []byte(jsonData)
	var data interface{}
	err := json.Unmarshal(b, &data)
	if err != nil {
		fmt.Printf("Returning empty frame because of badly formed json: '%s'\n --> %v\n", jsonData, err)
		m := make(FrameMap, 0)
		return FrameWithValue(&m)
	}
	return JsonToLispWithFrames(data)
}

func LispWithFramesToJson(d *Data) (result interface{}) {
	if d == nil {
		return ""
	}

	if IntegerP(d) {
		return IntegerValue(d)
	}

	if FloatP(d) {
		return FloatValue(d)
	}

	if StringP(d) {
		return StringValue(d)
	}

	if BooleanP(d) {
		return BooleanValue(d)
	}

	if PairP(d) {
		ary := make([]interface{}, 0, Length(d))
		for c := d; NotNilP(c); c = Cdr(c) {
			ary = append(ary, LispWithFramesToJson(Car(c)))
		}
		return ary
	}

	if FrameP(d) {
		dict := make(map[string]interface{}, Length(d))
		for k, v := range *FrameValue(d) {
			if !FunctionP(v) {
				dict[strings.TrimRight(k, ":")] = LispWithFramesToJson(v)
			}
		}
		return dict
	}

	return ""
}

func LispWithFramesToJsonString(d *Data) (result string) {
	temp := LispWithFramesToJson(d)
	j, err := json.Marshal(temp)
	if err == nil {
		return string(j)
	} else {
		return ""
	}
}


text:
package acceptance.runner;

public interface EventNotifier {
    void eventHappened();
}


text:
<?php

namespace EllisIO\Tests\Phone\Drivers;

use EllisIO\Phone\Facades\Phone as PhoneFacade;
use EllisIO\Phone\Phone;
use EllisIO\Tests\Phone\AbstractTestCase;

class TwilioTest extends AbstractTestCase
{
    public function testGetPhone()
    {
        $driver = $this->getDriver();
        $phone = $this->getPhone();

        $driverNumber = $driver->getPhone('4153902337');

        $this->assertInstanceOf(Phone::class, $driverNumber);
        $this->assertSame($phone->getNumber(), $driverNumber->getNumber());
    }

    public function testFormatNumber()
    {
        $driver = $this->getDriver();
        $phone = $this->getPhone();

        $this->assertSame($phone->getFormattedNumber(), $driver->formatNumber('4153902337'));
    }

    protected function getPhone()
    {
        return new Phone('+14153902337', '(415) 390-2337', 'US');
    }

    protected function getDriver()
    {
        return PhoneFacade::driver('twilio');
    }
}