text:
   /*******************************************************/
   /*      "C" Language Integrated Production System      */
   /*                                                     */
   /*             CLIPS Version 6.24  06/02/06            */
   /*                                                     */
   /*                CLASS FUNCTIONS MODULE               */
   /*******************************************************/

/*************************************************************/
/* Purpose: Internal class manipulation routines             */
/*                                                           */
/* Principal Programmer(s):                                  */
/*      Brian L. Dantes                                      */
/*                                                           */
/* Contributing Programmer(s):                               */
/*                                                           */
/* Revision History:                                         */
/*                                                           */
/*      6.24: Renamed BOOLEAN macro type to intBool.         */
/*                                                           */
/*            Corrected code to remove run-time program      */
/*            compiler warning.                              */
/*                                                           */
/*************************************************************/

/* =========================================
   *****************************************
               EXTERNAL DEFINITIONS
   =========================================
   ***************************************** */

#include <stdlib.h>

#include "setup.h"

#if OBJECT_SYSTEM

#if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE
#include "bload.h"
#endif

#include "classcom.h"
#include "classini.h"
#include "constant.h"
#include "constrct.h"
#include "cstrccom.h"
#include "cstrcpsr.h"
#include "envrnmnt.h"
#include "evaluatn.h"
#include "inscom.h"
#include "insfun.h"
#include "insmngr.h"
#include "memalloc.h"
#include "modulutl.h"
#include "msgfun.h"
#include "router.h"
#include "scanner.h"
#include "utility.h"

#define _CLASSFUN_SOURCE_
#include "classfun.h"

/* =========================================
   *****************************************
                   CONSTANTS
   =========================================
   ***************************************** */
#define BIG_PRIME          11329

#define CLASS_ID_MAP_CHUNK 30

#define PUT_PREFIX         "put-"
#define PUT_PREFIX_LENGTH  4

/* =========================================
   *****************************************
      INTERNALLY VISIBLE FUNCTION HEADERS
   =========================================
   ***************************************** */

static unsigned HashSlotName(SYMBOL_HN *);

#if (! RUN_TIME)
static int NewSlotNameID(void *);
static void DeassignClassID(void *,unsigned);
#endif

/* =========================================
   *****************************************
          EXTERNALLY VISIBLE FUNCTIONS
   =========================================
   ***************************************** */

/***************************************************
  NAME         : IncrementDefclassBusyCount
  DESCRIPTION  : Increments use count of defclass
  INPUTS       : The class
  RETURNS      : Nothing useful
  SIDE EFFECTS : Busy count incremented
  NOTES        : None
 ***************************************************/
globle void IncrementDefclassBusyCount(
  void *theEnv,
  void *theDefclass)
  {

   ((DEFCLASS *) theDefclass)->busy++;
  }

/***************************************************
  NAME         : DecrementDefclassBusyCount
  DESCRIPTION  : Decrements use count of defclass
  INPUTS       : The class
  RETURNS      : Nothing useful
  SIDE EFFECTS : Busy count decremented
  NOTES        : Since use counts are ignored on
                 a clear and defclasses might be
                 deleted already anyway, this is
                 a no-op on a clear
 ***************************************************/
globle void DecrementDefclassBusyCount(
  void *theEnv,
  void *theDefclass)
  {
   if (! ConstructData(theEnv)->ClearInProgress)
     ((DEFCLASS *) theDefclass)->busy--;
  }

/****************************************************
  NAME         : InstancesPurge
  DESCRIPTION  : Removes all instances
  INPUTS       : None
  RETURNS      : TRUE if all instances deleted,
                 FALSE otherwise
  SIDE EFFECTS : The instance hash table is cleared
  NOTES        : None
 ****************************************************/
globle intBool InstancesPurge(
  void *theEnv)
  {
   int svdepth;

   DestroyAllInstances(theEnv);
   svdepth = EvaluationData(theEnv)->CurrentEvaluationDepth;
   if (EvaluationData(theEnv)->CurrentEvaluationDepth == 0)
     EvaluationData(theEnv)->CurrentEvaluationDepth = -1;
   CleanupInstances(theEnv);
   EvaluationData(theEnv)->CurrentEvaluationDepth = svdepth;
   return((InstanceData(theEnv)->InstanceList != NULL) ? FALSE : TRUE);
  }

#if ! RUN_TIME

/***************************************************
  NAME         : InitializeClasses
  DESCRIPTION  : Allocates class hash table
                 Initializes class hash table
                   to all NULL addresses
                 Creates system classes
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Hash table initialized
  NOTES        : None
 ***************************************************/
globle void InitializeClasses(
  void *theEnv)
  {
   register int i;

   DefclassData(theEnv)->ClassTable =
      (DEFCLASS **) gm2(theEnv,(int) (sizeof(DEFCLASS *) * CLASS_TABLE_HASH_SIZE));
   for (i = 0 ; i < CLASS_TABLE_HASH_SIZE ; i++)
     DefclassData(theEnv)->ClassTable[i] = NULL;
   DefclassData(theEnv)->SlotNameTable =
      (SLOT_NAME **) gm2(theEnv,(int) (sizeof(SLOT_NAME *) * SLOT_NAME_TABLE_HASH_SIZE));
   for (i = 0 ; i < SLOT_NAME_TABLE_HASH_SIZE ; i++)
     DefclassData(theEnv)->SlotNameTable[i] = NULL;
  }

#endif

/********************************************************
  NAME         : FindClassSlot
  DESCRIPTION  : Searches for a named slot in a class
  INPUTS       : 1) The class address
                 2) The symbolic slot name
  RETURNS      : Address of slot if found, NULL otherwise
  SIDE EFFECTS : None
  NOTES        : Only looks in class defn, does not
                   examine inheritance paths
 ********************************************************/
globle SLOT_DESC *FindClassSlot(
  DEFCLASS *cls,
  SYMBOL_HN *sname)
  {
   long i;

   for (i = 0 ; i < cls->slotCount ; i++)
     {
      if (cls->slots[i].slotName->name == sname)
        return(&cls->slots[i]);
     }
   return(NULL);
  }

/***************************************************************
  NAME         : ClassExistError
  DESCRIPTION  : Prints out error message for non-existent class
  INPUTS       : 1) Name of function having the error
                 2) The name of the non-existent class
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        : None
 ***************************************************************/
globle void ClassExistError(
  void *theEnv,
  char *func,
  char *cname)
  {
   PrintErrorID(theEnv,(char*)"CLASSFUN",1,FALSE);
   EnvPrintRouter(theEnv,WERROR,(char*)"Unable to find class ");
   EnvPrintRouter(theEnv,WERROR,cname);
   EnvPrintRouter(theEnv,WERROR,(char*)" in function ");
   EnvPrintRouter(theEnv,WERROR,func);
   EnvPrintRouter(theEnv,WERROR,(char*)".\n");
   SetEvaluationError(theEnv,TRUE);
  }

/*********************************************
  NAME         : DeleteClassLinks
  DESCRIPTION  : Deallocates a class link list
  INPUTS       : The address of the list
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        : None
 *********************************************/
globle void DeleteClassLinks(
  void *theEnv,
  CLASS_LINK *clink)
  {
   CLASS_LINK *ctmp;

   for (ctmp = clink ; ctmp != NULL ; ctmp = clink)
     {
      clink = clink->nxt;
      rtn_struct(theEnv,classLink,ctmp);
     }
  }

/******************************************************
  NAME         : PrintClassName
  DESCRIPTION  : Displays a class's name
  INPUTS       : 1) Logical name of output
                 2) The class
                 3) Flag indicating whether to
                    print carriage-return at end
  RETURNS      : Nothing useful
  SIDE EFFECTS : Class name printed (and module name
                 too if class is not in current module)
  NOTES        : None
 ******************************************************/
globle void PrintClassName(
  void *theEnv,
  char *logicalName,
  DEFCLASS *theDefclass,
  intBool linefeedFlag)
  {
   if ((theDefclass->header.whichModule->theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv))) &&
       (theDefclass->system == 0))
     {
      EnvPrintRouter(theEnv,logicalName,
                 EnvGetDefmoduleName(theEnv,theDefclass->header.whichModule->theModule));
      EnvPrintRouter(theEnv,logicalName,(char*)"::");
     }
   EnvPrintRouter(theEnv,logicalName,ValueToString(theDefclass->header.name));
   if (linefeedFlag)
     EnvPrintRouter(theEnv,logicalName,(char*)"\n");
  }

#if DEBUGGING_FUNCTIONS || ((! BLOAD_ONLY) && (! RUN_TIME))

/***************************************************
  NAME         : PrintPackedClassLinks
  DESCRIPTION  : Displays the names of classes in
                 a list with a title
  INPUTS       : 1) The logical name of the output
                 2) Title string
                 3) List of class links
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        : None
 ***************************************************/
globle void PrintPackedClassLinks(
  void *theEnv,
  char *logicalName,
  char *title,
  PACKED_CLASS_LINKS *plinks)
  {
   long i;

   EnvPrintRouter(theEnv,logicalName,title);
   for (i = 0 ; i < plinks->classCount ; i++)
     {
      EnvPrintRouter(theEnv,logicalName,(char*)" ");
      PrintClassName(theEnv,logicalName,plinks->classArray[i],FALSE);
     }
   EnvPrintRouter(theEnv,logicalName,(char*)"\n");
  }

#endif

#if ! RUN_TIME

/*******************************************************
  NAME         : PutClassInTable
  DESCRIPTION  : Inserts a class in the class hash table
  INPUTS       : The class
  RETURNS      : Nothing useful
  SIDE EFFECTS : Class inserted
  NOTES        : None
 *******************************************************/
globle void PutClassInTable(
  void *theEnv,
  DEFCLASS *cls)
  {
   cls->hashTableIndex = HashClass(GetDefclassNamePointer((void *) cls));
   cls->nxtHash = DefclassData(theEnv)->ClassTable[cls->hashTableIndex];
   DefclassData(theEnv)->ClassTable[cls->hashTableIndex] = cls;
  }

/*********************************************************
  NAME         : RemoveClassFromTable
  DESCRIPTION  : Removes a class from the class hash table
  INPUTS       : The class
  RETURNS      : Nothing useful
  SIDE EFFECTS : Class removed
  NOTES        : None
 *********************************************************/
globle void RemoveClassFromTable(
  void *theEnv,
  DEFCLASS *cls)
  {
   DEFCLASS *prvhsh,*hshptr;

   prvhsh = NULL;
   hshptr = DefclassData(theEnv)->ClassTable[cls->hashTableIndex];
   while (hshptr != cls)
     {
      prvhsh = hshptr;
      hshptr = hshptr->nxtHash;
     }
   if (prvhsh == NULL)
     DefclassData(theEnv)->ClassTable[cls->hashTableIndex] = cls->nxtHash;
   else
     prvhsh->nxtHash = cls->nxtHash;
  }

/***************************************************
  NAME         : AddClassLink
  DESCRIPTION  : Adds a class link from one class to
                  another
  INPUTS       : 1) The packed links in which to
                    insert the new class
                 2) The subclass pointer
                 3) Index of where to place the
                    class (-1 to append)
  RETURNS      : Nothing useful
  SIDE EFFECTS : Link created and attached
  NOTES        : Assumes the pack structure belongs
                 to a class and does not need to
                 be deallocated
 ***************************************************/
globle void AddClassLink(
  void *theEnv,
  PACKED_CLASS_LINKS *src,
  DEFCLASS *cls,
  int posn)
  {
   PACKED_CLASS_LINKS dst;

   dst.classArray = (DEFCLASS **) gm2(theEnv,(sizeof(DEFCLASS *) * (src->classCount + 1)));

   if (posn == -1)
     {
      GenCopyMemory(DEFCLASS *,src->classCount,dst.classArray,src->classArray);
      dst.classArray[src->classCount] = cls;
     }
   else
     {
      if (posn != 0)
        GenCopyMemory(DEFCLASS *,posn,dst.classArray,src->classArray);
      GenCopyMemory(DEFCLASS *,src->classCount - posn,
                 dst.classArray + posn + 1,src->classArray + posn);
      dst.classArray[posn] = cls;
     }
   dst.classCount = (unsigned short) (src->classCount + 1);
   DeletePackedClassLinks(theEnv,src,FALSE);
   src->classCount = dst.classCount;
   src->classArray = dst.classArray;
  }

