<commit_before>/*
 * Copyright (C) 2007-2010  Sebastian Schuberth <sschuberth_AT_gmail_DOT_com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#include <shlobj.h>

#include "component.h"
#include "resource.h"

#include <foobar2000/helpers/win32_dialog.h>

#define DEFAULT_CAD_START     true
#define DEFAULT_CAD_PATH      get_registry_string(HKEY_CURRENT_USER,_T("Software\\CD Art Display"))
#define DEFAULT_WRITE_RATING  false

// Returns a registry key's default value in UTF-8.
static char const* get_registry_string(HKEY key,LPCTSTR subkey) {
    TCHAR path[MAX_PATH];
    LONG size=sizeof(path);
    if (RegQueryValue(key,subkey,path,&size)!=ERROR_SUCCESS) {
        return NULL;
    }

    pfc::stringcvt::string_utf8_from_wide path_utf8;
    path_utf8.convert(path);
    return path_utf8;
}

// {7cef938b-1b5f-4fe5-a8ca-a1711f6de31c}
static GUID const cfg_cad_start_guid=
{ 0x7cef938b, 0x1b5f, 0x4fe5, { 0xa8, 0xca, 0xa1, 0x71, 0x1f, 0x6d, 0xe3, 0x1c } };
cfg_bool cfg_cad_start(cfg_cad_start_guid,DEFAULT_CAD_START);

// {33b397c7-8e79-4302-b5af-058a269d0e4d}
static GUID const cfg_cad_path_guid=
{ 0x33b397c7, 0x8e79, 0x4302, { 0xb5, 0xaf, 0x05, 0x8a, 0x26, 0x9d, 0x0e, 0x4d } };
cfg_string cfg_cad_path(cfg_cad_path_guid,DEFAULT_CAD_PATH);

// {453c4714-7147-42a2-bae2-da0a6935a707}
static GUID const cfg_write_rating_guid=
{ 0x453c4714, 0x7147, 0x42a2, { 0xba, 0xe2, 0xda, 0x0a, 0x69, 0x35, 0xa7, 0x07 } };
cfg_bool cfg_write_rating(cfg_write_rating_guid,DEFAULT_WRITE_RATING);

class CDArtDisplayPreferences:public preferences_page
{
  public:

    HWND create(HWND p_parent) {
        return uCreateDialog(IDD_CONFIG,p_parent,WindowProc);
    }

    char const* get_name() {
        static char const* name="CD Art Display Interface";
        return name;
    }

    GUID get_guid() {
        // {8ae21164-7867-4fc0-9545-f5fe97dfe896}
        static GUID const guid=
            { 0x8ae21164, 0x7867, 0x4fc0, { 0x95, 0x45, 0xf5, 0xfe, 0x97, 0xdf, 0xe8, 0x96 } };
        return guid;
    }

    GUID get_parent_guid() {
        return guid_tools;
    }

    bool reset_query() {
        return true;
    }

    void reset() {
        cfg_cad_start=DEFAULT_CAD_START;
        cfg_cad_path=DEFAULT_CAD_PATH;
        cfg_write_rating=DEFAULT_WRITE_RATING;
    }

    bool get_help_url(pfc::string_base& p_out) {
        p_out="http://www.cdartdisplay.com/forum/";
        return true;
    }

  private:

    static int CALLBACK WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) {
        switch (uMsg) {
            case WM_INITDIALOG: {
                // Set the check box state according to the stored configuration.
                uSendDlgItemMessage(hWnd,IDC_CAD_START,BM_SETCHECK,cfg_cad_start,0);
                EnableWindow(GetDlgItem(hWnd,IDC_CAD_PATH),cfg_cad_start);

                // Get the foobar2000 configuration strings and convert them to
                // the OS' format.
                pfc::stringcvt::string_os_from_utf8 path2os;
                path2os.convert(cfg_cad_path);

                uSendDlgItemMessage(hWnd,IDC_CAD_PATH,WM_SETTEXT,0,reinterpret_cast<LPARAM>(path2os.get_ptr()));

                // Set the stored configuration for writing the rating to tags.
                uSendDlgItemMessage(hWnd,IDC_WRITE_RATING,BM_SETCHECK,cfg_write_rating,0);

                return TRUE;
            }
            case WM_COMMAND: {
                // Get all edit control string in the OS' format and convert them
                // to UTF-8 for foobar2000.
                pfc::stringcvt::string_utf8_from_os path2utf8;

                TCHAR path[MAX_PATH];
                LRESULT result;

                switch (LOWORD(wParam)) {
                    case IDC_CAD_START: {
                        // Get the check box state and toggle the edit control accordingly.
                        cfg_cad_start=uSendDlgItemMessage(hWnd,IDC_CAD_START,BM_GETCHECK,0,0)!=0;
                        EnableWindow(GetDlgItem(hWnd,IDC_CAD_PATH),cfg_cad_start);
                        break;
                    }
                    case IDC_CAD_PATH: {
                        if (HIWORD(wParam)==EN_CHANGE) {
                            result=uSendDlgItemMessage(hWnd,IDC_CAD_PATH,WM_GETTEXT,MAX_PATH,reinterpret_cast<LPARAM>(path));
                            if (result==0) {
                                cfg_cad_path.reset();
                            }
                            else if (result>0) {
                                path2utf8.convert(path);
                                cfg_cad_path=path2utf8;
                            }
                        }
                        break;
                    }
                    case IDC_WRITE_RATING: {
                        // Get the check box state and toggle the edit control accordingly.
                        cfg_write_rating=uSendDlgItemMessage(hWnd,IDC_WRITE_RATING,BM_GETCHECK,0,0)!=0;
                        break;
                    }
                    default: {
                        return 1;
                    }
                }

                return 0;
            }
        }
        return DefWindowProc(hWnd,uMsg,wParam,lParam);
    }
};

static preferences_page_factory_t<CDArtDisplayPreferences> foo_preferences;
<commit_msg>Never return NULL for the default path to CAD as a tentative fix to issue 2.<commit_after>/*
 * Copyright (C) 2007-2010  Sebastian Schuberth <sschuberth_AT_gmail_DOT_com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#include <shlobj.h>
#include <shlwapi.h>

#include "component.h"
#include "resource.h"

#include <foobar2000/helpers/win32_dialog.h>

#define DEFAULT_CAD_START     true
#define DEFAULT_CAD_PATH      get_cad_path()
#define DEFAULT_WRITE_RATING  false

// Returns a default path to CAD in UTF-8.
static char const* get_cad_path() {
    TCHAR path[MAX_PATH];
    LONG size=sizeof(path);
    if (RegQueryValue(HKEY_CURRENT_USER,_T("Software\\CD Art Display"),path,&size)!=ERROR_SUCCESS) {
        if (SHGetFolderPath(NULL,CSIDL_PROGRAM_FILES,NULL,SHGFP_TYPE_CURRENT,path)!=S_OK) {
            _tcscpy_s(path,_T("C:\\Program Files"));
        }
        PathAppend(path,_T("CD Art Display\\CAD.exe"));
    }

    pfc::stringcvt::string_utf8_from_wide path_utf8;
    path_utf8.convert(path);
    return path_utf8;
}

// {7cef938b-1b5f-4fe5-a8ca-a1711f6de31c}
static GUID const cfg_cad_start_guid=
{ 0x7cef938b, 0x1b5f, 0x4fe5, { 0xa8, 0xca, 0xa1, 0x71, 0x1f, 0x6d, 0xe3, 0x1c } };
cfg_bool cfg_cad_start(cfg_cad_start_guid,DEFAULT_CAD_START);

// {33b397c7-8e79-4302-b5af-058a269d0e4d}
static GUID const cfg_cad_path_guid=
{ 0x33b397c7, 0x8e79, 0x4302, { 0xb5, 0xaf, 0x05, 0x8a, 0x26, 0x9d, 0x0e, 0x4d } };
cfg_string cfg_cad_path(cfg_cad_path_guid,DEFAULT_CAD_PATH);

// {453c4714-7147-42a2-bae2-da0a6935a707}
static GUID const cfg_write_rating_guid=
{ 0x453c4714, 0x7147, 0x42a2, { 0xba, 0xe2, 0xda, 0x0a, 0x69, 0x35, 0xa7, 0x07 } };
cfg_bool cfg_write_rating(cfg_write_rating_guid,DEFAULT_WRITE_RATING);

class CDArtDisplayPreferences:public preferences_page
{
  public:

    HWND create(HWND p_parent) {
        return uCreateDialog(IDD_CONFIG,p_parent,WindowProc);
    }

    char const* get_name() {
        static char const* name="CD Art Display Interface";
        return name;
    }

    GUID get_guid() {
        // {8ae21164-7867-4fc0-9545-f5fe97dfe896}
        static GUID const guid=
            { 0x8ae21164, 0x7867, 0x4fc0, { 0x95, 0x45, 0xf5, 0xfe, 0x97, 0xdf, 0xe8, 0x96 } };
        return guid;
    }

    GUID get_parent_guid() {
        return guid_tools;
    }

    bool reset_query() {
        return true;
    }

    void reset() {
        cfg_cad_start=DEFAULT_CAD_START;
        cfg_cad_path=DEFAULT_CAD_PATH;
        cfg_write_rating=DEFAULT_WRITE_RATING;
    }

    bool get_help_url(pfc::string_base& p_out) {
        p_out="http://www.cdartdisplay.com/forum/";
        return true;
    }

  private:

    static int CALLBACK WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) {
        switch (uMsg) {
            case WM_INITDIALOG: {
                // Set the check box state according to the stored configuration.
                uSendDlgItemMessage(hWnd,IDC_CAD_START,BM_SETCHECK,cfg_cad_start,0);
                EnableWindow(GetDlgItem(hWnd,IDC_CAD_PATH),cfg_cad_start);

                // Get the foobar2000 configuration strings and convert them to
                // the OS' format.
                pfc::stringcvt::string_os_from_utf8 path2os;
                path2os.convert(cfg_cad_path);

                uSendDlgItemMessage(hWnd,IDC_CAD_PATH,WM_SETTEXT,0,reinterpret_cast<LPARAM>(path2os.get_ptr()));

                // Set the stored configuration for writing the rating to tags.
                uSendDlgItemMessage(hWnd,IDC_WRITE_RATING,BM_SETCHECK,cfg_write_rating,0);

                return TRUE;
            }
            case WM_COMMAND: {
                // Get all edit control string in the OS' format and convert them
                // to UTF-8 for foobar2000.
                pfc::stringcvt::string_utf8_from_os path2utf8;

                TCHAR path[MAX_PATH];
                LRESULT result;

                switch (LOWORD(wParam)) {
                    case IDC_CAD_START: {
                        // Get the check box state and toggle the edit control accordingly.
                        cfg_cad_start=uSendDlgItemMessage(hWnd,IDC_CAD_START,BM_GETCHECK,0,0)!=0;
                        EnableWindow(GetDlgItem(hWnd,IDC_CAD_PATH),cfg_cad_start);
                        break;
                    }
                    case IDC_CAD_PATH: {
                        if (HIWORD(wParam)==EN_CHANGE) {
                            result=uSendDlgItemMessage(hWnd,IDC_CAD_PATH,WM_GETTEXT,MAX_PATH,reinterpret_cast<LPARAM>(path));
                            if (result==0) {
                                cfg_cad_path.reset();
                            }
                            else if (result>0) {
                                path2utf8.convert(path);
                                cfg_cad_path=path2utf8;
                            }
                        }
                        break;
                    }
                    case IDC_WRITE_RATING: {
                        // Get the check box state and toggle the edit control accordingly.
                        cfg_write_rating=uSendDlgItemMessage(hWnd,IDC_WRITE_RATING,BM_GETCHECK,0,0)!=0;
                        break;
                    }
                    default: {
                        return 1;
                    }
                }

                return 0;
            }
        }
        return DefWindowProc(hWnd,uMsg,wParam,lParam);
    }
};

static preferences_page_factory_t<CDArtDisplayPreferences> foo_preferences;
<|endoftext|>


<commit_before>#pragma once
//=====================================================================//
/*!	@file
	@brief	RX64M/RX71M/RX72M/RX651/RX65N/RX24T/RX66T CAC 定義
    @author 平松邦仁 (hira@rvf-rc45.net)
	@copyright	Copyright (C) 2018, 2019 Kunihito Hiramatsu @n
				Released under the MIT license @n
				https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=====================================================================//
#include "common/device.hpp"

namespace device {

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  クロック周波数精度測定回路（CAC）クラス
		@param[in]	per		ペリフェラル型
		@param[in]	INT		割り込みベクタ型
		@param[in]	ferr	周波数エラー割り込みベクタ
		@param[in]	mend	測定終了割り込みベクタ
		@param[in]	ovff	オーバフロー割り込みベクタ
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	template<peripheral per, typename INT, INT ferr, INT mend, INT ovff>
	struct cac_t {

		static const auto PERIPHERAL = per;		///< ペリフェラル型
		static const auto FERR_VEC = ferr;		///< 周波数エラー割り込みベクター
		static const auto MEND_VEC = mend;		///< 測定終了割り込みベクター
		static const auto OVFF_VEC = ovff;		///< オーバーフロー割り込みベクター

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC コントロールレジスタ 0（CACR0）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct cacr0_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t<io_, bitpos::B0>   CFME;
		};
		static cacr0_t<0x0008B000> CACR0;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC コントロールレジスタ 1（CACR1）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct cacr1_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t <io_, bitpos::B0>     CACREFE;
			bits_rw_t<io_, bitpos::B1, 3>  FMCS;
			bits_rw_t<io_, bitpos::B4, 2>  TCSS;
			bits_rw_t<io_, bitpos::B6, 2>  EDGES;
		};
		static cacr1_t<0x0008B001> CACR1;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC コントロールレジスタ 2（CACR2）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct cacr2_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t <io_, bitpos::B0>     RPS;
			bits_rw_t<io_, bitpos::B1, 3>  RSCS;
			bits_rw_t<io_, bitpos::B4, 2>  RCDS;
			bits_rw_t<io_, bitpos::B6, 2>  DFS;
		};
		static cacr2_t<0x0008B002> CACR2;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC 割り込み要求許可レジスタ（CAICR）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct caicr_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t<io_, bitpos::B0>   FERRIE;
			bit_rw_t<io_, bitpos::B1>   MENDIE;
			bit_rw_t<io_, bitpos::B2>   OVFIE;

			bit_rw_t<io_, bitpos::B4>   FERRFCL;
			bit_rw_t<io_, bitpos::B5>   MENDFCL;
			bit_rw_t<io_, bitpos::B6>   OVFFCL;
		};
		static caicr_t<0x0008B003> CAICR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC ステータスレジスタ（CASTR）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct castr_t : public ro8_t<base> {
			typedef ro8_t<base> io_;
			using io_::operator ();

			bit_ro_t<io_, bitpos::B0>   FERRF;
			bit_ro_t<io_, bitpos::B1>   MENDF;
			bit_ro_t<io_, bitpos::B2>   OVFF;
		};
		static castr_t<0x0008B004> CASTR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC 上限値設定レジスタ（CAULVR）
		*/
		//-----------------------------------------------------------------//
		static rw16_t<0x0008B006>  CAULVR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC 下限値設定レジスタ（CALLVR）
		*/
		//-----------------------------------------------------------------//
		static rw16_t<0x0008B008>  CALLVR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC カウンタバッファレジスタ（CACNTBR）
		*/
		//-----------------------------------------------------------------//
		static rw16_t<0x0008B00A>  CACNTBR;
	};
