text:
namespace boost
{
namespace statechart
{
namespace detail
{

template< class Allocator, class RttiPolicy >
class leaf_state;
template< class Allocator, class RttiPolicy >
class node_state_base;

typedef unsigned char orthogonal_position_type;

//////////////////////////////////////////////////////////////////////////////
template< class Allocator, class RttiPolicy >
class state_base :
  #ifndef NDEBUG
  noncopyable,
  #endif
  public RttiPolicy::template rtti_base_type<
    // Derived class objects will be created, handled and destroyed by exactly
    // one thread --> locking is not necessary
    counted_base< false > >
{
  typedef typename RttiPolicy::template rtti_base_type<
    counted_base< false > > base_type;

  public:
    //////////////////////////////////////////////////////////////////////////
    void exit() {}

    virtual const state_base * outer_state_ptr() const = 0;

  protected:
    //////////////////////////////////////////////////////////////////////////
    state_base( typename RttiPolicy::id_provider_type idProvider ) :
      base_type( idProvider ),
      deferredEvents_( false )
    {
    }

    #if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT( 4 ) )
    // We make the destructor virtual for GCC because with this compiler there
    // is currently no way to disable the "has virtual functions but
    // non-virtual destructor" warning on a class by class basis. Although it
    // can be done on the compiler command line with -Wno-non-virtual-dtor,
    // this is undesirable as this would also suppress legitimate warnings for
    // types that are not states.
    virtual ~state_base() {}
    #else
    // This destructor is not virtual for performance reasons. The library
    // ensures that a state object is never deleted through a state_base
    // pointer but only through a pointer to the most-derived type.
    ~state_base() {}
    #endif

  protected:
    //////////////////////////////////////////////////////////////////////////
    // The following declarations should be private.
    // They are only protected because many compilers lack template friends.
    //////////////////////////////////////////////////////////////////////////
    void defer_event()
    {
      deferredEvents_ = true;
    }

    bool deferred_events() const
    {
      return deferredEvents_;
    }

    template< class Context >
    void set_context( orthogonal_position_type position, Context * pContext )
    {
      pContext->add_inner_state( position, this );
    }

  public:
    //////////////////////////////////////////////////////////////////////////
    // The following declarations should be private.
    // They are only public because many compilers lack template friends.
    //////////////////////////////////////////////////////////////////////////
    virtual detail::reaction_result react_impl(
      const event_base & evt,
      typename RttiPolicy::id_type eventType ) = 0;

    typedef intrusive_ptr< node_state_base< Allocator, RttiPolicy > >
      node_state_base_ptr_type;
    typedef intrusive_ptr< leaf_state< Allocator, RttiPolicy > >
      leaf_state_ptr_type;
    typedef std::list<
      leaf_state_ptr_type,
      typename boost::detail::allocator::rebind_to<
        Allocator, leaf_state_ptr_type >::type
    > state_list_type;

    virtual void remove_from_state_list(
      typename state_list_type::iterator & statesEnd,
      node_state_base_ptr_type & pOutermostUnstableState,
      bool performFullExit ) = 0;

  private:
    //////////////////////////////////////////////////////////////////////////
    bool deferredEvents_;
};

#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
} // namespace detail
} // namespace statechart
#endif

template< class Allocator, class RttiPolicy >
inline void intrusive_ptr_add_ref(
  const ::boost::statechart::detail::state_base< Allocator, RttiPolicy > * pBase )
{
  pBase->add_ref();
}

template< class Allocator, class RttiPolicy >
inline void intrusive_ptr_release(
  const ::boost::statechart::detail::state_base< Allocator, RttiPolicy > * pBase )
{
  if ( pBase->release() )
  {
    // The state_base destructor is *not* virtual for performance reasons
    // but intrusive_ptr< state_base > objects are nevertheless used to point
    // to states. This assert ensures that such a pointer is never the last
    // one referencing a state object.
    BOOST_ASSERT( false );
  }
}

#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
} // namespace detail
} // namespace statechart
#endif

} // namespace boost

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="hi-IN">
  <info>
    <translator>
      <name>Neha Srivastava</name>
      <email>neha-srivastava@outlook.com</email>
    </translator>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
    <updated>2021-02-22T12:13:02+05:30</updated>
  </info>
  <style-options punctuation-in-quote="true"/>
  <date form="text">
    <date-part name="day" suffix=" "/>
    <date-part name="month" suffix=", "/>
    <date-part name="year"/>
  </date>
  <date form="numeric">
    <date-part name="day" form="numeric-leading-zeros" suffix="/"/>
    <date-part name="month" form="numeric-leading-zeros" suffix="/"/>
    <date-part name="year"/>
  </date>
  <terms>
    <term name="advance-online-publication">advance online publication</term>
    <term name="album">album</term>
    <term name="audio-recording">audio recording</term>
    <term name="film">film</term>
    <term name="henceforth">henceforth</term>
    <term name="loc-cit">loc. cit.</term> <!-- like ibid., the abbreviated form is the regular form  -->
    <term name="no-place">no place</term>
    <term name="no-place" form="short">n.p.</term>
    <term name="no-publisher">no publisher</term> <!-- sine nomine -->
    <term name="no-publisher" form="short">n.p.</term>
    <term name="on">on</term>
    <term name="op-cit">op. cit.</term> <!-- like ibid., the abbreviated form is the regular form  -->
    <term name="original-work-published">original work published</term>
    <term name="personal-communication">personal communication</term>
    <term name="podcast">podcast</term>
    <term name="podcast-episode">podcast episode</term>
    <term name="preprint">preprint</term>
    <term name="radio-broadcast">radio broadcast</term>
    <term name="radio-series">radio series</term>
    <term name="radio-series-episode">radio series episode</term>
    <term name="special-issue">special issue</term>
    <term name="special-section">special section</term>
    <term name="television-broadcast">television broadcast</term>
    <term name="television-series">television series</term>
    <term name="television-series-episode">television series episode</term>
    <term name="video">video</term>
    <term name="working-paper">working paper</term>
    <term name="accessed">अंतिम उपयोग</term>
    <term name="and">व</term>
    <term name="and others">व अन्य</term>
    <term name="anonymous">अज्ञात</term>
    <term name="anonymous" form="short">अज्ञात</term>
    <term name="at">पर</term>
    <term name="available at">पर उपलब्ध</term>
    <term name="by">द्वारा</term>
    <term name="circa">सन </term>
    <term name="circa" form="short">सन.</term>
    <term name="cited">उल्लेखित</term>
    <term name="edition">
      <single>संस्करण</single>
      <multiple>संस्करण</multiple>
    </term>
    <term name="edition" form="short">ed.</term>
    <term name="et-al">इत्यादि</term>
    <term name="forthcoming">आगामी</term>
    <term name="from">से</term>
    <term name="ibid">उक्त</term>
    <term name="in">में</term>
    <term name="in press">मुद्रण में</term>
    <term name="internet">इंटर्नेट</term>
    <term name="letter">पत्र</term>
    <term name="no date">दिनांक अज्ञात</term>
    <term name="no date" form="short">n.d.</term>
    <term name="online">ऑनलाइन</term>
    <term name="presented at">पर प्रस्तुत</term>
    <term name="reference">
      <single>संदर्भ</single>
      <multiple>references</multiple>
    </term>
    <term name="reference" form="short">
      <single>ref.</single>
      <multiple>refs.</multiple>
    </term>
    <term name="retrieved">पुनर्प्राप्त</term>
    <term name="scale">scale</term>
    <term name="version">संस्करण</term>

    <!-- LONG ITEM TYPE FORMS -->
    <term name="article">preprint</term>
    <term name="article-journal">journal article</term>
    <term name="article-magazine">magazine article</term>
    <term name="article-newspaper">newspaper article</term>
    <term name="bill">bill</term>
    <!-- book is in the list of locator terms -->
    <term name="broadcast">broadcast</term>
    <!-- chapter is in the list of locator terms -->
    <term name="classic">classic</term>
    <term name="collection">collection</term>
    <term name="dataset">dataset</term>
    <term name="document">document</term>
    <term name="entry">entry</term>
    <term name="entry-dictionary">dictionary entry</term>
    <term name="entry-encyclopedia">encyclopedia entry</term>
    <term name="event">event</term>
    <!-- figure is in the list of locator terms -->
    <term name="graphic">graphic</term>
    <term name="hearing">hearing</term>
    <term name="interview">साक्षात्कार</term>
    <term name="legal_case">legal case</term>
    <term name="legislation">legislation</term>
    <term name="manuscript">manuscript</term>
    <term name="map">map</term>
    <term name="motion_picture">video recording</term>
    <term name="musical_score">musical score</term>
    <term name="pamphlet">pamphlet</term>
    <term name="paper-conference">conference paper</term>
    <term name="patent">patent</term>
    <term name="performance">performance</term>
    <term name="periodical">periodical</term>
    <term name="personal_communication">personal communication</term>
    <term name="post">post</term>
    <term name="post-weblog">blog post</term>
    <term name="regulation">regulation</term>
    <term name="report">report</term>
    <term name="review">review</term>
    <term name="review-book">book review</term>
    <term name="software">software</term>
    <term name="song">audio recording</term>
    <term name="speech">presentation</term>
    <term name="standard">standard</term>
    <term name="thesis">thesis</term>
    <term name="treaty">treaty</term>
    <term name="webpage">webpage</term>

    <!-- SHORT ITEM TYPE FORMS -->
    <term name="article-journal" form="short">journal art.</term>
    <term name="article-magazine" form="short">mag. art.</term>
    <term name="article-newspaper" form="short">newspaper art.</term>
    <!-- book is in the list of locator terms -->
    <!-- chapter is in the list of locator terms -->
    <term name="document" form="short">doc.</term>
    <!-- figure is in the list of locator terms -->
    <term name="graphic" form="short">graph.</term>
    <term name="interview" form="short">interv.</term>
    <term name="manuscript" form="short">MS</term>
    <term name="motion_picture" form="short">video rec.</term>
    <term name="report" form="short">rep.</term>
    <term name="review" form="short">rev.</term>
    <term name="review-book" form="short">bk. rev.</term>
    <term name="song" form="short">audio rec.</term>

    <!-- HISTORICAL ERA TERMS -->
    <term name="ad">CE</term>
    <term name="bc">BCE</term>
    <term name="bce">BCE</term>
    <term name="ce">CE</term>

    <!-- PUNCTUATION -->
    <term name="open-quote">"</term>
    <term name="close-quote">"</term>
    <term name="open-inner-quote">'</term>
    <term name="close-inner-quote">'</term>
    <term name="page-range-delimiter">–</term>
    <term name="colon">:</term>
    <term name="comma">,</term>
    <term name="semicolon">;</term>

    <!-- ORDINALS -->
    <term name="ordinal">वाँ</term>
    <term name="ordinal-01"></term>
    <term name="ordinal-02"></term>
    <term name="ordinal-03"></term>
    <term name="ordinal-04"></term>
    <term name="ordinal-06"></term>

    <!-- LONG ORDINALS -->
    <term name="long-ordinal-01">पहला</term>
    <term name="long-ordinal-01" gender-form="feminine">पहली</term>
    <term name="long-ordinal-02">दूसरा</term>
    <term name="long-ordinal-02" gender-form="feminine">दूसरी</term>
    <term name="long-ordinal-03">तीसरा</term>
    <term name="long-ordinal-03" gender-form="feminine">तीसरी</term>
    <term name="long-ordinal-04">चौथा</term>
    <term name="long-ordinal-04" gender-form="feminine">चौथी</term>
    <term name="long-ordinal-05">पाँचवा</term>
    <term name="long-ordinal-05" gender-form="feminine">पाँचवी</term>
    <term name="long-ordinal-06">छठा</term>
    <term name="long-ordinal-06" gender-form="feminine">छठी</term>
    <term name="long-ordinal-07">सातवाँ</term>
    <term name="long-ordinal-07" gender-form="feminine">सातवीं</term>
    <term name="long-ordinal-08">आठवाँ</term>
    <term name="long-ordinal-08" gender-form="feminine">आठवीं</term>
    <term name="long-ordinal-09">नवाँ</term>
    <term name="long-ordinal-09" gender-form="feminine">नौवीं</term>
    <term name="long-ordinal-10">दसवाँ</term>
    <term name="long-ordinal-10" gender-form="feminine">दसवीं</term>

    <!-- LONG LOCATOR FORMS -->
    <term name="act">
      <single>act</single>
      <multiple>acts</multiple>
    </term>
    <term name="appendix">
      <single>appendix</single>
      <multiple>appendices</multiple>
    </term>
    <term name="article-locator">
      <single>article</single>
      <multiple>articles</multiple>
    </term>
    <term name="canon">
      <single>canon</single>
      <multiple>canons</multiple>
    </term>
    <term name="elocation">
      <single>location</single>
      <multiple>locations</multiple>
    </term>
    <term name="equation">
      <single>equation</single>
      <multiple>equations</multiple>
    </term>
    <term name="rule">
      <single>rule</single>
      <multiple>rules</multiple>
    </term>
    <term name="scene">
      <single>scene</single>
      <multiple>scenes</multiple>
    </term>
    <term name="table">
      <single>table</single>
      <multiple>tables</multiple>
    </term>
    <term name="timestamp"> <!-- generally blank -->
      <single></single>
      <multiple></multiple>
    </term>
    <term name="title-locator">
      <single>title</single>
      <multiple>titles</multiple>
    </term>
    <term name="book">
      <single>पुस्तक</single>
      <multiple>पुस्तकें</multiple>
    </term>
    <term name="chapter">
      <single>अध्याय</single>
      <multiple>अध्याय</multiple>
    </term>
    <term name="column">
      <single>कॉलम</single>
      <multiple>columns</multiple>
    </term>
    <term name="figure">
      <single>चित्र</single>
      <multiple>चित्रों</multiple>
    </term>
    <term name="folio">
      <single>पर्ण</single>
      <multiple>folios</multiple>
    </term>
    <term name="issue">
      <single>संख्या</single>
      <multiple>संख्याएँ</multiple>
    </term>
    <term name="line">
      <single>पंक्ति</single>
      <multiple>पंक्तियाँ</multiple>
    </term>
    <term name="note">
      <single>नोट</single>
      <multiple>notes</multiple>
    </term>
    <term name="opus">
      <single>opus</single>
      <multiple>opera</multiple>
    </term>
    <term name="page">
      <single>पृष्ठ</single>
      <multiple>पृष्ठ</multiple>
    </term>
    <term name="number-of-pages">
      <single>पृष्ठ संख्या</single>
      <multiple>पृष्ठों की संख्या</multiple>
    </term>
    <term name="paragraph">
      <single>अनुच्छेद</single>
      <multiple>paragraphs</multiple>
    </term>
    <term name="part">
      <single>भाग</single>
      <multiple>parts</multiple>
    </term>
    <term name="section">
      <single>अनुभाग</single>
      <multiple>sections</multiple>
    </term>
    <term name="sub-verbo">
      <single>sub verbo</single>
      <multiple>sub verbis</multiple>
    </term>
    <term name="verse">
      <single>पद</single>
      <multiple>verses</multiple>
    </term>
    <term name="volume">
      <single>वॉल्यूम</single>
      <multiple>वॉल्यूम्ज़</multiple>
    </term>

    <!-- SHORT LOCATOR FORMS -->
    <term name="appendix" form="short">
      <single>app.</single>
      <multiple>apps.</multiple>
    </term>
    <term name="article-locator" form="short">
      <single>art.</single>
      <multiple>arts.</multiple>
    </term>
    <term name="elocation" form="short">
      <single>loc.</single>
      <multiple>locs.</multiple>
    </term>
    <term name="equation" form="short">
      <single>eq.</single>
      <multiple>eqs.</multiple>
    </term>
    <term name="rule" form="short">
      <single>r.</single>
      <multiple>rr.</multiple>
    </term>
    <term name="scene" form="short">
      <single>sc.</single>
      <multiple>scs.</multiple>
    </term>
    <term name="table" form="short">
      <single>tbl.</single>
      <multiple>tbls.</multiple>
    </term>
    <term name="timestamp" form="short"> <!-- generally blank -->
      <single></single>
      <multiple></multiple>
    </term>
    <term name="title-locator" form="short">
      <single>tit.</single>
      <multiple>tits.</multiple>
    </term>
    <term name="book" form="short">
      <single>bk.</single>
      <multiple>bks.</multiple>
    </term>
    <term name="chapter" form="short">
      <single>chap.</single>
      <multiple>chaps.</multiple>
    </term>
    <term name="column" form="short">
      <single>col.</single>
      <multiple>cols.</multiple>
    </term>
    <term name="figure" form="short">
      <single>fig.</single>
      <multiple>figs.</multiple>
    </term>
    <term name="folio" form="short">
      <single>fol.</single>
      <multiple>fols.</multiple>
    </term>
    <term name="issue" form="short">
      <single>no.</single>
      <multiple>nos.</multiple>
    </term>
    <term name="line" form="short">
      <single>l.</single>
      <multiple>ll.</multiple>
    </term>
    <term name="note" form="short">
      <single>n.</single>
      <multiple>nn.</multiple>
    </term>
    <term name="opus" form="short">
      <single>op.</single>
      <multiple>opp.</multiple>
    </term>
    <term name="page" form="short">
      <single>पृ.</single>
      <multiple>पृ.</multiple>
    </term>
    <term name="number-of-pages" form="short">
      <single>पृ. स.</single>
      <multiple>पृ. स.</multiple>
    </term>
    <term name="paragraph" form="short">
      <single>para.</single>
      <multiple>paras.</multiple>
    </term>
    <term name="part" form="short">
      <single>pt.</single>
      <multiple>pts.</multiple>
    </term>
    <term name="section" form="short">
      <single>sec.</single>
      <multiple>secs.</multiple>
    </term>
    <term name="sub-verbo" form="short">
      <single>s.v.</single>
      <multiple>s.vv.</multiple>
    </term>
    <term name="verse" form="short">
      <single>v.</single>
      <multiple>vv.</multiple>
    </term>
    <term name="volume" form="short">
      <single>vol.</single>
      <multiple>vols.</multiple>
    </term>

    <!-- SYMBOL LOCATOR FORMS -->
    <term name="paragraph" form="symbol">
      <single>¶</single>
      <multiple>¶¶</multiple>
    </term>
    <term name="section" form="symbol">
      <single>§</single>
      <multiple>§§</multiple>
    </term>

    <!-- LONG ROLE FORMS -->
    <term name="chair">
      <single>chair</single>
      <multiple>chairs</multiple>
    </term>
    <term name="compiler">
      <single>compiler</single>
      <multiple>compilers</multiple>
    </term>
    <term name="contributor">
      <single>contributor</single>
      <multiple>contributors</multiple>
    </term>
    <term name="curator">
      <single>curator</single>
      <multiple>curators</multiple>
    </term>
    <term name="executive-producer">
      <single>executive producer</single>
      <multiple>executive producers</multiple>
    </term>
    <term name="guest">
      <single>guest</single>
      <multiple>guests</multiple>
    </term>
    <term name="host">
      <single>host</single>
      <multiple>hosts</multiple>
    </term>
    <term name="narrator">
      <single>narrator</single>
      <multiple>narrators</multiple>
    </term>
    <term name="organizer">
      <single>organizer</single>
      <multiple>organizers</multiple>
    </term>
    <term name="performer">
      <single>performer</single>
      <multiple>performers</multiple>
    </term>
    <term name="producer">
      <single>producer</single>
      <multiple>producers</multiple>
    </term>
    <term name="script-writer">
      <single>writer</single>
      <multiple>writers</multiple>
    </term>
    <term name="series-creator">
      <single>series creator</single>
      <multiple>series creators</multiple>
    </term>
    <term name="director">
      <single>निर्देशक</single>
      <multiple>directors</multiple>
    </term>
    <term name="editor">
      <single>सम्पादक</single>
      <multiple>editors</multiple>
    </term>
    <term name="editorial-director">
      <single>सम्पादक</single>
      <multiple>editors</multiple>
    </term>
    <term name="illustrator">
      <single>चित्रकार</single>
      <multiple>illustrators</multiple>
    </term>
    <term name="translator">
      <single>अनुवादक</single>
      <multiple>translators</multiple>
    </term>
    <term name="editortranslator">
      <single>सम्पादक & अनुवादक</single>
      <multiple>editors & translators</multiple>
    </term>

    <!-- SHORT ROLE FORMS -->
    <term name="compiler" form="short">
      <single>comp.</single>
      <multiple>comps.</multiple>
    </term>
    <term name="contributor" form="short">
      <single>contrib.</single>
      <multiple>contribs.</multiple>
    </term>
    <term name="curator" form="short">
      <single>cur.</single>
      <multiple>curs.</multiple>
    </term>
    <term name="executive-producer" form="short">
      <single>exec. prod.</single>
      <multiple>exec. prods.</multiple>
    </term>
    <term name="narrator" form="short">
      <single>narr.</single>
      <multiple>narrs.</multiple>
    </term>
    <term name="organizer" form="short">
      <single>org.</single>
      <multiple>orgs.</multiple>
    </term>
    <term name="performer" form="short">
      <single>perf.</single>
      <multiple>perfs.</multiple>
    </term>
    <term name="producer" form="short">
      <single>prod.</single>
      <multiple>prods.</multiple>
    </term>
    <term name="script-writer" form="short">
      <single>writ.</single>
      <multiple>writs.</multiple>
    </term>
    <term name="series-creator" form="short">
      <single>cre.</single>
      <multiple>cres.</multiple>
    </term>
    <term name="director" form="short">
      <single>dir.</single>
      <multiple>dirs.</multiple>
    </term>
    <term name="editor" form="short">
      <single>ed.</single>
      <multiple>eds.</multiple>
    </term>
    <term name="editorial-director" form="short">
      <single>ed.</single>
      <multiple>eds.</multiple>
    </term>
    <term name="illustrator" form="short">
      <single>ill.</single>
      <multiple>ills.</multiple>
    </term>
    <term name="translator" form="short">
      <single>tran.</single>
      <multiple>trans.</multiple>
    </term>
    <term name="editortranslator" form="short">
      <single>ed. & tran.</single>
      <multiple>eds. & trans.</multiple>
    </term>

    <!-- VERB ROLE FORMS -->
    <term name="chair" form="verb">chaired by</term>
    <term name="compiler" form="verb">compiled by</term>
    <term name="contributor" form="verb">with</term>
    <term name="curator" form="verb">curated by</term>
    <term name="executive-producer" form="verb">executive produced by</term>
    <term name="guest" form="verb">with guest</term>
    <term name="host" form="verb">hosted by</term>
    <term name="narrator" form="verb">narrated by</term>
    <term name="organizer" form="verb">organized by</term>
    <term name="performer" form="verb">performed by</term>
    <term name="producer" form="verb">produced by</term>
    <term name="script-writer" form="verb">written by</term>
    <term name="series-creator" form="verb">created by</term>
    <term name="container-author" form="verb">द्वारा</term>
    <term name="director" form="verb">निर्देशन</term>
    <term name="editor" form="verb">सम्पादन</term>
    <term name="editorial-director" form="verb">निर्देशन</term>
    <term name="illustrator" form="verb">चित्रकारी</term>
    <term name="interviewer" form="verb">साक्षात्कारकर्ता</term>
    <term name="recipient" form="verb">सेवा में</term>
    <term name="reviewed-author" form="verb">द्वारा</term>
    <term name="translator" form="verb">अनुवाद </term>
    <term name="editortranslator" form="verb">सम्पादन & अनुवाद</term>

    <!-- SHORT VERB ROLE FORMS -->
    <term name="compiler" form="verb-short">comp. by</term>
    <term name="contributor" form="verb-short">w.</term>
    <term name="curator" form="verb-short">cur. by</term>
    <term name="executive-producer" form="verb-short">exec. prod. by</term>
    <term name="guest" form="verb-short">w. guest</term>
    <term name="host" form="verb-short">hosted by</term>
    <term name="narrator" form="verb-short">narr. by</term>
    <term name="organizer" form="verb-short">org. by</term>
    <term name="performer" form="verb-short">perf. by</term>
    <term name="producer" form="verb-short">prod. by</term>
    <term name="script-writer" form="verb-short">writ. by</term>
    <term name="series-creator" form="verb-short">cre. by</term>
    <term name="director" form="verb-short">dir. by</term>
    <term name="editor" form="verb-short">ed. by</term>
    <term name="editorial-director" form="verb-short">ed. by</term>
    <term name="illustrator" form="verb-short">illus. by</term>
    <term name="translator" form="verb-short">trans. by</term>
    <term name="editortranslator" form="verb-short">ed. & trans. by</term>

    <!-- LONG MONTH FORMS -->
    <term name="month-01">जनवरी</term>
    <term name="month-02">फ़रवरी</term>
    <term name="month-03">मार्च</term>
    <term name="month-04">अप्रैल</term>
    <term name="month-05">मई</term>
    <term name="month-06">जून</term>
    <term name="month-07">जुलाई</term>
    <term name="month-08">अगस्त</term>
    <term name="month-09">सितम्बर</term>
    <term name="month-10">अक्टूबर</term>
    <term name="month-11">नवम्बर</term>
    <term name="month-12">दिसम्बर</term>

    <!-- SHORT MONTH FORMS -->
    <term name="month-01" form="short">जन.</term>
    <term name="month-02" form="short">फ़र.</term>
    <term name="month-03" form="short">मार्च</term>
    <term name="month-04" form="short">अप्रैल</term>
    <term name="month-05" form="short">मई</term>
    <term name="month-06" form="short">जून</term>
    <term name="month-07" form="short">जुलाई</term>
    <term name="month-08" form="short">अग.</term>
    <term name="month-09" form="short">सित.</term>
    <term name="month-10" form="short">अक्ट.</term>
    <term name="month-11" form="short">नव.</term>
    <term name="month-12" form="short">दिस.</term>

    <!-- SEASONS -->
    <term name="season-01">वसंत ऋतु</term>
    <term name="season-02">ग्रीष्म ऋतु</term>
    <term name="season-03">पतझड़ ऋतु</term>
    <term name="season-04">शिशिर ऋतु</term>
  </terms>
