<mods xmlns="http://www.loc.gov/mods/v3" xmlns:exslt="http://exslt.org/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd" version="3.3" ID="P0b002ee18155c301">
<name type="corporate">
 <namePart>United States Government Printing Office</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">printer</roleTerm>
  <roleTerm type="code" authority="marcrelator">prt</roleTerm>
</role>
 <role>
  <roleTerm type="text" authority="marcrelator">distributor</roleTerm>
  <roleTerm type="code" authority="marcrelator">dst</roleTerm>
</role>
</name>
<name type="corporate">
 <namePart>United States</namePart>
 <namePart>United States District Court Northern District of Ohio</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">author</roleTerm>
  <roleTerm type="code" authority="marcrelator">aut</roleTerm>
</role>
 <description>Government Organization</description>
</name>
<typeOfResource>text</typeOfResource>
<genre authority="marcgt">government publication</genre>
<language>
 <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</language>
<extension>
 <collectionCode>USCOURTS</collectionCode>
 <category>Judicial Publications</category>
 <branch>judicial</branch>
 <dateIngested>2011-12-30</dateIngested>
</extension>
<originInfo>
 <publisher>Administrative Office of the United States Courts</publisher>
 <dateIssued encoding="w3cdtf">2011-01-28</dateIssued>
 <issuance>monographic</issuance>
</originInfo>
<physicalDescription>
 <note type="source content type">deposited</note>
 <digitalOrigin>born digital</digitalOrigin>
</physicalDescription>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="uri">http://www.gpo.gov/fdsys/pkg/USCOURTS-ohnd-1_09-cv-02027</identifier>
<identifier type="local">P0b002ee18155c301</identifier>
<recordInfo>
 <recordContentSource authority="marcorg">DGPO</recordContentSource>
 <recordCreationDate encoding="w3cdtf">2011-12-30</recordCreationDate>
 <recordChangeDate encoding="w3cdtf">2011-12-30</recordChangeDate>
 <recordIdentifier source="DGPO">USCOURTS-ohnd-1_09-cv-02027</recordIdentifier>
 <recordOrigin>machine generated</recordOrigin>
 <languageOfCataloging>
  <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</languageOfCataloging>
</recordInfo>
<accessCondition type="GPO scope determination">fdlp</accessCondition>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-ohnd-1_09-cv-02027</accessId>
 <courtType>District</courtType>
 <courtCode>ohnd</courtCode>
 <courtCircuit>6th</courtCircuit>
 <courtState>Ohio</courtState>
 <courtSortOrder>2392</courtSortOrder>
 <caseNumber>1:09-cv-02027</caseNumber>
 <caseOffice>Cleveland</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>710</natureSuitCode>
 <natureSuit>Fair Labor Standards Act</natureSuit>
 <cause>29:201 Fair Labor Standards Act</cause>
 <party firstName="Kelly" fullName="Kelly L. Frisby" lastName="Frisby" middleName="L." role="Counter-Defendant"></party>
 <party firstName="Kelly" fullName="Kelly L. Frisby" lastName="Frisby" middleName="L." role="Plaintiff"></party>
 <party fullName="Keith D. Weiner&Associates Co., L.P.A." lastName="Keith D. Weiner&Associates Co., L.P.A." role="Counter-Claimant"></party>
 <party fullName="Keith D. Weiner&Associates Co., L.P.A." lastName="Keith D. Weiner&Associates Co., L.P.A." role="Defendant"></party>
 <party firstName="Kathi" fullName="Kathi Van Horn" lastName="Van Horn" role="Defendant"></party>
 <party firstName="Keith" fullName="Keith D Weiner" lastName="Weiner" middleName="D" role="Defendant"></party>
</extension>
<titleInfo>
 <title>Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al</title>
 <partNumber>1:09-cv-02027</partNumber>
</titleInfo>
<location>
 <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/pkg/USCOURTS-ohnd-1_09-cv-02027/content-detail.html</url>
</location>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="preferred citation">1:09-cv-02027;09-2027</identifier>
<name type="corporate">
 <namePart>United States District Court Northern District of Ohio</namePart>
 <namePart>6th Circuit</namePart>
 <namePart>Cleveland</namePart>
 <affiliation>U.S. Courts</affiliation>
 <role>
  <roleTerm authority="marcrelator" type="text">author</roleTerm>
  <roleTerm authority="marcrelator" type="code">aut</roleTerm>
</role>
</name>
<name type="personal">
 <displayForm>Kelly L. Frisby</displayForm>
 <namePart type="family">Frisby</namePart>
 <namePart type="given">Kelly</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Counter-Defendant</description>
</name>
<name type="personal">
 <displayForm>Kelly L. Frisby</displayForm>
 <namePart type="family">Frisby</namePart>
 <namePart type="given">Kelly</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Plaintiff</description>
</name>
<name type="personal">
 <displayForm>Keith D. Weiner&Associates Co., L.P.A.</displayForm>
 <namePart type="family">Keith D. Weiner&Associates Co., L.P.A.</namePart>
 <namePart type="given"></namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Counter-Claimant</description>
</name>
<name type="personal">
 <displayForm>Keith D. Weiner&Associates Co., L.P.A.</displayForm>
 <namePart type="family">Keith D. Weiner&Associates Co., L.P.A.</namePart>
 <namePart type="given"></namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Defendant</description>
</name>
<name type="personal">
 <displayForm>Kathi Van Horn</displayForm>
 <namePart type="family">Van Horn</namePart>
 <namePart type="given">Kathi</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Defendant</description>
</name>
<name type="personal">
 <displayForm>Keith D Weiner</displayForm>
 <namePart type="family">Weiner</namePart>
 <namePart type="given">Keith</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Defendant</description>
</name>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-ohnd-1_09-cv-02027</accessId>
 <courtType>District</courtType>
 <courtCode>ohnd</courtCode>
 <courtCircuit>6th</courtCircuit>
 <courtState>Ohio</courtState>
 <courtSortOrder>2392</courtSortOrder>
 <caseNumber>1:09-cv-02027</caseNumber>
 <caseOffice>Cleveland</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>710</natureSuitCode>
 <natureSuit>Fair Labor Standards Act</natureSuit>
 <cause>29:201 Fair Labor Standards Act</cause>
 <party firstName="Kelly" fullName="Kelly L. Frisby" lastName="Frisby" middleName="L." role="Counter-Defendant"></party>
 <party firstName="Kelly" fullName="Kelly L. Frisby" lastName="Frisby" middleName="L." role="Plaintiff"></party>
 <party fullName="Keith D. Weiner&Associates Co., L.P.A." lastName="Keith D. Weiner&Associates Co., L.P.A." role="Counter-Claimant"></party>
 <party fullName="Keith D. Weiner&Associates Co., L.P.A." lastName="Keith D. Weiner&Associates Co., L.P.A." role="Defendant"></party>
 <party firstName="Kathi" fullName="Kathi Van Horn" lastName="Van Horn" role="Defendant"></party>
 <party firstName="Keith" fullName="Keith D Weiner" lastName="Weiner" middleName="D" role="Defendant"></party>
 <state>Ohio</state>
</extension>
<relatedItem type="constituent" ID="id-USCOURTS-ohnd-1_09-cv-02027-0" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-0/mods.xml">
 <titleInfo>
  <title>Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al</title>
  <subTitle>Opinion and Order signed by Judge James S. Gwin on 11/17/09. The Court denies the defendants' motion to strike and grants in part and denies in part defendants' motion to dismiss Counts III and IV. Further, the Court denies plaintiff's motion to dismiss. (Related Docs. 5, 6) (M,G)</subTitle>
  <partNumber>0</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2009-11-17</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-ohnd-1_09-cv-02027-0.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee181602304</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-0</identifier>
 <identifier type="former granule identifier">ohnd-1_09-cv-02027_0.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-0/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-ohnd-1_09-cv-02027/pdf/USCOURTS-ohnd-1_09-cv-02027-0.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:09-cv-02027; Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al; </searchTitle>
  <courtName>United States District Court Northern District of Ohio</courtName>
  <state>Ohio</state>
  <accessId>USCOURTS-ohnd-1_09-cv-02027-0</accessId>
  <sequenceNumber>0</sequenceNumber>
  <dateIssued>2009-11-17</dateIssued>
  <docketText>Opinion and Order signed by Judge James S. Gwin on 11/17/09. The Court denies the defendants' motion to strike and grants in part and denies in part defendants' motion to dismiss Counts III and IV. Further, the Court denies plaintiff's motion to dismiss. (Related Docs. 5, 6) (M,G)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-ohnd-1_09-cv-02027-1" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-1/mods.xml">
 <titleInfo>
  <title>Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al</title>
  <subTitle>Opinion and Order signed by Judge James S. Gwin on 4/21/10. The Court, as set forth in this entry, grants in part and denies in part defendants' motion for summary judgment. Defendants' motion for leave to file sur-rebuttal to address new arguments raised in plaintiffs' surreply is termed as moot. (Related Docs. 35, 60) (M,G)</subTitle>
  <partNumber>1</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2010-04-21</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-ohnd-1_09-cv-02027-1.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee181602305</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-1</identifier>
 <identifier type="former granule identifier">ohnd-1_09-cv-02027_1.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-1/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-ohnd-1_09-cv-02027/pdf/USCOURTS-ohnd-1_09-cv-02027-1.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:09-cv-02027; Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al; </searchTitle>
  <courtName>United States District Court Northern District of Ohio</courtName>
  <state>Ohio</state>
  <accessId>USCOURTS-ohnd-1_09-cv-02027-1</accessId>
  <sequenceNumber>1</sequenceNumber>
  <dateIssued>2010-04-21</dateIssued>
  <docketText>Opinion and Order signed by Judge James S. Gwin on 4/21/10. The Court, as set forth in this entry, grants in part and denies in part defendants' motion for summary judgment. Defendants' motion for leave to file sur-rebuttal to address new arguments raised in plaintiffs' surreply is termed as moot. (Related Docs. 35, 60) (M,G)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-ohnd-1_09-cv-02027-2" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-2/mods.xml">
 <titleInfo>
  <title>Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al</title>
  <subTitle>Report and Recommendation that Plaintiff's 76 Motion for award for attorney fees be denied as moot. Signed by Magistrate Judge Greg White on 1/24/2011. (Related document 88) (S,S)</subTitle>
  <partNumber>2</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2011-01-24</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-ohnd-1_09-cv-02027-2.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee181602303</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-2</identifier>
 <identifier type="former granule identifier">ohnd-1_09-cv-02027_2.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-2/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-ohnd-1_09-cv-02027/pdf/USCOURTS-ohnd-1_09-cv-02027-2.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:09-cv-02027; Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al; </searchTitle>
  <courtName>United States District Court Northern District of Ohio</courtName>
  <state>Ohio</state>
  <accessId>USCOURTS-ohnd-1_09-cv-02027-2</accessId>
  <sequenceNumber>2</sequenceNumber>
  <dateIssued>2011-01-24</dateIssued>
  <docketText>Report and Recommendation that Plaintiff's 76 Motion for award for attorney fees be denied as moot. Signed by Magistrate Judge Greg White on 1/24/2011. (Related document 88) (S,S)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-ohnd-1_09-cv-02027-3" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-3/mods.xml">
 <titleInfo>
  <title>Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al</title>
  <subTitle>Opinion&Order Adopting Report and Recommendation of Magistrate Judge and denying as moot plaintiff's motion for attorney fees. (Related Docs. 76, 89) (M,G) Modified text on 1/31/2011 (B,B).</subTitle>
  <partNumber>3</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2011-01-28</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-ohnd-1_09-cv-02027-3.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee181602302</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-3</identifier>
 <identifier type="former granule identifier">ohnd-1_09-cv-02027_3.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-ohnd-1_09-cv-02027/USCOURTS-ohnd-1_09-cv-02027-3/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-ohnd-1_09-cv-02027/pdf/USCOURTS-ohnd-1_09-cv-02027-3.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 1:09-cv-02027; Frisby v. Keith D. Weiner&Associates Co., L.P.A. et al; </searchTitle>
  <courtName>United States District Court Northern District of Ohio</courtName>
  <state>Ohio</state>
  <accessId>USCOURTS-ohnd-1_09-cv-02027-3</accessId>
  <sequenceNumber>3</sequenceNumber>
  <dateIssued>2011-01-28</dateIssued>
  <docketText>Opinion&Order Adopting Report and Recommendation of Magistrate Judge and denying as moot plaintiff's motion for attorney fees. (Related Docs. 76, 89) (M,G) Modified text on 1/31/2011 (B,B).</docketText>
