text:
module MMM.OOP.OrdVarSet where

import MMM.Core.FuncComb
import MMM.OOP.Language.Syntax(IsVar(..))
import MMM.Util.Util hiding ((<>))
import MMM.Util.Pretty
import MMM.HsMMM

import qualified Data.Map as M

import Control.Monad.State
import Control.Applicative

import Data.Function(on)
import Data.List(sortBy, (\\))
import Data.Maybe(fromJust)

import qualified Debug.Trace as T

--------------------------------------------------------------------------------
-- * Base Structure

-- |A (VarSet id) stores both the variables in scope and their current
--  position in "memory" (or, in the product passed as input to functions).
--
--  To illustrate the functions below, we'll consider a (vs :: VS id) such that
--
--  @vs = M.fromList $ [("a", 1), ("b", 2), ("c", 3), ("d", 4)]@
--
--  Note the distinction between focused and unfocused varsets,
--  Gladly, products are associative, therefore we can shuffle them
--  however we see fit.
data VS id
  -- |A VSSingle represents a normally left-associative product,
  --  If vs is a VSSingle, it represents (((a * b) * c) * d)
  = VSSingle (M.Map id Int)
  -- |A focus point is used to pass inputs to components. If
  --  vs is a VSFocus 1, it will represent (a * ((b * c) * d))
  | VSFocus Int (M.Map id Int)
  deriving (Show, Eq)

instance (IsVar id) => Pretty (VS id) where
  pretty vs
    = case vs of
        VSSingle _  -> pprAssocLeftWith pprPair $ vsSortedKeys vs
        VSFocus i _ -> let (f, r) = splitAt i (vsSortedKeys vs)
                       in parens $ pprAssocLeftWith pprPair f <> comma
                               <+> pprAssocLeftWith pprPair r
    where
      pprPair d a = parens $ d <> comma <+> pretty a

vsGetMap :: (IsVar id) => VS id -> M.Map id Int
vsGetMap = vsCata id (const id)

--------------------------------------------------------------------------------
-- ** Base Structure Utilities

vsCata :: (IsVar id)
       => (M.Map id Int -> a)
       -> (Int -> M.Map id Int -> a)
       -> VS id
       -> a
vsCata single _ (VSSingle m)  = single m
vsCata _ focus  (VSFocus i m) = focus i m

-- |Looks up a variable in the current state.
vsLookup :: (IsVar id) => id -> VS id -> Maybe Int
vsLookup i = vsCata (M.lookup i) (const $ M.lookup i)

-- |Builds a projection for a variable.
vsMkProj :: (IsVar id) => id -> VS id -> Maybe HsExp
vsMkProj v (VSSingle m)
  = HsEProj (M.size m) . (+1) <$> M.lookup v m
vsMkProj v vs@(VSFocus f m)
  = vsLookup v vs >>= return . mkProj vs
  where
    mkProj (VSFocus f m) i
      | i < f = flip HsEComp (HsEProj 2 1) . HsEProj f . (+1)              $ i
      | True  = flip HsEComp (HsEProj 2 2) . HsEProj (M.size m - f) . (+1) $ i - f

-- |Returns the keys of out map
vsKeys :: (IsVar id) => VS id -> [id]
vsKeys (VSSingle m)  = M.keys m
vsKeys (VSFocus _ m) = M.keys m

-- |Returns the keyset of a VS, ordered by their position in memory
vsSortedKeys :: (IsVar id) => VS id -> [id]
vsSortedKeys = vsCata aux (const aux)
  where
    aux = map fst . sortBy (compare `on` snd) . M.toList

-- |Appends a new variable, in the end of the map
vsAppTail :: (IsVar id) => id -> VS id -> VS id
vsAppTail v = vsCata (insS v) (insF v)
  where
    insS v m   = VSSingle $ M.insert v (M.size m) m
    insF v f m = VSFocus f $ M.insert v (M.size m) m

-- |Appends a new variable, in the beggining of the map
vsAppHead :: (IsVar id) => id -> VS id -> VS id
vsAppHead v = vsCata (ins v) err
  where
    ins v m = VSSingle $ M.insert v 0 $ M.map (+1) m
    err f m = bug (f, m) "OrdVarSet.vsAppHead: Can't append a variable into a focused variable set head."

-- *** Data.Map trivial extensions

-- |Data.Map.mapKeys extended to VS
vsMapKeys :: (IsVar id, IsVar id') => (id -> id') -> VS id -> VS id'
vsMapKeys h = vsCata (VSSingle . M.mapKeys h) (\f -> VSFocus f . M.mapKeys h)

-- |Data.Map.mapWithKey extended to VS
vsMapWithKey :: (IsVar id) => (id -> Int -> Int) -> VS id -> VS id
vsMapWithKey h = vsCata (VSSingle . M.mapWithKey h) (\f -> VSFocus f . M.mapWithKey h)

-- |Data.Map.size extended to VS
vsSize :: (IsVar id) => VS id -> Int
vsSize = vsCata M.size (const $ M.size)

-- |Data.Map.map extended to VS
vsMap :: (IsVar id) => (Int -> Int) -> VS id -> VS id
vsMap f = vsCata (VSSingle . M.map f) (\i -> VSFocus i . M.map f)

-- |Data.Map.delete extended to VS
vsDelete :: (IsVar id) => id -> VS id -> VS id
vsDelete v = vsCata (VSSingle . M.delete v) (delfocus v)
  where
    delfocus v f m
      = case M.lookup v m of
          Nothing  -> VSFocus f m
          Just idx -> if idx < f
                      then VSFocus (f-1) (M.delete v m)
                      else VSFocus f     (M.delete v m)

-- |Data.Map.toList extended to VS
vsToList :: (IsVar id) => VS id -> [(id, Int)]
vsToList = vsCata (M.toList) (const $ M.toList)

-- *** Predicates

vsIsSingle, vsIsFocus :: (IsVar id) => VS id -> Bool
vsIsSingle = vsCata (const True) (\_ _ -> False)
vsIsFocus  = not . vsIsSingle

-- *** Generation

-- |Generates a single varset from a list of identifiers.
vsFromList :: (IsVar id) => [id] -> VS id
vsFromList l = VSSingle $ M.fromList $ zip l [0..]

-- |Generates a focused varset from a list and a focus point.
vsFromListFocus :: (IsVar id) => [id] -> Int -> VS id
vsFromListFocus l i
  | length l == i = VSSingle (M.fromList $ zip l [0..])
  | otherwise     = VSFocus i $ M.fromList $ zip l [0..]

--------------------------------------------------------------------------------
-- ** State Monad Encapsulation

-- |Encapsulation of our dict into a state.
type OrdVS id = StateT (VS id)

-- |Unwrapping
runOrdVS :: (Monad m) => OrdVS id m a -> m a
runOrdVS = flip evalStateT (VSSingle M.empty)

runOrdVSvb :: (Monad m) => OrdVS id m a -> m (a, VS id)
runOrdVSvb = flip runStateT (VSSingle M.empty)

--------------------------------------------------------------------------------
-- *** Monadic Functionality

-- |Get
ordvsGetVarSet :: (IsVar id, Monad m) => OrdVS id m (VS id)
ordvsGetVarSet = get

-- |Put
ordvsPutVarSet :: (IsVar id, Monad m) => VS id -> OrdVS id m ()
ordvsPutVarSet = put

-- |Pretty prints the varset with the current variable names.
ordvsGetVarSetPretty :: (IsVar id, Monad m) => OrdVS id m String
ordvsGetVarSetPretty = get >>= return . show . pretty

-- |Returns a projection that will select a given variable.
--  @ordvsGetV "c" = Just $ HsEProj 4 3@
ordvsGetV :: (IsVar id, Monad m) => id -> OrdVS id m (Maybe HsExp)
ordvsGetV v = get >>= return . vsMkProj v

-- |Same as above, unsafe version.
ordvsGetV_U :: (IsVar id, Monad m) => id -> OrdVS id m HsExp
ordvsGetV_U v = ordvsGetV v >>= return . maybe err id
  where
    err = bug v "OrdVarSet.ordvsGetV_U: no such variable."

-- |Returns the list of variables in scope.
ordvsGetVs :: (IsVar id, Monad m) => OrdVS id m [id]
ordvsGetVs = get >>= return . vsSortedKeys

-- |Returns the current focus point
ordvsGetFocus :: (IsVar id, Monad m) => OrdVS id m Int
ordvsGetFocus = get >>= return . vsCata (const 0) (\i _ -> i)

-- |Creates a new variable, in the end of the current var list.
ordvsNewV :: (IsVar id, Monad m) => id -> OrdVS id m ()
ordvsNewV i = modify (vsAppTail i)

-- |Creates a new variable, in the head of the current list.
ordvsNewVhd :: (IsVar id, Monad m) => id -> OrdVS id m ()
ordvsNewVhd i = modify (vsAppHead i)

-- |Adds a "nil" valued variable, or a button in MMM jargon, to
--  the current input. The name of this variable is "NIL".
--  Returns a "pwnil" function.
ordvsAddNIL :: (IsVar id, Monad m) => OrdVS id m HsExp
ordvsAddNIL = ordvsNewVhd (varBuild "NIL") >> return (HsEVar "nilpw")

-- |Given a machine returns the correct running boilerplate,
ordvsRunm :: (IsVar id, Monad m) => HsMMM -> OrdVS id m HsMMM
ordvsRunm m
  = do
    vs <- ordvsGetVs
    return $ if length vs == 2
             then (HsMRunm1 m)
             else (HsMRunm m)