#if defined(SIG_RX24T)
	typedef cac_t<peripheral::CAC,
		ICU::VECTOR, ICU::VECTOR::FERRF, ICU::VECTOR::MENDF, ICU::VECTOR::OVFF> CAC;
#elif defined(SIG_RX64M) || defined(SIG_RX71M) || defined(SIG_RX72M) || defined(SIG_RX65N) || defined(SIG_RX66T) || defined(SIG_RX72M) || defined(SIG_RX72N)
	typedef cac_t<peripheral::CAC,
		ICU::VECTOR_BL0,
		ICU::VECTOR_BL0::FERRI, ICU::VECTOR_BL0::MENDI, ICU::VECTOR_BL0::OVFI> CAC;
#endif
}
<commit_msg>Update: The reality of the template when it is not optimized<commit_after>#pragma once
//=====================================================================//
/*!	@file
	@brief	RX64M/RX71M/RX72M/RX651/RX65N/RX24T/RX66T CAC 定義
    @author 平松邦仁 (hira@rvf-rc45.net)
	@copyright	Copyright (C) 2018, 2020 Kunihito Hiramatsu @n
				Released under the MIT license @n
				https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=====================================================================//
#include "common/device.hpp"

namespace device {

	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	/*!
		@brief  クロック周波数精度測定回路（CAC）クラス
		@param[in]	per		ペリフェラル型
		@param[in]	INT		割り込みベクタ型
		@param[in]	ferr	周波数エラー割り込みベクタ
		@param[in]	mend	測定終了割り込みベクタ
		@param[in]	ovff	オーバフロー割り込みベクタ
	*/
	//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
	template<peripheral per, typename INT, INT ferr, INT mend, INT ovff>
	struct cac_t {

		static const auto PERIPHERAL = per;		///< ペリフェラル型
		static const auto FERR_VEC = ferr;		///< 周波数エラー割り込みベクター
		static const auto MEND_VEC = mend;		///< 測定終了割り込みベクター
		static const auto OVFF_VEC = ovff;		///< オーバーフロー割り込みベクター

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC コントロールレジスタ 0（CACR0）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct cacr0_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t<io_, bitpos::B0>   CFME;
		};
		typedef cacr0_t<0x0008B000> CACR0_;
		static  CACR0_ CACR0;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC コントロールレジスタ 1（CACR1）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct cacr1_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t <io_, bitpos::B0>     CACREFE;
			bits_rw_t<io_, bitpos::B1, 3>  FMCS;
			bits_rw_t<io_, bitpos::B4, 2>  TCSS;
			bits_rw_t<io_, bitpos::B6, 2>  EDGES;
		};
		typedef cacr1_t<0x0008B001> CACR1_;
		static  CACR1_ CACR1;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC コントロールレジスタ 2（CACR2）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct cacr2_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t <io_, bitpos::B0>     RPS;
			bits_rw_t<io_, bitpos::B1, 3>  RSCS;
			bits_rw_t<io_, bitpos::B4, 2>  RCDS;
			bits_rw_t<io_, bitpos::B6, 2>  DFS;
		};
		typedef cacr2_t<0x0008B002> CACR2_;
		static  CACR2_ CACR2;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC 割り込み要求許可レジスタ（CAICR）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct caicr_t : public rw8_t<base> {
			typedef rw8_t<base> io_;
			using io_::operator =;
			using io_::operator ();
			using io_::operator |=;
			using io_::operator &=;

			bit_rw_t<io_, bitpos::B0>   FERRIE;
			bit_rw_t<io_, bitpos::B1>   MENDIE;
			bit_rw_t<io_, bitpos::B2>   OVFIE;

			bit_rw_t<io_, bitpos::B4>   FERRFCL;
			bit_rw_t<io_, bitpos::B5>   MENDFCL;
			bit_rw_t<io_, bitpos::B6>   OVFFCL;
		};
		typedef caicr_t<0x0008B003> CAICR_;
		static  CAICR_ CAICR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC ステータスレジスタ（CASTR）
			@param[in]	base	ベースアドレス
		*/
		//-----------------------------------------------------------------//
		template <uint32_t base>
		struct castr_t : public ro8_t<base> {
			typedef ro8_t<base> io_;
			using io_::operator ();

			bit_ro_t<io_, bitpos::B0>   FERRF;
			bit_ro_t<io_, bitpos::B1>   MENDF;
			bit_ro_t<io_, bitpos::B2>   OVFF;
		};
		typedef castr_t<0x0008B004> CASTR_;
		static  CASTR_ CASTR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC 上限値設定レジスタ（CAULVR）
		*/
		//-----------------------------------------------------------------//
		typedef rw16_t<0x0008B006>  CAULVR_;
		static  CAULVR_ CAULVR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC 下限値設定レジスタ（CALLVR）
		*/
		//-----------------------------------------------------------------//
		typedef rw16_t<0x0008B008>  CALLVR_;
		static  CALLVR_ CALLVR;

		//-----------------------------------------------------------------//
		/*!
			@brief  CAC カウンタバッファレジスタ（CACNTBR）
		*/
		//-----------------------------------------------------------------//
		typedef rw16_t<0x0008B00A>  CACNTBR_;
		static  CACNTBR_ CACNTBR;
	};

	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CACR0_ cac_t<per, INT, ferr, mend, ovff>::CACR0;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CACR1_ cac_t<per, INT, ferr, mend, ovff>::CACR1;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CACR2_ cac_t<per, INT, ferr, mend, ovff>::CACR2;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CAICR_ cac_t<per, INT, ferr, mend, ovff>::CAICR;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CASTR_ cac_t<per, INT, ferr, mend, ovff>::CASTR;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CAULVR_ cac_t<per, INT, ferr, mend, ovff>::CAULVR;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CALLVR_ cac_t<per, INT, ferr, mend, ovff>::CALLVR;
	template <peripheral per, typename INT, INT ferr, INT mend, INT ovff> typename cac_t<per, INT, ferr, mend, ovff>::  CACNTBR_ cac_t<per, INT, ferr, mend, ovff>::CACNTBR;