/***************************************************
  NAME         : DeleteSubclassLink
  DESCRIPTION  : Removes a class from another
                 class's subclass list
  INPUTS       : 1) The superclass whose subclass
                    list is to be modified
                 2) The subclass to be removed
  RETURNS      : Nothing useful
  SIDE EFFECTS : The subclass list is changed
  NOTES        : None
 ***************************************************/
globle void DeleteSubclassLink(
  void *theEnv,
  DEFCLASS *sclass,
  DEFCLASS *cls)
  {
   long deletedIndex;
   PACKED_CLASS_LINKS *src,dst;

   src = &sclass->directSubclasses;
   for (deletedIndex = 0 ; deletedIndex < src->classCount ; deletedIndex++)
     if (src->classArray[deletedIndex] == cls)
       break;
   if (deletedIndex == src->classCount)
     return;
   if (src->classCount > 1)
     {
      dst.classArray = (DEFCLASS **) gm2(theEnv,(sizeof(DEFCLASS *) * (src->classCount - 1)));
      if (deletedIndex != 0)
        GenCopyMemory(DEFCLASS *,deletedIndex,dst.classArray,src->classArray);
      GenCopyMemory(DEFCLASS *,src->classCount - deletedIndex - 1,
                 dst.classArray + deletedIndex,src->classArray + deletedIndex + 1);
     }
   else
     dst.classArray = NULL;
   dst.classCount = (unsigned short) (src->classCount - 1);
   DeletePackedClassLinks(theEnv,src,FALSE);
   src->classCount = dst.classCount;
   src->classArray = dst.classArray;
  }

/**************************************************************
  NAME         : NewClass
  DESCRIPTION  : Allocates and initalizes a new class structure
  INPUTS       : The symbolic name of the new class
  RETURNS      : The address of the new class
  SIDE EFFECTS : None
  NOTES        : None
 **************************************************************/
globle DEFCLASS *NewClass(
  void *theEnv,
  SYMBOL_HN *className)
  {
   register DEFCLASS *cls;

   cls = get_struct(theEnv,defclass);
   InitializeConstructHeader(theEnv,(char*)"defclass",(struct constructHeader *) cls,className);

   cls->id = 0;
   cls->installed = 0;
   cls->busy = 0;
   cls->system = 0;
   cls->abstract = 0;
   cls->reactive = 1;
#if DEBUGGING_FUNCTIONS
   cls->traceInstances = DefclassData(theEnv)->WatchInstances;
   cls->traceSlots = DefclassData(theEnv)->WatchSlots;
#endif
   cls->hashTableIndex = 0;
   cls->directSuperclasses.classCount = 0;
   cls->directSuperclasses.classArray = NULL;
   cls->directSubclasses.classCount = 0;
   cls->directSubclasses.classArray = NULL;
   cls->allSuperclasses.classCount = 0;
   cls->allSuperclasses.classArray = NULL;
   cls->slots = NULL;
   cls->instanceTemplate = NULL;
   cls->slotNameMap = NULL;
   cls->instanceSlotCount = 0;
   cls->localInstanceSlotCount = 0;
   cls->slotCount = 0;
   cls->maxSlotNameID = 0;
   cls->handlers = NULL;
   cls->handlerOrderMap = NULL;
   cls->handlerCount = 0;
   cls->instanceList = NULL;
   cls->instanceListBottom = NULL;
   cls->nxtHash = NULL;
   cls->scopeMap = NULL;
   ClearBitString(cls->traversalRecord,TRAVERSAL_BYTES);
   return(cls);
  }

/***************************************************
  NAME         : DeletePackedClassLinks
  DESCRIPTION  : Dealloacates a contiguous array
                 holding class links
  INPUTS       : 1) The class link segment
                 2) A flag indicating whether to
                    delete the top pack structure
  RETURNS      : Nothing useful
  SIDE EFFECTS : Class links deallocated
  NOTES        : None
 ***************************************************/
globle void DeletePackedClassLinks(
  void *theEnv,
  PACKED_CLASS_LINKS *plp,
  int deleteTop)
  {
   if (plp->classCount > 0)
     {
      rm(theEnv,(void *) plp->classArray,(sizeof(DEFCLASS *) * plp->classCount));
      plp->classCount = 0;
      plp->classArray = NULL;
     }
   if (deleteTop)
     rtn_struct(theEnv,packedClassLinks,plp);
  }

/***************************************************
  NAME         : AssignClassID
  DESCRIPTION  : Assigns a unique id to a class
                 and puts its address in the
                 id map
  INPUTS       : The class
  RETURNS      : Nothing useful
  SIDE EFFECTS : Class id assigned and map set
  NOTES        : None
 ***************************************************/
globle void AssignClassID(
  void *theEnv,
  DEFCLASS *cls)
  {
   register unsigned i;

   if ((DefclassData(theEnv)->MaxClassID % CLASS_ID_MAP_CHUNK) == 0)
     {
      DefclassData(theEnv)->ClassIDMap = (DEFCLASS **) genrealloc(theEnv,(void *) DefclassData(theEnv)->ClassIDMap,
                       (unsigned) (DefclassData(theEnv)->MaxClassID * sizeof(DEFCLASS *)),
                       (unsigned) ((DefclassData(theEnv)->MaxClassID + CLASS_ID_MAP_CHUNK) * sizeof(DEFCLASS *)));
      DefclassData(theEnv)->AvailClassID += (unsigned short) CLASS_ID_MAP_CHUNK;

      for (i = DefclassData(theEnv)->MaxClassID ; i < (unsigned) (DefclassData(theEnv)->MaxClassID + CLASS_ID_MAP_CHUNK) ; i++)
        DefclassData(theEnv)->ClassIDMap[i] = NULL;
     }
   DefclassData(theEnv)->ClassIDMap[DefclassData(theEnv)->MaxClassID] = cls;
   cls->id = DefclassData(theEnv)->MaxClassID++;
  }

/*********************************************************
  NAME         : AddSlotName
  DESCRIPTION  : Adds a new slot entry (or increments
                 the use count of an existing node).
  INPUTS       : 1) The slot name
                 2) The new canonical id for the slot name
                 3) A flag indicating whether the
                    given id must be used or not
  RETURNS      : The id of the (old) node
  SIDE EFFECTS : Slot name entry added or use count
                 incremented
  NOTES        : None
 *********************************************************/
globle SLOT_NAME *AddSlotName(
  void *theEnv,
  SYMBOL_HN *slotName,
  int newid,
  int usenewid)
  {
   SLOT_NAME *snp;
   unsigned hashTableIndex;
   char *buf;
   size_t bufsz;

   hashTableIndex = HashSlotName(slotName);
   snp = DefclassData(theEnv)->SlotNameTable[hashTableIndex];
   while ((snp != NULL) ? (snp->name != slotName) : FALSE)
     snp = snp->nxt;
   if (snp != NULL)
     {
      if (usenewid && (newid != snp->id))
        {
         SystemError(theEnv,(char*)"CLASSFUN",1);
         EnvExitRouter(theEnv,EXIT_FAILURE);
        }
      snp->use++;
     }
   else
     {
      snp = get_struct(theEnv,slotName);
      snp->name = slotName;
      snp->hashTableIndex = hashTableIndex;
      snp->use = 1;
      snp->id = (short) (usenewid ? newid : NewSlotNameID(theEnv));
      snp->nxt = DefclassData(theEnv)->SlotNameTable[hashTableIndex];
      DefclassData(theEnv)->SlotNameTable[hashTableIndex] = snp;
      IncrementSymbolCount(slotName);
      bufsz = (sizeof(char) *
                     (PUT_PREFIX_LENGTH + strlen(ValueToString(slotName)) + 1));
      buf = (char *) gm2(theEnv,bufsz);
      genstrcpy(buf,PUT_PREFIX);
      genstrcat(buf,ValueToString(slotName));
      snp->putHandlerName = (SYMBOL_HN *) EnvAddSymbol(theEnv,buf);
      IncrementSymbolCount(snp->putHandlerName);
      rm(theEnv,(void *) buf,bufsz);
      snp->bsaveIndex = 0L;
    }
   return(snp);
  }

/***************************************************
  NAME         : DeleteSlotName
  DESCRIPTION  : Removes a slot name entry from
                 the table of all slot names if
                 no longer in use
  INPUTS       : The slot name hash node
  RETURNS      : Nothing useful
  SIDE EFFECTS : Slot name entry deleted or use
                 count decremented
  NOTES        : None
 ***************************************************/
globle void DeleteSlotName(
  void *theEnv,
  SLOT_NAME *slotName)
  {
   SLOT_NAME *snp,*prv;

   if (slotName == NULL)
     return;
   prv = NULL;
   snp = DefclassData(theEnv)->SlotNameTable[slotName->hashTableIndex];
   while (snp != slotName)
     {
      prv = snp;
      snp = snp->nxt;
     }
   snp->use--;
   if (snp->use != 0)
     return;
   if (prv == NULL)
     DefclassData(theEnv)->SlotNameTable[snp->hashTableIndex] = snp->nxt;
   else
     prv->nxt = snp->nxt;
   DecrementSymbolCount(theEnv,snp->name);
   DecrementSymbolCount(theEnv,snp->putHandlerName);
   rtn_struct(theEnv,slotName,snp);
  }

/*******************************************************************
  NAME         : RemoveDefclass
  DESCRIPTION  : Deallocates a class structure and
                 all its fields - returns all symbols
                 in use by the class back to the symbol
                 manager for ephemeral removal
  INPUTS       : The address of the class
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        : Assumes class has no subclasses
                 IMPORTANT WARNING!! : Assumes class
                   busy count and all instances' busy
                   counts are 0 and all handlers' busy counts are 0!
 *******************************************************************/
LOCALE void RemoveDefclass(
  void *theEnv,
  void *vcls)
  {
   DEFCLASS *cls = (DEFCLASS *) vcls;
   HANDLER *hnd;
   long i;

   /* ====================================================
      Remove all of this class's superclasses' links to it
      ==================================================== */
   for (i = 0 ; i < cls->directSuperclasses.classCount ; i++)
     DeleteSubclassLink(theEnv,cls->directSuperclasses.classArray[i],cls);

   RemoveClassFromTable(theEnv,cls);

   InstallClass(theEnv,cls,FALSE);

   DeletePackedClassLinks(theEnv,&cls->directSuperclasses,FALSE);
   DeletePackedClassLinks(theEnv,&cls->allSuperclasses,FALSE);
   DeletePackedClassLinks(theEnv,&cls->directSubclasses,FALSE);

   for (i = 0 ; i < cls->slotCount ; i++)
     {
      if (cls->slots[i].defaultValue != NULL)
        {
         if (cls->slots[i].dynamicDefault)
           ReturnPackedExpression(theEnv,(EXPRESSION *) cls->slots[i].defaultValue);
         else
           rtn_struct(theEnv,dataObject,cls->slots[i].defaultValue);
        }
      DeleteSlotName(theEnv,cls->slots[i].slotName);
      RemoveConstraint(theEnv,cls->slots[i].constraint);
     }

   if (cls->instanceSlotCount != 0)
     {
      rm(theEnv,(void *) cls->instanceTemplate,
         (sizeof(SLOT_DESC *) * cls->instanceSlotCount));
      rm(theEnv,(void *) cls->slotNameMap,
         (sizeof(unsigned) * (cls->maxSlotNameID + 1)));
     }
   if (cls->slotCount != 0)
     rm(theEnv,(void *) cls->slots,(sizeof(SLOT_DESC) * cls->slotCount));

   for (i = 0 ; i < cls->handlerCount ; i++)
     {
      hnd = &cls->handlers[i];
      if (hnd->actions != NULL)
        ReturnPackedExpression(theEnv,hnd->actions);
      if (hnd->ppForm != NULL)
        rm(theEnv,(void *) hnd->ppForm,(sizeof(char) * (strlen(hnd->ppForm)+1)));
      if (hnd->usrData != NULL)
        { ClearUserDataList(theEnv,hnd->usrData); }
     }
   if (cls->handlerCount != 0)
     {
      rm(theEnv,(void *) cls->handlers,(sizeof(HANDLER) * cls->handlerCount));
      rm(theEnv,(void *) cls->handlerOrderMap,(sizeof(unsigned) * cls->handlerCount));
     }

   SetDefclassPPForm((void *) cls,NULL);
   DeassignClassID(theEnv,(unsigned) cls->id);
   rtn_struct(theEnv,defclass,cls);
  }