-- |Same as above, but uses the runm_, for ignoring output.
ordvsRunm_ :: (IsVar id, Monad m) => HsMMM -> OrdVS id m HsMMM
ordvsRunm_ m = ordvsRunm m
           >>= \x -> return $ case x of
                                  (HsMRunm m') -> HsMRunmI m'
                                  _            -> x

-- |Renames a variable
ordvsRename :: (IsVar id, Monad m) => id -> id -> OrdVS id m ()
ordvsRename on nn = modify (vsMapKeys $ rn on nn)
  where
    rn on nn k
      | k == on   = nn
      | otherwise = k

-- |@ordvsUnifyWith vs@ will return a associativity that, if applied to
--  vs will unify with the current varset. Make sure they're unifiable,
--  that is, they must have the same key set.
ordvsUnifyWith :: (IsVar id, Monad m) => VS id -> OrdVS id m HsExp
ordvsUnifyWith target
  = do
    vs <- get
    -- two var-sets curr and new are unifiable when new \subseteq curr
    when (not $ unifiable (vsKeys vs) (vsKeys target))
         $ bug (target, vs) "Can't unify the varsets."
    let projs = map (fromJust . flip vsMkProj vs) $ vsSortedKeys target
    put target
    let i = vsCata (\_ -> 0) (\i _ -> i) target
    return $ buildSplit i projs
  where
    unifiable currVs = all (`elem` currVs)

    buildSplit _ [] = HsEId
    buildSplit 0 ls = foldl1 HsESplit ls
    buildSplit i ls = let (focus, rest) = splitAt i ls
                      in case rest of
                          [] -> (foldl1 HsESplit focus)
                          _  -> HsESplit (foldl1 HsESplit focus) (foldl1 HsESplit rest)

-- |Performs an assoc operation, by selecting a list of variables and
--  pushing them to the beginning of the list.
--
--  @ordvsAssoc ["d", "c"] = split (split p4 p3) (split p1 p2)@
--
--  Note that after a ordvsAssoc the input type becomes focused. There's
--  more detail on this in the report, but we have to fix it afterwards, otherwise
--  some OrdVS functions might fail. You should call 'ordvsRmFocus' to get back to
--  a single VS.
ordvsAssoc  :: (IsVar id, Monad m) => [id] -> OrdVS id m HsExp
ordvsAssoc [] = ordvsGetV (varBuild "NIL")
            >>= maybe (ordvsAddNIL >>= return)
                      (\_ -> ordvsAssoc [varBuild "NIL"])
ordvsAssoc sl
  = do
    ks <- ordvsGetVs
    let sl' = sl `assertSublistAndCompleteWith` ks
    ordvsUnifyWith (vsFromListFocus sl' (length sl))
  where
    assertSublistAndCompleteWith sl ll
      = if sl <=* ll
        then sl ++ (ll \\ sl)
        else bug (sl, ll) "ordvsAssoc argument must be a sublist of the current keyset"

    sl <=* ll = all (`elem` ll) sl

-- |Removes the focus point. Returns the required associativity isomorphism.
ordvsRmFocus :: (IsVar id, Monad m) => OrdVS id m HsExp
ordvsRmFocus
  = do
    vs <- get
    case vs of
      (VSFocus f m) ->
        do
          put (VSSingle m)
          return $ mkSplit
                 $ map (\(v, _) -> fromJust $ vsMkProj v vs)
                 $ sortBy (compare `on` snd) $ M.toList m
      vs' -> return HsEId
  where
    mkSplit [] = error "mkSplit"
    mkSplit l  = foldl1 HsESplit l

-- |Performs a rewrite of two variables. @ordvsRw old new@ will write
--  @new@ on top of @old@. Returns the assoc function needed to perform
--  the operation on MMM level.
ordvsRw :: (IsVar id, Monad m) => id -> id -> OrdVS id m (Maybe HsExp)
ordvsRw old new
  = do
    assoc <- ordvsAssoc [old, new]
    modify (rmAndFix old)
    rmf <- ordvsRmFocus
    return . Just . HsEComp rmf
           . HsEComp (HsEProd [HsEProj 2 2, HsEId]) $ assoc
  where
    rmAndFix :: (IsVar id) => id -> VS id -> VS id
    rmAndFix o (VSFocus f m)
      = let
        oi = fromJust $ M.lookup o m
        m' = M.map (\v -> if v > oi then v-1 else v) m
      in VSFocus (f-1) $ M.delete o m'

-- |Performs garbage collection on a variable.
ordvsCollect :: (IsVar id, Monad m) => [id] -> OrdVS id m HsExp
ordvsCollect sl
  = do
    assoc <- ordvsAssoc sl
    modify rmFocus
    return . HsEComp (HsEProj 2 2) $ assoc
  where
    rmFocus (VSSingle m) = bug m "Can't collect a single varset."
    rmFocus (VSFocus f m) = VSSingle . M.map (\x -> x - f) . M.filter (>= f) $ m

--------------------------------------------------------------------------------
-- ** Testing

runTestOrdVS :: (Monad m) => OrdVS String m a -> m a
runTestOrdVS f = runOrdVS ((mapM_ ordvsNewV $ words "a b c d") >> f)

runTestOrdVS__ :: (Monad m) => OrdVS String m a -> m (a, VS String)
runTestOrdVS__ f = runStateT ((mapM_ ordvsNewV $ words "a b c d") >> f) $ VSSingle M.empty


text:
<!DOCTYPE html>

<meta charset="UTF-8">

<title>module Minitest::Spec::DSL::InstanceMethods - minitest-5.11.3 Documentation</title>

<link href="../../../css/fonts.css" rel="stylesheet">
<link href="../../../css/rdoc.css" rel="stylesheet">

    Home

    Pages
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Methods

#_

#expect

#value

    module Minitest::Spec::DSL::InstanceMethods

Rdoc… why are you so dumb?

Public Instance Methods

          _(value = nil, &block)

          click to toggle source

Returns a value monad that has all of Expectations methods available to it.

Also aliased to value and
expect for your
aesthetic pleasure:

     _(1 + 1).must_equal 2
 value(1 + 1).must_equal 2
expect(1 + 1).must_equal 2

This method of expectation-based testing is preferable to
straight-expectation methods (on Object)
because it stores its test context, bypassing our hacky use of thread-local
variables.

At some point, the methods on Object
will be deprecated and then removed.

# File lib/minitest/spec.rb, line 304
def _ value = nil, &block
  Minitest::Expectation.new block || value, self
end

          Also aliased as: value, expect

          expect(value = nil, &block)

          Alias for: _

          value(value = nil, &block)

          Alias for: _

Validate

Generated by RDoc 4.2.1.

Based on Darkfish by Michael Granger.

redpajama_set_name: RedPajamaGithub


text:
/*
 *  SPDX-License-Identifier: GPL-2.0+ or MIT
 */
#include <linux/module.h>
#include <linux/kernel.h>

static int number= 1;
static char *who = "World";

module_param(number, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(myint, "Just some number");
module_param(who, charp, 0000);
MODULE_PARM_DESC(who, "Whot to greet");

int init_module(void)
{
	printk(KERN_INFO "Hello %s (%d)!\n", who, number);
	return 0;
}

void cleanup_module(void)
{
	printk(KERN_INFO "Goodbye %s (%d)!\n", who, number);
}

MODULE_LICENSE("Dual MIT/GPL");


text:
package com.booking.validator.service;

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;
import java.util.Properties;

public class DiscrepancySinkFactory {
    private static final Logger LOGGER = LoggerFactory.getLogger(DiscrepancySinkFactory.class);

    private enum Types {
        KAFKA("kafka"),
        CONSOLE("console");

        private String value;
        Types(String value) {
            this.value = value;
        }
        public String getValue() {
            return value;
        }
        public static Types fromString(String text) {
            for (Types b : Types.values()) {
                if (b.getValue().equalsIgnoreCase(text)) {
                    return b;
                }
            }
            return null;
        }
    }

    public static interface DiscrepancySink {
        public void send(String message);
    }

    public static DiscrepancySink getDiscrepancySink(String type, Map<String, String> config) {
        switch (Types.fromString(type.trim())) {
            case CONSOLE:
                ConsoleDiscrepancySink consoleDiscrepancySink = new ConsoleDiscrepancySink(config);
                return consoleDiscrepancySink;
            case KAFKA:
                KafkaDiscrepancySink kafkaDiscrepancySink = new KafkaDiscrepancySink(config);
                return kafkaDiscrepancySink;
            default:
                return null;
        }
    }

    private static class ConsoleDiscrepancySink implements DiscrepancySink {
        public ConsoleDiscrepancySink(Map<String, String> config) {}
        @Override
        public void send(String message) {
            System.out.println(message);
        }
    }

    private static class KafkaDiscrepancySink implements DiscrepancySink {
        private String topic;
        private Producer<String, String> producer;

        public static interface Configuration{
            static final String BROKER_LIST = "broker.list";
            static final String TOPIC = "topic";
        }

        public KafkaDiscrepancySink(Map<String, String> config) {
            String brokerList = config.get(Configuration.BROKER_LIST);
            String topic = config.get(Configuration.TOPIC);
            if (brokerList.isEmpty() || topic.isEmpty()) {
                throw new RuntimeException("Kafka Discrepancy Sink needs broker-list and topic");
            }
            this.topic = topic;
            this.producer = setupKafkaProducer(brokerList);
        }

        private Producer<String, String> setupKafkaProducer(String brokerList) {
            Producer<String,String> producer = null;
            Properties properties = new Properties();
            properties.put("bootstrap.servers", brokerList);
            try {
                producer = new KafkaProducer(properties, new StringSerializer(), new StringSerializer());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return producer;
        }

        @Override
        public void send(String message) {
            try{
                producer.send(new ProducerRecord<>(topic, message));
            } catch (Exception e) {
                LOGGER.error(e.getStackTrace().toString());
            }
        }
    }
}


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using FunMatchGame.Models;

namespace FunMatchGame.Repositories
{
	public interface ISetRepository
	{
		Task<IList<Card>> GetCardsBySetIdAsync(Sets setId);
	}
}


text:
import * as nls from 'vs/nls';
import { Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IProcessEnvironment, OperatingSystem } from 'vs/base/common/platform';
import { IExtensionPointDescriptor } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IProcessDataEvent, IProcessReadyEvent, IShellLaunchConfig, ITerminalDimensions, ITerminalDimensionsOverride, ITerminalLaunchError, ITerminalProfile, ITerminalProfileObject, TerminalShellType } from 'vs/platform/terminal/common/terminal';
import { IEnvironmentVariableInfo } from 'vs/workbench/contrib/terminal/common/environmentVariable';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';

export const TERMINAL_VIEW_ID = 'terminal';

/** A context key that is set when there is at least one opened integrated terminal. */
export const KEYBINDING_CONTEXT_TERMINAL_IS_OPEN = new RawContextKey<boolean>('terminalIsOpen', false, true);

/** A context key that is set when the integrated terminal has focus. */
export const KEYBINDING_CONTEXT_TERMINAL_FOCUS = new RawContextKey<boolean>('terminalFocus', false, nls.localize('terminalFocusContextKey', "Whether the terminal is focused"));

/** A context key that is set to the current number of integrated terminals. */
export const KEYBINDING_CONTEXT_TERMINAL_COUNT = new RawContextKey<number>('terminalCount', 0, nls.localize('terminalCountContextKey', "The current number of terminals"));

/** A context key that is set when the terminal tabs view is narrow. */
export const KEYBINDING_CONTEXT_TERMINAL_IS_TABS_NARROW_FOCUS = new RawContextKey<boolean>('isTerminalTabsNarrow', false, true);

/** A context key that is set when the integrated terminal tabs widget has focus. */
export const KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS = new RawContextKey<boolean>('terminalTabsFocus', false, nls.localize('terminalTabsFocusContextKey', "Whether the terminal tabs widget is focused"));

/** A context key that is set when the integrated terminal tabs widget has the mouse focus. */
export const KEYBINDING_CONTEXT_TERMINAL_TABS_MOUSE = new RawContextKey<boolean>('terminalTabsMouse', false, undefined);

export const KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE_KEY = 'terminalShellType';
/** A context key that is set to the detected shell for the most recently active terminal, this is set to the last known value when no terminals exist. */
export const KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE = new RawContextKey<string>(KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE_KEY, undefined, { type: 'string', description: nls.localize('terminalShellTypeContextKey', "The shell type of the active terminal") });

export const KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE = new RawContextKey<boolean>('terminalAltBufferActive', false, true);

/** A context key that is set when the integrated terminal does not have focus. */
export const KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED = KEYBINDING_CONTEXT_TERMINAL_FOCUS.toNegated();

/** A context key that is set when the user is navigating the accessibility tree */
export const KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS = new RawContextKey<boolean>('terminalA11yTreeFocus', false, true);

/** A keybinding context key that is set when the integrated terminal has text selected. */
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED = new RawContextKey<boolean>('terminalTextSelected', false, nls.localize('terminalTextSelectedContextKey', "Whether text is selected in the active terminal"));
/** A keybinding context key that is set when the integrated terminal does not have text selected. */
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_NOT_SELECTED = KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED.toNegated();

/**  A context key that is set when the find widget in integrated terminal is visible. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE = new RawContextKey<boolean>('terminalFindVisible', false, true);
/**  A context key that is set when the find widget in integrated terminal is not visible. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_NOT_VISIBLE = KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE.toNegated();
/**  A context key that is set when the find widget find input in integrated terminal is focused. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_FOCUSED = new RawContextKey<boolean>('terminalFindInputFocused', false, true);
/**  A context key that is set when the find widget in integrated terminal is focused. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_FOCUSED = new RawContextKey<boolean>('terminalFindFocused', false, true);
/**  A context key that is set when the find widget find input in integrated terminal is not focused. */
export const KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_NOT_FOCUSED = KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_FOCUSED.toNegated();

export const KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED = new RawContextKey<boolean>('terminalProcessSupported', false, nls.localize('terminalProcessSupportedContextKey', "Whether terminal processes can be launched"));

export const KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION = new RawContextKey<boolean>('terminalTabsSingularSelection', false, nls.localize('terminalTabsSingularSelectedContextKey', "Whether one terminal tab is selected"));

export const NEVER_MEASURE_RENDER_TIME_STORAGE_KEY = 'terminal.integrated.neverMeasureRenderTime';

export const TERMINAL_CREATION_COMMANDS = ['workbench.action.terminal.toggleTerminal', 'workbench.action.terminal.new', 'workbench.action.togglePanel', 'workbench.action.terminal.focus'];

export const SUGGESTED_RENDERER_TYPE = 'terminal.integrated.suggestedRendererType';

export const TerminalCursorStyle = {
	BLOCK: 'block',
	LINE: 'line',
	UNDERLINE: 'underline'
};

export const TERMINAL_CONFIG_SECTION = 'terminal.integrated';

export const TERMINAL_ACTION_CATEGORY = nls.localize('terminalCategory', "Terminal");

export const DEFAULT_LETTER_SPACING = 0;
export const MINIMUM_LETTER_SPACING = -5;
export const DEFAULT_LINE_HEIGHT = 1;

export const MINIMUM_FONT_WEIGHT = 1;
export const MAXIMUM_FONT_WEIGHT = 1000;
export const DEFAULT_FONT_WEIGHT = 'normal';
export const DEFAULT_BOLD_FONT_WEIGHT = 'bold';
export const SUGGESTIONS_FONT_WEIGHT = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];

export const ITerminalProfileResolverService = createDecorator<ITerminalProfileResolverService>('terminalProfileResolverService');
export interface ITerminalProfileResolverService {
	readonly _serviceBrand: undefined;

	readonly defaultProfileName: string | undefined;

	/**
	 * Resolves the icon of a shell launch config if this will use the default profile
	 */
	resolveIcon(shellLaunchConfig: IShellLaunchConfig, os: OperatingSystem): void;
	resolveShellLaunchConfig(shellLaunchConfig: IShellLaunchConfig, options: IShellLaunchConfigResolveOptions): Promise<void>;
	getDefaultProfile(options: IShellLaunchConfigResolveOptions): Promise<ITerminalProfile>;
	getDefaultShell(options: IShellLaunchConfigResolveOptions): Promise<string>;
	getDefaultShellArgs(options: IShellLaunchConfigResolveOptions): Promise<string | string[]>;
	getEnvironment(remoteAuthority: string | undefined): Promise<IProcessEnvironment>;

	// TODO: Remove when workspace trust is enabled
	getSafeConfigValue(key: string, os: OperatingSystem): unknown | undefined;
	getSafeConfigValueFullKey(key: string): unknown | undefined;
}

export interface IShellLaunchConfigResolveOptions {
	remoteAuthority: string | undefined;
	os: OperatingSystem;
	allowAutomationShell?: boolean;
}

export type FontWeight = 'normal' | 'bold' | number;

export interface ITerminalProfiles {
	linux: { [key: string]: ITerminalProfileObject };
	osx: { [key: string]: ITerminalProfileObject };
	windows: { [key: string]: ITerminalProfileObject };
}

export interface ITerminalConfiguration {
	shell: {
		linux: string | null;
		osx: string | null;
		windows: string | null;
	};
	automationShell: {
		linux: string | null;
		osx: string | null;
		windows: string | null;
	};
	shellArgs: {
		linux: string[];
		osx: string[];
		windows: string[];
	};
	profiles: ITerminalProfiles;
	defaultProfile: {
		linux: string | null;
		osx: string | null;
		windows: string | null;
	};
	useWslProfiles: boolean;
	altClickMovesCursor: boolean;
	macOptionIsMeta: boolean;
	macOptionClickForcesSelection: boolean;
	gpuAcceleration: 'auto' | 'on' | 'off';
	rightClickBehavior: 'default' | 'copyPaste' | 'paste' | 'selectWord';
	cursorBlinking: boolean;
	cursorStyle: string;
	cursorWidth: number;
	drawBoldTextInBrightColors: boolean;
	fastScrollSensitivity: number;
	fontFamily: string;
	fontWeight: FontWeight;
	fontWeightBold: FontWeight;
	minimumContrastRatio: number;
	mouseWheelScrollSensitivity: number;
	sendKeybindingsToShell: boolean;
	// fontLigatures: boolean;
	fontSize: number;
	letterSpacing: number;
	lineHeight: number;
	detectLocale: 'auto' | 'off' | 'on';
	scrollback: number;
	commandsToSkipShell: string[];
	allowChords: boolean;
	allowMnemonics: boolean;
	cwd: string;
	confirmOnExit: boolean;
	enableBell: boolean;
	env: {
		linux: { [key: string]: string };
		osx: { [key: string]: string };
		windows: { [key: string]: string };
	};
	environmentChangesIndicator: 'off' | 'on' | 'warnonly';
	environmentChangesRelaunch: boolean;
	showExitAlert: boolean;
	splitCwd: 'workspaceRoot' | 'initial' | 'inherited';
	windowsEnableConpty: boolean;
	wordSeparators: string;
	experimentalUseTitleEvent: boolean;
	enableFileLinks: boolean;
	unicodeVersion: '6' | '11';
	experimentalLinkProvider: boolean;
	localEchoLatencyThreshold: number;
	localEchoExcludePrograms: ReadonlyArray<string>;
	localEchoStyle: 'bold' | 'dim' | 'italic' | 'underlined' | 'inverted' | string;
	enablePersistentSessions: boolean;
	tabs: {
		enabled: boolean;
		hideCondition: 'never' | 'singleTerminal';
		showActiveTerminal: 'always' | 'singleTerminal' | 'singleTerminalOrNarrow' | 'never';
		location: 'left' | 'right';
		focusMode: 'singleClick' | 'doubleClick';
	},
	bellDuration: number;
	allowWorkspaceConfiguration: boolean;
}

export const DEFAULT_LOCAL_ECHO_EXCLUDE: ReadonlyArray<string> = ['vim', 'vi', 'nano', 'tmux'];

export interface ITerminalConfigHelper {
	config: ITerminalConfiguration;

	configFontIsMonospace(): boolean;
	getFont(): ITerminalFont;
	showRecommendations(shellLaunchConfig: IShellLaunchConfig): void;
}

export interface ITerminalFont {
	fontFamily: string;
	fontSize: number;
	letterSpacing: number;
	lineHeight: number;
	charWidth?: number;
	charHeight?: number;
}

export interface IRemoteTerminalAttachTarget {
	id: number;
	pid: number;
	title: string;
	cwd: string;
	workspaceId: string;
	workspaceName: string;
	isOrphan: boolean;
	icon: string | undefined;
	color: string | undefined;
}

export interface ICommandTracker {
	scrollToPreviousCommand(): void;
	scrollToNextCommand(): void;
	selectToPreviousCommand(): void;
	selectToNextCommand(): void;
	selectToPreviousLine(): void;
	selectToNextLine(): void;
}

export interface INavigationMode {
	exitNavigationMode(): void;
	focusPreviousLine(): void;
	focusNextLine(): void;
}

export interface IBeforeProcessDataEvent {
	/**
	 * The data of the event, this can be modified by the event listener to change what gets sent
	 * to the terminal.
	 */
	data: string;
}

export interface IDefaultShellAndArgsRequest {
	useAutomationShell: boolean;
	callback: (shell: string, args: string[] | string | undefined) => void;
}

export interface ITerminalProcessManager extends IDisposable {
	readonly processState: ProcessState;
	readonly ptyProcessReady: Promise<void>;
	readonly shellProcessId: number | undefined;
	readonly remoteAuthority: string | undefined;
	readonly os: OperatingSystem | undefined;
	readonly userHome: string | undefined;
	readonly environmentVariableInfo: IEnvironmentVariableInfo | undefined;
	readonly persistentProcessId: number | undefined;
	readonly shouldPersist: boolean;
	readonly isDisconnected: boolean;
	/** Whether the process has had data written to it yet. */
	readonly hasWrittenData: boolean;

	readonly onPtyDisconnect: Event<void>;
	readonly onPtyReconnect: Event<void>;

	readonly onProcessReady: Event<IProcessReadyEvent>;
	readonly onBeforeProcessData: Event<IBeforeProcessDataEvent>;
	readonly onProcessData: Event<IProcessDataEvent>;
	readonly onProcessTitle: Event<string>;
	readonly onProcessShellTypeChanged: Event<TerminalShellType>;
	readonly onProcessExit: Event<number | undefined>;
	readonly onProcessOverrideDimensions: Event<ITerminalDimensionsOverride | undefined>;
	readonly onProcessResolvedShellLaunchConfig: Event<IShellLaunchConfig>;
	readonly onEnvironmentVariableInfoChanged: Event<IEnvironmentVariableInfo>;

	dispose(immediate?: boolean): void;
	detachFromProcess(): void;
	createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean): Promise<ITerminalLaunchError | undefined>;
	relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean, reset: boolean): Promise<ITerminalLaunchError | undefined>;
	write(data: string): void;
	setDimensions(cols: number, rows: number): Promise<void>;
	setDimensions(cols: number, rows: number, sync: false): Promise<void>;
	setDimensions(cols: number, rows: number, sync: true): void;
	acknowledgeDataEvent(charCount: number): void;
	processBinary(data: string): void;

	getInitialCwd(): Promise<string>;
	getCwd(): Promise<string>;
	getLatency(): Promise<number>;
}