#if defined(SIG_RX24T)
	typedef cac_t<peripheral::CAC,
		ICU::VECTOR, ICU::VECTOR::FERRF, ICU::VECTOR::MENDF, ICU::VECTOR::OVFF> CAC;
#elif defined(SIG_RX64M) || defined(SIG_RX71M) || defined(SIG_RX72M) || defined(SIG_RX65N) || defined(SIG_RX66T) || defined(SIG_RX72M) || defined(SIG_RX72N)
	typedef cac_t<peripheral::CAC,
		ICU::VECTOR_BL0,
		ICU::VECTOR_BL0::FERRI, ICU::VECTOR_BL0::MENDI, ICU::VECTOR_BL0::OVFI> CAC;
#endif
}
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: colorlistener.hxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: hr $ $Date: 2003-03-25 18:19:32 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef __FRAMEWORK_CLASSES_COLORLISTENER_HXX_
#define __FRAMEWORK_CLASSES_COLORLISTENER_HXX_

//__________________________________________
// own includes

#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
#include <threadhelp/threadhelpbase.hxx>
#endif

#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
#include <macros/xinterface.hxx>
#endif

#ifndef __FRAMEWORK_GENERAL_H_
#include <general.h>
#endif

//__________________________________________
// interface includes

#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif

//__________________________________________
// other includes

#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif

#ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
#include <svtools/colorcfg.hxx>
#endif

//__________________________________________
// definition

namespace framework
{

//__________________________________________

/** listen for color changes inside configuration.

    This listener looks for color changes provided at the config item
    "ColorConfig". All interested colors will be applied directly to a
    given window set window member. Curren implementation support setting
    of the background only.

    @see    ::svtools::ColorConfig
 */

class ColorListener : public  css::lang::XEventListener
                    , private ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
                    , public  SfxListener
                    , public  ::cppu::OWeakObject

{
    //______________________________________
    // member

    private:

        /** points to the single config item, which provides the color-change notification. */
        ::svtools::ColorConfig* m_pConfig;

        /** reference to the window, on which we must set the changed color. */
        css::uno::Reference< css::awt::XWindow > m_xWindow;

        /** we must know, if we already registered as listener or not. */
        sal_Bool m_bListen;

    //______________________________________
    // interface

    public:

        DECLARE_XINTERFACE

         ColorListener( const css::uno::Reference< css::awt::XWindow >& xWindow );
        ~ColorListener(                                                         );

        // XEventListener
        virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);

        // SfxListener
        virtual void Notify( SfxBroadcaster& rBroadCaster, const SfxHint& rHint );

    //______________________________________
    // helper

    private:

        void impl_applyColor    ();
        void impl_startListening();
        void impl_stopListening ();
        void impl_die           ();

}; // class ColorListener

} // namespace framework

#endif // __FRAMEWORK_CLASSES_COLORLISTENER_HXX_
<commit_msg>INTEGRATION: CWS mav4 (1.2.10); FILE MERGED 2003/04/23 13:17:42 as 1.2.10.1: #109052# HACK: refresh background color if it was changed by 3rdparty!<commit_after>/*************************************************************************
 *
 *  $RCSfile: colorlistener.hxx,v $
 *
 *  $Revision: 1.3 $
 *
 *  last change: $Author: rt $ $Date: 2003-04-24 13:32:43 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef __FRAMEWORK_CLASSES_COLORLISTENER_HXX_
#define __FRAMEWORK_CLASSES_COLORLISTENER_HXX_

//__________________________________________
// own includes

#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
#include <threadhelp/threadhelpbase.hxx>
#endif

#ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
#include <macros/xinterface.hxx>
#endif

#ifndef __FRAMEWORK_GENERAL_H_
#include <general.h>
#endif

//__________________________________________
// interface includes

#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif

//__________________________________________
// other includes

#ifndef _CPPUHELPER_WEAK_HXX_
#include <cppuhelper/weak.hxx>
#endif

#ifndef INCLUDED_SVTOOLS_COLORCFG_HXX
#include <svtools/colorcfg.hxx>
#endif

#ifndef _LINK_HXX
#include <tools/link.hxx>
#endif

//__________________________________________
// definition

namespace framework
{

//__________________________________________

/** listen for color changes inside configuration.

    This listener looks for color changes provided at the config item
    "ColorConfig". All interested colors will be applied directly to a
    given window set window member. Curren implementation support setting
    of the background only.

    @see    ::svtools::ColorConfig
 */

class ColorListener : public  css::lang::XEventListener
                    , private ThreadHelpBase // attention! Must be the first base class to guarentee right initialize lock ...
                    , public  SfxListener
                    , public  ::cppu::OWeakObject

{
    //______________________________________
    // member

    private:

        /** points to the single config item, which provides the color-change notification. */
        ::svtools::ColorConfig* m_pConfig;

        /** reference to the window, on which we must set the changed color. */
        css::uno::Reference< css::awt::XWindow > m_xWindow;

        /** we must know, if we already registered as listener or not. */
        sal_Bool m_bListen;

        long m_nColor;

    //______________________________________
    // interface

    public:

        DECLARE_XINTERFACE

         ColorListener( const css::uno::Reference< css::awt::XWindow >& xWindow );
        ~ColorListener(                                                         );

        // XEventListener
        virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException);

        // SfxListener
        virtual void Notify( SfxBroadcaster& rBroadCaster, const SfxHint& rHint );

        DECL_LINK( impl_SettingsChanged, void* );

    //______________________________________
    // helper

    private:

        void impl_applyColor    ( sal_Bool bInvalidate );
        void impl_startListening();
        void impl_stopListening ();
        void impl_die           ();

}; // class ColorListener

} // namespace framework

#endif // __FRAMEWORK_CLASSES_COLORLISTENER_HXX_
<|endoftext|>


<commit_before>#include "Scheduler.h"
#include <cstdio>

using namespace std;
using namespace boost;