</extension>
</relatedItem>
</mods>


import os, sys

root = os.path.dirname(__file__)
if not root in sys.path:
    sys.path.append(root)

# HOUDINI
def showHoudini(clear=False, ontop=False, name=None, floating=False, position=(), size=(),
                pane=None, replacePyPanel=False, hideTitleMenu=True):
    """
    This method use hqt module. Download it before
    """
    from .managers import _houdini
    reload(_houdini)
    _houdini.show(clear=clear, ontop=ontop, name=name, floating=floating, position=position,
                  size=size, pane=pane, replacePyPanel=replacePyPanel, hideTitleMenu=hideTitleMenu)

# NUKE
def showNuke(panel=False):
    from .managers import _nuke
    reload(_nuke)
    _nuke.show(panel)

# MAYA
def showMaya(dock=False):
    from .managers import _maya
    reload (_maya)
    _maya.show(dock)

# 3DSMAX PLUS
def show3DSMax():
    sys.argv = []
    from .managers import _3dsmax
    reload (_3dsmax)
    _3dsmax.show()


//! moment.js locale configuration
//! locale : Bahasa Indonesia (id)
//! author : Mohammad Satrio Utomo : https://github.com/tyok
//! reference: http://id.wikisource.org/wiki/Pedoman_Umum_Ejaan_Bahasa_Indonesia_yang_Disempurnakan

(function (global, factory) {
   typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
   typeof define === 'function' && define.amd ? define(['moment'], factory) :
   factory(global.moment)
}(this, function (moment) { 'use strict';

    var id = moment.defineLocale('id', {
        months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'),
        monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des'.split('_'),
        weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'),
        weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'),
        weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'),
        longDateFormat : {
            LT : 'HH.mm',
            LTS : 'HH.mm.ss',
            L : 'DD/MM/YYYY',
            LL : 'D MMMM YYYY',
            LLL : 'D MMMM YYYY [pukul] HH.mm',
            LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
        },
        meridiemParse: /pagi|siang|sore|malam/,
        meridiemHour : function (hour, meridiem) {
            if (hour === 12) {
                hour = 0;
            }
            if (meridiem === 'pagi') {
                return hour;
            } else if (meridiem === 'siang') {
                return hour >= 11 ? hour : hour + 12;
            } else if (meridiem === 'sore' || meridiem === 'malam') {
                return hour + 12;
            }
        },
        meridiem : function (hours, minutes, isLower) {
            if (hours < 11) {
                return 'pagi';
            } else if (hours < 15) {
                return 'siang';
            } else if (hours < 19) {
                return 'sore';
            } else {
                return 'malam';
            }
        },
        calendar : {
            sameDay : '[Hari ini pukul] LT',
            nextDay : '[Besok pukul] LT',
            nextWeek : 'dddd [pukul] LT',
            lastDay : '[Kemarin pukul] LT',
            lastWeek : 'dddd [lalu pukul] LT',
            sameElse : 'L'
        },
        relativeTime : {
            future : 'dalam %s',
            past : '%s yang lalu',
            s : 'beberapa detik',
            m : 'semenit',
            mm : '%d menit',
            h : 'sejam',
            hh : '%d jam',
            d : 'sehari',
            dd : '%d hari',
            M : 'sebulan',
            MM : '%d bulan',
            y : 'setahun',
            yy : '%d tahun'
        },
        week : {
            dow : 1, // Monday is the first day of the week.
            doy : 7  // The week that contains Jan 1st is the first week of the year.
        }
    });

    return id;

}));


using System;
using System.Threading.Tasks;
using JetBrains.Annotations;
using ReactiveUI;
using Restaurant.Abstractions;
using Restaurant.Abstractions.Facades;
using Restaurant.Abstractions.Factories;
using Restaurant.Abstractions.Services;

namespace Restaurant.Core.Services
{
    [UsedImplicitly]
    public class NavigationService : INavigationService
    {
        private readonly INavigationFacade _navigationFacade;
        private readonly IPlatformFacade _platformFacade;
        private readonly IViewFactory _viewFactory;
        private readonly ILoggingService _loggingService;
        private readonly IViewModelFactory _viewModelFactory;

        public NavigationService(
            ILoggingService loggingService,
            IViewModelFactory viewModelFactory,
            IViewFactory viewFactory,
            INavigationFacade navigationFacade,
            IPlatformFacade platformFacade)
        {
            _loggingService = loggingService;
            _viewModelFactory = viewModelFactory;
            _viewFactory = viewFactory;
            _navigationFacade = navigationFacade;
            _platformFacade = platformFacade;
        }

        public IViewFor CurrentView { get; private set; }

        public Task NavigateAsync(INavigatableViewModel viewModel)
        {
            CurrentView = _viewFactory.ResolveView(viewModel);

            _loggingService.Info($"Navigating to page: {CurrentView}");

            return _navigationFacade.PushAsync(CurrentView);
        }

        public Task NavigateAsync(Type viewModelType)
        {
            var vm = _viewModelFactory.GetViewModel(viewModelType);
            CurrentView = _viewFactory.ResolveView(vm);

            _loggingService.Info($"Navigating to page: {CurrentView}");

            return _navigationFacade.PushAsync(CurrentView);
        }

        public Task NavigateModalAsync(INavigatableViewModel viewModel)
        {
            CurrentView = _viewFactory.ResolveView(viewModel);

            _loggingService.Info($"Opened Modal page: {CurrentView}");

            return _navigationFacade.PushModalAsync(CurrentView);
        }

        public Task NavigateModalAsync(Type viewModelType)
        {
            var vm = _viewModelFactory.GetViewModel(viewModelType);
            CurrentView = _viewFactory.ResolveView(vm);

            _loggingService.Info($"Opened Modal page: {CurrentView}");

            return _navigationFacade.PushModalAsync(CurrentView);
        }

        public Task CloseModalAsync(bool animated)
        {
            _loggingService.Info($"Closed Modal LastModal page: {CurrentView}");

            return _navigationFacade.PopModalAsync(animated);
        }

        public Task NavigateToMainPage(INavigatableViewModel viewModel)
        {
            CurrentView = _viewFactory.ResolveView(viewModel);

            _loggingService.Info($"Navigating to MainPage: {CurrentView}");

            return _navigationFacade.NavigateToMainPage(CurrentView);
        }

        public Task NavigateToMainPage(Type viewModelType)
        {
            var vm = _viewModelFactory.GetMainViewModel(viewModelType, _platformFacade.RuntimePlatform);
            CurrentView = _viewFactory.ResolveView(vm);

            _loggingService.Info($"Navigating to MainPage: {CurrentView}");

            return _navigationFacade.NavigateToMainPage(CurrentView);
        }

        public Task NavigateToMainPageContent(INavigatableViewModel viewModel)
        {
            CurrentView = _viewFactory.ResolveView(viewModel);

            _loggingService.Info($"Changing to MainPage Content: {CurrentView}");

            return _navigationFacade.NavigateToMainPageContent(CurrentView);
        }

        public Task NavigateToRoot()
        {
            _loggingService.Info("Navigating to Root page");

            return _navigationFacade.NavigateToRoot();
        }
    }
}


/*
 * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
 * Copyright 2017 BaishanCloud. All rights reserved.
 *
 * Licensed under the OpenSSL license (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include <openssl/bn.h>
#include <openssl/err.h>
#include "rsa_locl.h"

void rsa_multip_info_free_ex(RSA_PRIME_INFO *pinfo)
{
    /* free pp and pinfo only */
    BN_clear_free(pinfo->pp);
    OPENSSL_free(pinfo);
}

void rsa_multip_info_free(RSA_PRIME_INFO *pinfo)
{
    /* free a RSA_PRIME_INFO structure */
    BN_clear_free(pinfo->r);
    BN_clear_free(pinfo->d);
    BN_clear_free(pinfo->t);
    rsa_multip_info_free_ex(pinfo);
}

RSA_PRIME_INFO *rsa_multip_info_new(void)
{
    RSA_PRIME_INFO *pinfo;

    /* create a RSA_PRIME_INFO structure */
    if ((pinfo = OPENSSL_zalloc(sizeof(RSA_PRIME_INFO))) == NULL) {
        RSAerr(RSA_F_RSA_MULTIP_INFO_NEW, ERR_R_MALLOC_FAILURE);
        return NULL;
    }
    if ((pinfo->r = BN_secure_new()) == NULL)
        goto err;
    if ((pinfo->d = BN_secure_new()) == NULL)
        goto err;
    if ((pinfo->t = BN_secure_new()) == NULL)
        goto err;
    if ((pinfo->pp = BN_secure_new()) == NULL)
        goto err;

    return pinfo;

 err:
    BN_free(pinfo->r);
    BN_free(pinfo->d);
    BN_free(pinfo->t);
    BN_free(pinfo->pp);
    OPENSSL_free(pinfo);
    return NULL;
}

/* Refill products of primes */
int rsa_multip_calc_product(RSA *rsa)
{
    RSA_PRIME_INFO *pinfo;
    BIGNUM *p1 = NULL, *p2 = NULL;
    BN_CTX *ctx = NULL;
    int i, rv = 0, ex_primes;

    if ((ex_primes = sk_RSA_PRIME_INFO_num(rsa->prime_infos)) <= 0) {
        /* invalid */
        goto err;
    }

    if ((ctx = BN_CTX_new()) == NULL)
        goto err;

    /* calculate pinfo->pp = p * q for first 'extra' prime */
    p1 = rsa->p;
    p2 = rsa->q;

    for (i = 0; i < ex_primes; i++) {
        pinfo = sk_RSA_PRIME_INFO_value(rsa->prime_infos, i);
        if (pinfo->pp == NULL) {
            pinfo->pp = BN_secure_new();
            if (pinfo->pp == NULL)
                goto err;
        }
        if (!BN_mul(pinfo->pp, p1, p2, ctx))
            goto err;
        /* save previous one */
        p1 = pinfo->pp;
        p2 = pinfo->r;
    }

    rv = 1;
 err:
    BN_CTX_free(ctx);
    return rv;
}

