text:
// Copyright (C) 2010, 2011 and 2012 Marcin Arkadiusz Skrobiranda.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. Neither the name of the project nor the names of its contributors
//    may be used to endorse or promote products derived from this software
//    without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.

#ifndef GAMESERVER_PERSISTENCE_IPERSISTENCE_HPP
#define GAMESERVER_PERSISTENCE_IPERSISTENCE_HPP

#include <Game/GameServer/Persistence/IConnection.hpp>
#include <Game/GameServer/Persistence/ITransaction.hpp>

namespace GameServer
{
namespace Persistence
{

/**
 * @brief The interface of persistence.
 */
class IPersistence
{
public:
    virtual ~IPersistence(){};

    /**
     * @brief Gets the connection.
     *
     * @return The connection.
     */
    virtual IConnectionShrPtr getConnection() = 0;

    /**
     * @brief Gets a transaction.
     *
     * @param a_connection The connection that transaction bases upon.
     *
     * @return The transaction.
     */
    virtual ITransactionShrPtr getTransaction(
        IConnectionShrPtr a_connection
    ) = 0;
};

/**
 * @brief The shared pointer of the interface of persistence.
 */
typedef boost::shared_ptr<IPersistence> IPersistenceShrPtr;

} // namespace Persistence
} // namespace GameServer

#endif // GAMESERVER_PERSISTENCE_PERSISTENCE_HPP


text:
import json
from json import JSONDecodeError

from dojo.models import Finding

class OssIndexDevauditParser(object):
    """OssIndex Devaudit Results Parser
    Parses files created by the Sonatype OssIndex Devaudit tool
    https://github.com/sonatype-nexus-community/DevAudit
    """

    def get_scan_types(self):
        return ["OssIndex Devaudit SCA Scan Importer"]

    def get_label_for_scan_types(self, scan_type):
        return scan_type  # no custom label for now

    def get_description_for_scan_types(self, scan_type):
        return "Import OssIndex Devaudit SCA Scan in json format."

    def get_findings(self, json_file, test):

        tree = self.parse_json(json_file)

        if tree:
            return list([data for data in self.get_items(tree, test)])
        else:
            return list()

    def parse_json(self, json_file):
        if json_file is None:
            return None
        try:
            tree = json.load(json_file)
        except JSONDecodeError:
            raise Exception("Invalid format")

        return tree

    def get_items(self, tree, test):

        items = {}

        results = {key: value for (key, value) in tree.items()}
        for package in results.get('Packages', []):
            package_data = package['Package']
            if len(package.get('Vulnerabilities', [])) > 0:
                for vulnerability in package.get('Vulnerabilities', []):
                    item = get_item(
                        dependency_name=package_data['name'],
                        dependency_version=package_data['version'],
                        dependency_source=package_data['pm'],
                        vulnerability=vulnerability,
                        test=test
                    )
                    unique_key = vulnerability['id']
                    items[unique_key] = item

        return items.values()

def get_item(dependency_name, dependency_version, dependency_source, vulnerability, test):

    cwe_data = vulnerability.get('cwe', 'CWE-1035')
    if cwe_data is None or cwe_data.startswith('CWE') is False:
        cwe_data = 'CWE-1035'
    try:
        cwe = int(cwe_data.split('-')[1])
    except ValueError:
        raise ValueError('Attempting to convert the CWE value to an integer failed')

    finding = Finding(title=dependency_source + ":" + dependency_name + " - " + "(" + dependency_version + ", " + cwe_data + ")",
                      test=test,
                      severity=get_severity(vulnerability.get('cvssScore', '')),
                      description=vulnerability['title'],
                      cwe=cwe,
                      cvssv3=vulnerability['cvssVector'].replace('CVSS:3.0', ''),
                      mitigation='Upgrade the component to the latest non-vulnerable version, or remove the package if it is not in use.',
                      references=vulnerability.get('reference', ''),
                      false_p=False,
                      duplicate=False,
                      out_of_scope=False,
                      mitigated=None,
                      static_finding=False,
                      dynamic_finding=False,
                      impact="No impact provided by scan")

    return finding

def get_severity(cvss_score):

    result = 'Info'

    if cvss_score != "":
        ratings = [
            ('Critical', 9.0, 10.0),
            ('High', 7.0, 8.9),
            ('Medium', 4.0, 6.9),
            ('Low', 0.1, 3.9)
        ]

        for severity, low, high in ratings:
            if low <= float(cvss_score) <= high:
                result = severity

    return result

redpajama_set_name: RedPajamaGithub


text:
    /*
    *     main query widget
    *
    *     basic idea of UI - user interacts with natural language sentence, not with a web form,
    *     and get immediate responce after constructing and sending queries
    *     responce is in the form of 2 numbers: for volume and amount of deals returned by her query
    *     if she wants more details she click on these numbers( and we will send additional resource consuming
    *	  queries to back-end)
    *
    *     inspired by Bret Victor and his Tangle.js
    *     cc by @dvrnd, 2012
    */
	var query;  // tis is our main Tangle object, here we collect all info about query
	// var active_color = 'black';
	// var inactive_color = '#bebebe';
	var active_class = 'active';
	var inactive_class = 'inactive';

        // format for millions
        Tangle.formats.millions = function (value) {     // formats 0.42 as "42%"
          return "" + Math.round(value / 10000 )/100;
        };

	// correct ua linguistic for monthes
        function time_name_ua(monthes){
          if( monthes % 100 > 9 && monthes % 100 < 21  ) return 'місяців';
	  switch(monthes % 10){
	    case 1:
 		return "місяць";
	    case 2:
            case 3:
            case 4:
 		return "місяці";
	    default:
 		return "місяців";
	  }
	}

	// switch on/off part of sentence ('у яких держгроші...')
	function change_dependent_text_status(clas, is_active, is_other_active){
		$(clas).removeClass(active_class).removeClass(inactive_class);
	        if(is_active){
		  // ... trying to switch off
	 	  $(clas).addClass(is_other_active ? active_class : inactive_class );
		} else {
		  // switch on
	 	  $(clas).addClass(active_class);
		}
        }
 	// switch status for condition and change color
	function flag_und_style(flagVar, element, query){
                    var is_active = query.getValue(flagVar);
					$(element).removeClass(active_class).removeClass(inactive_class);
                    $(element).addClass(is_active == 1 ? inactive_class : active_class );
                    query.setValue( flagVar, is_active == 1 ? 0 : 1 );
	}
	// produce function for click-logic of simple condition (ie "пов'язані з (галузь)")
	function change_condition_status(element, flagVar, query){
		return function(){
		    var is_active = query.getValue(flagVar);
                    flag_und_style(flagVar, element, query);
		};
	}

	// produce function for click-logic of paired condition (ie "пройшли ... через (установу)")
	function change_composite_status(element, dependent_element, flag, other_flag, query){
                return function(){
                    var is_other_active = query.getValue(other_flag);
                    var is_active = query.getValue(flag);
		    change_dependent_text_status(dependent_element, is_active, is_other_active);
                    flag_und_style(flag, element, query);
		};
	}

        /* autocomplete input box half-married to Tangle object */

         // male input box to add ajax autocomplete later
         function create_input(anchor, input_id, value){
		var in_box = new Element('input',
			{'id': input_id,
			'type': 'text',
			'autocomplete': 'off',
			'value': value }
		).inject($(anchor), 'after'); // find parental div container
               // block click events on input box
               in_box.addEvent('click', function(e){  e.stopPropagation();  })
       }
       // destroy string with old(previous) search result, create input box
       // this function 'flicks', ie it inserts reference on self (by 'flick' var) for next click
       var flick = function( stat_str_id, input_id, anchor, tangle, tangle_var, url){
                current = $(stat_str_id); // make elem from id

                create_input(anchor, input_id, current.get('text'));

		// choose what to search for? seller or buyer?
		if(tangle_var == 'dealBuyerId'){
		   var post_param = 'buyer';
		} else {
		   var post_param = 'seller';
		}

		// create instance of autocompleter based on upper inputbox
		ac = new CwAutocompleter( input_id , url + '/actor',
                  { ajaxMethod: 'post', // use get or post for the request?
		    ajaxParam: post_param, // who to search, seller or buyer?
 		   // targetfieldForKey: 'any_id',   // TODO: make sense of it, maybe with tangle

		    onChoose: function(selection) {
		      //console_log("You selected: " + selection.value + " (" + selection.key + ")");

                      // update tangle  object    magical-mistical connection to tangle (I know it's ugly, bro)
                      tangle.setValue(tangle_var, selection.key);

		      // revert: get search result, make span with string from it (selection.value)
                      var in_str = new Element('span',
			    {'id': stat_str_id,
			      'text': selection.value,
			      'class': 'input_complete'
		      });

		      // on future click, make input box again
                      in_str.addEvent('click', function(e){
					e.stopPropagation();
					flick(stat_str_id, input_id, anchor, tangle, tangle_var, url);
		      });
                      in_str.inject($(input_id).getPrevious(), 'after'); // inject after anchor

                      // destroy input box
                      $(input_id).destroy();
                      // kludge to remove hidden list of choices, this magic constant is from cwcompleter.js
                      $(document.body).getElement('div.cwCompleteOuter').destroy();

		   }

                   // temporary stub instead of AJAX requests
		   //doRetrieveValues: function(input) {
		   //   return [['1','example'], ['2','something else']];
		   //}
		});

		// destroy span with string
		current.destroy();
       };

       // eof search input boxes with autocomplete


text:
from setuptools import setup

setup(name='servicemanager',
      version='0.0.30',
      description='A python tool to manage developing and testing with lots of microservices',
      url='https://github.com/hmrc/service-manager',
      author='vaughansharman',
      license='Apache Licence 2.0',
      packages=['servicemanager', 'servicemanager.actions', 'servicemanager.server', 'servicemanager.service', 'servicemanager.thirdparty'],
      install_requires=['requests==2.2.1','pymongo==2.6.3','bottle==0.12.4','pytest==2.5.2','argcomplete==0.8.1'],
      scripts=['bin/sm', 'bin/smserver'],
      zip_safe=False)


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#ifndef NATIVE_EXTENSION_VTK_VTKIMAGEMIRRORPADWRAP_H
#define NATIVE_EXTENSION_VTK_VTKIMAGEMIRRORPADWRAP_H

#include <nan.h>

#include <vtkSmartPointer.h>
#include <vtkImageMirrorPad.h>

#include "vtkImagePadFilterWrap.h"
#include "../../plus/plus.h"

class VtkImageMirrorPadWrap : public VtkImagePadFilterWrap
{
	public:
		using Nan::ObjectWrap::Wrap;
		static void Init(v8::Local<v8::Object> exports);
		static void InitPtpl();
		static void ConstructorGetter(
			v8::Local<v8::String> property,
			const Nan::PropertyCallbackInfo<v8::Value>& info);

		VtkImageMirrorPadWrap(vtkSmartPointer<vtkImageMirrorPad>);
		VtkImageMirrorPadWrap();
		~VtkImageMirrorPadWrap( );
		static Nan::Persistent<v8::FunctionTemplate> ptpl;

	private:
		static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);

		static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info);

#ifdef VTK_NODE_PLUS_VTKIMAGEMIRRORPADWRAP_CLASSDEF
		VTK_NODE_PLUS_VTKIMAGEMIRRORPADWRAP_CLASSDEF
#endif
};

#endif


text: Just so I can read a comic without paging :P


text:
/* Declare all functions and types used by gigi.  */