</locale>

redpajama_set_name: RedPajamaGithub


text:
void set_static_cgi_environment(struct spade_server* server) {
    setenv("SERVER_SOFTWARE", SPADE_SERVER_DESCRIPTOR, 1);
    setenv("SERVER_NAME", server->hostname, 1);
    setenv("GATEWAY_INTERFACE", CGI_VERSION, 1);

    setenv("SERVER_PROTOCOL", "HTTP/1.0", 1);
    char stringified_port[MAX_PORT_LENGTH];
    sprintf(stringified_port, "%d", server->port);
    setenv("SERVER_PORT", stringified_port, 1);
}

void set_cgi_environment(struct spade_server* server, http_request* request,
        cgi_handler* handler) {
    setenv("REQUEST_METHOD", http_method_to_string(request->method), 1);

    char extra_path[MAX_PATH_LENGTH];
    strcpy(extra_path, request->uri.path + strlen(handler->handler));
    setenv("PATH_INFO", extra_path, 1);

    char translated_path[MAX_PATH_LENGTH];
    strcpy(translated_path, server->cgi_file_path);
    strcat(translated_path, extra_path);
    setenv("PATH_TRANSLATED", translated_path, 1);

    setenv("SCRIPT_NAME", handler->path, 1);
    setenv("QUERY_STRING", request->uri.query_string, 1);
    setenv("REMOTE_HOST", request->remote_host, 1);
    setenv("REMOTE_ADDR", request->remote_address, 1);
    // Spade only supports GET requests.
    // setenv("CONTENT_TYPE", TODO, 1);
    // setenv("CONTENT_LENGTH", TODO, 1);
}