int rsa_multip_cap(int bits)
{
    int cap = 5;

    if (bits < 1024)
        cap = 2;
    else if (bits < 4096)
        cap = 3;
    else if (bits < 8192)
        cap = 4;

    if (cap > RSA_MAX_PRIME_NUM)
        cap = RSA_MAX_PRIME_NUM;

    return cap;
}


//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <vector>

// Call front() on empty container.

#if _LIBCPP_DEBUG >= 1

#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))

#include <vector>
#include <cassert>
#include <iterator>
#include <exception>
#include <cstdlib>

#include "test_macros.h"
#include "min_allocator.h"

int main()
{
    {
    typedef int T;
    typedef std::vector<T> C;
    C c(1);
    assert(c.front() == 0);
    c.clear();
    assert(c.front() == 0);
    assert(false);
    }
#if TEST_STD_VER >= 11
    {
    typedef int T;
    typedef std::vector<T, min_allocator<T>> C;
    C c(1);
    assert(c.front() == 0);
    c.clear();
    assert(c.front() == 0);
    assert(false);
    }
#endif
}

#else

int main()
{
}

#endif


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

package doc

import (
	"bytes"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"sort"
	"strconv"
	"strings"
	"time"

	"github.com/cpuguy83/go-md2man/v2/md2man"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
)

// GenManTree will generate a man page for this command and all descendants
// in the directory given. The header may be nil. This function may not work
// correctly if your command names have `-` in them. If you have `cmd` with two
// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`
// it is undefined which help output will be in the file `cmd-sub-third.1`.
func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error {
	return GenManTreeFromOpts(cmd, GenManTreeOptions{
		Header:           header,
		Path:             dir,
		CommandSeparator: "-",
	})
}

// GenManTreeFromOpts generates a man page for the command and all descendants.
// The pages are written to the opts.Path directory.
func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error {
	header := opts.Header
	if header == nil {
		header = &GenManHeader{}
	}
	for _, c := range cmd.Commands() {
		if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
			continue
		}
		if err := GenManTreeFromOpts(c, opts); err != nil {
			return err
		}
	}
	section := "1"
	if header.Section != "" {
		section = header.Section
	}

	separator := "_"
	if opts.CommandSeparator != "" {
		separator = opts.CommandSeparator
	}
	basename := strings.Replace(cmd.CommandPath(), " ", separator, -1)
	filename := filepath.Join(opts.Path, basename+"."+section)
	f, err := os.Create(filename)
	if err != nil {
		return err
	}
	defer f.Close()

	headerCopy := *header
	return GenMan(cmd, &headerCopy, f)
}

// GenManTreeOptions is the options for generating the man pages.
// Used only in GenManTreeFromOpts.
type GenManTreeOptions struct {
	Header           *GenManHeader
	Path             string
	CommandSeparator string
}

// GenManHeader is a lot like the .TH header at the start of man pages. These
// include the title, section, date, source, and manual. We will use the
// current time if Date is unset and will use "Auto generated by spf13/cobra"
// if the Source is unset.
type GenManHeader struct {
	Title   string
	Section string
	Date    *time.Time
	date    string
	Source  string
	Manual  string
}

// GenMan will generate a man page for the given command and write it to
// w. The header argument may be nil, however obviously w may not.
func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
	if header == nil {
		header = &GenManHeader{}
	}
	if err := fillHeader(header, cmd.CommandPath()); err != nil {
		return err
	}

	b := genMan(cmd, header)
	_, err := w.Write(md2man.Render(b))
	return err
}

func fillHeader(header *GenManHeader, name string) error {
	if header.Title == "" {
		header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1))
	}
	if header.Section == "" {
		header.Section = "1"
	}
	if header.Date == nil {
		now := time.Now()
		if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" {
			unixEpoch, err := strconv.ParseInt(epoch, 10, 64)
			if err != nil {
				return fmt.Errorf("invalid SOURCE_DATE_EPOCH: %v", err)
			}
			now = time.Unix(unixEpoch, 0)
		}
		header.Date = &now
	}
	header.date = (*header.Date).Format("Jan 2006")
	if header.Source == "" {
		header.Source = "Auto generated by spf13/cobra"
	}
	return nil
}

func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) {
	description := cmd.Long
	if len(description) == 0 {
		description = cmd.Short
	}

	buf.WriteString(fmt.Sprintf(`%% %s(%s)%s
%% %s
%% %s
# NAME
`, header.Title, header.Section, header.date, header.Source, header.Manual))
	buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short))
	buf.WriteString("# SYNOPSIS\n")
	buf.WriteString(fmt.Sprintf("**%s**\n\n", cmd.UseLine()))
	buf.WriteString("# DESCRIPTION\n")
	buf.WriteString(description + "\n\n")
}

func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) {
	flags.VisitAll(func(flag *pflag.Flag) {
		if len(flag.Deprecated) > 0 || flag.Hidden {
			return
		}
		format := ""
		if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 {
			format = fmt.Sprintf("**-%s**, **--%s**", flag.Shorthand, flag.Name)
		} else {
			format = fmt.Sprintf("**--%s**", flag.Name)
		}
		if len(flag.NoOptDefVal) > 0 {
			format += "["
		}
		if flag.Value.Type() == "string" {
			// put quotes on the value
			format += "=%q"
		} else {
			format += "=%s"
		}
		if len(flag.NoOptDefVal) > 0 {
			format += "]"
		}
		format += "\n\t%s\n\n"
		buf.WriteString(fmt.Sprintf(format, flag.DefValue, flag.Usage))
	})
}

func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) {
	flags := command.NonInheritedFlags()
	if flags.HasAvailableFlags() {
		buf.WriteString("# OPTIONS\n")
		manPrintFlags(buf, flags)
		buf.WriteString("\n")
	}
	flags = command.InheritedFlags()
	if flags.HasAvailableFlags() {
		buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n")
		manPrintFlags(buf, flags)
		buf.WriteString("\n")
	}
}

func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
	cmd.InitDefaultHelpCmd()
	cmd.InitDefaultHelpFlag()

	// something like `rootcmd-subcmd1-subcmd2`
	dashCommandName := strings.Replace(cmd.CommandPath(), " ", "-", -1)

	buf := new(bytes.Buffer)

	manPreamble(buf, header, cmd, dashCommandName)
	manPrintOptions(buf, cmd)
	if len(cmd.Example) > 0 {
		buf.WriteString("# EXAMPLE\n")
		buf.WriteString(fmt.Sprintf("```\n%s\n```\n", cmd.Example))
	}
	if hasSeeAlso(cmd) {
		buf.WriteString("# SEE ALSO\n")
		seealsos := make([]string, 0)
		if cmd.HasParent() {
			parentPath := cmd.Parent().CommandPath()
			dashParentPath := strings.Replace(parentPath, " ", "-", -1)
			seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section)
			seealsos = append(seealsos, seealso)
			cmd.VisitParents(func(c *cobra.Command) {
				if c.DisableAutoGenTag {
					cmd.DisableAutoGenTag = c.DisableAutoGenTag
				}
			})
		}
		children := cmd.Commands()
		sort.Sort(byName(children))
		for _, c := range children {
			if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
				continue
			}
			seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section)
			seealsos = append(seealsos, seealso)
		}
		buf.WriteString(strings.Join(seealsos, ", ") + "\n")
	}
	if !cmd.DisableAutoGenTag {
		buf.WriteString(fmt.Sprintf("# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006")))
	}
	return buf.Bytes()
}


<!DOCTYPE html>
getLocale()) }}">

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>DummyModuleName</title>

        <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">

                    DummyModuleName

                    @if (Lang::has('DummyModuleName::example.welcome'))
                        {{ trans('DummyModuleName::example.welcome') }}
                    @else
                        Welcome, this is DummyModuleName module.
                    @endif


using System.Collections;
using System.Collections.Generic;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Playables;
using UnityMMO;
using UnityMMO.Component;

public class SpeedControlBehaviour : PlayableBehaviour
{
    public float SpeedFactor=1.0f;
    public Entity SpeedOwner;
    public EntityManager EntityMgr;

    public override void OnBehaviourPlay(Playable playable, FrameData info)
    {
        if (!EntityMgr.HasComponent<SpeedData>(SpeedOwner))
            return;
        var lastSpeed = EntityMgr.GetComponentObject<SpeedData>(SpeedOwner);
        lastSpeed.ChangeSpeed("SpeedCtrlTL", true, SpeedFactor);
    }

    public override void OnBehaviourPause(Playable playable, FrameData info)
    {
        if (!EntityMgr.HasComponent<SpeedData>(SpeedOwner))
            return;
        var lastSpeed = EntityMgr.GetComponentObject<SpeedData>(SpeedOwner);
        lastSpeed.ChangeSpeed("SpeedCtrlTL", false, SpeedFactor);
    }
}


米穀等の取引等に係る情報の記録及び産地情報の伝達に関する法律施行令第七条第四項の規定に基づく都道府県知事の報告に関する省令
（平成二十一年十一月五日農林水産省令第六十一号）
　米穀等の取引等に係る情報の記録及び産地情報の伝達に関する法律施行令
（平成二十一年政令第二百六十一号）第七条第四項
の規定に基づき、米穀等の取引等に係る情報の記録及び産地情報の伝達に関する法律施行令第七条第四項の規定に基づく都道府県知事の報告に関する省令を次のように定める。

　米穀等の取引等に係る情報の記録及び産地情報の伝達に関する法律施行令第七条第四項
の規定による報告（法第四条、第八条又は第九条の規定の施行に関するものを除く。）は、遅滞なく、次に掲げる事項を記載した書面を提出してしなければならない。
一

　報告を求め、又は立入検査を行った米穀事業者又は米穀等の運送業者若しくは倉庫業者の氏名又は名称及び住所

二

　報告を求め、又は立入検査を行った年月日

三

　報告の徴収又は立入検査に係る米穀等の種類

四

　報告の徴収又は立入検査の結果

五

　その他参考となるべき事項

　　　附　則

　この省令は、米穀等の取引等に係る情報の記録及び産地情報の伝達に関する法律（平成二十一年法律第二十六号）の施行の日（平成二十二年十月一日）から施行する。


Wo3vLwyeU/H3XXhTZZ4qIO6ysiqv3mQZoFirT290a/QPwMO3gPJERS2j6/HF2Cze
okGJlyAO+C5Ern4/pEqCZu4cjrDItdTPWunxmg==


include ../../../../inc/common.mk

gtfToGenePred = ${DESTBINDIR}/gtfToGenePred
genePredCheck = ${DESTBINDIR}/genePredCheck

all:

test: basic srcPre dups impliedStop ensembl geneNameAsName2 splitStop \
	ignoreGroupWithoutExons ensemblSplicedStop