/* The largest alignment, in bits, that is needed for using the widest
   move instruction.  */
extern unsigned int largest_move_alignment;

/* Compute the alignment of the largest mode that can be used for copying
   objects.  */
extern void gnat_compute_largest_alignment (void);

/* GNU_TYPE is a type. Determine if it should be passed by reference by
   default.  */
extern bool default_pass_by_ref (tree gnu_type);

/* GNU_TYPE is the type of a subprogram parameter.  Determine from the type
   if it should be passed by reference.  */
extern bool must_pass_by_ref (tree gnu_type);

/* Initialize DUMMY_NODE_TABLE.  */
extern void init_dummy_type (void);

/* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada
   entity, this routine returns the equivalent GCC tree for that entity
   (an ..._DECL node) and associates the ..._DECL node with the input GNAT
   defining identifier.

   If GNAT_ENTITY is a variable or a constant declaration, GNU_EXPR gives its
   initial value (in GCC tree form). This is optional for variables.
   For renamed entities, GNU_EXPR gives the object being renamed.

   DEFINITION is nonzero if this call is intended for a definition.  This is
   used for separate compilation where it necessary to know whether an
   external declaration or a definition should be created if the GCC equivalent
   was not created previously.  The value of 1 is normally used for a nonzero
   DEFINITION, but a value of 2 is used in special circumstances, defined in
   the code.  */
extern tree gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr,
                                int definition);

/* Similar, but if the returned value is a COMPONENT_REF, return the
   FIELD_DECL.  */
extern tree gnat_to_gnu_field_decl (Entity_Id gnat_entity);

/* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a
   GCC type corresponding to that entity.  GNAT_ENTITY is assumed to
   refer to an Ada type.  */
extern tree gnat_to_gnu_type (Entity_Id gnat_entity);

/* Add GNU_STMT to the current BLOCK_STMT node.  */
extern void add_stmt (tree gnu_stmt);

/* Similar, but set the location of GNU_STMT to that of GNAT_NODE.  */
extern void add_stmt_with_node (tree gnu_stmt, Node_Id gnat_node);

/* Set the BLOCK node corresponding to the current code group to GNU_BLOCK.  */
extern void set_block_for_group (tree);

/* Add a declaration statement for GNU_DECL to the current BLOCK_STMT node.
   Get SLOC from GNAT_ENTITY.  */
extern void add_decl_expr (tree gnu_decl, Entity_Id gnat_entity);

/* Given GNAT_ENTITY, elaborate all expressions that are required to
   be elaborated at the point of its definition, but do nothing else.  */
extern void elaborate_entity (Entity_Id gnat_entity);

/* Mark GNAT_ENTITY as going out of scope at this point.  Recursively mark
   any entities on its entity chain similarly.  */
extern void mark_out_of_scope (Entity_Id gnat_entity);

/* Make a dummy type corresponding to GNAT_TYPE.  */
extern tree make_dummy_type (Entity_Id gnat_type);

/* Get the unpadded version of a GNAT type.  */
extern tree get_unpadded_type (Entity_Id gnat_entity);

/* Called when we need to protect a variable object using a save_expr.  */
extern tree maybe_variable (tree gnu_operand);

/* Create a record type that contains a field of TYPE with a starting bit
   position so that it is aligned to ALIGN bits and is SIZE bytes long.  */
extern tree make_aligning_type (tree type, int align, tree size);

/* Ensure that TYPE has SIZE and ALIGN.  Make and return a new padded type
   if needed.  We have already verified that SIZE and TYPE are large enough.

   GNAT_ENTITY and NAME_TRAILER are used to name the resulting record and
   to issue a warning.

   IS_USER_TYPE is true if we must be sure we complete the original type.

   DEFINITION is true if this type is being defined.

   SAME_RM_SIZE is true if the RM_Size of the resulting type is to be
   set to its TYPE_SIZE; otherwise, it's set to the RM_Size of the original
   type.  */
extern tree maybe_pad_type (tree type, tree size, unsigned int align,
                            Entity_Id gnat_entity, const char *name_trailer,
			    bool is_user_type, bool definition,
                            bool same_rm_size);

/* Given a GNU tree and a GNAT list of choices, generate an expression to test
   the value passed against the list of choices.  */
extern tree choices_to_gnu (tree operand, Node_Id choices);

/* Given a type T, a FIELD_DECL F, and a replacement value R,
   return a new type with all size expressions that contain F
   updated by replacing F with R.  This is identical to GCC's
   substitute_in_type except that it knows about TYPE_INDEX_TYPE.  */
extern tree gnat_substitute_in_type (tree t, tree f, tree r);

/* Return the "RM size" of GNU_TYPE.  This is the actual number of bits
   needed to represent the object.  */
extern tree rm_size (tree gnu_type);

/* Given GNU_ID, an IDENTIFIER_NODE containing a name, and SUFFIX, a
   string, return a new IDENTIFIER_NODE that is the concatenation of
   the name in GNU_ID and SUFFIX.  */
extern tree concat_id_with_name (tree gnu_id, const char *suffix);

/* Return the name to be used for GNAT_ENTITY.  If a type, create a
   fully-qualified name, possibly with type information encoding.
   Otherwise, return the name.  */
extern tree get_entity_name (Entity_Id gnat_entity);

/* Return a name for GNAT_ENTITY concatenated with two underscores and
   SUFFIX.  */
extern tree create_concat_name (Entity_Id gnat_entity, const char *suffix);

/* If true, then gigi is being called on an analyzed but unexpanded tree, and
   the only purpose of the call is to properly annotate types with
   representation information.  */
extern bool type_annotate_only;

/* Current file name without path */
extern const char *ref_filename;

/* This is the main program of the back-end.  It sets up all the table
   structures and then generates code.

   ??? Needs parameter descriptions  */

extern void gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
                  struct Node *nodes_ptr, Node_Id *next_node_ptr,
                  Node_Id *prev_node_ptr, struct Elist_Header *elists_ptr,
                  struct Elmt_Item *elmts_ptr,
                  struct String_Entry *strings_ptr,
                  Char_Code *strings_chars_ptr,
                  struct List_Header *list_headers_ptr,
		  Int number_units ATTRIBUTE_UNUSED,
                  char *file_info_ptr ATTRIBUTE_UNUSED,
                  Entity_Id standard_integer,
                  Entity_Id standard_long_long_float,
                  Entity_Id standard_exception_type,
                  Int gigi_operating_mode);

/* GNAT_NODE is the root of some GNAT tree.  Return the root of the
   GCC tree corresponding to that GNAT tree.  Normally, no code is generated;
   we just return an equivalent tree which is used elsewhere to generate
   code.  */
extern tree gnat_to_gnu (Node_Id gnat_node);

/* GNU_STMT is a statement.  We generate code for that statement.  */
extern void gnat_expand_stmt (tree gnu_stmt);

/* ??? missing documentation */
extern int gnat_gimplify_expr (tree *expr_p, tree *pre_p,
                               tree *post_p ATTRIBUTE_UNUSED);

/* Do the processing for the declaration of a GNAT_ENTITY, a type.  If
   a separate Freeze node exists, delay the bulk of the processing.  Otherwise
   make a GCC type for GNAT_ENTITY and set up the correspondence.  */
extern void process_type (Entity_Id gnat_entity);

/* Convert Sloc into *LOCUS (a location_t).  Return true if this Sloc
   corresponds to a source code location and false if it doesn't.  In the
   latter case, we don't update *LOCUS.  We also set the Gigi global variable
   REF_FILENAME to the reference file name as given by sinput (i.e no
   directory).  */
extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus);

/* Post an error message.  MSG is the error message, properly annotated.
   NODE is the node at which to post the error and the node to use for the
   "&" substitution.  */
extern void post_error (const char *, Node_Id);

/* Similar, but NODE is the node at which to post the error and ENT
   is the node to use for the "&" substitution.  */
extern void post_error_ne (const char *msg, Node_Id node, Entity_Id ent);

/* Similar, but NODE is the node at which to post the error, ENT is the node
   to use for the "&" substitution, and N is the number to use for the ^.  */
extern void post_error_ne_num (const char *msg, Node_Id node, Entity_Id ent,
                               int n);

/* Similar to post_error_ne_num, but T is a GCC tree representing the number
   to write.  If the tree represents a constant that fits within a
   host integer, the text inside curly brackets in MSG will be output
   (presumably including a '^').  Otherwise that text will not be output
   and the text inside square brackets will be output instead.  */
extern void post_error_ne_tree (const char *msg, Node_Id node, Entity_Id ent,
                                tree t);

/* Similar to post_error_ne_tree, except that NUM is a second
   integer to write in the message.  */
extern void post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent,
                                  tree t, int num);

/* Protect EXP from multiple evaluation.  This may make a SAVE_EXPR.  */
extern tree protect_multiple_eval (tree exp);

/* Initialize the table that maps GNAT codes to GCC codes for simple
   binary and unary operations.  */
extern void init_code_table (void);

/* Current node being treated, in case gigi_abort or Check_Elaboration_Code
   called.  */
extern Node_Id error_gnat_node;

/* This is equivalent to stabilize_reference in GCC's tree.c, but we know how
   to handle our new nodes and we take extra arguments.

   FORCE says whether to force evaluation of everything,

   SUCCESS we set to true unless we walk through something we don't
   know how to stabilize, or through something which is not an lvalue
   and LVALUES_ONLY is true, in which cases we set to false.  */
extern tree maybe_stabilize_reference (tree ref, bool force, bool lvalues_only,
				       bool *success);

/* Wrapper around maybe_stabilize_reference, for common uses without
   lvalue restrictions and without need to examine the success
   indication.  */

extern tree gnat_stabilize_reference (tree ref, bool force);

/* Highest number in the front-end node table.  */
extern int max_gnat_nodes;

/* If nonzero, pretend we are allocating at global level.  */
extern int force_global;

/* Standard data type sizes.  Most of these are not used.  */

#ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif

#ifndef SHORT_TYPE_SIZE
#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
#endif

#ifndef INT_TYPE_SIZE
#define INT_TYPE_SIZE BITS_PER_WORD
#endif

#ifndef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE BITS_PER_WORD
#endif

#ifndef LONG_LONG_TYPE_SIZE
#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
#endif

#ifndef FLOAT_TYPE_SIZE
#define FLOAT_TYPE_SIZE BITS_PER_WORD
#endif

#ifndef DOUBLE_TYPE_SIZE
#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
#endif

#ifndef LONG_DOUBLE_TYPE_SIZE
#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
#endif

/* The choice of SIZE_TYPE here is very problematic.  We need a signed
   type whose bit width is Pmode.  Assume "long" is such a type here.  */
#undef SIZE_TYPE
#define SIZE_TYPE "long int"

/* Data structures used to represent attributes.  */

enum attr_type
{
  ATTR_MACHINE_ATTRIBUTE,
  ATTR_LINK_ALIAS,
  ATTR_LINK_SECTION,
  ATTR_LINK_CONSTRUCTOR,
  ATTR_LINK_DESTRUCTOR,
  ATTR_WEAK_EXTERNAL
};

struct attrib
{
  struct attrib *next;
  enum attr_type type;
  tree name;
  tree args;
  Node_Id error_point;
};

/* Table of machine-independent internal attributes.  */
extern const struct attribute_spec gnat_internal_attribute_table[];

/* Define the entries in the standard data array.  */
enum standard_datatypes
{
/* Various standard data types and nodes.  */
  ADT_longest_float_type,
  ADT_void_type_decl,

  /* The type of an exception.  */
  ADT_except_type,