text:
module RamlAPIConsole
  VERSION = "0.0.1"
end


text:
DROP VIEW IF EXISTS view_daftar_penerimaan_bpbd;

CREATE VIEW view_daftar_penerimaan_bpbd AS

SELECT
*

FROM
view_daftar_penerimaan_kabupaten

WHERE
1 = 1  AND
id_skpd = 39;

GRANT ALL PRIVILEGES ON view_daftar_penerimaan_bpbd, sub_skpd TO lap_bpbd;
REVOKE INSERT, UPDATE, DELETE ON view_daftar_penerimaan_bpbd, sub_skpd FROM lap_bpbd;


text:
const _ = require('@sailshq/lodash');
const async = require('async');
const jsonDiff = require('json-diff').diffString;
const Promise = require('bluebird');

// Direct use of `console` makes sense here because
// we're implementing an interaction at the CLI.
// -Tom

/* eslint-disable no-console */

module.exports = function(self, options) {
  self.enableAddMissingLocalesTask = function() {
    self.apos.tasks.add(self.__meta.name, 'add-missing-locales',
      'Generally no longer necessary to run yourself, as it will run automatically as you add locales. Run this task after adding new locales or setting up the module for the first time. If you are using the replicateAcrossLocales: false option, you may wish to specify --replicate-related-documents=locale-x,locale-y,locale-z as when you do so documents related to the parked pages and global document are copied from the parent locale. However this, too, happens automatically on the first normal startup or migration run of Apostrophe with new locales.',
      self.addMissingLocalesTask
    );
  };

  self.enableAddLocalePrefixesTask = function() {
    self.apos.tasks.add(self.__meta.name, 'add-locale-prefixes',
      'Run this task after turning on "prefixes: true" on an existing site.',
      self.addLocalePrefixesTask
    );
  };

  self.enableRemoveNumberedParkedPagesTask = function() {
    self.apos.tasks.add(self.__meta.name, 'remove-numbered-parked-pages',
      'One-time fix for very early users of this module who have duplicate parked pages due to an early oversight in the code. Use of this task is NOT recommended or necessary for new projects.',
      self.removeNumberedParkedPagesTask
    );
  };

  self.enableResolveJoinIdsTask = function() {
    self.apos.tasks.add(self.__meta.name, 'resolve-join-ids',
      'One-time fix for join ids not pointing to the right locale',
      self.resolveJoinIdsTask
    );
  };

  self.enableHarmonizeWorkflowGuidsByParkedIdTask = function() {
    self.apos.tasks.add(self.__meta.name, 'harmonize-workflow-guids-by-parked-id',
      'One-time fix for legacy workflow guids for the same parkedId not being consistent',
      self.harmonizeWorkflowGuidsByParkedIdTask
    );
  };

  self.enableDiffDraftAndLiveTask = function() {
    self.addTask('diff-draft-and-live',
      'Display a diff of the differences between the draft and live versions\n' +
      'of the document specified by draft _id as the first argument.',
      self.diffDraftAndLiveTask
    );
  };

  self.enableReplicateLocaleTask = function() {
    self.addTask('replicate-locale',
      'Call with --from=locale1 --to=locale2. locale1, which must already have content,\n' +
      'is replicated to locale2, DELETING ALL EXISTING CONTENT in locale2.\n' +
      'This is occasionally a helpful convenience for new locales when the\n' +
      'replicateAcrossLocales option is set to false but you wish to make an\n' +
      'exception for a particular new locale.\n\n' +
      'If you did significant work in locale2 prior to deciding to replace it with\n' +
      'a copy of locale1, and there are already attachments referenced by locale2,\n' +
      'you should run the apostrophe-attachments:recompute-all-doc-references task\n' +
      'after this task. If you have not done any work yet in locale2 this is not\n' +
      'necessary, so it is not done by default.',
      self.replicateLocaleTask
    );
  };

  // Run the given function inside the apostrophe-pages:parked lock, which
  // in the presence of workflow is the general purpose lock for major
  // overhauls of aposDocs. The function must take a callback.

  self.withLock = function(fn, callback) {
    return self.apos.locks.withLock('apostrophe-pages:parked', fn, callback);
  };

  self.addMissingLocalesTask = function(apos, argv, callback) {
    var req = self.apos.tasks.getReq();
    return self.withLock(fix, callback);
    function fix(callback) {
      self.apos.utils.info('add-missing-locales in progress');
      return async.series([
        fixIndexes,
        noLocales,
        replicateRelatedDocuments,
        missingSomeLocalesDraft,
        missingSomeLocalesLive,
        resolve
      ], function(err) {
        if (err) {
          return callback(err);
        }
        self.apos.utils.info('add-missing-locales completed');
        return callback(null);
      });
    }

    function fixIndexes(callback) {
      self.apos.utils.info('Fixing indexes...');
      var old;
      return async.series([
        getOld,
        // New indexes first, so we're not without a unique index if the site is up
        ensureNewSlug,
        ensureNewPath,
        dropOldSlug,
        dropOldPath
      ], callback);
      function getOld(callback) {
        return self.apos.docs.db.indexes(function(err, _old) {
          if (err) {
            return callback(err);
          }
          old = _old;
          return callback(null);
        });
      }
      function ensureNewSlug(callback) {
        return self.apos.docs.db.ensureIndex({ slug: 1, workflowLocale: 1 }, { unique: true }, callback);
      }
      function ensureNewPath(callback) {
        // workflowLocaleForPathIndex is identical to workflowLocale except that it exists only
        // when path exists, allowing the sparse unique index to work properly with pieces
        // as well as pages.
        return self.apos.docs.db.ensureIndex({ path: 1, workflowLocaleForPathIndex: 1 }, { unique: true, sparse: true }, callback);
      }
      function dropOldSlug(callback) {
        var existing = _.find(old, function(index) {
          return index.key && index.key.slug && (!index.key.workflowLocale);
        });
        if (!existing) {
          return callback(null);
        }
        return self.apos.docs.db.dropIndex(existing.name, callback);
      }
      function dropOldPath(callback) {
        var existing = _.find(old, function(index) {
          if (!index.unique) {
            return;
          }
          return index.key && index.key.path && (!index.key.workflowLocale) && (!index.key.workflowLocaleForPathIndex);
        });
        if (!existing) {
          return callback(null);
        }
        return self.apos.docs.db.dropIndex(existing.name, callback);
      }
    }

    function replicateRelatedDocuments(callback) {
      const replicateRelatedDocumentsTo = argv['replicate-related-documents'] ? argv['replicate-related-documents'].split(',') : [];
      return self.replicateRelatedDocuments(replicateRelatedDocumentsTo).then(function() {
        // Avoid unconsumed promise warning
        callback(null);
        return null;
      }).catch(callback);
    }

    function noLocales(callback) {
      self.apos.utils.info('Fixing documents with no locales...');
      return self.apos.migrations.eachDoc({ workflowLocale: { $exists: 0 } }, 5, function(doc, callback) {
        if (!self.includeType(doc.type)) {
          return setImmediate(callback);
        }
        doc.workflowLocale = self.defaultLocale;
        doc.workflowResolveDeferred = true;
        self.ensureWorkflowLocaleForPathIndex(doc);
        doc.workflowGuid = self.apos.utils.generateId();
        return self.apos.docs.update(req, doc, { workflowMissingLocalesLive: argv.live ? true : 'liveOnly' }, callback);
      }, callback);
    }

    function missingSomeLocalesDraft(callback) {
      self.apos.utils.info('Fixing documents missing some locales in draft...');
      return self.addMissingLocales(req, { workflowMissingLocalesSubset: 'draft' }, callback);

    }

    function missingSomeLocalesLive(callback) {
      self.apos.utils.info('Fixing documents missing some locales in live...');
      return self.addMissingLocales(req, { workflowMissingLocalesSubset: 'live' }, callback);

    }

    function resolve(callback) {
      self.apos.utils.info('Resolving deferred join relationships efficiently...');
      return self.resolveDeferredRelationships(callback);
    }

  };

  self.resolveJoinIdsTask = function(apos, argv, callback) {

    return async.series([
      update,
      resolve
    ], function(err) {
      return callback(err);
    });

    function update(callback) {
      return self.apos.docs.db.update({
        workflowLocale: { $exists: 1 }
      }, {
        $set: {
          workflowResolveDeferred: true
        }
      },
      {
        multi: true
      },
      callback);
    }

    function resolve(callback) {
      return self.resolveDeferredRelationships(callback);
    }

  };

  self.addLocalePrefixesTask = function(apos, argv, callback) {
    return self.updateLocalePrefixes(callback);
  };

  self.removeNumberedParkedPagesTask = function(apos, argv, callback) {
    return self.apos.docs.db.remove({
      parked: { $exists: 1 },
      slug: /^\/.*\d+$/
    }, callback);
  };

  self.harmonizeWorkflowGuidsByParkedIdTask = function(apos, argv, callback) {
    var pages;
    return async.series([ crossCorrectPass, find, update ], callback);

    // First pass: for some workflowGuids, only some of the locales
    // have a parkedId, due to various catch-22's. Give them all a
    // parkedId.
    function crossCorrectPass(callback) {
      return async.series([ find, correct ], callback);
      function find(callback) {
        return self.apos.docs.db.findWithProjection({ parkedId: { $exists: 1 } }).toArray(function(err, _pages) {
          if (err) {
            return callback(err);
          }
          pages = _pages;
          return callback(null);
        });
      }
      function correct(callback) {
        var parkedIdsByWorkflowGuid = {};
        _.each(pages, function(page) {
          parkedIdsByWorkflowGuid[page.workflowGuid] = page.parkedId;
        });
        return async.eachSeries(_.keys(parkedIdsByWorkflowGuid), function(workflowGuid, callback) {
          return self.apos.docs.db.update({
            workflowGuid: workflowGuid
          }, {
            $set: {
              parkedId: parkedIdsByWorkflowGuid[workflowGuid]
            }
          }, {
            multi: true
          }, callback);
        }, callback);
      }
    }
    // Second pass: for all of the parked ids, make sure the workflowGuids
    // are the same. Where they are not the same map to the most common one.
    function find(callback) {
      return self.apos.docs.db.findWithProjection({ parkedId: { $exists: 1 } }).toArray(function(err, _pages) {
        if (err) {
          return callback(err);
        }
        pages = _pages;
        return callback(null);
      });
    }
    function update(callback) {
      var parkedIds = _.uniq(_.map(pages, 'parkedId'));
      var updates = [];
      var losers = [];
      _.each(parkedIds, function(parkedId) {
        var relevant = _.filter(pages, { parkedId: parkedId });
        var byGuid = _.groupBy(relevant, 'workflowGuid');
        if (_.keys(byGuid).length <= 1) {
          return;
        }
        var guids = _.uniq(_.map(relevant, 'workflowGuid'));
        guids.sort(function(a, b) {
          if (byGuid[a].length < byGuid[b].length) {
            return 1;
          } else if (byGuid[a].length > byGuid[b].length) {
            // We want the most popular guid to be [0]
            return -1;
          } else {
            return 0;
          }
        });
        var winner = guids[0];
        self.apos.utils.warn('Multiple workflowGuids for parkedId ' + parkedId + ', correcting to ' + winner);
        // If a given locale already appears with this parkedId
        // for the winning parkedId, then we can't merge this one
        // in
        var winnerLocales = _.map(_.filter(pages, { workflowGuid: winner }), 'workflowLocale');
        losers = losers.concat(_.map(_.filter(pages, function(page) {
          return ((page.parkedId === parkedId) && (page.workflowGuid !== winner) && _.includes(winnerLocales, page.workflowLocale));
        }), '_id'));
        updates.push([
          {
            workflowGuid: {
              $in: guids.slice(1)
            },
            parkedId: parkedId
          }, {
            $set: {
              workflowGuid: winner
            }
          }
        ]);
      });
      return async.series([
        removeLosers, execUpdates
      ], callback);
      function removeLosers(callback) {
        if (!losers.length) {
          return callback(null);
        }
        self.apos.utils.warn('Can only keep one per locale/guid combination, removing: ', losers);
        return self.apos.docs.db.remove({ _id: { $in: losers } }, callback);
      }
      function execUpdates(callback) {
        return async.eachSeries(updates, function(update, callback) {
          return self.apos.docs.db.update(update[0], update[1], { multi: true }, callback);
        }, callback);
      }
    }
  };

  self.diffDraftAndLiveTask = function(apos, argv, callback) {
    var req;
    var draft;
    var modified;
    var diffDraft;
    var diffLive;
    if (!argv._[1]) {
      throw 'Specify the _id of a draft document as the sole argument after the task name.';
    }
    return async.series([
      determineLocale,
      isModified,
      diff
    ], callback);

    function determineLocale(callback) {
      return self.apos.docs.db.findOne({ _id: argv._[1] }, function(err, _draft) {
        if (err) {
          return callback(err);
        }
        if (!_draft) {
          return callback('not found');
        }
        draft = _draft;
        req = self.apos.tasks.getReq({ locale: draft.workflowLocale });
        return callback(null);
      });
    }

    function isModified(callback) {
      return self.isModified(req, draft, function(err, _modified, _diffDraft, _diffLive) {
        if (err) {
          return callback(err);
        }
        modified = _modified;
        diffDraft = _diffDraft;
        diffLive = _diffLive;
        return callback(null);
      });
    }

    function diff(callback) {
      if (!modified) {
        // eslint-disable-next-line no-console
        console.log('The draft and live documents are equivalent.');
        return callback(null);
      }
      // eslint-disable-next-line no-console
      console.log(jsonDiff(diffDraft, diffLive));
      return callback(null);
    }
  };

  self.dereplicateTask = function() {
    return self.apos.docs.db.aggregate([
      {
        $match: {
          workflowLocale: { $exists: 1 },
          trash: {
            $ne: true
          }
        }
      },
      {
        $group: {
          _id: "$workflowGuid",
          count: { $sum: 1 },
          workflowLocales: { $push: "$workflowLocale" }
        }
      },
      {
        $match: {
          count: {
            // Either it's valid in draft and trash in live for its original locale
            // or it's valid in both for its original locale. If it is trash in
            // every locale it doesn't fit the profile and we should leave it alone
            $gte: 1,
            $lte: 2
          }
        }
      }
    ]).toArray().then(function(orphans) {
      if (!orphans.length) {
        return;
      }
      var bulk = self.apos.docs.db.initializeUnorderedBulkOp();
      var count = 0;
      orphans.forEach(function(orphan) {
        var c = bulk.find({
          workflowGuid: orphan._id,
          workflowLocale: {
            $nin: [
              self.draftify(orphan.workflowLocales[0]),
              self.liveify(orphan.workflowLocales[0])
            ]
          }
        });
        c.remove();
        count++;
      });
      if (!count) {
        // bulk.execute will throw an error if there are no updates
        return;
      }
      return bulk.execute();
    });
  };

  self.removeTask = function(apos, argv) {
    var locale = argv.locale;
    if (!locale) {
      if (self.localized) {
        throw 'Since you have configured locales, you MUST specify --locale to choose\nthe content that will NOT be permanently deleted when running this task.';
      }
      locale = 'default';
    }
    if (!(argv.draft || argv.live)) {
      throw 'You MUST specify either --draft or --live to determine which content will\nbe kept. All other content will be PERMANENTLY DELETED.';
    }
    var keep = locale + (argv.draft ? '-draft' : '');
    return Promise.try(function() {
      console.log('Making sure the content you have chosen to keep exists...');
      return self.apos.docs.db.count({
        workflowLocale: keep
      });
    }).then(function(count) {
      if (!count) {
        throw 'There is no content with workflowLocale set to ' + keep + '.\nYou seem to have chosen a\nnonexistent locale. Exiting.';
      }
      console.log('Deleting content not chosen to keep...');
      return self.apos.docs.db.remove({
        $and: [
          {
            workflowLocale: {
              $exists: 1
            }
          },
          {
            workflowLocale: {
              $ne: keep
            }
          }
        ]
      });
    }).then(function() {
      console.log('Removing workflow properties from content kept...');
      return self.apos.docs.db.update({}, {
        $unset: {
          workflowLocale: 1,
          workflowGuid: 1,
          workflowModified: 1,
          workflowLocaleForPathIndex: 1,
          workflowMoved: 1,
          workflowMovedIsNew: 1
        }
      }, {
        multi: true
      });
    }).then(function() {
      console.log('Removing the commits collection...');
      return self.db.drop();
    }).then(function() {
      console.log('Removing the facts collection...');
      return self.facts.drop();
    }).then(function() {
      console.log('Completed.\n\nYOU MUST REMOVE apostrophe-workflow FROM app.js BEFORE\nYOU LAUNCH THE SITE OR RUN ANY MORE TASKS.\nOtherwise workflow will come back.');
      // mongo connection seems to get stuck open, maybe because we dropped
      // collections, so node will not exit on its own
      process.exit(0);
    });
  };

  self.addTask('recompute-modified', 'Recompute the workflowModified flag for every doc. Not needed unless you have\nperformed modifications directly with the MongoDB APIs, bypassing Apostrophe,\nand you need workflow to see those modifications as changes. In future, consider\nsetting workflowModified to true via your own code rather than relying on this\ntime-consuming task.', function(apos, argv) {
    return self.recomputeModified();
  });

  self.addTask('dereplicate', 'Dereplicate docs. Used when transitioning to the "replicateAcrossLocales: false"\noption, which should be turned on before running this task. This task looks for docs\nthat are in the trash in all but two locales (live and draft of the\nsame user-facing locale), and removes them from the locales where they\nare in the trash. THIS DELETES CONTENT FROM THE DATABASE.', function(apos, argv) {
    return self.dereplicateTask();
  });

  self.addTask('remove', 'Remove workflow. You MUST specify the locale to keep (unless you do not have locales configured) with --locale. You MUST specify whether to keep draft content (--draft) or live content (--live). Everything else is DELETED FOREVER.\n\nAfter running this task you MUST IMMEDIATELY REMOVE apostrophe-workflow\nfrom your app.js file, or it will just come back.', function(apos, argv) {
    self.removeTask(apos, argv);
  });

  self.replicateLocaleTask = async (apos, argv) => {

    const docAfterSave = require('util').promisify(self.docAfterSave);
    const replicate = function(req, doc) {
      return docAfterSave(req, doc, {
        workflowMissingLocalesLocales: [ to, self.draftify(to) ],
        workflowResolveDeferred: true,
        workflowMissingLocalesLive: true
      });
    };
    const resolveDeferredRelationships = require('util').promisify(self.resolveDeferredRelationships);

    const from = argv.from;
    const to = argv.to;
    if (!(from && to)) {
      throw 'You must pass the --from and --to options and specify a locale for each value.';
    }
    if (!self.locales[from]) {
      throw `${from} is not a locale name.`;
    }
    if (!self.locales[to]) {
      throw `${to} is not a locale name.`;
    }
    await self.apos.docs.db.remove({
      workflowLocale: {
        $in: [ to, self.draftify(to) ]
      }
    });
    const _ids = (await self.apos.docs.db.find({
      workflowLocale: from
    }, {
      _id: 1
    }).sort({ level: 1, rank: 1 }).toArray()).map(doc => doc._id);
    const req = self.apos.tasks.getReq();
    const meter = self.apos.migrations.progressStart({
      getTotal: function(callback) {
        return callback(null, _ids.length);
      }
    });
    for (const _id of _ids) {
      const doc = await self.apos.docs.db.findOne({ _id });
      await replicate(req, doc);
      meter.step();
    }
    meter.end();

    console.log('Resolving relationships...');
    await self.apos.docs.db.update({
      workflowLocale: {
        $in: [ to, self.draftify(to) ]
      }
    }, {
      $set: {
        workflowResolveDeferred: true
      }
    },
    {
      multi: true
    });

    await resolveDeferredRelationships();
    console.log('... Done.');
  };
};