export const enum ProcessState {
	// The process has not been initialized yet.
	Uninitialized = 1,
	// The process is currently launching, the process is marked as launching
	// for a short duration after being created and is helpful to indicate
	// whether the process died as a result of bad shell and args.
	Launching = 2,
	// The process is running normally.
	Running = 3,
	// The process was killed during launch, likely as a result of bad shell and
	// args.
	KilledDuringLaunch = 4,
	// The process was killed by the user (the event originated from VS Code).
	KilledByUser = 5,
	// The process was killed by itself, for example the shell crashed or `exit`
	// was run.
	KilledByProcess = 6
}

export interface ITerminalProcessExtHostProxy extends IDisposable {
	readonly instanceId: number;

	emitData(data: string): void;
	emitTitle(title: string): void;
	emitReady(pid: number, cwd: string): void;
	emitExit(exitCode: number | undefined): void;
	emitOverrideDimensions(dimensions: ITerminalDimensions | undefined): void;
	emitResolvedShellLaunchConfig(shellLaunchConfig: IShellLaunchConfig): void;
	emitInitialCwd(initialCwd: string): void;
	emitCwd(cwd: string): void;
	emitLatency(latency: number): void;

	onInput: Event<string>;
	onBinary: Event<string>;
	onResize: Event<{ cols: number, rows: number }>;
	onAcknowledgeDataEvent: Event<number>;
	onShutdown: Event<boolean>;
	onRequestInitialCwd: Event<void>;
	onRequestCwd: Event<void>;
	onRequestLatency: Event<void>;
}

export interface IStartExtensionTerminalRequest {
	proxy: ITerminalProcessExtHostProxy;
	cols: number;
	rows: number;
	callback: (error: ITerminalLaunchError | undefined) => void;
}

export interface IDefaultShellAndArgsRequest {
	useAutomationShell: boolean;
	callback: (shell: string, args: string[] | string | undefined) => void;
}

export enum TitleEventSource {
	/** From the API or the rename command that overrides any other type */
	Api,
	/** From the process name property*/
	Process,
	/** From the VT sequence */
	Sequence
}

export const QUICK_LAUNCH_PROFILE_CHOICE = 'workbench.action.terminal.profile.choice';