  /* Type declaration node  <==> typedef void *T */
  ADT_ptr_void_type,

  /* Function type declaration -- void T() */
  ADT_void_ftype,

  /* Type declaration node  <==> typedef void *T() */
  ADT_ptr_void_ftype,

  /* A function declaration node for a run-time function for allocating memory.
     Ada allocators cause calls to this function to be generated.   */
  ADT_malloc_decl,

  /* Likewise for freeing memory.  */
  ADT_free_decl,

  /* Types and decls used by our temporary exception mechanism.  See
     init_gigi_decls for details.  */
  ADT_jmpbuf_type,
  ADT_jmpbuf_ptr_type,
  ADT_get_jmpbuf_decl,
  ADT_set_jmpbuf_decl,
  ADT_get_excptr_decl,
  ADT_setjmp_decl,
  ADT_longjmp_decl,
  ADT_update_setjmp_buf_decl,
  ADT_raise_nodefer_decl,
  ADT_begin_handler_decl,
  ADT_end_handler_decl,
  ADT_others_decl,
  ADT_all_others_decl,
  ADT_LAST};

extern GTY(()) tree gnat_std_decls[(int) ADT_LAST];
extern GTY(()) tree gnat_raise_decls[(int) LAST_REASON_CODE + 1];

extern GTY(()) tree static_ctors;
extern GTY(()) tree static_dtors;

#define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type]
#define void_type_decl_node gnat_std_decls[(int) ADT_void_type_decl]
#define except_type_node gnat_std_decls[(int) ADT_except_type]
#define ptr_void_type_node gnat_std_decls[(int) ADT_ptr_void_type]
#define void_ftype gnat_std_decls[(int) ADT_void_ftype]
#define ptr_void_ftype gnat_std_decls[(int) ADT_ptr_void_ftype]
#define malloc_decl gnat_std_decls[(int) ADT_malloc_decl]
#define free_decl gnat_std_decls[(int) ADT_free_decl]
#define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type]
#define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type]
#define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl]
#define set_jmpbuf_decl gnat_std_decls[(int) ADT_set_jmpbuf_decl]
#define get_excptr_decl gnat_std_decls[(int) ADT_get_excptr_decl]
#define setjmp_decl gnat_std_decls[(int) ADT_setjmp_decl]
#define longjmp_decl gnat_std_decls[(int) ADT_longjmp_decl]
#define update_setjmp_buf_decl gnat_std_decls[(int) ADT_update_setjmp_buf_decl]
#define raise_nodefer_decl gnat_std_decls[(int) ADT_raise_nodefer_decl]
#define begin_handler_decl gnat_std_decls[(int) ADT_begin_handler_decl]
#define others_decl gnat_std_decls[(int) ADT_others_decl]
#define all_others_decl gnat_std_decls[(int) ADT_all_others_decl]
#define end_handler_decl gnat_std_decls[(int) ADT_end_handler_decl]

/* Routines expected by the gcc back-end. They must have exactly the same
   prototype and names as below.  */

/* Returns nonzero if we are currently in the global binding level.  */
extern int global_bindings_p (void);

/* Enter and exit a new binding level. */
extern void gnat_pushlevel (void);
extern void gnat_poplevel (void);

/* Set SUPERCONTEXT of the BLOCK for the current binding level to FNDECL
   and point FNDECL to this BLOCK.  */
extern void set_current_block_context (tree fndecl);

/* Set the jmpbuf_decl for the current binding level to DECL.  */
extern void set_block_jmpbuf_decl (tree decl);

/* Get the setjmp_decl, if any, for the current binding level.  */
extern tree get_block_jmpbuf_decl (void);

/* Insert BLOCK at the end of the list of subblocks of the
   current binding level.  This is used when a BIND_EXPR is expanded,
   to handle the BLOCK node inside the BIND_EXPR.  */
extern void insert_block (tree block);

/* Records a ..._DECL node DECL as belonging to the current lexical scope
   and uses GNAT_NODE for location information.  */
extern void gnat_pushdecl (tree decl, Node_Id gnat_node);

extern void gnat_init_stmt_group (void);
extern void gnat_init_decl_processing (void);
extern void init_gigi_decls (tree long_long_float_type, tree exception_type);
extern void gnat_init_gcc_eh (void);

/* Return an integer type with the number of bits of precision given by
   PRECISION.  UNSIGNEDP is nonzero if the type is unsigned; otherwise
   it is a signed type.  */
extern tree gnat_type_for_size (unsigned precision, int unsignedp);

/* Return a data type that has machine mode MODE.  UNSIGNEDP selects
   an unsigned type; otherwise a signed type is returned.  */
extern tree gnat_type_for_mode (enum machine_mode mode, int unsignedp);

/* Return the unsigned version of a TYPE_NODE, a scalar type.  */
extern tree gnat_unsigned_type (tree type_node);

/* Return the signed version of a TYPE_NODE, a scalar type.  */
extern tree gnat_signed_type (tree type_node);

/* Return a type the same as TYPE except unsigned or signed according to
   UNSIGNEDP.  */
extern tree gnat_signed_or_unsigned_type (int unsignedp, tree type);

/* Create an expression whose value is that of EXPR,
   converted to type TYPE.  The TREE_TYPE of the value
   is always TYPE.  This function implements all reasonable
   conversions; callers should filter out those that are
   not permitted by the language being compiled.  */
extern tree convert (tree type, tree expr);

/* Routines created solely for the tree translator's sake. Their prototypes
   can be changed as desired.  */

/* GNAT_ENTITY is a GNAT tree node for a defining identifier.
   GNU_DECL is the GCC tree which is to be associated with
   GNAT_ENTITY. Such gnu tree node is always an ..._DECL node.
   If NO_CHECK is nonzero, the latter check is suppressed.
   If GNU_DECL is zero, a previous association is to be reset.  */
extern void save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl,
                           bool no_check);

/* GNAT_ENTITY is a GNAT tree node for a defining identifier.
   Return the ..._DECL node that was associated with it.  If there is no tree
   node associated with GNAT_ENTITY, abort.  */
extern tree get_gnu_tree (Entity_Id gnat_entity);

/* Return nonzero if a GCC tree has been associated with GNAT_ENTITY.  */
extern bool present_gnu_tree (Entity_Id gnat_entity);

/* Initialize tables for above routines.  */
extern void init_gnat_to_gnu (void);

/* Given a record type (RECORD_TYPE) and a chain of FIELD_DECL
   nodes (FIELDLIST), finish constructing the record or union type.
   If HAS_REP is true, this record has a rep clause; don't call
   layout_type but merely set the size and alignment ourselves.
   If DEFER_DEBUG is true, do not call the debugging routines
   on this type; it will be done later. */
extern void finish_record_type (tree record_type, tree fieldlist,
                                bool has_rep, bool defer_debug);

/*  Output the debug information associated to a record type.  */
extern void write_record_type_debug_info (tree);

/* Returns a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the
   subprogram. If it is void_type_node, then we are dealing with a procedure,
   otherwise we are dealing with a function. PARAM_DECL_LIST is a list of
   PARM_DECL nodes that are the subprogram arguments.  CICO_LIST is the
   copy-in/copy-out list to be stored into TYPE_CI_CO_LIST.
   RETURNS_UNCONSTRAINED is true if the function returns an unconstrained
   object.  RETURNS_BY_REF is true if the function returns by reference.
   RETURNS_WITH_DSP is true if the function is to return with a
   depressed stack pointer.  RETURNS_BY_TARGET_PTR is true if the function
   is to be passed (as its first parameter) the address of the place to copy
   its result.  */
extern tree create_subprog_type (tree return_type, tree param_decl_list,
                                 tree cico_list, bool returns_unconstrained,
                                 bool returns_by_ref, bool returns_with_dsp,
                                 bool returns_by_target_ptr);

/* Return a copy of TYPE, but safe to modify in any way.  */
extern tree copy_type (tree type);

/* Return an INTEGER_TYPE of SIZETYPE with range MIN to MAX and whose
   TYPE_INDEX_TYPE is INDEX.  */
extern tree create_index_type (tree min, tree max, tree index);

/* Return a TYPE_DECL node. TYPE_NAME gives the name of the type (a character
   string) and TYPE is a ..._TYPE node giving its data type.
   ARTIFICIAL_P is true if this is a declaration that was generated
   by the compiler.  DEBUG_INFO_P is true if we need to write debugging
   information about this type.  GNAT_NODE is used for the position of
   the decl.  */
extern tree create_type_decl (tree type_name, tree type,
                              struct attrib *attr_list,
                              bool artificial_p, bool debug_info_p,
			      Node_Id gnat_node);

/* Returns a GCC VAR_DECL node. VAR_NAME gives the name of the variable.
   ASM_NAME is its assembler name (if provided).  TYPE is
   its data type (a GCC ..._TYPE node).  VAR_INIT is the GCC tree for an
   optional initial expression; NULL_TREE if none.

   CONST_FLAG is true if this variable is constant.

   PUBLIC_FLAG is true if this definition is to be made visible outside of
   the current compilation unit. This flag should be set when processing the
   variable definitions in a package specification.  EXTERN_FLAG is nonzero
   when processing an external variable declaration (as opposed to a
   definition: no storage is to be allocated for the variable here).

   STATIC_FLAG is only relevant when not at top level.  In that case
   it indicates whether to always allocate storage to the variable.

   GNAT_NODE is used for the position of the decl.  */
extern tree create_var_decl (tree var_name, tree asm_name, tree type,
                             tree var_init, bool const_flag,
                             bool public_flag, bool extern_flag,
                             bool static_flag,
			     struct attrib *attr_list, Node_Id gnat_node);

/* Given a DECL and ATTR_LIST, apply the listed attributes.  */
extern void process_attributes (tree decl, struct attrib *attr_list);

/* Returns a FIELD_DECL node. FIELD_NAME the field name, FIELD_TYPE is its
   type, and RECORD_TYPE is the type of the parent.  PACKED is nonzero if
   this field is in a record type with a "pragma pack".  If SIZE is nonzero
   it is the specified size for this field.  If POS is nonzero, it is the bit
   position.  If ADDRESSABLE is nonzero, it means we are allowed to take
   the address of this field for aliasing purposes.  */
extern tree create_field_decl (tree field_name, tree field_type,
                               tree record_type, int packed, tree size,
                               tree pos, int addressable);

/* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter,
   PARAM_TYPE is its type.  READONLY is true if the parameter is
   readonly (either an IN parameter or an address of a pass-by-ref
   parameter). */
extern tree create_param_decl (tree param_name, tree param_type,
                               bool readonly);

/* Returns a FUNCTION_DECL node.  SUBPROG_NAME is the name of the subprogram,
   ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
   node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
   PARM_DECL nodes chained through the TREE_CHAIN field).

   INLINE_FLAG, PUBLIC_FLAG, EXTERN_FLAG, and ATTR_LIST are used to set the
   appropriate fields in the FUNCTION_DECL.  GNAT_NODE gives the location.  */
extern tree create_subprog_decl (tree subprog_name, tree asm_name,
                                 tree subprog_type, tree param_decl_list,
                                 bool inlinee_flag, bool public_flag,
                                 bool extern_flag,
				 struct attrib *attr_list, Node_Id gnat_node);

/* Returns a LABEL_DECL node for LABEL_NAME.  */
extern tree create_label_decl (tree label_name);

/* Set up the framework for generating code for SUBPROG_DECL, a subprogram
   body. This routine needs to be invoked before processing the declarations
   appearing in the subprogram.  */