#endif

/*******************************************************************
  NAME         : DestroyDefclass
  DESCRIPTION  : Deallocates a class structure and
                 all its fields.
  INPUTS       : The address of the class
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        :
 *******************************************************************/
LOCALE void DestroyDefclass(
  void *theEnv,
  void *vcls)
  {
   DEFCLASS *cls = (DEFCLASS *) vcls;
   long i;
#if ! RUN_TIME
   HANDLER *hnd;
   DeletePackedClassLinks(theEnv,&cls->directSuperclasses,FALSE);
   DeletePackedClassLinks(theEnv,&cls->allSuperclasses,FALSE);
   DeletePackedClassLinks(theEnv,&cls->directSubclasses,FALSE);
#endif
   for (i = 0 ; i < cls->slotCount ; i++)
     {
      if (cls->slots[i].defaultValue != NULL)
        {
#if ! RUN_TIME
         if (cls->slots[i].dynamicDefault)
           ReturnPackedExpression(theEnv,(EXPRESSION *) cls->slots[i].defaultValue);
         else
           rtn_struct(theEnv,dataObject,cls->slots[i].defaultValue);
#else
         if (cls->slots[i].dynamicDefault == 0)
           rtn_struct(theEnv,dataObject,cls->slots[i].defaultValue);
#endif
        }
     }

#if ! RUN_TIME
   if (cls->instanceSlotCount != 0)
     {
      rm(theEnv,(void *) cls->instanceTemplate,
         (sizeof(SLOT_DESC *) * cls->instanceSlotCount));
      rm(theEnv,(void *) cls->slotNameMap,
         (sizeof(unsigned) * (cls->maxSlotNameID + 1)));
     }

   if (cls->slotCount != 0)
     rm(theEnv,(void *) cls->slots,(sizeof(SLOT_DESC) * cls->slotCount));

   for (i = 0 ; i < cls->handlerCount ; i++)
     {
      hnd = &cls->handlers[i];
      if (hnd->actions != NULL)
        ReturnPackedExpression(theEnv,hnd->actions);

      if (hnd->ppForm != NULL)
        rm(theEnv,(void *) hnd->ppForm,(sizeof(char) * (strlen(hnd->ppForm)+1)));

      if (hnd->usrData != NULL)
        { ClearUserDataList(theEnv,hnd->usrData); }
     }

   if (cls->handlerCount != 0)
     {
      rm(theEnv,(void *) cls->handlers,(sizeof(HANDLER) * cls->handlerCount));
      rm(theEnv,(void *) cls->handlerOrderMap,(sizeof(unsigned) * cls->handlerCount));
     }

   DestroyConstructHeader(theEnv,&cls->header);

   rtn_struct(theEnv,defclass,cls);
#else
#endif
  }

#if ! RUN_TIME

/***************************************************
  NAME         : InstallClass
  DESCRIPTION  : In(De)crements all symbol counts for
                 for symbols in use by class
                 Disallows (allows) symbols to become
                 ephemeral.
  INPUTS       : 1) The class address
                 2) 1 - install, 0 - deinstall
  RETURNS      : Nothing useful
  SIDE EFFECTS : None
  NOTES        : None
 ***************************************************/
globle void InstallClass(
  void *theEnv,
  DEFCLASS *cls,
  int set)
  {
   SLOT_DESC *slot;
   HANDLER *hnd;
   long i;

   if ((set && cls->installed) ||
       ((set == FALSE) && (cls->installed == 0)))
     return;

   /* ==================================================================
      Handler installation is handled when message-handlers are defined:
      see ParseDefmessageHandler() in MSGCOM.C

      Slot installation is handled by ParseSlot() in CLASSPSR.C
      Scope map installation is handled by CreateClassScopeMap()
      ================================================================== */
   if (set == FALSE)
     {
      cls->installed = 0;

      DecrementSymbolCount(theEnv,cls->header.name);

#if DEFMODULE_CONSTRUCT
      DecrementBitMapCount(theEnv,cls->scopeMap);
#endif
      ClearUserDataList(theEnv,cls->header.usrData);

      for (i = 0 ; i < cls->slotCount ; i++)
        {
         slot = &cls->slots[i];
         DecrementSymbolCount(theEnv,slot->overrideMessage);
         if (slot->defaultValue != NULL)
           {
            if (slot->dynamicDefault)
              ExpressionDeinstall(theEnv,(EXPRESSION *) slot->defaultValue);
            else
              ValueDeinstall(theEnv,(DATA_OBJECT *) slot->defaultValue);
           }
        }
      for (i = 0 ; i < cls->handlerCount ; i++)
        {
         hnd = &cls->handlers[i];
         DecrementSymbolCount(theEnv,hnd->name);
         if (hnd->actions != NULL)
           ExpressionDeinstall(theEnv,hnd->actions);
        }
     }
   else
     {
      cls->installed = 1;
      IncrementSymbolCount(cls->header.name);
     }
  }

#endif

#if (! BLOAD_ONLY) && (! RUN_TIME)

/***************************************************
  NAME         : IsClassBeingUsed
  DESCRIPTION  : Checks the busy flag of a class
                   and ALL classes that inherit from
                   it to make sure that it is not
                   in use before deletion
  INPUTS       : The class
  RETURNS      : TRUE if in use, FALSE otherwise
  SIDE EFFECTS : None
  NOTES        : Recursively examines all subclasses
 ***************************************************/
globle int IsClassBeingUsed(
  DEFCLASS *cls)
  {
   long i;

   if (cls->busy > 0)
     return(TRUE);
   for (i = 0 ; i < cls->directSubclasses.classCount ; i++)
     if (IsClassBeingUsed(cls->directSubclasses.classArray[i]))
       return(TRUE);
   return(FALSE);
  }

/***************************************************
  NAME         : RemoveAllUserClasses
  DESCRIPTION  : Removes all classes
  INPUTS       : None
  RETURNS      : TRUE if succesful, FALSE otherwise
  SIDE EFFECTS : The class hash table is cleared
  NOTES        : None
 ***************************************************/
globle int RemoveAllUserClasses(
  void *theEnv)
  {
   void *userClasses,*ctmp;
   int success = TRUE;

#if BLOAD || BLOAD_AND_BSAVE
   if (Bloaded(theEnv))
     return(FALSE);
#endif
   /* ====================================================
      Don't delete built-in system classes at head of list
      ==================================================== */
   userClasses = EnvGetNextDefclass(theEnv,NULL);
   while (userClasses != NULL)
     {
      if (((DEFCLASS *) userClasses)->system == 0)
        break;
      userClasses = EnvGetNextDefclass(theEnv,userClasses);
     }
   while (userClasses != NULL)
     {
      ctmp = userClasses;
      userClasses = EnvGetNextDefclass(theEnv,userClasses);
      if (EnvIsDefclassDeletable(theEnv,ctmp))
        {
         RemoveConstructFromModule(theEnv,(struct constructHeader *) ctmp);
         RemoveDefclass(theEnv,ctmp);
        }
      else
        {
         success = FALSE;
         CantDeleteItemErrorMessage(theEnv,(char*)"defclass",EnvGetDefclassName(theEnv,ctmp));
        }
     }
   return(success);
  }

/****************************************************
  NAME         : DeleteClassUAG
  DESCRIPTION  : Deallocates a class and all its
                 subclasses
  INPUTS       : The address of the class
  RETURNS      : 1 if successful, 0 otherwise
  SIDE EFFECTS : Removes the class from each of
                 its superclasses' subclass lists
  NOTES        : None
 ****************************************************/
globle int DeleteClassUAG(
  void *theEnv,
  DEFCLASS *cls)
  {
   long subCount;

   while (cls->directSubclasses.classCount != 0)
     {
      subCount = cls->directSubclasses.classCount;
      DeleteClassUAG(theEnv,cls->directSubclasses.classArray[0]);
      if (cls->directSubclasses.classCount == subCount)
        return(FALSE);
     }
   if (EnvIsDefclassDeletable(theEnv,(void *) cls))
     {
      RemoveConstructFromModule(theEnv,(struct constructHeader *) cls);
      RemoveDefclass(theEnv,(void *) cls);
      return(TRUE);
     }
   return(FALSE);
  }

/*********************************************************
  NAME         : MarkBitMapSubclasses
  DESCRIPTION  : Recursively marks the ids of a class
                 and all its subclasses in a bitmap
  INPUTS       : 1) The bitmap
                 2) The class
                 3) A code indicating whether to set
                    or clear the bits of the map
                    corresponding to the class ids
  RETURNS      : Nothing useful
  SIDE EFFECTS : BitMap marked
  NOTES        : IMPORTANT!!!!  Assumes the bitmap is
                 large enough to hold all ids encountered!
 *********************************************************/
globle void MarkBitMapSubclasses(
  char *map,
  DEFCLASS *cls,
  int set)
  {
   long i;

   if (set)
     SetBitMap(map,cls->id);
   else
     ClearBitMap(map,cls->id);
   for (i = 0 ; i < cls->directSubclasses.classCount ; i++)
     MarkBitMapSubclasses(map,cls->directSubclasses.classArray[i],set);
  }

#endif

/***************************************************
  NAME         : FindSlotNameID
  DESCRIPTION  : Finds the id of a slot name
  INPUTS       : The slot name
  RETURNS      : The slot name id (-1 if not found)
  SIDE EFFECTS : None
  NOTES        : A slot name always has the same
                 id regardless of what class uses
                 it.  In this way, a slot can
                 be referred to by index independent
                 of class.  Each class stores a
                 map showing which slot name indices
                 go to which slot.  This provides
                 for immediate lookup of slots
                 given the index (object pattern
                 matching uses this).
 ***************************************************/
globle short FindSlotNameID(
  void *theEnv,
  SYMBOL_HN *slotName)
  {
   SLOT_NAME *snp;

   snp = DefclassData(theEnv)->SlotNameTable[HashSlotName(slotName)];
   while ((snp != NULL) ? (snp->name != slotName) : FALSE)
     snp = snp->nxt;
   return((snp != NULL) ? (short) snp->id : (short) -1);
  }

/***************************************************
  NAME         : FindIDSlotName
  DESCRIPTION  : Finds the slot anme for an id
  INPUTS       : The id
  RETURNS      : The slot name (NULL if not found)
  SIDE EFFECTS : None
  NOTES        : None
 ***************************************************/
globle SYMBOL_HN *FindIDSlotName(
  void *theEnv,
  int id)
  {
   SLOT_NAME *snp;

   snp = FindIDSlotNameHash(theEnv,id);
   return((snp != NULL) ? snp->name : NULL);
  }

/***************************************************
  NAME         : FindIDSlotNameHash
  DESCRIPTION  : Finds the slot anme for an id
  INPUTS       : The id
  RETURNS      : The slot name (NULL if not found)
  SIDE EFFECTS : None
  NOTES        : None
 ***************************************************/
