;; Intrinsic patterns description of Andes NDS32 cpu for GNU compiler
;; Copyright (C) 2012-2020 Free Software Foundation, Inc.
;; Contributed by Andes Technology Corporation.
;;
;; This file is part of GCC.
;;
;; GCC is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published
;; by the Free Software Foundation; either version 3, or (at your
;; option) any later version.
;;
;; GCC 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 General Public
;; License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GCC; see the file COPYING3.  If not see
;; <http://www.gnu.org/licenses/>.

;; ------------------------------------------------------------------------

;; Register Transfer.

(define_insn "unspec_volatile_mfsr"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_VOLATILE_MFSR))]
  ""
  "mfsr\t%0, %V1"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_volatile_mfusr"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_VOLATILE_MFUSR))]
  ""
  "mfusr\t%0, %V1"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_expand "mtsr_isb"
  [(set (match_operand:SI 0 "register_operand" "")
	(match_operand:SI 1 "immediate_operand" ""))]
  ""
{
  emit_insn (gen_unspec_volatile_mtsr (operands[0], operands[1]));
  emit_insn (gen_unspec_volatile_isb());
  DONE;
})

(define_expand "mtsr_dsb"
  [(set (match_operand:SI 0 "register_operand" "")
	(match_operand:SI 1 "immediate_operand" ""))]
  ""
{
  emit_insn (gen_unspec_volatile_mtsr (operands[0], operands[1]));
  emit_insn (gen_unspec_dsb());
  DONE;
})

(define_insn "unspec_volatile_mtsr"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
			(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_VOLATILE_MTSR)]
  ""
  "mtsr\t%0, %V1"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_volatile_mtusr"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
			(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_VOLATILE_MTUSR)]
  ""
  "mtusr\t%0, %V1"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

;; FPU Register Transfer.

(define_insn "unspec_fcpynsd"
   [(set (match_operand:DF 0 "register_operand" "=f")
	 (unspec:DF [(match_operand:DF 1 "register_operand" "f")
		     (match_operand:DF 2 "register_operand" "f")] UNSPEC_FCPYNSD))]
  ""
  "fcpynsd\t%0, %1, %2"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_fcpynss"
   [(set (match_operand:SF 0 "register_operand" "=f")
	 (unspec:SF [(match_operand:SF 1 "register_operand" "f")
		     (match_operand:SF 2 "register_operand" "f")] UNSPEC_FCPYNSS))]
  ""
  "fcpynss\t%0, %1, %2"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_fcpysd"
   [(set (match_operand:DF 0 "register_operand" "=f")
	 (unspec:DF [(match_operand:DF 1 "register_operand" "f")
		     (match_operand:DF 2 "register_operand" "f")] UNSPEC_FCPYSD))]
  ""
  "fcpysd\t%0, %1, %2"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_fcpyss"
   [(set (match_operand:SF 0 "register_operand" "=f")
	 (unspec:SF [(match_operand:SF 1 "register_operand" "f")
		     (match_operand:SF 2 "register_operand" "f")] UNSPEC_FCPYSS))]
  ""
  "fcpyss\t%0, %1, %2"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_fmfcsr"
   [(set (match_operand:SI 0 "register_operand" "=r")
	 (unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_FMFCSR))]
  ""
  "fmfcsr\t%0"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_fmtcsr"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_FMTCSR)]
  ""
  "fmtcsr\t%0"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_fmfcfg"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_FMFCFG))]
  ""
  "fmfcfg\t%0"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

;; ------------------------------------------------------------------------

;; Interrupt Instructions.

(define_insn "unspec_volatile_setgie_en"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_SETGIE_EN)]
  ""
  "setgie.e"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_volatile_setgie_dis"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_SETGIE_DIS)]
  ""
  "setgie.d"
  [(set_attr "type" "misc")]
)

(define_expand "unspec_enable_int"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "")] UNSPEC_VOLATILE_ENABLE_INT)]
  ""
{
  rtx system_reg;
  rtx temp_reg = gen_reg_rtx (SImode);

  /* Set system register form nds32_intrinsic_register_names[].  */
  if ((INTVAL (operands[0]) >= NDS32_INT_H16)
      && (INTVAL (operands[0]) <= NDS32_INT_H31))
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_MASK2__);
      operands[0] = GEN_INT (1 << (INTVAL (operands[0])));
    }
  else if ((INTVAL (operands[0]) >= NDS32_INT_H32)
	   && (INTVAL (operands[0]) <= NDS32_INT_H63))
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_MASK3__);
      operands[0] = GEN_INT (1 << (INTVAL (operands[0]) - 32));
    }
  else
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_MASK__);

      if (INTVAL (operands[0]) == NDS32_INT_SWI)
        operands[0] = GEN_INT (1 << 16);
      else if ((INTVAL (operands[0]) >= NDS32_INT_ALZ)
	       && (INTVAL (operands[0]) <= NDS32_INT_DSSIM))
	operands[0] = GEN_INT (1 << (INTVAL (operands[0]) - 4));
      else
	operands[0] = GEN_INT (1 << (INTVAL (operands[0])));
    }

  emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
  emit_insn (gen_iorsi3 (temp_reg, temp_reg, operands[0]));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

(define_expand "unspec_disable_int"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "")] UNSPEC_VOLATILE_DISABLE_INT)]
  ""
{
  rtx system_reg;
  rtx temp_reg = gen_reg_rtx (SImode);

  /* Set system register form nds32_intrinsic_register_names[].  */
  if ((INTVAL (operands[0]) >= NDS32_INT_H16)
      && (INTVAL (operands[0]) <= NDS32_INT_H31))
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_MASK2__);
      operands[0] = GEN_INT (~(1 << INTVAL (operands[0])));
    }
  else if ((INTVAL (operands[0]) >= NDS32_INT_H32)
	   && (INTVAL (operands[0]) <= NDS32_INT_H63))
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_MASK3__);
      operands[0] = GEN_INT (~(1 << (INTVAL (operands[0]) - 32)));
    }
  else
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_MASK__);

      if (INTVAL (operands[0]) == NDS32_INT_SWI)
        operands[0] = GEN_INT (~(1 << 16));
      else if ((INTVAL (operands[0]) >= NDS32_INT_ALZ)
	       && (INTVAL (operands[0]) <= NDS32_INT_DSSIM))
	operands[0] = GEN_INT (~(1 << (INTVAL (operands[0]) - 4)));
      else
	operands[0] = GEN_INT (~(1 << INTVAL (operands[0])));
    }

  emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
  emit_insn (gen_andsi3 (temp_reg, temp_reg, operands[0]));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

(define_expand "unspec_set_pending_swint"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_SET_PENDING_SWINT)]
  ""
{
  /* Get $INT_PEND system register form nds32_intrinsic_register_names[]  */
  rtx system_reg =  GEN_INT (__NDS32_REG_INT_PEND__);
  rtx temp_reg = gen_reg_rtx (SImode);

  emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
  emit_insn (gen_iorsi3 (temp_reg, temp_reg, GEN_INT (65536)));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

(define_expand "unspec_clr_pending_swint"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_CLR_PENDING_SWINT)]
  ""
{
  /* Get $INT_PEND system register form nds32_intrinsic_register_names[]  */
  rtx system_reg =  GEN_INT (__NDS32_REG_INT_PEND__);
  rtx temp_reg = gen_reg_rtx (SImode);

  emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
  emit_insn (gen_andsi3 (temp_reg, temp_reg, GEN_INT (~(1 << 16))));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

(define_expand "unspec_clr_pending_hwint"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "")] UNSPEC_VOLATILE_CLR_PENDING_HWINT)]
  ""
{
  rtx system_reg = NULL_RTX;
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx clr_hwint;
  unsigned offset = 0;

  /* Set system register form nds32_intrinsic_register_names[].  */
  if ((INTVAL (operands[0]) >= NDS32_INT_H0)
      && (INTVAL (operands[0]) <= NDS32_INT_H15))
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND__);
    }
  else if ((INTVAL (operands[0]) >= NDS32_INT_H16)
	   && (INTVAL (operands[0]) <= NDS32_INT_H31))
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND2__);
    }
  else if ((INTVAL (operands[0]) >= NDS32_INT_H32)
	   && (INTVAL (operands[0]) <= NDS32_INT_H63))
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND3__);
      offset = 32;
    }
  else
    error ("__nds32__clr_pending_hwint not support NDS32_INT_SWI,"
	   " NDS32_INT_ALZ, NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  /* $INT_PEND type is write one clear.  */
  clr_hwint = GEN_INT (1 << (INTVAL (operands[0]) - offset));

  if (system_reg != NULL_RTX)
    {
      emit_move_insn (temp_reg, clr_hwint);
      emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
      emit_insn (gen_unspec_dsb ());
    }
  DONE;
})

(define_expand "unspec_get_all_pending_int"
  [(set (match_operand:SI 0 "register_operand" "")
	(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_GET_ALL_PENDING_INT))]
  ""
{
  rtx system_reg = GEN_INT (__NDS32_REG_INT_PEND__);
  emit_insn (gen_unspec_volatile_mfsr (operands[0], system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

(define_expand "unspec_get_pending_int"
  [(set (match_operand:SI 0 "register_operand" "")
	(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_VOLATILE_GET_PENDING_INT))]
  ""
{
  rtx system_reg = NULL_RTX;

  /* Set system register form nds32_intrinsic_register_names[].  */
  if ((INTVAL (operands[1]) >= NDS32_INT_H0)
      && (INTVAL (operands[1]) <= NDS32_INT_H15))
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND__);
      operands[2] = GEN_INT (31 - INTVAL (operands[1]));
    }
  else if (INTVAL (operands[1]) == NDS32_INT_SWI)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND__);
      operands[2] = GEN_INT (15);
    }
  else if ((INTVAL (operands[1]) >= NDS32_INT_H16)
	   && (INTVAL (operands[1]) <= NDS32_INT_H31))
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND2__);
      operands[2] = GEN_INT (31 - INTVAL (operands[1]));
    }
  else if ((INTVAL (operands[1]) >= NDS32_INT_H32)
	   && (INTVAL (operands[1]) <= NDS32_INT_H63))
    {
      system_reg = GEN_INT (__NDS32_REG_INT_PEND3__);
      operands[2] = GEN_INT (31 - (INTVAL (operands[1]) - 32));
    }
  else
    error ("get_pending_int not support NDS32_INT_ALZ,"
	   " NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  /* mfsr op0, sytem_reg  */
  if (system_reg != NULL_RTX)
    {
      emit_insn (gen_unspec_volatile_mfsr (operands[0], system_reg));
      emit_insn (gen_ashlsi3 (operands[0], operands[0], operands[2]));
      emit_insn (gen_lshrsi3 (operands[0], operands[0], GEN_INT (31)));
      emit_insn (gen_unspec_dsb ());
    }
  DONE;
})

(define_expand "unspec_set_int_priority"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "")
			(match_operand:SI 1 "immediate_operand" "")] UNSPEC_VOLATILE_SET_INT_PRIORITY)]
  ""
{
  rtx system_reg = NULL_RTX;
  rtx priority = NULL_RTX;
  rtx mask = NULL_RTX;
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx mask_reg = gen_reg_rtx (SImode);
  rtx set_reg = gen_reg_rtx (SImode);
  unsigned offset = 0;

  /* Get system register form nds32_intrinsic_register_names[].  */
  if (INTVAL (operands[0]) <= NDS32_INT_H15)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI__);
      offset = 0;
    }
  else if (INTVAL (operands[0]) >= NDS32_INT_H16
	   && INTVAL (operands[0]) <= NDS32_INT_H31)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI2__);
      /* The $INT_PRI2 first bit correspond to H16, so need
	 subtract 16.  */
      offset = 16;
    }
  else if (INTVAL (operands[0]) >= NDS32_INT_H32
	   && INTVAL (operands[0]) <= NDS32_INT_H47)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI3__);
      /* The $INT_PRI3 first bit correspond to H32, so need
	 subtract 32.  */
      offset = 32;
    }
  else if (INTVAL (operands[0]) >= NDS32_INT_H48
	   && INTVAL (operands[0]) <= NDS32_INT_H63)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI4__);
      /* The $INT_PRI3 first bit correspond to H48, so need
	 subtract 48.  */
      offset = 48;
    }
  else
    error ("set_int_priority not support NDS32_INT_SWI,"
	   " NDS32_INT_ALZ, NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  mask = GEN_INT (~(3 << 2 * (INTVAL (operands[0]) - offset)));
  priority = GEN_INT ((int) (INTVAL (operands[1])
			     << ((INTVAL (operands[0]) - offset) * 2)));

  if (system_reg != NULL_RTX)
    {
      emit_move_insn (mask_reg, mask);
      emit_move_insn (set_reg, priority);
      emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
      emit_insn (gen_andsi3 (temp_reg, temp_reg, mask_reg));
      emit_insn (gen_iorsi3 (temp_reg, temp_reg, set_reg));
      emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
      emit_insn (gen_unspec_dsb ());
    }
  DONE;
})