extern void begin_subprog_body (tree subprog_decl);

/* Finish the definition of the current subprogram and compile it all the way
   to assembler language output.  BODY is the tree corresponding to
   the subprogram.  */
extern void end_subprog_body (tree body);

/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
   EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs.
   Return a constructor for the template.  */
extern tree build_template (tree template_type, tree array_type, tree expr);

/* Build a VMS descriptor from a Mechanism_Type, which must specify
   a descriptor type, and the GCC type of an object.  Each FIELD_DECL
   in the type contains in its DECL_INITIAL the expression to use when
   a constructor is made for the type.  GNAT_ENTITY is a gnat node used
   to print out an error message if the mechanism cannot be applied to
   an object of that type and also for the name.  */

extern tree build_vms_descriptor (tree type, Mechanism_Type mech,
                                  Entity_Id gnat_entity);

/* Build a type to be used to represent an aliased object whose nominal
   type is an unconstrained array.  This consists of a RECORD_TYPE containing
   a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an
   ARRAY_TYPE.  If ARRAY_TYPE is that of the unconstrained array, this
   is used to represent an arbitrary unconstrained object.  Use NAME
   as the name of the record.  */
extern tree build_unc_object_type (tree template_type, tree object_type,
                                   tree name);

/* Same as build_unc_object_type, but taking a thin or fat pointer type
   instead of the template type. */
extern tree build_unc_object_type_from_ptr (tree thin_fat_ptr_type,
					    tree object_type, tree name);

/* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE.  In
   the normal case this is just two adjustments, but we have more to do
   if NEW is an UNCONSTRAINED_ARRAY_TYPE.  */
extern void update_pointer_to (tree old_type, tree new_type);

/* EXP is an expression for the size of an object.  If this size contains
   discriminant references, replace them with the maximum (if MAX_P) or
   minimum (if !MAX_P) possible value of the discriminant.  */
extern tree max_size (tree exp, bool max_p);

/* Remove all conversions that are done in EXP.  This includes converting
   from a padded type or to a left-justified modular type.  If TRUE_ADDRESS
   is true, always return the address of the containing object even if
   the address is not bit-aligned.  */
extern tree remove_conversions (tree exp, bool true_address);

/* If EXP's type is an UNCONSTRAINED_ARRAY_TYPE, return an expression that
   refers to the underlying array.  If its type has TYPE_CONTAINS_TEMPLATE_P,
   likewise return an expression pointing to the underlying array.  */
extern tree maybe_unconstrained_array (tree exp);

/* Return an expression that does an unchecked conversion of EXPR to TYPE.
   If NOTRUNC_P is true, truncation operations should be suppressed.  */
extern tree unchecked_convert (tree type, tree expr, bool notrunc_p);

/* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical
   operation.

   This preparation consists of taking the ordinary
   representation of an expression EXPR and producing a valid tree
   boolean expression describing whether EXPR is nonzero.  We could
   simply always do build_binary_op (NE_EXPR, expr, integer_zero_node, 1),
   but we optimize comparisons, &&, ||, and !.

   The resulting type should always be the same as the input type.
   This function is simpler than the corresponding C version since
   the only possible operands will be things of Boolean type.  */
extern tree gnat_truthvalue_conversion (tree expr);

/* Return the base type of TYPE.  */
extern tree get_base_type (tree type);

/* EXP is a GCC tree representing an address.  See if we can find how
   strictly the object at that address is aligned.   Return that alignment
   strictly the object at that address is aligned.   Return that alignment
   in bits.  If we don't know anything about the alignment, return 0.  */
extern unsigned int known_alignment (tree exp);

/* Return true if VALUE is a multiple of FACTOR. FACTOR must be a power
   of 2. */
extern bool value_factor_p (tree value, HOST_WIDE_INT factor);

/* Make a binary operation of kind OP_CODE.  RESULT_TYPE is the type
   desired for the result.  Usually the operation is to be performed
   in that type.  For MODIFY_EXPR and ARRAY_REF, RESULT_TYPE may be 0
   in which case the type to be used will be derived from the operands.  */
extern tree build_binary_op (enum tree_code op_code, tree retult_type,
                             tree left_operand, tree right_operand);

/* Similar, but make unary operation.   */
extern tree build_unary_op (enum tree_code op_code, tree result_type,
                            tree operand);

/* Similar, but for COND_EXPR.  */
extern tree build_cond_expr (tree result_type, tree condition_operand,
                             tree true_operand, tree false_operand);

/* Similar, but for RETURN_EXPR.  */
extern tree build_return_expr (tree result_decl, tree ret_val);

/* Build a CALL_EXPR to call FUNDECL with one argument, ARG.  Return
   the CALL_EXPR.  */
extern tree build_call_1_expr (tree fundecl, tree arg);

/* Build a CALL_EXPR to call FUNDECL with two argument, ARG1 & ARG2.  Return
   the CALL_EXPR.  */
extern tree build_call_2_expr (tree fundecl, tree arg1, tree arg2);

/* Likewise to call FUNDECL with no arguments.  */
extern tree build_call_0_expr (tree fundecl);

/* Call a function that raises an exception and pass the line number and file
   name, if requested.  MSG says which exception function to call.

   GNAT_NODE is the gnat node conveying the source location for which the
   error should be signaled, or Empty in which case the error is signaled on
   the current ref_file_name/input_line.  */
extern tree build_call_raise (int msg, Node_Id gnat_node);

/* Return a CONSTRUCTOR of TYPE whose list is LIST.  This is not the
   same as build_constructor in the language-independent tree.c.  */
extern tree gnat_build_constructor (tree type, tree list);

/* Return a COMPONENT_REF to access a field that is given by COMPONENT,
   an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL,
   for the field, or both.  Don't fold the result if NO_FOLD_P.  */
extern tree build_component_ref (tree record_variable, tree component,
                                 tree field, bool no_fold_p);

/* Build a GCC tree to call an allocation or deallocation function.
   If GNU_OBJ is nonzero, it is an object to deallocate.  Otherwise,
   genrate an allocator.

   GNU_SIZE is the size of the object and ALIGN is the alignment.
   GNAT_PROC, if present is a procedure to call and GNAT_POOL is the
   storage pool to use.  If not preset, malloc and free will be used.  */
extern tree build_call_alloc_dealloc (tree gnu_obj, tree gnu_size,
                                      unsigned align, Entity_Id gnat_proc,
				      Entity_Id gnat_pool, Node_Id gnat_node);

/* Build a GCC tree to correspond to allocating an object of TYPE whose
   initial value if INIT, if INIT is nonzero.  Convert the expression to
   RESULT_TYPE, which must be some type of pointer.  Return the tree.
   GNAT_PROC and GNAT_POOL optionally give the procedure to call and
   the storage pool to use.  GNAT_NODE is used to provide an error
   location for restriction violations messages.  If IGNORE_INIT_TYPE is
   true, ignore the type of INIT for the purpose of determining the size;
   this will cause the maximum size to be allocated if TYPE is of
   self-referential size.  */
extern tree build_allocator (tree type, tree init, tree result_type,
                             Entity_Id gnat_proc, Entity_Id gnat_pool,
                             Node_Id gnat_node, bool);

/* Fill in a VMS descriptor for EXPR and return a constructor for it.
   GNAT_FORMAL is how we find the descriptor record.  */

extern tree fill_vms_descriptor (tree expr, Entity_Id gnat_formal);

/* Indicate that we need to make the address of EXPR_NODE and it therefore
   should not be allocated in a register.  Return true if successful.  */
extern bool gnat_mark_addressable (tree expr_node);

/* Implementation of the builtin_function langhook.  */
extern tree builtin_function (const char *name, tree type, int function_code,
                              enum built_in_class class,
			      const char *library_name, tree attrs);

/* Search the chain of currently reachable declarations for a builtin
   FUNCTION_DECL node corresponding to function NAME (an IDENTIFIER_NODE).
   Return the first node found, if any, or NULL_TREE otherwise.  */
extern tree builtin_decl_for (tree name ATTRIBUTE_UNUSED);

/* This function is called by the front end to enumerate all the supported
   modes for the machine.  We pass a function which is called back with
   the following integer parameters:

   FLOAT_P	nonzero if this represents a floating-point mode
   COMPLEX_P	nonzero is this represents a complex mode
   COUNT	count of number of items, nonzero for vector mode
   PRECISION	number of bits in data representation
   MANTISSA	number of bits in mantissa, if FP and known, else zero.
   SIZE		number of bits used to store data
   ALIGN	number of bits to which mode is aligned.  */
extern void enumerate_modes (void (*f) (int, int, int, int, int, int,
					unsigned int));

/* These are temporary function to deal with recent GCC changes related to
   FP type sizes and precisions.  */
extern int fp_prec_to_size (int prec);
extern int fp_size_to_prec (int size);

/* These functions return the basic data type sizes and related parameters
   about the target machine.  */

extern Pos get_target_bits_per_unit (void);
extern Pos get_target_bits_per_word (void);
extern Pos get_target_char_size (void);
extern Pos get_target_wchar_t_size (void);
extern Pos get_target_short_size (void);
extern Pos get_target_int_size (void);
extern Pos get_target_long_size (void);
extern Pos get_target_long_long_size (void);
extern Pos get_target_float_size (void);
extern Pos get_target_double_size (void);
extern Pos get_target_long_double_size (void);
extern Pos get_target_pointer_size (void);
extern Pos get_target_maximum_alignment (void);
extern Nat get_float_words_be (void);
extern Nat get_words_be (void);
extern Nat get_bytes_be (void);
extern Nat get_bits_be (void);
extern Nat get_strict_alignment (void);


text:
/**
 * Media-related Javascript
 * @author Patrick Peters <patrick@lightwell.de>
 */

var tabControls;

$(document).ready(function() {

});