globle SLOT_NAME *FindIDSlotNameHash(
  void *theEnv,
  int id)
  {
   register int i;
   SLOT_NAME *snp;

   for (i = 0 ; i < SLOT_NAME_TABLE_HASH_SIZE ; i++)
     {
      snp = DefclassData(theEnv)->SlotNameTable[i];
      while (snp != NULL)
        {
         if (snp->id == id)
           return(snp);
         snp = snp->nxt;
        }
     }
   return(NULL);
  }

/***************************************************
  NAME         : GetTraversalID
  DESCRIPTION  : Returns a unique integer ID for a
                  traversal into the class hierarchy
  INPUTS       : None
  RETURNS      : The id, or -1 if none available
  SIDE EFFECTS : EvaluationError set when no ids
                   available
  NOTES        : Used for recursive traversals of
                  class hierarchy to assure that a
                  class is only visited once
 ***************************************************/
globle int GetTraversalID(
  void *theEnv)
  {
   register unsigned i;
   register DEFCLASS *cls;

   if (DefclassData(theEnv)->CTID >= MAX_TRAVERSALS)
     {
      PrintErrorID(theEnv,(char*)"CLASSFUN",2,FALSE);
      EnvPrintRouter(theEnv,WERROR,(char*)"Maximum number of simultaneous class hierarchy\n  traversals exceeded ");
      PrintLongInteger(theEnv,WERROR,(long) MAX_TRAVERSALS);
      EnvPrintRouter(theEnv,WERROR,(char*)".\n");
      SetEvaluationError(theEnv,TRUE);
      return(-1);
     }

   for (i = 0 ; i < CLASS_TABLE_HASH_SIZE ; i++)
     for (cls = DefclassData(theEnv)->ClassTable[i] ; cls != NULL ; cls = cls->nxtHash)
       ClearTraversalID(cls->traversalRecord,DefclassData(theEnv)->CTID);
   return(DefclassData(theEnv)->CTID++);
  }

/***************************************************
  NAME         : ReleaseTraversalID
  DESCRIPTION  : Releases an ID for future use
                 Also clears id from all classes
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS : Old ID released for later reuse
  NOTES        : Releases ID returned by most recent
                   call to GetTraversalID()
 ***************************************************/
globle void ReleaseTraversalID(
  void *theEnv)
  {
   DefclassData(theEnv)->CTID--;
  }

/*******************************************************
  NAME         : HashClass
  DESCRIPTION  : Generates a hash index for a given
                 class name
  INPUTS       : The address of the class name SYMBOL_HN
  RETURNS      : The hash index value
  SIDE EFFECTS : None
  NOTES        : Counts on the fact that the symbol
                 has already been hashed into the
                 symbol table - uses that hash value
                 multiplied by a prime for a new hash
 *******************************************************/
globle unsigned HashClass(
  SYMBOL_HN *cname)
  {
   unsigned long tally;

   tally = ((unsigned long) cname->bucket) * BIG_PRIME;
   return((unsigned) (tally % CLASS_TABLE_HASH_SIZE));
  }

/* =========================================
   *****************************************
          INTERNALLY VISIBLE FUNCTIONS
   =========================================
   ***************************************** */

/*******************************************************
  NAME         : HashSlotName
  DESCRIPTION  : Generates a hash index for a given
                 slot name
  INPUTS       : The address of the slot name SYMBOL_HN
  RETURNS      : The hash index value
  SIDE EFFECTS : None
  NOTES        : Counts on the fact that the symbol
                 has already been hashed into the
                 symbol table - uses that hash value
                 multiplied by a prime for a new hash
 *******************************************************/
static unsigned HashSlotName(
  SYMBOL_HN *sname)
  {
   unsigned long tally;

   tally = ((unsigned long) sname->bucket) * BIG_PRIME;
   return((unsigned) (tally % SLOT_NAME_TABLE_HASH_SIZE));
  }

#if (! RUN_TIME)

/***********************************************
  NAME         : NewSlotNameID
  DESCRIPTION  : Returns  an unused slot name id
                 as close to 1 as possible
  INPUTS       : None
  RETURNS      : The new unused id
  SIDE EFFECTS : None
  NOTES        : None
 ***********************************************/
static int NewSlotNameID(
  void *theEnv)
  {
   int newid = 0;
   register unsigned i;
   SLOT_NAME *snp;

   while (TRUE)
     {
      for (i = 0 ; i < SLOT_NAME_TABLE_HASH_SIZE ; i++)
        {
         snp = DefclassData(theEnv)->SlotNameTable[i];
         while ((snp != NULL) ? (snp->id != newid) : FALSE)
           snp = snp->nxt;
         if (snp != NULL)
           break;
        }
      if (i < SLOT_NAME_TABLE_HASH_SIZE)
        newid++;
      else
        break;
     }
   return(newid);
  }

/***************************************************
  NAME         : DeassignClassID
  DESCRIPTION  : Reduces id map and MaxClassID if
                 no ids in use above the one being
                 released.
  INPUTS       : The id
  RETURNS      : Nothing useful
  SIDE EFFECTS : ID map and MaxClassID possibly
                 reduced
  NOTES        : None
 ***************************************************/
static void DeassignClassID(
  void *theEnv,
  unsigned id)
  {
   int i;
   int reallocReqd;
   unsigned short oldChunk = 0,newChunk = 0;

   DefclassData(theEnv)->ClassIDMap[id] = NULL;
   for (i = id + 1 ; i < DefclassData(theEnv)->MaxClassID ; i++)
     if (DefclassData(theEnv)->ClassIDMap[i] != NULL)
       return;
   reallocReqd = FALSE;
   while (DefclassData(theEnv)->ClassIDMap[id] == NULL)
     {
      DefclassData(theEnv)->MaxClassID = (unsigned short) id;
      if ((DefclassData(theEnv)->MaxClassID % CLASS_ID_MAP_CHUNK) == 0)
        {
         newChunk = DefclassData(theEnv)->MaxClassID;
         if (reallocReqd == FALSE)
           {
            oldChunk = (unsigned short) (DefclassData(theEnv)->MaxClassID + CLASS_ID_MAP_CHUNK);
            reallocReqd = TRUE;
           }
        }
      if (id == 0)
        break;
      id--;
     }
   if (reallocReqd)
     {
      DefclassData(theEnv)->ClassIDMap = (DEFCLASS **) genrealloc(theEnv,(void *) DefclassData(theEnv)->ClassIDMap,
                       (unsigned) (oldChunk * sizeof(DEFCLASS *)),
                       (unsigned) (newChunk * sizeof(DEFCLASS *)));

      DefclassData(theEnv)->AvailClassID = newChunk;
     }
  }

#endif

#endif


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>cz.muni.physics.pdr</groupId>
        <artifactId>star-survey-plugins</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>crts-plugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <main.class>cz.muni.physics.pdr.crts.Main</main.class>
        <plugin.folder>CRTS</plugin.folder>
        <plugin.name>CrtsPlugin</plugin.name>
    </properties>

    <dependencies>
        <dependency>
            <!-- jsoup HTML parser library @ http://jsoup.org/ -->
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.14.2</version>
        </dependency>
        <dependency>
            <groupId>net.sf.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>cz.muni.physics.pdr</groupId>
            <artifactId>java-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

redpajama_set_name: RedPajamaGithub


text:
define(function(require, exports, module) {

var marionette = require('marionette');
var backbone = require('backbone');
var vent = require('built/app/vent').vent;
var modals = require('built/app/modals');
var activity = require('built/app/activity');
var keys = require('built/app/keys');

var JobLayoutView = require('app/jobs/views/layout').JobLayoutView;

var ApplicationDelegate = marionette.Controller.extend({

    initialize: function(options){
        this.app = options.app;

        // var services = new Services();
        // services.fetch().then(function(){
        //     debugger;
        // })

        /* This call is required to initialize the
            BUILT App foundation. See below for what's done.
            You can customize that as necessary. */
        // this.BUILT();

        /* Ready. Set. Go!
            - Your Application's Regions are set in the app/app.js
              everything else starts here. (or in another route)
        */

        // show the main view
        // var model = new backbone.Model({
        //     message: 'Build something! Press Shift + M to display a Modal'
        // });
        this.app.main.show(new JobLayoutView());

    },

    // Demo of handling Key Presses
    // Combined with Modal Handling
    keyDown: function(e){
        var key = keys.getKeyFromEvent(e);

        if(key == 'M' && // shift + M
           !this.app.modal.currentView){

            var complete = function(modalView){
                // Data from the modal:
                console.log(modalView.getData());

                // You are responsible for dismissing the modal.
                modals.dismissModal();
            };

            // Present a modal view.
            modals.presentModal(new MyModalView())
                  .then(complete);

            return true;
        }
    },

    BUILT: function(){

        // Key Management
        // If you are not using the modal system,
        // but are using the key system, you can omit
        // the dictionary passed here.
        keys.initialize({modals: modals});

        // The responder chain is a stack of views/controllers.
        // When a key event is detected, the stack is searched
        // from the bottom up. AKA Last in First Out (LIFO).
        // Views that participate in the chain can choose to implement
        // keyDown(e) or performKeyEquivalent(e).
        //
        // performKeyEquivalent is checked first then keyDown is checked.
        // If either of those returns 'true' the chain is no longer traversed.
        //
        // Note that we automatically add the ApplicationDelegate.
        // This ensures it will be the last one checked for key events.
        // Then we implement keyDown above to handle looking for
        // our desired key press.
        //
        // Any additional view or controller that would like
        // to participate in this chain is required to register
        // itself into the chain like we do here.
        keys.registerInResponderChain(this);

        // Modal Management
        // These handlers are present so you can define how the modal is
        // shown. AKA via animation, or some other means.
        //
        // You should NEVER call these directly.
        this.listenTo(vent, modals.events.PRESENT, this._presentModal);
        this.listenTo(vent, modals.events.DISMISS, this._dismissModal);

        // Activity Management
        // Like modal managerment, these handlers are present so you can define
        // how the network activity indicator is presented. AKA via animation
        // or some other means.
        //
        // You should NEVER call these directly.
        this.listenTo(vent, activity.events.PRESENT, this._presentNetworkActivityIndicator);
        this.listenTo(vent, activity.events.DISMISS, this._dismissNetworkActivityIndicator);
    },

    _presentNetworkActivityIndicator: function(){
        throw new Error('No Activity Indicator View Specified');
        //this.app.activity.show(new YourActivityView);
    },

    _dismissNetworkActivityIndicator: function(modalView){
        this.app.activity.close();
    },

    _presentModal: function(modalView){
        this.app.modal.show(modalView);
    },

    _dismissModal: function(modalView){
        this.app.modal.close();

        // This is VERY important!
        // You MUST call this after your
        // modal has been dismissed.
        modals.nextModal();
    }
});

exports.ApplicationDelegate = ApplicationDelegate;

});


text:
use super::super::TEMPORARY_MAP_TABLE;
use super::current_page_table::CURRENT_PAGE_TABLE;
use super::frame_allocator::FRAME_ALLOCATOR;
use super::page_table::{Level4, PageTable};
use super::page_table_entry::*;
use super::page_table_manager::PageTableManager;
use super::PageFrame;
use core::ptr::Unique;
use crate::memory::{Address, PhysicalAddress};
use crate::sync::PreemptionState;
use x86_64::registers::control_regs::cr3;

/// The reference to the place where the level 4 table will be mapped.
const L4_TABLE: *mut PageTable<Level4> = 0xffff_ffff_ffff_d000 as *mut PageTable<Level4>;

/// Represents a currently inactive page table that needs to be modified.
pub struct InactivePageTable {
    /// A reference to the level 4 table.
    l4_table: Unique<PageTable<Level4>>,
    /// The page frame of the level 4 table.
    l4_frame: PageFrame,
    /// Optionally contains the preemption state of the mapped entry in the
    /// current page table.
    preemption_state: Option<PreemptionState>,
}

impl PageTableManager for InactivePageTable {
    fn get_l4(&mut self) -> &mut PageTable<Level4> {
        unsafe {
            self.map();
            self.l4_table.as_mut()
        }
    }
}