(define_expand "unspec_get_int_priority"
  [(set (match_operand:SI 0 "register_operand" "")
	(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_VOLATILE_GET_INT_PRIORITY))]
  ""
{
  rtx system_reg = NULL_RTX;
  rtx priority = NULL_RTX;
  unsigned offset = 0;

  /* Get system register form nds32_intrinsic_register_names[]  */
  if (INTVAL (operands[1]) <= NDS32_INT_H15)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI__);
      offset = 0;
    }
  else if (INTVAL (operands[1]) >= NDS32_INT_H16
	   && INTVAL (operands[1]) <= NDS32_INT_H31)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI2__);
      /* The $INT_PRI2 first bit correspond to H16, so need
	 subtract 16.  */
      offset = 16;
    }
  else if (INTVAL (operands[1]) >= NDS32_INT_H32
	   && INTVAL (operands[1]) <= NDS32_INT_H47)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI3__);
      /* The $INT_PRI3 first bit correspond to H32, so need
	 subtract 32.  */
      offset = 32;
    }
  else if (INTVAL (operands[1]) >= NDS32_INT_H48
	   && INTVAL (operands[1]) <= NDS32_INT_H63)
    {
      system_reg =  GEN_INT (__NDS32_REG_INT_PRI4__);
      /* The $INT_PRI4 first bit correspond to H48, so need
	 subtract 48.  */
      offset = 48;
    }
  else
    error ("set_int_priority not support NDS32_INT_SWI,"
	   " NDS32_INT_ALZ, NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  priority = GEN_INT (31 - 2 * (INTVAL (operands[1]) - offset));

  if (system_reg != NULL_RTX)
    {
      emit_insn (gen_unspec_volatile_mfsr (operands[0], system_reg));
      emit_insn (gen_ashlsi3 (operands[0], operands[0], priority));
      emit_insn (gen_lshrsi3 (operands[0], operands[0], GEN_INT (30)));
      emit_insn (gen_unspec_dsb ());
    }
  DONE;
})

(define_expand "unspec_set_trig_level"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "")] UNSPEC_VOLATILE_SET_TRIG_LEVEL)]
  ""
{
  rtx system_reg = NULL_RTX;
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx set_level;
  unsigned offset = 0;

  if (INTVAL (operands[0]) >= NDS32_INT_H0
      && INTVAL (operands[0]) <= NDS32_INT_H31)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_TRIGGER__);
      offset = 0;
    }
  else if (INTVAL (operands[0]) >= NDS32_INT_H32
	   && INTVAL (operands[0]) <= NDS32_INT_H63)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_TRIGGER2__);
      offset = 32;
    }
  else
    error ("__nds32__set_trig_type_level not support NDS32_INT_SWI,"
	   " NDS32_INT_ALZ, NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  if (system_reg != NULL_RTX)
    {
      /* TRIGGER register, 0 mean level triggered and 1 mean edge triggered. */
      set_level = GEN_INT (~(1 << (INTVAL (operands[0]) - offset)));

      emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
      emit_insn (gen_andsi3 (temp_reg, temp_reg, set_level));
      emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
    }
  DONE;
})

(define_expand "unspec_set_trig_edge"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "")] UNSPEC_VOLATILE_SET_TRIG_EDGE)]
  ""
{
  rtx system_reg = NULL_RTX;
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx set_level;
  unsigned offset = 0;

  if (INTVAL (operands[0]) >= NDS32_INT_H0
      && INTVAL (operands[0]) <= NDS32_INT_H31)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_TRIGGER__);
      offset = 0;
    }
  else if (INTVAL (operands[0]) >= NDS32_INT_H32
	   && INTVAL (operands[0]) <= NDS32_INT_H63)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_TRIGGER2__);
      offset = 32;
    }
  else
    error ("__nds32__set_trig_type_edge not support NDS32_INT_SWI,"
	   " NDS32_INT_ALZ, NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  if (system_reg != NULL_RTX)
    {
      /* TRIGGER register, 0 mean level triggered and 1 mean edge triggered. */
      set_level = GEN_INT ((1 << (INTVAL (operands[0]) - offset)));

      emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
      emit_insn (gen_iorsi3 (temp_reg, temp_reg, set_level));
      emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
    }
  DONE;
})

(define_expand "unspec_get_trig_type"
  [(set (match_operand:SI 0 "register_operand" "")
	(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "")] UNSPEC_VOLATILE_GET_TRIG_TYPE))]
  ""
{
  rtx system_reg = NULL_RTX;
  rtx trig_type;
  unsigned offset = 0;

  if (INTVAL (operands[1]) >= NDS32_INT_H0
      && INTVAL (operands[1]) <= NDS32_INT_H31)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_TRIGGER__);
      offset = 0;
    }
  else if (INTVAL (operands[1]) >= NDS32_INT_H32
	   && INTVAL (operands[1]) <= NDS32_INT_H63)
    {
      system_reg = GEN_INT (__NDS32_REG_INT_TRIGGER2__);
      offset = 32;
    }
  else
    error ("__nds32__get_trig_type not support NDS32_INT_SWI,"
	   " NDS32_INT_ALZ, NDS32_INT_IDIVZE, NDS32_INT_DSSIM");

  if (system_reg != NULL_RTX)
    {
      trig_type = GEN_INT (31 - (INTVAL (operands[1]) - offset));

      emit_insn (gen_unspec_volatile_mfsr (operands[0], system_reg));
      emit_insn (gen_ashlsi3 (operands[0], operands[0], trig_type));
      emit_insn (gen_lshrsi3 (operands[0], operands[0], GEN_INT (31)));
      emit_insn (gen_unspec_dsb ());
    }
  DONE;
})

;; ------------------------------------------------------------------------

;; Cache Synchronization Instructions

(define_insn "unspec_volatile_isync"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_ISYNC)]
  ""
  "isync\t%0"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_volatile_isb"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_ISB)]
  ""
  "isb"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_dsb"
  [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_DSB)]
  ""
  "dsb"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_msync"
  [(unspec_volatile [(match_operand:SI 0 "immediate_operand" "i")] UNSPEC_VOLATILE_MSYNC)]
  ""
  "msync\t%0"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_msync_all"
  [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_MSYNC_ALL)]
  ""
  "msync\tall"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_msync_store"
  [(unspec_volatile [(const_int 0)] UNSPEC_VOLATILE_MSYNC_STORE)]
  ""
  "msync\tstore"
  [(set_attr "type" "misc")]
)

;; Load and Store

(define_insn "unspec_volatile_llw"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
					      (match_operand:SI 2 "register_operand" "r")))] UNSPEC_VOLATILE_LLW))]
  ""
  "llw\t%0, [%1 + %2]"
  [(set_attr "length"    "4")]
)

(define_insn "unspec_lwup"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
					      (match_operand:SI 2 "register_operand" "r")))] UNSPEC_LWUP))]
  ""
  "lwup\t%0, [%1 + %2]"
  [(set_attr "length"    "4")]
)

(define_insn "unspec_lbup"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
					      (match_operand:SI 2 "register_operand" "r")))] UNSPEC_LBUP))]
  ""
  "lbup\t%0, [%1 + %2]"
  [(set_attr "length"    "4")]
)

(define_insn "unspec_volatile_scw"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
					      (match_operand:SI 2 "register_operand" "r")))
			     (match_operand:SI 3 "register_operand" "0")] UNSPEC_VOLATILE_SCW))]
  ""
  "scw\t%0, [%1 + %2]"
  [(set_attr "length"     "4")]
)

(define_insn "unspec_swup"
  [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "r")
			 (match_operand:SI 1 "register_operand" "r")))
	(unspec:SI [(match_operand:SI 2 "register_operand" "r")] UNSPEC_SWUP))]
  ""
  "swup\t%2, [%0 + %1]"
  [(set_attr "length"     "4")]
)

(define_insn "unspec_sbup"
  [(set (mem:SI (plus:SI (match_operand:SI 0 "register_operand" "r")
			 (match_operand:SI 1 "register_operand" "r")))
	(unspec:SI [(match_operand:SI 2 "register_operand" "r")] UNSPEC_SBUP))]
  ""
  "sbup\t%2, [%0 + %1]"
  [(set_attr "length"     "4")]
)

;; CCTL

(define_insn "cctl_l1d_invalall"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_CCTL_L1D_INVALALL)]
  ""
  "cctl\tL1D_INVALALL"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_l1d_wball_alvl"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_CCTL_L1D_WBALL_ALVL)]
  ""
  "cctl\tL1D_WBALL, alevel"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_l1d_wball_one_lvl"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_CCTL_L1D_WBALL_ONE_LVL)]
  ""
  "cctl\tL1D_WBALL, 1level"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_idx_read"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(match_operand:SI 1 "immediate_operand" "i")
			     (match_operand:SI 2 "register_operand" "r")] UNSPEC_VOLATILE_CCTL_IDX_READ))]
  ""
  "cctl\t%0, %2, %X1"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_idx_write"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")
			(match_operand:SI 1 "register_operand" "r")
			(match_operand:SI 2 "register_operand" "r")] UNSPEC_VOLATILE_CCTL_IDX_WRITE)]
  ""
  "cctl\t%1, %2, %W0"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_va_wbinval_l1"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")
			(match_operand:SI 1 "register_operand" "r")] UNSPEC_VOLATILE_CCTL_VA_WBINVAL_L1)]
  ""
  "cctl\t%1, %U0, 1level"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_va_wbinval_la"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")
			(match_operand:SI 1 "register_operand" "r")] UNSPEC_VOLATILE_CCTL_VA_WBINVAL_LA)]
  ""
  "cctl\t%1, %U0, alevel"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_idx_wbinval"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")
			(match_operand:SI 1 "register_operand" "r")] UNSPEC_VOLATILE_CCTL_IDX_WBINVAL)]
  ""
  "cctl\t%1, %T0"
  [(set_attr "type" "mmu")]
)

(define_insn "cctl_va_lck"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")
			(match_operand:SI 1 "register_operand" "r")] UNSPEC_VOLATILE_CCTL_VA_LCK)]
  ""
  "cctl\t%1, %R0"
  [(set_attr "type" "mmu")]
)

;;PREFETCH

(define_insn "prefetch_qw"
  [(unspec_volatile:QI [(match_operand:SI 0 "register_operand" "r")
			(match_operand:SI 1 "nonmemory_operand" "r")
			(match_operand:SI 2 "immediate_operand" "i")] UNSPEC_VOLATILE_DPREF_QW)]
  ""
  "dpref\t%Z2, [%0 + %1]"
  [(set_attr "type" "misc")]
)

(define_insn "prefetch_hw"
  [(unspec_volatile:HI [(match_operand:SI 0 "register_operand" "r")
			(match_operand:SI 1 "nonmemory_operand" "r")
			(match_operand:SI 2 "immediate_operand" "i")] UNSPEC_VOLATILE_DPREF_HW)]
  ""
  "dpref\t%Z2, [%0 + (%1<<1)]"
  [(set_attr "type" "misc")]
)

(define_insn "prefetch_w"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "    r, r")
			(match_operand:SI 1 "nonmemory_operand" "Is15, r")
			(match_operand:SI 2 "immediate_operand" "   i, i")] UNSPEC_VOLATILE_DPREF_W)]
  ""
  "@
  dprefi.w\t%Z2, [%0 + %1]
  dpref\t%Z2, [%0 + (%1<<2)]"
  [(set_attr "type" "misc")]
)

(define_insn "prefetch_dw"
  [(unspec_volatile:DI [(match_operand:SI 0 "register_operand"  "   r, r")
			(match_operand:SI 1 "nonmemory_operand" "Is15, r")
			(match_operand:SI 2 "immediate_operand" "   i, i")] UNSPEC_VOLATILE_DPREF_DW)]
  ""
  "@
  dprefi.d\t%Z2, [%0 + %1]
  dpref\t%Z2, [%0 + (%1<<3)]"
  [(set_attr "type" "misc")]
)