void Scheduler::addConnection(Connection *c)
{
    printf("addConnection: source [ %p idx %d ] -> sink [ %p idx %d]\n",
        c->m_sourceBlock, c->m_sourceIndex, c->m_sinkBlock, c->m_sinkIndex);

    vertex_t vert_source, vert_sink;
    bool found_source = false, found_sink = false;

    /* see if the source or sink vertex (or both) is already in the graph */
    auto v_it = vertices(m_graph);
    for (auto it = v_it.first; it != v_it.second; ++it)
    {
        vertex_t v = *it;

        if (m_graph[v] == c->m_sourceBlock)
        {
            printf("- source block %p is already in the graph.\n",
                c->m_sourceBlock);

            vert_source = v;
            found_source = true;
        }
        if (m_graph[v] == c->m_sinkBlock)
        {
            printf("- sink block %p is already in the graph.\n",
                c->m_sinkBlock);

            vert_sink = v;
            found_sink = true;
        }

        if (found_source && found_sink) break;
    }

    /* if source and/or sink were not found, add new vertex(es) to the graph */
    if (!found_source)
    {
        printf("- source block %p is not in the graph; creating.\n",
            c->m_sourceBlock);

        vert_source = add_vertex(m_graph);
        m_graph[vert_source] = c->m_sourceBlock;
    }
    if (!found_sink)
    {
        printf("- sink block %p is not in the graph; creating.\n",
            c->m_sinkBlock);

        vert_sink = add_vertex(m_graph);
        m_graph[vert_sink] = c->m_sinkBlock;
    }

    edge_t edge;
    bool found_edge = false;

    /* see if the edge is already in the graph */
    auto e_it = edges(m_graph);
    for (auto it = e_it.first; it != e_it.second; ++it)
    {
        edge_t e = *it;
        pair<int, int> indices = m_graph[e];

        vertex_t v1 = source(e, m_graph);
        vertex_t v2 = target(e, m_graph);

        if (m_graph[v1] == c->m_sourceBlock && m_graph[v2] == c->m_sinkBlock &&
            indices.first == c->m_sourceIndex && indices.second == c->m_sinkIndex)
        {
            printf("- edge is already in the graph!\n");

            edge = e;
            found_edge = true;

            break;
        }
    }

    /* if edge was not found, add new edge to the graph */
    if (!found_edge)
    {
        printf("- edge does not exist in the graph; creating.\n");

        bool b;
        tie(edge, b) = add_edge(vert_source, vert_sink, m_graph);
        m_graph[edge] = pair<int, int>(c->m_sourceIndex, c->m_sinkIndex);

        /* bool b is supposed to be set false if the graph is configured to
         * disallow parallel edges (see documentation for add_edge);
         * currently this is not how our graph is set up.
         * if this can be set, then we don't need to hunt for duplicate edges */
    }
    else
    {
        /* probably want to throw an exception here instead of this nonsense */
        printf("- refusing to add a duplicate edge\n");
    }

    dumpGraph();
}

void Scheduler::dumpGraph(void)
{
    printf("\n====================== m_graph summary ======================\n");

    printf("%d vertices\n", num_vertices(m_graph));
    auto v_it = vertices(m_graph);
    for (auto it = v_it.first; it != v_it.second; ++it)
    {
        vertex_t v = *it;
        printf(" + vert: %p\n", m_graph[v]);
    }

    printf("\n%d edges\n", num_edges(m_graph));
    auto e_it = edges(m_graph);
    for (auto it = e_it.first; it != e_it.second; ++it)
    {
        edge_t e = *it;
        auto conn = m_graph[e];

        vertex_t v1 = source(e, m_graph);
        vertex_t v2 = target(e, m_graph);

        printf(" + edge: [ %p idx %d ] -> [ %p idx %d ]\n",
            m_graph[v1], conn.first, m_graph[v2], conn.second);
    }

    printf("=============================================================\n\n");
}

void Scheduler::run(void)
{
    /* Call work on all blocks */
    for (boost::tie(i, end) = vertices(m_graph); i != end; ++i)
    {
        printf("run: calling work on %p\n", *i);
        (*i)->work();
    }

    /* Move samples from source blocks to sink blocks */
    graph_traits < adjacency_list <> >::vertex_iterator i, end;
    for (boost::tie(i, end) = vertices(m_graph); i != end; ++i)
    {
        while (!(*i)->outputEmpty())
        {
            int sample = (*i)->popOutput();
            /* Iterate over all sinks attached to this block */
            graph_traits < adjacency_list <> >::adjacency_iterator ai, a_end;
            for (boost::tie(ai, a_end) = adjacent_vertices(*i, m_graph);
                ai != a_end; ++ai)
            {
                printf("");
                (*ai)->pushInput(sample);
            }
        }
    }
}
<commit_msg>remove non-compiling Scheduler::run<commit_after>#include "Scheduler.h"
#include <cstdio>

using namespace std;
using namespace boost;

void Scheduler::addConnection(Connection *c)
{
    printf("addConnection: source [ %p idx %d ] -> sink [ %p idx %d]\n",
        c->m_sourceBlock, c->m_sourceIndex, c->m_sinkBlock, c->m_sinkIndex);

    vertex_t vert_source, vert_sink;
    bool found_source = false, found_sink = false;

    /* see if the source or sink vertex (or both) is already in the graph */
    auto v_it = vertices(m_graph);
    for (auto it = v_it.first; it != v_it.second; ++it)
    {
        vertex_t v = *it;

        if (m_graph[v] == c->m_sourceBlock)
        {
            printf("- source block %p is already in the graph.\n",
                c->m_sourceBlock);

            vert_source = v;
            found_source = true;
        }
        if (m_graph[v] == c->m_sinkBlock)
        {
            printf("- sink block %p is already in the graph.\n",
                c->m_sinkBlock);

            vert_sink = v;
            found_sink = true;
        }

        if (found_source && found_sink) break;
    }

    /* if source and/or sink were not found, add new vertex(es) to the graph */
    if (!found_source)
    {
        printf("- source block %p is not in the graph; creating.\n",
            c->m_sourceBlock);

        vert_source = add_vertex(m_graph);
        m_graph[vert_source] = c->m_sourceBlock;
    }
    if (!found_sink)
    {
        printf("- sink block %p is not in the graph; creating.\n",
            c->m_sinkBlock);

        vert_sink = add_vertex(m_graph);
        m_graph[vert_sink] = c->m_sinkBlock;
    }

    edge_t edge;
    bool found_edge = false;

    /* see if the edge is already in the graph */
    auto e_it = edges(m_graph);
    for (auto it = e_it.first; it != e_it.second; ++it)
    {
        edge_t e = *it;
        pair<int, int> indices = m_graph[e];

        vertex_t v1 = source(e, m_graph);
        vertex_t v2 = target(e, m_graph);

        if (m_graph[v1] == c->m_sourceBlock && m_graph[v2] == c->m_sinkBlock &&
            indices.first == c->m_sourceIndex && indices.second == c->m_sinkIndex)
        {
            printf("- edge is already in the graph!\n");

            edge = e;
            found_edge = true;

            break;
        }
    }

    /* if edge was not found, add new edge to the graph */
    if (!found_edge)
    {
        printf("- edge does not exist in the graph; creating.\n");

        bool b;
        tie(edge, b) = add_edge(vert_source, vert_sink, m_graph);
        m_graph[edge] = pair<int, int>(c->m_sourceIndex, c->m_sinkIndex);

        /* bool b is supposed to be set false if the graph is configured to
         * disallow parallel edges (see documentation for add_edge);
         * currently this is not how our graph is set up.
         * if this can be set, then we don't need to hunt for duplicate edges */
    }
    else
    {
        /* probably want to throw an exception here instead of this nonsense */
        printf("- refusing to add a duplicate edge\n");
    }

    dumpGraph();
}

void Scheduler::dumpGraph(void)
{
    printf("\n====================== m_graph summary ======================\n");

    printf("%d vertices\n", num_vertices(m_graph));
    auto v_it = vertices(m_graph);
    for (auto it = v_it.first; it != v_it.second; ++it)
    {
        vertex_t v = *it;
        printf(" + vert: %p\n", m_graph[v]);
    }

    printf("\n%d edges\n", num_edges(m_graph));
    auto e_it = edges(m_graph);
    for (auto it = e_it.first; it != e_it.second; ++it)
    {
        edge_t e = *it;
        auto conn = m_graph[e];

        vertex_t v1 = source(e, m_graph);
        vertex_t v2 = target(e, m_graph);

        printf(" + edge: [ %p idx %d ] -> [ %p idx %d ]\n",
            m_graph[v1], conn.first, m_graph[v2], conn.second);
    }

    printf("=============================================================\n\n");
}

void Scheduler::run(void)
{
#if 0
    /* Call work on all blocks */
    for (boost::tie(i, end) = vertices(m_graph); i != end; ++i)
    {
        printf("run: calling work on %p\n", *i);
        (*i)->work();
    }

    /* Move samples from source blocks to sink blocks */
    graph_traits < adjacency_list <> >::vertex_iterator i, end;
    for (boost::tie(i, end) = vertices(m_graph); i != end; ++i)
    {
        while (!(*i)->outputEmpty())
        {
            int sample = (*i)->popOutput();
            /* Iterate over all sinks attached to this block */
            graph_traits < adjacency_list <> >::adjacency_iterator ai, a_end;
            for (boost::tie(ai, a_end) = adjacent_vertices(*i, m_graph);
                ai != a_end; ++ai)
            {
                printf("");
                (*ai)->pushInput(sample);
            }
        }
    }
#endif
}
<|endoftext|>