var mediaControls = {
    readFolder: function(folderId) {
        $.post(ajaxPathPrefix + '/cms/media/getFolderContent/'+folderId, function(data) {
            $('#media-browserarea').html(data);
            $('#media-metadataarea').html('');
            $('#media-previewarea').html('');
        });
    },
    readChooserFolder: function(currentFolder, folderId) {
        $.post(ajaxPathPrefix + '/cms/media/browseRelationFiles/'+currentFolder+'/'+folderId, function(data) {
            $('#genericDialog').html(data);
        });
    },
    chooseFile: function(type, id) {
        if($('#genericDialog').dialog('isOpen')) {
            $('#genericDialog').dialog('close');
            var caller = $('#genericDialog').attr('data-caller');
            $('#content [rel='+caller+']').val(type+':'+id);

            $.post(ajaxPathPrefix + '/cms/media/browseRelationFilesThumbnail/' + type + '/' + id, function(data) {
                var responseObj = $.parseJSON(data);
                $('#content [rel='+caller+']').val('['+type+':'+id+'] '+responseObj.filename);
                $('#content [rel='+caller+']').siblings('img.relationImage').attr('src', responseObj.thumb);
                $('#content [rel='+caller+']').siblings('img.relationImage').show();
            });
        }
    },
    showFile: function(fileId) {
        $.post(ajaxPathPrefix + '/cms/media/editMetaData/edit', 'file_id=' + fileId, function(data) {
            $('#media-rightarea').html(data);
        });
    },
    saveMetaData: function(form) {
        $.post(ajaxPathPrefix + '/cms/media/editMetaData/save', form, function(data) {
            $('#media-rightarea').html(data);
        });
    },
    toggleCheckboxes: function(containerId) {
        var anyIsNotChecked = false;
        $('#'+containerId+' [rel=media-checkobx]').each(
                function(element) {
                    if (!$(this).is(':checked')) {
                        anyIsNotChecked = true;
                    }
                }
        );
        if (anyIsNotChecked) {
            $('#'+containerId+' [rel=media-checkobx]').attr('checked', true);
            $('#'+containerId+' [rel=media-togglecheckbox]').attr('checked', true);
        } else {
            $('#'+containerId+' [rel=media-checkobx]').attr('checked', false);
            $('#'+containerId+' [rel=media-togglecheckbox]').attr('checked', false);
        }
    },
    cutPasteFiles: function() {
        var selectedValues = $('#media-cutfiles').val();
        if (selectedValues.indexOf('|') > 0) {
            // paste files
            var destination = $('#media-opendir').val();
            $.post(ajaxPathPrefix + '/cms/media/moveFile/'+destination, '&source='+selectedValues, function(data) {
                if (!isResponseError(data)) {
                    $('#media-browserarea').html(data);
                }
            });
            this.buttonsClipboardInactive();
        } else {
            // cut files
            var chosenFiles = '';
            $('#media-browserarea [rel=media-checkobx]').each(
                 function(id, element) {
                    if ($(this).is(':checked')) {
                        var appendString = element.name.substr(10);
                        chosenFiles += appendString + '|';
                    }
                }
            );
            if (chosenFiles != '') {
                $('#media-cutfiles').val(chosenFiles);
                this.buttonsClipboardActive();
            }
        }
    },
    cancelCutFiles: function () {
        this.buttonsClipboardInactive();
    },
    renameFile: function (file_id, file_name) {
        var newName = prompt('Datei Umbenennen', file_name);
        if (newName != null) {
            var currentFolder = $('#media-opendir').val();
            $.post(ajaxPathPrefix + '/cms/media/renameFile/'+currentFolder, 'file='+file_id+'&newName='+newName, function(data) {
                $('#media-browserarea').html(data);
            });
        }
    },
    addFolder: function (file_id) {
        var newName = prompt('Name des neuen Ordners:');
        if (newName.trim() != '' && newName != null) {
            var currentFolder = $('#media-opendir').val();
            $.post(ajaxPathPrefix + '/cms/media/addFolder/'+currentFolder, 'newName='+newName, function(data) {
                $('#media-browserarea').html(data);
            });
        }
    },
    buttonsClipboardActive: function () {
        $('#media-cutpastebtn').html('');
        $('#media-cancelbtn').attr('disabled', false);
        $('#media-cancelbtn').addClass('btn-warning');
        $('#media-cutpastebtn').addClass('btn-warning');
    },
    buttonsClipboardInactive: function () {
        $('#media-cutfiles').val('');
        $('#media-cancelbtn').attr('disabled', true);
        $('#media-cancelbtn').removeClass('btn-warning');
        $('#media-cutpastebtn').removeClass('btn-warning');
        $('#media-cutpastebtn').html('');
    },
    deleteFile: function(id) {
        var chosenFiles = '';
        $('#media-browserarea [rel=media-checkobx]').each(
            function(id, element) {
               if ($(this).is(':checked')) {
                   var appendString = element.name.substr(10);
                   chosenFiles += appendString + '|';
                }
            }
        );
        if (chosenFiles.indexOf('|') > 0 && confirm('Markierte Dateien wirklich löschen?')) {
            var currentFolder = $('#media-opendir').val();
            $.post(ajaxPathPrefix + '/cms/media/deleteFile/'+currentFolder, 'files='+chosenFiles, function(data) {
                if (!isResponseError(data)) {
                    $('#media-browserarea').html(data);
                    $('#media-metadataarea').html('');
                }
            });
        }
    },
    uploadFile: function() {
        var currentFolder = $('#media-opendir').val();
        $('#mediafile-area-iframe').attr('src', $('#mediafile-area-iframe').attr('src'));
		setDialogTitle('Dateien hochladen', 'mediafile-area');
		$('#mediafile-area').dialog({
			modal: true,
			width: 700,
			height: 540,
			buttons: {
				"Übernehmen": function() {
                    outer = $(this);
					$.post(ajaxPathPrefix + '/cms/media/uploadFile/'+currentFolder, function(data) {
                        $('#media-browserarea').html(data);
                        $('#media-metadataarea').html('');
                        outer.dialog('close');
                    });
				},
				"Abbrechen": function() {
					$('#treeDialog').find('form').html('');
					$(this).dialog('close');
				}
			},
		});
    },
    uploadManagedFile: function(currentFolder) {
        setDialogTitle('Dateien hochladen', 'dropzone' + currentFolder);
        $('#dropzone' + currentFolder + ' iframe').attr('src', $('#dropzone' + currentFolder + ' iframe').attr('src'));
		$('#dropzone' + currentFolder).dialog({
			modal: true,
			width: 700,
			height: 540,
            currentFolder: currentFolder,

			buttons: {
				"Übernehmen": function() {
                    outer = $(this);
					$.post(ajaxPathPrefix + '/cms/media/uploadManagedFile/' + currentFolder, function(data) {
                        $('#upload' + currentFolder).replaceWith(data);
                        $('#dropzone' + currentFolder + ' iframe').attr('src', $('#dropzone' + currentFolder + ' iframe').attr('src'));
                        outer.dialog('close');
                    });
				},
				"Abbrechen": function() {
                    outer = $(this);
					$.post(ajaxPathPrefix + '/cms/media/uploadManagedFile/' + currentFolder, '&cancel=1', function(data) {
                        $('#upload' + currentFolder).replaceWith(data);
                        outer.dialog('close');
                    });
				}
			},
		});
    },
    deleteManagedFile: function(currentFolder) {
        var chosenFiles = '';
        $('#upload' + currentFolder + ' [rel=media-checkobx]').each(
            function(id, element) {
               if ($(this).is(':checked')) {
                   var appendString = element.name.substr(10);
                   chosenFiles += appendString + '|';
                }
            }
        );
        if (chosenFiles.indexOf('|') > 0 && confirm('Markierte Dateien wirklich löschen?')) {
            $.post(ajaxPathPrefix + '/cms/media/deleteManagedFile/'+currentFolder, 'files='+chosenFiles, function(data) {
                if (!isResponseError(data)) {
                    $('#upload' + currentFolder).replaceWith(data);
                }
            });
        }
    },
};


text:
using System;
using NUnit.Framework;
using System.Linq;
using Zookeeper.PSProvider.Intergration.Tests.Nunit.Helpers;

namespace Zookeeper.PSProvider.Intergration.Tests.Nunit
{
    [TestFixture(Category="Integration_tests")]
    public abstract class CmdletTestsBase
    {
        protected PowershellHelpers powershell;
        protected ZookeeperHelpers zookeeper;

        [SetUp]
        public void SetUp()
        {
            InstallUtil.Install("Zookeeper.PSProvider");
            this.zookeeper = new ZookeeperHelpers();
            this.zookeeper.CleanZookeeper();

            this.powershell = new PowershellHelpers();
            this.powershell.AddScript("Add-PSSnapin ZookeeperPSSnap");
            this.powershell.AddScript("New-PSDrive -Name Zookeeper -PSProvider Zookeeeper -Root /");
            this.powershell.AddScript("cd Zookeeper:");
        }

        [TearDown]
        public void TearDown()
        {
            this.zookeeper.Dispose();
        }
    }
}


text:
package org.apache.camel.component.spring.integration;

import org.apache.camel.CamelContext;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.spring.SpringCamelContext;
import org.springframework.integration.core.MessageChannel;

/**
 * Defines the Spring Integration Endpoint
 *
 * @version $Revision$
 */
public class SpringIntegrationEndpoint extends DefaultEndpoint {
    private String inputChannel;
    private String outputChannel;
    private String defaultChannel;
    private MessageChannel messageChannel;
    private boolean inOut;

    public SpringIntegrationEndpoint(String uri, String channel, SpringIntegrationComponent component) {
        super(uri, component);
        this.defaultChannel = channel;
    }

    public SpringIntegrationEndpoint(String uri, MessageChannel channel, CamelContext context) {
        super(uri, context);
        this.messageChannel = channel;
    }

    public SpringIntegrationEndpoint(String endpointUri, MessageChannel messageChannel) {
        super(endpointUri);
        this.messageChannel = messageChannel;
    }

    public Producer createProducer() throws Exception {
        return new SpringIntegrationProducer((SpringCamelContext) getCamelContext(), this);
    }

    public Consumer createConsumer(Processor processor) throws Exception {
        return new SpringIntegrationConsumer(this, processor);
    }

    public void setInputChannel(String input) {
        inputChannel = input;
    }

    public String getInputChannel() {
        return inputChannel;
    }

    public void setOutputChannel(String output) {
        outputChannel = output;
    }

    public String getOutputChannel() {
        return outputChannel;
    }

    public String getDefaultChannel() {
        return defaultChannel;
    }

    public MessageChannel getMessageChannel() {
        return messageChannel;
    }

    public boolean isSingleton() {
        return false;
    }

    public void setInOut(boolean inOut) {
        this.inOut = inOut;
    }

    public boolean isInOut() {
        return this.inOut;
    }

}


text:
package flags

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"reflect"
	"runtime"
	"strings"
	"unicode/utf8"
)

type alignmentInfo struct {
	maxLongLen      int
	hasShort        bool
	hasValueName    bool
	terminalColumns int
	indent          bool
}

const (
	paddingBeforeOption                 = 2
	distanceBetweenOptionAndDescription = 2
)

func (a *alignmentInfo) descriptionStart() int {
	ret := a.maxLongLen + distanceBetweenOptionAndDescription

	if a.hasShort {
		ret += 2
	}

	if a.maxLongLen > 0 {
		ret += 4
	}

	if a.hasValueName {
		ret += 3
	}

	return ret
}

func (a *alignmentInfo) updateLen(name string, indent bool) {
	l := utf8.RuneCountInString(name)

	if indent {
		l = l + 4
	}

	if l > a.maxLongLen {
		a.maxLongLen = l
	}
}

func (p *Parser) getAlignmentInfo() alignmentInfo {
	ret := alignmentInfo{
		maxLongLen:      0,
		hasShort:        false,
		hasValueName:    false,
		terminalColumns: getTerminalColumns(),
	}

	if ret.terminalColumns <= 0 {
		ret.terminalColumns = 80
	}

	var prevcmd *Command

	p.eachActiveGroup(func(c *Command, grp *Group) {
		if c != prevcmd {
			for _, arg := range c.args {
				ret.updateLen(arg.Name, c != p.Command)
			}
		}

		for _, info := range grp.options {
			if !info.canCli() {
				continue
			}

			if info.ShortName != 0 {
				ret.hasShort = true
			}

			if len(info.ValueName) > 0 {
				ret.hasValueName = true
			}

			ret.updateLen(info.LongNameWithNamespace()+info.ValueName, c != p.Command)
		}
	})

	return ret
}