;; Performance Extension

(define_expand "unspec_ave"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "register_operand" "")]
  ""
{
  emit_insn (gen_ave (operands[0], operands[1], operands[2]));
  DONE;
})

(define_expand "unspec_bclr"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "immediate_operand" "")]
  ""
{
  unsigned HOST_WIDE_INT val = ~(1u << UINTVAL (operands[2]));
  emit_insn (gen_andsi3 (operands[0], operands[1], gen_int_mode (val, SImode)));
  DONE;
})

(define_expand "unspec_bset"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "immediate_operand" "")]
  ""
{
  unsigned HOST_WIDE_INT val = 1u << UINTVAL (operands[2]);
  emit_insn (gen_iorsi3 (operands[0], operands[1], gen_int_mode (val, SImode)));
  DONE;
})

(define_expand "unspec_btgl"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "immediate_operand" "")]
  ""
{
  unsigned HOST_WIDE_INT val = 1u << UINTVAL (operands[2]);
  emit_insn (gen_xorsi3 (operands[0], operands[1], gen_int_mode (val, SImode)));
  DONE;
})

(define_expand "unspec_btst"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "immediate_operand" "")]
  ""
{
  emit_insn (gen_btst (operands[0], operands[1], operands[2]));
  DONE;
})

(define_insn "unspec_clip"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "immediate_operand" "i")] UNSPEC_CLIP))]
  ""
  "clip\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

(define_insn "unspec_clips"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "immediate_operand" "i")] UNSPEC_CLIPS))]
  ""
  "clips\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

(define_insn "unspec_clo"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_CLO))]
  ""
  "clo\t%0, %1"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

(define_insn "unspec_ssabssi2"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(ss_abs:SI (match_operand:SI 1 "register_operand" "r")))]
  ""
  "abs\t%0, %1"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

;; Performance extension 2

(define_insn "unspec_pbsad"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_PBSAD))]
  ""
  "pbsad\t%0, %1, %2"
  [(set_attr "type" "pbsad")
   (set_attr "length"   "4")]
)

(define_insn "unspec_pbsada"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "0")
		    (match_operand:SI 2 "register_operand" "r")
		    (match_operand:SI 3 "register_operand" "r")] UNSPEC_PBSADA))]
  ""
  "pbsada\t%0, %2, %3"
  [(set_attr "type" "pbsada")
   (set_attr "length"    "4")]
)

(define_expand "bse"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "register_operand" "")]
  ""
  {
    rtx temp0 = gen_reg_rtx (SImode);
    rtx temp2 = gen_reg_rtx (SImode);

    emit_move_insn (temp0, gen_rtx_MEM (Pmode, operands[0]));
    emit_move_insn (temp2, gen_rtx_MEM (Pmode, operands[2]));
    emit_insn (gen_unspec_bse (temp0, operands[1], temp2, temp0, temp2));
    emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp0);
    emit_move_insn (gen_rtx_MEM (Pmode, operands[2]), temp2);
    DONE;
  }
)

(define_insn "unspec_bse"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")
		    (match_operand:SI 3 "register_operand" "0")] UNSPEC_BSE))
   (set (match_operand:SI 4 "register_operand" "=2")
	(unspec:SI [(match_dup 1)
		    (match_dup 2)
		    (match_dup 0)] UNSPEC_BSE_2))]
  ""
  "bse\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

(define_expand "bsp"
  [(match_operand:SI 0 "register_operand" "")
   (match_operand:SI 1 "register_operand" "")
   (match_operand:SI 2 "register_operand" "")]
  ""
  {
    rtx temp0 = gen_reg_rtx (SImode);
    rtx temp2 = gen_reg_rtx (SImode);

    emit_move_insn (temp0, gen_rtx_MEM (Pmode, operands[0]));
    emit_move_insn (temp2, gen_rtx_MEM (Pmode, operands[2]));
    emit_insn (gen_unspec_bsp (temp0, operands[1], temp2, temp0, temp2));
    emit_move_insn (gen_rtx_MEM (Pmode, operands[0]), temp0);
    emit_move_insn (gen_rtx_MEM (Pmode, operands[2]), temp2);
    DONE;
  }
)

(define_insn "unspec_bsp"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")
		    (match_operand:SI 3 "register_operand" "0")] UNSPEC_BSP))
   (set (match_operand:SI 4 "register_operand" "=2")
	(unspec:SI [(match_dup 1)
		    (match_dup 2)
		    (match_dup 0)] UNSPEC_BSP_2))]
  ""
  "bsp\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

;; String Extension

(define_insn "unspec_ffb"
  [(set (match_operand:SI 0 "register_operand" "=r, r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r, r")
		    (match_operand:SI 2 "nonmemory_operand" "Iu08, r")] UNSPEC_FFB))]
  ""
  "@
  ffbi\t%0, %1, %2
  ffb\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

(define_insn "unspec_ffmism"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_FFMISM))]
  ""
  "ffmism\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

(define_insn "unspec_flmism"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_FLMISM))]
  ""
  "flmism\t%0, %1, %2"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

;; SATURATION

(define_insn "unspec_kaddw"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(ss_plus:SI (match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")))]
  ""
  "kaddw\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_ksubw"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(ss_minus:SI (match_operand:SI 1 "register_operand" "r")
		     (match_operand:SI 2 "register_operand" "r")))]
  ""
  "ksubw\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kaddh"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_KADDH))]
  ""
  "kaddh\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_ksubh"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_KSUBH))]
  ""
  "ksubh\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kaddh_dsp"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "r")
			     (match_operand:SI 2 "register_operand" "r"))
		    (const_int 15)] UNSPEC_CLIPS))]
  "NDS32_EXT_DSP_P ()"
  "kaddh\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_ksubh_dsp"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(minus:SI (match_operand:SI 1 "register_operand" "r")
			      (match_operand:SI 2 "register_operand" "r"))
		    (const_int 15)] UNSPEC_CLIPS))]
  "NDS32_EXT_DSP_P ()"
  "ksubh\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kdmbb"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KDMBB))]
  ""
  "kdmbb\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kdmbt"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KDMBT))]
  ""
  "kdmbt\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kdmtb"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KDMTB))]
  ""
  "kdmtb\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kdmtt"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KDMTT))]
  ""
  "kdmtt\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_khmbb"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KHMBB))]
  ""
  "khmbb\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_khmbt"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KHMBT))]
  ""
  "khmbt\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_khmtb"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KHMTB))]
  ""
  "khmtb\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_khmtt"
  [(set (match_operand:V2HI 0 "register_operand" "=r")
	(unspec:V2HI [(match_operand:V2HI 1 "register_operand" "r")
		      (match_operand:V2HI 2 "register_operand" "r")] UNSPEC_KHMTT))]
  ""
  "khmtt\t%0, %1, %2"
  [(set_attr "type"    "mul")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kslraw"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_KSLRAW))]
  ""
  "kslraw\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_kslrawu"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_KSLRAWU))]
  ""
  "kslraw.u\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_volatile_rdov"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_RDOV))]
  ""
  "rdov\t%0"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

(define_insn "unspec_volatile_clrov"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_CLROV)]
  ""
  "clrov"
  [(set_attr "type"   "misc")
   (set_attr "length"    "4")]
)

;; System

(define_insn "unspec_sva"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_SVA))]
  ""
  "sva\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_svs"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")
		    (match_operand:SI 2 "register_operand" "r")] UNSPEC_SVS))]
  ""
  "svs\t%0, %1, %2"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

(define_insn "unspec_jr_itoff"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_JR_ITOFF)]
  ""
  "jr.itoff\t%0"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_jr_toff"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_JR_TOFF)]
  ""
  "jr.toff\t%0"
  [(set_attr "type" "branch")]
)

(define_insn "unspec_jral_iton"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_JRAL_ITON)]
  ""
  "jral.iton\t%0"
  [(set_attr "type" "branch")]
)

(define_insn "unspec_jral_ton"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_JRAL_TON)]
  ""
  "jral.ton\t%0"
  [(set_attr "type" "branch")]
)

(define_insn "unspec_ret_itoff"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_RET_ITOFF)]
  ""
  "ret.itoff\t%0"
  [(set_attr "type" "branch")]
)

(define_insn "unspec_ret_toff"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_RET_TOFF)]
  ""
  "ret.toff\t%0"
  [(set_attr "type" "branch")]
)

(define_insn "unspec_standby_no_wake_grant"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_STANDBY_NO_WAKE_GRANT)]
  ""
  "standby\tno_wake_grant"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_standby_wake_grant"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_STANDBY_WAKE_GRANT)]
  ""
  "standby\twake_grant"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_standby_wait_done"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_STANDBY_WAKE_DONE)]
  ""
  "standby\twait_done"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_teqz"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
			(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_VOLATILE_TEQZ)]
  ""
  "teqz\t%0, %1"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_tnez"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
			(match_operand:SI 1 "immediate_operand" "i")] UNSPEC_VOLATILE_TNEZ)]
  ""
  "tnez\t%0, %1"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_trap"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")] UNSPEC_VOLATILE_TRAP)]
  ""
  "trap\t%0"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_setend_big"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_SETEND_BIG)]
  ""
  "setend.b"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_setend_little"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_SETEND_LITTLE)]
  ""
  "setend.l"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_break"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")] UNSPEC_VOLATILE_BREAK)]
  ""
  "break\t%0"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_syscall"
  [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")] UNSPEC_VOLATILE_SYSCALL)]
  ""
  "syscall\t%0"
  [(set_attr "type" "misc")]
)

(define_insn "unspec_nop"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_NOP)]
  ""
  "nop"
  [(set_attr "type" "misc")]
)

(define_expand "unspec_get_current_sp"
  [(match_operand:SI 0 "register_operand" "")]
  ""
{
  emit_move_insn (operands[0], gen_rtx_REG (SImode, SP_REGNUM));
  DONE;
})

(define_expand "unspec_set_current_sp"
  [(match_operand:SI 0 "register_operand" "")]
  ""
{
  emit_move_insn (gen_rtx_REG (SImode, SP_REGNUM), operands[0]);
  DONE;
})

(define_expand "unspec_return_address"
  [(match_operand:SI 0 "register_operand" "")]
  ""
{
  emit_move_insn (operands[0], gen_rtx_REG (SImode, LP_REGNUM));
  DONE;
})

;; Swap

(define_insn "unspec_wsbh"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_WSBH))]
  ""
  "wsbh\t%0, %1"
  [(set_attr "type"    "alu")
   (set_attr "length"    "4")]
)

;; TLBOP Intrinsic

(define_insn "unspec_tlbop_trd"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_TRD)]
  ""
  "tlbop\t%0, TRD"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_twr"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_TWR)]
  ""
  "tlbop\t%0, TWR"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_rwr"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_RWR)]
  ""
  "tlbop\t%0, RWR"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_rwlk"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_RWLK)]
  ""
  "tlbop\t%0, RWLK"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_unlk"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_UNLK)]
  ""
  "tlbop\t%0, UNLK"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_pb"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_PB))]
  ""
  "tlbop\t%0, %1, PB"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_inv"
  [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")] UNSPEC_VOLATILE_TLBOP_INV)]
  ""
  "tlbop\t%0, INV"
  [(set_attr "type" "mmu")]
)

(define_insn "unspec_tlbop_flua"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_TLBOP_FLUA)]
  ""
  "tlbop\tFLUA"
  [(set_attr "type" "mmu")]
)

;;Unaligned Load/Store

(define_expand "unaligned_load_hw"
  [(set (match_operand:HI 0 "register_operand" "")
	(unspec:HI [(mem:HI (match_operand:SI 1 "register_operand" ""))] UNSPEC_UALOAD_HW))]
  ""
{
  operands[0] = simplify_gen_subreg (SImode, operands[0],
				     GET_MODE (operands[0]), 0);
  if (TARGET_ISA_V3M)
    {
      nds32_expand_unaligned_load (operands, HImode);
    }
  else
    {
      emit_insn (gen_unaligned_load_w (operands[0],
				       gen_rtx_MEM (SImode, operands[1])));

      if (WORDS_BIG_ENDIAN)
	emit_insn (gen_lshrsi3 (operands[0], operands[0], GEN_INT(16)));
      else
	emit_insn (gen_andsi3 (operands[0], operands[0], GEN_INT (0xffff)));
    }

  DONE;
})