export const enum TerminalCommandId {
	FindNext = 'workbench.action.terminal.findNext',
	FindPrevious = 'workbench.action.terminal.findPrevious',
	Toggle = 'workbench.action.terminal.toggleTerminal',
	Kill = 'workbench.action.terminal.kill',
	KillInstance = 'workbench.action.terminal.killInstance',
	QuickKill = 'workbench.action.terminal.quickKill',
	ConfigureTerminalSettings = 'workbench.action.terminal.openSettings',
	CopySelection = 'workbench.action.terminal.copySelection',
	SelectAll = 'workbench.action.terminal.selectAll',
	DeleteWordLeft = 'workbench.action.terminal.deleteWordLeft',
	DeleteWordRight = 'workbench.action.terminal.deleteWordRight',
	DeleteToLineStart = 'workbench.action.terminal.deleteToLineStart',
	MoveToLineStart = 'workbench.action.terminal.moveToLineStart',
	MoveToLineEnd = 'workbench.action.terminal.moveToLineEnd',
	New = 'workbench.action.terminal.new',
	NewWithCwd = 'workbench.action.terminal.newWithCwd',
	NewLocal = 'workbench.action.terminal.newLocal',
	NewInActiveWorkspace = 'workbench.action.terminal.newInActiveWorkspace',
	NewWithProfile = 'workbench.action.terminal.newWithProfile',
	Split = 'workbench.action.terminal.split',
	SplitInstance = 'workbench.action.terminal.splitInstance',
	SplitInActiveWorkspace = 'workbench.action.terminal.splitInActiveWorkspace',
	Unsplit = 'workbench.action.terminal.unsplit',
	JoinInstance = 'workbench.action.terminal.joinInstance',
	Relaunch = 'workbench.action.terminal.relaunch',
	FocusPreviousPane = 'workbench.action.terminal.focusPreviousPane',
	ShowTabs = 'workbench.action.terminal.showTabs',
	FocusTabs = 'workbench.action.terminal.focusTabs',
	FocusNextPane = 'workbench.action.terminal.focusNextPane',
	ResizePaneLeft = 'workbench.action.terminal.resizePaneLeft',
	ResizePaneRight = 'workbench.action.terminal.resizePaneRight',
	ResizePaneUp = 'workbench.action.terminal.resizePaneUp',
	CreateWithProfileButton = 'workbench.action.terminal.createProfileButton',
	ResizePaneDown = 'workbench.action.terminal.resizePaneDown',
	Focus = 'workbench.action.terminal.focus',
	FocusNext = 'workbench.action.terminal.focusNext',
	FocusPrevious = 'workbench.action.terminal.focusPrevious',
	Paste = 'workbench.action.terminal.paste',
	PasteSelection = 'workbench.action.terminal.pasteSelection',
	SelectDefaultProfile = 'workbench.action.terminal.selectDefaultShell',
	RunSelectedText = 'workbench.action.terminal.runSelectedText',
	RunActiveFile = 'workbench.action.terminal.runActiveFile',
	SwitchTerminal = 'workbench.action.terminal.switchTerminal',
	ScrollDownLine = 'workbench.action.terminal.scrollDown',
	ScrollDownPage = 'workbench.action.terminal.scrollDownPage',
	ScrollToBottom = 'workbench.action.terminal.scrollToBottom',
	ScrollUpLine = 'workbench.action.terminal.scrollUp',
	ScrollUpPage = 'workbench.action.terminal.scrollUpPage',
	ScrollToTop = 'workbench.action.terminal.scrollToTop',
	Clear = 'workbench.action.terminal.clear',
	ClearSelection = 'workbench.action.terminal.clearSelection',
	ChangeIcon = 'workbench.action.terminal.changeIcon',
	ChangeIconInstance = 'workbench.action.terminal.changeIconInstance',
	ChangeColor = 'workbench.action.terminal.changeColor',
	ChangeColorInstance = 'workbench.action.terminal.changeColorInstance',
	Rename = 'workbench.action.terminal.rename',
	RenameInstance = 'workbench.action.terminal.renameInstance',
	RenameWithArgs = 'workbench.action.terminal.renameWithArg',
	FindFocus = 'workbench.action.terminal.focusFind',
	FindHide = 'workbench.action.terminal.hideFind',
	QuickOpenTerm = 'workbench.action.quickOpenTerm',
	ScrollToPreviousCommand = 'workbench.action.terminal.scrollToPreviousCommand',
	ScrollToNextCommand = 'workbench.action.terminal.scrollToNextCommand',
	SelectToPreviousCommand = 'workbench.action.terminal.selectToPreviousCommand',
	SelectToNextCommand = 'workbench.action.terminal.selectToNextCommand',
	SelectToPreviousLine = 'workbench.action.terminal.selectToPreviousLine',
	SelectToNextLine = 'workbench.action.terminal.selectToNextLine',
	ToggleEscapeSequenceLogging = 'toggleEscapeSequenceLogging',
	SendSequence = 'workbench.action.terminal.sendSequence',
	ToggleFindRegex = 'workbench.action.terminal.toggleFindRegex',
	ToggleFindWholeWord = 'workbench.action.terminal.toggleFindWholeWord',
	ToggleFindCaseSensitive = 'workbench.action.terminal.toggleFindCaseSensitive',
	NavigationModeExit = 'workbench.action.terminal.navigationModeExit',
	NavigationModeFocusNext = 'workbench.action.terminal.navigationModeFocusNext',
	NavigationModeFocusPrevious = 'workbench.action.terminal.navigationModeFocusPrevious',
	ShowEnvironmentInformation = 'workbench.action.terminal.showEnvironmentInformation',
	SearchWorkspace = 'workbench.action.terminal.searchWorkspace',
	AttachToRemoteTerminal = 'workbench.action.terminal.attachToSession'
}

export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [
	TerminalCommandId.ClearSelection,
	TerminalCommandId.Clear,
	TerminalCommandId.CopySelection,
	TerminalCommandId.DeleteToLineStart,
	TerminalCommandId.DeleteWordLeft,
	TerminalCommandId.DeleteWordRight,
	TerminalCommandId.FindFocus,
	TerminalCommandId.FindHide,
	TerminalCommandId.FindNext,
	TerminalCommandId.FindPrevious,
	TerminalCommandId.ToggleFindRegex,
	TerminalCommandId.ToggleFindWholeWord,
	TerminalCommandId.ToggleFindCaseSensitive,
	TerminalCommandId.FocusNextPane,
	TerminalCommandId.FocusNext,
	TerminalCommandId.FocusPreviousPane,
	TerminalCommandId.FocusPrevious,
	TerminalCommandId.Focus,
	TerminalCommandId.Kill,
	TerminalCommandId.MoveToLineEnd,
	TerminalCommandId.MoveToLineStart,
	TerminalCommandId.NewInActiveWorkspace,
	TerminalCommandId.New,
	TerminalCommandId.Paste,
	TerminalCommandId.PasteSelection,
	TerminalCommandId.ResizePaneDown,
	TerminalCommandId.ResizePaneLeft,
	TerminalCommandId.ResizePaneRight,
	TerminalCommandId.ResizePaneUp,
	TerminalCommandId.RunActiveFile,
	TerminalCommandId.RunSelectedText,
	TerminalCommandId.ScrollDownLine,
	TerminalCommandId.ScrollDownPage,
	TerminalCommandId.ScrollToBottom,
	TerminalCommandId.ScrollToNextCommand,
	TerminalCommandId.ScrollToPreviousCommand,
	TerminalCommandId.ScrollToTop,
	TerminalCommandId.ScrollUpLine,
	TerminalCommandId.ScrollUpPage,
	TerminalCommandId.SendSequence,
	TerminalCommandId.SelectAll,
	TerminalCommandId.SelectToNextCommand,
	TerminalCommandId.SelectToNextLine,
	TerminalCommandId.SelectToPreviousCommand,
	TerminalCommandId.SelectToPreviousLine,
	TerminalCommandId.SplitInActiveWorkspace,
	TerminalCommandId.Split,
	TerminalCommandId.Toggle,
	TerminalCommandId.NavigationModeExit,
	TerminalCommandId.NavigationModeFocusNext,
	TerminalCommandId.NavigationModeFocusPrevious,
	'editor.action.toggleTabFocusMode',
	'workbench.action.quickOpen',
	'workbench.action.quickOpenPreviousEditor',
	'workbench.action.showCommands',
	'workbench.action.tasks.build',
	'workbench.action.tasks.restartTask',
	'workbench.action.tasks.runTask',
	'workbench.action.tasks.reRunTask',
	'workbench.action.tasks.showLog',
	'workbench.action.tasks.showTasks',
	'workbench.action.tasks.terminate',
	'workbench.action.tasks.test',
	'workbench.action.toggleFullScreen',
	'workbench.action.terminal.focusAtIndex1',
	'workbench.action.terminal.focusAtIndex2',
	'workbench.action.terminal.focusAtIndex3',
	'workbench.action.terminal.focusAtIndex4',
	'workbench.action.terminal.focusAtIndex5',
	'workbench.action.terminal.focusAtIndex6',
	'workbench.action.terminal.focusAtIndex7',
	'workbench.action.terminal.focusAtIndex8',
	'workbench.action.terminal.focusAtIndex9',
	'workbench.action.focusSecondEditorGroup',
	'workbench.action.focusThirdEditorGroup',
	'workbench.action.focusFourthEditorGroup',
	'workbench.action.focusFifthEditorGroup',
	'workbench.action.focusSixthEditorGroup',
	'workbench.action.focusSeventhEditorGroup',
	'workbench.action.focusEighthEditorGroup',
	'workbench.action.focusNextPart',
	'workbench.action.focusPreviousPart',
	'workbench.action.nextPanelView',
	'workbench.action.previousPanelView',
	'workbench.action.nextSideBarView',
	'workbench.action.previousSideBarView',
	'workbench.action.debug.start',
	'workbench.action.debug.stop',
	'workbench.action.debug.run',
	'workbench.action.debug.restart',
	'workbench.action.debug.continue',
	'workbench.action.debug.pause',
	'workbench.action.debug.stepInto',
	'workbench.action.debug.stepOut',
	'workbench.action.debug.stepOver',
	'workbench.action.nextEditor',
	'workbench.action.previousEditor',
	'workbench.action.nextEditorInGroup',
	'workbench.action.previousEditorInGroup',
	'workbench.action.openNextRecentlyUsedEditor',
	'workbench.action.openPreviousRecentlyUsedEditor',
	'workbench.action.openNextRecentlyUsedEditorInGroup',
	'workbench.action.openPreviousRecentlyUsedEditorInGroup',
	'workbench.action.quickOpenPreviousRecentlyUsedEditor',
	'workbench.action.quickOpenLeastRecentlyUsedEditor',
	'workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup',
	'workbench.action.quickOpenLeastRecentlyUsedEditorInGroup',
	'workbench.action.focusActiveEditorGroup',
	'workbench.action.focusFirstEditorGroup',
	'workbench.action.focusLastEditorGroup',
	'workbench.action.firstEditorInGroup',
	'workbench.action.lastEditorInGroup',
	'workbench.action.navigateUp',
	'workbench.action.navigateDown',
	'workbench.action.navigateRight',
	'workbench.action.navigateLeft',
	'workbench.action.togglePanel',
	'workbench.action.quickOpenView',
	'workbench.action.toggleMaximizedPanel'
];

export interface ITerminalContributions {
	types?: ITerminalTypeContribution[];
}

export interface ITerminalTypeContribution {
	title: string;
	command: string;
	icon?: string;
}

export const terminalContributionsDescriptor: IExtensionPointDescriptor = {
	extensionPoint: 'terminal',
	defaultExtensionKind: 'workspace',
	jsonSchema: {
		description: nls.localize('vscode.extension.contributes.terminal', 'Contributes terminal functionality.'),
		type: 'object',
		properties: {
			types: {
				type: 'array',
				description: nls.localize('vscode.extension.contributes.terminal.types', "Defines additional terminal types that the user can create."),
				items: {
					type: 'object',
					required: ['command', 'title'],
					properties: {
						command: {
							description: nls.localize('vscode.extension.contributes.terminal.types.command', "Command to execute when the user creates this type of terminal."),
							type: 'string',
						},
						title: {
							description: nls.localize('vscode.extension.contributes.terminal.types.title', "Title for this type of terminal."),
							type: 'string',
						},
						icon: {
							description: nls.localize('vscode.extension.contributes.terminal.types.icon', "A codicon to associate with this terminal type."),
							type: 'string',
						},
					},
				},
			},
		},
	},
};