text:
![2.9 stars](../../images/ic_star_black_18dp_1x.png)![2.9 stars](../../images/ic_star_black_18dp_1x.png)![2.9 stars](../../images/ic_star_half_black_18dp_1x.png)![2.9 stars](../../images/ic_star_border_black_18dp_1x.png)![2.9 stars](../../images/ic_star_border_black_18dp_1x.png) 6

To use the Today In History skill, try saying...

* *Alexa, ask Today In History what happened on this date in history.*

* *Alexa, ask Today In History what happened on this date*

* *Alexa, ask Today In History to generate a fact*

Use This Day In History to ask what happened today in history to get a brief description about a historical event that occurred on today's date.

***

### Skill Details

* **Invocation Name:** today in history
* **Category:** null
* **ID:** amzn1.echo-sdk-ams.app.38915e1b-4881-480b-86e0-777dfac6ee1e
* **ASIN:** B01DL5E2PE
* **Author:** Allen Kramer
* **Release Date:** April 7, 2016 @ 09:03:01
* **In-App Purchasing:** No


text:
package com.team254.frc2015.behavior;

import com.team254.frc2015.Constants;
import com.team254.frc2015.ElevatorSafety;
import com.team254.frc2015.HardwareAdaptor;
import com.team254.frc2015.behavior.routines.*;
import com.team254.frc2015.subsystems.*;
import com.team254.lib.util.StateHolder;
import com.team254.lib.util.Tappable;