(define_expand "unaligned_loadsi"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(mem:SI (match_operand:SI 1 "register_operand" "r"))] UNSPEC_UALOAD_W))]
  ""
{
  if (flag_unaligned_access)
    {
      rtx mem = gen_rtx_MEM (SImode, operands[1]);
      emit_move_insn (operands[0], mem);
    }
  else
    {
      if (TARGET_ISA_V3M)
	nds32_expand_unaligned_load (operands, SImode);
      else
	emit_insn (gen_unaligned_load_w (operands[0],
					 gen_rtx_MEM (SImode, (operands[1]))));
    }
  DONE;
})

(define_insn "unaligned_load_w"
  [(set (match_operand:SI 0 "register_operand"                       "=  r")
	(unspec:SI [(match_operand:SI 1 "nds32_lmw_smw_base_operand" " Umw")] UNSPEC_UALOAD_W))]
  ""
{
  return nds32_output_lmw_single_word (operands);
}
  [(set_attr "type"   "load")
   (set_attr "length"    "4")]
)

(define_expand "unaligned_loaddi"
  [(set (match_operand:DI 0 "register_operand" "=r")
	(unspec:DI [(mem:DI (match_operand:SI 1 "register_operand" "r"))] UNSPEC_UALOAD_DW))]
  ""
{
  if (TARGET_ISA_V3M)
    {
      nds32_expand_unaligned_load (operands, DImode);
    }
  else
    emit_insn (gen_unaligned_load_dw (operands[0], operands[1]));
  DONE;
})

(define_insn "unaligned_load_dw"
  [(set (match_operand:DI 0 "register_operand" "=r")
	(unspec:DI [(mem:DI (match_operand:SI 1 "register_operand" "r"))] UNSPEC_UALOAD_DW))]
  ""
{
  rtx otherops[3];
  otherops[0] = gen_rtx_REG (SImode, REGNO (operands[0]));
  otherops[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
  otherops[2] = operands[1];

  output_asm_insn ("lmw.bi\t%0, [%2], %1, 0", otherops);
  return "";
}
  [(set_attr "type"   "load")
   (set_attr "length"    "4")]
)

(define_expand "unaligned_store_hw"
  [(set (mem:SI (match_operand:SI 0 "register_operand" ""))
	(unspec:HI [(match_operand:HI 1 "register_operand" "")] UNSPEC_UASTORE_HW))]
  ""
{
  operands[1] = simplify_gen_subreg (SImode, operands[1],
				     GET_MODE (operands[1]), 0);
  nds32_expand_unaligned_store (operands, HImode);
  DONE;
})

(define_expand "unaligned_storesi"
  [(set (mem:SI (match_operand:SI 0 "register_operand" "r"))
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_UASTORE_W))]
  ""
{
  if (flag_unaligned_access)
    {
      rtx mem = gen_rtx_MEM (SImode, operands[0]);
      emit_move_insn (mem, operands[1]);
    }
  else
    {
      if (TARGET_ISA_V3M)
	nds32_expand_unaligned_store (operands, SImode);
      else
	emit_insn (gen_unaligned_store_w (gen_rtx_MEM (SImode, operands[0]),
					  operands[1]));
    }
  DONE;
})

(define_insn "unaligned_store_w"
  [(set (match_operand:SI 0 "nds32_lmw_smw_base_operand"   "=Umw")
	(unspec:SI [(match_operand:SI 1 "register_operand" "   r")] UNSPEC_UASTORE_W))]
  ""
{
  return nds32_output_smw_single_word (operands);
}
  [(set_attr "type"   "store")
   (set_attr "length"     "4")]
)

(define_expand "unaligned_storedi"
  [(set (mem:DI (match_operand:SI 0 "register_operand" "r"))
	(unspec:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_UASTORE_DW))]
  ""
{
  if (TARGET_ISA_V3M)
    nds32_expand_unaligned_store (operands, DImode);
  else
    emit_insn (gen_unaligned_store_dw (gen_rtx_MEM (DImode, operands[0]),
				       operands[1]));
  DONE;
})

(define_insn "unaligned_store_dw"
  [(set (match_operand:DI 0 "nds32_lmw_smw_base_operand"   "=Umw")
	(unspec:DI [(match_operand:DI 1 "register_operand" "   r")] UNSPEC_UASTORE_DW))]
  ""
{
  return nds32_output_smw_double_word (operands);
}
  [(set_attr "type"   "store")
   (set_attr "length"     "4")]
)

(define_expand "unspec_unaligned_feature"
  [(set (match_operand:SI 0 "register_operand" "")
	(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_UNALIGNED_FEATURE))]
  ""
{
  /* Get $MMU_CTL system register form nds32_intrinsic_register_names[]  */
  rtx system_reg =  GEN_INT (__NDS32_REG_MMU_CTL__);
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx temp2_reg = gen_reg_rtx (SImode);

  emit_insn (gen_unspec_volatile_mfsr (operands[0], system_reg));
  emit_move_insn (temp_reg, operands[0]);
  emit_move_insn (temp2_reg, GEN_INT (0x800 << 12));
  emit_insn (gen_iorsi3 (operands[0], operands[0], temp2_reg));
  emit_insn (gen_unspec_volatile_mtsr (operands[0], system_reg));
  emit_insn (gen_unspec_dsb ());

  emit_insn (gen_unspec_volatile_mfsr (operands[0], system_reg));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());

  emit_insn (gen_ashlsi3 (operands[0], operands[0], GEN_INT (8)));
  emit_insn (gen_lshrsi3 (operands[0], operands[0], GEN_INT (31)));
  DONE;
})

(define_expand "unspec_enable_unaligned"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_UNALIGNED_FEATURE)]
  ""
{
  /* Get $MMU_CTL system register form nds32_intrinsic_register_names[]  */
  rtx system_reg =  GEN_INT (__NDS32_REG_MMU_CTL__);
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx temp2_reg = gen_reg_rtx (SImode);
  emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
  emit_move_insn (temp2_reg, GEN_INT (0x800 << 12));
  emit_insn (gen_iorsi3 (temp_reg, temp_reg, temp2_reg));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

(define_expand "unspec_disable_unaligned"
  [(unspec_volatile:SI [(const_int 0)] UNSPEC_VOLATILE_UNALIGNED_FEATURE)]
  ""
{
  /* Get $MMU_CTL system register form nds32_intrinsic_register_names[]  */
  rtx system_reg =  GEN_INT (__NDS32_REG_MMU_CTL__);
  rtx temp_reg = gen_reg_rtx (SImode);
  rtx temp2_reg = gen_reg_rtx (SImode);
  emit_insn (gen_unspec_volatile_mfsr (temp_reg, system_reg));
  emit_move_insn (temp2_reg, GEN_INT (0x800 << 12));
  emit_insn (gen_one_cmplsi2 (temp2_reg, temp2_reg));
  emit_insn (gen_andsi3 (temp_reg, temp_reg, temp2_reg));
  emit_insn (gen_unspec_volatile_mtsr (temp_reg, system_reg));
  emit_insn (gen_unspec_dsb ());
  DONE;
})

;; abs alias kabs

(define_insn "unspec_kabs"
  [(set (match_operand:SI 0 "register_operand" "=r")
	(unspec:SI [(match_operand:SI 1 "register_operand" "r")] UNSPEC_KABS))]
  ""
  "kabs\t%0, %1"
  [(set_attr "type" "alu")
   (set_attr "length" "4")]
)

;; ------------------------------------------------------------------------

{'repo_name': 'gcc-mirror/gcc', 'stars': '3986', 'repo_language': 'C', 'file_name': 'epiphany.opt', 'mime_type': 'text/plain', 'hash': -7028820743614653754, 'source_dataset': 'data'}


.. _bokeh.models.glyphs.Arc:

bokeh.models.glyphs.Arc
-----------------------

.. autoclass:: bokeh.models.glyphs.Arc
    :members:
    :inherited-members:

{'repo_name': 'bokeh/bokeh', 'stars': '13710', 'repo_language': 'Python', 'file_name': 'ui.py', 'mime_type': 'text/x-python', 'hash': -5585834241924012420, 'source_dataset': 'data'}


# created by tools/tclZIC.tcl - do not edit

set TZData(:Asia/Dushanbe) {
    {-9223372036854775808 16512 0 LMT}
    {-1441168512 18000 0 DUST}
    {-1247547600 21600 0 DUST}
    {354909600 25200 1 DUSST}
    {370717200 21600 0 DUST}
    {386445600 25200 1 DUSST}
    {402253200 21600 0 DUST}
    {417981600 25200 1 DUSST}
    {433789200 21600 0 DUST}
    {449604000 25200 1 DUSST}
    {465336000 21600 0 DUST}
    {481060800 25200 1 DUSST}
    {496785600 21600 0 DUST}
    {512510400 25200 1 DUSST}
    {528235200 21600 0 DUST}
    {543960000 25200 1 DUSST}
    {559684800 21600 0 DUST}
    {575409600 25200 1 DUSST}
    {591134400 21600 0 DUST}
    {606859200 25200 1 DUSST}
    {622584000 21600 0 DUST}
    {638308800 25200 1 DUSST}
    {654638400 21600 0 DUST}
    {670363200 21600 1 DUSST}
    {684363600 18000 0 TJT}
}

{'repo_name': 'macports/macports-base', 'stars': '402', 'repo_language': 'Tcl', 'file_name': 'port-cd.1', 'mime_type': 'text/troff', 'hash': 5997593348625525754, 'source_dataset': 'data'}


//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace ClearCanvas.ImageServer.Web.Application.Pages.Studies.StudyDetails.Controls {

    public partial class StudyStorageView {

        /// <summary>
        /// ContainerTable control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Table ContainerTable;

        /// <summary>
        /// StudyStorageViewControl control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.DetailsView StudyStorageViewControl;
    }
}

{'repo_name': 'ClearCanvas/ClearCanvas', 'stars': '318', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': 6128048083463213182, 'source_dataset': 'data'}


//
//  DMHYSite.h
//  DMHY
//
//  Created by 小笠原やきん on 7/16/16.
//  Copyright © 2016 yaqinking. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@class DMHYKeyword;

NS_ASSUME_NONNULL_BEGIN

@interface DMHYSite : NSManagedObject

// Insert code here to declare functionality of your managed object subclass

+ (DMHYSite *)entityFormDictionary:(NSDictionary *)site inManagedObjectContext:(NSManagedObjectContext *)context;

@end

NS_ASSUME_NONNULL_END

#import "DMHYSite+CoreDataProperties.h"

{'repo_name': 'yaqinking/DMHY', 'stars': '297', 'repo_language': 'Objective-C', 'file_name': 'contents.xcworkspacedata', 'mime_type': 'text/xml', 'hash': -6275169549530869969, 'source_dataset': 'data'}


/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 */

package com.microsoft.azure.management.network.v2020_06_01.implementation;

import com.microsoft.azure.management.network.v2020_06_01.ApplicationGatewayPrivateEndpointConnection;
import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl;
import rx.Observable;
import com.microsoft.azure.management.network.v2020_06_01.PrivateLinkServiceConnectionState;
import com.microsoft.azure.management.network.v2020_06_01.ProvisioningState;
import com.microsoft.azure.management.network.v2020_06_01.PrivateEndpoint;

class ApplicationGatewayPrivateEndpointConnectionImpl extends CreatableUpdatableImpl<ApplicationGatewayPrivateEndpointConnection, ApplicationGatewayPrivateEndpointConnectionInner, ApplicationGatewayPrivateEndpointConnectionImpl> implements ApplicationGatewayPrivateEndpointConnection, ApplicationGatewayPrivateEndpointConnection.Update {
    private final NetworkManager manager;
    private String resourceGroupName;
    private String applicationGatewayName;
    private String connectionName;

    ApplicationGatewayPrivateEndpointConnectionImpl(String name, NetworkManager manager) {
        super(name, new ApplicationGatewayPrivateEndpointConnectionInner());
        this.manager = manager;
        // Set resource name
        this.connectionName = name;
        //
    }

    ApplicationGatewayPrivateEndpointConnectionImpl(ApplicationGatewayPrivateEndpointConnectionInner inner, NetworkManager manager) {
        super(inner.name(), inner);
        this.manager = manager;
        // Set resource name
        this.connectionName = inner.name();
        // set resource ancestor and positional variables
        this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups");
        this.applicationGatewayName = IdParsingUtils.getValueFromIdByName(inner.id(), "applicationGateways");
        this.connectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "privateEndpointConnections");
        //
    }

    @Override
    public NetworkManager manager() {
        return this.manager;
    }

    @Override
    public Observable<ApplicationGatewayPrivateEndpointConnection> createResourceAsync() {
        ApplicationGatewayPrivateEndpointConnectionsInner client = this.manager().inner().applicationGatewayPrivateEndpointConnections();
        return null; // NOP createResourceAsync implementation as create is not supported
    }

    @Override
    public Observable<ApplicationGatewayPrivateEndpointConnection> updateResourceAsync() {
        ApplicationGatewayPrivateEndpointConnectionsInner client = this.manager().inner().applicationGatewayPrivateEndpointConnections();
        return client.updateAsync(this.resourceGroupName, this.applicationGatewayName, this.connectionName, this.inner())
            .map(innerToFluentMap(this));
    }

    @Override
    protected Observable<ApplicationGatewayPrivateEndpointConnectionInner> getInnerAsync() {
        ApplicationGatewayPrivateEndpointConnectionsInner client = this.manager().inner().applicationGatewayPrivateEndpointConnections();
        return client.getAsync(this.resourceGroupName, this.applicationGatewayName, this.connectionName);
    }

    @Override
    public boolean isInCreateMode() {
        return this.inner().id() == null;
    }

    @Override
    public String etag() {
        return this.inner().etag();
    }

    @Override
    public String id() {
        return this.inner().id();
    }

    @Override
    public String linkIdentifier() {
        return this.inner().linkIdentifier();
    }

    @Override
    public String name() {
        return this.inner().name();
    }

    @Override
    public PrivateEndpoint privateEndpoint() {
        PrivateEndpointInner inner = this.inner().privateEndpoint();
        if (inner != null) {
            return  new PrivateEndpointImpl(inner.name(), inner, manager());
        } else {
            return null;
        }
    }

    @Override
    public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() {
        return this.inner().privateLinkServiceConnectionState();
    }

    @Override
    public ProvisioningState provisioningState() {
        return this.inner().provisioningState();
    }

    @Override
    public String type() {
        return this.inner().type();
    }

    @Override
    public ApplicationGatewayPrivateEndpointConnectionImpl withId(String id) {
        this.inner().withId(id);
        return this;
    }

    @Override
    public ApplicationGatewayPrivateEndpointConnectionImpl withName(String name) {
        this.inner().withName(name);
        return this;
    }

    @Override
    public ApplicationGatewayPrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) {
        this.inner().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState);
        return this;
    }

}