# basic conversion
basic: mkdirs
	${gtfToGenePred} -infoOut=output/$@.info input/basic.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp
	diff expected/$@.info output/$@.info

# source prefix filtering
srcPre: mkdirs
	${gtfToGenePred} -infoOut=output/$@.info -sourcePrefix=mgc2 -sourcePrefix=mgc3 input/basic.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp
	diff expected/$@.info output/$@.info

# error reporting
dups: mkdirs
	if ${gtfToGenePred} -allErrors input/dups.gtf output/$@.gp >output/$@.out 2>&1 ; then false ; else true ; fi
	diff expected/$@.out output/$@.out
	diff expected/$@.gp output/$@.gp

impliedStop: mkdirs
	${gtfToGenePred} -impliedStopAfterCds -infoOut=output/$@.info input/flybase.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp
	diff expected/$@.info output/$@.info

# protein id
ensembl: mkdirs
	${gtfToGenePred} -genePredExt -infoOut=output/$@.info input/ensembl.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp
	diff expected/$@.info output/$@.info

# -geneNameAsName2
geneNameAsName2: mkdirs
	${gtfToGenePred} -genePredExt -geneNameAsName2 input/ensembl.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp

# split stop coding, produced bogus frame
splitStop: mkdirs
	${gtfToGenePred} -genePredExt input/splitStop.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp

ignoreGroupWithoutExons: mkdirs
	${gtfToGenePred} -genePredExt -ignoreGroupsWithoutExons input/geneFeature.gtf output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp

# this caused assert in assigning exon frame
ensemblSplicedStop: mkdirs
	${gtfToGenePred} -genePredExt input/ensemblSplicedStop.gp output/$@.gp
	${genePredCheck} -verbose=0 output/$@.gp
	diff expected/$@.gp output/$@.gp

mkdirs:
	mkdir -p output

clean:
	rm -rf output


using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class TargetMovement : MonoBehaviour {

	public float m_Speed = 0.5f;
	private float lateral_speed;

	public float wait_time_lon = 3f;
	public float wait_time_lat = 7f;

	private Rigidbody m_Rigidbody;

	// Longitudinal Variable
	private float max_speed = 0.8f;
	private float min_speed = 0.4f;

	// Lateral Variable
	private bool Is_right_lane_change = false;
	private bool Is_left_lane_change = false;
	private float start_y = 0;

	private float sum_time_lon = 0f;
	private float sum_time_lat = 0f;

	private float mode_lon = 0;
	private int mode_lat = 0;

	private float lane1_x = -18;
	private float lane2_x = -11;
	private float lane3_x = -4;
	private float lane4_x = 3;
	private float lane5_x = 10;

	private int current_lane = 3;

	// 0: Do nothing
	// Mode_lon => 1: speed up, 2: speed down
	// Mode_lat => 1: right change, 2: left change

	// Use this for initialization
	private void Start()
	{
		m_Rigidbody = GetComponent<Rigidbody> (); // At start, define rigidbody
		m_Speed = Random.Range(0.4f, 0.6f); // Initial speed
	}

	// Update is called once per frame
	private void FixedUpdate()
	{
		lateral_speed = m_Speed * 0.25f;

        float random_slider_val = GameObject.FindGameObjectWithTag("RandomSlider").GetComponent<Slider>().value;
        wait_time_lon = 8f - random_slider_val;
        wait_time_lat = 8f - random_slider_val;

        sum_time_lon += Time.deltaTime;
		sum_time_lat += Time.deltaTime;

		if (sum_time_lon > wait_time_lon)
		{
			mode_lon = Random.Range (0, 1f);
			sum_time_lon = 0;
		}

		if (sum_time_lat > wait_time_lat) {
			mode_lat = Random.Range (0, 3);
			sum_time_lat = 0;
		}

		bool Left_warning = false;
		bool Right_warning = false;
		float forward_dist = 0f;
		float forward_vel = 0f;
		bool Forward_warning = false;

		Left_warning = this.gameObject.GetComponent<TargetController> ().Left_warning;
		Right_warning= this.gameObject.GetComponent<TargetController> ().Right_warning;
		forward_dist = this.gameObject.GetComponent<TargetController> ().forward_distance;
		forward_vel = this.gameObject.GetComponent<TargetController> ().forward_velocity;

		// Forward distance controller
		float forward_threshold = 5f + (m_Speed / 3f);
		float k_p = 0.001f;
		float k_i = 0.001f;

		// AEB like motion
		if (forward_dist < 6f) {
			k_p = 0.5f;
		}

		float accel_prob = 0.75f;

		if ((forward_dist < forward_threshold) && (forward_dist != 0)) {
			Forward_warning = true;
		}

		////////////////////// Longitudinal Move //////////////////////
		if (Forward_warning == false) {
			if (mode_lon < accel_prob && mode_lon > 0 && m_Speed < max_speed) {
				m_Speed += 0.05f;
				mode_lon = 0;
			}

			if (mode_lon > accel_prob && m_Speed > min_speed) {
				m_Speed -= 0.05f;
				mode_lon = 0;
			}
		} else {
			m_Speed -= (k_p * (m_Speed - forward_vel) + k_i * (m_Speed - forward_vel) / Time.deltaTime);
			mode_lon = 0;
		}

		VerticalMove();

		if (m_Speed > max_speed) {
			m_Speed = max_speed;
		}

		if (m_Speed < min_speed) {
			m_Speed = min_speed;
		}

		////////////////////// Lateral Move //////////////////////

		if (m_Rigidbody.position.x < (lane1_x + lane2_x) / 2) {
			current_lane = 1;
		} else if (m_Rigidbody.position.x < (lane2_x + lane3_x) / 2) {
			current_lane = 2;
		} else if (m_Rigidbody.position.x < (lane3_x + lane4_x) / 2) {
			current_lane = 3;
		} else if (m_Rigidbody.position.x < (lane4_x + lane5_x) / 2) {
			current_lane = 4;
		} else {
			current_lane = 5;
		}

		// Right Change
		if (mode_lat == 1 && Is_right_lane_change == false && current_lane != 5 && Right_warning == false)
		{
			Is_right_lane_change = true;
			start_y = m_Rigidbody.position.x;
		}

		if (Is_right_lane_change == true)
		{
			Vector3 movement = transform.right * lateral_speed;
			m_Rigidbody.MovePosition (m_Rigidbody.position + movement);
			if (Abs(m_Rigidbody.position.x - start_y) >= 7)
			{
				Is_right_lane_change = false;
				mode_lat = 0;
			}
		}

		// Left Change
		if (mode_lat == 2 && Is_left_lane_change == false && current_lane != 1 && Left_warning == false)
		{
			Is_left_lane_change = true;
			start_y = m_Rigidbody.position.x;
		}

		if (Is_left_lane_change == true)
		{
			Vector3 movement = transform.right * lateral_speed;
			m_Rigidbody.MovePosition (m_Rigidbody.position - movement);
			if (Abs(start_y - m_Rigidbody.position.x) >= 7)
			{
				Is_left_lane_change = false;
				mode_lat = 0;
			}
		}

		// Move to center lane if it is not changing the lane
		float current_lane_x = 0;
		if (Is_left_lane_change == false && Is_right_lane_change == false) {
			if (current_lane == 1) {
				current_lane_x = lane1_x;
			}
			if (current_lane == 2) {
				current_lane_x = lane2_x;
			}
			if (current_lane == 3) {
				current_lane_x = lane3_x;
			}
			if (current_lane == 4) {
				current_lane_x = lane4_x;
			}
			if (current_lane == 5) {
				current_lane_x = lane5_x;
			}

//			float lateral_diff = 0.1f * (m_Rigidbody.position.x - current_lane_x);
//			Vector3 movement = transform.right * lateral_diff;
//			m_Rigidbody.MovePosition (m_Rigidbody.position + movement);

			Vector3 pos_vehicle = new Vector3 (current_lane_x, m_Rigidbody.position.y, m_Rigidbody.position.z);

			this.transform.position = pos_vehicle;
		}

	}

	private void VerticalMove()
	{
		Vector3 movement = transform.forward * m_Speed;
		m_Rigidbody.MovePosition (m_Rigidbody.position + movement);
	}

	// Abs function to make input as absolute value
	private float Abs(float val)
	{
		if (val < 0)
		{
			return -val;
		}
		else
		{
			return val;
		}
	}
}


// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix solaris

// This code implements the filelock API using POSIX 'fcntl' locks, which attach
// to an (inode, process) pair rather than a file descriptor. To avoid unlocking
// files prematurely when the same file is opened through different descriptors,
// we allow only one read-lock at a time.
//
// Most platforms provide some alternative API, such as an 'flock' system call
// or an F_OFD_SETLK command for 'fcntl', that allows for better concurrency and
// does not require per-inode bookkeeping in the application.
//
// TODO(golang.org/issue/35618): add a syscall.Flock binding for Illumos and
// switch it over to use filelock_unix.go.

package filelock

import (
	"errors"
	"io"
	"math/rand"
	"os"
	"sync"
	"syscall"
	"time"
)

type lockType int16

const (
	readLock  lockType = syscall.F_RDLCK
	writeLock lockType = syscall.F_WRLCK
)

type inode = uint64 // type of syscall.Stat_t.Ino

type inodeLock struct {
	owner File
	queue []<-chan File
}

type token struct{}

var (
	mu     sync.Mutex
	inodes = map[File]inode{}
	locks  = map[inode]inodeLock{}
)