text:
namespace KFS
{
namespace tools
{
using std::cin;
using std::cout;
using std::endl;
using std::map;
using std::vector;
using std::string;
using std::auto_ptr;
using std::getline;
using std::flush;

typedef map <string, cmdHandler> CmdHandlers;

static CmdHandlers handlers;

static void setupHandlers();

/// @retval: status code from executing the last command
static int processCmds(KfsClient *client, bool quietMode,
                       int nargs, const char **cmdLine);

static int
kfsshell_main(int argc, char **argv)
{
    string              serverHost;
    int                 port      = -1;
    bool                help      = false;
    bool                quietMode = false;
    MsgLogger::LogLevel logLevel  = MsgLogger::kLogLevelINFO;
    const char*         config    = 0;

    int optchar;
    while ((optchar = getopt(argc, argv, "hqs:p:vf:")) != -1) {
        switch (optchar) {
            case 's':
                serverHost = optarg;
                break;
            case 'p':
                port = atoi(optarg);
                break;
            case 'h':
                help = true;
                break;
            case 'v':
                logLevel = MsgLogger::kLogLevelDEBUG;
                break;
            case 'q':
                quietMode = true;
                break;
            case 'f':
                config = optarg;
                break;
            default:
                cout << "Unrecognized flag : " << char(optchar);
                help = true;
                break;
        }
    }

    if (help || serverHost.empty() || port <= 0) {
        cout << "Usage: " << argv[0] <<
            " -s <meta server name> -p <port> [-q [cmd]]"
            " [-f <config file name>]\n"
            "Starts an interactive client shell to QFS.\n"
            "  -q: switches to execution in quiet mode.\n"
            " cmd: command to execute, only in quiet mode.\n";
        return 1;
    }

    MsgLogger::Init(0, logLevel);
    KfsClient* const kfsClient = KfsClient::Connect(serverHost, port, config);
    if (! kfsClient) {
        cout << "qfs client failed to initialize\n";
        return 1;
    }
    auto_ptr<KfsClient> cleanup(kfsClient);
    setupHandlers();

    return processCmds(kfsClient, quietMode,
        argc - optind, (const char **) &argv[optind]) == 0 ? 0 : 1;
}

void printCmds()
{
    for (CmdHandlers::const_iterator
            it = handlers.begin(); it != handlers.end(); ++it) {
        cout << it->first << "\n";
    }
}

int handleHelp(KfsClient *client, const vector<string> &args)
{
    printCmds();
    return 0;
}

int handleExit(KfsClient *client, const vector<string> &args)
{
    exit(0);
    return 0;
}

void setupHandlers()
{
    handlers["cd"] = handleCd;
    handlers["changeReplication"] = handleChangeReplication;
    handlers["cp"] = handleCopy;
    handlers["ls"] = handleLs;
    handlers["mkdir"] = handleMkdirs;
    handlers["mv"] = handleMv;
    handlers["rmdir"] = handleRmdir;
    handlers["rm"] = handleRm;
    handlers["stat"] = handleFstat;
    handlers["pwd"] = handlePwd;
    handlers["help"] = handleHelp;
    handlers["append"] = handleAppend;
    handlers["finfo"] = fileInfo;
    handlers["cinfo"] = chunkInfo;
    handlers["chmod"] = handleChmod;
    handlers["chown"] = handleChown;
    handlers["chgrp"] = handleChgrp;
    handlers["quit"] = handleExit;
    handlers["exit"] = handleExit;
}

int processCmds(KfsClient *client, bool quietMode, int nargs, const char **cmdLine)
{
    string s, cmd;
    int retval = 0;

    for (; ;) {
        if (quietMode) {
            // Turn off prompt printing when quiet mode is enabled;
            // this allows scripting with KfsShell
            if (nargs <= 0) {
                break;
            }
            s.clear();
            for (int i = 0; i < nargs; i++) {
                if (! s.empty()) {
                    s += " ";
                }
                s += cmdLine[i];
            }
            nargs = 0;
        } else {
            cout << "QfsShell> " << flush;
            if (! getline(cin, s)) {
                break;
            }
        }

        // buf contains info of the form: <cmd>{<args>}
        // where, <cmd> is one of kfs cmds
        string::size_type curr;

        // get rid of leading spaces
        curr = s.find_first_not_of(" \t");
        s.erase(0, curr);
        curr = s.find(' ');
        if (curr != string::npos) {
            cmd.assign(s, 0, curr);
        } else {
            cmd = s;
        }
        // extract out the args
        vector<string> args;
        while (curr != string::npos) {
            string component;

            // curr points to a ' '
            curr++;
            const string::size_type next = s.find(' ', curr);
            if (next != string::npos)
                component.assign(s, curr, next - curr);
            else
                component.assign(s, curr, string::npos);

            if (component != "")
                args.push_back(component);
            curr = next;
        }

        CmdHandlers::const_iterator h = handlers.find(cmd);
        if (h == handlers.end()) {
            cout << "Unknown cmd: " << cmd << endl;
            cout << "Supported cmds are: " << endl;
            printCmds();
            cout << "Type <cmd name> --help for command specific help" << endl;
            continue;
        }

        retval = ((*h).second)(client, args);
    }
    return retval;
}
}} // KFS::tools

int
main(int argc, char **argv)
{
    return KFS::tools::kfsshell_main(argc, argv);
}


text:
<?php namespace Kodermax\Reviews;

use System\Classes\PluginBase;
use Backend;

/**
 * Reviews Plugin Information File
 */
class Plugin extends PluginBase
{

    /**
     * Returns information about this plugin.
     *
     * @return array
     */
    public function pluginDetails()
    {
        return [
            'name'        => 'kodermax.reviews::lang.plugin.name',
            'description' => 'kodermax.reviews::lang.plugin.description',
            'author'      => 'Maksim Karpychev',
            'icon'        => 'icon-list'
        ];
    }
    public function registerComponents()
    {
        return [
            'Kodermax\Reviews\Components\Reviews' => 'reviews',
            'Kodermax\Reviews\Components\Review' => 'review',
        ];
    }
    public function registerNavigation()
    {
        return [
            'reviews' => [
                'label' => 'kodermax.reviews::lang.menu.name',
                'url'   => Backend::url('kodermax/reviews/reviews'),
                'icon'        => 'icon-list',
                'permissions' => ['kodermax.*'],
                'order'       => 500,
            ],
        ];
    }
}


text:
Optimal HA-Proxy builder script

Prerequisites
> __on debian__
```bash
apt-get install wget gcc make libreadline-dev
```


text:
const checkAndBuildOpts = require('builder/helpers/required-opts');

const template = require('./import-database.tpl');
const UploadModel = require('builder/data/upload-model');
const ImportDataView = require('builder/components/modals/add-layer/content/imports/import-data/import-data-view');
const ConnectFormView = require('./import-database-connect-form-view');
const HeaderView = require('./import-database-header-view');
const headerTemplate = require('./import-database-header.tpl');
const QueryFormView = require('./import-database-query-form-view');
const SelectedDataset = require('./import-database-selected-dataset-view');

/**
 *  Import Databse
 *
 *  Main View for Import API DB Connectors
 */

const REQUIRED_OPTS = [
  'userModel',
  'configModel',
  'service'
];

module.exports = ImportDataView.extend({

  options: {
    fileExtensions: [],
    type: 'service',
    acceptSync: true,
    fileEnabled: false,
    fileAttrs: {
      ext: false,
      title: '',
      description: ''
    }
  },

  initialize: function (opts) {
    checkAndBuildOpts(opts, REQUIRED_OPTS, this);

    this._initModels();
    this._initBinds();
  },

  render: function () {
    this.clearSubViews();
    this.$el.html(template(this.options));
    this.model.set('state', 'idle');
    this._initViews();
    return this;
  },

  _initModels: function () {
    this.model = new UploadModel({
      type: this.options.type,
      service_name: this._service
    }, {
      userModel: this._userModel,
      configModel: this._configModel
    });
  },

  _initBinds: function () {
    this.model.unbind('change:state', this._checkState, this);
    this.model.unbind('change', this._triggerChange, this);

    this.model.bind('change:state', this._checkState, this);
    this.model.bind('change', this._triggerChange, this);
  },

  _initViews: function () {
    const connectformView = new ConnectFormView({
      el: this.$('.ImportPanel-connectForm'),
      userModel: this._userModel,
      model: this.model,
      configModel: this._configModel,
      title: this.options.title,
      service: this._service,
      params: this.options.params
    });
    connectformView.render();
    this.addView(connectformView);

    const headerView = new HeaderView({
      el: this.$('.ImportPanel-header'),
      model: this.model,
      userModel: this._userModel,
      collection: this.collection,
      fileEnabled: this.options.fileEnabled,
      acceptSync: this.options.acceptSync,
      title: this.options.title,
      template: headerTemplate
    });
    headerView.render();
    this.addView(headerView);

    // Data Form
    const formView = new QueryFormView({
      el: this.$('.ImportPanel-queryForm'),
      userModel: this._userModel,
      model: this.model,
      configModel: this._configModel,
      title: this.options.title,
      service: this.options.service,
      placeholder_query: this.options.placeholder_query,
      sql_hint: this.options.sql_hint
    });
    formView.render();
    this.addView(formView);

    // Dataset selected
    const selected = new SelectedDataset({
      el: this.$('.DatasetSelected'),
      userModel: this._userModel,
      model: this.model,
      acceptSync: this.options.acceptSync,
      fileAttrs: this.options.fileAttrs,
      configModel: this._configModel
    });
    selected.render();
    this.addView(selected);
  }
});


text:
<?php

namespace InfyOm\Generator\Commands\Scaffold;

use InfyOm\Generator\Commands\BaseCommand;
use InfyOm\Generator\Common\CommandData;
use InfyOm\Generator\Generators\Scaffold\RequestGenerator;