<commit_before>/*
 *  yosys -- Yosys Open SYnthesis Suite
 *
 *  Copyright (C) 2012  Clifford Wolf <clifford@clifford.at>
 *
 *  Permission to use, copy, modify, and/or distribute this software for any
 *  purpose with or without fee is hereby granted, provided that the above
 *  copyright notice and this permission notice appear in all copies.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 *  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 *  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 *  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 *  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 *  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 *  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#include "kernel/yosys.h"
#include "kernel/sigtools.h"

USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN

template<class T> bool includes(const T &lhs, const T &rhs) {
	return std::includes(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
#include "passes/pmgen/xilinx_dsp_pm.h"

void pack_xilinx_dsp(xilinx_dsp_pm &pm)
{
	auto &st = pm.st_xilinx_dsp;

#if 1
	log("\n");
	log("ffA:   %s\n", log_id(st.ffA, "--"));
	log("ffB:   %s\n", log_id(st.ffB, "--"));
	log("dsp:   %s\n", log_id(st.dsp, "--"));
	log("addAB: %s\n", log_id(st.addAB, "--"));
	log("ffP:   %s\n", log_id(st.ffP, "--"));
	//log("muxP:  %s\n", log_id(st.muxP, "--"));
	log("sigPused: %s\n", log_signal(st.sigPused));
#endif

	log("Analysing %s.%s for Xilinx DSP packing.\n", log_id(pm.module), log_id(st.dsp));

	Cell *cell = st.dsp;
	SigSpec P = st.sigP;

	if (st.addAB) {
		log("  adder %s (%s)\n", log_id(st.addAB), log_id(st.addAB->type));
		cell->setPort("\\C", st.sigC.extend_u0(48, true));
		SigSpec &opmode = cell->connections_.at("\\OPMODE");
		opmode[6] = State::S0;
		opmode[5] = State::S1;
		opmode[4] = State::S1;
		pm.autoremove(st.addAB);
	}

	if (st.clock != SigBit())
	{
		cell->setPort("\\CLK", st.clock);

		if (st.ffA) {
			SigSpec A = cell->getPort("\\A");
			SigSpec D = st.ffA->getPort("\\D");
			SigSpec Q = st.ffA->getPort("\\Q");
			A.replace(Q, D);
			cell->setPort("\\A", A);
			cell->setParam("\\AREG", 1);
			if (st.ffA->type == "$dff")
				cell->setPort("\\CEA2", State::S1);
			//else if (st.ffA->type == "$dffe")
			//	cell->setPort("\\CEA2", st.ffA->getPort("\\EN"));
			else log_abort();
		}
		if (st.ffB) {
			SigSpec B = cell->getPort("\\B");
			SigSpec D = st.ffB->getPort("\\D");
			SigSpec Q = st.ffB->getPort("\\Q");
			B.replace(Q, D);
			cell->setPort("\\B", B);
			cell->setParam("\\BREG", 1);
			if (st.ffB->type == "$dff")
				cell->setPort("\\CEB2", State::S1);
			//else if (st.ffB->type == "$dffe")
			//	cell->setPort("\\CEB2", st.ffB->getPort("\\EN"));
			else log_abort();
		}
		if (st.ffP) {
			SigSpec D;
			//if (st.muxP)
			//	D = st.muxP->getPort("\\B");
			//else
				D = st.ffP->getPort("\\D");
			SigSpec Q = st.ffP->getPort("\\Q");
			P.replace(pm.sigmap(D), Q);
			cell->setParam("\\PREG", State::S1);
			if (st.ffP->type == "$dff")
				cell->setPort("\\CEP", State::S1);
			//else if (st.ffP->type == "$dffe")
			//	cell->setPort("\\CEP", st.ffP->getPort("\\EN"));
			else log_abort();

			st.ffP->connections_.at("\\Q").replace(P, pm.module->addWire(NEW_ID, GetSize(P)));
		}

		log("  clock: %s (%s)", log_signal(st.clock), "posedge");

		if (st.ffA)
			log(" ffA:%s", log_id(st.ffA));

		if (st.ffB)
			log(" ffB:%s", log_id(st.ffB));

		if (st.ffP)
			log(" ffP:%s", log_id(st.ffP));

		log("\n");
	}

	if (GetSize(P) < 48)
		P.append(pm.module->addWire(NEW_ID, 48-GetSize(P)));
	cell->setPort("\\P", P);

	pm.blacklist(cell);
}

struct Ice40DspPass : public Pass {
	Ice40DspPass() : Pass("xilinx_dsp", "Xilinx: pack DSP registers") { }
	void help() YS_OVERRIDE
	{
		//   |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
		log("\n");
		log("    xilinx_dsp [options] [selection]\n");
		log("\n");
		log("Pack registers into Xilinx DSPs\n");
		log("\n");
	}
	void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
	{
		log_header(design, "Executing XILINX_DSP pass (pack DSPs).\n");

		size_t argidx;
		for (argidx = 1; argidx < args.size(); argidx++)
		{
			// if (args[argidx] == "-singleton") {
			// 	singleton_mode = true;
			// 	continue;
			// }
			break;
		}
		extra_args(args, argidx, design);

		for (auto module : design->selected_modules())
			xilinx_dsp_pm(module, module->selected_cells()).run_xilinx_dsp(pack_xilinx_dsp);
	}
} Ice40DspPass;

PRIVATE_NAMESPACE_END
<commit_msg>Rename to XilinxDspPass<commit_after>/*
 *  yosys -- Yosys Open SYnthesis Suite
 *
 *  Copyright (C) 2012  Clifford Wolf <clifford@clifford.at>
 *
 *  Permission to use, copy, modify, and/or distribute this software for any
 *  purpose with or without fee is hereby granted, provided that the above
 *  copyright notice and this permission notice appear in all copies.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 *  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 *  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 *  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 *  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 *  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 *  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#include "kernel/yosys.h"
#include "kernel/sigtools.h"

USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN

template<class T> bool includes(const T &lhs, const T &rhs) {
	return std::includes(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
#include "passes/pmgen/xilinx_dsp_pm.h"

void pack_xilinx_dsp(xilinx_dsp_pm &pm)
{
	auto &st = pm.st_xilinx_dsp;

#if 1
	log("\n");
	log("ffA:   %s\n", log_id(st.ffA, "--"));
	log("ffB:   %s\n", log_id(st.ffB, "--"));
	log("dsp:   %s\n", log_id(st.dsp, "--"));
	log("addAB: %s\n", log_id(st.addAB, "--"));
	log("ffP:   %s\n", log_id(st.ffP, "--"));
	//log("muxP:  %s\n", log_id(st.muxP, "--"));
	log("sigPused: %s\n", log_signal(st.sigPused));
#endif

	log("Analysing %s.%s for Xilinx DSP packing.\n", log_id(pm.module), log_id(st.dsp));

	Cell *cell = st.dsp;
	SigSpec P = st.sigP;

	if (st.addAB) {
		log("  adder %s (%s)\n", log_id(st.addAB), log_id(st.addAB->type));
		cell->setPort("\\C", st.sigC.extend_u0(48, true));
		SigSpec &opmode = cell->connections_.at("\\OPMODE");
		opmode[6] = State::S0;
		opmode[5] = State::S1;
		opmode[4] = State::S1;
		pm.autoremove(st.addAB);
	}

	if (st.clock != SigBit())
	{
		cell->setPort("\\CLK", st.clock);

		if (st.ffA) {
			SigSpec A = cell->getPort("\\A");
			SigSpec D = st.ffA->getPort("\\D");
			SigSpec Q = st.ffA->getPort("\\Q");
			A.replace(Q, D);
			cell->setPort("\\A", A);
			cell->setParam("\\AREG", 1);
			if (st.ffA->type == "$dff")
				cell->setPort("\\CEA2", State::S1);
			//else if (st.ffA->type == "$dffe")
			//	cell->setPort("\\CEA2", st.ffA->getPort("\\EN"));
			else log_abort();
		}
		if (st.ffB) {
			SigSpec B = cell->getPort("\\B");
			SigSpec D = st.ffB->getPort("\\D");
			SigSpec Q = st.ffB->getPort("\\Q");
			B.replace(Q, D);
			cell->setPort("\\B", B);
			cell->setParam("\\BREG", 1);
			if (st.ffB->type == "$dff")
				cell->setPort("\\CEB2", State::S1);
			//else if (st.ffB->type == "$dffe")
			//	cell->setPort("\\CEB2", st.ffB->getPort("\\EN"));
			else log_abort();
		}
		if (st.ffP) {
			SigSpec D;
			//if (st.muxP)
			//	D = st.muxP->getPort("\\B");
			//else
				D = st.ffP->getPort("\\D");
			SigSpec Q = st.ffP->getPort("\\Q");
			P.replace(pm.sigmap(D), Q);
			cell->setParam("\\PREG", State::S1);
			if (st.ffP->type == "$dff")
				cell->setPort("\\CEP", State::S1);
			//else if (st.ffP->type == "$dffe")
			//	cell->setPort("\\CEP", st.ffP->getPort("\\EN"));
			else log_abort();

			st.ffP->connections_.at("\\Q").replace(P, pm.module->addWire(NEW_ID, GetSize(P)));
		}

		log("  clock: %s (%s)", log_signal(st.clock), "posedge");

		if (st.ffA)
			log(" ffA:%s", log_id(st.ffA));

		if (st.ffB)
			log(" ffB:%s", log_id(st.ffB));

		if (st.ffP)
			log(" ffP:%s", log_id(st.ffP));

		log("\n");
	}

	if (GetSize(P) < 48)
		P.append(pm.module->addWire(NEW_ID, 48-GetSize(P)));
	cell->setPort("\\P", P);

	pm.blacklist(cell);
}

struct XilinxDspPass : public Pass {
	XilinxDspPass() : Pass("xilinx_dsp", "Xilinx: pack DSP registers") { }
	void help() YS_OVERRIDE
	{
		//   |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
		log("\n");
		log("    xilinx_dsp [options] [selection]\n");
		log("\n");
		log("Pack registers into Xilinx DSPs\n");
		log("\n");
	}
	void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
	{
		log_header(design, "Executing XILINX_DSP pass (pack DSPs).\n");

		size_t argidx;
		for (argidx = 1; argidx < args.size(); argidx++)
		{
			// if (args[argidx] == "-singleton") {
			// 	singleton_mode = true;
			// 	continue;
			// }
			break;
		}
		extra_args(args, argidx, design);

		for (auto module : design->selected_modules())
			xilinx_dsp_pm(module, module->selected_cells()).run_xilinx_dsp(pack_xilinx_dsp);
	}
} XilinxDspPass;

PRIVATE_NAMESPACE_END
<|endoftext|>


<commit_before>/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2016 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#include "xenia/gpu/vulkan/vulkan_shader.h"

#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/ui/vulkan/vulkan_util.h"

namespace xe {
namespace gpu {
namespace vulkan {

using xe::ui::vulkan::CheckResult;

VulkanShader::VulkanShader(VkDevice device, ShaderType shader_type,
                           uint64_t data_hash, const uint32_t* dword_ptr,
                           uint32_t dword_count)
    : Shader(shader_type, data_hash, dword_ptr, dword_count), device_(device) {}

VulkanShader::~VulkanShader() {
  if (shader_module_) {
    vkDestroyShaderModule(device_, shader_module_, nullptr);
    shader_module_ = nullptr;
  }
}

bool VulkanShader::Prepare() {
  assert_null(shader_module_);
  assert_true(is_valid());

  // Create the shader module.
  VkShaderModuleCreateInfo shader_info;
  shader_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
  shader_info.pNext = nullptr;
  shader_info.flags = 0;
  shader_info.codeSize = translated_binary_.size();
  shader_info.pCode =
      reinterpret_cast<const uint32_t*>(translated_binary_.data());
  auto err =
      vkCreateShaderModule(device_, &shader_info, nullptr, &shader_module_);
  CheckResult(err, "vkCreateShaderModule");

  return true;
}

}  // namespace vulkan
}  // namespace gpu
}  // namespace xe
<commit_msg>VulkanShader::Prepare - return false if vkCreateShaderModule failed.<commit_after>/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2016 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#include "xenia/gpu/vulkan/vulkan_shader.h"

#include "xenia/base/assert.h"
#include "xenia/base/logging.h"
#include "xenia/base/math.h"
#include "xenia/ui/vulkan/vulkan_util.h"

namespace xe {
namespace gpu {
namespace vulkan {

using xe::ui::vulkan::CheckResult;

VulkanShader::VulkanShader(VkDevice device, ShaderType shader_type,
                           uint64_t data_hash, const uint32_t* dword_ptr,
                           uint32_t dword_count)
    : Shader(shader_type, data_hash, dword_ptr, dword_count), device_(device) {}

VulkanShader::~VulkanShader() {
  if (shader_module_) {
    vkDestroyShaderModule(device_, shader_module_, nullptr);
    shader_module_ = nullptr;
  }
}

bool VulkanShader::Prepare() {
  assert_null(shader_module_);
  assert_true(is_valid());

  // Create the shader module.
  VkShaderModuleCreateInfo shader_info;
  shader_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
  shader_info.pNext = nullptr;
  shader_info.flags = 0;
  shader_info.codeSize = translated_binary_.size();
  shader_info.pCode =
      reinterpret_cast<const uint32_t*>(translated_binary_.data());
  auto status =
      vkCreateShaderModule(device_, &shader_info, nullptr, &shader_module_);
  CheckResult(status, "vkCreateShaderModule");

  return status == VK_SUCCESS;
}

}  // namespace vulkan
}  // namespace gpu
}  // namespace xe
<|endoftext|>


<commit_before>#ifndef SESSION_H
#define SESSION_H

#include <chrono>
#include <string>

namespace pastec {
  using Time = std::chrono::time_point<std::chrono::system_clock>;
  using Key  = std::string;
  using Data = std::string;

  class Session {
  public:
    Session(const Key& key, const Data& data, const std::chrono::seconds& lifeTime) noexcept
    : m_key(key)
    , m_data(data)
    , m_startUpTime(std::chrono::system_clock::now())
    , m_endLifeTime(m_startUpTime + std::chrono::seconds(lifeTime)) { }

    void setData(const Data& data, const std::chrono::seconds& lifeTime) noexcept {
      m_data = data;
      setTime(lifeTime);
    }

    void setTime(const std::chrono::seconds& lifeTime) noexcept {
      m_startUpTime = std::chrono::system_clock::now();
      m_endLifeTime = m_startUpTime + std::chrono::seconds (lifeTime);
    }

  public:
    Key  key()         const noexcept { return m_key;         }
    Data data()        const noexcept { return m_data;        }
    Time startUpTime() const noexcept { return m_startUpTime; }
    Time endTime()     const noexcept { return m_endLifeTime; }

    int remainingTime() const noexcept {
      return std::chrono::duration_cast<std::chrono::seconds>(m_endLifeTime - m_startUpTime).count();
    }

    bool isExpired() const noexcept {
      return std::chrono::system_clock::now() > m_endLifeTime;
    }

  private:
    Key  m_key;
    Data m_data;
    Time m_startUpTime;
    Time m_endLifeTime;
  };
}

#endif // SESSION_H
<commit_msg>delete unused class Session<commit_after><|endoftext|>


<commit_before>/***
  This file is part of libblake2

  Copyright 2015 Mirco Tischler

  libblake2 is free software; you can redistribute it and/or modify it
  under the terms of the GNU Lesser General Public License as published by
  the Free Software Foundation; either version 2.1 of the License, or
  (at your option) any later version.

  libblake2 is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with libblake2; If not, see <http://www.gnu.org/licenses/>.
 ***/