func lock(f File, lt lockType) (err error) {
	// POSIX locks apply per inode and process, and the lock for an inode is
	// released when *any* descriptor for that inode is closed. So we need to
	// synchronize access to each inode internally, and must serialize lock and
	// unlock calls that refer to the same inode through different descriptors.
	fi, err := f.Stat()
	if err != nil {
		return err
	}
	ino := fi.Sys().(*syscall.Stat_t).Ino

	mu.Lock()
	if i, dup := inodes[f]; dup && i != ino {
		mu.Unlock()
		return &os.PathError{
			Op:   lt.String(),
			Path: f.Name(),
			Err:  errors.New("inode for file changed since last Lock or RLock"),
		}
	}
	inodes[f] = ino

	var wait chan File
	l := locks[ino]
	if l.owner == f {
		// This file already owns the lock, but the call may change its lock type.
	} else if l.owner == nil {
		// No owner: it's ours now.
		l.owner = f
	} else {
		// Already owned: add a channel to wait on.
		wait = make(chan File)
		l.queue = append(l.queue, wait)
	}
	locks[ino] = l
	mu.Unlock()

	if wait != nil {
		wait <- f
	}

	// Spurious EDEADLK errors arise on platforms that compute deadlock graphs at
	// the process, rather than thread, level. Consider processes P and Q, with
	// threads P.1, P.2, and Q.3. The following trace is NOT a deadlock, but will be
	// reported as a deadlock on systems that consider only process granularity:
	//
	// 	P.1 locks file A.
	// 	Q.3 locks file B.
	// 	Q.3 blocks on file A.
	// 	P.2 blocks on file B. (This is erroneously reported as a deadlock.)
	// 	P.1 unlocks file A.
	// 	Q.3 unblocks and locks file A.
	// 	Q.3 unlocks files A and B.
	// 	P.2 unblocks and locks file B.
	// 	P.2 unlocks file B.
	//
	// These spurious errors were observed in practice on AIX and Solaris in
	// cmd/go: see https://golang.org/issue/32817.
	//
	// We work around this bug by treating EDEADLK as always spurious. If there
	// really is a lock-ordering bug between the interacting processes, it will
	// become a livelock instead, but that's not appreciably worse than if we had
	// a proper flock implementation (which generally does not even attempt to
	// diagnose deadlocks).
	//
	// In the above example, that changes the trace to:
	//
	// 	P.1 locks file A.
	// 	Q.3 locks file B.
	// 	Q.3 blocks on file A.
	// 	P.2 spuriously fails to lock file B and goes to sleep.
	// 	P.1 unlocks file A.
	// 	Q.3 unblocks and locks file A.
	// 	Q.3 unlocks files A and B.
	// 	P.2 wakes up and locks file B.
	// 	P.2 unlocks file B.
	//
	// We know that the retry loop will not introduce a *spurious* livelock
	// because, according to the POSIX specification, EDEADLK is only to be
	// returned when “the lock is blocked by a lock from another process”.
	// If that process is blocked on some lock that we are holding, then the
	// resulting livelock is due to a real deadlock (and would manifest as such
	// when using, for example, the flock implementation of this package).
	// If the other process is *not* blocked on some other lock that we are
	// holding, then it will eventually release the requested lock.

	nextSleep := 1 * time.Millisecond
	const maxSleep = 500 * time.Millisecond
	for {
		err = setlkw(f.Fd(), lt)
		if err != syscall.EDEADLK {
			break
		}
		time.Sleep(nextSleep)

		nextSleep += nextSleep
		if nextSleep > maxSleep {
			nextSleep = maxSleep
		}
		// Apply 10% jitter to avoid synchronizing collisions when we finally unblock.
		nextSleep += time.Duration((0.1*rand.Float64() - 0.05) * float64(nextSleep))
	}

	if err != nil {
		unlock(f)
		return &os.PathError{
			Op:   lt.String(),
			Path: f.Name(),
			Err:  err,
		}
	}

	return nil
}

func unlock(f File) error {
	var owner File

	mu.Lock()
	ino, ok := inodes[f]
	if ok {
		owner = locks[ino].owner
	}
	mu.Unlock()

	if owner != f {
		panic("unlock called on a file that is not locked")
	}

	err := setlkw(f.Fd(), syscall.F_UNLCK)

	mu.Lock()
	l := locks[ino]
	if len(l.queue) == 0 {
		// No waiters: remove the map entry.
		delete(locks, ino)
	} else {
		// The first waiter is sending us their file now.
		// Receive it and update the queue.
		l.owner = <-l.queue[0]
		l.queue = l.queue[1:]
		locks[ino] = l
	}
	delete(inodes, f)
	mu.Unlock()

	return err
}

// setlkw calls FcntlFlock with F_SETLKW for the entire file indicated by fd.
func setlkw(fd uintptr, lt lockType) error {
	for {
		err := syscall.FcntlFlock(fd, syscall.F_SETLKW, &syscall.Flock_t{
			Type:   int16(lt),
			Whence: io.SeekStart,
			Start:  0,
			Len:    0, // All bytes.
		})
		if err != syscall.EINTR {
			return err
		}
	}
}

func isNotSupported(err error) bool {
	return err == syscall.ENOSYS || err == syscall.ENOTSUP || err == syscall.EOPNOTSUPP || err == ErrNotSupported
}


#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<stack>

#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define LET(x, a)  __typeof(a) x(a)
#define foreach(it, v) for(LET(it, v.begin()); it != v.end(); it++)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define __ freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

#define tr(x) cout<<x<<endl;
#define tr2(x,y) cout<<x<<" "<<y<<endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(w,x,y,z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;

using namespace std;

int n, k, nt q[101], s[101], p[2][101], cpy[101], x[101], y[101];

bool fwd(){
	int indx = 0;
	for(int i = 1; i <= k; i++){
		indx = 1-indx;
		for(int j = 1; j <= n; j++) p[indx][j] = p[1-indx][q[j]];

		bool ok = true;
		for(int j = 1; j <= n; j++)
			if(p[indx][j] != s[j]) ok = false;

		if(ok and (k-i)%2 == 0) return ok;
	}
	return false;
}

bool rev(){
	for(int i = 1; i <= n; i++) p[0][i] = cpy[i];

	int indx = 0;
	for(int i = 1; i <= k; i++){
		indx = 1-indx;
		for(int j = 1; j <= n; j++) p[indx][q[j]] = p[1-indx][j];

		bool ok = true;
		for(int j = 1; j <= n; j++)
			if(p[indx][j] != s[j]) ok = false;

		if(ok and (k-i)%2 == 0) return ok;
	}
	return false;
}

int main(){
	sd2(n,k);

	for(int i = 1; i <= n; i++) sd(q[i]);
	for(int i = 1; i <= n; i++) sd(s[i]);
	for(int i = 1; i <= n; i++) cpy[i] = p[0][i] = i;

	bool ok = false;

	for(int i = 1; i <= n; i++){
		if(p[0][i] != s[i]) ok = true;
	}

	if(!ok){
		puts("NO"); return 0;
	}

	for(int i = 1; i <= n; i++) x[i] = p[0][q[i]], y[q[i]] = p[0][i];

	ok = false;
	for(int i = 1; i <= n; i++)
		if(!(x[i] == y[i] and y[i] == s[i])) ok = true;

	if(!ok and k == 1){
		puts("YES"); return 0;
	}
	else if(!ok){
		puts("NO"); return 0;
	}

	if(fwd() or rev()){
		puts("YES"); return 0;
	}

	puts("NO");

	return 0;
}


#pragma once
#include <deque>
#include <pthread.h>
#include <functional>      // for std::function, std::bind

// 使用C++03/C++0x 语言规范实现的线程池： 基于对象做法，每一个job都是一个function对象
namespace zl
{
    class ThreadPool
    {
    public:
        typedef std::function<void()> Task;

    public:
        ThreadPool(int threadNum = 10);
        ~ThreadPool();

    public:
        size_t addTask(const Task& task);
        void   stop();
        int    size();
        Task take();

    private:
        int createThreads();
        static void* threadFunc(void * threadData);

    private:
        ThreadPool& operator=(const ThreadPool&);
        ThreadPool(const ThreadPool&);

    private:
        volatile  bool              isRunning_;
        int                         threadsNum_;
        pthread_t*                  threads_;

        std::deque<Task>            taskQueue_;
        pthread_mutex_t             mutex_;
        pthread_cond_t              condition_;
    };
}


package com.github.parker8283.bon2.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;

public class IOUtils {

    public static byte[] readStreamFully(InputStream is) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(Math.max(8192, is.available()));
        byte[] buffer = new byte[8192];
        int read;
        while((read = is.read(buffer)) >= 0) {
            baos.write(buffer, 0, read);
        }
        return baos.toByteArray();
    }

    public static ClassNode readClassFromBytes(byte[] bytes) {
        ClassNode classNode = new ClassNode();
        ClassReader classReader = new ClassReader(bytes);
        classReader.accept(classNode, 0);
        return classNode;
    }

    public static byte[] writeClassToBytes(ClassNode classNode) {
        ClassWriter classWriter = new ClassWriter(0);
        classNode.accept(classWriter);
        return classWriter.toByteArray();
    }

    public static int getSecondToLastIndexOf(String string, char character) {
        String temp = string.substring(0, string.lastIndexOf(character));
        return temp.lastIndexOf(character);
    }
}


/**
  ******************************************************************************
  * @file    system_stm32f0xx.c
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    23-March-2012
  * @brief   CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
  *          This file contains the system clock configuration for STM32F0xx devices,
  *          and is customized for use with STM32F0-DISCOVERY Kit.
  *          The STM32F0xx is configured to run at 48 MHz, following the three
  *          configuration below:
  *            - PLL_SOURCE_HSI (default): HSI (~8MHz) used to clock the PLL, and
  *                                        the PLL is used as system clock source.
  *            - PLL_SOURCE_HSE          : HSE (8MHz) used to clock the PLL, and
  *                                        the PLL is used as system clock source.
  *            - PLL_SOURCE_HSE_BYPASS   : HSE bypassed with an external clock
  *                                        (8MHz, coming from ST-Link) used to clock
  *                                        the PLL, and the PLL is used as system
  *                                        clock source.
  *
  *
  * 1.  This file provides two functions and one global variable to be called from
  *     user application:
  *      - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
  *                      and Divider factors, AHB/APBx prescalers and Flash settings),
  *                      depending on the configuration selected (see above).
  *                      This function is called at startup just after reset and
  *                      before branch to main program. This call is made inside
  *                      the "startup_stm32f0xx.s" file.
  *
  *      - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
  *                                  by the user application to setup the SysTick
  *                                  timer or configure other parameters.
  *
  *      - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
  *                                 be called whenever the core clock is changed
  *                                 during program execution.
  *
  * 2. After each device reset the HSI (8 MHz Range) is used as system clock source.
  *    Then SystemInit() function is called, in "startup_stm32f0xx.s" file, to
  *    configure the system clock before to branch to main program.
  *
  * 3. If the system clock source selected by user fails to startup, the SystemInit()
  *    function will do nothing and HSI still used as system clock source. User can
  *    add some code to deal with this issue inside the SetSysClock() function.
  *
  * 4. The default value of HSE crystal is set to 8MHz, refer to "HSE_VALUE" define
  *    in "stm32f0xx.h" file. When HSE is used as system clock source, directly or
  *    through PLL, and you are using different crystal you have to adapt the HSE
  *    value to your own configuration.
  *
  ******************************************************************************
  * @attention
  *
  *
© COPYRIGHT 2012 STMicroelectronics

  *
  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  * You may not use this file except in compliance with the License.
  * You may obtain a copy of the License at:
  *
  *        http://www.st.com/software_license_agreement_liberty_v2
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
  ******************************************************************************
  */

/** @addtogroup CMSIS
  * @{
  */

/** @addtogroup stm32f0xx_system
  * @{
  */

/** @addtogroup STM32F0xx_System_Private_Includes
  * @{
  */

#include "config/stdperiph.h"

/**
  * @}
  */

/** @addtogroup STM32F0xx_System_Private_TypesDefinitions
  * @{
  */

/**
  * @}
  */

/** @addtogroup STM32F0xx_System_Private_Defines
  * @{
  */
/* Select the PLL clock source */

#define PLL_SOURCE_HSI        // HSI (~8MHz) used to clock the PLL, and the PLL is used as system clock source
//#define PLL_SOURCE_HSE        // HSE (8MHz) used to clock the PLL, and the PLL is used as system clock source
//#define PLL_SOURCE_HSE_BYPASS // HSE bypassed with an external clock (8MHz, coming from ST-Link) used to clock
                              // the PLL, and the PLL is used as system clock source

/**
  * @}
  */

/** @addtogroup STM32F0xx_System_Private_Macros
  * @{
  */

/**
  * @}
  */