class RequestsGeneratorCommand extends BaseCommand
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'infyom.scaffold:requests';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create a full CRUD views for given model';

    /**
     * Create a new command instance.
     */
    public function __construct()
    {
        parent::__construct();

        $this->commandData = new CommandData($this, CommandData::$COMMAND_TYPE_SCAFFOLD);
    }

    /**
     * Execute the command.
     *
     * @return void
     */
    public function handle()
    {
        parent::handle();

        $requestGenerator = new RequestGenerator($this->commandData);
        $requestGenerator->generate();

        $this->performPostActions();
    }

    /**
     * Get the console command options.
     *
     * @return array
     */
    public function getOptions()
    {
        return array_merge(parent::getOptions(), []);
    }

    /**
     * Get the console command arguments.
     *
     * @return array
     */
    protected function getArguments()
    {
        return array_merge(parent::getArguments(), []);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.ProgramSynthesis;
using Microsoft.ProgramSynthesis.Rules;
using Microsoft.ProgramSynthesis.Specifications;
using RefazerFunctions.Spg.Config;
using TreeElement.Spg.Node;
using TreeElement.Token;

namespace RefazerFunctions.Spg.Witness
{
    public class Variable
    {
        /// <summary>
        /// Defines the back-propagation function of the kind parameter of the Abstract operator.
        /// </summary>
        /// <param name="rule">Grammar rule</param>
        /// <param name="spec">Specification</param>
        [SuppressMessage("ReSharper", "LoopCanBeConvertedToQuery")]
        [SuppressMessage("ReSharper", "ImplicitlyCapturedClosure")]
        public static DisjunctiveExamplesSpec VariableKindDisjunctive(GrammarRule rule, DisjunctiveExamplesSpec spec)
        {
            var treeExamples = new Dictionary<State, IEnumerable<object>>();
            var @intersect = spec.DisjunctiveExamples.First().Value.Cast<Tuple<TreeNode<SyntaxNodeOrToken>, int>>().Select(o => o.Item1.Value.Kind().ToString());
            foreach (State input in spec.ProvidedInputs)
            {
                var kinds = spec.DisjunctiveExamples[input].Cast<Tuple<TreeNode<SyntaxNodeOrToken>, int>>().Select(o => o.Item1.Value.Kind().ToString());
                @intersect = @intersect.Intersect(kinds);
            }
            var list = new List<object>();
            @intersect.ForEach(o => list.Add(o));
            list.Add(Token.Expression);

            spec.ProvidedInputs.ForEach(o => treeExamples[o] = list);
            return DisjunctiveExamplesSpec.From(treeExamples);
        }

        /// <summary>
        /// Defines the back-propagation function of the kind parameter of the Abstract operator.
        /// </summary>
        /// <param name="rule">Grammar</param>
        /// <param name="spec">Specification for Abstract operator</param>
        public static DisjunctiveExamplesSpec VariableKind(GrammarRule rule, ExampleSpec spec)
        {
            var matches = spec.Examples.Values.Cast<Tuple<TreeNode<SyntaxNodeOrToken>, int>>().ToList();
            var first = matches.First().Item1;
            //queries
            var isTypeEqual = matches.All(o => o.Item1.Value.Kind().ToString().Equals(first.Value.Kind().ToString()));
            if (SynthesisConfig.GetInstance().BoundGeneratedPrograms)
            {
                var isChildrenNumberEquals = matches.All(o => o.Item1.Children.Count == first.Children.Count);
                var hasChildren = first.Children.Any();
                if (isTypeEqual && isChildrenNumberEquals && hasChildren) return null;
            }
            var treeExamples = new Dictionary<State, IEnumerable<object>>();
            if (!isTypeEqual)
            {
                spec.ProvidedInputs.ForEach(o => treeExamples[o] = new List<object> { Token.Expression });
                return new DisjunctiveExamplesSpec(treeExamples);
            }
            spec.ProvidedInputs.ForEach(o => treeExamples[o] = new List<object> { first.Value.Kind().ToString()});
            if (!SynthesisConfig.GetInstance().BoundGeneratedPrograms)
            {
                spec.ProvidedInputs.ForEach(o => ((List<object>) treeExamples[o]).Add(Token.Expression));
            }
            return new DisjunctiveExamplesSpec(treeExamples);
        }
    }
}


text:
@interface NUIPBNFParserDelegate : NSObject <NUIPTokeniserDelegate,NUIPParserDelegate>

@property (readwrite, retain, nonatomic) NSError *err;

@end

@implementation NUIPBNFParserDelegate

@synthesize err = _err;

- (id)parser:(NUIPParser *)parser didProduceSyntaxTree:(NUIPSyntaxTree *)syntaxTree
{
    NSArray *children = [syntaxTree children];
    switch ([[syntaxTree rule] tag])
    {
        case 0:
        {
            NSMutableArray *rules = (NSMutableArray *)[children objectAtIndex:0];
            [rules addObjectsFromArray:[children objectAtIndex:1]];
            return rules;
        }
        case 1:
            return [NSMutableArray arrayWithArray:[children objectAtIndex:0]];
        case 2:
        {
            NSArray *rules = [children objectAtIndex:1];
            for (NUIPRule *r in rules)
            {
                [r setTag:[[(NUIPNumberToken *)[children objectAtIndex:0] number] intValue]];
            }
            return rules;
        }
        case 3:
            return [children objectAtIndex:0];
        case 4:
        {
            NSArray *arrs = [children objectAtIndex:2];
            NSMutableArray *rules = [NSMutableArray arrayWithCapacity:[arrs count]];
            for (NSArray *rhs in arrs)
            {
                NSString *name = [(NUIPIdentifierToken *)[children objectAtIndex:0] identifier];
                Class c = NSClassFromString(name);
                NUIPRule *rule = nil == c || ![c conformsToProtocol:@protocol(NUIPParseResult)] ? [NUIPRule ruleWithName:name rightHandSideElements:rhs] : [NUIPRule ruleWithName:name rightHandSideElements:rhs representitiveClass:c];
                [rules addObject:rule];
            }
            return rules;
        }
        case 5:
        {
            NSMutableArray *rhs = [children objectAtIndex:0];
            [rhs addObject:[children objectAtIndex:2]];
            return rhs;
        }
        case 6:
        {
            NSMutableArray *rhs = [children objectAtIndex:0];
            [rhs addObject:[NSArray array]];
            return rhs;
        }
        case 7:
            return [NSMutableArray arrayWithObject:[children objectAtIndex:0]];
        case 8:
        {
            NSMutableArray *elements = (NSMutableArray *)[children objectAtIndex:0];
            [elements addObject:[children objectAtIndex:1]];
            return elements;
        }
        case 9:
            return [NSMutableArray arrayWithObject:[children objectAtIndex:0]];
        case 10:
            return [children objectAtIndex:0];
        case 11:
        {
            id i = [children objectAtIndex:2];
            if ([i isRHSItem])
            {
                [(NUIPRHSItem *)i addTag:[[children objectAtIndex:0] identifier]];
                return i;
            }
            else
            {
                NUIPRHSItem *newI = [[[NUIPRHSItem alloc] init] autorelease];
                [newI setAlternatives:[NSArray arrayWithObject:[NSArray arrayWithObject:i]]];
                [newI setRepeats:NO];
                [newI setMayNotExist:NO];
                [newI addTag:[[children objectAtIndex:0] identifier]];
                [newI setShouldCollapse:YES];
                return newI;
            }
        }
        case 12:
            return [children objectAtIndex:0];
        case 13:
        {
            NUIPRHSItem *i = [[[NUIPRHSItem alloc] init] autorelease];
            [i setAlternatives:[NSArray arrayWithObject:[NSArray arrayWithObject:[children objectAtIndex:0]]]];
            NSString *symbol = [(NUIPKeywordToken *)[children objectAtIndex:1] keyword];
            if ([symbol isEqualToString:@"*"])
            {
                [i setRepeats:YES];
                [i setMayNotExist:YES];
            }
            else if ([symbol isEqualToString:@"+"])
            {
                [i setRepeats:YES];
                [i setMayNotExist:NO];
            }
            else
            {
                [i setRepeats:NO];
                [i setMayNotExist:YES];
            }
            return i;
        }
        case 14:
            return [children objectAtIndex:0];
        case 15:
        {
            NUIPRHSItem *i = [[[NUIPRHSItem alloc] init] autorelease];
            [i setAlternatives:[children objectAtIndex:1]];
            [i setRepeats:NO];
            [i setMayNotExist:NO];
            return i;
        }
        case 16:
        case 17:
        case 18:
        case 19:
        case 20:
            return [children objectAtIndex:0];
            return [children objectAtIndex:0];
        case 21:
            return [NUIPGrammarSymbol nonTerminalWithName:[(NUIPIdentifierToken *)[children objectAtIndex:1] identifier]];
        case 22:
            return [NUIPGrammarSymbol terminalWithName:[(NUIPQuotedToken *)[children objectAtIndex:0] content]];
        default:
            return syntaxTree;
    }
}

- (NUIPRecoveryAction *)parser:(NUIPParser *)parser didEncounterErrorOnInput:(NUIPTokenStream *)inputStream expecting:(NSSet *)acceptableTokens
{
    NUIPToken *t = [inputStream peekToken];
    [self setErr:[NSError errorWithDomain:NUIPEBNFParserErrorDomain
                                     code:NUIPErrorCodeCouldNotParseEBNF
                                 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
                                           [NSString stringWithFormat:@"Could not parse EBNF for grammar.  %ld:%ld: Found %@, Expected %@.", (long)[t lineNumber] + 1, (long)[t columnNumber] + 1, t, acceptableTokens], NSLocalizedDescriptionKey,
                                           nil]]];
    return [NUIPRecoveryAction recoveryActionStop];
}

- (BOOL)tokeniser:(NUIPTokeniser *)tokeniser shouldConsumeToken:(NUIPToken *)token
{
    return YES;
}

- (NSArray *)tokeniser:(NUIPTokeniser *)tokeniser willProduceToken:(NUIPToken *)token
{
    if ([token isWhiteSpaceToken])
    {
        return [NSArray array];
    }
    return [NSArray arrayWithObject:token];
}

@end

@implementation NUIPGrammar

@synthesize start;

+ (id)grammarWithStart:(NSString *)start rules:(NSArray *)rules
{
    return [[[self alloc] initWithStart:start rules:rules] autorelease];
}

- (id)initWithStart:(NSString *)initStart rules:(NSArray *)initRules;
{
    self = [super init];

    if (nil != self)
    {
        [self setStart:initStart];
        [self setRules:initRules];
        [self setFollowCache:[NSMutableDictionary dictionary]];
    }

    return self;
}

+ (id)grammarWithStart:(NSString *)start backusNaurForm:(NSString *)bnf
{
    return [[[self alloc] initWithStart:start backusNaurForm:bnf] autorelease];
}

+ (id)grammarWithStart:(NSString *)start backusNaurForm:(NSString *)bnf error:(NSError **)error
{
    return [[[self alloc] initWithStart:start backusNaurForm:bnf error:error] autorelease];
}

- (id)initWithStart:(NSString *)initStart backusNaurForm:(NSString *)bnf
{
    NSError *err = nil;
    self = [self initWithStart:initStart backusNaurForm:bnf error:&err];
    if (nil == self)
    {
        NSLog(@"=== Core Parse Error ===");
        NSLog(@"%@", err);
    }
    return self;
}