import java.util.Optional;

public class BehaviorManager implements Tappable {

    public boolean isZero(double val) {
        return val == 0 || (val < 0.001 && val > -0.001);
    }

    protected Drive drive = HardwareAdaptor.kDrive;
    protected TopCarriage top_carriage = HardwareAdaptor.kTopCarriage;
    protected BottomCarriage bottom_carriage = HardwareAdaptor.kBottomCarriage;
    protected Intake intake = HardwareAdaptor.kIntake;
    protected AirPeacock airPeacock = HardwareAdaptor.kAirPeacock;
    protected MotorPeacock motorPeacock = HardwareAdaptor.kMotorPeacock;

    private boolean m_top_jogging = false;
    private boolean m_bottom_jogging = false;

    private Routine m_cur_routine = null;
    private RobotSetpoints m_setpoints;
    private ManualRoutine m_manual_routine = new ManualRoutine();

    private void setNewRoutine(Routine new_routine) {
        boolean needs_cancel = new_routine != m_cur_routine && m_cur_routine != null;

        boolean needs_reset = new_routine != m_cur_routine && new_routine != null;
        if (needs_cancel) {
            m_cur_routine.cancel();
        }
        m_cur_routine = new_routine;
        if (needs_reset) {
            m_cur_routine.reset();
        }
    }