{'repo_name': 'Azure/azure-sdk-for-java', 'stars': '587', 'repo_language': 'Java', 'file_name': 'MetricSpecification.java', 'mime_type': 'text/x-java', 'hash': -596182063913219281, 'source_dataset': 'data'}


/*
 * COPYRIGHT:       See COPYING in the top level directory
 * PROJECT:         ReactOS Console Server DLL
 * FILE:            condrv/dummyterm.c
 * PURPOSE:         Dummy Terminal used when no terminal
 *                  is attached to the specified console.
 * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
 */

/* INCLUDES *******************************************************************/

#include <consrv.h>

/* DUMMY TERMINAL INTERFACE ***************************************************/

static NTSTATUS NTAPI
DummyInitTerminal(IN OUT PTERMINAL This,
                  IN PCONSOLE Console)
{
    return STATUS_SUCCESS;
}

static VOID NTAPI
DummyDeinitTerminal(IN OUT PTERMINAL This)
{
}

/************ Line discipline ***************/

static NTSTATUS NTAPI
DummyReadStream(IN OUT PTERMINAL This,
                /**/IN PUNICODE_STRING ExeName /**/OPTIONAL/**/,/**/
                IN BOOLEAN Unicode,
                /**PWCHAR Buffer,**/
                OUT PVOID Buffer,
                IN OUT PCONSOLE_READCONSOLE_CONTROL ReadControl,
                IN ULONG NumCharsToRead,
                OUT PULONG NumCharsRead OPTIONAL)
{
    /*
     * We were called because the console was in cooked mode.
     * There is nothing to read, wait until a real terminal
     * is plugged into the console.
     */
    return STATUS_PENDING;
}

static NTSTATUS NTAPI
DummyWriteStream(IN OUT PTERMINAL This,
                 PTEXTMODE_SCREEN_BUFFER Buff,
                 PWCHAR Buffer,
                 DWORD Length,
                 BOOL Attrib)
{
    /*
     * We were called because the console was in cooked mode.
     * There is nothing to write, wait until a real terminal
     * is plugged into the console.
     */

    // /* Stop here if the console is paused */
    // if (Console->UnpauseEvent != NULL) return STATUS_PENDING;

    return STATUS_PENDING;
}

/************ Line discipline ***************/

static VOID NTAPI
DummyDrawRegion(IN OUT PTERMINAL This,
                SMALL_RECT* Region)
{
}

static BOOL NTAPI
DummySetCursorInfo(IN OUT PTERMINAL This,
                   PCONSOLE_SCREEN_BUFFER ScreenBuffer)
{
    return TRUE;
}

static BOOL NTAPI
DummySetScreenInfo(IN OUT PTERMINAL This,
                   PCONSOLE_SCREEN_BUFFER ScreenBuffer,
                   SHORT OldCursorX,
                   SHORT OldCursorY)
{
    return TRUE;
}

static VOID NTAPI
DummyResizeTerminal(IN OUT PTERMINAL This)
{
}

static VOID NTAPI
DummySetActiveScreenBuffer(IN OUT PTERMINAL This)
{
}

static VOID NTAPI
DummyReleaseScreenBuffer(IN OUT PTERMINAL This,
                         IN PCONSOLE_SCREEN_BUFFER ScreenBuffer)
{
}

static VOID NTAPI
DummyGetLargestConsoleWindowSize(IN OUT PTERMINAL This,
                                 PCOORD pSize)
{
}

static BOOL NTAPI
DummySetPalette(IN OUT PTERMINAL This,
                HPALETTE PaletteHandle,
                UINT PaletteUsage)
{
    return TRUE;
}

static INT NTAPI
DummyShowMouseCursor(IN OUT PTERMINAL This,
                     BOOL Show)
{
    return 0;
}

static TERMINAL_VTBL DummyVtbl =
{
    DummyInitTerminal,
    DummyDeinitTerminal,

    DummyReadStream,
    DummyWriteStream,

    DummyDrawRegion,
    DummySetCursorInfo,
    DummySetScreenInfo,
    DummyResizeTerminal,
    DummySetActiveScreenBuffer,
    DummyReleaseScreenBuffer,
    DummyGetLargestConsoleWindowSize,
    DummySetPalette,
    DummyShowMouseCursor,
};

VOID
ResetTerminal(IN PCONSOLE Console)
{
    if (!Console) return;

    /* Reinitialize the terminal interface */
    RtlZeroMemory(&Console->TermIFace, sizeof(Console->TermIFace));
    Console->TermIFace.Vtbl = &DummyVtbl;
}

/* EOF */

{'repo_name': 'mirror/reactos', 'stars': '115', 'repo_language': 'C', 'file_name': 'de-DE.mc', 'mime_type': 'text/plain', 'hash': 755780644094808330, 'source_dataset': 'data'}


/*******************************************************************************
 * Copyright (c) 2016, 2020 Eurotech and/or its affiliates and others
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Eurotech - initial API and implementation
 *******************************************************************************/
package org.eclipse.kapua.app.console.module.authorization.client.role;

import org.eclipse.kapua.app.console.module.api.client.ui.dialog.KapuaDialog;
import org.eclipse.kapua.app.console.module.api.client.ui.widget.EntityCRUDToolbar;
import org.eclipse.kapua.app.console.module.api.shared.model.session.GwtSession;
import org.eclipse.kapua.app.console.module.authorization.client.role.dialog.RoleAddDialog;
import org.eclipse.kapua.app.console.module.authorization.client.role.dialog.RoleDeleteDialog;
import org.eclipse.kapua.app.console.module.authorization.client.role.dialog.RoleEditDialog;
import org.eclipse.kapua.app.console.module.authorization.shared.model.GwtRole;
import org.eclipse.kapua.app.console.module.authorization.shared.model.permission.RoleSessionPermission;

import com.google.gwt.user.client.Element;

public class RoleToolbarGrid extends EntityCRUDToolbar<GwtRole> {

    public RoleToolbarGrid(GwtSession currentSession) {
        super(currentSession);
    }

    @Override
    protected KapuaDialog getAddDialog() {
        return new RoleAddDialog(currentSession);
    }

    @Override
    protected KapuaDialog getEditDialog() {
        GwtRole selectedRole = gridSelectionModel.getSelectedItem();
        RoleEditDialog dialog = null;
        if (selectedRole != null) {
            dialog = new RoleEditDialog(currentSession, selectedRole);
        }
        return dialog;
    }

    @Override
    protected void onRender(Element target, int index) {
        super.onRender(target, index);
        getAddEntityButton().setEnabled(currentSession.hasPermission(RoleSessionPermission.write()));
    }

    @Override
    protected KapuaDialog getDeleteDialog() {
        GwtRole selectedRole = gridSelectionModel.getSelectedItem();
        RoleDeleteDialog dialog = null;
        if (selectedRole != null) {
            dialog = new RoleDeleteDialog(selectedRole);
        }
        return dialog;
    }
}

{'repo_name': 'eclipse/kapua', 'stars': '159', 'repo_language': 'Java', 'file_name': 'XmlServiceEventMarshalerTest.java', 'mime_type': 'text/x-java', 'hash': 8045020428227752064, 'source_dataset': 'data'}


/* Class = "NSTextFieldCell"; title = "Uncheck \"receive beta updates\" from Preferences - General, and install a stable release from our official website."; ObjectID = "3aN-Hg-GkT"; */
"3aN-Hg-GkT.title" = "Desmarque a opção \"receber atualizações beta\" das Preferências - Geral e instale uma versão estável em nosso site oficial.";

/* Class = "NSTextFieldCell"; title = "Report to us via email or GitHub issue."; ObjectID = "BIz-NQ-0qD"; */
"BIz-NQ-0qD.title" = "Envie-nos um email ou issue do GitHub .";

/* Class = "NSTextFieldCell"; title = "Open URL…"; ObjectID = "FKG-Tz-TCV"; */
"FKG-Tz-TCV.title" = "Abrir URL…";

/* Class = "NSTextFieldCell"; title = "You are using a beta version of IINA"; ObjectID = "H7D-2H-wQn"; */
"H7D-2H-wQn.title" = "Você está usando uma versão beta do IINA";

/* Class = "NSTextFieldCell"; title = "Found a bug?"; ObjectID = "I6R-Jl-2Jk"; */
"I6R-Jl-2Jk.title" = "Encontrou um bug?";

/* Class = "NSTextFieldCell"; title = "Resume"; ObjectID = "KWZ-BM-GBN"; */
"KWZ-BM-GBN.title" = "Continuar";

/* Class = "NSTextFieldCell"; title = "BETA"; ObjectID = "g2g-dy-qBH"; */
"g2g-dy-qBH.title" = "BETA";

/* Class = "NSTextFieldCell"; title = "Open…"; ObjectID = "qsU-lZ-WQq"; */
"qsU-lZ-WQq.title" = "Abrir…";

/* Class = "NSTextFieldCell"; title = "Want to rollback?"; ObjectID = "s3U-4u-gYp"; */
"s3U-4u-gYp.title" = "Quer reverter?";

{'repo_name': 'iina/iina', 'stars': '24331', 'repo_language': 'Swift', 'file_name': 'integrate_doc_types.rb', 'mime_type': 'text/x-ruby', 'hash': 4924383498804690059, 'source_dataset': 'data'}


/*------------------------------------------------------------------------*/
/* FRK-RX62N: SCI in UART control module                                  */
/*------------------------------------------------------------------------*/
/*
/  Copyright (C) 2016, ChaN, all right reserved.
/
/ * This software is a free software and there is NO WARRANTY.
/ * No restriction on use. You can use, modify and redistribute it for
/   personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY.
/ * Redistributions of source code must retain the above copyright notice.
/
/-------------------------------------------------------------------------*/

#define F_PCLK		96000000UL	/* PCLK frequency (configured by SCKCR.PCK) */

#define USE_SCI0	0	/* Use SCI0 */
#define TXBUF0		128	/* Tx FIFO size [byte]	*/
#define RXBUF0		128	/* Rx FIFO size [byte]	*/

#define USE_SCI1	1	/* Use SCI1 */
#define TXBUF1		128	/* Tx FIFO size [byte]	*/
#define RXBUF1		128	/* Rx FIFO size [byte]	*/