#pragma once

#include <array>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>

namespace Blake2 {

using std::array;
using std::begin;
using std::memcpy;
using std::string;
using std::vector;

class Blake2b {
    public:
	using hash_t = array<uint64_t, 8>;
	using salt_t = array<uint64_t, 2>;
	using personalization_t = array<uint64_t, 2>;

	Blake2b(const unsigned int &digestLength,
		const unsigned int &keyLength,
		const salt_t &salt,
		const personalization_t &personalization);

	Blake2b() {
		setup_parameter_block();
	}

	hash_t operator()(const string &data);
	hash_t operator()(const vector<uint64_t> &data);
	hash_t operator()(const char *data, const size_t &len);

	void set_digest_length(const size_t &digest_length);
	void set_salt(const salt_t &salt);
	void set_personalization(const personalization_t &personalization);

	static uint64_t initialization_vector(const size_t &i) {
		assert(i < 8);
		return i_v[i];
	}

	static uint64_t permutation_matrix(const size_t &i, const size_t &j) {
		assert(j < 16);
		return p_m[i][j];
	}
	static string to_string(const hash_t &hash);

    private:
	using s_t = array<unsigned int, 16>;
	using sigma_t = array<s_t, 12>;

	void setup_parameter_block();
	hash_t initialize_h() const;
	template<class Container>
	hash_t hash_internal(const Container &v_m, const size_t &orig_size);

	static constexpr auto i_v = hash_t{
		{
			0x6a09e667f3bcc908ULL,
			0xbb67ae8584caa73bULL,
			0x3c6ef372fe94f82bULL,
			0xa54ff53a5f1d36f1ULL,
			0x510e527fade682d1ULL,
			0x9b05688c2b3e6c1fULL,
			0x1f83d9abfb41bd6bULL,
			0x5be0cd19137e2179ULL
		}
	};

	static constexpr auto p_m = sigma_t{
		{
			s_t
			{
				{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
			},
			s_t
			{
				{14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3}
			},
			s_t
			{
				{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4}
			},
			s_t
			{
				{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8}
			},
			s_t
			{
				{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13}
			},
			s_t
			{
				{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9}
			},
			s_t
			{
				{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11}
			},
			s_t
			{
				{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10}
			},
			s_t
			{
				{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5}
			},
			s_t
			{
				{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0}
			},
			s_t
			{
				{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
			},
			s_t
			{
				{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3}
			}
		}
	};

	struct ParameterBlock {
		uint8_t digest_length;
		uint8_t key_length;
		uint8_t fanout;
		uint8_t depth;
		uint32_t leaf_length;
		uint64_t node_offset;
		uint8_t node_depth;
		uint8_t inner_length;
		uint8_t RFU[14];
		salt_t salt;
		personalization_t personalization;
	};

	// make this a union so we don't have to do even more ugly casts

	union ParameterBlockUnion {
		struct ParameterBlock pbs;
		array<uint64_t, 8> pba;
	};
	ParameterBlockUnion parameter_block;

};

} // namespace Blake2
<commit_msg>compiletime check the sizes of ParameterBlock union match<commit_after>/***
  This file is part of libblake2

  Copyright 2015 Mirco Tischler

  libblake2 is free software; you can redistribute it and/or modify it
  under the terms of the GNU Lesser General Public License as published by
  the Free Software Foundation; either version 2.1 of the License, or
  (at your option) any later version.

  libblake2 is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with libblake2; If not, see <http://www.gnu.org/licenses/>.
 ***/

#pragma once

#include <array>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>

namespace Blake2 {

using std::array;
using std::begin;
using std::memcpy;
using std::string;
using std::vector;

class Blake2b {
    public:
	using hash_t = array<uint64_t, 8>;
	using salt_t = array<uint64_t, 2>;
	using personalization_t = array<uint64_t, 2>;

	Blake2b(const unsigned int &digestLength,
		const unsigned int &keyLength,
		const salt_t &salt,
		const personalization_t &personalization);

	Blake2b() {
		setup_parameter_block();
	}