    public void reset() {
        setNewRoutine(null);
    }

    public BehaviorManager() {
        m_setpoints = new RobotSetpoints();
        m_setpoints.reset();
    }

    public void update(Commands commands) {
        m_setpoints.reset();

        if (m_cur_routine != null && m_cur_routine.isFinished()) {
            setNewRoutine(null);
        }

        if (commands.cancel_current_routine) {
            setNewRoutine(null);
        } else if (commands.horizontal_can_grabber_request == Commands.HorizontalCanGrabberRequests.ACTIVATE && !(m_cur_routine instanceof HorizontalCanPickupRoutine)) {
            setNewRoutine(new HorizontalCanPickupRoutine());
        } else if (commands.vertical_can_grab_request == Commands.VerticalCanGrabberRequests.ACTIVATE && !(m_cur_routine instanceof VerticalCanPickupRoutine)) {
            setNewRoutine(new VerticalCanPickupRoutine());
        } else if (commands.floor_load_mode && !(m_cur_routine instanceof FloorLoadRoutine)) {
            setNewRoutine(new FloorLoadRoutine());
        } else if (!commands.floor_load_mode && m_cur_routine instanceof FloorLoadRoutine) {
            FloorLoadRoutine flr = (FloorLoadRoutine) m_cur_routine;
            if (!flr.isDoneWithSixStack()) {
                setNewRoutine(new AfterFloorClampRoutine());
            } else {
                setNewRoutine(null);
                m_setpoints.bottom_open_loop_jog = Optional.of(0.0);
            }
        } else if (commands.preset_request == Commands.PresetRequest.SCORE && !(m_cur_routine instanceof ScoreRoutine)) {
            setNewRoutine(new ScoreRoutine());
        } else if (commands.preset_request == Commands.PresetRequest.CARRY_SQUEZE) {
            setNewRoutine(new RegraspRoutine());
        } else if (commands.preset_request == Commands.PresetRequest.COOP) {
            setNewRoutine(new CoopRoutine());
        } else if ((m_cur_routine instanceof CoopRoutine) && commands.preset_request != Commands.PresetRequest.NONE && commands.preset_request != Commands.PresetRequest.COOP) {
            setNewRoutine(null);
        }

        if (m_cur_routine != null) {
            m_setpoints = m_cur_routine.update(commands, m_setpoints);
        }

        // Get manual m_setpoints
        m_setpoints = m_manual_routine.update(commands, m_setpoints);

        boolean can_close_intake = true;
        boolean can_control_top_carriage_pivot = true;
        boolean can_control_top_carriage_grabber = true;
        boolean can_control_bottom_carriage = true;
        boolean want_pusher_extend = m_setpoints.coop_pusher_action == RobotSetpoints.CoopPusherAction.EXTEND;

        double bottom_jog_speed = 0.0;
        double top_jog_speed = 0.0;
        // Set elevator m_setpoints and jog
        if (m_setpoints.bottom_open_loop_jog.isPresent()) {
            bottom_jog_speed = m_setpoints.bottom_open_loop_jog.get();
            m_bottom_jogging = true;
        } else if (m_setpoints.m_elevator_setpoints.bottom_setpoint.isPresent()) {
            bottom_carriage.setPositionSetpoint(m_setpoints.m_elevator_setpoints.bottom_setpoint.get(), true);
            m_bottom_jogging = false;
        } else if (m_bottom_jogging && !m_setpoints.bottom_open_loop_jog.isPresent()) {
            bottom_carriage.setOpenLoop(0, true);
            m_bottom_jogging = false;
        }

        if (m_setpoints.top_carriage_squeeze && !want_pusher_extend) {
            top_carriage.squeeze();
        } else {
            if (top_carriage.hasSquezeEnabled()) {
                top_carriage.setOpenLoop(0, true);
            }
        }

        if (m_setpoints.top_open_loop_jog.isPresent()) {
            top_jog_speed = m_setpoints.top_open_loop_jog.get();
            m_top_jogging = true;
        } else if (m_setpoints.m_elevator_setpoints.top_setpoint.isPresent()) {
            top_carriage.setPositionSetpoint(m_setpoints.m_elevator_setpoints.top_setpoint.get(), true);
            m_top_jogging = false;
        } else if (m_top_jogging && !m_setpoints.top_open_loop_jog.isPresent()) {
            top_carriage.setOpenLoop(0, true);
            m_top_jogging = false;
        }

        if (!want_pusher_extend) {
            if (m_bottom_jogging) {
                bottom_carriage.setOpenLoop(bottom_jog_speed, isZero(bottom_jog_speed));
            }

            if (m_top_jogging) {
                top_carriage.setOpenLoop(top_jog_speed, isZero(top_jog_speed));
                if (m_cur_routine instanceof RegraspRoutine) {
                    setNewRoutine(null);
                }
            }
        } else {
            bottom_carriage.setOpenLoop(0, true);
            top_carriage.setOpenLoop(0, true);
        }

        // Bail from scoring
        if (m_cur_routine instanceof ScoreRoutine && m_bottom_jogging) {
            setNewRoutine(null);
        }

        ElevatorSafety.Setpoints m_elevator_setpoints = ElevatorSafety.generateSafeSetpoints(m_setpoints.m_elevator_setpoints);
        if (m_elevator_setpoints.top_setpoint.isPresent() && !m_top_jogging && !m_bottom_jogging) {
            top_carriage.setPositionSetpoint(m_elevator_setpoints.top_setpoint.get(), true);
        }
        if (m_elevator_setpoints.bottom_setpoint.isPresent() && !m_bottom_jogging && !m_bottom_jogging) {
            bottom_carriage.setPositionSetpoint(m_elevator_setpoints.bottom_setpoint.get(), true);
        }

        // Top carriage actions.
        if (can_control_top_carriage_grabber
                && m_setpoints.claw_action == RobotSetpoints.TopCarriageClawAction.OPEN) {
            top_carriage.setGrabberPosition(TopCarriage.GrabberPositions.OPEN);
            can_control_top_carriage_pivot = false;
        } else if (can_control_top_carriage_grabber
                && m_setpoints.claw_action == RobotSetpoints.TopCarriageClawAction.CLOSE) {
            top_carriage.setGrabberPosition(TopCarriage.GrabberPositions.CLOSED);
        } else if (can_control_top_carriage_grabber
                && m_setpoints.claw_action == RobotSetpoints.TopCarriageClawAction.NEUTRAL) {
            top_carriage.setGrabberPosition(TopCarriage.GrabberPositions.VENTED);
        } else if (can_control_top_carriage_grabber
                && m_setpoints.claw_action == RobotSetpoints.TopCarriageClawAction.PREFER_CLOSE) {
            top_carriage.setGrabberPosition(TopCarriage.GrabberPositions.CLOSED);
        }

        if (can_control_top_carriage_pivot
                && m_setpoints.pivot_action == RobotSetpoints.TopCarriagePivotAction.PIVOT_DOWN) {
            top_carriage.setPivotDown(true);
        } else if (can_control_top_carriage_pivot
                && m_setpoints.pivot_action == RobotSetpoints.TopCarriagePivotAction.PIVOT_UP) {
            top_carriage.setPivotDown(false);
        }

        // Bottom carriage actions.
        if (can_control_bottom_carriage
                && m_setpoints.flapper_action == RobotSetpoints.BottomCarriageFlapperAction.OPEN) {
            bottom_carriage.setFlapperOpen(true);
        } else if (can_control_bottom_carriage
                && m_setpoints.flapper_action == RobotSetpoints.BottomCarriageFlapperAction.CLOSE) {
            bottom_carriage.setFlapperOpen(false);
        }

        // Intake actions.
        if (!can_close_intake || m_setpoints.intake_action == RobotSetpoints.IntakeAction.OPEN || m_setpoints.intake_action == RobotSetpoints.IntakeAction.PREFER_OPEN) {
            // Open intake
            intake.open();
        } else if (m_setpoints.intake_action == RobotSetpoints.IntakeAction.CLOSE || m_setpoints.intake_action == RobotSetpoints.IntakeAction.PREFER_CLOSE) {
            // Close intake
            intake.close();
        }

        // Roller actions.
        if (m_setpoints.roller_action == RobotSetpoints.RollerAction.INTAKE) {
            // Run intake inwards.
            intake.setSpeed(Constants.kManualIntakeSpeed);
        } else if (m_setpoints.roller_action == RobotSetpoints.RollerAction.EXHAUST) {
            // Run intake outwards.
            intake.setSpeed(-Constants.kManualExhaustSpeed);
        } else if (m_setpoints.roller_action == RobotSetpoints.RollerAction.EXHAUST_COOP) {
            // Run intake outwards.
            intake.setSpeed(-Constants.kCoopIntakeSpeed);
        } else if (m_setpoints.roller_action == RobotSetpoints.RollerAction.INTAKE_CAN) {
            // Run intake inwards.
            intake.setSpeed(Constants.kCanIntakeSpeed);
        } else if (m_setpoints.roller_action == RobotSetpoints.RollerAction.INTAKE_CAN_SLOW) {
            // Run intake inwards.
            intake.setSpeed(Constants.kCanIntakeSlowSpeed);
        } else {
            // Stop intake.
            intake.setSpeed(0.0);
        }

        // Motor peacock - use commands because this is only open loop
        // Down is positive pwm
        double leftPeacockSpeed = 0;
        if (commands.left_motor_peacock_requests == Commands.MotorPeacockRequests.MOVE_UP) {
            leftPeacockSpeed = -Constants.kPeacockUpManualPWM;
        } else if (commands.left_motor_peacock_requests == Commands.MotorPeacockRequests.MOVE_DOWN) {
            leftPeacockSpeed = Constants.kPeacockDownManualPWM;
        }

        double rightPeacockSpeed = 0;
        if (commands.right_motor_peacock_requests == Commands.MotorPeacockRequests.MOVE_UP) {
            rightPeacockSpeed = -Constants.kPeacockUpManualPWM;
        } else if (commands.right_motor_peacock_requests == Commands.MotorPeacockRequests.MOVE_DOWN) {
            rightPeacockSpeed = Constants.kPeacockDownManualPWM;
        }

        motorPeacock.setOpenLoop(leftPeacockSpeed, rightPeacockSpeed);

        // Pusher
        intake.setCoopPusherOut(m_setpoints.coop_pusher_action == RobotSetpoints.CoopPusherAction.EXTEND);

        // Pinball wizard
        intake.setPinballWizardOut(m_setpoints.pinball_wizard_action == RobotSetpoints.PinballWizardAction.EXTEND);

        // Peacock
        airPeacock.setDown(m_setpoints.deploy_peacock);
    }