#define USE_SCI2	0	/* Use SCI2 */
#define TXBUF2		128	/* Tx FIFO size [byte]	*/
#define RXBUF2		128	/* Rx FIFO size [byte]	*/

#define USE_SCI3	0	/* Use SCI3 */
#define TXBUF3		128	/* Tx FIFO size [byte]	*/
#define RXBUF3		128	/* Rx FIFO size [byte]	*/

/*--------------------------------------------------*/

#include "iodefine.h"
#include "uart_sci.h"
#include "vect.h"

extern void delay_ms(unsigned int);	/* Defined in main.c */

#define IODLY() {ICU.IR[0].BYTE; ICU.IR[0].BYTE; ICU.IR[0].BYTE;}

#if USE_SCI0

static
volatile struct {
	uint16_t	rri, rwi, rct, tri, twi, tct, run;
	uint8_t		rbuf[RXBUF0], tbuf[TXBUF0];
} Fifo0;

/* Initialize SCI */

void uart0_init (
	uint32_t bps,
	const char* fmt
)
{
	uint32_t f, d;

	/* Attach SCI0 to I/O pad */
	MSTP_SCI0 = 0;
	PORT2.ICR.BIT.B1 = 1;

	SCI0.SCR.BYTE = 0;
	f = 0;							/* CM=0, CHR=0, PE=0, PM=0, STOP=0, MP=0, CKS=0 */
	if (fmt[0] == 'o') f |= 0x30;	/* PE=1, PM=1 */
	if (fmt[0] == 'e') f |= 0x20;	/* PE=1 */
	if (fmt[1] == '7') f |= 0x40;	/* CHR=1 */
	if (fmt[2] == '2') f |= 0x08;	/* STOP=1 */
	d = F_PCLK / 32 / bps - 1;
	if (d >= 256) {
		d /= 4; f |= 1;	/* CKS0=1 */
	}
	SCI0.SMR.BYTE = f;
	SCI0.BRR = d;
	delay_ms(2);
	SCI0.SCR.BYTE = 0xF0;		/* Start SCI (TIE=1,RIE=1,TE=1,RE=1) */

	/* Clear Tx/Rx Buffer */
	Fifo0.tri = 0; Fifo0.twi = 0; Fifo0.tct = 0; Fifo0.run = 0;
	Fifo0.rri = 0; Fifo0.rwi = 0; Fifo0.rct = 0;

	/* Enable SCI interrupts */
	IPR(SCI0, ERI0) = 3; IEN(SCI0, ERI0) = 1;
	IPR(SCI0, RXI0) = 3; IEN(SCI0, RXI0) = 1;
	IPR(SCI0, TXI0) = 1; IEN(SCI0, TXI0) = 1;
}

/* Get number of bytes in the Rx Buffer */

int uart0_test (void)
{
	return Fifo0.rct;
}

/* Get a byte from Rx buffer */

uint8_t uart0_getc (void)
{
	uint8_t d;
	uint16_t i;

	while (!Fifo0.rct) ;		/* Wait for Rx data available */

	IEN(SCI0, RXI0) = 0; IEN(SCI0, ERI0) = 0;	/* Disable Rx Irq */
	IODLY();

	i = Fifo0.rri;
	d = Fifo0.rbuf[i++];		/* Get a byte from Rx buffer */
	Fifo0.rri = i % RXBUF0;
	Fifo0.rct--;

	IEN(SCI0, RXI0) = 1; IEN(SCI0, ERI0) = 1;	/* Enable Rx Irq */

	return d;
}

/* Put a byte into Tx buffer */

void uart0_putc (
	uint8_t dat
)
{
	uint16_t i;

	while (Fifo0.tct >= TXBUF0) ;	/* Wait for buffer ready */

	IEN(SCI0, TXI0) = 0;	/* Disable Tx Irq */
	IODLY();

	if (Fifo0.run) {
		i = Fifo0.twi;			/* Store the data into the Tx buffer */
		Fifo0.tbuf[i++] = dat;
		Fifo0.twi = i % TXBUF0;
		Fifo0.tct++;
	} else {
		Fifo0.run = 1;
		SCI0.TDR = dat;
	}

	IEN(SCI0, TXI0) = 1;	/* Enable Tx Irq */
}

/* RDR Ready ISR */

void Excep_SCI0_RXI0 (void)
{
	uint16_t i;
	uint8_t d;

	d = SCI0.RDR;	/* Get received byte */

	if (Fifo0.rct < RXBUF0) {	/* Store the byte if buffer is not full */
		i = Fifo0.rwi;
		Fifo0.rbuf[i++] = d;
		Fifo0.rwi = i % RXBUF0;
		Fifo0.rct++;
	}
}

/* Receive Error ISR */

void Excep_SCI0_ERI0 (void)
{
	/* Clear error status */
	SCI0.RDR;
	SCI0.SSR.BYTE = 0x84;
}

/* TDR ready ISR */

void Excep_SCI0_TXI0 (void)
{
	uint16_t i;

	if (Fifo0.tct) {	/* There is a data to be sent */
		i = Fifo0.tri;
		SCI0.TDR = Fifo0.tbuf[i++];
		Fifo0.tri = i % TXBUF0;
		Fifo0.tct--;
	} else {			/* No data to be sent */
		Fifo0.run = 0;
	}
}

#endif

#if USE_SCI1

static
volatile struct {
	uint16_t	rri, rwi, rct, tri, twi, tct, run;
	uint8_t		rbuf[RXBUF1], tbuf[TXBUF1];
} Fifo1;

/* Initialize SCI */

void uart1_init (
	uint32_t bps,
	const char* fmt
)
{
	uint32_t f, d;

	/* Attach SCI1 to I/O pad */
	MSTP_SCI1 = 0;
	PORT3.ICR.BIT.B0 = 1;

	SCI1.SCR.BYTE = 0;
	f = 0;							/* CM=0, CHR=0, PE=0, PM=0, STOP=0, MP=0, CKS=0 */
	if (fmt[0] == 'o') f |= 0x30;	/* PE=1, PM=1 */
	if (fmt[0] == 'e') f |= 0x20;	/* PE=1 */
	if (fmt[1] == '7') f |= 0x40;	/* CHR=1 */
	if (fmt[2] == '2') f |= 0x08;	/* STOP=1 */
	d = F_PCLK / 32 / bps - 1;
	if (d >= 256) {
		d /= 4; f |= 1;	/* CKS0=1 */
	}
	SCI1.SMR.BYTE = f;
	SCI1.BRR = d;
	delay_ms(2);
	SCI1.SCR.BYTE = 0xF0;		/* Start SCI (TIE=1,RIE=1,TE=1,RE=1) */

	/* Clear Tx/Rx Buffer */
	Fifo1.tri = 0; Fifo1.twi = 0; Fifo1.tct = 0; Fifo1.run = 0;
	Fifo1.rri = 0; Fifo1.rwi = 0; Fifo1.rct = 0;

	/* Enable SCI interrupts */
	IPR(SCI1, ERI1) = 3; IEN(SCI1, ERI1) = 1;
	IPR(SCI1, RXI1) = 3; IEN(SCI1, RXI1) = 1;
	IPR(SCI1, TXI1) = 1; IEN(SCI1, TXI1) = 1;
}

/* Get number of bytes in the Rx Buffer */

int uart1_test (void)
{
	return Fifo1.rct;
}

/* Get a byte from Rx buffer */

uint8_t uart1_getc (void)
{
	uint8_t d;
	uint16_t i;

	while (!Fifo1.rct) ;		/* Wait for Rx data available */

	IEN(SCI1, RXI1) = 0; IEN(SCI1, ERI1) = 0;	/* Disable Rx Irq */
	IODLY();

	i = Fifo1.rri;
	d = Fifo1.rbuf[i++];		/* Get a byte from Rx buffer */
	Fifo1.rri = i % RXBUF1;
	Fifo1.rct--;

	IEN(SCI1, RXI1) = 1; IEN(SCI1, ERI1) = 1;	/* Enable Rx Irq */

	return d;
}

/* Put a byte into Tx buffer */

void uart1_putc (
	uint8_t dat
)
{
	uint16_t i;

	while (Fifo1.tct >= TXBUF1) ;	/* Wait for buffer ready */

	IEN(SCI1, TXI1) = 0;	/* Disable Tx Irq */
	IODLY();

	if (Fifo1.run) {
		i = Fifo1.twi;			/* Store the data into the Tx buffer */
		Fifo1.tbuf[i++] = dat;
		Fifo1.twi = i % TXBUF1;
		Fifo1.tct++;
	} else {
		Fifo1.run = 1;
		SCI1.TDR = dat;
	}

	IEN(SCI1, TXI1) = 1;	/* Enable Tx Irq */
}

/* RDR Ready ISR */

void Excep_SCI1_RXI1 (void)
{
	uint16_t i;
	uint8_t d;

	d = SCI1.RDR;	/* Get received byte */

	if (Fifo1.rct < RXBUF1) {	/* Store the byte if buffer is not full */
		i = Fifo1.rwi;
		Fifo1.rbuf[i++] = d;
		Fifo1.rwi = i % RXBUF1;
		Fifo1.rct++;
	}
}

/* Receive Error ISR */

void Excep_SCI1_ERI1 (void)
{
	/* Clear error status */
	SCI1.RDR;
	SCI1.SSR.BYTE = 0x84;
}

/* TDR ready ISR */

void Excep_SCI1_TXI1 (void)
{
	uint16_t i;

	if (Fifo1.tct) {	/* There is a data to be sent */
		i = Fifo1.tri;
		SCI1.TDR = Fifo1.tbuf[i++];
		Fifo1.tri = i % TXBUF1;
		Fifo1.tct--;
	} else {			/* No data to be sent */
		Fifo1.run = 0;
	}
}

#endif

#if USE_SCI2

static
volatile struct {
	uint16_t	rri, rwi, rct, tri, twi, tct, run;
	uint8_t		rbuf[RXBUF2], tbuf[TXBUF2];
} Fifo2;

/* Initialize SCI */

void uart2_init (
	uint32_t bps,
	const char* fmt
)
{
	uint32_t f, d;

	/* Attach SCI2 to I/O pad */
	IOPORT.PFFSCI.BIT.SCI2S = 0;
	MSTP_SCI2 = 0;
	PORT1.ICR.BIT.B2 = 1;

	SCI2.SCR.BYTE = 0;
	f = 0;							/* CM=0, CHR=0, PE=0, PM=0, STOP=0, MP=0, CKS=0 */
	if (fmt[0] == 'o') f |= 0x30;	/* PE=1, PM=1 */
	if (fmt[0] == 'e') f |= 0x20;	/* PE=1 */
	if (fmt[1] == '7') f |= 0x40;	/* CHR=1 */
	if (fmt[2] == '2') f |= 0x08;	/* STOP=1 */
	d = F_PCLK / 32 / bps - 1;
	if (d >= 256) {
		d /= 4; f |= 1;	/* CKS0=1 */
	}
	SCI2.SMR.BYTE = f;
	SCI2.BRR = d;
	delay_ms(2);
	SCI2.SCR.BYTE = 0xF0;		/* Start SCI (TIE=1,RIE=1,TE=1,RE=1) */

	/* Clear Tx/Rx Buffer */
	Fifo2.tri = 0; Fifo2.twi = 0; Fifo2.tct = 0; Fifo2.run = 0;
	Fifo2.rri = 0; Fifo2.rwi = 0; Fifo2.rct = 0;

	/* Enable SCI interrupts */
	IPR(SCI2, ERI2) = 3; IEN(SCI2, ERI2) = 1;
	IPR(SCI2, RXI2) = 3; IEN(SCI2, RXI2) = 1;
	IPR(SCI2, TXI2) = 1; IEN(SCI2, TXI2) = 1;
}

/* Get number of bytes in the Rx Buffer */

int uart2_test (void)
{
	return Fifo2.rct;
}

/* Get a byte from Rx buffer */

uint8_t uart2_getc (void)
{
	uint8_t d;
	uint16_t i;

	while (!Fifo2.rct) ;		/* Wait for Rx data available */

	IEN(SCI2, RXI2) = 0; IEN(SCI2, ERI2) = 0;	/* Disable Rx Irq */
	IODLY();

	i = Fifo2.rri;
	d = Fifo2.rbuf[i++];		/* Get a byte from Rx buffer */
	Fifo2.rri = i % RXBUF2;
	Fifo2.rct--;

	IEN(SCI2, RXI2) = 1; IEN(SCI2, ERI2) = 1;	/* Enable Rx Irq */

	return d;
}