- (id)initWithStart:(NSString *)initStart backusNaurForm:(NSString *)bnf error:(NSError **)error
{
    NUIPBNFParserDelegate *del = [[[NUIPBNFParserDelegate alloc] init] autorelease];
    NUIPTokeniser *tokeniser = [[[NUIPTokeniser alloc] init] autorelease];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"::="]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"@"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"<"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@">"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"("]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@")"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"*"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"+"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"?"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@"|"]];
    [tokeniser addTokenRecogniser:[NUIPKeywordRecogniser recogniserForKeyword:@";"]];
    [tokeniser addTokenRecogniser:[NUIPNumberRecogniser integerRecogniser]];
    [tokeniser addTokenRecogniser:[NUIPQuotedRecogniser quotedRecogniserWithStartQuote:@"\"" endQuote:@"\"" escapeSequence:@"\\" name:@"String"]];
    [tokeniser addTokenRecogniser:[NUIPQuotedRecogniser quotedRecogniserWithStartQuote:@"'" endQuote:@"'" escapeSequence:@"\\" name:@"String"]];
    [tokeniser addTokenRecogniser:[NUIPIdentifierRecogniser identifierRecogniser]];
    [tokeniser addTokenRecogniser:[NUIPWhiteSpaceRecogniser whiteSpaceRecogniser]];
    [tokeniser setDelegate:del];
    NUIPTokenStream *tokenStream = [tokeniser tokenise:bnf];

    NUIPRule *ruleset1 = [NUIPRule ruleWithName:@"ruleset" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"ruleset"], [NUIPGrammarSymbol nonTerminalWithName:@"rule"], nil] tag:0];
    NUIPRule *ruleset2 = [NUIPRule ruleWithName:@"ruleset" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"rule"], nil] tag:1];

    NUIPRule *rule1 = [NUIPRule ruleWithName:@"rule" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol terminalWithName:@"Number"], [NUIPGrammarSymbol nonTerminalWithName:@"unNumbered"], nil] tag:2];
    NUIPRule *rule2 = [NUIPRule ruleWithName:@"rule" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"unNumbered"], nil] tag:3];

    NUIPRule *unNumbered = [NUIPRule ruleWithName:@"unNumbered" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol terminalWithName:@"Identifier"], [NUIPGrammarSymbol terminalWithName:@"::="], [NUIPGrammarSymbol nonTerminalWithName:@"rightHandSide"], [NUIPGrammarSymbol terminalWithName:@";"], nil] tag:4];

    NUIPRule *rightHandSide1 = [NUIPRule ruleWithName:@"rightHandSide" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"rightHandSide"], [NUIPGrammarSymbol terminalWithName:@"|"], [NUIPGrammarSymbol nonTerminalWithName:@"sumset"], nil] tag:5];
    NUIPRule *rightHandSide2 = [NUIPRule ruleWithName:@"rightHandSide" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"rightHandSide"], [NUIPGrammarSymbol terminalWithName:@"|"], nil] tag:6];
    NUIPRule *rightHandSide3 = [NUIPRule ruleWithName:@"rightHandSide" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"sumset"], nil] tag:7];

    NUIPRule *sumset1 = [NUIPRule ruleWithName:@"sumset" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"sumset"], [NUIPGrammarSymbol nonTerminalWithName:@"taggedRightHandSideItem"], nil] tag:8];
    NUIPRule *sumset2 = [NUIPRule ruleWithName:@"sumset" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"taggedRightHandSideItem"], nil] tag:9];

    NUIPRule *taggedRightHandSideItem1 = [NUIPRule ruleWithName:@"taggedRightHandSideItem" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"rightHandSideItem"], nil] tag:10];
    NUIPRule *taggedRightHandSideItem2 = [NUIPRule ruleWithName:@"taggedRightHandSideItem" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol terminalWithName:@"Identifier"], [NUIPGrammarSymbol terminalWithName:@"@"], [NUIPGrammarSymbol nonTerminalWithName:@"taggedRightHandSideItem"], nil] tag:11];

    NUIPRule *rightHandSideItem1 = [NUIPRule ruleWithName:@"rightHandSideItem" rightHandSideElements:[NSArray arrayWithObject:[NUIPGrammarSymbol nonTerminalWithName:@"unit"]] tag:12];
    NUIPRule *rightHandSideItem2 = [NUIPRule ruleWithName:@"rightHandSideItem" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"unit"], [NUIPGrammarSymbol nonTerminalWithName:@"repeatSymbol"], nil] tag:13];

    NUIPRule *unit1 = [NUIPRule ruleWithName:@"unit" rightHandSideElements:[NSArray arrayWithObject:[NUIPGrammarSymbol nonTerminalWithName:@"grammarSymbol"]] tag:14];
    NUIPRule *unit2 = [NUIPRule ruleWithName:@"unit" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol terminalWithName:@"("], [NUIPGrammarSymbol nonTerminalWithName:@"rightHandSide"], [NUIPGrammarSymbol terminalWithName:@")"], nil] tag:15];

    NUIPRule *repeatSymbol1 = [NUIPRule ruleWithName:@"repeatSymbol" rightHandSideElements:[NSArray arrayWithObject:[NUIPGrammarSymbol terminalWithName:@"*"]] tag:16];
    NUIPRule *repeatSymbol2 = [NUIPRule ruleWithName:@"repeatSymbol" rightHandSideElements:[NSArray arrayWithObject:[NUIPGrammarSymbol terminalWithName:@"+"]] tag:17];
    NUIPRule *repeatSymbol3 = [NUIPRule ruleWithName:@"repeatSymbol" rightHandSideElements:[NSArray arrayWithObject:[NUIPGrammarSymbol terminalWithName:@"?"]] tag:18];

    NUIPRule *grammarSymbol1 = [NUIPRule ruleWithName:@"grammarSymbol" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"nonterminal"], nil] tag:19];
    NUIPRule *grammarSymbol2 = [NUIPRule ruleWithName:@"grammarSymbol" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol nonTerminalWithName:@"terminal"], nil] tag:20];

    NUIPRule *nonterminal = [NUIPRule ruleWithName:@"nonterminal" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol terminalWithName:@"<"], [NUIPGrammarSymbol terminalWithName:@"Identifier"], [NUIPGrammarSymbol terminalWithName:@">"], nil] tag:21];

    NUIPRule *terminal = [NUIPRule ruleWithName:@"terminal" rightHandSideElements:[NSArray arrayWithObjects:[NUIPGrammarSymbol terminalWithName:@"String"], nil] tag:22];

    NUIPGrammar *bnfGrammar = [NUIPGrammar grammarWithStart:@"ruleset" rules:[NSArray arrayWithObjects:ruleset1, ruleset2, rule1, rule2, unNumbered, rightHandSide1, rightHandSide2, rightHandSide3, sumset1, sumset2, taggedRightHandSideItem1, taggedRightHandSideItem2, rightHandSideItem1, rightHandSideItem2, unit1, unit2, repeatSymbol1, repeatSymbol2, repeatSymbol3, grammarSymbol1, grammarSymbol2, nonterminal, terminal, nil]];
    NUIPParser *parser = [NUIPLALR1Parser parserWithGrammar:bnfGrammar];
    [parser setDelegate:del];

    NSMutableArray *initRules = [parser parse:tokenStream];

    if ([del err] != nil)
    {
        if (NULL != error)
        {
            *error = [[[del err] copy] autorelease];
        }
        [self release];
        return nil;
    }

    NSError *e = [self checkForMissingNonTerminalsInRules:initRules];
    if (nil != e)
    {
        if (NULL != error)
        {
            *error = e;
        }
        [self release];
        return nil;
    }

    NSArray *newRules = [self tidyRightHandSides:initRules error:error];
    if (nil == newRules)
    {
        [self release];
        return nil;
    }

    return [self initWithStart:initStart rules:newRules];
}

- (id)init
{
    return [self initWithStart:nil rules:[NSArray array]];
}

#define NUIPGrammarStartKey @"s"
#define NUIPGrammarRulesKey @"r"

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];

    if (nil != self)
    {
        [self setStart:[aDecoder decodeObjectForKey:NUIPGrammarStartKey]];
        [self setRules:[aDecoder decodeObjectForKey:NUIPGrammarRulesKey]];
    }

    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:[self start] forKey:NUIPGrammarStartKey];
    [aCoder encodeObject:[self rules] forKey:NUIPGrammarRulesKey];
}

- (void)dealloc
{
    [start release];
    [self setRules:nil];

    [super dealloc];
}

- (NSSet *)allRules
{
        return [NSSet setWithArray:[self rules]];
}

- (NSError *)checkForMissingNonTerminalsInRules:(NSArray *)rules
{
    NSMutableSet *definedNonTerminals = [NSMutableSet setWithCapacity:[rules count]];
    for (NUIPRule *rule in rules)
    {
        [definedNonTerminals addObject:[rule ruleName]];
    }

    for (NUIPRule *rule in rules)
    {
        for (id item in [rule rightHandSideElements])
        {
            if ([item isGrammarSymbol] && ![(NUIPGrammarSymbol *)item isTerminal] && ![definedNonTerminals containsObject:[(NUIPGrammarSymbol *)item name]])
            {
                return [NSError errorWithDomain:NUIPEBNFParserErrorDomain
                                           code:NUIPErrorCodeUndefinedNonTerminal
                                       userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
                                                 [NSString stringWithFormat:@"Could not find definition of %@, used in %@", [item name], rule], NSLocalizedDescriptionKey,
                                                 nil]];
            }
            else if ([item isRHSItem])
            {
                NSSet *usedNonTerminals = [(NUIPRHSItem *)item nonTerminalsUsed];
                if (![usedNonTerminals isSubsetOfSet:definedNonTerminals])
                {
                    NSMutableSet *mutableUsedNonTerminals = [[usedNonTerminals mutableCopy] autorelease];
                    [mutableUsedNonTerminals minusSet:definedNonTerminals];
                    return [NSError errorWithDomain:NUIPEBNFParserErrorDomain
                                               code:NUIPErrorCodeUndefinedNonTerminal
                                           userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
                                                     [NSString stringWithFormat:@"Could not find definition of %@, used in %@", [mutableUsedNonTerminals anyObject], rule], NSLocalizedDescriptionKey,
                                                     nil]];
                }
            }
        }
    }

    return nil;
}

- (NSArray *)allNonTerminalNames
{
    return [[self rulesByNonTerminal] allKeys];
}

- (void)addRule:(NUIPRule *)rule
{
    NSMutableDictionary *rs = [self rulesByNonTerminal];
    NSMutableArray *arr = [rs objectForKey:[rule ruleName]];
    if (nil == arr)
    {
        arr = [NSMutableArray array];
        [rs setObject:arr forKey:[rule ruleName]];
    }
    [arr addObject:rule];
}

- (NSArray *)rulesForNonTerminalWithName:(NSString *)nonTerminal
{
    return [[self rulesByNonTerminal] objectForKey:nonTerminal];
}

- (NSUInteger)hash
{
    return [[self start] hash] ^ [[self rules] hash];
}

- (BOOL)isGrammar
{
    return YES;
}

- (BOOL)isEqual:(id)object
{
    return ([object isGrammar] &&
            [((NUIPGrammar *)object)->start isEqualToString:start] &&
            [[(NUIPGrammar *)object rules] isEqualToArray:[self rules]]);
}

@end


text:
<?php

require_once('classes/user.php');
require_once('includes/include.php');

$locationTitle = 'Gestion des utilisateurs';

if (isset($_POST['targetUser'])) {
	$targetUser = new User($_POST['targetUser']);
};

//INSERTIONS EN BASE DE DONNEE DU FORMULAIRE
if(isset($_POST['public_name'])){
	//VERIFICATION PHP DES DONNEES ENVOYEES
	if( empty(trim($_POST['public_name'])) || empty(trim($_POST['public_surname'])) || empty(trim($_POST['function'])) || empty(trim($_POST['email'])) ){
		$actionResultat = '

				×

Erreur ! Il est nécéssaire de remplir tout les champs du formulaire.

';
	}
	else{
		if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == FALSE) {
			$actionResultat = '

				×

Erreur ! Vous devez saisir une adresse mail valide.

';
		}
		else{
			if(!empty($_POST['id'])){
				$targetUser = new User($_POST['id']);
				$targetUser->setPublicName($_POST['public_name']);
				$targetUser->setPublicSurname($_POST['public_surname']);
				$targetUser->setFunction($_POST['function']);
				$targetUser->setLogin($_POST['login']);
				$targetUser->setEmailAdress($_POST['email']);
				$targetUser->setStatus($_POST['status']);
				$updateUser = $targetUser->synchroDb('', '');

				if ($updateUser) {
					$actionResultat = '

					×

Félicitation ! L\'utilisateur a bien été modifié. Merci de patienter, un e-mail de confirmation est en cours d\'envoi.

';
				}
				else{
					$actionResultat = '

					×

Erreur ! L\'utilisateur n\'a pas été modifié.

';
		   		 }
			}
			else{
				$newUser = new User();
				$newUser->setPublicName($_POST['public_name']);
				$newUser->setPublicSurname($_POST['public_surname']);
				$newUser->setFunction($_POST['function']);
				$newUser->setLogin($_POST['login']);
				$newUser->setEmailAdress($_POST['email']);
				$newUser->setStatus($_POST['status']);
				$addUser = $newUser->synchroDb('','');

				if ($addUser) {
					$actionResultat = '

					×

Félicitation ! L\'utilisateur a bien été enregistré. Merci de patienter, un e-mail de confirmation est en cours d\'envoi.

';
				}
				else{
					$actionResultat = '

					×

Erreur ! L\'utilisateur n\'a pas été enregistré.

';
				};
			};
		}
	}
};

if(isset($_POST['action']) && $_POST['action'] == 'resetPassword'){
	$targetUser = new User($_POST['id']);
	$resetPassword = $targetUser->resetPassword();
	if ($resetPassword) {
		$actionResultat = '

		×

Vous venez de réinitialiser le mot de passe de '.$targetUser->getPublicName().' '.$targetUser->getPublicSurname().'. Merci de patienter, un e-mail de confirmation est en cours d\'envoi.

';
	}
	else{
		$actionResultat = '

		×

Erreur ! le mot de passe de l\'utilisateur n\'a pas pu être réinitialiser.

';
	}
}