    @Override
    public void getState(StateHolder states) {
        states.put("mode", m_cur_routine != null ? m_cur_routine.getName() : "---");
    }

    @Override
    public String getName() {
        return "behaviors";
    }
}


text:
function getStage() {
    return '${opt:stage, self:provider.stage}';
}

function getMongoDbConnectionString() {
    const stage = getStage();
    return `\${env:bizhub_api_mongodb_connectionstring_${stage}}`;
}

module.exports.stage = getStage;
module.exports.mongodb_connection_string = getMongoDbConnectionString;


text:
package mashup

import com.fasterxml.jackson.databind.{DeserializationFeature, ObjectMapper}
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule

object JsonUtil {

  val mapper = new ObjectMapper() with ScalaObjectMapper
  mapper.registerModule(DefaultScalaModule)
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)

  def toJson(value: Map[Symbol, Any]): String = {
    toJson(value map { case (k,v) => k.name -> v})
  }

  def toJson(value: Any): String = {
    mapper.writerWithDefaultPrettyPrinter.writeValueAsString(value)
  }

  def toMap[V](json:String)(implicit m: Manifest[V]) = fromJson[Map[String,V]](json)

  def fromJson[T](json: String)(implicit m : Manifest[T]): T = {
    mapper.readValue[T](json)
  }
}