func (p *Parser) writeHelpOption(writer *bufio.Writer, option *Option, info alignmentInfo) {
	line := &bytes.Buffer{}

	prefix := paddingBeforeOption

	if info.indent {
		prefix += 4
	}

	line.WriteString(strings.Repeat(" ", prefix))

	if option.ShortName != 0 {
		line.WriteRune(defaultShortOptDelimiter)
		line.WriteRune(option.ShortName)
	} else if info.hasShort {
		line.WriteString("  ")
	}

	descstart := info.descriptionStart() + paddingBeforeOption

	if len(option.LongName) > 0 {
		if option.ShortName != 0 {
			line.WriteString(", ")
		} else if info.hasShort {
			line.WriteString("  ")
		}

		line.WriteString(defaultLongOptDelimiter)
		line.WriteString(option.LongNameWithNamespace())
	}

	if option.canArgument() {
		line.WriteRune(defaultNameArgDelimiter)

		if len(option.ValueName) > 0 {
			line.WriteString(option.ValueName)
		}
	}

	written := line.Len()
	line.WriteTo(writer)

	if option.Description != "" {
		dw := descstart - written
		writer.WriteString(strings.Repeat(" ", dw))

		def := ""
		defs := option.Default

		if len(option.DefaultMask) != 0 {
			if option.DefaultMask != "-" {
				def = option.DefaultMask
			}
		} else if len(defs) == 0 && option.canArgument() {
			var showdef bool

			switch option.field.Type.Kind() {
			case reflect.Func, reflect.Ptr:
				showdef = !option.value.IsNil()
			case reflect.Slice, reflect.String, reflect.Array:
				showdef = option.value.Len() > 0
			case reflect.Map:
				showdef = !option.value.IsNil() && option.value.Len() > 0
			default:
				zeroval := reflect.Zero(option.field.Type)
				showdef = !reflect.DeepEqual(zeroval.Interface(), option.value.Interface())
			}

			if showdef {
				def, _ = convertToString(option.value, option.tag)
			}
		} else if len(defs) != 0 {
			def = strings.Join(defs, ", ")
		}

		var envDef string
		if option.EnvDefaultKey != "" {
			var envPrintable string
			if runtime.GOOS == "windows" {
				envPrintable = "%" + option.EnvDefaultKey + "%"
			} else {
				envPrintable = "$" + option.EnvDefaultKey
			}
			envDef = fmt.Sprintf(" [%s]", envPrintable)
		}

		var desc string

		if def != "" {
			desc = fmt.Sprintf("%s (%v)%s", option.Description, def,
				envDef)
		} else {
			desc = option.Description + envDef
		}

		writer.WriteString(wrapText(desc,
			info.terminalColumns-descstart,
			strings.Repeat(" ", descstart)))
	}

	writer.WriteString("\n")
}

func maxCommandLength(s []*Command) int {
	if len(s) == 0 {
		return 0
	}

	ret := len(s[0].Name)

	for _, v := range s[1:] {
		l := len(v.Name)

		if l > ret {
			ret = l
		}
	}

	return ret
}

// WriteHelp writes a help message containing all the possible options and
// their descriptions to the provided writer. Note that the HelpFlag parser
// option provides a convenient way to add a -h/--help option group to the
// command line parser which will automatically show the help messages using
// this method.
func (p *Parser) WriteHelp(writer io.Writer) {
	if writer == nil {
		return
	}

	wr := bufio.NewWriter(writer)
	aligninfo := p.getAlignmentInfo()

	cmd := p.Command

	for cmd.Active != nil {
		cmd = cmd.Active
	}

	if p.Name != "" {
		wr.WriteString("Usage:\n")
		wr.WriteString(" ")

		allcmd := p.Command

		for allcmd != nil {
			var usage string

			if allcmd == p.Command {
				if len(p.Usage) != 0 {
					usage = p.Usage
				} else if p.Options&HelpFlag != 0 {
					usage = "[OPTIONS]"
				}
			} else if us, ok := allcmd.data.(Usage); ok {
				usage = us.Usage()
			} else if allcmd.hasCliOptions() {
				usage = fmt.Sprintf("[%s-OPTIONS]", allcmd.Name)
			}

			if len(usage) != 0 {
				fmt.Fprintf(wr, " %s %s", allcmd.Name, usage)
			} else {
				fmt.Fprintf(wr, " %s", allcmd.Name)
			}

			if len(allcmd.args) > 0 {
				fmt.Fprintf(wr, " ")
			}

			for i, arg := range allcmd.args {
				if i != 0 {
					fmt.Fprintf(wr, " ")
				}

				name := arg.Name

				if arg.isRemaining() {
					name = name + "..."
				}

				if !allcmd.ArgsRequired {
					fmt.Fprintf(wr, "[%s]", name)
				} else {
					fmt.Fprintf(wr, "%s", name)
				}
			}

			if allcmd.Active == nil && len(allcmd.commands) > 0 {
				var co, cc string

				if allcmd.SubcommandsOptional {
					co, cc = "[", "]"
				} else {
					co, cc = "<", ">"
				}

				if len(allcmd.commands) > 3 {
					fmt.Fprintf(wr, " %scommand%s", co, cc)
				} else {
					subcommands := allcmd.sortedCommands()
					names := make([]string, len(subcommands))

					for i, subc := range subcommands {
						names[i] = subc.Name
					}

					fmt.Fprintf(wr, " %s%s%s", co, strings.Join(names, " | "), cc)
				}
			}

			allcmd = allcmd.Active
		}

		fmt.Fprintln(wr)

		if len(cmd.LongDescription) != 0 {
			fmt.Fprintln(wr)

			t := wrapText(cmd.LongDescription,
				aligninfo.terminalColumns,
				"")

			fmt.Fprintln(wr, t)
		}
	}

	c := p.Command

	for c != nil {
		printcmd := c != p.Command

		c.eachGroup(func(grp *Group) {
			first := true

			// Skip built-in help group for all commands except the top-level
			// parser
			if grp.isBuiltinHelp && c != p.Command {
				return
			}

			for _, info := range grp.options {
				if !info.canCli() {
					continue
				}

				if printcmd {
					fmt.Fprintf(wr, "\n[%s command options]\n", c.Name)
					aligninfo.indent = true
					printcmd = false
				}

				if first && cmd.Group != grp {
					fmt.Fprintln(wr)

					if aligninfo.indent {
						wr.WriteString("    ")
					}

					fmt.Fprintf(wr, "%s:\n", grp.ShortDescription)
					first = false
				}

				p.writeHelpOption(wr, info, aligninfo)
			}
		})

		if len(c.args) > 0 {
			if c == p.Command {
				fmt.Fprintf(wr, "\nArguments:\n")
			} else {
				fmt.Fprintf(wr, "\n[%s command arguments]\n", c.Name)
			}

			maxlen := aligninfo.descriptionStart()

			for _, arg := range c.args {
				prefix := strings.Repeat(" ", paddingBeforeOption)
				fmt.Fprintf(wr, "%s%s", prefix, arg.Name)

				if len(arg.Description) > 0 {
					align := strings.Repeat(" ", maxlen-len(arg.Name)-1)
					fmt.Fprintf(wr, ":%s%s", align, arg.Description)
				}

				fmt.Fprintln(wr)
			}
		}

		c = c.Active
	}

	scommands := cmd.sortedCommands()

	if len(scommands) > 0 {
		maxnamelen := maxCommandLength(scommands)

		fmt.Fprintln(wr)
		fmt.Fprintln(wr, "Available commands:")

		for _, c := range scommands {
			fmt.Fprintf(wr, "  %s", c.Name)

			if len(c.ShortDescription) > 0 {
				pad := strings.Repeat(" ", maxnamelen-len(c.Name))
				fmt.Fprintf(wr, "%s  %s", pad, c.ShortDescription)

				if len(c.Aliases) > 0 {
					fmt.Fprintf(wr, " (aliases: %s)", strings.Join(c.Aliases, ", "))
				}

			}

			fmt.Fprintln(wr)
		}
	}

	wr.Flush()
}


text:
/* ----------------------------------------------------------------------------
 * Imports
 * ------------------------------------------------------------------------- */

var gulp       = require('gulp');
var addsrc     = require('gulp-add-src');
var args       = require('yargs').argv;
var autoprefix = require('autoprefixer');
var child      = require('child_process');
var clean      = require('del');
var collect    = require('gulp-rev-collector');
var compact    = require('gulp-remove-empty-lines');
var concat     = require('gulp-concat');
var ignore     = require('gulp-ignore');
var gulpif     = require('gulp-if');
var mincss     = require('gulp-cssnano');
var minhtml    = require('gulp-htmlmin');
var minimage   = require('gulp-image-optimization');
var modernizr  = require('gulp-modernizr');
var mqpacker   = require('css-mqpacker');
var notifier   = require('node-notifier');
var plumber    = require('gulp-plumber');
var postcss    = require('gulp-postcss');
var rev        = require('gulp-rev');
var sass       = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var uglify     = require('gulp-uglify');
var util       = require('gulp-util');
var vinyl      = require('vinyl-paths');

/* ----------------------------------------------------------------------------
 * Locals
 * ------------------------------------------------------------------------- */

/* MkDocs server */
var server = null;

/* ----------------------------------------------------------------------------
 * Overrides
 * ------------------------------------------------------------------------- */

/*
 * Override gulp.src() for nicer error handling.
 */
var src = gulp.src;
gulp.src = function() {
  return src.apply(gulp, arguments)
    .pipe(
      plumber(function(error) {
        util.log(util.colors.red(
          'Error (' + error.plugin + '): ' + error.message
        ));
        notifier.notify({
          title: 'Error (' + error.plugin + ')',
          message: error.message.split('\n')[0]
        });
        this.emit('end');
      }));
};

/* ----------------------------------------------------------------------------
 * Asset pipeline
 * ------------------------------------------------------------------------- */

/*
 * Build stylesheets from SASS source.
 */
gulp.task('assets:stylesheets', function() {
  return gulp.src('src/assets/stylesheets/*.scss')
    .pipe(gulpif(args.sourcemaps, sourcemaps.init()))
    .pipe(
      sass({
        includePaths: [
          'bower_components/bourbon/app/assets/stylesheets/',
          'bower_components/quantum-colors/',
          'bower_components/quantum-shadows/'
        ]
      }))
    .pipe(
      postcss([
        autoprefix(),
        mqpacker
      ]))
    .pipe(gulpif(args.sourcemaps, sourcemaps.write()))
    .pipe(gulpif(args.production, mincss()))
    .pipe(gulp.dest('material/assets/stylesheets/'));
});

/*
 * Build javascripts from Bower components and source.
 */
gulp.task('assets:javascripts', function() {
  return gulp.src([

    /* Bower components */
    'bower_components/classlist/classList.js',
    'bower_components/fastclick/lib/fastclick.js',
    'bower_components/pegasus/dist/pegasus.js',
    'bower_components/lunr.js/lunr.js',
    'bower_components/jquery/dist/jquery.js',

    /* Application javascripts */
    'src/assets/javascripts/application.js',
    'src/assets/javascripts/standalone.js'
  ]).pipe(gulpif(args.sourcemaps, sourcemaps.init()))
    .pipe(concat('application.js'))
    .pipe(gulpif(args.sourcemaps, sourcemaps.write()))
    .pipe(gulpif(args.production, uglify()))
    .pipe(gulp.dest('material/assets/javascripts/'));
});

/*
 * Create a customized modernizr build.
 */
gulp.task('assets:modernizr', [
  'assets:stylesheets',
  'assets:javascripts'
], function() {
  return gulp.src([
    'material/assets/stylesheets/application.css',
    'material/assets/javascripts/application.js'
  ]).pipe(
      modernizr({
        options: [
          'addTest',                   /* Add custom tests */
          'fnBind',                    /* Use function.bind */
          'html5printshiv',            /* HTML5 support for IE */
          'setClasses',                /* Add CSS classes to root tag */
          'testProp'                   /* Test for properties */
        ]
      }))
    .pipe(addsrc.append('bower_components/respond/dest/respond.src.js'))
    .pipe(concat('modernizr.js'))
    .pipe(gulpif(args.production, uglify()))
    .pipe(gulp.dest('material/assets/javascripts'));
});