/** @addtogroup STM32F0xx_System_Private_Variables
  * @{
  */
uint32_t SystemCoreClock    = 48000000;
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};

/**
  * @}
  */

/** @addtogroup STM32F0xx_System_Private_FunctionPrototypes
  * @{
  */

static void SetSysClock(void);

/**
  * @}
  */

/** @addtogroup STM32F0xx_System_Private_Functions
  * @{
  */

/**
  * @brief  Setup the microcontroller system.
  *         Initialize the Embedded Flash Interface, the PLL and update the
  *         SystemCoreClock variable.
  * @param  None
  * @retval None
  */
void SystemInit (void)
{
  /* Set HSION bit */
  RCC->CR |= (uint32_t)0x00000001;

  /* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
  RCC->CFGR &= (uint32_t)0xF8FFB80C;

  /* Reset HSEON, CSSON and PLLON bits */
  RCC->CR &= (uint32_t)0xFEF6FFFF;

  /* Reset HSEBYP bit */
  RCC->CR &= (uint32_t)0xFFFBFFFF;

  /* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
  RCC->CFGR &= (uint32_t)0xFFC0FFFF;

  /* Reset PREDIV1[3:0] bits */
  RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;

  /* Reset USARTSW[1:0], I2CSW, CECSW and ADCSW bits */
  RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;

  /* Reset HSI14 bit */
  RCC->CR2 &= (uint32_t)0xFFFFFFFE;

  /* Disable all interrupts */
  RCC->CIR = 0x00000000;

  /* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
  SetSysClock();
}

/**
  * @brief  Update SystemCoreClock according to Clock Register Values
  *         The SystemCoreClock variable contains the core clock (HCLK), it can
  *         be used by the user application to setup the SysTick timer or configure
  *         other parameters.
  *
  * @note   Each time the core clock (HCLK) changes, this function must be called
  *         to update SystemCoreClock variable value. Otherwise, any configuration
  *         based on this variable will be incorrect.
  *
  * @note   - The system frequency computed by this function is not the real
  *           frequency in the chip. It is calculated based on the predefined
  *           constant and the selected clock source:
  *
  *           - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
  *
  *           - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
  *
  *           - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
  *             or HSI_VALUE(*) multiplied/divided by the PLL factors.
  *
  *         (*) HSI_VALUE is a constant defined in stm32f0xx.h file (default value
  *             8 MHz) but the real value may vary depending on the variations
  *             in voltage and temperature.
  *
  *         (**) HSE_VALUE is a constant defined in stm32f0xx.h file (default value
  *              8 MHz), user has to ensure that HSE_VALUE is same as the real
  *              frequency of the crystal used. Otherwise, this function may
  *              have wrong result.
  *
  *         - The result of this function could be not correct when using fractional
  *           value for HSE crystal.
  * @param  None
  * @retval None
  */
void SystemCoreClockUpdate (void)
{
  uint32_t tmp = 0, pllmull = 0, pllsource = 0, prediv1factor = 0;

  /* Get SYSCLK source -------------------------------------------------------*/
  tmp = RCC->CFGR & RCC_CFGR_SWS;

  switch (tmp)
  {
    case 0x00:  /* HSI used as system clock */
      SystemCoreClock = HSI_VALUE;
      break;
    case 0x04:  /* HSE used as system clock */
      SystemCoreClock = HSE_VALUE;
      break;
    case 0x08:  /* PLL used as system clock */
      /* Get PLL clock source and multiplication factor ----------------------*/
      pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
      pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
      pllmull = ( pllmull >> 18) + 2;

      if (pllsource == 0x00)
      {
        /* HSI oscillator clock divided by 2 selected as PLL clock entry */
        SystemCoreClock = (HSI_VALUE >> 1) * pllmull;
      }
      else
      {
        prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1;
        /* HSE oscillator clock selected as PREDIV1 clock entry */
        SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
      }
      break;
    default: /* HSI used as system clock */
      SystemCoreClock = HSI_VALUE;
      break;
  }
  /* Compute HCLK clock frequency ----------------*/
  /* Get HCLK prescaler */
  tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
  /* HCLK clock frequency */
  SystemCoreClock >>= tmp;
}

/**
  * @brief  Configures the System clock frequency, AHB/APBx prescalers and Flash
  *         settings.
  * @note   This function should be called only once the RCC clock configuration
  *         is reset to the default reset state (done in SystemInit() function).
  * @param  None
  * @retval None
  */
static void SetSysClock(void)
{
  /* SYSCLK, HCLK, PCLK configuration ----------------------------------------*/
#if defined (PLL_SOURCE_HSI)

  /* At this stage the HSI is already enabled */

  /* Enable Prefetch Buffer and set Flash Latency */
  FLASH->ACR = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY;

  /* HCLK = SYSCLK */
  RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;

  /* PCLK = HCLK */
  RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE_DIV1;

  /* PLL configuration = (HSI/2) * 12 = ~48 MHz */
  RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
  RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_HSI_Div2 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL12);

  /* Enable PLL */
  RCC->CR |= RCC_CR_PLLON;

  /* Wait till PLL is ready */
  while((RCC->CR & RCC_CR_PLLRDY) == 0)
  {
  }

  /* Select PLL as system clock source */
  RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
  RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;

  /* Wait till PLL is used as system clock source */
  while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)
  {
  }
#else

  __IO uint32_t StartUpCounter = 0, HSEStatus = 0;

 #if defined (PLL_SOURCE_HSE)
  /* Enable HSE */
  RCC->CR |= ((uint32_t)RCC_CR_HSEON);
 #elif defined (PLL_SOURCE_HSE_BYPASS)
  /* HSE oscillator bypassed with external clock */
  RCC->CR |= (uint32_t)(RCC_CR_HSEON | RCC_CR_HSEBYP);
 #endif /* PLL_SOURCE_HSE */

  /* Wait till HSE is ready and if Time out is reached exit */
  do
  {
    HSEStatus = RCC->CR & RCC_CR_HSERDY;
    StartUpCounter++;
  } while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));

  if ((RCC->CR & RCC_CR_HSERDY) != RESET)
  {
    HSEStatus = (uint32_t)0x01;
  }
  else
  {
    HSEStatus = (uint32_t)0x00;
  }

  if (HSEStatus == (uint32_t)0x01)
  {
    /* Enable Prefetch Buffer and set Flash Latency */
    FLASH->ACR = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY;

    /* HCLK = SYSCLK */
    RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;

    /* PCLK = HCLK */
    RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE_DIV1;

    /* PLL configuration = HSE * 6 = 48 MHz */
    RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
    RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL6);

    /* Enable PLL */
    RCC->CR |= RCC_CR_PLLON;

    /* Wait till PLL is ready */
    while((RCC->CR & RCC_CR_PLLRDY) == 0)
    {
    }

    /* Select PLL as system clock source */
    RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
    RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;

    /* Wait till PLL is used as system clock source */
    while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)
    {
    }
  }
  else
  { /* If HSE fails to start-up, the application will have wrong clock
         configuration. User can add here some code to deal with this error */
  }
#endif /* PLL_SOURCE_HSI */
}

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


//
// File: shell.h
// 2016 - Created by Fred Nora.
//

//Setup current compiler
#include "compiler.h"

#include <sys/ioctl.h>
#include <sys/ioctls.h>

#include <types.h>
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <sys/socket.h>

#include <netinet/if_ether.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>

//shell stuff
#include "globals.h"
#include "builtins.h"
#include <api.h>

//# bash 1.05 stuff #
#include "variables.h"
#include "general.h"
#include "flags.h"
#include "alias.h"
#include "ndir.h"
#include "version.h"

#include <sys/wait.h>
//...

#include "tests.h"

//#define SHELL_VERBOSE 1

struct window_d *taskbarWindow;
struct window_d *menu_button;
struct window_d *app1_button;
struct window_d *app2_button;
struct window_d *app3_button;
struct window_d *app4_button;
struct window_d *editboxWindow;
struct window_d *reboot_button;
struct window_d *close_button;

/* Values that can be returned by execute_command (). */
#define EXECUTION_FAILURE 1
#define EXECUTION_SUCCESS 0

/* The list of characters that are quoted in double-quotes with a
   backslash.  Other characters following a backslash cause nothing
   special to happen. */
#define slashify_in_quotes "\\`\"$"

/*
 # generic list #

 All structs which contain a `next' field should have that field
as the first field in the struct.  This means that functions
can be written to handle the general case for linked lists.
*/

typedef struct g_list_d g_list;
typedef struct g_list_d GENERIC_LIST;
typedef struct g_list_d g_list_t;
struct g_list_d
{
    struct g_list_d *next;
};

/* Instructions describing what kind of thing to do for a redirection. */
typedef enum r_instruction_t r_instruction;
typedef enum {
    r_output_direction,
	r_input_direction,
	r_inputa_direction,
	r_appending_to,
	r_reading_until,
	r_duplicating,
	r_deblank_reading_until,
	r_close_this,
	r_err_and_out
}r_instruction_t;

/* Command Types: */
typedef enum command_type_t command_type;
typedef enum {
    cm_for,
	cm_case,
	cm_while,
	cm_if,
	cm_simple,
	cm_connection,
	cm_function_def,
	cm_until,
	cm_group
}command_type_t;

/* A structure which represents a word. */

typedef struct word_desc_d word_desc;
typedef struct word_desc_d WORD_DESC;
typedef struct word_desc_d word_desc_t;
struct word_desc_d
{
  char *word;			/* Zero terminated string. */
  int dollar_present;		/* Non-zero means dollar sign present. */
  int quoted;			/* Non-zero means single, double, or back quote
				   or backslash is present. */
  int assignment;		/* Non-zero means that this word contains an assignment. */
};

/* A linked list of words. */
typedef struct word_list_d word_list;
typedef struct word_list_d WORD_LIST;
typedef struct word_list_d word_list_t;
struct word_list_d
{
    struct word_list_d *next;
    struct word_desc_d *word;
};

/* ******************************** */
/*								    */
/*       Shell Command Structs      */
/*								    */
/* ******************************** */

/*
 What a redirection descriptor looks like.  If FLAGS is IS_DESCRIPTOR,
 then we use REDIRECTEE.DEST, else we use the file specified.
 */

typedef struct redirect_d redirect;
typedef struct redirect_d REDIRECT;
typedef struct redirect_d redirect_t;
struct redirect_d
{
    struct redirect_d *next;	/* Next element, or NULL. */
    int redirector;		/* Descriptor to be redirected. */
    int flags;			/* Flag value for `open'. */
    r_instruction_t  instruction; /* What to do with the information. */

	union {
        int dest;			/* Place to redirect REDIRECTOR to, or ... */
        WORD_DESC *filename;	/* filename to redirect to. */
    }redirectee;

	char *here_doc_eof;		/* The word that appeared in <<foo. */
};

/*
 An element used in parsing.
 A single word or a single redirection.
 This is an ephemeral construct.
 */
typedef struct element_d element;
typedef struct element_d ELEMENT;
typedef struct element_d element_t;
struct element_d
{
    WORD_DESC *word;
    REDIRECT *redirect;
};

/*
 What a command looks like.
 */