impl Drop for InactivePageTable {
    fn drop(&mut self) {
        match self.preemption_state {
            Some(_) => self.unmap(),
            None => (),
        }
    }
}

impl InactivePageTable {
    /// Creates a new inactive page table.
    ///
    /// # Safety
    /// - Should only be called during kernel setup.
    pub unsafe fn new() -> InactivePageTable {
        let frame = FRAME_ALLOCATOR.allocate();
        let preemption_state = CURRENT_PAGE_TABLE.lock().map_inactive(frame);

        // Zero the page.
        let table = &mut *L4_TABLE;
        table.zero();

        // Set up some invariants.
        table[510].set_address(TEMPORARY_MAP_TABLE).set_flags(
            PageTableEntryFlags::PRESENT
                | PageTableEntryFlags::WRITABLE
                | PageTableEntryFlags::NO_EXECUTE,
        );
        table[511].set_address(frame.get_address()).set_flags(
            PageTableEntryFlags::PRESENT
                | PageTableEntryFlags::WRITABLE
                | PageTableEntryFlags::NO_EXECUTE,
        );

        InactivePageTable {
            l4_table: Unique::new_unchecked(L4_TABLE),
            l4_frame: frame,
            preemption_state: Some(preemption_state),
        }
    }

    /// Creates a copy of the current page table kernel part as an inactive
    /// page table.
    pub fn copy_from_current() -> InactivePageTable {
        let frame = FRAME_ALLOCATOR.allocate();
        let preemption_state = unsafe { CURRENT_PAGE_TABLE.lock().map_inactive(frame) };

        let table = unsafe { &mut *L4_TABLE };
        table.zero();

        table[256] = CURRENT_PAGE_TABLE.lock().get_l4()[256].clone();
        table[257] = CURRENT_PAGE_TABLE.lock().get_l4()[257].clone();
        table[506] = CURRENT_PAGE_TABLE.lock().get_l4()[506].clone();
        table[507] = CURRENT_PAGE_TABLE.lock().get_l4()[507].clone();

        unsafe {
            table[510].set_address(TEMPORARY_MAP_TABLE).set_flags(
                PageTableEntryFlags::PRESENT
                    | PageTableEntryFlags::WRITABLE
                    | PageTableEntryFlags::NO_EXECUTE,
            );
        }
        table[511].set_address(frame.get_address()).set_flags(
            PageTableEntryFlags::PRESENT
                | PageTableEntryFlags::WRITABLE
                | PageTableEntryFlags::NO_EXECUTE,
        );

        CURRENT_PAGE_TABLE.lock().unmap_inactive(&preemption_state);

        InactivePageTable {
            l4_table: unsafe { Unique::new_unchecked(L4_TABLE) },
            l4_frame: frame,
            preemption_state: None,
        }
    }

    /// Creates an inactive page table at the given address.
    ///
    /// The old_table parameter points to a table containing the preemption
    /// state.
    pub fn from_frame(frame: PageFrame, old_table: &InactivePageTable) -> InactivePageTable {
        InactivePageTable {
            l4_table: unsafe { Unique::new_unchecked(L4_TABLE) },
            l4_frame: frame,
            preemption_state: Some(unsafe {
                old_table
                    .preemption_state
                    .as_ref()
                    .expect("The old table was not mapped.")
                    .copy()
            }),
        }
    }

    /// Creates an inactive page table that points to the current page table.
    pub fn from_current_table() -> InactivePageTable {
        InactivePageTable {
            l4_table: unsafe { Unique::new_unchecked(L4_TABLE) },
            l4_frame: PageFrame::from_address(PhysicalAddress::from_usize(cr3().0 as usize)),
            preemption_state: None,
        }
    }

    /// Maps the inactive page table to the current one.
    ///
    /// # Safety
    /// - Ensure that it is properly unmapped every time it's mapped.
    unsafe fn map(&mut self) {
        if self.preemption_state.is_none() {
            let preemption_state = CURRENT_PAGE_TABLE.lock().map_inactive(self.l4_frame);
            self.preemption_state = Some(preemption_state);
        }
    }

    /// Returns the page frame of this page table.
    pub fn get_frame(&self) -> PageFrame {
        unsafe { self.l4_frame.copy() }
    }

    /// Unmaps the currently loaded inactive page table.
    pub fn unmap(&mut self) {
        // TODO: Find something better than unmapping manually after every use.
        if !self.preemption_state.is_none() {
            CURRENT_PAGE_TABLE
                .lock()
                .unmap_inactive(self.preemption_state.as_ref().unwrap());
            self.preemption_state = None;
        }
    }
}


text:
/*jshint node: true, loopfunc: true */
/*globals describe: false, it: false */
'use strict';
var expect = require('expect.js'),
  types = require('../../types'),
  LimitExpression = types.LimitExpression;

describe('LimitExpression', function () {
  it('returns a partial statement', function () {
    var expr = new LimitExpression(null, 'x', 'y');
    expect(expr).to.be.a(types._PartialStatement);
    expect(expr.toAQL).to.be.a('function');
  });
  it('generates a LIMIT statement', function () {
    expect(new LimitExpression(null, 'x', 'y').toAQL()).to.equal('LIMIT x, y');
  });
  it('treats the offset as optional', function () {
    expect(new LimitExpression(null, 'x', 'y')._offset._value).to.equal('x');
    expect(new LimitExpression(null, 'x', 'y')._count._value).to.equal('y');
    expect(new LimitExpression(null, 'y')._count._value).to.equal('y');
  });
  it('auto-casts offsets', function () {
    var arr = [42, 'id', 'some.ref', '"hello"', false, null];
    var ctors = [
      types.IntegerLiteral,
      types.Identifier,
      types.SimpleReference,
      types.StringLiteral,
      types.BooleanLiteral,
      types.NullLiteral
    ];
    for (var i = 0; i < arr.length; i++) {
      expect(new LimitExpression(null, arr[i], 'y')._offset.constructor).to.equal(ctors[i]);
    }
  });
  it('wraps Operation offsets in parentheses', function () {
    var op = new types._Operation();
    op.toAQL = function () {return 'x';};
    expect(new LimitExpression(null, op, 'y').toAQL()).to.equal('LIMIT (x), y');
  });
  it('wraps Statement offsets in parentheses', function () {
    var st = new types._Statement();
    st.toAQL = function () {return 'x';};
    expect(new LimitExpression(null, st, 'y').toAQL()).to.equal('LIMIT (x), y');
  });
  it('wraps PartialStatement offsets in parentheses', function () {
    var ps = new types._PartialStatement();
    ps.toAQL = function () {return 'x';};
    expect(new LimitExpression(null, ps, 'y').toAQL()).to.equal('LIMIT (x), y');
  });
  it('auto-casts counts', function () {
    var arr = [42, 'id', 'some.ref', '"hello"', false, null];
    var ctors = [
      types.IntegerLiteral,
      types.Identifier,
      types.SimpleReference,
      types.StringLiteral,
      types.BooleanLiteral,
      types.NullLiteral
    ];
    for (var i = 0; i < arr.length; i++) {
      expect(new LimitExpression(null, 'x', arr[i])._count.constructor).to.equal(ctors[i]);
    }
  });
  it('wraps Operation counts in parentheses', function () {
    var op = new types._Operation();
    op.toAQL = function () {return 'y';};
    expect(new LimitExpression(null, 'x', op).toAQL()).to.equal('LIMIT x, (y)');
  });
  it('wraps Statement counts in parentheses', function () {
    var st = new types._Statement();
    st.toAQL = function () {return 'y';};
    expect(new LimitExpression(null, 'x', st).toAQL()).to.equal('LIMIT x, (y)');
  });
  it('wraps PartialStatement counts in parentheses', function () {
    var ps = new types._PartialStatement();
    ps.toAQL = function () {return 'y';};
    expect(new LimitExpression(null, 'x', ps).toAQL()).to.equal('LIMIT x, (y)');
  });
  it('converts preceding nodes to AQL', function () {
    var ps = new types._PartialStatement();
    ps.toAQL = function () {return '$';};
    expect(new LimitExpression(ps, 'x', 'y').toAQL()).to.equal('$ LIMIT x, y');
  });
});


text:
package org.keycloak.authentication.authenticators.broker;

import org.keycloak.Config;
import org.keycloak.authentication.Authenticator;
import org.keycloak.authentication.AuthenticatorFactory;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.provider.ProviderConfigProperty;

import java.util.List;

/**
 * @author Marek Posolda
 */
public class IdpConfirmLinkAuthenticatorFactory implements AuthenticatorFactory {

    public static final String PROVIDER_ID = "idp-confirm-link";
    static IdpConfirmLinkAuthenticator SINGLETON = new IdpConfirmLinkAuthenticator();

    @Override
    public Authenticator create(KeycloakSession session) {
        return SINGLETON;
    }

    @Override
    public void init(Config.Scope config) {

    }

    @Override
    public void postInit(KeycloakSessionFactory factory) {

    }

    @Override
    public void close() {

    }

    @Override
    public String getId() {
        return PROVIDER_ID;
    }

    @Override
    public String getReferenceCategory() {
        return "confirmLink";
    }

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

    public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = {
            AuthenticationExecutionModel.Requirement.REQUIRED,
            AuthenticationExecutionModel.Requirement.DISABLED};

    @Override
    public AuthenticationExecutionModel.Requirement[] getRequirementChoices() {
        return REQUIREMENT_CHOICES;
    }

    @Override
    public String getDisplayType() {
        return "Confirm link existing account";
    }

    @Override
    public String getHelpText() {
        return "Show the form where user confirms if he wants to link identity provider with existing account or rather edit user profile data retrieved from identity provider to avoid conflict";
    }

    @Override
    public List<ProviderConfigProperty> getConfigProperties() {
        return null;
    }

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

}


text:
namespace google {
namespace cloud {
namespace debugger_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

std::shared_ptr<Debugger2Stub> CreateDefaultDebugger2Stub(
    google::cloud::CompletionQueue cq, Options const& options) {
  auto auth = google::cloud::internal::CreateAuthenticationStrategy(
      std::move(cq), options);
  auto channel = auth->CreateChannel(options.get<EndpointOption>(),
                                     internal::MakeChannelArguments(options));
  auto service_grpc_stub =
      google::devtools::clouddebugger::v2::Debugger2::NewStub(channel);
  std::shared_ptr<Debugger2Stub> stub =
      std::make_shared<DefaultDebugger2Stub>(std::move(service_grpc_stub));

  if (auth->RequiresConfigureContext()) {
    stub = std::make_shared<Debugger2Auth>(std::move(auth), std::move(stub));
  }
  stub = std::make_shared<Debugger2Metadata>(std::move(stub));
  if (internal::Contains(options.get<TracingComponentsOption>(), "rpc")) {
    GCP_LOG(INFO) << "Enabled logging for gRPC calls";
    stub = std::make_shared<Debugger2Logging>(
        std::move(stub), options.get<GrpcTracingOptionsOption>(),
        options.get<TracingComponentsOption>());
  }
  return stub;
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace debugger_internal
}  // namespace cloud
}  // namespace google


text:
package org.mapfish.print.processor.http;

import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.test.context.ContextConfiguration;

import java.net.URI;
import javax.annotation.Nullable;

import static org.junit.Assert.assertEquals;

@ContextConfiguration(locations = {
        "classpath:org/mapfish/print/processor/http/map-uri/add-custom-processor-application-context.xml"
})
public class MapUriProcessorTest extends AbstractHttpProcessorTest {

    @Override
    protected String baseDir() {
        return "map-uri";
    }

    @Override
    protected Class<TestProcessor> testProcessorClass() {
        return TestProcessor.class;
    }

    @Override
    protected Class<? extends AbstractClientHttpRequestFactoryProcessor> classUnderTest() {
        return MapUriProcessor.class;
    }