if(isset($_POST['password'])){
	$delete = $currentUser->deleteUser($_POST['password'], $_POST['targetId']);

	if ($delete) {
		$actionResultat = '

		×

Félicitation ! L\'utilisateur a bien été supprimé.

';
	}
	else{
		$actionResultat = '

		×

Erreur ! Votre mot de passe ne correspond pas. L\'utilisateur n\'a pas pu été supprimé.

';
	}
}

include('header.php');

?>

		<?= !empty($actionResultat)?$actionResultat:''; ?>

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Attention!

            <?php if(isset($targetUser)){
            	if($targetUser->getStatus() == 0){
            		?>

Vous ne pouvez pas supprimer un administrateur !

Si vous souhaitez vraiment supprimer le compte de <?= $targetUser->getPublicName(); ?> <?= $targetUser->getPublicSurname(); ?>, vous devez d'abord changer son statut.

            		<?php
            	}
            	else{
            		?>

 Vous êtes sur le point de supprimer définitivement le compte de <?= $targetUser->getPublicName(); ?> <?= $targetUser->getPublicSurname(); ?>.

 Pour valider la suppression, veuillez saisir votre mot de passe.

                	<form action="users_management.php" method="post" class="form-inline clearfix">

	                		Mot de passe :
	                		<input type="password" name="password" placeholder="Votre mot de passe" class="form-control" required />

                		<input type="hidden" value="<?= isset($targetUser)?$targetUser->getId():';' ?>" name="targetId">
                		<input type="submit" value="Supprimer" class="btn btn-danger pull-right" />
					</form>
            		<?php
            	}
            }?>

                <button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>

Liste des utilisateurs

						Utilisateur
						Fonction
						Email
						Dernière connexion
						Actions

				<?php
					$liste = User::listUsers();
					foreach ($liste as $l) {
				?>

							<span class="<?= $l->getStatus() == 0?'fa fa-star':'fa fa-user'; ?>">
							<?= $l->getPublicName(); ?> <?= $l->getPublicSurname(); ?>

							<?= $l->getFunction(); ?>

							<?= $l->getEmailAdress(); ?>

							<?= !empty($l->getLastConnection())?dateFormat($l->getLastConnection()):'Aucune connexion'; ?>

								<select class="form-control actionUser">
									<option> --- </option>
									<option value="update" data-id="<?= $l->getId(); ?>">Modifier</option>
									<option value="delete" data-id="<?= $l->getId(); ?>" >Supprimer</option>
								</select>

				<?php
					};
				?>

				<a href="<?= URL_ADMIN ?>users_management.php" class="btn btn-default btn-lg btn-custom"> Ajouter un utilisateur

		 <?php
			if(isset($targetUser)){
				$targetUser->form(URL_ADMIN.'users_management.php', 'Modifier', 'Modifier un utilisateur :', 'edit');
				?>
				<form action="<?= URL_ADMIN; ?>users_management.php" method="POST" id="reset-password">
					<input type="hidden" name="action" value="resetPassword">
					<input type="hidden" name="id" value="<?= $targetUser->getId(); ?>" />
					<input type="submit" value="Réinitialiser le mot de passe" class="btn btn-warning btn-md" />
				</form>
			<?php
			}
			else{

				$user = new User();
				$user->form(URL_ADMIN.'users_management.php','Créer', 'Créer un utilisateur :', 'add');

			}
		?>

<?php
include('footer.php');


text:
#ifndef ENSCOORDSYSTEM_H
#define ENSCOORDSYSTEM_H

/* ========================================================================= */
/* ============================= include files ============================= */
/* ========================================================================= */

#include "ensdatabaseadaptor.h"

AJ_BEGIN_DECLS

/* ========================================================================= */
/* =============================== constants =============================== */
/* ========================================================================= */

/* ========================================================================= */
/* ============================== public data ============================== */
/* ========================================================================= */

struct EnsSCoordsystem;

/* @data EnsPCoordsystemadaptor ***********************************************
**
** Ensembl Coordinate System Adaptor
**
** @alias EnsSCoordsystemadaptor
** @alias EnsOCoordsystemadaptor
**
** @cc Bio::EnsEMBL::DBSQL::BaseAdaptor
** @attr Adaptor [EnsPDatabaseadaptor] Ensembl Database Adaptor
** cc Bio::EnsEMBL::DBSQL::CoordSystemAdaptor
** @attr CacheByIdentifier [AjPTable] Database identifier cache
** @attr CacheByName [AjPTable] Name cache
** @attr CacheByRank [AjPTable] Rank cache
** @attr CacheByDefault [AjPTable] Default Ensembl Coordinate System objects
** @attr MappingPaths [AjPTable] Mapping paths between coordinate systems
** @attr ExternalToInternal [AjPTable]
** AJAX Table of AJAX unsigned integer
** (external Ensembl Sequence Region identifier) key data and
** AJAX unsigned integer
** (internal Ensembl Sequence Region identifier) value data
** @attr InternalToExternal [AjPTable]
** AJAX Table of AJAX unsigned integer
** (internal Ensembl Sequence Region identifier) key data and
** AJAX unsigned integer
** (external Ensembl Sequence Region identifier) value data
** @attr Seqlevel [struct EnsSCoordsystem*]
** Sequence-level Ensembl Coordinate System
** @attr Toplevel [struct EnsSCoordsystem*]
** Top-level Ensembl Coordinate System
** @@
******************************************************************************/

typedef struct EnsSCoordsystemadaptor
{
    EnsPDatabaseadaptor Adaptor;
    AjPTable CacheByIdentifier;
    AjPTable CacheByName;
    AjPTable CacheByRank;
    AjPTable CacheByDefault;
    AjPTable MappingPaths;
    AjPTable ExternalToInternal;
    AjPTable InternalToExternal;
    struct EnsSCoordsystem *Seqlevel;
    struct EnsSCoordsystem *Toplevel;
} EnsOCoordsystemadaptor;

#define EnsPCoordsystemadaptor EnsOCoordsystemadaptor*

/* @data EnsPCoordsystem ******************************************************
**
** Ensembl Coordinate System
**
** @alias EnsSCoordsystem
** @alias EnsOCoordsystem
**
** @attr Use [ajuint] Use counter
** @cc Bio::EnsEMBL::Storable
** @attr Identifier [ajuint] Internal SQL database identifier (primary key)
** @attr Adaptor [EnsPCoordsystemadaptor] Ensembl Coordinate System Adaptor
** @cc Bio::EnsEMBL::CoordSystem
** @attr Name [AjPStr] Coordinate System name
** @attr Version [AjPStr] Coordinate System version
** @attr Default [AjBool] Default Coordinate System version of this name
** @attr SequenceLevel [AjBool] Sequence-level attribute
** @attr Toplevel [AjBool] Top-level attribute
** @attr Rank [ajuint] Coordinate System rank
** @@
******************************************************************************/

typedef struct EnsSCoordsystem
{
    ajuint Use;
    ajuint Identifier;
    EnsPCoordsystemadaptor Adaptor;
    AjPStr Name;
    AjPStr Version;
    AjBool Default;
    AjBool SequenceLevel;
    AjBool Toplevel;
    ajuint Rank;
} EnsOCoordsystem;

#define EnsPCoordsystem EnsOCoordsystem*

/* ========================================================================= */
/* =========================== public functions ============================ */
/* ========================================================================= */

/*
** Prototype definitions
*/

/* Ensembl Coordinate System */

EnsPCoordsystem ensCoordsystemNewCpy(const EnsPCoordsystem cs);

EnsPCoordsystem ensCoordsystemNewIni(EnsPCoordsystemadaptor csa,
                                     ajuint identifier,
                                     AjPStr name,
                                     AjPStr version,
                                     ajuint rank,
                                     AjBool deflt,
                                     AjBool toplvl,
                                     AjBool seqlvl);

EnsPCoordsystem ensCoordsystemNewRef(EnsPCoordsystem cs);

void ensCoordsystemDel(EnsPCoordsystem *Pcs);

EnsPCoordsystemadaptor ensCoordsystemGetAdaptor(const EnsPCoordsystem cs);

AjBool ensCoordsystemGetDefault(const EnsPCoordsystem cs);

ajuint ensCoordsystemGetIdentifier(const EnsPCoordsystem cs);

const AjPStr ensCoordsystemGetName(const EnsPCoordsystem cs);

ajuint ensCoordsystemGetRank(const EnsPCoordsystem cs);

AjBool ensCoordsystemGetSeqlevel(const EnsPCoordsystem cs);

AjBool ensCoordsystemGetToplevel(const EnsPCoordsystem cs);

const AjPStr ensCoordsystemGetVersion(const EnsPCoordsystem cs);

AjBool ensCoordsystemSetAdaptor(EnsPCoordsystem cs,
                                EnsPCoordsystemadaptor csa);

AjBool ensCoordsystemSetIdentifier(EnsPCoordsystem cs, ajuint identifier);

AjBool ensCoordsystemTrace(const EnsPCoordsystem cs, ajuint level);

size_t ensCoordsystemCalculateMemsize(const EnsPCoordsystem cs);

AjBool ensCoordsystemMatch(const EnsPCoordsystem cs1,
                           const EnsPCoordsystem cs2);

AjPStr ensCoordsystemGetSpecies(const EnsPCoordsystem cs);

AjBool ensListCoordsystemSortIdentifierAscending(AjPList css);

AjBool ensListCoordsystemSortIdentifierDescending(AjPList css);

AjBool ensListCoordsystemSortRankAscending(AjPList css);

AjBool ensListCoordsystemSortRankDescending(AjPList css);

AjBool ensListCoordsystemTrace(const AjPList css, ajuint level);

/* Ensembl Coordinate System Adaptor */

EnsPCoordsystemadaptor ensRegistryGetCoordsystemadaptor(
    EnsPDatabaseadaptor dba);

EnsPCoordsystemadaptor ensCoordsystemadaptorNew(
    EnsPDatabaseadaptor dba);

void ensCoordsystemadaptorDel(EnsPCoordsystemadaptor *Pcsa);

EnsPDatabaseadaptor ensCoordsystemadaptorGetDatabaseadaptor(
    EnsPCoordsystemadaptor csa);

AjBool ensCoordsystemadaptorFetchAll(
    const EnsPCoordsystemadaptor csa,
    AjPList css);

AjBool ensCoordsystemadaptorFetchAllbyName(
    const EnsPCoordsystemadaptor csa,
    const AjPStr name,
    AjPList css);

AjBool ensCoordsystemadaptorFetchByIdentifier(
    const EnsPCoordsystemadaptor csa,
    ajuint identifier,
    EnsPCoordsystem *Pcs);

AjBool ensCoordsystemadaptorFetchByName(
    const EnsPCoordsystemadaptor csa,
    const AjPStr name,
    const AjPStr version,
    EnsPCoordsystem *Pcs);

AjBool ensCoordsystemadaptorFetchByRank(
    const EnsPCoordsystemadaptor csa,
    ajuint rank,
    EnsPCoordsystem *Pcs);

AjBool ensCoordsystemadaptorFetchSeqlevel(
    const EnsPCoordsystemadaptor csa,
    EnsPCoordsystem *Pcs);

AjBool ensCoordsystemadaptorFetchToplevel(
    const EnsPCoordsystemadaptor csa,
    EnsPCoordsystem *Pcs);

const AjPList ensCoordsystemadaptorGetMappingpath(
    const EnsPCoordsystemadaptor csa,
    EnsPCoordsystem cs1,
    EnsPCoordsystem cs2);

ajuint ensCoordsystemadaptorGetSeqregionidentifierExternal(
    const EnsPCoordsystemadaptor csa,
    ajuint srid);

ajuint ensCoordsystemadaptorGetSeqregionidentifierInternal(
    const EnsPCoordsystemadaptor csa,
    ajuint srid);

/*
** End of prototype definitions
*/

AJ_END_DECLS

#endif /* !ENSCOORDSYSTEM_H */


text:
<?php
function testVisitorInvokesStartVisitParameterOnListener($foo, $bar)
{

}