/* Put a byte into Tx buffer */

void uart2_putc (
	uint8_t dat
)
{
	uint16_t i;

	while (Fifo2.tct >= TXBUF2) ;	/* Wait for buffer ready */

	IEN(SCI2, TXI2) = 0;	/* Disable Tx Irq */
	IODLY();

	if (Fifo2.run) {
		i = Fifo2.twi;			/* Store the data into the Tx buffer */
		Fifo2.tbuf[i++] = dat;
		Fifo2.twi = i % TXBUF2;
		Fifo2.tct++;
	} else {
		Fifo2.run = 1;
		SCI2.TDR = dat;
	}

	IEN(SCI2, TXI2) = 1;	/* Enable Tx Irq */
}

/* RDR Ready ISR */

void Excep_SCI2_RXI2 (void)
{
	uint16_t i;
	uint8_t d;

	d = SCI2.RDR;	/* Get received byte */

	if (Fifo2.rct < RXBUF2) {	/* Store the byte if buffer is not full */
		i = Fifo2.rwi;
		Fifo2.rbuf[i++] = d;
		Fifo2.rwi = i % RXBUF2;
		Fifo2.rct++;
	}
}

/* Receive Error ISR */

void Excep_SCI2_ERI2 (void)
{
	/* Clear error status */
	SCI2.RDR;
	SCI2.SSR.BYTE = 0x84;
}

/* TDR ready ISR */

void Excep_SCI2_TXI2 (void)
{
	uint16_t i;

	if (Fifo2.tct) {	/* There is a data to be sent */
		i = Fifo2.tri;
		SCI2.TDR = Fifo2.tbuf[i++];
		Fifo2.tri = i % TXBUF2;
		Fifo2.tct--;
	} else {			/* No data to be sent */
		Fifo2.run = 0;
	}
}

#endif

#if USE_SCI3

static
volatile struct {
	uint16_t	rri, rwi, rct, tri, twi, tct, run;
	uint8_t		rbuf[RXBUF3], tbuf[TXBUF3];
} Fifo3;

/* Initialize SCI */

void uart3_init (
	uint32_t bps,
	const char* fmt
)
{
	uint32_t f, d;

	/* Attach SCI3 to I/O pad */
	IOPORT.PFFSCI.BIT.SCI3S = 0;
	MSTP_SCI3 = 0;
	PORT1.ICR.BIT.B2 = 1;

	SCI3.SCR.BYTE = 0;
	f = 0;							/* CM=0, CHR=0, PE=0, PM=0, STOP=0, MP=0, CKS=0 */
	if (fmt[0] == 'o') f |= 0x30;	/* PE=1, PM=1 */
	if (fmt[0] == 'e') f |= 0x20;	/* PE=1 */
	if (fmt[1] == '7') f |= 0x40;	/* CHR=1 */
	if (fmt[2] == '2') f |= 0x08;	/* STOP=1 */
	d = F_PCLK / 32 / bps - 1;
	if (d >= 256) {
		d /= 4; f |= 1;	/* CKS0=1 */
	}
	SCI3.SMR.BYTE = f;
	SCI3.BRR = d;
	delay_ms(2);
	SCI3.SCR.BYTE = 0xF0;		/* Start SCI (TIE=1,RIE=1,TE=1,RE=1) */

	/* Clear Tx/Rx Buffer */
	Fifo3.tri = 0; Fifo3.twi = 0; Fifo3.tct = 0; Fifo3.run = 0;
	Fifo3.rri = 0; Fifo3.rwi = 0; Fifo3.rct = 0;

	/* Enable SCI interrupts */
	IPR(SCI3, ERI3) = 3; IEN(SCI3, ERI3) = 1;
	IPR(SCI3, RXI3) = 3; IEN(SCI3, RXI3) = 1;
	IPR(SCI3, TXI3) = 1; IEN(SCI3, TXI3) = 1;
}

/* Get number of bytes in the Rx Buffer */

int uart3_test (void)
{
	return Fifo3.rct;
}

/* Get a byte from Rx buffer */

uint8_t uart3_getc (void)
{
	uint8_t d;
	uint16_t i;

	while (!Fifo3.rct) ;		/* Wait for Rx data available */

	IEN(SCI3, RXI3) = 0; IEN(SCI3, ERI3) = 0;	/* Disable Rx Irq */
	IODLY();

	i = Fifo3.rri;
	d = Fifo3.rbuf[i++];		/* Get a byte from Rx buffer */
	Fifo3.rri = i % RXBUF3;
	Fifo3.rct--;

	IEN(SCI3, RXI3) = 1; IEN(SCI3, ERI3) = 1;	/* Enable Rx Irq */

	return d;
}

/* Put a byte into Tx buffer */

void uart3_putc (
	uint8_t dat
)
{
	uint16_t i;

	while (Fifo3.tct >= TXBUF3) ;	/* Wait for buffer ready */

	IEN(SCI3, TXI3) = 0;	/* Disable Tx Irq */
	IODLY();

	if (Fifo3.run) {
		i = Fifo3.twi;			/* Store the data into the Tx buffer */
		Fifo3.tbuf[i++] = dat;
		Fifo3.twi = i % TXBUF3;
		Fifo3.tct++;
	} else {
		Fifo3.run = 1;
		SCI3.TDR = dat;
	}

	IEN(SCI3, TXI3) = 1;	/* Enable Tx Irq */
}

/* RDR Ready ISR */

void Excep_SCI3_RXI3 (void)
{
	uint16_t i;
	uint8_t d;

	d = SCI3.RDR;	/* Get received byte */

	if (Fifo3.rct < RXBUF3) {	/* Store the byte if buffer is not full */
		i = Fifo3.rwi;
		Fifo3.rbuf[i++] = d;
		Fifo3.rwi = i % RXBUF3;
		Fifo3.rct++;
	}
}

/* Receive Error ISR */

void Excep_SCI3_ERI3 (void)
{
	/* Clear error status */
	SCI3.RDR;
	SCI3.SSR.BYTE = 0x84;
}

/* TDR ready ISR */

void Excep_SCI3_TXI3 (void)
{
	uint16_t i;

	if (Fifo3.tct) {	/* There is a data to be sent */
		i = Fifo3.tri;
		SCI3.TDR = Fifo3.tbuf[i++];
		Fifo3.tri = i % TXBUF3;
		Fifo3.tct--;
	} else {			/* No data to be sent */
		Fifo3.run = 0;
	}
}

#endif

{'repo_name': 'aldostools/webMAN-MOD', 'stars': '404', 'repo_language': 'C', 'file_name': 'keys', 'mime_type': 'text/plain', 'hash': 2747808348212971949, 'source_dataset': 'data'}


package com.sromku.simple.fb.entities;

import com.google.gson.annotations.SerializedName;

/**
 * Age range (min-max) of the user.
 *
 * @author sromku
 */
public class AgeRange {

    @SerializedName("min")
    private String mMin;

    @SerializedName("max")
    private String mMax;

    public String getMin() {
        return mMin;
    }

    public String getMax() {
        return mMax;
    }
}

{'repo_name': 'sromku/android-simple-facebook', 'stars': '889', 'repo_language': 'Java', 'file_name': 'MainFragment.java', 'mime_type': 'text/x-java', 'hash': -3281709274285259812, 'source_dataset': 'data'}


// Copyright (c) 2014, Suryandaru Triandana <syndtr@gmail.com>
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Package errors provides common error types used throughout leveldb.
package errors

import (
	"errors"
	"fmt"

	"github.com/syndtr/goleveldb/leveldb/storage"
	"github.com/syndtr/goleveldb/leveldb/util"
)

// Common errors.
var (
	ErrNotFound    = New("leveldb: not found")
	ErrReleased    = util.ErrReleased
	ErrHasReleaser = util.ErrHasReleaser
)

// New returns an error that formats as the given text.
func New(text string) error {
	return errors.New(text)
}

// ErrCorrupted is the type that wraps errors that indicate corruption in
// the database.
type ErrCorrupted struct {
	Fd  storage.FileDesc
	Err error
}

func (e *ErrCorrupted) Error() string {
	if !e.Fd.Zero() {
		return fmt.Sprintf("%v [file=%v]", e.Err, e.Fd)
	}
	return e.Err.Error()
}

// NewErrCorrupted creates new ErrCorrupted error.
func NewErrCorrupted(fd storage.FileDesc, err error) error {
	return &ErrCorrupted{fd, err}
}

// IsCorrupted returns a boolean indicating whether the error is indicating
// a corruption.
func IsCorrupted(err error) bool {
	switch err.(type) {
	case *ErrCorrupted:
		return true
	case *storage.ErrCorrupted:
		return true
	}
	return false
}

// ErrMissingFiles is the type that indicating a corruption due to missing
// files. ErrMissingFiles always wrapped with ErrCorrupted.
type ErrMissingFiles struct {
	Fds []storage.FileDesc
}

func (e *ErrMissingFiles) Error() string { return "file missing" }

// SetFd sets 'file info' of the given error with the given file.
// Currently only ErrCorrupted is supported, otherwise will do nothing.
func SetFd(err error, fd storage.FileDesc) error {
	switch x := err.(type) {
	case *ErrCorrupted:
		x.Fd = fd
		return x
	}
	return err
}

{'repo_name': 'xormplus/xorm', 'stars': '1246', 'repo_language': 'Go', 'file_name': 'context_cache.go', 'mime_type': 'text/plain', 'hash': 3506792164938047251, 'source_dataset': 'data'}


---
-api-id: N:Windows.System.Profile
-api-type: winrt namespace
---

# Windows.System.Profile

## -description
Enables apps to get information about the system.

## -remarks

## -examples

## -see-also