    public static class TestProcessor extends AbstractTestProcessor {
        @Nullable
        @Override
        public Void execute(TestParam values, ExecutionContext context) throws Exception {
            final URI uri = new URI("http://localhost:8080/path?query#fragment");
            final ClientHttpRequest request = values.clientHttpRequestFactoryProvider.get().createRequest(uri,
                                                                                HttpMethod.GET);
            final URI finalUri = request.getURI();

            assertEquals("http", finalUri.getScheme());
            assertEquals("127.0.0.1", finalUri.getHost());
            assertEquals("/path", finalUri.getPath());
            assertEquals(8080, finalUri.getPort());
            assertEquals("query", finalUri.getQuery());
            assertEquals("fragment", finalUri.getFragment());

            return null;
        }
    }
}


text:
<?php

namespace luyatests\core\widgets;

use luya\widgets\SubmitButtonWidget;
use luyatests\LuyaWebTestCase;
use yii\base\InvalidConfigException;
use yii\widgets\ActiveForm;

class SubmitButtonWidgetTest extends LuyaWebTestCase
{
    public function testException()
    {
        $this->expectException(\TypeError::class);
        SubmitButtonWidget::widget(['label' => 'foo', 'pushed' => 'barfoo', 'activeForm' => 'wrongType', 'options' => ['class' => 'btn']]);
    }

    public function testRun()
    {
        $this->assertSame('<button type="submit" class="btn" onclick="this.disabled=true; this.innerHTML=\'barfoo\';">foo</button>', SubmitButtonWidget::widget(['label' => 'foo', 'pushed' => 'barfoo', 'options' => ['class' => 'btn']]));
        $this->assertSame('<button type="submit" class="btn">foo</button>', SubmitButtonWidget::widget(['label' => 'foo', 'pushed' => 'barfoo', 'activeForm' => new ActiveForm(), 'options' => ['class' => 'btn']]));
    }