typedef struct command_d command;
typedef struct command_d COMMAND;
typedef struct command_d command_t;
struct command_d
{
    command_type_t type;	/* FOR CASE WHILE IF CONNECTION or SIMPLE. */
    int subshell;			/* Non-zero means execute in a subshell. */
    REDIRECT *redirects;		/* Special redirects for FOR CASE, etc. */

	union {
        struct for_com *For;
        struct case_com *Case;
        struct while_com *While;
        struct if_com *If;
        struct connection *Connection;
        struct simple_com *Simple;
        struct function_def *Function_def;
        struct group_com *Group;
    }value;
};

/*
 Structure used to represent the CONNECTION type.
 */

typedef struct connection_d connection;
typedef struct connection_d CONNECTION;
typedef struct connection_d connection_t;
struct connection_d
{
    COMMAND *first;		/* Pointer to the first command. */
    COMMAND *second;		/* Pointer to the second command. */
    int connector;		/* What separates this command from others. */
};

/* Structures used to represent the CASE command. */

/* Pattern/action structure for CASE_COM. */

typedef struct pattern_list_d pattern_list;
typedef struct pattern_list_d PATTERN_LIST;
typedef struct pattern_list_d pattern_list_t;
struct pattern_list_d
{
    struct pattern_list_d *next;	/* The next clause to try in case this one failed. */
    WORD_LIST *patterns;		/* Linked list of patterns to test, one after each other. */
    COMMAND *action;		/* Thing to execute if one of the patterns match. */
};

/* The CASE command. */
typedef struct case_com_d case_com;
typedef struct case_com_d CASE_COM;
typedef struct case_com_d case_com_t;
struct case_com_d
{
    WORD_DESC *word;		/* the thing to test. */
    PATTERN_LIST *clauses;	/* the clauses to test against, or NULL. */
};

/* FOR command. */
typedef struct for_com_d for_com;
typedef struct for_com_d FOR_COM;
typedef struct for_com_d for_com_t;
struct for_com_d
{
    WORD_DESC *name;		/* The variable name to get mapped over. */
    WORD_LIST *map_list;		/* The things to map over.  This is never NULL. */
    COMMAND *action;		/* The action to execute.
				   During execution, NAME is bound to successive
				   members of MAP_LIST. */
};

/* IF command. */
typedef struct if_com_d if_com;
typedef struct if_com_d IF_COM;
typedef struct if_com_d if_com_t;
struct if_com_d
{
    COMMAND *test;		/* Thing to test. */
    COMMAND *true_case;		/* What to do if the test returned non-zero. */
    COMMAND *false_case;		/* What to do if the test returned zero. */
};

/* WHILE command. */
typedef struct while_com_d while_com;
typedef struct while_com_d WHILE_COM;
typedef struct while_com_d while_com_t;
struct while_com_d
{
    COMMAND *test;		/* Thing to test. */
    COMMAND *action;		/* Thing to do while test is non-zero. */
};

/* The "simple" command.  Just a collection of words and redirects. */
typedef struct simple_com_d simple_com;
typedef struct simple_com_d SIMPLE_COM;
typedef struct simple_com_d simple_com_t;
struct simple_com_d
{
    WORD_LIST *words;		/* The program name, the arguments, variable assignments, etc. */
    REDIRECT *redirects;		/* Redirections to perform. */
};

/* The "function_def" command.  This isn't really a command, but it is
   represented as such for now.  If the function def appears within
   `(' `)' the parser tries to set the SUBSHELL bit of the command.  That
   means that FUNCTION_DEF has to be run through the executor.  Maybe this
   command should be defined in a subshell.  Who knows or cares. */
typedef struct function_def_d function_def;
typedef struct function_def_d FUNCTION_DEF;
typedef struct function_def_d function_def_t;
struct function_def_d
{
    WORD_DESC *name;
    COMMAND *command;
};

/* A command that is `grouped' allows pipes to take effect over
   the entire command structure. */
typedef struct group_com_d group_com;
typedef struct group_com_d GROUP_COM;
typedef struct group_com_d group_com_t;
struct group_com_d
{
    COMMAND *command;
};

//
// # env. support #
//

/*POSIX*/

//colunas e linhas
#define ENV_COLUMNS "COLUMNS"
#define ENV_LINES "LINES"

#define ENV_LOGNAME "LOGNAME"

#define ENV_PATH "PATH"

#define ENV_SHELL "SHELL"

//the local time zone
#define ENV_TZ "TZ"

/*OUTROS*/

//home directory of the present user.
#define ENV_HOME "HOME"

//login name
#define ENV_USER "USER"

//the language she would like to see messages
#define ENV_LANG "LANG"

//the default printer to be used
#define ENV_PRINTER "PRINTER"
#define ENV_LPDEST "LPDEST"

//
// ## pathname suppport ##
//

#define PATH_SEPARATOR '/'
#define PATH_TERMINATOR '\0'

#define PATHNAME_LENGHT (64)
char pathname_buffer[PATHNAME_LENGHT];
int pathname_lenght; //tamanho do atual pathname.
int pathname_initilized;

//
// ## filename suppport ##
//

#define FILENAME_LENGHT (8+3)
char filename_buffer[FILENAME_LENGHT];
int filename_lenght; //tamanho do nome de arquivo atual.
int filename_initilized;

//@todo:
//devemos criar uma rotina que inicialisa
//esses buffers.

//
// pool
//

//tipo array de strings
typedef char ** poll;
typedef char ** POLL;

//array de unsigned longs contendo ponteiros
//para pools de strings;
typedef unsigned long pool_list_t;
typedef unsigned long POOLLIST;

/*
//command type
typedef enum {
	ctNull,
	//...
}command_type_t;

//command struct
typedef struct command_d command_t;
struct command_d
{
	// Typo de comando.
    command_type_t type;

	//@todo: Criar essas estruturas.
    //struct start_com_d     *Start;
    //struct finish_com_d    *Finish;
    //struct super_com_d     *Super;
    //struct rules_com_d     *Rules;
    //struct condition_d     *Condition;
    //struct open_com_d      *Open;
    //struct close_com_d     *Close;
    //struct run_com_d       *Run;
    //struct stop_com_d      *Stop;
    //struct guarantee_com_d *Guarantee;
    //struct mix_com_d       *Mix;
    //struct here_com_d      *Here;
    //struct there_com_d     *There;

	//...
};
command_t *current_command;
*/

/*
//command struct
typedef struct connection_d connection_t;
struct connection_d
{
    struct command_d *first;
    struct command_d *second;

	//qual é o tipo de conector entre os comandos
	// | ???
	int connectorType;
};
connection_t *current_connection;
*/

//...

// ?? what crazy thing haha
//Lista de palavras reservadas.
//São as mesmas da gramado language, pois
//a gramado language é uma linguagem de script.
//*.gra  usar esse >>> (*.gl1)

static char *RESERVED[] = {
	"start",      //início do script
	"finish",      //fim do script
	"super",       //tipo genérico.
	"rules",       //fecha declaração (;)
	"condition",   //
	"open",        //(
	"close",       //)
	"run",         //{
	"stop",        //}
	"guarantee",   //while
	"mix",         //done: ??
	"here",        //system() command
	"there",       // fecha (;)
};

static unsigned char SPECIAL[] = {
	'(',
	')',
	'{',
	'}',
	'/',
	'*',
	'-',
	'+',
	'|',
	'\'',
	'@',
	'$',
	'%',
	'&',
	'+',
	//...
};

static unsigned char SPECIALOPEN[] = {
	'(',
	'{',
	'[',
	//...
};

static unsigned char SPECIALCLOSE[] = {
	')',
	'{',
	']',
	//...
};

static unsigned char SPECIALMATH[] = {
	'/',
	'*',
	'-',
	'+',
	'.',
	',',
	//...
};

//
// File suppport.
//

//#define FILENAME_LENGTH (8+3)
//...

int EOF_Reached;

//
// SCREEN SUPPORT
//

#define DEFAULT_WINDOW_X 0
#define DEFAULT_WINDOW_Y 0

//Obs: aumentar essas constantes aumenta o tamanho da janela.
#define DEFAULT_MAX_COLUMNS 80
#define DEFAULT_MAX_ROWS    50 //25

//linux
//#define SCREEN_START 0xb8000
//#define SCREEN_END   0xc0000
//#define LINES 25
//#define COLUMNS 80
//#define NPAR 16

//
// Messages support.
//

#define CMD_ABOUT 1000
//#define CMD_ABOUT 1001
//#define CMD_ABOUT 1002
//#define CMD_ABOUT 1003
//...

#define TAB_SIZE 8

//
// Strings
//

#define SHELL_PATHNAME_SEPARATOR "/"
#define SHELL_PATHNAME_TERMINATOR "\0"

#define SHELL_STRING_TERMINATOR "\0"

//@todo:
//a versão do sistema operacional deve-se obter através de uma chamada ao sistema.
#define OS_VERSION     "0.1"
#define SHELL_VERSION  "0.1"

//prompt
#define SHELL_PROMPT   "$"
#define SHELL_PROMPT2  "#"
#define SHELL_PROMPT3  "%"
#define SHELL_PROMPT4  ">"
//...

//
// Volume support
//

//Volume list
#define SHELL_ROOT_STRING        "root:"
#define SHELL_VOLUMELIST_STRING  "root:"

//volumes
#define SHELL_UNKNOWNVOLUME_STRING "unknown-volume"
#define SHELL_VOLUME0_STRING "volume0"   //vfs
#define SHELL_VOLUME1_STRING "volume1"   //boot volume
#define SHELL_VOLUME2_STRING "volume2"   //system volume.
//...

char *current_volume_string;
int current_volume_id;

//
// pwd support
//

#define SHELL_UNKNOWNWORKINGDIRECTORY_ID (-1)
#define SHELL_VFSWORKINGDIRECTORY_ID     0
#define SHELL_BOOTWORKINGDIRECTORY_ID    1
#define SHELL_SYSTEMWORKINGDIRECTORY_ID  2

#define SHELL_VFSWORKINGDIRECTORY_STRING     "volume1"
#define SHELL_BOOTWORKINGDIRECTORY_STRING    "volume1"
#define SHELL_SYSTEMWORKINGDIRECTORY_STRING  "volume2"
#define SHELL_UNKNOWNWORKINGDIRECTORY_STRING "unknown-directory"
//...

int g_current_disk_id;
int g_current_volume_id;
int g_current_workingdirectory_id;  //??

#define WORKINGDIRECTORY_STRING_MAX 32
// a string do diretório de trabalho.
char current_workingdiretory_string[WORKINGDIRECTORY_STRING_MAX];
int pwd_initialized;

#define CalculateRowScanLine(WindowY,CharHeight) \
    ( WindowY * CharHeight )

#define CalculateColumnScanLine(WindowX,CharWidth) \
    ( WindowX * CharWidth )

//usado para salvar um comando atual
//char tmp_command[32];

//
// Banners.
//