/*
 * Copy static assets like images and webfonts.
 */
gulp.task('assets:static', function() {
  return gulp.src('src/assets/{fonts,images}/*.{jpg,png,gif}')
    .pipe(gulpif(args.production,
      minimage({
        optimizationLevel: 5,
        progressive: true,
        interlaced: true
      })))
    .pipe(addsrc.append('src/assets/{fonts,images}/*.{ico,eot,svg,ttf,woff}'))
    .pipe(gulp.dest('material/assets/'));
});

/*
 * Minify views.
 */
gulp.task('assets:views', args.production ? [
  'assets:modernizr',
  'assets:revisions:clean',
  'assets:revisions'
] : [], function() {
  return gulp.src([
    'src/*.html'
  ]).pipe(
      minhtml({
        collapseBooleanAttributes: true,
        removeComments: true,
        removeScriptTypeAttributes: true,
        removeStyleLinkTypeAttributes: true
      }))
    .pipe(compact())
    .pipe(gulpif(args.production,
      addsrc.append([
        'material/manifest.json',
        'material/**/*.css'
      ])))
    .pipe(gulpif(args.production, collect()))
    .pipe(ignore.exclude(/manifest\.json$/))
    .pipe(gulp.dest('material'));
});

/*
 * Clean outdated revisions.
 */
gulp.task('assets:revisions:clean', function() {
  return gulp.src(['material/**/*.{ico,css,js,png,jpg,gif}'])
    .pipe(ignore.include(/-[a-f0-9]{8,}\.(ico|css|js|png|jpg|gif)$/))
    .pipe(vinyl(clean));
});

/*
 * Revision assets after build.
 */
gulp.task('assets:revisions', [
  'assets:revisions:clean',
  'assets:stylesheets',
  'assets:javascripts',
  'assets:static'
], function() {
  return gulp.src(['material/**/*.{ico,css,js,png,jpg,gif}'])
    .pipe(ignore.exclude(/-[a-f0-9]{8,}\.(css|js|png|jpg|gif)$/))
    .pipe(rev())
    .pipe(gulp.dest('material'))
    .pipe(rev.manifest('manifest.json'))
    .pipe(gulp.dest('material'));
});

/*
 * Build assets.
 */
gulp.task('assets:build', [
  'assets:stylesheets',
  'assets:javascripts',
  'assets:modernizr',
  'assets:static',
  'assets:views'
]);

/*
 * Watch assets for changes and rebuild on the fly.
 */
gulp.task('assets:watch', function() {

  /* Rebuild stylesheets */
  gulp.watch([
    'src/assets/stylesheets/**/*.scss'
  ], ['assets:stylesheets']);

  /* Rebuild javascripts */
  gulp.watch([
    'src/assets/javascripts/**/*.js',
    'bower.json'
  ], ['assets:javascripts']);

  /* Copy static assets */
  gulp.watch([
    'src/assets/{fonts,images}/*'
  ], ['assets:static']);

  /* Minify views */
  gulp.watch([
    'src/*.html'
  ], ['assets:views']);
});

/* ----------------------------------------------------------------------------
 * Application server
 * ------------------------------------------------------------------------- */

/*
 * Build documentation.
 */
gulp.task('mkdocs:build', [
  'assets:build'
], function() {
  return child.spawnSync('mkdocs', ['build']);
});

/*
 * Restart MkDocs server.
 */
gulp.task('mkdocs:serve', function() {
  if (server)
    server.kill();

  /* Spawn MkDocs server */
  server = child.spawn('mkdocs', ['serve', '-a', '0.0.0.0:8000']);

  /* Pretty print server log output */
  server.stdout.on('data', function(data) {
    var lines = data.toString().split('\n')
    for (var l in lines)
      if (lines[l].length)
        util.log(lines[l]);
  });

  /* Print errors to stdout */
  server.stderr.on('data', function(data) {
    process.stdout.write(data.toString());
  });
});

/* ----------------------------------------------------------------------------
 * Interface
 * ------------------------------------------------------------------------- */

/*
 * Build assets and documentation.
 */
gulp.task('build', [
  'assets:build'
].concat(args.mkdocs
  ? 'mkdocs:build'
  : []));

/*
 * Start asset and MkDocs watchdogs.
 */
gulp.task('watch', [
  'assets:build',
], function() {
  return gulp.start([
    'assets:watch'
  ].concat(args.mkdocs
    ? 'mkdocs:serve'
    : []));
});

/*
 * Build assets by default.
 */
gulp.task('default', ['build']);


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
 See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 Esri Inc. licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<gptConfig version="10.0.0.200">

  <databaseReference name="gpt" jndiName="jdbc/gpt"/>

  <catalog gptTablePrefix="GPT_">

    <search
      searchTimeoutMillisecs="10000"
      distributedSearchTimeoutMillisecs="5000"
      distributedSearchMaxSelectedSites="5"
      searchResultsPerPage="10"
      searchResultsReviewsShown="all"
      maxSavedSearches="10"
      allowExternalSiteSearch="true">

      <repositories>
        <repository key="local"
          class="com.esri.gpt.catalog.search.SearchEngineLocal"
          labelResourceKey="catalog.search.searchSite.defaultsite"
          abstractResourceKey="catalog.search.searchSite.defaultsite.abstract"/>

        <repository key="^$"
          class="com.esri.gpt.catalog.search.SearchEngineLocal"
          labelResourceKey=""
          abstractResourceKey=""/>

       <repository key="SharePoint"
          class="com.esri.gpt.catalog.search.SearchEngineRest"
          labelResourceKey="catalog.search.searchSite.sharePoint"
          abstractResourceKey="catalog.search.searchSite.sharePoint.abstract">
                <parameter key="endPointSearchUrl"
            value="http://pswebsp/SearchCenter/_layouts/srchrss.aspx?k={searchTerms}&start={startIndex}"/>

          <parameter key="profileId"
             value="urn:esri:gpt:HTTP:XML:SHAREPOINT" />
          <parameter key="defaultParamValues"
              value="k✔DefaultToPreventExceptionOnEmptyKeyword"/>
         </repository>

        <repository key="ArcGIS.COM"
          class="com.esri.gpt.catalog.search.SearchEngineRest"
          labelResourceKey="catalog.search.searchSite.agsonline"
          abstractResourceKey="catalog.search.searchSite.agsonline.abstract">
          <parameter key="endPointSearchUrl"
              value="http://www.arcgis.com/sharing/search?q={searchTerms}&start={startIndex}&num={count}&focus={gpt:contenttype?}&f=json"/>
          <parameter key="defaultParamValues"
              value="q✔access:shared || access:public || access:private "/>
          <parameter key="profileId"
              value="urn:esri:gpt:HTTP:JSON:ESRI:AGSONLINE" />
          <parameter key="gpt:contentType"
              value="liveMap✔maps✕application✔applications"/>
        </repository>

        <repository key="ArcGIS.COM|ArcGISOnline|ArcGISOnline2"
          class="com.esri.gpt.catalog.search.SearchEngineRest"
          labelResourceKey=""
          abstractResourceKey="">
          <parameter key="endPointSearchUrl"
              value="http://www.arcgis.com/sharing/search?q={searchTerms}&start={startIndex}&num={count}&f=json"/>
          <parameter key="defaultParamValues"
              value="q✔access:shared || access:public || access:private "/>
          <parameter key="profileId"
              value="urn:esri:gpt:HTTP:JSON:ESRI:AGSONLINE" />
          <parameter key="gpt:contentType"
              value="liveMap✔maps✕application✔applications"/>
        </repository>

        <repository key="*"
          class="com.esri.gpt.catalog.search.SearchEngineExternalCsw"/>
      </repositories>
    </search>

	<parameter key="webharvester.active" value="false"/>

	<parameter key="openls.geocode" value="http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer"/>
	<parameter key="openls.reverseGeocode" value="http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer"/>
	<parameter key="openls.portrayMap" value="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
	<parameter key="openls.determineRoute" value="http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route"/>
	<parameter key="openls.determineRoute.mapService" value="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
	<parameter key="openls.directory" value="http://trainingcloud.arcgis.com/ArcGIS/rest/services/Redlands_PointsOfInterest/MapServer/0"/>

     <!-- Directory field mappings -->
	<parameter key="POIName" value="NAME"/>
	<parameter key="PhoneNumber" value="TEL"/>
	<parameter key="NAICS_type" value="TYPE"/>
	<parameter key="NAICS_subtype" value="DESC_"/>
	<parameter key="NAICS_category" value="TYPE"/>
	<parameter key="SIC_type" value="TYPE"/>
	<parameter key="SIC_code" value="OBJECTID"/>
	<parameter key="SIC_subtype" value="DESC_"/>
	<parameter key="SIC_category" value="TYPE"/>
	<parameter key="Keyword" value="COMMENT"/>
  </catalog>

</gptConfig>


text:
package org.jetbrains.jps.model;

import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.ContainerUtilRt;
import org.jetbrains.jps.model.java.*;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.module.*;

import java.util.List;

/**
 * @author nik
 */
public class JpsModuleTest extends JpsModelTestCase {
  public void testAddSourceRoot() {
    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    JpsSimpleElement<JavaSourceRootProperties> properties = JpsElementFactory.getInstance().createSimpleElement(
      new JavaSourceRootProperties("com.xxx"));
    final JpsModuleSourceRoot sourceRoot = module.addSourceRoot("file://url", JavaSourceRootType.SOURCE, properties);

    assertSameElements(myDispatcher.retrieveAdded(JpsModule.class), module);
    assertSameElements(myDispatcher.retrieveAdded(JpsModuleSourceRoot.class), sourceRoot);

    final JpsModuleSourceRoot root = assertOneElement(module.getSourceRoots());
    assertEquals("file://url", root.getUrl());
    assertSameElements(ContainerUtilRt.newArrayList(module.getSourceRoots(JavaSourceRootType.SOURCE)), root);
    assertEmpty(ContainerUtil.newArrayList(module.getSourceRoots(JavaSourceRootType.TEST_SOURCE)));
    JpsTypedModuleSourceRoot<JpsSimpleElement<JavaSourceRootProperties>> typedRoot = root.asTyped(JavaSourceRootType.SOURCE);
    assertNotNull(typedRoot);
    assertEquals("com.xxx", typedRoot.getProperties().getData().getPackagePrefix());
  }

  public void testGetModulesOfType() {
    JpsProject project = myProject;
    JpsModule module = project.addModule("m", JpsJavaModuleType.INSTANCE);
    Iterable<JpsTypedModule<JpsDummyElement>> modules = project.getModules(JpsJavaModuleType.INSTANCE);
    assertSameElements(ContainerUtil.newArrayList(modules), module);
  }

  public void testModifiableModel() {
    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    final JpsModuleSourceRoot root0 = module.addSourceRoot("url1", JavaSourceRootType.SOURCE);
    myDispatcher.clear();

    final JpsModel modifiableModel = myModel.createModifiableModel(new TestJpsEventDispatcher());
    final JpsModule modifiableModule = assertOneElement(modifiableModel.getProject().getModules());
    modifiableModule.addSourceRoot("url2", JavaSourceRootType.TEST_SOURCE);
    modifiableModel.commit();

    assertEmpty(myDispatcher.retrieveAdded(JpsModule.class));
    assertEmpty(myDispatcher.retrieveRemoved(JpsModule.class));

    final List<? extends JpsModuleSourceRoot> roots = module.getSourceRoots();
    assertEquals(2, roots.size());
    assertSame(root0, roots.get(0));
    final JpsModuleSourceRoot root1 = roots.get(1);
    assertEquals("url2", root1.getUrl());
    assertOrderedEquals(myDispatcher.retrieveAdded(JpsModuleSourceRoot.class), root1);
    assertEmpty(myDispatcher.retrieveChanged(JpsModuleSourceRoot.class));
  }