text:
template <class T>
void test_is_trivially_destructible()
{
    static_assert( std::is_trivially_destructible<T>::value, "");
    static_assert( std::is_trivially_destructible<const T>::value, "");
    static_assert( std::is_trivially_destructible<volatile T>::value, "");
    static_assert( std::is_trivially_destructible<const volatile T>::value, "");
}

template <class T>
void test_is_not_trivially_destructible()
{
    static_assert(!std::is_trivially_destructible<T>::value, "");
    static_assert(!std::is_trivially_destructible<const T>::value, "");
    static_assert(!std::is_trivially_destructible<volatile T>::value, "");
    static_assert(!std::is_trivially_destructible<const volatile T>::value, "");
}

class Empty
{
};

class NotEmpty
{
    virtual ~NotEmpty();
};

union Union {};

struct bit_zero
{
    int :  0;
};

class Abstract
{
    virtual void foo() = 0;
};

class AbstractDestructor
{
    virtual ~AbstractDestructor() = 0;
};

struct A
{
    ~A();
};

int main()
{
    test_is_not_trivially_destructible<void>();
    test_is_not_trivially_destructible<A>();
    test_is_not_trivially_destructible<AbstractDestructor>();
    test_is_not_trivially_destructible<NotEmpty>();
    test_is_not_trivially_destructible<char[]>();

    test_is_trivially_destructible<Abstract>();
    test_is_trivially_destructible<int&>();
    test_is_trivially_destructible<Union>();
    test_is_trivially_destructible<Empty>();
    test_is_trivially_destructible<int>();
    test_is_trivially_destructible<double>();
    test_is_trivially_destructible<int*>();
    test_is_trivially_destructible<const int*>();
    test_is_trivially_destructible<char[3]>();
    test_is_trivially_destructible<bit_zero>();
}