// help
static const char help_banner[] =
    "\n Commands: \n \n"
	" ?         - This help\n"
	" cd        - Change current directory\n"
	" cls       - Clear screen\n"
	" copy      - Copy file or directory\n"
	" date      - Date\n"
	" del       - Delete file or directory\n"
	" dir       - List\n"
	" echo      - This ---\n"
	" exit      - Exit shell\n"
	" help      - This help\n"
    " mov       - Move file or diretory\n"
    " new       - New file or directory\n"
	" pwd       - Print working directory\n"
    " reboot    - Reboot system\n"
    " rename    - Rename file or directory\n"
	" shutdown  - Shutdown your computer locally or remotely\n"
	" time      - Time\n"
	" version   - Shell version\n"
	"\n";

// tree
static const char tree_banner[] =
"\n"
"\n"
"     \\o/    \n"
"      d      \n"
"     ccc     \n"
"    bbbbb    \n"
"   aaaaaaa   \n"
"  ggggggggg  \n"
" fffffffffff \n"
"eeeeeeeeeeeee\n"
"     ||      \n"
"     ||      \n"
"     ||      \n"
"    ~~~~     \n"
"\n";
//...

// usage
static const char usage[] =
    "Usage: shell [arguments...]\n"
    "       shell -help             Display this help message and exit.\n"
    "       shell -version          Output version information and exit.\n";
	//...

//
// Files (strings).
//

static const char bmp1_file_name[] = "BMP1    BMP";
static const char bmp2_file_name[] = "BMP2    BMP";
static const char bmp3_file_name[] = "BMP3    BMP";
static const char bmp4_file_name[] = "BMP4    BMP";
static const char init_file_name[] = "INIT    TXT";
//...

//static const char file_bmp1[] = "BMP1.BMP";
//static const char file_bmp2[] = "BMP2.BMP";
//static const char file_bmp3[] = "BMP3.BMP";
//static const char file_bmp4[] = "BMP4.BMP";
//static const char file_init[] = "INIT.TXT";
//...

/*
    Fluxo padrão: definido em <stdio.h>

    FILE *stdin;
    FILE *stdout;
    FILE *stderr;

*/

//
// font support.
//

//FILE *font_file;

//Diretórios para o shell comparar os comandos com os nomes dos arquivos lá.

struct _iobuf *pwd;
struct _iobuf *root;
//...

//
// Structures.
//

//??
typedef struct shell_hook_d shell_hook_t;
struct shell_hook_d
{
	int dummy;
	//struct window_d *window;
	//struct rect_d *rect;
};
shell_hook_t *ShellHook;

//metrics
typedef struct shell_metrics_d shell_metrics_t;
struct shell_metrics_d
{
    int fontWidth;
    int fontHeight;
	int lineMax;
	int colMax; //rowMax
	//...
};
shell_metrics_t *ShellMetrics;
//...

/*
 #bugbug isso dá problema. falta de página.

typedef struct shell_message_d shell_message_t;
struct shell_message_d
{
	struct window_d *window;
	int msg;
	unsigned long long1;
	unsigned long long2;
};
*/

//
// Comunicação Cliente/Servidor:
// Número da mensagem enviada pelo terminal virtual.
// São apenas mensagens usadas pelo terminal virtual
// em modo texto, relativas a input e output de textos.
//
//

typedef enum terminal_api_message_number_d {

	terminalNull,          // 0
	terminalOpenTerminal,  // Inicia a estrutura de terminal virtual.
    terminalCloseTerminal, // Fecha a estrutura de terminal.
	terminalGetWindow,     //
    terminalGetMessage,    //
    terminalGetLong1,      //
    terminalGetLong2, 	   //
    terminalScreenWidth,
    terminalScreenHeight,
    terminalCursorWidth,
    terminalCursorHeight,
    terminalCharWidth,
    terminalCharHeight
	//...

}terminal_api_message_number_t;

//
// @todo:
// Cada atitude do terminal merece uma estrutura.
// faremos as estruturas daqui para baixo.
//

//screen info
typedef struct terminal_screen_info_d terminal_screen_info_t;
struct terminal_screen_info_d
{
	unsigned long width;
	unsigned long height;
};

//#importante.
//rect info
//retângulo da área de cliente onde aparecerão os caracteres.
typedef struct terminal_rect_info_d terminal_rect_info_t;
struct terminal_rect_info_d
{
	unsigned long top;
	unsigned long left;
	unsigned long width;
	unsigned long height;
	//...
};
struct terminal_rect_info_d terminal_rect;

//cursor info
typedef struct terminal_cursor_info_d terminal_cursor_info_t;
struct terminal_cursor_info_d
{
	unsigned long width;
	unsigned long height;
	//...
};

//char info
typedef struct terminal_char_info_d terminal_char_info_t;
struct terminal_char_info_d
{
	unsigned long width;
	unsigned long height;
};

//...

#define SHELL_STREAM_STATUS_INPUT  1    // input
#define SHELL_STREAM_STATUS_OUTPUT 2    // output
#define SHELL_STREAM_STATUS_ERROR  3    // error

//
// Estrutura principal.
// Informações sobre o shell.
//

typedef struct shell_info_d shell_info_t;
struct shell_info_d
{
	struct window_d *main_window;
	struct window_d *terminal_window;

	//stream support.
    int stream_status;  //inpout ou output.

	//#BUGBUG duplicando estrutura. ??
	//struct _iobuf *stdin;
	//struct _iobuf *stdout;
	//struct _iobuf *stderr;

	//O retângulo da área de cliente.
	struct rect_d *rect;
	//struct terminal_rect_info_d *r;

	struct shell_hook_d *hook;
	struct shell_metrics_d *metrics;
	//...

};
//sem ponteiro.
struct shell_info_d shell_info;

// alias support
typedef struct alias_d alias_t;
struct alias_d
{
	int used;
	int magic;

	int name_lenght;
    char *name;

	int command_lenght;
    char *command;
};

typedef struct COMMAND_D COMMAND_T;
struct COMMAND_D
{
	int used;
	int magic;

	int command_lenght;
	char *command;

	struct alias_d *alias;
};
COMMAND_T *CurrentCommand;
//...

typedef struct COMMANDHISTORY_D COMMANDHISTORY_T;
struct COMMANDHISTORY_D
{
    int NumberOfCommands;
	int MaximumNumberOfCommands;

};
COMMANDHISTORY_T *CommandHistory;

//
// Macros.
//

//#define DeclareStructHandle(name) struct nameJABUTICABA__ { int unused; }; typedef struct nameJABUTICABA__ *name
//#define DeclareHandle(name) typedef void* name

int main ( int argc, char *argv[] );

//
// Screen support.
//

void shellClearScreen (void);

//copia o conteúdo do buffer para a tela. (dentro da janela)
void shellRefreshScreen (void);

void shellRefreshLine ( int line_number );

void shellRefreshChar ( int line_number, int col_number );

//refresh do char que está na posição usada pelo input.
void shellRefreshCurrentChar (void);

//scroll dentro da screen_buffer. (VGA emulada)
void shellScroll (void);
//...

//
// Buffer support.
//

void shellClearBuffer(void);
void shellShowScreenBuffer (void);
//...

//
// Typing support.
//

void shellInsertCR (void);
void shellInsertLF (void);
void shellInsertNullTerminator (void);
void shellInsertNextChar (char c);

void shellInsertCharXY (unsigned long x, unsigned long y, char c);

char
shellGetCharXY (
    unsigned long x,
    unsigned long y );

static void lf (void);
static void ri (void);
static void cr (void);
static void del (void);

void move_to ( unsigned long x, unsigned long y);
//...

//
// Cursor support.
//

void shellSetCursor (unsigned long x, unsigned long y);
static void save_cur (void);
static void restore_cur (void);

//
// Reset prompt.
//

void shellPrompt (void);

//cmd
//Funções chamadas pelos comandos.
void shellHelp (void);
void shellTree (void);
void shellThread (void);
void shellTestLoadFile (void);
void shellTestFork(void);
void shellTestThreads (void);
void shellTestMBR (void);

//int test_operators();

void shellShowWindowInfo (void);
void shellShowInfo (void);
void shellShowMetrics (void);
void shellShowSystemInfo (void);

unsigned long
shellSendMessage (
    struct window_d *window,
    int msg,
    unsigned long long1,
    unsigned long long2 );
// ...

// Wait for commands.
//Isso não é usado, temos um while.
void shellWaitCmd (void);

 // Compare comands.
unsigned long shellCompare (struct window_d *window);

// Initialization.
int shellInit ( struct window_d *window );    // Init.
void shellShell (void);                           // Constructor.

// Finalizing ...
// ??exit, die...

//show ascii table
//void shellASCII();

// copia bytes
void
shell_memcpy_bytes (
    unsigned char *Dest,
    unsigned char *Source,
    unsigned long Length );

void shellUpdateCurrentDirectoryID ( int id );
void shellUpdateWorkingDiretoryString ( char *string );

void shellInitializeWorkingDiretoryString (void);

//lista informações sobre os processos.
void shellTaskList (void);

void shellShowPID (void);
void shellShowPPID (void);
void shellShowUID (void);
void shellShowGID (void);

void shellShowUserSessionID (void);
void shellShowWindowStationID (void);
void shellShowDesktopID (void);

void shellShowProcessHeapPointer (void);
void shellShowKernelHeapPointer (void);

void shellShowDiskInfo (void);
void shellShowVolumeInfo (void);

void shellShowMemoryInfo (void);
void shellShowPCIInfo (void);
void shellShowKernelInfo (void);

/*
 * gramado core specials execve SUPPORT.
 * Executa um programa exclusivamente dentro
 * do ambiente Gramado Core no lugar do processo init.bin.
 */

int
shell_gramado_core_init_execve (
    const char *arg1,
    const char *arg2,
    const char *arg3 );

//
// shelui.c
//

void shellCreateEditBox(void);

struct window_d *shellCreateMainWindow( int status );
//struct window_d *shellCreatemainWindow ();

int shellDisplayBMP ( char *file_name );

int shellDisplayBMPEx (char *file_name, int size );

void shellTestDisplayBMP (void);

void
bmpDisplayBMP (
    void* address,
    unsigned long x,
    unsigned long y,
    int width,
    int height );

//um comando no shell aponta o script para executar.
int shellExecuteThisScript ( char* script_name );

/*
 **************************************
 * absolute_pathname:
 * Retorna 1 nos seguintes casos:
 *
 * >/
 * >.
 * >./
 * >..
 * >../
 *
 * Credits: bash 1.05
 */
int absolute_pathname ( char *string );

//inicializaremos o supporte a pathname
int shellInitPathname (void);

//inicializaremos o supporte a filename
int shellInitFilename (void);

void shellExit (int code);

/*
 Remove the last N directories from PATH.
 Do not leave a blank path.
 PATH must contain enough space for MAXPATHLEN characters.
 Credits: bash 1.05
 */
void shell_pathname_backup ( char *path, int n );

// Isso vai ser usado pelo echo.
void
shell_print_tokenList (
    char *token_list[],
    char *separator );

/* Check if it's a .bin file */
int is_bin ( char *cmd );

/* Check if it's a .sh1 file */
int is_sh1 ( char *cmd );

int shellCheckPassword (void);

//testando botão.
int shellTestButtons (void);

//tests
void testCreateWindow (void);

//
// End.
//