    public function testInvalidCall()
    {
        $this->expectException(InvalidConfigException::class);
        SubmitButtonWidget::widget();
    }
}


text:
//
//  CKIPagedResponse.m
//  CanvasKit
//
//  Created by Jason Larsen on 9/18/13.
//  Copyright (c) 2013 Instructure. All rights reserved.
//

#import <Mantle/Mantle.h>

#import "CKIPagedResponse.h"
#import "NSHTTPURLResponse+Pagination.h"
#import "CKIClient.h"
#import "CKIModel.h"

@interface CKIPagedResponse ()

/**
 The current URL of this page of responses.
 */
@property (nonatomic, strong) NSURL *currentPage;

/**
 The next URL in the paginated series.
 */
@property (nonatomic, copy) NSURL *nextPage;

/**
 The URL or the previous page in the series.
 */
@property (nonatomic, copy) NSURL *previousPage;

/**
 The URL of the first page in the series.
 */
@property (nonatomic, copy) NSURL *firstPage;

/**
 The URL of the last page in the series.
 */
@property (nonatomic, copy) NSURL *lastPage;

/**
 The class that will be used to transform the items in the response.
 */
@property (nonatomic) Class modelClass;

/**
 The context of the items.
 */
@property (nonatomic, strong) id<CKIContext> context;
@end

@implementation CKIPagedResponse

+ (instancetype)pagedResponseForTask:(NSURLSessionDataTask *)task responseObject:(NSArray *)responseObject modelClass:(Class)modelClass context:(id<CKIContext>)context
{
    NSAssert([modelClass isSubclassOfClass:[CKIModel class]], @"%@ is not a subclass of CKIModel", modelClass);
    CKIPagedResponse *pagedResponse = [[CKIPagedResponse alloc] init];

    NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
    pagedResponse.currentPage = response.currentPage;
    pagedResponse.nextPage = response.nextPage;
    pagedResponse.previousPage = response.previousPage;
    pagedResponse.firstPage = response.firstPage;
    pagedResponse.lastPage = response.lastPage;

    pagedResponse.modelClass = modelClass;

    pagedResponse.context = context;

    NSValueTransformer *arrayTransformer = [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:modelClass];
    NSArray *items = [arrayTransformer transformedValue:responseObject];

    [items enumerateObjectsUsingBlock:^(CKIModel *model, NSUInteger idx, BOOL *stop) {
        model.context = context;
    }];

    pagedResponse.items = items;

    return pagedResponse;
}

- (BOOL)isLastPage
{
    return self.currentPage == nil || [self.currentPage isEqual:self.lastPage];
}

- (void)fetchNextPageWithSuccess:(void (^)(CKIPagedResponse *))success failure:(void (^)(NSError *))failure
{
    [[CKIClient currentClient] GET:self.nextPage.relativeString parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        if (success) {
            CKIPagedResponse *pagedResponse = [CKIPagedResponse pagedResponseForTask:task responseObject:responseObject modelClass:self.modelClass context:self.context];
            success(pagedResponse);
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
}

@end


text:
module SummonersHelper
end


text:
package br.mg.com.sistemaIgreja.cadastroPessoa;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.wb.swt.SWTResourceManager;

public class CadastroPessoa {

	protected Shell shlCadastro;
	private Text nome;
	private Text nomePai;
	private Text nomeMae;
	private Text logradouro;
	private Text numCasa;
	private Text bairro;
	private Text cep;
	private Text cidade;
	private Text compl;
	private Text responsavel;
	private Text telResponsavel;
	private Text celResponsavel;
	private Text email;
	private Text tel;
	private Text cel;
	private Text text;
	private Text text_1;
	private Text text_2;
	private Text text_3;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {

		try {
			CadastroPessoa window = new CadastroPessoa();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {

		Display display = Display.getDefault();
		createContents();
		shlCadastro.open();
		shlCadastro.layout();

		while (!shlCadastro.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {

		shlCadastro = new Shell();
		shlCadastro.setModified(true);
		shlCadastro.setSize(692, 762);
		shlCadastro.setText("Cadastro");
		shlCadastro.setLayout(new GridLayout(1, false));

		TabFolder tabFolder = new TabFolder(shlCadastro, SWT.NONE);
		tabFolder.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		GridData gd_tabFolder = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
		gd_tabFolder.heightHint = 218;
		tabFolder.setLayoutData(gd_tabFolder);

		TabItem tbtmDadosPessoais = new TabItem(tabFolder, SWT.NONE);
		tbtmDadosPessoais.setText("Dados Pessoais");

		Composite composite = new Composite(tabFolder, SWT.NONE);
		composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
		tbtmDadosPessoais.setControl(composite);

		Group grpEndereo = new Group(composite, SWT.NONE);
		grpEndereo.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		grpEndereo.setText("Endere\u00E7o");
		grpEndereo.setBounds(10, 317, 638, 136);

		Label lblLogradouro = new Label(grpEndereo, SWT.NONE);
		lblLogradouro.setText("Logradouro:");
		lblLogradouro.setBounds(10, 24, 65, 15);

		logradouro = new Text(grpEndereo, SWT.BORDER);
		logradouro.setBounds(80, 18, 328, 21);

		Label lblNmero = new Label(grpEndereo, SWT.NONE);
		lblNmero.setText("N\u00FAmero:");
		lblNmero.setBounds(490, 21, 47, 15);

		numCasa = new Text(grpEndereo, SWT.BORDER | SWT.RIGHT);
		numCasa.setBounds(540, 18, 88, 21);

		Label lblBairro = new Label(grpEndereo, SWT.NONE);
		lblBairro.setText("Bairro:");
		lblBairro.setBounds(10, 61, 34, 15);

		bairro = new Text(grpEndereo, SWT.BORDER);
		bairro.setBounds(50, 58, 189, 21);

		Label lblCep = new Label(grpEndereo, SWT.NONE);
		lblCep.setAlignment(SWT.CENTER);
		lblCep.setText("CEP:");
		lblCep.setBounds(508, 61, 29, 15);

		cep = new Text(grpEndereo, SWT.BORDER);
		cep.setBounds(540, 55, 88, 21);

		Label lblCidade = new Label(grpEndereo, SWT.NONE);
		lblCidade.setAlignment(SWT.CENTER);
		lblCidade.setText("Cidade:");
		lblCidade.setBounds(246, 58, 47, 15);

		cidade = new Text(grpEndereo, SWT.BORDER);
		cidade.setBounds(299, 55, 189, 21);

		Label lblComplemento = new Label(grpEndereo, SWT.NONE);
		lblComplemento.setAlignment(SWT.CENTER);
		lblComplemento.setText("Complemento:");
		lblComplemento.setBounds(10, 103, 82, 15);

		compl = new Text(grpEndereo, SWT.BORDER);
		compl.setBounds(98, 100, 328, 21);
		grpEndereo.setTabList(new Control[]{logradouro, numCasa, bairro, cidade, cep});

		Group grpDadosPessoais = new Group(composite, SWT.NONE);
		grpDadosPessoais.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		grpDadosPessoais.setLocation(10, 18);
		grpDadosPessoais.setSize(638, 199);
		grpDadosPessoais.setText("Dados Pessoais");

		Label label = new Label(grpDadosPessoais, SWT.NONE);
		label.setText("Nome Completo:");
		label.setBounds(10, 24, 92, 15);

		nome = new Text(grpDadosPessoais, SWT.BORDER);
		nome.setBounds(105, 21, 333, 21);

		Label label_1 = new Label(grpDadosPessoais, SWT.NONE);
		label_1.setText("Data de Nascimento:");
		label_1.setBounds(10, 66, 110, 15);

		DateTime dtNasc = new DateTime(grpDadosPessoais, SWT.BORDER);
		dtNasc.setBounds(126, 57, 106, 24);

		Group group = new Group(grpDadosPessoais, SWT.NONE);
		group.setText("Sexo");
		group.setBounds(497, 12, 131, 69);

		Button sexoMasc = new Button(group, SWT.RADIO);
		sexoMasc.setText("Masculino");
		sexoMasc.setBounds(10, 23, 76, 16);

		Button sexoFem = new Button(group, SWT.RADIO);
		sexoFem.setText("Feminino");
		sexoFem.setBounds(10, 45, 76, 16);

		Label label_2 = new Label(grpDadosPessoais, SWT.NONE);
		label_2.setText("Estado Civil:");
		label_2.setBounds(257, 66, 64, 15);

		Combo estCivil = new Combo(grpDadosPessoais, SWT.NONE);
		estCivil.setBounds(327, 58, 152, 23);

		Group group_1 = new Group(grpDadosPessoais, SWT.NONE);
		group_1.setText("Filia\u00E7\u00E3o");
		group_1.setBounds(10, 92, 428, 96);

		Label label_3 = new Label(group_1, SWT.NONE);
		label_3.setText("Nome do Pai:");
		label_3.setBounds(10, 23, 78, 15);

		nomePai = new Text(group_1, SWT.BORDER);
		nomePai.setBounds(89, 17, 328, 21);

		Label label_4 = new Label(group_1, SWT.NONE);
		label_4.setText("Nome da M\u00E3e:");
		label_4.setBounds(10, 68, 78, 15);

		nomeMae = new Text(group_1, SWT.BORDER);
		nomeMae.setBounds(89, 62, 328, 21);

		Label lblEscolaridade = new Label(grpDadosPessoais, SWT.NONE);
		lblEscolaridade.setText("Escolaridade:");
		lblEscolaridade.setBounds(476, 105, 69, 15);

		Combo escolaridade = new Combo(grpDadosPessoais, SWT.NONE);
		escolaridade.setBounds(476, 126, 152, 23);
		grpDadosPessoais.setTabList(new Control[]{nome, group, dtNasc, estCivil, group_1, escolaridade});

		Group grpResponsvel = new Group(composite, SWT.NONE);
		grpResponsvel.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		grpResponsvel.setText("Respons\u00E1vel");
		grpResponsvel.setBounds(10, 459, 638, 88);

		Label lblResponsvel = new Label(grpResponsvel, SWT.NONE);
		lblResponsvel.setAlignment(SWT.CENTER);
		lblResponsvel.setText("Nome:");
		lblResponsvel.setBounds(10, 23, 40, 15);

		responsavel = new Text(grpResponsvel, SWT.BORDER);
		responsavel.setBounds(56, 20, 328, 21);

		Label lblTelContato = new Label(grpResponsvel, SWT.NONE);
		lblTelContato.setText("Tel. Contato:");
		lblTelContato.setBounds(418, 23, 72, 15);

		telResponsavel = new Text(grpResponsvel, SWT.BORDER);
		telResponsavel.setBounds(494, 20, 101, 21);

		Label lblCelularContato = new Label(grpResponsvel, SWT.NONE);
		lblCelularContato.setText("Celular Contato:");
		lblCelularContato.setAlignment(SWT.CENTER);
		lblCelularContato.setBounds(10, 63, 86, 15);

		celResponsavel = new Text(grpResponsvel, SWT.BORDER);
		celResponsavel.setBounds(102, 57, 101, 21);

		Group grpContato = new Group(composite, SWT.NONE);
		grpContato.setText("Contato");
		grpContato.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		grpContato.setBounds(10, 223, 638, 88);

		Label lblEmail = new Label(grpContato, SWT.NONE);
		lblEmail.setText("E-mail:");
		lblEmail.setAlignment(SWT.CENTER);
		lblEmail.setBounds(10, 23, 40, 15);

		email = new Text(grpContato, SWT.BORDER);
		email.setBounds(56, 20, 328, 21);

		Label label_6 = new Label(grpContato, SWT.NONE);
		label_6.setText("Tel. Contato:");
		label_6.setBounds(418, 23, 72, 15);

		tel = new Text(grpContato, SWT.BORDER);
		tel.setBounds(494, 20, 101, 21);

		Label label_7 = new Label(grpContato, SWT.NONE);
		label_7.setText("Celular Contato:");
		label_7.setAlignment(SWT.CENTER);
		label_7.setBounds(10, 63, 86, 15);

		cel = new Text(grpContato, SWT.BORDER);
		cel.setBounds(102, 57, 101, 21);

		Group grpSituaoReligiosa = new Group(composite, SWT.NONE);
		grpSituaoReligiosa.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		grpSituaoReligiosa.setText("Situa\u00E7\u00E3o Religiosa");
		grpSituaoReligiosa.setBounds(10, 553, 638, 88);

		text = new Text(grpSituaoReligiosa, SWT.BORDER);
		text.setBounds(69, 22, 167, 21);

		Label lblBatizado = new Label(grpSituaoReligiosa, SWT.NONE);
		lblBatizado.setBounds(10, 25, 55, 15);
		lblBatizado.setText("Batizado:");

		Label lblEucaristia = new Label(grpSituaoReligiosa, SWT.NONE);
		lblEucaristia.setText("1\u00AA Eucaristia:");
		lblEucaristia.setBounds(273, 25, 69, 15);

		text_1 = new Text(grpSituaoReligiosa, SWT.BORDER);
		text_1.setBounds(348, 22, 167, 21);

		Label lblCrismado = new Label(grpSituaoReligiosa, SWT.NONE);
		lblCrismado.setText("Crismado:");
		lblCrismado.setBounds(10, 60, 55, 15);

		text_2 = new Text(grpSituaoReligiosa, SWT.BORDER);
		text_2.setBounds(69, 57, 167, 21);

		Label lblCrisma = new Label(grpSituaoReligiosa, SWT.NONE);
		lblCrisma.setText("Crisma:");
		lblCrisma.setBounds(273, 60, 69, 15);

		text_3 = new Text(grpSituaoReligiosa, SWT.BORDER);
		text_3.setBounds(348, 57, 167, 21);

		TabItem tbtmObservaes = new TabItem(tabFolder, SWT.NONE);
		tbtmObservaes.setText("Observa\u00E7\u00F5es");

		Composite composite_1 = new Composite(tabFolder, SWT.NONE);
		composite_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
		tbtmObservaes.setControl(composite_1);

		Group grpObservaesImportantes = new Group(composite_1, SWT.NONE);
		grpObservaesImportantes.setText("Observa\u00E7\u00F5es Importantes");
		grpObservaesImportantes.setBounds(10, 18, 638, 199);

		Group grpMedicamentos = new Group(grpObservaesImportantes, SWT.NONE);
		grpMedicamentos.setText("Medicamentos");
		grpMedicamentos.setBounds(10, 26, 187, 69);

		Button btnSim = new Button(grpMedicamentos, SWT.RADIO);
		btnSim.setText("Sim");
		btnSim.setBounds(10, 23, 76, 16);

		Button btnNo = new Button(grpMedicamentos, SWT.RADIO);
		btnNo.setText("N\u00E3o");
		btnNo.setBounds(10, 45, 76, 16);

		Group grpRestrioAlimentar = new Group(grpObservaesImportantes, SWT.NONE);
		grpRestrioAlimentar.setText("Restri\u00E7\u00E3o Alimentar");
		grpRestrioAlimentar.setBounds(441, 26, 187, 69);

		Button button = new Button(grpRestrioAlimentar, SWT.RADIO);
		button.setText("Sim");
		button.setBounds(10, 23, 76, 16);

		Button button_1 = new Button(grpRestrioAlimentar, SWT.RADIO);
		button_1.setText("N\u00E3o");
		button_1.setBounds(10, 45, 76, 16);

	}
	/**
	 * @wbp.factory
	 */
	public static ToolBar createToolBar(Composite parent) {
		ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
		toolBar.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
		toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
		return toolBar;
	}
}


text:
Thanks
======

Zinnia cannot be a great application without great contributors who make
this application greatest each day.

* Bjorn Meyer (bmeyer71)
* Jannis Leideil (jezdez)
* Tobias von Klipstein (klipstein)
* Mark Renton (indexofire)
* Bill Mill (llimllib)
* Kevin Renskers (Bolhoed)
* Jonathan Stoppani (GaretJax)
* Elijah Rutschman (elijahr)
* Thomas Bartelmess (tbartelmess)
* Franck Bret
* Jason Davies
* Brandon Taylor
* bernhardvallant
* nl0
* esauro
* 0Chuzz
* un33K
* orblivion
* kjikaqawej
* igalarzab
* jtrain
* and You.

I also want to thanks `Transifex.net`_ and `ReadTheDocs.org`_ for their services
of great quality.

.. _`Transifex.net`: http://www.transifex.net/
.. _`ReadTheDocs.org`: http://readthedocs.org/


text:
<?php

/**
 * Include the SDK by using the autoloader from Composer.
 */
require __DIR__.'/../vendor/autoload.php';
/**
 * Include some utility functions.
 */
require __DIR__.'/utils.php';

/**
 * Include the configuration values.
 *
 * Ensure that you have edited the configuration.php file
 * to include your application keys.
 */
$config = require __DIR__.'/../configuration.php';

/**
 * The namespaces provided by the SDK.
 */
use \DTS\eBaySDK\Sdk;
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\FileTransfer;
use \DTS\eBaySDK\BulkDataExchange;
use \DTS\eBaySDK\MerchantData;

/**
 * Create the service objects.
 *
 * This example uses both the File Transfer and Bulk Data Exchange services.
 */
$sdk = new Sdk([
    'credentials' => $config['sandbox']['credentials'],
    'authToken'   => $config['sandbox']['authToken'],
    'sandbox'     => true
]);
$exchangeService = $sdk->createBulkDataExchange();
$transferService = $sdk->createFileTransfer();
$merchantData = new MerchantData\MerchantData();

/**
 * Before anything can be uploaded a request needs to be made to obtain a job ID and file reference ID.
 * eBay needs to know the job type and a way to identify it.
 */
$createUploadJobRequest = new BulkDataExchange\Types\CreateUploadJobRequest();
$createUploadJobRequest->uploadJobType = 'AddFixedPriceItem';
$createUploadJobRequest->UUID = uniqid();

/**
 * Send the request.
 */
print('Requesting job Id from eBay...');
$createUploadJobResponse = $exchangeService->createUploadJob($createUploadJobRequest);
print("Done\n");

/**
 * Output the result of calling the service operation.
 */
if (isset($createUploadJobResponse->errorMessage)) {
    foreach ($createUploadJobResponse->errorMessage->error as $error) {
        printf(
            "%s: %s\n\n",
            $error->severity === BulkDataExchange\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning',
            $error->message
        );
    }
}

if ($createUploadJobResponse->ack !== 'Failure') {
    printf(
        "JobId [%s] FileReferenceId [%s]\n",
        $createUploadJobResponse->jobId,
        $createUploadJobResponse->fileReferenceId
    );

    /**
     * Pass the required values to the File Transfer service.
     */
    $uploadFileRequest = new FileTransfer\Types\UploadFileRequest();
    $uploadFileRequest->fileReferenceId = $createUploadJobResponse->fileReferenceId;
    $uploadFileRequest->taskReferenceId = $createUploadJobResponse->jobId;
    $uploadFileRequest->fileFormat = 'gzip';

    $payload = buildPayload();

    /**
     * Convert our payload to XML.
     */
    $payloadXml = $payload->toRequestXml();

    /**
     * GZip and attach the XML payload.
     */
    $uploadFileRequest->attachment(gzencode($payloadXml, 9));

    /**
     * Now upload the file.
     */
    print('Uploading fixed price item requests...');
    $uploadFileResponse = $transferService->uploadFile($uploadFileRequest);
    print("Done\n");

    if (isset($uploadFileResponse->errorMessage)) {
        foreach ($uploadFileResponse->errorMessage->error as $error) {
            printf(
                "%s: %s\n\n",
                $error->severity === FileTransfer\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning',
                $error->message
            );
        }
    }

    if ($uploadFileResponse->ack !== 'Failure') {
        /**
         * Once the file has uploaded we can tell eBay to start processing it.
         */
        $startUploadJobRequest = new BulkDataExchange\Types\StartUploadJobRequest();
        $startUploadJobRequest->jobId = $createUploadJobResponse->jobId;

        print('Request processing of fixed price items...');
        $startUploadJobResponse = $exchangeService->startUploadJob($startUploadJobRequest);
        print("Done\n");

        if (isset($startUploadJobResponse->errorMessage)) {
            foreach ($startUploadJobResponse->errorMessage->error as $error) {
                printf(
                    "%s: %s\n\n",
                    $error->severity === BulkDataExchange\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning',
                    $error->message
                );
            }
        }

        if ($startUploadJobResponse->ack !== 'Failure') {
            /**
             * Now wait for the job to be processed.
             */
            $getJobStatusRequest = new BulkDataExchange\Types\GetJobStatusRequest();
            $getJobStatusRequest->jobId = $createUploadJobResponse->jobId;

            $done = false;

            while (!$done) {
                $getJobStatusResponse = $exchangeService->getJobStatus($getJobStatusRequest);

                if (isset($getJobStatusResponse->errorMessage)) {
                    foreach ($getJobStatusResponse->errorMessage->error as $error) {
                        printf(
                            "%s: %s\n\n",
                            $error->severity === BulkDataExchange\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning',
                            $error->message
                        );
                    }
                }

                if ($getJobStatusResponse->ack !== 'Failure') {
                    printf("Status is %s\n", $getJobStatusResponse->jobProfile[0]->jobStatus);

                    switch ($getJobStatusResponse->jobProfile[0]->jobStatus) {
                        case BulkDataExchange\Enums\JobStatus::C_COMPLETED:
                            $downloadFileReferenceId = $getJobStatusResponse->jobProfile[0]->fileReferenceId;
                            $done = true;
                            break;
                        case BulkDataExchange\Enums\JobStatus::C_ABORTED:
                        case BulkDataExchange\Enums\JobStatus::C_FAILED:
                            $done = true;
                            break;
                        default:
                            sleep(5);
                            break;
                    }
                } else {
                    $done = true;
                }
            }

            if (isset($downloadFileReferenceId)) {
                $downloadFileRequest = new FileTransfer\Types\DownloadFileRequest();
                $downloadFileRequest->fileReferenceId = $downloadFileReferenceId;
                $downloadFileRequest->taskReferenceId = $createUploadJobResponse->jobId;

                print('Downloading fixed price item responses...');
                $downloadFileResponse = $transferService->downloadFile($downloadFileRequest);
                print("Done\n");

                if (isset($downloadFileResponse->errorMessage)) {
                    foreach ($downloadFileResponse->errorMessage->error as $error) {
                        printf(
                            "%s: %s\n\n",
                            $error->severity === FileTransfer\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning',
                            $error->message
                        );
                    }
                }

                if ($downloadFileResponse->ack !== 'Failure') {
                    /**
                     * Check that the response has an attachment.
                     */
                    if ($downloadFileResponse->hasAttachment()) {
                        $attachment = $downloadFileResponse->attachment();

                        /**
                         * Save the attachment to file system's temporary directory.
                         */
                        $filename = saveAttachment($attachment['data']);
                        if ($filename !== false) {
                            $xml = unZipArchive($filename);
                            if ($xml !== false) {
                                $responses = $merchantData->addFixedPriceItem($xml);
                                foreach ($responses as $response) {
                                    if (isset($response->Errors)) {
                                        foreach ($response->Errors as $error) {
                                            printf(
                                                "%s: %s\n%s\n\n",
                                                $error->SeverityCode === MerchantData\Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning',
                                                $error->ShortMessage,
                                                $error->LongMessage
                                            );
                                        }
                                    }

                                    if ($response->Ack !== 'Failure') {
                                        printf(
                                            "The item was listed to the eBay Sandbox with the Item number %s\n",
                                            $response->ItemID
                                        );
                                    }
                                }
                            }
                        }
                    } else {
                        print("Unable to locate attachment\n\n");
                    }
                }
            }
        }
    }
}

function buildPayload()
{
    global $config;

    $payload = new MerchantData\Types\BulkDataExchangeRequestsType();
    $payload->Header = new MerchantData\Types\MerchantDataRequestHeaderType();
    $payload->Header->SiteID = Constants\SiteIds::US;
    $payload->Header->Version = '951';

    $payload->AddFixedPriceItemRequest[] = buildAddFixedPriceItemRequest([
        'title' => 'Example one',
        'description' => 'Example one',
        'sku' => 'abc-001',
        'price' => 9.99,
        'quantity' => 1
    ]);

    $payload->AddFixedPriceItemRequest[] = buildAddFixedPriceItemRequest([
        'title' => 'Example two',
        'description' => 'Example two',
        'sku' => 'abc-002',
        'price' => 10.99,
        'quantity' => 9
    ]);

    return $payload;
}

function buildAddFixedPriceItemRequest($details)
{
    global $config;

    $request = new MerchantData\Types\AddFixedPriceItemRequestType();
    $request->Version = '951';

    $item = new MerchantData\Types\ItemType();
    $item->ListingType = MerchantData\Enums\ListingTypeCodeType::C_FIXED_PRICE_ITEM;
    $item->Quantity = $details['quantity'];
    $item->ListingDuration = 'GTC';
    $item->StartPrice = new MerchantData\Types\AmountType(['value' => $details['price']]);
    $item->Title = $details['title'];
    $item->Description = $details['description'];
    $item->SKU = $details['sku'];
    $item->Country = 'US';
    $item->Location = 'Beverly Hills';
    $item->PostalCode = '90210';
    $item->Currency = 'USD';
    $item->PictureDetails = new MerchantData\Types\PictureDetailsType();
    $item->PictureDetails->GalleryType = MerchantData\Enums\GalleryTypeCodeType::C_GALLERY;
    $item->PictureDetails->PictureURL = ['http://lorempixel.com/1500/1024/abstract'];
    $item->PrimaryCategory = new MerchantData\Types\CategoryType();
    $item->PrimaryCategory->CategoryID = '29792';
    $item->ConditionID = 1000;
    $item->PaymentMethods = [
        'PayPal'
    ];
    $item->PayPalEmailAddress = 'example@example.com';
    $item->DispatchTimeMax = 1;
    $item->ShippingDetails = new MerchantData\Types\ShippingDetailsType();
    $item->ShippingDetails->ShippingType = MerchantData\Enums\ShippingTypeCodeType::C_FLAT;
    $shippingService = new MerchantData\Types\ShippingServiceOptionsType();
    $shippingService->ShippingServicePriority = 1;
    $shippingService->ShippingService = 'Other';
    $shippingService->ShippingServiceCost = new MerchantData\Types\AmountType(['value' => 2.00]);
    $item->ShippingDetails->ShippingServiceOptions[] = $shippingService;
    $item->ReturnPolicy = new MerchantData\Types\ReturnPolicyType();
    $item->ReturnPolicy->ReturnsAcceptedOption = 'ReturnsAccepted';
    $item->ReturnPolicy->RefundOption = 'MoneyBack';
    $item->ReturnPolicy->ReturnsWithinOption = 'Days_14';
    $item->ReturnPolicy->ShippingCostPaidByOption = 'Buyer';

    $request->Item = $item;

    return $request;
}


text:
<?php

declare(strict_types=1);

namespace Codeception\Util\Shared;

use function array_filter;
use function array_pop;
use function explode;
use function implode;
use function ltrim;
use function str_replace;

trait Namespaces
{
    /**
     * @return string[]
     */
    protected function breakParts(string $class): array
    {
        // removing leading slashes and dots first
        $class = str_replace('/', '\\', ltrim($class, './\\'));
        return explode('\\', $class);
    }

    protected function getShortClassName(string $class): string
    {
        $namespaces = $this->breakParts($class);
        return array_pop($namespaces);
    }

    protected function getNamespaceString(string $class): string
    {
        $namespaces = $this->getNamespaces($class);
        return implode('\\', $namespaces);
    }

    protected function getNamespaceHeader(string $class): string
    {
        $str = $this->getNamespaceString($class);
        if (!$str) {
            return "";
        }
        return "\nnamespace {$str};\n";
    }

    protected function getNamespaces(string $class): array
    {
        $namespaces = $this->breakParts($class);
        array_pop($namespaces);
        return array_filter($namespaces, 'strlen');
    }
}


text:
CWD=$(shell pwd)
GOPATH := $(CWD)

prep:
	if test -d pkg; then rm -rf pkg; fi

self:   prep
	if test -d src; then rm -rf src; fi
	mkdir -p src/github.com/whosonfirst/go-whosonfirst-bbox/parser
	cp bbox.go src/github.com/whosonfirst/go-whosonfirst-bbox/
	cp parser/*.go src/github.com/whosonfirst/go-whosonfirst-bbox/parser
	cp -r vendor/* src/

rmdeps:
	if test -d src; then rm -rf src; fi

build:	fmt bin

deps:
	@GOPATH=$(GOPATH) go get -u "github.com/facebookgo/grace/gracehttp"
	@GOPATH=$(GOPATH) go get -u "github.com/thisisaaronland/go-marc"

vendor-deps: rmdeps deps
	if test -d vendor; then rm -rf vendor; fi
	cp -r src vendor
	find vendor -name '.git' -print -type d -exec rm -rf {} +
	rm -rf src

fmt:
	go fmt bbox.go
	go fmt cmd/*.go

bin: 	rmdeps self
	@GOPATH=$(GOPATH) go build -o bin/parse-bbox cmd/parse-bbox.go
	@GOPATH=$(GOPATH) go build -o bin/parse-bbox-server cmd/parse-bbox-server.go


text:
using UnityEngine;
using System.Collections.Generic;

/**
 * GravityManager can give you a gravity force vector at any point in the scene.
 */

public class GravityManager : Singleton<GravityManager>
{

	// Properties
	// -----------------------------------------------------

	/** Maximum distance from ground at which gravity applies. */
	public float GroundMaxDistance = 100;

	/** Layer mask for determining what constitutes solid ground. */
	public LayerMask GroundLayers;

	/** Strength of the gravitational field. */
	public float Strength;

	/** Number of samples to take when estimating gravity. */
	public int Samples = 128;

	// Members
	// -----------------------------------------------------

	/** Raycast hit info. */
	private RaycastHit hit =  new RaycastHit();

	// Public Methods
	// -----------------------------------------------------

	/** Return a gravity force vector, given a point in world space. */
	public Vector3 ForceAt(Vector3 point)
	{
		// Scatter rays out randomly, looking for solid ground.
		// When we hit it, accumulate the resulting surface normal.
		Vector3 gravity = Vector3.zero;
		for (int i = 0; i < Samples; i++)
		{
			Vector3 direction = Random.onUnitSphere;
			if (Physics.Raycast(point, direction, out hit, GroundMaxDistance, GroundLayers))
				gravity -= (hit.normal * 1 / (hit.distance * hit.distance));

			/*
			{
				// Recover the gravity source.
				GravitySource source = hit.collider.gameObject.GetComponent<GravitySource>();
				if (source)
					gravity += hit.normal * source.Strength;
			}
			*/
		}

		// Return the overall gravity direction.
		return gravity.normalized * Strength;
	}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GlueCsvEditor.Data
{
    public class ComplexTypeProperty
    {
        public string Name { get; set; }
        public string Type { get; set; }
        public string Value { get; set; }
        public List<string> Attributes { get; set; } = new List<string>();

        public override string ToString()
        {
            return $"{Type} {Name} = {Value}";
        }
    }
}


text:
<?php

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('predefinedlist');

/**
 * Plugin Status field.
 *
 * @since  3.5
 */
class JFormFieldPlugin_Status extends JFormFieldPredefinedList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.5
	 */
	public $type = 'Plugin_Status';

	/**
	 * Available statuses
	 *
	 * @var  array
	 * @since  3.5
	 */
	protected $predefinedOptions = array(
		'0'  => 'JDISABLED',
		'1'  => 'JENABLED',
	);
}


text:
package testing

import (
	"context"
	"errors"

	"knative.dev/eventing-natss/pkg/dispatcher"
	eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"
	messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1"
)

// DispatcherDoNothing is a mock which doesn't do anything
type DispatcherDoNothing struct{}

var _ dispatcher.NatsDispatcher = (*DispatcherDoNothing)(nil)

func NewDispatcherDoNothing() dispatcher.NatsDispatcher {
	return &DispatcherDoNothing{}
}

func (s *DispatcherDoNothing) Start(_ context.Context) error {
	return nil
}

func (s *DispatcherDoNothing) UpdateSubscriptions(ctx context.Context, name, ns string, subscriptions []eventingduckv1.SubscriberSpec, isFinalizer bool) (map[eventingduckv1.SubscriberSpec]error, error) {
	return nil, nil
}

func (s *DispatcherDoNothing) ProcessChannels(_ context.Context, _ []messagingv1.Channel) error {
	return nil
}

// DispatcherFailNatssSubscription simulates that natss has a failed subscription
type DispatcherFailNatssSubscription struct {
}

var _ dispatcher.NatsDispatcher = (*DispatcherFailNatssSubscription)(nil)

func NewDispatcherFailNatssSubscription() *DispatcherFailNatssSubscription {
	return &DispatcherFailNatssSubscription{}
}

func (s *DispatcherFailNatssSubscription) Start(_ context.Context) error {
	return nil
}

// UpdateSubscriptions returns a failed natss subscription
func (s *DispatcherFailNatssSubscription) UpdateSubscriptions(ctx context.Context, name, ns string, subscriptions []eventingduckv1.SubscriberSpec, isFinalizer bool) (map[eventingduckv1.SubscriberSpec]error, error) {
	failedSubscriptions := make(map[eventingduckv1.SubscriberSpec]error, len(subscriptions))
	for _, sub := range subscriptions {
		ss := eventingduckv1.SubscriberSpec{
			UID:           sub.UID,
			Generation:    sub.Generation,
			SubscriberURI: sub.SubscriberURI,
			ReplyURI:      sub.ReplyURI,
			Delivery:      sub.Delivery,
		}
		failedSubscriptions[ss] = errors.New("ups")
	}
	return failedSubscriptions, nil
}

func (s *DispatcherFailNatssSubscription) ProcessChannels(_ context.Context, _ []messagingv1.Channel) error {
	return nil
}