	hash_t operator()(const string &data);
	hash_t operator()(const vector<uint64_t> &data);
	hash_t operator()(const char *data, const size_t &len);

	void set_digest_length(const size_t &digest_length);
	void set_salt(const salt_t &salt);
	void set_personalization(const personalization_t &personalization);

	static uint64_t initialization_vector(const size_t &i) {
		assert(i < 8);
		return i_v[i];
	}

	static uint64_t permutation_matrix(const size_t &i, const size_t &j) {
		assert(j < 16);
		return p_m[i][j];
	}
	static string to_string(const hash_t &hash);

    private:
	using s_t = array<unsigned int, 16>;
	using sigma_t = array<s_t, 12>;

	void setup_parameter_block();
	hash_t initialize_h() const;
	template<class Container>
	hash_t hash_internal(const Container &v_m, const size_t &orig_size);

	static constexpr auto i_v = hash_t{
		{
			0x6a09e667f3bcc908ULL,
			0xbb67ae8584caa73bULL,
			0x3c6ef372fe94f82bULL,
			0xa54ff53a5f1d36f1ULL,
			0x510e527fade682d1ULL,
			0x9b05688c2b3e6c1fULL,
			0x1f83d9abfb41bd6bULL,
			0x5be0cd19137e2179ULL
		}
	};

	static constexpr auto p_m = sigma_t{
		{
			s_t
			{
				{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
			},
			s_t
			{
				{14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3}
			},
			s_t
			{
				{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4}
			},
			s_t
			{
				{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8}
			},
			s_t
			{
				{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13}
			},
			s_t
			{
				{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9}
			},
			s_t
			{
				{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11}
			},
			s_t
			{
				{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10}
			},
			s_t
			{
				{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5}
			},
			s_t
			{
				{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0}
			},
			s_t
			{
				{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
			},
			s_t
			{
				{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3}
			}
		}
	};

	struct ParameterBlock {
		uint8_t digest_length;
		uint8_t key_length;
		uint8_t fanout;
		uint8_t depth;
		uint32_t leaf_length;
		uint64_t node_offset;
		uint8_t node_depth;
		uint8_t inner_length;
		uint8_t RFU[14];
		salt_t salt;
		personalization_t personalization;
	};

	// make this a union so we don't have to do even more ugly casts

	union ParameterBlockUnion {
		struct ParameterBlock pbs;
		array<uint64_t, 8> pba;
	};
	ParameterBlockUnion parameter_block;

	static_assert(sizeof(struct ParameterBlock) == sizeof(array<uint64_t, 8>), "size mismatch");
};

} // namespace Blake2
<|endoftext|>


<commit_before>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/tools/test_shell/notification_presenter.h"

#include "googleurl/src/gurl.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotification.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotificationPermissionCallback.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"

using WebKit::WebNotification;
using WebKit::WebNotificationPresenter;
using WebKit::WebNotificationPermissionCallback;
using WebKit::WebSecurityOrigin;
using WebKit::WebString;
using WebKit::WebURL;

void TestNotificationPresenter::grantPermission(const std::string& origin) {
  // Make sure it's in the form of an origin.
  GURL url(origin);
  allowed_origins_.insert(url.GetOrigin().spec());
}

// The output from all these methods matches what DumpRenderTree produces.
bool TestNotificationPresenter::show(const WebNotification& notification) {
  if (notification.isHTML()) {
    printf("DESKTOP NOTIFICATION: contents at %s\n",
           notification.url().spec().data());
  } else {
    printf("DESKTOP NOTIFICATION: icon %s, title %s, text %s\n",
           notification.icon().utf8().data(),
           notification.title().utf8().data(),
           notification.body().utf8().data());
  }

  WebNotification event_target(notification);
  event_target.dispatchDisplayEvent();
  return true;
}

void TestNotificationPresenter::cancel(const WebNotification& notification) {
  WebString identifier;
  if (notification.isHTML())
    identifier = notification.url().spec().utf16();
  else
    identifier = notification.title();

  printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data());
  WebNotification event_target(notification);
  event_target.dispatchCloseEvent(false);
}

void TestNotificationPresenter::objectDestroyed(
    const WebKit::WebNotification& notification) {
  // Nothing to do.  Not storing the objects.
}

WebNotificationPresenter::Permission TestNotificationPresenter::checkPermission(
    const WebURL& url) {
  // Check with the layout test controller
  std::string origin = static_cast<GURL>(url).GetOrigin().spec();
  bool allowed = allowed_origins_.find(origin) != allowed_origins_.end();
  return allowed ? WebNotificationPresenter::PermissionAllowed
                 : WebNotificationPresenter::PermissionDenied;
}

void TestNotificationPresenter::requestPermission(
    const WebSecurityOrigin& origin,
    WebNotificationPermissionCallback* callback) {
  printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n",
         origin.toString().utf8().data());
  callback->permissionRequestComplete();
}
<commit_msg>Migrate to WebNotification::iconURL in src/webkit/tools/test_shell/notification_presenter.cc<commit_after>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/tools/test_shell/notification_presenter.h"

#include "googleurl/src/gurl.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotification.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNotificationPermissionCallback.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"

using WebKit::WebNotification;
using WebKit::WebNotificationPresenter;
using WebKit::WebNotificationPermissionCallback;
using WebKit::WebSecurityOrigin;
using WebKit::WebString;
using WebKit::WebURL;

void TestNotificationPresenter::grantPermission(const std::string& origin) {
  // Make sure it's in the form of an origin.
  GURL url(origin);
  allowed_origins_.insert(url.GetOrigin().spec());
}

// The output from all these methods matches what DumpRenderTree produces.
bool TestNotificationPresenter::show(const WebNotification& notification) {
  if (notification.isHTML()) {
    printf("DESKTOP NOTIFICATION: contents at %s\n",
           notification.url().spec().data());
  } else {
    printf("DESKTOP NOTIFICATION: icon %s, title %s, text %s\n",
           notification.iconURL().spec().data(),
           notification.title().utf8().data(),
           notification.body().utf8().data());
  }

  WebNotification event_target(notification);
  event_target.dispatchDisplayEvent();
  return true;
}

void TestNotificationPresenter::cancel(const WebNotification& notification) {
  WebString identifier;
  if (notification.isHTML())
    identifier = notification.url().spec().utf16();
  else
    identifier = notification.title();

  printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data());
  WebNotification event_target(notification);
  event_target.dispatchCloseEvent(false);
}

void TestNotificationPresenter::objectDestroyed(
    const WebKit::WebNotification& notification) {
  // Nothing to do.  Not storing the objects.
}

WebNotificationPresenter::Permission TestNotificationPresenter::checkPermission(
    const WebURL& url) {
  // Check with the layout test controller
  std::string origin = static_cast<GURL>(url).GetOrigin().spec();
  bool allowed = allowed_origins_.find(origin) != allowed_origins_.end();
  return allowed ? WebNotificationPresenter::PermissionAllowed
                 : WebNotificationPresenter::PermissionDenied;
}

void TestNotificationPresenter::requestPermission(
    const WebSecurityOrigin& origin,
    WebNotificationPermissionCallback* callback) {
  printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n",
         origin.toString().utf8().data());
  callback->permissionRequestComplete();
}
<|endoftext|>


<commit_before>#include "RefereeCom.h"

RefereeCom::RefereeCom(const std::string &name): ConfigurableModule(name)
{
	AddSetting("Field", [this]{return std::string(1,this->FIELD_MARKER);}, [this]{this->nextField();});
	AddSetting("Team", [this]{return std::string(1,this->TEAM_MARKER);}, [this]{this->nextTeam();});
	AddSetting("Robot", [this]{return std::string(1,this->ROBOT_MARKER);}, [this]{this->nextRobot();});
	LoadSettings();
}

bool RefereeCom::isCommandAvailable() {
	return !commandQueue.empty();
}

REFCOMMAND RefereeCom::getNextCommand() {
	REFCOMMAND nextCommand = commandQueue.front();
	commandQueue.pop();
	return nextCommand;
}

void RefereeCom::giveCommand(REFCOMMAND command) {
	commandQueue.push(command);
}

void RefereeCom::nextField() {
	if (FIELD_MARKER == 'A') {
		FIELD_MARKER = 'B';
	}
	else {
		FIELD_MARKER = 'A';
	}
}

void RefereeCom::nextTeam() {
	if (TEAM_MARKER == 'A') {
		TEAM_MARKER = 'B';
	}
	else {
		TEAM_MARKER = 'A';
	}
}

void RefereeCom::nextRobot() {
	if (ROBOT_MARKER == 'A') {
		ROBOT_MARKER = 'B';
	}
	else if (ROBOT_MARKER == 'B') {
		ROBOT_MARKER = 'C';
	}
	else if (ROBOT_MARKER == 'C') {
		ROBOT_MARKER = 'D';
	}
	else if (ROBOT_MARKER == 'D') {
		ROBOT_MARKER = 'A';
	}
}

/**********************************
* HARDWARE RECEIVER IMPLEMENTATION
***********************************/
LLAPReceiver::LLAPReceiver(boost::asio::io_service &io_service, std::string port, unsigned int baud_rate, const std::string &name)
	: RefereeCom(name), SimpleSerial(io_service, port, baud_rate), ThreadedClass(name) {}

LLAPReceiver::~LLAPReceiver()
{
	WaitForStop();
}