{'repo_name': 'MicrosoftDocs/winrt-api', 'stars': '106', 'repo_language': 'JavaScript', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': 7299730639892361746, 'source_dataset': 'data'}


// ========================================================================
// SproutCore -- JavaScript Application Framework
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
// Portions copyright ©2008 Apple Inc.  All rights reserved.
// ========================================================================
/*global SC */

/** @class
  This is a basic designer used for all SC.Objects that are created in design
  mode.

  FIXME: have SC.ViewDesigner subclass this designer.....

  @extends SC.Object
  @since SproutCore 1.0
*/
SC.ObjectDesigner = SC.Object.extend(
/** @scope SC.ViewDesigner.prototype */ {

  /** The object managed by this designer. */
  object: null,

  /** The class for the design.  Set when the object is created. */
  objectClass: null,

  /** Set to YES if the object is currently selected for editing. */
  designIsSelected: NO,

  /** Set to YES if this particular designer should not be enabled. */
  designIsEnabled: YES,

  /**
    The current page.  Comes from the object.

    @property {SC.Page}
  */
  page: function() {
    var v = this.get('object');
    return (v) ? v.get('page') : null;
  }.property('object').cacheable(),

  /**
    The design controller from the page.  Comes from page

    @property {SC.PageDesignController}
  */
  designController: function() {
    var p = this.get('page');
    return (p) ? p.get('designController') : null ;
  }.property('page').cacheable(),

  concatenatedProperties: ['designProperties', 'localizedProperties', 'excludeProperties'],

  // ..........................................................
  // GENERIC PROPERTIES
  //
  // Adds support for adding generic properties to a object.  These will
  // overwrite whatever you write out using specifically supported props.

  // ..........................................................
  // HANDLE ENCODING OF VIEW DESIGN
  //

  /**
    Encodes any simple properties that can just be copied from the object onto
    the coder.  This is used by encodeDesignProperties() and
    encodeLocalizedProperties().
  */
  encodeSimpleProperties: function(props, coder) {
    var object = this.get('object'), proto = this.get('objectClass').prototype ;
    props.forEach(function(prop) {
      var val = object[prop] ; // avoid get() since we don't want to exec props
      if (val !== undefined && (val !== proto[prop])) {
        coder.encode(prop, val) ;
      }
    }, this);
  },

  /**
    Array of properties that can be encoded directly.  This is an easy way to
    add support for simple properties that need to be written to the design
    without added code.  These properties will be encoded by
    encodeDesignProperties().

    You can add to this array in your subclasses.
  */
  designProperties: [],

  /*
    Array of properties specifically not displayed in the editable properties
    list
  */

  excludeProperties: [],

  /*
    Array of properties avaliaible to edit in greenhouse

  */
  editableProperties: function(){

    var con = this.get('designAttrs'),
        obj = this.get('object'),
        ret = [],
        designProperties = this.get('designProperties'),
        excludeProperties = this.get('excludeProperties');
    if(con) con = con[0];
    for(var i in con){
      if(con.hasOwnProperty(i) && excludeProperties.indexOf(i) < 0){
        if(!SC.none(obj[i])) ret.pushObject(SC.Object.create({value: obj[i], key: i, view: obj}));
      }
    }
    designProperties.forEach(function(k){
      if(excludeProperties.indexOf(k) < 0){
        ret.pushObject(SC.Object.create({value: obj[k], key: k, view: obj}));
      }
    });

    return ret;
  }.property('designProperties').cacheable(),

  /**
    Invoked by a design coder to encode design properties.  The default
    implementation invoked encodeDesignProperties() and
    encodeChildViewsDesign().  You can override this method with your own
    additional encoding if you like.
  */
  encodeDesign: function(coder) {
    coder.set('className', SC._object_className(this.get('objectClass')));
    this.encodeDesignProperties(coder);
    return YES ;
  },

  /**
    Encodes the design properties for the object.  These properties are simply
    copied from the object onto the coder.  As an optimization, the value of
    each property will be checked against the default value in the class. If
    they match, the property will not be emitted.
  */
  encodeDesignProperties: function(coder) {
    return this.encodeSimpleProperties(this.get('designProperties'), coder);
  },

  /**
    Array of localized that can be encoded directly.  This is an easy way to
    add support for simple properties that need to be written to the
    localization without added code.  These properties will be encoded by
    encodeLocalizedProperties().

    You can add to this array in your subclasses.
  */
  localizedProperties: [],

  /**
    Invoked by a localization coder to encode design properties.  The default
    implementation invoked encodeLocalizedProperties() and
    encodeChildViewsLoc().  You can override this method with your own
    additional encoding if you like.
  */
  encodeLoc: function(coder) {
    coder.set('className', SC._object_className(this.get('objectClass')));
    this.encodeLocalizedProperties(coder);
    return YES ;
  },

  /**
    Encodes the localized properties for the object.  These properties are
    simply copied from the object onto the coder.  As an optimization, the value
    of  each property will be checked against the default value in the class.
    If they match, the property will not be emitted.
  */
  encodeLocalizedProperties: function(coder) {
    return this.encodeSimpleProperties(this.get('localizedProperties'),coder);
  },

  /**
    This method is invoked when the designer is instantiated.  You can use
    this method to reload any state saved in the object.  This method is called
    before any observers or bindings are setup to give you a chance to
    configure the initial state of the designer.
  */
  awakeDesign: function() {},

  /**
    The unknownProperty handler will pass through to the object by default.
    This will often provide you the support you need without needing to
    customize the Designer.  Just make sure you don't define a conflicting
    property name on the designer itself!
  */
  unknownProperty: function(key, value) {
    if (value !== undefined) {
      this.object.set(key, value);
      return value ;
    } else return this.object.get(key);
  },

  // ......................................
  // PRIVATE METHODS
  //

  init: function() {

    // setup design from object state...
    this.awakeDesign();

    // setup bindings, etc
    sc_super();

    // and register with designController, if defined...
    var c= this.get('designController');
    if (c) c.registerDesigner(this) ;

  },

  destroy: function() {
    sc_super();
    this.set('object', null); // clears the object observer...
  },

  tryToPerform: function(methodName, arg1, arg2) {
    // only handle event if we are in design mode
    var page = this.object ? this.object.get('page') : null ;
    var isDesignMode = page ? page.get('needsDesigner') || page.get('isDesignMode') : NO ;

    // if we are in design mode, route event handling to the designer
    // otherwise, invoke default method.
    if (isDesignMode) {
      return sc_super();
    } else {
      return SC.Object.prototype.tryToPerform.apply(this.object, arguments);
    }
  }
}) ;

// Set default Designer for object
if (!SC.Object.Designer) SC.Object.Designer = SC.ObjectDesigner ;

// ..........................................................
// DESIGN NOTIFICATION METHODS
//
// These methods are invoked automatically on the designer class whenever it
// is loaded.

SC.ObjectDesigner.mixin({
  /**
    Invoked whenever a designed object is loaded.  This will save the design
    attributes for later use by a designer.
  */
  didLoadDesign: function(designedObject, sourceObject, attrs) {
    designedObject.isDesign = YES ; // indicates that we need a designer.
    designedObject.designAttrs = attrs;
    designedObject.sourceObject = sourceObject;
  },

  /**
    Invoked whenever a location is applied to a designed object.  Saves the
    attributes separately for use by the design object.
  */
  didLoadLocalization: function(designedObject, attrs) {
    // nothing to do for now.
  },

  /**
    Invoked whenver a object is created.  This will create a peer designer if
    needed.
  */
  didCreateObject: function(object, attrs) {
    // add designer if page is in design mode
    var page = object.get('page'), design = object.constructor;

    if (design.isDesign && page && page.get('needsDesigner')) {

      // find the designer class
      var cur = design, origDesign = design;
      while(cur && !cur.Designer) cur = cur.superclass;
      var DesignerClass = (cur) ? cur.Designer : SC.Object.Designer;

      // next find the first superclass object that is not a design (and a real
      // class).  This is important to make sure that we can determine the
      // real name of a object's class.
      while (design && design.isDesign) design = design.superclass;
      if (!design) design = SC.Object;

      object.designer = DesignerClass.create({
        object: object,
        objectClass: design,
        designAttrs: origDesign.designAttrs,
        sourceObject: origDesign.sourceObject
      });
    }
  }

});

{'repo_name': 'sproutit/sproutcore', 'stars': '460', 'repo_language': 'JavaScript', 'file_name': 'data.plist', 'mime_type': 'text/xml', 'hash': -2064760565943827103, 'source_dataset': 'data'}


package me.firesun.wechat.enhancement.plugin;

import de.robv.android.xposed.callbacks.XC_LoadPackage;

public interface IPlugin {
    public void hook(XC_LoadPackage.LoadPackageParam lpparam);
}

{'repo_name': 'firesunCN/WechatEnhancement', 'stars': '953', 'repo_language': 'Java', 'file_name': 'ReflectionUtil.java', 'mime_type': 'text/x-java', 'hash': 3464778093107232024, 'source_dataset': 'data'}


<?php

/*
 * This file is part of the Yosymfony\Spress.
 *
 * (c) YoSymfony <http://github.com/yosymfony>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Yosymfony\Spress\Core\DataSource\Memory;

use Yosymfony\Spress\Core\DataSource\AbstractDataSource;
use Yosymfony\Spress\Core\DataSource\ItemInterface;

/**
 * Memory data source. Useful for generating dynamic content.
 *
 * @author Victor Puertas <vpgugr@gmail.com>
 */
class MemoryDataSource extends AbstractDataSource
{
    private $items = [];
    private $layouts = [];
    private $includes = [];

    /**
     * {@inheritdoc}
     */
    public function getItems()
    {
        return $this->items;
    }

    /**
     * {@inheritdoc}
     */
    public function getLayouts()
    {
        return $this->layouts;
    }

    /**
     * {@inheritdoc}
     */
    public function getIncludes()
    {
        return $this->includes;
    }

    /**
     * Adds a new item.
     *
     * @param Yosymfony\Spress\Core\DataSource\ItemInterface $item
     *
     * @throws RuntimeException If a previous item exists with the same id
     */
    public function addItem(ItemInterface $item)
    {
        if ($this->hasItem($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous item exists with the same id: "%s".', $item->getId()));
        }

        $this->items[$item->getId()] = $item;
    }

    /**
     * Adds a new layout item.
     *
     * @param Yosymfony\Spress\Core\DataSource\ItemInterface $item
     *
     * @throws RuntimeException If a previous layout item exists with the same id
     */
    public function addLayout(ItemInterface $item)
    {
        if ($this->hasLayout($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous layout item exists with the same id: "%s".', $item->getId()));
        }

        $this->layouts[$item->getId()] = $item;
    }

    /**
     * Adds a new include item.
     *
     * @param Yosymfony\Spress\Core\DataSource\ItemInterface $item
     *
     * @throws RuntimeException If a previous include item exists with the same id
     */
    public function addInclude(ItemInterface $item)
    {
        if ($this->hasInclude($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous include item exists with the same id: "%s".', $item->getId()));
        }

        $this->includes[$item->getId()] = $item;
    }

    /**
     * Checks if an item exists.
     *
     * @param string $id The item's identifier
     *
     * @return bool
     */
    public function hasItem($id)
    {
        return isset($this->items[$id]);
    }

    /**
     * Checks if a layout item exists.
     *
     * @param string $id The item's identifier
     *
     * @return bool
     */
    public function hasLayout($id)
    {
        return isset($this->layouts[$id]);
    }

    /**
     * Checks if an include item exists.
     *
     * @param string $id The item's identifier
     *
     * @return bool
     */
    public function hasInclude($id)
    {
        return isset($this->includes[$id]);
    }

    /**
     * Sets an item.
     *
     * @param Yosymfony\Spress\Core\DataSource\ItemInterface $item
     */
    public function setItem(ItemInterface $item)
    {
        $this->items[$item->getId()] = $item;
    }

    /**
     * Sets a layout item.
     *
     * @param Yosymfony\Spress\Core\DataSource\ItemInterface $item
     */
    public function setLayout(ItemInterface $item)
    {
        $this->layouts[$item->getId()] = $item;
    }

    /**
     * Sets an include item.
     *
     * @param Yosymfony\Spress\Core\DataSource\ItemInterface $item
     */
    public function setInclude(ItemInterface $item)
    {
        $this->includes[$item->getId()] = $item;
    }

    /**
     * Counts the items registered.
     *
     * @return int
     */
    public function countItem()
    {
        return count($this->items);
    }

    /**
     * Counts the layout items registered.
     *
     * @return int
     */
    public function countLayout()
    {
        return count($this->layouts);
    }

    /**
     * Counts the include items registered.
     *
     * @return int
     */
    public function countInclude()
    {
        return count($this->includes);
    }

    /**
     * Removes an item.
     *
     * @param string $id The item's identifier
     */
    public function removeItem($id)
    {
        unset($this->items[$id]);
    }

    /**
     * Removes a layout item.
     *
     * @param string $id The item's identifier
     */
    public function removeLayout($id)
    {
        unset($this->layouts[$id]);
    }

    /**
     * Removes a include item.
     *
     * @param string $id The item's identifier
     */
    public function removeInclude($id)
    {
        unset($this->includes[$id]);
    }

    /**
     * Clears all items registered.
     */
    public function clearItem()
    {
        $this->items = [];
    }

    /**
     * Clears all layouts registered.
     */
    public function clearLayout()
    {
        $this->layouts = [];
    }

    /**
     * Clears all includes registered.
     */
    public function clearInclude()
    {
        $this->includes = [];
    }
}

{'repo_name': 'spress/spress', 'stars': '367', 'repo_language': 'PHP', 'file_name': 'SiteGeneratorTest.php', 'mime_type': 'text/x-php', 'hash': -5866307733155406813, 'source_dataset': 'data'}


#!/usr/bin/env python

from kafka_utils.kafka_cluster_manager.main import run

if __name__ == '__main__':
    run()

{'repo_name': 'Yelp/kafka-utils', 'stars': '257', 'repo_language': 'Python', 'file_name': 'test_main.py', 'mime_type': 'text/x-python', 'hash': 8877875335673852236, 'source_dataset': 'data'}


// Copyright 2015 Google 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 cpuload

import (
	"fmt"

	info "github.com/google/cadvisor/info/v1"

	"github.com/golang/glog"
	"github.com/google/cadvisor/utils/cpuload/netlink"
)

type CpuLoadReader interface {
	// Start the reader.
	Start() error

	// Stop the reader and clean up internal state.
	Stop()

	// Retrieve Cpu load for a given group.
	// name is the full hierarchical name of the container.
	// Path is an absolute filesystem path for a container under CPU cgroup hierarchy.
	GetCpuLoad(name string, path string) (info.LoadStats, error)
}

func New() (CpuLoadReader, error) {
	reader, err := netlink.New()
	if err != nil {
		return nil, fmt.Errorf("failed to create a netlink based cpuload reader: %v", err)
	}
	glog.V(3).Info("Using a netlink-based load reader")
	return reader, nil
}

{'repo_name': 'continuouspipe/continuouspipe', 'stars': '165', 'repo_language': 'PHP', 'file_name': 'xsrf.go', 'mime_type': 'text/plain', 'hash': 2293135281337601777, 'source_dataset': 'data'}