  public void testAddDependency() {
    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE);
    final JpsModule dep = myProject.addModule("dep", JpsJavaModuleType.INSTANCE);
    module.getDependenciesList().addLibraryDependency(library);
    module.getDependenciesList().addModuleDependency(dep);

    final List<? extends JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies();
    assertEquals(3, dependencies.size());
    assertInstanceOf(dependencies.get(0), JpsModuleSourceDependency.class);
    assertSame(library, assertInstanceOf(dependencies.get(1), JpsLibraryDependency.class).getLibrary());
    assertSame(dep, assertInstanceOf(dependencies.get(2), JpsModuleDependency.class).getModule());
  }

  public void testChangeElementInModifiableModel() {
    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    final JpsModule dep = myProject.addModule("dep", JpsJavaModuleType.INSTANCE);
    final JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE);
    module.getDependenciesList().addLibraryDependency(library);
    myDispatcher.clear();

    final JpsModel modifiableModel = myModel.createModifiableModel(new TestJpsEventDispatcher());
    final JpsModule m = modifiableModel.getProject().getModules().get(0);
    assertEquals("m", m.getName());
    m.getDependenciesList().getDependencies().get(1).remove();
    m.getDependenciesList().addModuleDependency(dep);
    modifiableModel.commit();
    assertOneElement(myDispatcher.retrieveRemoved(JpsLibraryDependency.class));
    assertSame(dep, assertOneElement(myDispatcher.retrieveAdded(JpsModuleDependency.class)).getModuleReference().resolve());
    List<JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies();
    assertEquals(2, dependencies.size());
    assertSame(dep, assertInstanceOf(dependencies.get(1), JpsModuleDependency.class).getModuleReference().resolve());
  }

  public void testCreateReferenceByModule() {
    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    final JpsModuleReference reference = module.createReference().asExternal(myModel);
    assertEquals("m", reference.getModuleName());
    assertSame(module, reference.resolve());
  }

  public void testCreateReferenceByName() {
    final JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference("m").asExternal(myModel);
    assertEquals("m", reference.getModuleName());
    assertNull(reference.resolve());

    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    assertSame(module, reference.resolve());
  }

  public void testSdkDependency() {
    JpsSdk<JpsDummyElement> sdk = myModel.getGlobal().addSdk("sdk", null, null, JpsJavaSdkType.INSTANCE).getProperties();
    final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
    module.getSdkReferencesTable().setSdkReference(JpsJavaSdkType.INSTANCE, sdk.createReference());
    module.getDependenciesList().addSdkDependency(JpsJavaSdkType.INSTANCE);

    List<JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies();
    assertEquals(2, dependencies.size());
    final JpsSdkDependency dependency = assertInstanceOf(dependencies.get(1), JpsSdkDependency.class);
    assertSame(sdk.getParent(), dependency.resolveSdk());
  }
}


text:
import Ember from 'ember';
import minValidator  from '../../../validations/min';
import { module, test } from 'qunit';

module('Unit | Validation | min');

test('valid', function(assert) {
  assert.expect(1);

  const Context = Ember.Object.extend({});
  const min = minValidator.validate.bind(Context.create({ min: 2 }));

  assert.deepEqual(min('123', []), []);
});

test('inValid', function(assert) {
  assert.expect(1);

  const Context = Ember.Object.extend({});
  const min = minValidator.validate.bind(Context.create({ min: 2 }));

  assert.deepEqual(min('1', []), ['Please enter a value greater than or equal to 2']);
});

test('message override', function(assert) {
  assert.expect(1);

  const Context = Ember.Object.extend({});
  const min = minValidator.validate.bind(Context.create({ min: 2, minMessage: 'foobar' }));

  assert.deepEqual(min('1', []), ['foobar']);
});


text:
/**
  Our data model for showing a preview of an email

  @class EmailPreview
  @extends Discourse.Model
  @namespace Discourse
  @module Discourse
**/
Discourse.EmailPreview = Discourse.Model.extend({});

Discourse.EmailPreview.reopenClass({
  findDigest: function(lastSeenAt) {

    if (Em.isEmpty(lastSeenAt)) {
      lastSeenAt = moment().subtract('days',7).format('YYYY-MM-DD');
    }

    return Discourse.ajax("/admin/email/preview-digest.json", {
      data: {last_seen_at: lastSeenAt}
    }).then(function (result) {
      return Discourse.EmailPreview.create(result);
    });
  }
});


text:
package floobits.actions;

import com.intellij.openapi.actionSystem.AnActionEvent;
import floobits.FloobitsPlugin;
import floobits.common.EditorEventHandler;

public class FollowUser extends IsJoinedAction {
    @Override
    public void actionPerformed(AnActionEvent e, EditorEventHandler editorEventHandler, FloobitsPlugin floobitsPlugin) {
        floobitsPlugin.context.followUser();
    }
}


text:
package org.apache.beam.runners.spark.translation;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.beam.runners.spark.coders.CoderHelpers;
import org.apache.beam.runners.spark.util.SideInputBroadcast;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.util.WindowedValue;
import org.apache.beam.sdk.values.PCollectionView;
import org.apache.spark.api.java.JavaSparkContext;
import scala.Tuple2;

/**
 * SparkPCollectionView is used to pass serialized views to lambdas.
 */
public class SparkPCollectionView implements Serializable {

    // Holds the view --> broadcast mapping. Transient so it will be null from resume
    private transient volatile Map<PCollectionView<?>, SideInputBroadcast>
        broadcastHelperMap = null;

    // Holds the Actual data of the views in serialize form
    private Map<PCollectionView<?>,
        Tuple2<byte[], Coder<Iterable<WindowedValue<?>>>>> pviews =
            new LinkedHashMap<>();

    // Driver only - during evaluation stage
    void putPView(
        PCollectionView<?> view,
        Iterable<WindowedValue<?>> value,
        Coder<Iterable<WindowedValue<?>>> coder) {

        pviews.put(view, new Tuple2<>(CoderHelpers.toByteArray(value, coder), coder));

        // Currently unsynchronized unpersist, if needed can be changed to blocking
        if (broadcastHelperMap != null) {
            synchronized (SparkPCollectionView.class) {
                SideInputBroadcast helper = broadcastHelperMap.get(view);
                if (helper != null) {
                    helper.unpersist();
                    broadcastHelperMap.remove(view);
                }
            }
        }
    }

    SideInputBroadcast getPCollectionView(
        PCollectionView<?> view,
        JavaSparkContext context) {
        // initialize broadcastHelperMap if needed
        if (broadcastHelperMap == null) {
            synchronized (SparkPCollectionView.class) {
                if (broadcastHelperMap == null) {
                    broadcastHelperMap = new LinkedHashMap<>();
                }
            }
        }

        //lazily broadcast views
        SideInputBroadcast helper = broadcastHelperMap.get(view);
        if (helper == null) {
            synchronized (SparkPCollectionView.class) {
                helper = broadcastHelperMap.get(view);
                if (helper == null) {
                    helper = createBroadcastHelper(view, context);
                }
            }
        }
        return helper;
    }

    private SideInputBroadcast createBroadcastHelper(
        PCollectionView<?> view,
        JavaSparkContext context) {
        Tuple2<byte[], Coder<Iterable<WindowedValue<?>>>> tuple2 = pviews.get(view);
        SideInputBroadcast helper = SideInputBroadcast.create(tuple2._1, tuple2._2);
        helper.broadcast(context);
        broadcastHelperMap.put(view, helper);
        return helper;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>Shindig | Register</title>
    <link rel="stylesheet" href="assets/css/styles.css"/>


text:
describe('patient', function(){

    var httpBackend, $scope, controller, authRequestHandler;

    beforeEach(angular.mock.module("careProviderPortal"));

    beforeEach(inject(function($injector,$rootScope,$httpBackend){

        httpBackend = $httpBackend;

        httpBackend.whenPOST(/\/patientLookup.php/).respond(200,{NameLast: "s", NameFirst: "f", DOB: "2017-03-01"});

        $scope = $rootScope.$new();
    }));

    it('should work', inject(function($controller){

        controller = $controller('patientCtrl', {
            $scope: $scope
        });
        $scope.patientID = "1232890";
        $scope.getPatientData();
        httpBackend.flush();
        expect($scope.status).toBe(200);
        expect($scope.patientInfo).toEqual({NameLast: "s", NameFirst: "f", DOB: "2017-03-01"});
        expect($scope.show).toBe(true);

    }));
});


text:
/*	$NetBSD: dmac_0266.h,v 1.1 1999/12/09 14:53:04 tsutsui Exp $	*/

/*-
 * Copyright (C) 1999 Izumi Tsutsui.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/* DMAC 266 register definition */

struct dma_regs {
	u_int32_t	ctl;			/* Control Register	*/
#define	 DC_CTL_RST	0x04			/* Soft Reset		*/
#define	 DC_CTL_MOD	0x02			/* set transfer dir	*/
#define	 DC_CTL_ENB	0x01			/* set Enable		*/

	u_int32_t	stat;			/* Status Register 	*/
#define	 DC_ST_TCZ	0x10			/* Transfer Count Zero 	*/
#define	 DC_ST_INT	0x08			/* Interrupt 		*/
#define	 DC_ST_MOD	0x02			/* monitor transfer dir	*/
#define	 DC_ST_ENB	0x01			/* monitor Enable	*/

	u_int32_t	tcnt;			/* transfer counter	*/
	u_int32_t	tag;			/* Tag Register 	*/
	u_int32_t	offset;			/* Offset Register 	*/
	u_int32_t	mapent;			/* Map entry Register 	*/
};

#define DMAC_WAIT	__asm __volatile ("nop; nop; nop; nop; nop; nop")

#define DMAC_SEG_SIZE	0x1000 /* 4kbyte per DMA segment */
#define DMAC_SEG_OFFSET	0x0fff
#define DMAC_SEG_SHIFT	12


text:
@interface NavigationBarTitleView : UIView

@end


text:
namespace faint {

class Bitmap;
class ColRGB;
class utf8_string;

class Clipboard{
public:
  Clipboard();
  ~Clipboard();
  static void Flush();
  Optional<Bitmap> GetBitmap();
  Optional<objects_t> GetObjects();
  Optional<utf8_string> GetText();

  bool Good() const;

  // Puts the bitmap in the clipboard. When pasted outside Faint,
  // pixels with alpha will be blended onto bgCol.
  void SetBitmap(const Bitmap&, const ColRGB& bgCol);
  void SetObjects(const objects_t&);
  void SetText(const utf8_string&);
private:
  bool m_ok;
};

} // namespace

#endif


text:
export default class Page{
	constructor(path,vid,lock,configuration = null, modules = null, keepLive = false, allowDuplicate = false, ghostPage = false, roles = null){
		this.path = path;
		this.vid = vid;
		this.lock = lock;
		this.configuration = configuration;
		this.modules = modules;
		this.roles = roles;
		this.keepLive = keepLive;
		this.allowDuplicate = allowDuplicate;
		this.ghostPage = ghostPage;
	}
}