void LLAPReceiver::Run() {
	std::cout << "Referee listener starting" << std::endl;
	std::string command;
	while (!stop_thread){
		command = readNumberOfCharsAsync(12);
		if (command.length() == 12 && command.at(0) == 'a' && command.at(1) == FIELD_MARKER && (command.at(2) == ALL_MARKER || command.at(2) == ROBOT_MARKER)) {
			if (command.at(2) == ROBOT_MARKER) writeString("a" + std::string(1, FIELD_MARKER) + std::string(1, ROBOT_MARKER) + "ACK------");
			command = command.substr(3);
			if (command == "START----") commandQueue.push(START);
			else if (command == "STOP-----") commandQueue.push(STOP);
			else if (command == "PLACEDBAL") commandQueue.push(PLACED_BALL);
			else if (command == "ENDHALF--") commandQueue.push(END_HALF);
			else if (command.at(0) == TEAM_MARKER) {
				command = command.substr(1);
				if (command == "KICKOFF-") commandQueue.push(KICK_OFF);
				else if (command == "IFREEK--") commandQueue.push(INDIRECT_FREE_KICK);
				else if (command == "DFREEK--") commandQueue.push(INDIRECT_FREE_KICK);
				else if (command == "GOALK---") commandQueue.push(GOAL_KICK);
				else if (command == "THROWIN-") commandQueue.push(THROW_IN);
				else if (command == "CORNERK-") commandQueue.push(CORNER_KICK);
				else if (command == "PENALTY-") commandQueue.push(PENALTY);
				else if (command == "GOAL----") commandQueue.push(GOAL);
				else if (command == "CARDY---") commandQueue.push(YELLOW_CARD);
			}
		}
		std::this_thread::sleep_for(std::chrono::milliseconds(50)); // do not poll serial to fast
	}
	std::cout << "Referee listener stoping" << std::endl;
}<commit_msg>Fix - direct kick instead of double indirect<commit_after>#include "RefereeCom.h"

RefereeCom::RefereeCom(const std::string &name): ConfigurableModule(name)
{
	AddSetting("Field", [this]{return std::string(1,this->FIELD_MARKER);}, [this]{this->nextField();});
	AddSetting("Team", [this]{return std::string(1,this->TEAM_MARKER);}, [this]{this->nextTeam();});
	AddSetting("Robot", [this]{return std::string(1,this->ROBOT_MARKER);}, [this]{this->nextRobot();});
	LoadSettings();
}

bool RefereeCom::isCommandAvailable() {
	return !commandQueue.empty();
}

REFCOMMAND RefereeCom::getNextCommand() {
	REFCOMMAND nextCommand = commandQueue.front();
	commandQueue.pop();
	return nextCommand;
}

void RefereeCom::giveCommand(REFCOMMAND command) {
	commandQueue.push(command);
}

void RefereeCom::nextField() {
	if (FIELD_MARKER == 'A') {
		FIELD_MARKER = 'B';
	}
	else {
		FIELD_MARKER = 'A';
	}
}

void RefereeCom::nextTeam() {
	if (TEAM_MARKER == 'A') {
		TEAM_MARKER = 'B';
	}
	else {
		TEAM_MARKER = 'A';
	}
}

void RefereeCom::nextRobot() {
	if (ROBOT_MARKER == 'A') {
		ROBOT_MARKER = 'B';
	}
	else if (ROBOT_MARKER == 'B') {
		ROBOT_MARKER = 'C';
	}
	else if (ROBOT_MARKER == 'C') {
		ROBOT_MARKER = 'D';
	}
	else if (ROBOT_MARKER == 'D') {
		ROBOT_MARKER = 'A';
	}
}

/**********************************
* HARDWARE RECEIVER IMPLEMENTATION
***********************************/
LLAPReceiver::LLAPReceiver(boost::asio::io_service &io_service, std::string port, unsigned int baud_rate, const std::string &name)
	: RefereeCom(name), SimpleSerial(io_service, port, baud_rate), ThreadedClass(name) {}

LLAPReceiver::~LLAPReceiver()
{
	WaitForStop();
}

void LLAPReceiver::Run() {
	std::cout << "Referee listener starting" << std::endl;
	std::string command;
	while (!stop_thread){
		command = readNumberOfCharsAsync(12);
		if (command.length() == 12 && command.at(0) == 'a' && command.at(1) == FIELD_MARKER && (command.at(2) == ALL_MARKER || command.at(2) == ROBOT_MARKER)) {
			if (command.at(2) == ROBOT_MARKER) writeString("a" + std::string(1, FIELD_MARKER) + std::string(1, ROBOT_MARKER) + "ACK------");
			command = command.substr(3);
			if (command == "START----") commandQueue.push(START);
			else if (command == "STOP-----") commandQueue.push(STOP);
			else if (command == "PLACEDBAL") commandQueue.push(PLACED_BALL);
			else if (command == "ENDHALF--") commandQueue.push(END_HALF);
			else if (command.at(0) == TEAM_MARKER) {
				command = command.substr(1);
				if (command == "KICKOFF-") commandQueue.push(KICK_OFF);
				else if (command == "IFREEK--") commandQueue.push(INDIRECT_FREE_KICK);
				else if (command == "DFREEK--") commandQueue.push(DIRECT_FREE_KICK);
				else if (command == "GOALK---") commandQueue.push(GOAL_KICK);
				else if (command == "THROWIN-") commandQueue.push(THROW_IN);
				else if (command == "CORNERK-") commandQueue.push(CORNER_KICK);
				else if (command == "PENALTY-") commandQueue.push(PENALTY);
				else if (command == "GOAL----") commandQueue.push(GOAL);
				else if (command == "CARDY---") commandQueue.push(YELLOW_CARD);
			}
		}
		std::this_thread::sleep_for(std::chrono::milliseconds(50)); // do not poll serial to fast
	}
	std::cout << "Referee listener stoping" << std::endl;
}<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: VIndexColumn.hxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: oj $ $Date: 2001-03-02 15:26:26 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_

#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
#include "connectivity/sdbcx/VColumn.hxx"
#endif

namespace connectivity
{
    namespace sdbcx
    {
        class OIndexColumn;
        typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP;

        class OIndexColumn :    public OColumn,
                                public OIndexColumn_PROP
        {
        protected:
            sal_Bool    m_IsAscending;
            virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
            virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
        public:
            OIndexColumn(   sal_Bool _bCase);
            OIndexColumn(   sal_Bool _IsAscending,
                            const ::rtl::OUString& _Name,
                            const ::rtl::OUString& _TypeName,
                            const ::rtl::OUString& _DefaultValue,
                            sal_Int32       _IsNullable,
                            sal_Int32       _Precision,
                            sal_Int32       _Scale,
                            sal_Int32       _Type,
                            sal_Bool        _IsAutoIncrement,
                            sal_Bool        _IsRowVersion,
                            sal_Bool        _IsCurrency,
                            sal_Bool        _bCase);

            virtual void construct();
            DECLARE_SERVICE_INFO();
        };
    }
}
#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_

<commit_msg>INTEGRATION: CWS ooo19126 (1.5.356); FILE MERGED 2005/09/05 17:22:43 rt 1.5.356.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: VIndexColumn.hxx,v $
 *
 *  $Revision: 1.6 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-08 05:04:49 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_

#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
#include "connectivity/sdbcx/VColumn.hxx"
#endif

namespace connectivity
{
    namespace sdbcx
    {
        class OIndexColumn;
        typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP;

        class OIndexColumn :    public OColumn,
                                public OIndexColumn_PROP
        {
        protected:
            sal_Bool    m_IsAscending;
            virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
            virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
        public:
            OIndexColumn(   sal_Bool _bCase);
            OIndexColumn(   sal_Bool _IsAscending,
                            const ::rtl::OUString& _Name,
                            const ::rtl::OUString& _TypeName,
                            const ::rtl::OUString& _DefaultValue,
                            sal_Int32       _IsNullable,
                            sal_Int32       _Precision,
                            sal_Int32       _Scale,
                            sal_Int32       _Type,
                            sal_Bool        _IsAutoIncrement,
                            sal_Bool        _IsRowVersion,
                            sal_Bool        _IsCurrency,
                            sal_Bool        _bCase);

            virtual void construct();
            DECLARE_SERVICE_INFO();
        };
    }
}
#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_

<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: MABNSInit.hxx,v $
 *
 *  $Revision: 1.4 $
 *
 *  last change: $Author: oj $ $Date: 2001-07-03 10:21:57 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): Darren Kenny
 *
 *
 ************************************************************************/

#ifndef _CONNECTIVITY_MAB_NS_INIT_HXX_
#define _CONNECTIVITY_MAB_NS_INIT_HXX_ 1

#include <sal/types.h>

sal_Bool MAB_NS_Init(sal_Bool& aProfileExists);

sal_Bool MAB_NS_Term();

#endif // _CONNECTIVITY_MAB_NS_INIT_HXX_ 1

<commit_msg>INTEGRATION: CWS ooo19126 (1.4.348); FILE MERGED 2005/09/05 17:25:39 rt 1.4.348.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: MABNSInit.hxx,v $
 *
 *  $Revision: 1.5 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-08 07:29:17 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _CONNECTIVITY_MAB_NS_INIT_HXX_
#define _CONNECTIVITY_MAB_NS_INIT_HXX_ 1

#include <sal/types.h>

sal_Bool MAB_NS_Init(sal_Bool& aProfileExists);

sal_Bool MAB_NS_Term();

#endif // _CONNECTIVITY_MAB_NS_INIT_HXX_ 1

<|endoftext|>


<commit_before>//This is Test.cpp File
<commit_msg>Delete Src.cpp<commit_after><|endoftext|>