fKindness \u2744#RESIST","Ehhh","Mi sue\u00f1o es volar un Sukhoi Su-27","Il Social che va di moda","Abogada, Licenciada en Relaciones Internacionales. Empresaria. Mi corazon partido en dos entre Argentina y Espa\u00f1a.","Recensies, interviews, filmnieuws, films op tv, festivalverslagen en meer!","\ud83d\udcfa\ud83c\udfa4\ud83c\udfa8\ud83d\udcf9 (My job) ... \"A \ud83e\udd14 that sometimes drives me \ud83e\udd2a: am \ud83d\udc41 or are the others \ud83e\udd2c?\" - Albert Einstein\ud83e\udd13\ud83e\udde0","\u300c\u4e00\u9014\u4e00\u5fc3\u300d\u306a\u4ff3\u512a \u6728\u6751\u62d3\u54c9\u3055\u3093\u3092\u5c0a\u656c\u3057\u3066\u3044\u307e\u3059\u3002\u65e5\u672c\u304c\u8a87\u308c\u308b\u4ff3\u512a\u3068\u3057\u3066\u300e\u7121\u9650\u306e\u4f4f\u4eba\u300f\u306e\u69d8\u306b\u3069\u3093\u3069\u3093\u6d77\u5916\u306b\u3082\u98db\u3073\u51fa\u3057\u3066\u6b32\u3057\u3044\u3002(\u30b9\u30dd\u30fc\u30c4\u3068\u97d3\u30c9\u30e9\u304c\u597d\u304d\u3067\u3059\u3002\u65e5\u8ab2\u306f\u6c34\u6cf3\ud83c\udfca\u200d\u2640\ufe0f\u30d5\u30e9\u30c0\u30f3\u30b9\u3082\u59cb\u3081\u307e\u3057\u305f\ud83c\udf34)\u30d5\u30a9\u30ed\u30fc\u30d0\u30c3\u30af\u306f\u6642\u9593\u304b\u304b\u308a\u307e\u3059\ud83d\ude47\u200d\u2640\ufe0f","C\u026a\u0274\u1d07\u1d0d\u1d00. T\u0280\u1d00\u1d20\u1d07\u029f. C\u1d0f\u0493\u0493\u1d07\u1d07.W\u026a\u0274\u1d07&J\u1d00\u1d22\u1d22 \u029f\u1d0f\u1d20\u1d07\u0280 T\u1d00\u1d1b\u1d1b\u1d0f\u1d0f\u1d07\u1d05.G\u1d07\u1d0d\u026a\u0274\u026a.F\u1d07\u1d0d\u026a\u0274\u026as\u1d1b \u1d00\u029f\u029f\u028f. M\u1d1cs\u026a\u1d04 \u026as \u1d1b\u029c\u1d07 \u1d00\u0274s\u1d21\u1d07\u0280. M\u026a\u1d07\u1d0d\u0299\u0280\u1d0f \u1d05\u1d07 \u029f\u1d00 #ComunidadFuturock\u270c\ud83c\udffc| A\u1d0d\u1d0f\u0280 \u1d0f N\u1d00\u1d05\u1d00 | S\u026a\u1d07\u1d0d\u1d18\u0280\u1d07 \u1d07s \u029c\u1d0f\u028f |","Webdesigner-Photographe-Auteur- Ce n'est pas grandir le probl\u00e8me de nos vies, c'est d'oublier que nous avons \u00e9t\u00e9 un enfant qui avait des r\u00eaves ! **showrunner**","Le Top de l'Actualit\u


 [res_last]"r"(res_last),
      [inc_p_costs]"r"(inc_p_costs)
    : "memory"
  );

  // Last coefficient is always non-zero
  {
    const int v = abs(res->coeffs[n]);
    assert(v != 0);
    cost += VP8LevelCost(t, v);
    if (n < 15) {
      const int b = VP8EncBands[n + 1];
      const int ctx = (v == 1) ? 1 : 2;
      const int last_p0 = res->prob[b][ctx][0];
      cost += VP8BitCost(0, last_p0);
    }
  }
  return cost;
}

static void SetResidualCoeffs_MIPS32(const int16_t* const coeffs,
                                     VP8Residual* const res) {
  const int16_t* p_coeffs = (int16_t*)coeffs;
  int temp0, temp1, temp2, n, n1;
  assert(res->first == 0 || coeffs[0] == 0);

  __asm__ volatile (
    ".set     push                                      \n\t"
    ".set     noreorder                                 \n\t"
    "addiu    %[p_coeffs],   %[p_coeffs],    28         \n\t"
    "li       %[n],          15                         \n\t"
    "li       %[temp2],      -1                         \n\t"
  "0:                                                   \n\t"
    "ulw      %[temp0],      0(%[p_coeffs])             \n\t"
    "beqz     %[temp0],      1f                         \n\t"
#if defined(WORDS_BIGENDIAN)
    " sll     %[temp1],      %[temp0],       16         \n\t"
#else
    " srl     %[temp1],      %[temp0],       16         \n\t"
#endif
    "addiu    %[n1],         %[n],           -1         \n\t"
    "movz     %[temp0],      %[n1],          %[temp1]   \n\t"
    "movn     %[temp0],      %[n],           %[temp1]   \n\t"
    "j        2f                                        \n\t"
    " addiu   %[temp2],      %[temp0],       0          \n\t"
  "1:                                                   \n\t"
    "addiu    %[n],          %[n],           -2         \n\t"
    "bgtz     %[n],          0b                         \n\t"
    " addiu   %[p_coeffs],   %[p_coeffs],    -4         \n\t"
  "2:                                                   \n\t"
    ".set     pop                                       \n\t"
    : [p_coeffs]"+&r"(p_coeffs), [temp0]"=&r"(temp0),
      [temp1]"=&r"(temp1), [temp2]"=&r"(temp2),
      [n]"=&r"(n), [n1]"=&r"(n1)
    :
    : "memory"
  );
  res->last = temp2;
  res->coeffs = coeffs;
}

//------------------------------------------------------------------------------
// Entry point

extern void VP8EncDspCostInitMIPS32(void);

WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPS32(void) {
  VP8GetResidualCost = GetResidualCost_MIPS32;
  VP8SetResidualCoeffs = SetResidualCoeffs_MIPS32;
}

#else  // !WEBP_USE_MIPS32

WEBP_DSP_INIT_STUB(VP8EncDspCostInitMIPS32)

#endif  // WEBP_USE_MIPS32


T_LOG_OPT_TCPOPT;
		break;

	case '3':
		if (*flags & IPT_LOG_OPT_IPOPT)
			xtables_error(PARAMETER_PROBLEM,
				   "Can't specify --log-ip-options twice");

		loginfo->logflags |= IPT_LOG_IPOPT;
		*flags |= IPT_LOG_OPT_IPOPT;
		break;

	case '4':
		if (*flags & IPT_LOG_OPT_UID)
			xtables_error(PARAMETER_PROBLEM,
				   "Can't specify --log-uid twice");

		loginfo->logflags |= IPT_LOG_UID;
		*flags |= IPT_LOG_OPT_UID;
		break;

	default:
		return 0;
	}

	return 1;
}

static void LOG_print(const void *ip, const struct xt_entry_target *target,
                      int numeric)
{
	const struct ipt_log_info *loginfo
		= (const struct ipt_log_info *)target->data;
	unsigned int i = 0;

	printf("LOG ");
	if (numeric)
		printf("flags %u level %u ",
		       loginfo->logflags, loginfo->level);
	else {
		for (i = 0; i < ARRAY_SIZE(ipt_log_names); ++i)
			if (loginfo->level == ipt_log_names[i].level) {
				printf("level %s ", ipt_log_names[i].name);
				break;
			}
		if (i == ARRAY_SIZE(ipt_log_names))
			printf("UNKNOWN level %u ", loginfo->level);
		if (loginfo->logflags & IPT_LOG_TCPSEQ)
			printf("tcp-sequence ");
		if (loginfo->logflags & IPT_LOG_TCPOPT)
			printf("tcp-options ");
		if (loginfo->logflags & IPT_LOG_IPOPT)
			printf("ip-options ");
		if (loginfo->logflags & IPT_LOG_UID)
			printf("uid ");
		if (loginfo->logflags & ~(IPT_LOG_MASK))
			printf("unknown-flags ");
	}

	if (strcmp(loginfo->prefix, "") != 0)
		printf("prefix `%s' ", loginfo->prefix);
}

static void LOG_save(const void *ip, const struct xt_entry_target *target)
{
	const struct ipt_log_info *loginfo
		= (const struct ipt_log_info *)target->data;

	if (strcmp(loginfo->prefix, "") != 0) {
		printf("--log-prefix ");
		xtables_save_string(loginfo->prefix);
	}

	if (loginfo->level != LOG_DEFAULT_LEVEL)
		printf("--log-level %d ", loginfo->level);

	if (loginfo->logflags & IPT_LOG_TCPSEQ)
		printf("--log-tcp-sequence ");
	if (loginfo->logflags & IPT_LOG_TCPOPT)
		printf("--log-tcp-options ");
	if (loginfo->logflags & IPT_LOG_IPOPT)
		printf("--log-ip-options ");
	if (loginfo->logflags & IPT_LOG_UID)
		printf("--log-uid ");
}

static struct xtables_target log_tg_reg = {
    .name          = "LOG",
    .version       = XTABLES_VERSION,
    .family        = NFPROTO_IPV4,
    .size          = XT_ALIGN(sizeof(struct ipt_log_info)),
    .userspacesize = XT_ALIGN(sizeof(struct ipt_log_info)),
    .help          = LOG_help,
    .init          = LOG_init,
    .parse         = LOG_parse,
    .print         = LOG_print,
    .save          = LOG_save,
    .extra_opts    = LOG_opts,
};

void _init(void)
{
	xtables_register_target(&log_tg_reg);
}


*          meaning it cannot be changed or deleted.

   *
If you applied Vault Lock to your vault without specifying a lock date, you can change
   *          your Vault Lock settings, or delete Vault Lock from the vault entirely, at any time.

   *
This value is in Unix format, Coordinated Universal Time (UTC), and accurate to
   *          milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018
   *          12:11:30.087 AM.

   */
  LockDate?: Date;
}

/**
 * @public
 *
Contains DeleteAt and MoveToColdStorageAt timestamps, which
 *          are used to specify a lifecycle for a recovery point.

 *
The lifecycle defines when a protected resource is transitioned to cold storage and when
 *          it expires. Backup transitions and expires backups automatically according to
 *          the lifecycle that you define.

 *
Backups transitioned to cold storage must be stored in cold storage for a minimum of 90
 *          days. Therefore, the “retention” setting must be 90 days greater than the “transition to
 *          cold after days” setting. The “transition to cold after days” setting cannot be changed
 *          after a backup has been transitioned to cold.

 *
Resource types that are able to be transitioned to cold storage are listed in the "Lifecycle to cold storage"
 *          section of the
 *             Feature availability by resource table. Backup ignores this expression for
 *          other resource types.

 */
export interface CalculatedLifecycle {
  /**
   * @public
   *
A timestamp that specifies when to transition a recovery point to cold storage.

   */
  MoveToColdStorageAt?: Date;

  /**
   * @public
   *
A timestamp that specifies when to delete a recovery point.

   */
  DeleteAt?: Date;
}

/**
 * @public
 */
export interface CancelLegalHoldInput {
  /**
   * @public
   *
Legal hold ID required to remove the specified legal hold on a recovery point.

   */
  LegalHoldId: string | undefined;

  /**
   * @public
   *
String describing the reason for removing the legal hold.

   */
  CancelDescription: string | undefined;

  /**
   * @public
   *
The integer amount in days specifying amount of days after this
   *          API operation to remove legal hold.

   */
  RetainRecordInDays?: number;
}

/**
 * @public
 */
export interface CancelLegalHoldOutput {}

/**
 * @public
 *
Indicates that something is wrong with a parameter's value. For example, the value is
 *          out of range.

 */
export class InvalidParameterValueException extends __BaseException {
  readonly name: "InvalidParameterValueException" = "InvalidParameterValueException";
  readonly $fault: "client" = "client";
  Code?: string;
  Message?: string;
  /**
   * @public
   *

   */
  Type?: string;

  /**
   * @public
   *

   */
  Context?: string;
  /**
   * @internal
   */
  constructor(opts: __ExceptionOptionType<InvalidParameterValueException, __BaseException>) {
    super({
      name: "InvalidParameterValueException",
      $fault: "client",
      ...opts,
    });
    Object.setPrototypeOf(this, InvalidParameterValueException.prototype);
    this.Code = opts.Code;
    this.Message = opts.Message;
    this.Type = opts.Type;
    this.Context = opts.Co


lar-border-width: .5px}.request-section-content-filter[data-v-dcd86938]{box-shadow:0 -10px 0 10px var(--scalar-background-1)}.request-item:focus-within .request-meta-buttons[data-v-dcd86938]{opacity:1}.group-hover-input[data-v-dcd86938]{border-width:var(--scalar-border-width);border-color:transparent}.group:hover .group-hover-input[data-v-dcd86938]{background:color-mix(in srgb,var(--scalar-background-1),var(--scalar-background-2));border-color:var(--scalar-border-color)}.group-hover-input[data-v-dcd86938]:focus{background:transparent!important;border-color:var(--scalar-border-color)!important}@media (min-width: 800px){.has-no-import-url,.has-import-url{max-width:100dvw;overflow-x:hidden;contain:paint}.has-no-import-url{opacity:1;background:var(--scalar-background-1);animation:transform-restore-layout ease-in-out .3s forwards}.has-import-url .scalar-client>main{opacity:0;transform:scale(.85) translate3d(calc(50dvw + 80px),0,0);animation:transform-fade-layout ease-in-out .3s forwards;border:var(--scalar-border-width) solid var(--scalar-border-color);border-radius:12px;overflow:hidden;z-index:10000}.has-import-url .scalar-client .sidenav{display:none}.has-no-import-url .scalar-app,.has-import-url .scalar-app{background:var(--scalar-background-1)!important}}@keyframes transform-fade-layout{0%{opacity:0;transform:scale(.85) translate3d(calc(50dvw + 80px),10px,0)}to{opacity:1;transform:scale(.85) translate3d(calc(50dvw + 80px),0,0)}}@keyframes transform-restore-layout{0%{opacity:1;transform:scale(.85) translate3d(calc(50dvw + 80px),0,0)}to{opacity:1;transform:scale(1) translateZ(0)}}.openapi-color{color:var(--scalar-color-green)}.section-flare{position:fixed;top:0;right:-50dvw}@layer scalar-base,scalar-theme;@layer scalar-base{body{margin:0;line-height:inherit}:root{--scalar-border-width: .5px;--scalar-radius: 3px;--scalar-radius-lg: 6px;--scalar-radius-xl: 8px;--scalar-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;--scalar-font-code: "JetBrains Mono", ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;--scalar-heading-1: 40px;--scalar-page-description: 24px;--scalar-heading-2: 24px;--scalar-heading-3: 20px;--scalar-heading-4: 16px;--scalar-heading-5: 16px;--scalar-heading-6: 16px;--scalar-paragraph: 16px;--scalar-small: 14px;--scalar-mini: 13px;--scalar-micro: 12px;--scalar-bold: 600;--scalar-semibold: 500;--scalar-regular: 400;--scalar-font-size-1: 24px;--scalar-font-size-2: 16px;--scalar-font-size-3: 14px;--scalar-font-size-4: 13px;--scalar-font-size-5


 = "FIN_WAIT1",
                            7 => connection_state = "FIN_WAIT2",
                            8 => connection_state = "CLOSE_WAIT",
                            9 => connection_state = "CLOSING",
                            10 => connection_state = "LAST_ACK",
                            11 => connection_state = "TIME_WAIT",
                            12 => connection_state = "DELETE_TCB",
                            _ => connection_state = "UNKNOWN"
                        };
                        &output_table.push(ProcessOpenSocketsRow {
                            pid: tcp_row.dwOwningPid as i64,
                            fd: 0,  // NA for windows
                            socket: 0,  // NA for windows
                            family: 2,  // IPv4
                            protocol: 6,    // TCP
                            local_address: Ipv4Addr::from(u32::from_be(tcp_row.dwLocalAddr)).to_string(),
                            remote_address: Ipv4Addr::from(u32::from_be(tcp_row.dwRemoteAddr)).to_string(),
                            local_port: u16::from_be(tcp_row.dwLocalPort as u16) as i32,
                            remote_port: u16::from_be(tcp_row.dwRemotePort as u16) as i32,
                            path: "".to_string(),   // NA for windows
                            state: connection_state.to_string(),
                            net_namespace: "".to_string(),  // NA for windows
                        });
                    };
                }
            }
        },

        SocketType::Tcp6 => {

            let mut buffer: Vec<u8>;
            let tcp6_return_val: u32;
            let tcp6_table_ptr: *const MIB_TCP6TABLE_OWNER_PID;

            get_extended_tcp_table_internal(ptr::null_mut(), table_size_ptr, 1, AF_INET6, TCP_TABLE_CLASS::TCP_TABLE_OWNER_PID_ALL, 0);

            buffer = Vec::with_capacity(table_size as usize);
            tcp6_return_val = get_extended_tcp_table_internal(buffer.as_mut_ptr(), table_size_ptr, 1, AF_INET6, TCP_TABLE_CLASS::TCP_TABLE_OWNER_PID_ALL, 0);
            tcp6_table_ptr = buffer.as_mut_ptr() as *const MIB_TCP6TABLE_OWNER_PID;

            if tcp6_return_val == 0 && table_size > 0 {
                unsafe {

                    let tcp6_table = &(*tcp6_table_ptr).table as *const MIB_TCP6ROW_OWNER_PID;

                    let num_entries = (*tcp6_table_ptr).dwNumEntries;

                    for i in 0..num_entries {
                        let tcp6_row = *tcp6_table.offset(i as isize);

                        let connection_state_int = tcp6_row.dwState;
                        match connection_state_int {
                            1 => connection_state = "CLOSED",
                            2 => connection_state = "LISTEN",
                            3 => connection_state = "SYN_SENT",
                            4 => connection_state = "SYN_RCVD",
                            5 => connection_state = "ESTAB",
                            6 => connection_state = "FIN_WAIT1",
                            7 => connection_state = "FIN_WAIT2",
                            8 => connection_state = "CLOSE_WAIT",
                            9 => connection_state = "CLOSING",
                            10 => connection_state = "LAST_ACK",
                            11 => connection_state = "TIME_WAIT",
                            12 => connection_state = "DELETE_TCB",
                            _ => connection_state = "UNKNOWN"
                        };

                        let local_ipv6_bytes: [u8; 16] = tcp6_row.ucLocalAddr;


_sum), (ep1 + ep2));
    }

    #[test]
    fn vector2dfloat_partialeq() {
        let v1 = Vector2DFloat::new((1.0, 2.0), (2.0, 3.0));
        let v2 = Vector2DFloat::new((2.0, 3.0), (3.0, 4.0));
        let v3 = Vector2DFloat::new_bound((10.0, 10.0));
        // equivalence defined on magnitude and direction comparison only
        assert_eq!(v1.coord, v2.coord);
        assert_ne!(v1.begin, v2.begin);
        assert_ne!(v1.end(), v2.end());
        assert_eq!(v1, v2);
        assert_ne!(v1, v3);
    }

    #[test]
    fn vector2dfloat_unary_neg_operator() {
        let v1 = Vector2DFloat::new((1.0, 2.0), (3.0, 4.0));
        let v2 = Vector2DFloat::new((3.0, 4.0), (1.0, 2.0));
        let v3 = Vector2DFloat::new((-1.0, -2.0), (-3.0, -4.0));
        let v4 = Vector2DFloat::new((-3.0, -4.0), (-1.0, -2.0));
        assert_relative_eq!(v1.coord.x, 2.0);
        assert_relative_eq!(v1.coord.y, 2.0);
        assert_relative_eq!(-v1.coord.x, -2.0);
        assert_relative_eq!(-v1.coord.y, -2.0);
        assert_eq!(-v1, -v1);
        assert_eq!(-v1, v2);
        assert_eq!(-v3, -v3);
        assert_eq!(-v3, v4);
    }

    #[test]
    fn vector2dfloat_add_operator() {
        let v1 = Vector2DFloat::new_bound((5.1, 5.1));
        let v2 = Vector2DFloat::new_bound((4.2, 4.2));
        let v3 = Vector2DFloat::new_bound((1.3, 1.3));
        let v_zero = Vector2DFloat::new_bound((0.0, 0.0));
        assert_eq!(v1 + v2, Vector2DFloat::new_bound((5.1 + 4.2, 5.1 + 4.2)));
        assert_eq!(v2 + v1, Vector2DFloat::new_bound((5.1 + 4.2, 5.1 + 4.2)));
        assert_eq!(v1 + v2 + v3, Vector2DFloat::new_bound((5.1 + 4.2 + 1.3, 5.1 + 4.2 + 1.3)));
        assert_eq!((v1 + v2) + v3, Vector2DFloat::new_bound((5.1 + 4.2 + 1.3, 5.1 + 4.2 + 1.3)));
        assert_eq!(v1 + (v2 + v3), Vector2DFloat::new_bound((5.1 + 4.2 + 1.3, 5.1 + 4.2 + 1.3)));
        assert_eq!(v1 + v_zero, v1);
        assert_eq!(v_zero + v1, v1);
        assert_eq!(v1 + (-v1), v_zero);
        let v1_v2 = v1 + v2;
        assert_eq!(v1.begin, v1_v2.begin);
        // vectors have same distance and magnitude but different
        // begin / end coordinates. The lhs begin takes precedence
        // in addition.
        let v4 = Vector2DFloat::new((1.3, 1.3), (2.3, 2.3));
        let v5 = Vector2DFloat::new((2.3, 2.3), (3.3, 3.3));


ston, MA 02110, USA
*************************************************************************************/

#include "UrlParser.h"
#include "Consts.h"
#include "options/DefaultOptions.h"
#include "pool/GlobalStateInfo.h"
#include "Exception.hpp"
#include "credential/CredentialPluginLoader.h"
#include "logger/LoggerFactory.h"

namespace sql
{
namespace mariadb
{
  const SQLString mysqlTcp("tcp://"), mysqlSocket("unix://"), mysqlPipe("pipe://");

  bool isLegacyUriFormat(const SQLString& url)
  {
    if (url.empty() || url.startsWith(mysqlTcp))
    {
      return true;
    }
    else if (url.startsWith(mysqlPipe)) {
      return true;
    }
    else if (url.startsWith(mysqlSocket)) {
      return true;
    }

    return false;
  }

  UrlParser::UrlParser() : options(new Options())
  {}

  UrlParser::UrlParser(SQLString& database, std::vector<HostAddress>& addresses, Shared::Options options, enum HaMode haMode) :
    database(database),
    options(options),
    addresses(addresses),
    haMode(haMode)
  {
    if (haMode == HaMode::AURORA)
    {
      for (HostAddress hostAddress : addresses) {
        hostAddress.type= "";
      }
    }
    else
    {
      for (HostAddress hostAddress : addresses) {
        if (hostAddress.type.empty()) {
          hostAddress.type= ParameterConstant::TYPE_MASTER;
        }
      }
    }
    this->credentialPlugin= CredentialPluginLoader::get(StringImp::get(options->credentialType));
    DefaultOptions::postOptionProcess(options, credentialPlugin.get());
    setInitialUrl();
    loadMultiMasterValue();
  }

  bool UrlParser::acceptsUrl(const SQLString& url) {
    return (url.startsWith("jdbc:mariadb:") || isLegacyUriFormat(url));
  }

  UrlParser* UrlParser::parse(const SQLString& url) {
    Properties emptyProps;
    return parse(url, emptyProps);
  }

  UrlParser* UrlParser::parse(const SQLString& url, Properties& prop)
  {
    if (url.startsWith("jdbc:mariadb:")
      || isLegacyUriFormat(url))
    {
      UrlParser *urlParser= new UrlParser();

      parseInternal(*urlParser, url, prop);
      return urlParser;
    }

    return nullptr;
  }

  void UrlParser::parseInternal(UrlParser& urlParser, const SQLString& url, Properties &properties)
  {
    try
    {
      urlParser.initialUrl= url;
      size_t separator= StringImp::get(url).find("//");

      if (separator == std::string::npos)
      {
        throw IllegalArgumentException("url parsing error : '//' is not present in the url " + url);
      }
      urlParser.haMode= parseHaMode(url, separator);

      if (urlParser.haMode != HaMode::NONE)
      {
        throw SQLFeatureNotImplementedException(SQLString("Support of the HA mode") + HaModeStrMap[urlParser.haMode] + "is not yet implemented");
      }

      SQLString urlSecondPart= url.substr(separator + 2);
      size_t dbIndex= urlSecondPart.find_first_of('/');
      size_t paramIndex= urlSecondPart.find_first_of('?');
      SQLString hostAddressesString;
      SQLString additionalParameters;

      if (paramIndex != std::string::npos && (dbIndex == std::string::npos || dbIndex > paramIndex))
      {
        hostAddressesString= urlSecondPart.substr(0, paramIndex


#ifndef __BLEND_FUNCTOR_SSE2_H__
#define __BLEND_FUNCTOR_SSE2_H__

extern "C" {
extern unsigned char TVPOpacityOnOpacityTable[256*256];
extern unsigned char TVPNegativeMulTable[256*256];
};

// ソースのアルファを使う
template<typename blend_func>
struct sse2_variation : public blend_func {
	inline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {
		tjs_uint32 a = (s>>24);
		return blend_func::operator()( d, s, a );
	}
	inline __m128i operator()( __m128i d, __m128i s ) const {
		__m128i a = s;
		a = _mm_srli_epi32( a, 24 );
		return blend_func::operator()( d, s, a );
	}
};

// ソースのアルファとopacity値を使う
template<typename blend_func>
struct sse2_variation_opa : public blend_func {
	const tjs_int32 opa_;
	const __m128i opa128_;
	inline sse2_variation_opa( tjs_int32 opa ) : opa_(opa), opa128_(_mm_set1_epi32(opa)) {}
	inline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {
		//tjs_uint32 a = ((s>>24)*opa_) >> 8;
		tjs_uint32 a = (tjs_uint32)( ((tjs_uint64)s*(tjs_uint64)opa_) >> 32 );	// 最適化でうまくmulの上位ビット入るはず
		return blend_func::operator()( d, s, a );
	}
	inline __m128i operator()( __m128i d, __m128i s ) const {
		__m128i a = s;
		a = _mm_srli_epi32( a, 24 );
		a = _mm_mullo_epi16( a, opa128_ );
		a = _mm_srli_epi32( a, 8 );
		return blend_func::operator()( d, s, a );
	}
};

// ソースとデスティネーションのアルファを使う
//template<typename blend_func>
struct sse2_alpha_blend_d_functor {
	const __m128i colormask_;
	const __m128i zero_;
	inline sse2_alpha_blend_d_functor() : colormask_(_mm_set1_epi32(0x00ffffff)), zero_(_mm_setzero_si128()){}
	inline tjs_uint32 operator()( tjs_uint32 d, tjs_uint32 s ) const {
		tjs_uint32 addr = ((s >> 16) & 0xff00) + (d>>24);
		tjs_uint32 sopa = TVPOpacityOnOpacityTable[addr];

		__m128i ma = _mm_cvtsi32_si128( sopa );
		ma = _mm_shufflelo_epi16( ma, _MM_SHUFFLE( 0, 0, 0, 0 )  );	// 00oo00oo00oo00oo
		__m128i ms = _mm_cvtsi32_si128( s );
		ms = _mm_unpacklo_epi8( ms, zero_ );// 00 ss 00 ss 00 ss 00 ss
		__m128i md = _mm_cvtsi32_si128( d );
		md = _mm_unpacklo_epi8( md, zero_ );// 00 dd 00 dd 00 dd 00 dd

		ms = _mm_sub_epi16( ms, md );		// ms -= md
		ms = _mm_mullo_epi16( ms, ma );		// ms *= ma
		md = _mm_slli_epi16( md, 8 );		// md <<= 8
		md = _mm_add_epi16( md, ms );		// md += ms
		md = _mm_srli_epi16( md, 8 );		// ms >>= 8
		md = _mm_packus_epi16( md, md );
		tjs_uint32 ret = _mm_cvtsi128_si32( md );

#if 0
		// TVPNegativeMulTable[addr] = (unsigned char)( 255 - (255-a)*(255-b)/ 255 );
		addr ^= 0xffff; // (a = 255-a, b = 255-b) : ^=xor
		tjs_uint32 tmp = addr;
		addr = (addr&0xff) * (tmp>>8);	// (255-a)*(255-b)
		addr = ~addr;	// result = 255-result : ビット反転
		addr = (addr&0xff00) << 16;	// /255 : 最下位ではなく、一つ上を選択することで/255と同等
#endif
		addr = TVPNegativeMulTable[addr] << 24;
		return (ret&0x00ffffff) | addr;
	}
	inline __m128i operator()( __m128i md1, __m128i ms1 ) const {
		//if( _mm_testc_si128( s, alphamask_ ) ) { return s; }
		//if( _mm_testz_si128( s, alphamask_ ) ) { return d; }
		__m128i sa = ms1;
		sa  = _mm_srli_epi32( sa, 24 );
		__m128i da = md1;
		da = _mm_srli_epi32( da, 24 );
		__m128i maddr = _mm_add_epi32( _mm_slli_epi32(sa, 8), da );
		__m128i dopa = maddr;
#if 0
		tjs_uint32 addr;
		addr = _mm_cvtsi128_si32( maddr );
		tjs_uint32 opa = TVPOpacityOnOpacityTable[addr];
		__m128i mopa = _mm_cvtsi32_si128( opa );

		maddr = _mm_shuffle_epi32( maddr, _MM_SHUFFLE( 0, 3, 2, 1 ) );
		addr = _mm_cvtsi128_si32( maddr );
		opa = TVPOpacityOnOpacityTable[addr];
		__m128i mopa2 = _mm_cvtsi32_si128( opa );
		mopa = _mm_unpacklo_epi32( mopa, mopa2 );

		maddr = _mm_shuffle_epi32( maddr, _MM_SHUFFLE( 0, 3, 2, 1 ) );
		addr = _mm_cvtsi128_si32( maddr );
		opa = TVPOpacityOnOpacityTable[addr];
		mopa2 = _mm_cvtsi32_si128( opa );

		maddr = _mm_shuffle_epi32( maddr, _MM_SHUFFLE( 0, 3, 2, 1 ) );
		addr = _mm_cvtsi128_si32( maddr );
		opa = TVPOpacityOnOpacityTable[addr];
		__m128i mopa3 = _mm_cvtsi32_si128( opa );
		mopa2 = _mm_unpacklo_epi32( mopa2, mopa3 );

		mopa = _mm_unpacklo_epi64( mopa, mopa2 );
#else	// 以下のようにコンパイラ任せの方がいいかも
		__m128i ma1 = _mm_set_epi32(
			TVPOpacityOnOpacityTable[maddr.m128i_u32[3]],
			TVPOpacityOnOpacityTable[maddr.m128i_u32[2]],
			TVPOpacityOnOpacityTable[maddr.m128i_u32[1]],
			TVPOpacityOnOpacityTable[maddr.m128i_u32[0]]);
#endif
#if 0
		tjs_uint32 sopa = ma1.m128i_u32[0];
		tjs_uint32 d = md1.m128i_u32[0];
		tjs_uint32 s = ms1.m128i_u32[0];
		tjs_uint32 d1 = d & 0xff00ff;
		d1 = (d1 + (((s & 0xff00ff) - d1) * sopa >> 8)) & 0xff00ff;
		d &= 0xff00;
		s &= 0xff00;
		tjs_uin


 devil\'s darning needle, sewing needle, ' +
      'snake feeder, snake doctor, mosquito hawk, skeeter hawk',
  320: 'damselfly',
  321: 'admiral',
  322: 'ringlet, ringlet butterfly',
  323: 'monarch, monarch butterfly, milkweed butterfly, Danaus plexippus',
  324: 'cabbage butterfly',
  325: 'sulphur butterfly, sulfur butterfly',
  326: 'lycaenid, lycaenid butterfly',
  327: 'starfish, sea star',
  328: 'sea urchin',
  329: 'sea cucumber, holothurian',
  330: 'wood rabbit, cottontail, cottontail rabbit',
  331: 'hare',
  332: 'Angora, Angora rabbit',
  333: 'hamster',
  334: 'porcupine, hedgehog',
  335: 'fox squirrel, eastern fox squirrel, Sciurus niger',
  336: 'marmot',
  337: 'beaver',
  338: 'guinea pig, Cavia cobaya',
  339: 'sorrel',
  340: 'zebra',
  341: 'hog, pig, grunter, squealer, Sus scrofa',
  342: 'wild boar, boar, Sus scrofa',
  343: 'warthog',
  344: 'hippopotamus, hippo, river horse, Hippopotamus amphibius',
  345: 'ox',
  346: 'water buffalo, water ox, Asiatic buffalo, Bubalus bubalis',
  347: 'bison',
  348: 'ram, tup',
  349: 'bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky ' +
      'Mountain sheep, Ovis canadensis',
  350: 'ibex, Capra ibex',
  351: 'hartebeest',
  352: 'impala, Aepyceros melampus',
  353: 'gazelle',
  354: 'Arabian camel, dromedary, Camelus dromedarius',
  355: 'llama',
  356: 'weasel',
  357: 'mink',
  358: 'polecat, fitch, foulmart, foumart, Mustela putorius',
  359: 'black-footed ferret, ferret, Mustela nigripes',
  360: 'otter',
  361: 'skunk, polecat, wood pussy',
  362: 'badger',
  363: 'armadillo',
  364: 'three-toed sloth, ai, Bradypus tridactylus',
  365: 'orangutan, orang, orangutang, Pongo pygmaeus',
  366: 'gorilla, Gorilla gorilla',
  367: 'chimpanzee, chimp, Pan troglodytes',
  368: 'gibbon, Hylobates lar',
  369: 'siamang, Hylobates syndactylus, Symphalangus syndactylus',
  370: 'guenon, guenon monkey',
  371: 'patas, hussar monkey, Erythrocebus patas',
  372: 'baboon',
  373: 'macaque',
  374: 'langur',
  375: 'colobus, colobus monkey',
  376: 'proboscis monkey, Nasalis larvatus',
  377: 'marmoset',
  378: 'capuchin, ringtail, Cebus capucinus',
  379: 'howler monkey, howler',
  380: 'titi, titi monkey',
  381: 'spider monkey, Ateles geoffroyi',
  382: 'squirrel monkey, Saimiri sciureus',
  383: 'Madagascar cat, ring-tailed lemur, Lemur catta',
  384: 'indri, indris, Indri indri, Indri brevicaudatus',
  385: 'Indian elephant, Elephas maximus',
  386: 'African elephant, Loxodonta africana',
  387: 'lesser panda, red panda, panda, bear c


//...Packing for Y face(3,7,10,15,17).................................
    ScaLBL_D3Q19_Pack(3, dvcSendList_Y, 0, sendCount_Y, sendbuf_Y, Aq, N);
    ScaLBL_D3Q19_Pack(3, dvcSendList_Y, sendCount_Y, sendCount_Y, sendbuf_Y, Bq,
                      N);
    ScaLBL_D3Q19_Pack(3, dvcSendList_Y, 2 * sendCount_Y, sendCount_Y, sendbuf_Y,
                      Cq, N);
    //...Packing for z face(6,12,13,16,17)................................
    ScaLBL_D3Q19_Pack(6, dvcSendList_z, 0, sendCount_z, sendbuf_z, Aq, N);
    ScaLBL_D3Q19_Pack(6, dvcSendList_z, sendCount_z, sendCount_z, sendbuf_z, Bq,
                      N);
    ScaLBL_D3Q19_Pack(6, dvcSendList_z, 2 * sendCount_z, sendCount_z, sendbuf_z,
                      Cq, N);
    //...Packing for Z face(5,11,14,15,18)................................
    ScaLBL_D3Q19_Pack(5, dvcSendList_Z, 0, sendCount_Z, sendbuf_Z, Aq, N);
    ScaLBL_D3Q19_Pack(5, dvcSendList_Z, sendCount_Z, sendCount_Z, sendbuf_Z, Bq,
                      N);
    ScaLBL_D3Q19_Pack(5, dvcSendList_Z, 2 * sendCount_Z, sendCount_Z, sendbuf_Z,
                      Cq, N);

    //...................................................................................
    // Send all the distributions
    req1[0] =
        MPI_COMM_SCALBL.Isend(sendbuf_x, 3 * sendCount_x, rank_x, sendtag + 0);
    req2[0] =
        MPI_COMM_SCALBL.Irecv(recvbuf_X, 3 * recvCount_X, rank_X, recvtag + 0);
    req1[1] =
        MPI_COMM_SCALBL.Isend(sendbuf_X, 3 * sendCount_X, rank_X, sendtag + 1);
    req2[1] =
        MPI_COMM_SCALBL.Irecv(recvbuf_x, 3 * recvCount_x, rank_x, recvtag + 1);
    req1[2] =
        MPI_COMM_SCALBL.Isend(sendbuf_y, 3 * sendCount_y, rank_y, sendtag + 2);
    req2[2] =
        MPI_COMM_SCALBL.Irecv(recvbuf_Y, 3 * recvCount_Y, rank_Y, recvtag + 2);
    req1[3] =
        MPI_COMM_SCALBL.Isend(sendbuf_Y, 3 * sendCount_Y, rank_Y, sendtag + 3);
    req2[3] =
        MPI_COMM_SCALBL.Irecv(recvbuf_y, 3 * recvCount_y, rank_y, recvtag + 3);
    req1[4] =
        MPI_COMM_SCALBL.Isend(sendbuf_z, 3 * sendCount_z, rank_z, sendtag + 4);
    req2[4] =
        MPI_COMM_SCALBL.Irecv(recvbuf_Z, 3 * recvCount_Z, rank_Z, recvtag + 4);
    req1[5] =
        MPI_COMM_SCALBL.Isend(sendbuf_Z, 3 * sendCount_Z, rank_Z, sendtag + 5);
    req2[5] =
        MPI_COMM_SCALBL.Irecv(recvbuf_z, 3 * recvCount_z, rank_z, recvtag + 5);
}

void ScaLBL_Communicator::TriRecvD3Q7AA(double *Aq, double *Bq, double *Cq) {

    // NOTE: the center distribution f0 must NOT be at the start of feven, provide offset to start of f2
    //............................................................


 can find more information about deadlocks in the Rust Book, ch16-03:
    // https://doc.rust-lang.org/book/ch16-03-shared-state.html
    //
    // All of this means that we have to keep locks open for the least time possible, so we put
    // them inside a block, so they get closed automatically when dropped.
    // If we don't do this, we would never be able to open the data lock anywhere else.
    //
    // Alternatively, you can also use `ClientBuilder::type_map_insert` or
    // `ClientBuilder::type_map` to populate the global TypeMap without dealing with the RwLock.
    {
        // Open the data lock in write mode, so keys can be inserted to it.
        let mut data = client.data.write().await;

        // The CommandCounter Value has the following type:
        // Arc<RwLock<HashMap<String, u64>>>
        // So, we have to insert the same type to it.
        data.insert::<CommandCounter>(Arc::new(RwLock::new(HashMap::default())));

        data.insert::<MessageCount>(Arc::new(AtomicUsize::new(0)));
    }

    if let Err(why) = client.start().await {
        eprintln!("Client error: {:?}", why);
    }
}

#[command]
async fn ping(ctx: &Context, msg: &Message) -> CommandResult {
    msg.reply(ctx, "Pong!").await?;

    Ok(())
}

/// Usage: `~command_usage <command_name>`
/// Example: `~command_usage ping`
#[command]
async fn command_usage(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
    let command_name = match args.single_quoted::<String>() {
        Ok(x) => x,
        Err(_) => {
            msg.reply(ctx, "I require an argument to run this command.").await?;
            return Ok(());
        },
    };

    // Yet again, we want to keep the locks open for the least time possible.
    let amount = {
        // Since we only want to read the data and not write to it, we open it in read mode,
        // and since this is open in read mode, it means that there can be multiple locks open at
        // the same time, and as mentioned earlier, it's heavily recommended that you only open
        // the data lock in read mode, as it will avoid a lot of possible deadlocks.
        let data_read = ctx.data.read().await;

        // Then we obtain the value we need from data, in this case, we want the command counter.
        // The returned value from get() is an Arc, so the reference will be cloned, rather than
        // the data.
        let command_counter_lock =
            data_read.get::<CommandCounter>().expect("Expected CommandCounter in TypeMap.").clone();

        let command_counter = command_counter_lock.read().await;
        // And we return a usable value from it.
        // This time, the value is not Arc, so the data will be cloned.
        command_counter.get(&command_name).map_or(0, |x| *x)
    };

    if amount == 0 {
        msg.reply(ctx, format!("The command `{}` has not yet been used.", command_name)).await?;
    } else {
        msg.reply(
            ctx,
            format!("The command `{}` has been used {} time/s this session!", command_name, amount),
        )
        .await?;
    }

    Ok(())
}

#[command]
async fn owo_count(ctx: &Context, msg: &Message) -> CommandResult {
    let raw_count = {
        let data_read = ctx.data.read().await;
        data_read.get::<MessageCount>().expect("Expected MessageCount in TypeMa


    combination with the NativeRendering render type will lend poor and sometimes pixelated
    results.
*/
TextEdit::RenderType TextEdit::renderType() const
{
    Q_D(const TextEdit);
    return d->renderType;
}

void TextEdit::setRenderType(TextEdit::RenderType renderType)
{
    Q_D(TextEdit);
    if (d->renderType == renderType)
        return;

    d->renderType = renderType;
    emit renderTypeChanged();
    d->updateDefaultTextOption();

    if (isComponentComplete())
        updateSize();
}

QFont TextEdit::font() const
{
    Q_D(const TextEdit);
    return d->sourceFont;
}

void TextEdit::setFont(const QFont &font)
{
    Q_D(TextEdit);
    if (d->sourceFont == font)
        return;

    d->sourceFont = font;
    QFont oldFont = d->font;
    d->font = font;
    if (static_cast<int>(d->font.pointSizeF()) != -1) {
        // 0.5pt resolution
        qreal size = qRound(d->font.pointSizeF()*2.0);
        d->font.setPointSizeF(size/2.0);
    }

    if (oldFont != d->font && d->font.pixelSize() > 0) {
        if (d->document) d->document->setDefaultFont(d->font);
        if (d->cursorItem) {
            d->cursorItem->setHeight(QFontMetrics(d->font).height());
            moveCursorDelegate();
        }
        updateSize();
        updateWholeDocument();
#ifndef QT_NO_IM
        updateInputMethod(Qt::ImCursorRectangle | Qt::ImAnchorRectangle | Qt::ImFont);
#endif
    }

    if (d->lineSurface) d->lineSurface->setLineDocumentFont(font);
    emit fontChanged(d->sourceFont);
}

/*!
    \qmlproperty color QtQuick::TextEdit::color

    The text color.

    \qml
    // green text using hexadecimal notation
    TextEdit { color: "#00FF00" }
    \endqml

    \qml
    // steelblue text using SVG color name
    TextEdit { color: "steelblue" }
    \endqml
*/
QColor TextEdit::color() const
{
    Q_D(const TextEdit);
    return d->color;
}

void TextEdit::setColor(const QColor &color)
{
    Q_D(TextEdit);
    if (d->color == color)
        return;

    d->color = color;

    updateWholeDocument();
    emit colorChanged(d->color);
}

/*!
    \qmlproperty color QtQuick::TextEdit::selectionColor

    The text highlight color, used behind selections.
*/
QColor TextEdit::selectionColor() const
{
    Q_D(const TextEdit);
    return d->selectionColor;
}

void TextEdit::setSelectionColor(const QColor &color)
{
    Q_D(TextEdit);
    if (d->selectionColor == color)
        return;

    d->selectionColor = color;
    updateWholeDocument();
    emit selectionColorChanged(d->selectionColor);
}

/*!
    \qmlproperty color QtQuick::TextEdit::selectedTextColor

    The selected text color, used in selections.
*/
QColor TextEdit::selectedTextColor() const
{
    Q_D(const TextEdit);
    return d->selectedTextColor;
}

void TextEdit::setSelectedTextColor(const QColor &color)
{
    Q_D(TextEdit);
    if (d->selectedTextColor == color)
        return;

    d->selectedTextColor = color;
    updateWholeDocument();
    emit selectedTextColorChanged(d->selectedTextColor);
}

void TextEdit::setFragmentStart(int frStart) {
    Q_D(TextEdit);
    if (d->fragmentStartPalette)
    {
        d->lineControl->removePalette(d->fragmentStartPalette, false);
    }

    if (frStart <= 0) return;

    if (!d->document)
    {
        // save in buffer
        d->fragmentStart = frStart;


final commentRequest = CreateCommentTextileMarkupRequest(
        comment: Comment(
          articleId: int.parse(articleId),
          author: author,
          email: email,
          body: body,
          ip: ip,
          blogId: int.parse(blogId),
        ),
      );

      // Call the API method
      final response =
          await GetIt.I<CommentService>().createCommentTextileMarkup(
        apiVersion: ApiNetwork.apiVersion,
        model: commentRequest,
      );

      // Return success response
      return {
        "status": "success",
        "message": "Comment created successfully",
        "comment": response.comment?.toJson(),
        "params": {
          "article_id": articleId,
          "author": author,
          "created_at": response.comment?.createdAt,
        },
        "timestamp": DateTime.now().toIso8601String(),
      };
    } catch (e) {
      // Handle errors
      return {
        "status": "error",
        "message": "Failed to create comment: ${e.toString()}",
        "timestamp": DateTime.now().toIso8601String(),
      };
    }
  }

  @override
  List<String> get supportedMethods => ['POST'];

  @override
  Map<String, List<ApiField>> get requiredFields => {
        'POST': [
          const ApiField(
            name: 'article_id',
            label: 'Article ID',
            hint: 'The ID of the article to comment on',
            isRequired: true,
          ),
          const ApiField(
            name: 'author',
            label: 'Author',
            hint: 'The name of the comment author',
            isRequired: true,
          ),
          const ApiField(
            name: 'email',
            label: 'Email',
            hint: 'The email of the comment author',
            isRequired: true,
          ),
          const ApiField(
            name: 'body',
            label: 'Body',
            hint: 'The comment text in Textile markup',
            isRequired: true,
          ),
          const ApiField(
            name: 'ip',
            label: 'IP Address',
            hint: 'The IP address of the comment author',
          ),
          const ApiField(
            name: 'blog_id',
            label: 'Blog ID',
            hint: 'The ID of the blog containing the article',
            isRequired: true,
          ),
        ],
      };
}
import 'package:apis/apis.dart';
import 'package:apis/network/remote/shopify/rest/online_store/blog/abstract/blog_service.dart';
import 'package:apis/network/remote/shopify/rest/online_store/blog/freezed_model/request/create_empty_blog_with_metafield_request.dart'
    as blog_metafield_request;
import 'package:api_explorer/services/api_request_handler.dart';
import 'package:api_explorer/services/api_service_registry.dart';
import 'package:get_it/get_it.dart';

///**************************************************************
///*************** 📝 CREATE BLOG WITH METAFIELD ***************
///**************************************************************

class CreateEmptyBlogWithMetafieldHandler implements ApiRequestHandler {
  @override
  Future<Map<String, dynamic>> handleRequest(
    String method,
    Map<String, String> params,
  ) async {
    // Only handle POST requests for blog creation
    if (method != 'POST') {
      return {
        "status": "error",
        "message": "Method $method not supported. Only POST is allowed.",
        "timestamp": DateTime.now().toIso8601String(),
      };
    }

    // Extract required parameters
    final title = params['title'];
    final commentable = params['commentable'] ?? 'no';

    // Extract metafield parameters
    final metafieldKey = params['metafield_key'];
    final metafieldValue = pa


注意，为了使用`ptr`方法，你需要首先获得一个你想初始化的数据的*raw pointer*。对未初始化的数据构建一个*引用*是非法的，这意味着你在获得上述原始指针时必须小心：

- 对于一个`T`的数组，你可以使用`base_ptr.add(idx)`，其中`base_ptr: *mut T`来计算数组索引`idx`的地址。这依赖于数组在内存中的布局方式
- 然而，对于一个结构体，一般来说，我们不知道它是如何布局的，而且我们也不能使用`&mut base_ptr.field`，因为这将创建一个引用。因此，当你使用[`raw 引用`][raw_reference]的时候，你必须非常小心，这将跳过中间层直接创建一个指向该字段的裸指针：

```rust
use std::{ptr, mem::MaybeUninit};
struct Demo {
    field: bool,
}
let mut uninit = MaybeUninit::<Demo>::uninit();
// `&uninit.as_mut().field`将会创建一个指向未初始化的`bool`的指针，而这是 UB 行为。
let f1_ptr = unsafe { &raw mut (*uninit.as_mut_ptr()).field };
unsafe { f1_ptr.write(true); }
let init = unsafe { uninit.assume_init() };
```

最后一句话：在阅读旧的 Rust 代码时，你可能会无意中发现被废弃的`mem::uninitialized`函数。这个函数曾经是处理栈上未初始化内存的唯一方法，但它被证明不能与语言的其他部分很好地结合在一起。在新的代码中你总是应该使用`MaybeUninit`来代替，并且当你有机会的时候，可以把旧的代码移植过来。

这就是与未初始化内存打交道的方法。基本上没有任何地方希望得到未初始化的内存，所以如果你要传递它，一定要*非常*小心。

[`maybeuninit`]: https://doc.rust-lang.org/core/mem/union.MaybeUninit.html
[assume_init]: https://doc.rust-lang.org/core/mem/union.MaybeUninit.html#method.assume_init
[`ptr`]: https://doc.rust-lang.org/core/ptr/index.html
[raw_reference]: https://doc.rust-lang.org/reference/types/pointer.html#r-type.pointer.raw.constructor
[`write`]: https://doc.rust-lang.org/core/ptr/fn.write.html
[`copy`]: https://doc.rust-lang.org/std/ptr/fn.copy.html
[`copy_nonoverlapping`]: https://doc.rust-lang.org/std/ptr/fn.copy_nonoverlapping.html
# 丢弃检查

我们已经看到了生命周期如何为我们提供了一些相当简单的规则来确保我们永远不会读到悬空的引用。但是到目前为止， _outlives_ 是一种包容的关系。也就是说，当我们谈论`'a: 'b`时，`'a`可以和`'b`的寿命一样长。乍一看，这似乎是一个无意义的特点。没有什么东西会和另一个东西同时被丢弃，对吗？这就是为什么我们对以下`let`语句解语法糖：

<!-- ignore: simplified code -->

```rust,ignore
let


 };
break;
case 1204:

     parser.suggestKeywords(['WHEN']);
     this.$ = { caseTypes: [{ types: ['T'] }] };

break;
case 1205:

     parser.suggestKeywords(['WHEN']);
     this.$ = { caseTypes: [$$[$0]] };

break;
case 1206:

     parser.valueExpressionSuggest();
     parser.suggestKeywords(['WHEN']);
     this.$ = { caseTypes: [{ types: ['T'] }] };

break;
case 1207:

      parser.valueExpressionSuggest();
      parser.suggestKeywords(['WHEN']);
      this.$ = { caseTypes: [{ types: ['T'] }] };

break;
case 1208: case 1210:

     parser.valueExpressionSuggest();
     this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };

break;
case 1209:

     parser.valueExpressionSuggest();
     parser.suggestKeywords(['THEN']);
     this.$ = { caseTypes: [{ types: ['T'] }], suggestFilters: true };

break;
case 1211:

     parser.valueExpressionSuggest();
     this.$ = { caseTypes: [$$[$0]], suggestFilters: true };

break;
case 1212:

     parser.suggestValueExpressionKeywords($$[$0-1], ['THEN']);
     this.$ = { caseTypes: [{ types: ['T'] }] };

break;
case 1213:

     parser.suggestValueExpressionKeywords($$[$0-2], ['THEN']);
     this.$ = { caseTypes: [{ types: ['T'] }] };

break;
case 1214: case 1215: case 1216: case 1217:

     parser.valueExpressionSuggest();
     this.$ = { caseTypes: [{ types: ['T'] }] };

break;
}
},
table: [o($V0,$V1,{341:1,266:2}),{1:[3]},o($V2,$V3,{342:3,346:4,20:5,157:6,46:7,21:8,22:9,23:10,24:11,25:12,26:13,27:14,28:15,29:16,30:17,35:19,36:20,37:21,158:22,159:23,170:24,171:25,38:26,44:27,160:33,4:$V4,8:$V5,12:$V6,16:$V7,164:$V8,176:$V9,243:$Va,274:$Vb,324:$Vc,340:$Vd,510:$Ve}),{343:[1,39],347:[1,40]},o($V2,[2,631]),o($V2,[2,637]),o($V2,[2,638]),o($V2,[2,639]),o($V2,[2,16]),o($V2,[2,17]),o($V2,[2,18]),o($V2,[2,19]),o($V2,[2,20]),o($V2,[2,21]),o($V2,[2,22]),o($V2,[2,23]),o($V2,[2,24]),o($V2,[2,25]),{31:[1,41],32:42,61:43,65:$Vf,115:$Vg,230:$Vh,350:46,351:$Vi,352:$Vj},o($V2,[2,28]),o($V2,[2,29]),o($V


="viewport" content="width=device-width,initial-scale=1">
    <title>VuePress</title>
    <meta name="generator" content="VuePress 1.4.1">
    <link rel="icon" href="/vue-data-view/logo.png">
    <link rel="manifest" href="/vue-data-view/manifest.json">
    <link rel="apple-touch-icon" href="/vue-data-view/icons/apple-touch-icon-152x152.png">
    <link rel="mask-icon" href="/vue-data-view/icons/safari-pinned-tab.svg" color="#3eaf7c">
    <meta name="description" content="">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
    <meta name="msapplication-TileColor" content="#000000">
    <link rel="preload" href="/vue-data-view/assets/css/0.styles.ed18d9a7.css" as="style"><link rel="preload" href="/vue-data-view/assets/js/app.09fbf70b.js" as="script"><link rel="preload" href="/vue-data-view/assets/js/3.b3916055.js" as="script"><link rel="preload" href="/vue-data-view/assets/js/6.fece313e.js" as="script"><link rel="prefetch" href="/vue-data-view/assets/js/10.2bc4ff65.js"><link rel="prefetch" href="/vue-data-view/assets/js/11.4185e0e1.js"><link rel="prefetch" href="/vue-data-view/assets/js/12.e98e165b.js"><link rel="prefetch" href="/vue-data-view/assets/js/13.348525e4.js"><link rel="prefetch" href="/vue-data-view/assets/js/14.c5ccc1a1.js"><link rel="prefetch" href="/vue-data-view/assets/js/15.7c0eb4fd.js"><link rel="prefetch" href="/vue-data-view/assets/js/16.50feb46d.js"><link rel="prefetch" href="/vue-data-view/assets/js/4.5d9dd1ff.js"><link rel="prefetch" href="/vue-data-view/assets/js/5.c2034e08.js"><link rel="prefetch" href="/vue-data-view/assets/js/7.0f7aaead.js"><link rel="prefetch" href="/vue-data-view/assets/js/8.9d4aaaa1.js"><link rel="prefetch" href="/vue-data-view/assets/js/9.5b8c8124.js"><link rel="prefetch" href="/vue-data-view/assets/js/vendors~docsearch.793d1193.js">
    <link rel="stylesheet" href="/vue-data-view/assets/css/0.styles.ed18d9a7.css">

<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512"


;
      case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
        _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID);
        out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
        break;
      default:
        PRINT_ERROR("F1AP_ProtocolIE_ID_id %ld unknown, skipping\n", ie->id);
        break;
    }
  }

  return true;
}

/**
 * @brief F1 UE Context Release Complete deep copy
 */
f1ap_ue_context_rel_cplt_t cp_ue_context_rel_cplt(const f1ap_ue_context_rel_cplt_t *orig)
{
  f1ap_ue_context_rel_cplt_t cp = {
    .gNB_CU_ue_id = orig->gNB_CU_ue_id,
    .gNB_DU_ue_id = orig->gNB_DU_ue_id,
  };
  return cp;
}

/**
 * @brief F1 UE Context Release Complete equality check
 */
bool eq_ue_context_rel_cplt(const f1ap_ue_context_rel_cplt_t *a, const f1ap_ue_context_rel_cplt_t *b)
{
  _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id);
  _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id);
  return true;
}

/**
 * @brief Free Allocated F1 UE Context Release Complete
 */
void free_ue_context_rel_cplt(f1ap_ue_context_rel_cplt_t *cplt)
{
  // nothing to free
}


relu_double_3x3_reduce_out = self.inception_5b_relu_double_3x3_reduce(inception_5b_double_3x3_reduce_bn_out)
        inception_5b_double_3x3_1_out = self.inception_5b_double_3x3_1(inception_5b_relu_double_3x3_reduce_out)
        inception_5b_double_3x3_1_bn_out = self.inception_5b_double_3x3_1_bn(inception_5b_double_3x3_1_out)
        inception_5b_relu_double_3x3_1_out = self.inception_5b_relu_double_3x3_1(inception_5b_double_3x3_1_bn_out)
        inception_5b_double_3x3_2_out = self.inception_5b_double_3x3_2(inception_5b_relu_double_3x3_1_out)
        inception_5b_double_3x3_2_bn_out = self.inception_5b_double_3x3_2_bn(inception_5b_double_3x3_2_out)
        inception_5b_relu_double_3x3_2_out = self.inception_5b_relu_double_3x3_2(inception_5b_double_3x3_2_bn_out)
        inception_5b_pool_out = self.inception_5b_pool(inception_5a_output_out)
        inception_5b_pool_proj_out = self.inception_5b_pool_proj(inception_5b_pool_out)
        inception_5b_pool_proj_bn_out = self.inception_5b_pool_proj_bn(inception_5b_pool_proj_out)
        inception_5b_relu_pool_proj_out = self.inception_5b_relu_pool_proj(inception_5b_pool_proj_bn_out)
        inception_5b_output_out = torch.cat([inception_5b_relu_1x1_out,inception_5b_relu_3x3_out,inception_5b_relu_double_3x3_2_out,inception_5b_relu_pool_proj_out], 1)
        return inception_5b_output_out

    def logits(self, features):
        adaptiveAvgPoolWidth = features.shape[2]
        x = F.avg_pool2d(features, kernel_size=adaptiveAvgPoolWidth)
        x = x.view(x.size(0), -1)
        x = self.last_linear(x)
        return x

    def forward(self, input):
        x = self.features(input)
        x = self.logits(x)
        return x

def bninception(num_classes=1000, pretrained='imagenet'):
    r"""BNInception model architecture from <https://arxiv.org/pdf/1502.03167.pdf>`_ paper.
    """
    model = BNInception(num_classes=num_classes)
    if pretrained is not None:
        settings = pretrained_settings['bninception'][pretrained]
        assert num_classes == settings['num_classes'], \
            "num_classes should be {}, but is {}".format(settings['num_classes'], num_classes)
        model.load_state_dict(model_zoo.load_url(settings['url']))
        model.input_space = settings['input_space']
        model.input_size = settings['input_size']
        model.input_range = settings['input_range']
        model.mean = settings['mean']
        model.std = settings['std']
    return model

if __name__ == '__main__':

    model = bninception()


e {
        throw new Error(`Unknown SelectItem`);
    }
}
import { Euler, LinearFilter, LinearMipmapLinearFilter, MathUtils, Quaternion, Texture, Vector3 } from 'three';
import { PSVError } from '../PSVError';
import { ExtendedPosition, Point, ResolvableBoolean } from '../model';
import { wrap } from './math';
import { clone, isPlainObject } from './misc';

/**
 * Executes a callback with the value of a ResolvableBoolean
 */
export function resolveBoolean(value: boolean | ResolvableBoolean, cb: (val: boolean, init: boolean) => void) {
    if (isPlainObject(value)) {
        cb((value as ResolvableBoolean).initial, true);
        (value as ResolvableBoolean).promise.then((res) => cb(res, false));
    } else {
        cb(value as boolean, true);
    }
}

/**
 * Inverts the result of a ResolvableBoolean
 */
export function invertResolvableBoolean(value: ResolvableBoolean): ResolvableBoolean {
    return {
        initial: !value.initial,
        promise: value.promise.then((res) => !res),
    };
}

/**
 * Builds an Error with name 'AbortError'
 */
export function getAbortError(): Error {
    const error = new Error('Loading was aborted.');
    error.name = 'AbortError';
    return error;
}

/**
 * Tests if an Error has name 'AbortError'
 */
export function isAbortError(err: Error): boolean {
    return err?.name === 'AbortError';
}

/**
 * Displays a warning in the console with "PhotoSphereViewer" prefix
 */
export function logWarn(message: string) {
    console.warn(`PhotoSphereViewer: ${message}`);
}

/**
 * Checks if an object is a ExtendedPosition, ie has textureX/textureY or yaw/pitch
 */
export function isExtendedPosition(object: any): object is ExtendedPosition {
    if (!object) {
        return false;
    }
    return [
        ['textureX', 'textureY'],
        ['yaw', 'pitch'],
    ].some(([key1, key2]) => {
        return object[key1] !== undefined && object[key2] !== undefined;
    });
}

/**
 * Returns the value of a given attribute in the panorama metadata
 */
export function getXMPValue(data: string, attr: string): number | null {
    // XMP data are stored in children
    let result = data.match('<GPano:' + attr + '>(.*)</GPano:' + attr + '>');
    if (result !== null) {
        const val = parseInt(result[1], 10);
        return isNaN(val) ? null : val;
    }

    // XMP data are stored in attributes
    result = data.match('GPano:' + attr + '="(.*?)"');
    if (result !== null) {
        const val = parseInt(result[1], 10);
        return isNaN(val) ? null : val;
    }

    return null;
}

const CSS_POSITIONS: Record<string, string> = {
    top: '0%',
    bottom: '100%',
    left: '0%',
    right: '100%',
    center: '50%',
};
const X_VALUES = ['left', 'center', 'right'];
const Y_VALUES = ['top', 'center', 'bottom'];
const POS_VALUES = [...X_VALUES, ...Y_VALUES];
const CENTER = 'center';

/**
 * Translate CSS values like "top center" or "10% 50%" as top and left positions (0-1 range)
 * @description The implementation is as close as possible to the "background-position" specification
 * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}
 */
export function parsePoint(value: string | Point): Point {
    if (!value) {
        return { x: 0.5, y: 0


实例购买会预先冻结本次实例购买一小时内所需金额，在调用本接口前请确保账户余额充足。
        /// * 调用本接口创建实例，支持代金券自动抵扣（注意，代金券不可用于抵扣后付费冻结金额），详情请参考[代金券选用规则](https://cloud.tencent.com/document/product/555/7428)。
        /// * 本接口允许购买的实例数量遵循[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664)，所创建的实例和官网入口创建的实例共用配额。
        /// * 本接口为异步接口，当创建实例请求下发成功后会返回一个实例`ID`列表和一个`RequestId`，此时创建实例操作并未立即完成。在此期间实例的状态将会处于“PENDING”，实例创建结果可以通过调用 [DescribeInstancesStatus](https://cloud.tencent.com/document/product/213/15738)  接口查询，如果实例状态(InstanceState)由“PENDING(创建中)”变为“RUNNING(运行中)”，则代表实例创建成功，“LAUNCH_FAILED”代表实例创建失败。
        /// </summary>
        /// <param name="req"><see cref="RunInstancesRequest"/></param>
        /// <returns><see cref="RunInstancesResponse"/></returns>
        public Task<RunInstancesResponse> RunInstances(RunInstancesRequest req)
        {
            return InternalRequestAsync<RunInstancesResponse>(req, "RunInstances");
        }

        /// <summary>
        /// 本接口 (RunInstances) 用于创建一个或多个指定配置的实例。
        ///
        /// * 实例创建成功后将自动开机启动，[实例状态](https://cloud.tencent.com/document/product/213/15753#InstanceStatus)变为“运行中”。
        /// * 预付费实例的购买会预先扣除本次实例购买所需金额，按小时后付费实例购买会预先冻结本次实例购买一小时内所需金额，在调用本接口前请确保账户余额充足。
        /// * 调用本接口创建实例，支持代金券自动抵扣（注意，代金券不可用于抵扣后付费冻结金额），详情请参考[代金券选用规则](https://cloud.tencent.com/document/product/555/7428)。
        /// * 本接口允许购买的实例数量遵循[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664)，所创建的实例和官网入口创建的实例共用配额。
        /// * 本接口为异步接口，当创建实例请求下发成功后会返回一个实例`ID`列表和一个`RequestId`，此时创建实例操作并未立即完成。在此期间实例的状态将会处于“PENDING”，实例创建结果可以通过调用 [DescribeInstancesStatus](https://cloud.tencent.com/document/product/213/15738)  接口查询，如果实例状态(InstanceState)由“PENDING(创建中)”变为“RUNNING(运行中)”，则代表实例创建成功，“LAUNCH_FAILED”代表实例创建失败。
        /// </summary>


 1.  const: An unchangeable value (the common case).
/// 2.  static: A possibly mutable variable with 'static lifetime. The static lifetime is inferred
///     and does not have to be specified. Accessing or modifying a mutable static variable is unsafe.

static LANGUAGE: &str = "Rust";
// Accessing or modifying a mutable static variable is "unsafe"!
pub static mut COUNT: u32 = 0;
const THRESHOLD: i32 = 10;

pub fn is_big(n: i32) -> bool {
    n > THRESHOLD
}
pub fn is_favorite_language(lang: &str) -> bool {
    lang == LANGUAGE
}

#[cfg(test)]
mod tests {
    use crate::constants::{is_big, is_favorite_language, LANGUAGE};

    #[test]
    fn test_is_big() {
        assert_eq!(true, is_big(11));
        assert_eq!("Rust", LANGUAGE);
    }

    #[test]
    fn test_local_constant() {
        const LOCAL_COUNT: u32 = 99;
        assert_eq!(99, LOCAL_COUNT);
    }

    #[test]
    fn test_local_static() {
        static NAME: &str = "John";
        assert_eq!("John", NAME);
    }

    #[test]
    fn test_is_favorite_language() {
        assert!(is_favorite_language("Rust"));
    }
}
<filename>libs_no_std/diss/src/armv8a_a32.rs
use crate::utils::*;

pub enum Reg {
    R0,
    R1,
    R2,
    R3,
    R4,
    R5,
    R6,
    R7,
    R8,
    R9,
    R10,
    R11,
    R12,
    Fp, // X29
    Lr, // x30

    Xzr,
    Pc,
    Sp,
    Elr,
    Spsr,
}

///
pub trait ArmV8A32User<E> {
    fn add(&mut self, condition: Cond, r1: Reg, r2: Reg, r3: Reg) -> Result<(), E>;
}

#[repr(u8)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
/// Conditional menemonics for instructions.
/// From the [reference manual](https://developer.arm.com/documentation/ddi0406/cb/Application-Level-Architecture/Instruction-Details/Conditional-execution?lang=en#Chdcgdjb)
pub enum Cond {
    /// Equal, Z == 1
    Eq = 0b0000,
    /// Not equal, Z == 0
    Ne = 0b0001,
    /// Carry set (also called Hs), C == 1
    Cs = 0b0010,
    /// Carry clear (also called Lo), C == 0
    Cc = 0b0011,
    /// Minus, negative, N == 1
    Mi = 0b0100,
    /// Plus positive or zero, N == 0
    Pl = 0b0101,
    /// Overflow, V == 1
    Vs = 0b0110,
    /// No overflow, V == 0
    Vc = 0b0111,
    /// Unsigned higher, C == 1 and Z == 0
    Hi = 0b1000,
    /// Unsigned lower or same, C == 0 or Z == 1
    Ls = 0b1001,
    /// Signed Greater than or equal, N == V
    Ge = 0b1010,
    /// Signed less than, N != V
    Lt = 0b1011,
    /// Signed grater than, Z == 0 and N == V
    Gt = 0b1100,
    /// Signed less than or equal, Z == 1 or N != V
    Le = 0b1101,
    /// None, Always, unconditional
    Al = 0b1110,
    /// Instruction that can only be executed unconditionally
    Unconditional = 0b1111,
}

/// <https://developer.arm.com/documentation/ddi0406/cb/Application-Level-Architecture/ARM-Instruction-Set-Encoding/ARM-instruction-set-encoding>
pub fn disassemble_armv8a_a32<U: ArmV8A3


 *LCLTray) AsCEFTray() *CEFTray {
	return nil
}

// AsLCLTray 尝试转换为 LCL 组件托盘, 如果创建的是其它类型托盘返回nil
func (m *LCLTray) AsLCLTray() *LCLTray {
	return m
}

// SetVisible 设置显示状态
func (m *LCLTray) SetVisible(v bool) {
	m.trayIcon.SetVisible(v)
}

// Visible 显示状态
func (m *LCLTray) Visible() bool {
	return m.trayIcon.Visible()
}

// Show 显示/启动 托盘
func (m *LCLTray) Show() {
	m.SetVisible(true)
}

// Hide 隐藏 托盘
func (m *LCLTray) Hide() {
	m.SetVisible(false)
}

func (m *LCLTray) close() {
	m.Hide()
}

// SetOnDblClick 设置双击事件
func (m *LCLTray) SetOnDblClick(fn TrayICONClick) {
	m.trayIcon.SetOnDblClick(func(sender lcl.IObject) {
		fn()
	})
}

// SetOnClick 设置单击事件
func (m *LCLTray) SetOnClick(fn TrayICONClick) {
	m.trayIcon.SetOnClick(func(sender lcl.IObject) {
		fn()
	})
}

// SetOnMouseUp 鼠标抬起事件
func (m *LCLTray) SetOnMouseUp(fn TMouseEvent) {
	m.trayIcon.SetOnMouseUp(func(sender lcl.IObject, button types.TMouseButton, shift types.TShiftState, x, y int32) {
		fn(sender, button, shift, x, y)
	})
}

// SetOnMouseDown 鼠标按下事件
func (m *LCLTray) SetOnMouseDown(fn lcl.TMouseEvent) {
	m.trayIcon.SetOnMouseDown(fn)
}

// SetOnMouseMove 鼠标移动事件
func (m *LCLTray) SetOnMouseMove(fn lcl.TMouseMoveEvent) {
	m.trayIcon.SetOnMouseMove(fn)
}

// TrayMenu 创建并返回托盘根菜单 PopupMenu
func (m *LCLTray) TrayMenu() *lcl.TPopupMenu {
	if m.popupMenu == nil {
		m.popupMenu = lcl.NewPopupMenu(m.trayIcon)
		m.trayIcon.SetPopupMenu(m.popupMenu)
	}
	return m.popupMenu
}

// SetIconFS 设置托盘图标
func (m *LCLTray) SetIconFS(iconResourcePath string) {
	ext := strings.ToLower(filepath.Ext(iconResourcePath))
	switch ext {
	case ".png":
		png := lcl.NewPngImage()
		png.LoadFromFSFile(iconResourcePath)
		m.trayIcon.Icon().Assign(png)
		png.Free()
	case ".jpeg":
		jpeg := lcl.NewJPEGImage()
		jpeg.LoadFromFSFile(iconResourcePath)
		m.trayIcon.Icon().Assign(jpeg)
		jpeg.Free()
	case ".ico":
		m.trayIcon.Icon().LoadFromFSFile(iconResourcePath)
	}
}

// SetIcon 设置托盘图标
func (m *LCLTray) SetIcon(iconResourcePath string) {
	ext := strings.ToLower(filepath.Ext(iconResourcePath))
	switch ext {
	case ".png":
		png := lcl.NewPngImage()
		png.LoadFromFile(iconResourcePath)
		m.trayIcon.Icon().Assign(png)
		png.Free()
	case ".jpeg":
		jpeg := lcl.NewJPEGImage()
		jpeg


ungle-level.png"));
		mountainsTex = new Texture(Gdx.files.internal("data/blur/mountains.png"));

		// Populate level container
		Array<LevelSelector.Level> levels = new Array<LevelSelector.Level>();

		LevelSelector.Level level1 = new LevelSelector.Level("Level1", skin);
		level1.setImage( new Image(new TextureRegionDrawable(new TextureRegion(jungleTex))));

		LevelSelector.Level level2 = new LevelSelector.Level("Level2", skin);
		level2.setImage(new Image(new TextureRegionDrawable(new TextureRegion(mountainsTex))));

		LevelSelector.Level level3 = new LevelSelector.Level("Level3", skin);
		level3.setImage(new Image(new TextureRegionDrawable(new TextureRegion(jungleTex))));

		levels.addAll(level1, level2, level3);

		levelSelector = new LevelSelector(skin);
		levelSelector.addLevels(levels);

		table.row();
		table.add(level_menu).padBottom(20f);
		table.row();
		table.add(levelSelector);

		table.setFillParent(true);
		table.pack();

		stage.addActor(table);

		// Start game button listener
		levelSelector.getButton().addListener( new ClickListener() {
			@Override
			public void clicked(InputEvent event, float x, float y) {
				Gdx.app.log(TAG, "START LEVEL " + levelSelector.getCurrentLevel());
			};
		});

		table.debug();
	}

	@Override
	public void resize(int width, int height) {
		viewport.update(width, height);
	}

	@Override
	public void dispose() {
		jungleTex.dispose();
		mountainsTex.dispose();
		batch.dispose();
		skin.dispose();
		stage.dispose();
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(0, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

		stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 60f));
		stage.draw();
	}
}
package com.cookbook.samples;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.utils.Logger;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.cookbook.box2d.MapBodyManager;

public class Box2DMapPopulatorSample extends GdxSample {
	private static final String TAG = "Box2DMapPopulatorSample";

	private static final float SCREEN_TO_WORLD = 30f;
	private static final float WORLD_TO_SCREEN = 1/SCREEN_TO_WORLD;
	private static final float SCENE_WIDTH = 12.80f; // 12.8 metres wide
	private static final float S


 guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Safe Commands for Automated Execution

The following commands are safe to run automatically without asking for permission:

### Read-only Operations
- `git status`, `git log`, `git diff`, `git show`
- `gh run list`, `gh run view`
- `gh run view <run-id>` (view specific workflow run details)
- `gh run view <run-id> --log` (view full logs including successful steps)
- `gh run view <run-id> --log-failed` (view logs from failed steps only)
- `gh pr view --json state --jq .state` (check PR state)
- `gh run list --limit 10` (list recent workflow runs)
- `gh run view <run-id>` (view specific workflow run details)
- `gh run view <run-id> --log` (view full logs including successful steps)
- `gh run view <run-id> --log-failed` (view logs from failed steps only)
- `gh pr view --json state --jq .state` (check PR state)
- `gh run list --limit 10` (list recent workflow runs)
- `gh run view <run-id>` (view specific workflow run details)
- `cat`, `head`, `tail`, `ls`, file reading operations
- `kubectl get`, `kubectl describe` (read-only kubectl commands)
- `helm list`, `helm status` (read-only helm commands)

### Code Quality & Testing
- `uv pip install -e ".[dev]"` (in virtual environment)
- `isort .` (fix import ordering)
- `isort . --check-only` (check import ordering)
- `ruff check .` (linting check)
- `ruff check . --fix` (auto-fix linting issues)
- `ruff format .` (auto-format code - replaces black)
- `ruff format . --check` (check formatting status)
- `pytest --collect-only` (test collection without running)
- `playwright install` (browser installation)

### Environment Setup
- `uv venv` (create virtual environment)
- `source .venv/bin/activate` (activate virtual environment)
- `mkdir -p temp/` (create temp directory)
- `git checkout` (checkout any branch)
- `git pull origin` (pull any branch)
- `git checkout -b fix/new-branch-name` (create new branch)
- `git cherry-pick <commit-hash>` (cherry-pick commits)
- `gh pr view --json state --jq .state` (check PR state)
- `git reset HEAD <file>` (unstage files)
- `mv <source> <destination>` (move/rename files)
- `git add <files>` (stage files for commit)
- `git push -u origin <branch-name>` (push new branch to remote)
- `gh pr create` (create pull request)

### Analysis Commands
- `find`, `grep`, `rg` (ripgrep), search operations
- `wc`, `sort`, `uniq` (text processing)
- `docker images`, `docker ps` (read-only docker commands)

### Version Management Commands
- `bump-my-version show` (show current version and config)
- `bump-my-version show-bump` (preview version increments)
- `bump-my-version bump --dry-run <increment>` (test version bump without changes)
- `grep -r "__version__\|version.*=" src/ charts/ pyproject.toml k8s/` (check version consistency)

## Commands That Require Permission

### Git Operations - Always Check First
Before any git commits, ALWAYS run these safety checks:
```bash
# Check if current branch is already merged
gh pr view --json state --jq .state 2>/dev/null || echo "No PR found"

# Check if working on merged branch
git branch -r --merged main | grep $(git branch --show-current) && echo "⚠ BRANCH ALREADY MERGED!"

# Check current branch and status
git branch --show-current
git status
```

### Modifying Operations
- `git add`, `git commit`, `git push` (always ask before committing AND check if branch is merge


import io.kotest.matchers.MatcherResult
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe

/**
 * Asserts that this [Double] is greater than or equal to [x]
 *
 * Verifies that this [Double] is greater or equal to [x]. This assertion includes [x] itself.
 *
 * Opposite of [Double.shouldNotBeGreaterThanOrEqual]
 *
 * ```
 * 0.2 shouldBeGreaterThanOrEqual 0.1   // Assertion passes
 * 0.2 shouldBeGreaterThanOrEqual 0.2   // Assertion passes
 * 0.2 shouldBeGreaterThanOrEqual 0.3   // Assertion fails
 * ```
 *
 * @see [Double.shouldBeGreaterThan]
 * @see [Double.shouldNotBeLessThanOrEqual]
 */
infix fun Double.shouldBeGreaterThanOrEqual(x: Double): Double {
   this shouldBe gte(x)
   return this
}

/**
 * Asserts that this [Double] is not greater than [x] nor equal to [x]
 *
 * Opposite of [Double.shouldBeGreaterThanOrEqual]
 *
 * ```
 * 0.2 shouldNotBeGreaterThanOrEqual 0.1   // Assertion fails
 * 0.2 shouldNotBeGreaterThanOrEqual 0.2   // Assertion fails
 * 0.2 shouldNotBeGreaterThanOrEqual 0.3   // Assertion passes
 * ```
 *
 * @see [Double.shouldNotBeGreaterThan]
 * @see [Double.shouldBeLessThanOrEqual]
 */
infix fun Double.shouldNotBeGreaterThanOrEqual(x: Double): Double {
   this shouldNotBe gte(x)
   return this
}

fun gte(x: Double) = beGreaterThanOrEqualTo(x)
fun beGreaterThanOrEqualTo(x: Double) = object : Matcher<Double> {
   override fun test(value: Double) =
      MatcherResult(
         value >= x,
         { "$value should be >= $x" },
         { "$value should not be >= $x" })
}
package io.kotest.matchers.bytes

import io.kotest.matchers.Matcher
import io.kotest.matchers.comparables.between
import io.kotest.matchers.shouldBe

/**
 * Match that verifies a given [UByte] has a value between [lower, upper] (inclusive, inclusive).
 */
@Deprecated(
   "UByte-specific assertion is getting replaced with a new Comparable assertion of the same name.\nNote: If you perform the offered IDE autocorrection, you still need to remove the UByte import `io.kotest.matchers.bytes.shouldBeBetween` manually.",
   ReplaceWith("shouldBeBetween(lower, upper)", "io.kotest.matchers.comparables.shouldBeBetween")
)
fun UByte.shouldBeBetween(lower: UByte, upper: UByte): UByte {
   this shouldBe between(lower, upper)
   return this
}

/**
 * Match that verifies a given [UByte] has a value between [lower, upper] (inclusive, inclusive).
 */
@Deprecated(
   "UByte-specific matcher is getting replaced with a new Comparable matcher of the same name.\nNote: If you perform the offered IDE autocorrection, you still need to remove the UByte import `io.kotest.matchers.bytes.between` manually.",
   ReplaceWith("between(lower, upper)", "io.kotest.matchers.comparables.between")
)
fun between(lower: UByte, upper: UByte): Matcher<UByte> = between(lower, upper)
package io.kotest.matchers.ints

import io.kotest.matchers.Matcher
import io.kotest.matchers.comparables.between
import io.kotest.matchers.shouldBe

/**
 * Match that verifies a given [UInt] has a value between [lower, upper] (inclusive, inclusive).
 */
@Deprecated(
   "UInt-specific assertion is getting replaced with a new Comparable as


��력을 수동으로 검사하여 추론을 포함하는 오류로 분류한다(그림의 첫 번째 예). 1) 및 형상-내부 오류(두 번째 예제); 우리는 16개의 추론과 9개의 형상 오류를 발견한다. 또한 LOGO에서 CodeLlama-13B를 사용하여 증강 에이전트가 실패하고 기준선이 성공한 모든 경우를 수동으로 검사하여 ReGAL의 실패 모드를 검사한다. 우리는 그것들을 세 가지 유형으로 분류한다.\n' +
      '\n' +
      '******: (7 exs.) 프로그램은 프리미티브 동작들 또는 제어 흐름의 실수들로 인해 실패한다.\n' +
      '*****잘못된/정의되지 않은 함수**: (4 exs.) 코드는 존재하지 않는 함수를 지칭하거나, 올바른 함수와 유사한 함수를 잘못 호출한다.\n' +
      '**검증 실패**: (2 exs.) 프로그램은 정확했지만 검증 함수는 false negative.5 각주 5: 예를 들어, "작은 6 gon_ 옆에 있는 작은 사각형"에 대해 에이전트는 정사각형의 왼쪽에 육각형을 생성하며, 여기서 참조는 오른쪽에 있다.\n' +
      '\n' +
      '따라서, 가장 일반적인 에러는 프리미티브 동작들을 예측하지 못하는 것이고; 여기서, ReGAL 에이전트는 둘 다 동일한 ICL 예산을 갖기 때문에 기준 에이전트 w.r.t.에 불리하다. 베이스라인 에이전트는 _only_ 프리미티브 코드를 갖는 10개의 ICL 예들을 보는 반면, ReGAL 에이전트는 5개의 프리미티브 예들 및 5개의 데모 뱅크 예들을 본다.\n' +
      '\n' +
      '그림 3: 상위 5명의 가장 일반적인 도우미에 대한 CodeLlama-13B의 기능


installed, then install the
latest puppet and puppet apply against a puppet repo from the /repository/puppet_repo directory using the defailt manifest site.pp

To override a setting at the suite-level, specify the setting name under the suite:

```yaml
    suites:
     - name: default
       provisioner:
         manifest: foobar.pp
```

#### custom_install_command example usage

* One liner
```yaml
    custom_install_command: yum install -y git
```
* Multiple lines, a.k.a embed shell script
```yaml
  custom_install_command: |
     command1
     command2
```
* Multiple lines join without new line
```yaml
  custom_install_command: >
     command1 &&
     command2
```

### Per-suite Structure

It can be beneficial to keep different Puppet layouts for different suites. Rather than having to specify the manifest, modules, etc for each suite, you can create the following directory structure and they will automatically be found:

    $kitchen_root/$suite_name/puppet/manifests
    $kitchen_root/$suite_name/puppet/modules
    $kitchen_root/$suite_name/puppet/hiera
    $kitchen_root/$suite_name/puppet/hiera.yaml
    $kitchen_root/$suite_name/puppet/Puppetfile

### Puppet Version
When specifying a puppet version, you must use this format: "3.6.2-1puppetlabs1". I have
no idea why Puppet versioned their repository with a trailing
"-1puppetlabs1", but there it is.

### eyaml

See https://puppet.com/blog/encrypt-your-data-using-hiera-eyaml

See https://blog.benroberts.net/2014/12/setting-up-hiera-eyaml-gpg for using GPG backend allowing secrets to be protected using asymmetric keys.

# Puppet Agent Provisioner Options

key | default value | Notes
----|---------------|--------
puppet_version | "latest"| desired version, affects apt installs.
facter_version | "latest"| desired version, affects apt installs.
platform | platform_name kitchen.yml parameter | OS platform of server
require_puppet_repo | true | Set if using a puppet install from yum or apt repo
puppet_apt_repo | http://apt.puppetlabs.com/ puppetlabs-release-precise.deb| apt repo
puppet_yum_repo | https://yum.puppetlabs.com/ puppetlabs-release-el-6.noarch.rpm| yum repo
require_puppet_omnibus | false | Set if using omnibus puppet install
puppet_omnibus_url | | omnibus puppet install location.
puppet_omnibus_remote_path | "/opt/puppet" | Server Installation location of an omnibus puppet install.
puppet_detailed_exitcodes | nil | Provide transaction information via exit codes.
puppet_logdest | nil | Where to send messages. Choose between syslog, the console, and a log file.
puppet_masterport | nil | The port on which to contact the puppet master.
puppet_environment | nil | The puppet environment to run the agent under
puppet_test | false | Enable the most common options used for testing.
puppet_onetime | true | Run the configuration once.
puppet_no_daemonize | true | Do not send the process into the background.
puppet_server | nil | will default to 'puppet'. Useful for interactively running when used with the --no-daemonize option.
puppet_waitforcert | '0' | Time to wait for certificate if agent does not yet have certificates
puppet_certname | nil | Set the certname (unique ID) of the client
puppet_digest | nil | Change the certificate fingerprinting digest algorithm. The default is SHA256
puppet_debug| false| Enable full debugging logging on


gnal_connect(G_OBJECT(gtkTreeView), "button-press-event", G_CALLBACK(TableView_buttonEvent), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeView), "button-release-event", G_CALLBACK(TableView_buttonEvent), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeView), "key-press-event", G_CALLBACK(TableView_keyPressEvent), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeView), "motion-notify-event", G_CALLBACK(TableView_mouseMoveEvent), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeView), "popup-menu", G_CALLBACK(TableView_popup), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeView), "realize", G_CALLBACK(TableView_realize), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeView), "row-activated", G_CALLBACK(TableView_activate), (gpointer)this);
  g_signal_connect(G_OBJECT(gtkTreeSelection), "changed", G_CALLBACK(TableView_change), (gpointer)this);

  //searching doesn't currently work anyway ...
  gtkEntry = (GtkEntry*)gtk_entry_new();
  gtk_tree_view_set_search_entry(gtkTreeView, gtkEntry);

  pWidget::construct();
}

auto pTableView::destruct() -> void {
  gtk_widget_destroy(GTK_WIDGET(gtkEntry));
  gtk_widget_destroy(gtkWidgetChild);
  gtk_widget_destroy(gtkWidget);
}

auto pTableView::append(sTableViewColumn column) -> void {
  _updateRulesHint();
}

auto pTableView::append(sTableViewItem item) -> void {
}

auto pTableView::focused() const -> bool {
  return gtk_widget_has_focus(GTK_WIDGET(gtkTreeView));
}

auto pTableView::remove(sTableViewColumn column) -> void {
  _updateRulesHint();
}

auto pTableView::remove(sTableViewItem item) -> void {
}

auto pTableView::resizeColumns() -> void {
  auto lock = acquire();

  std::vector<s32> widths;
  s32 minimumWidth = 0;
  s32 expandable = 0;
  for(u32 position : range(self().columnCount())) {
    s32 width = _width(position);
    widths.push_back(width);
    minimumWidth += width;
    if(self().column(position).expandable()) expandable++;
  }

  s32 maximumWidth = self().geometry().width() - 6;
  if(auto scrollBar = gtk_scrolled_window_get_vscrollbar(gtkScrolledWindow)) {
    GtkAllocation allocation;
    gtk_widget_get_allocation(scrollBar, &allocation);
    if(gtk_widget_get_visible(scrollBar)) maximumWidth -= allocation.width;
  }

  s32 expandWidth = 0;
  if(expandable && maximumWidth > minimumWidth) {
    expandWidth = (maximumWidth - minimumWidth) / expandable;
  }

  for(u32 position : range(self().columnCount())) {
    if(auto column = self().column(position)->self()) {
      s32 width = widths[position];
      if(column->state().expandable) width += expandWidth;
      gtk_tree_view_column_set_fixed_width(column->gtkColumn, width);
    }
  }
}

auto pTableView::setAlignment(Alignment alignment) -> void {
  _updateRulesHint();
}

auto pTableView::setBackgroundColor(Color color) -> void {
  GdkColor gdkColor = CreateColor(color);
  gtk_widget_modify_base(gtkWidgetChild, GTK_STATE_NORMAL, color ? &gdkColor : nullptr);
  _updateRulesHint();
}

auto pTableView::setBatchable(bool batchable) ->


): GrowableXYZArray | undefined {
    if (range.isNull)
      return undefined;
    const corners = range.corners();
    const frameOnPlane = this.getFrame();
    frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);
    const localRange = Range3d.createArray(corners);
    if (localRange.low.z * localRange.high.z > 0.0)
      return undefined;
    // oversized polygon on local z= 0
    const xyzOut = new GrowableXYZArray();
    xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);
    xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);
    xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);
    xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);
    xyzOut.multiplyTransformInPlace(frameOnPlane);
    IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);
    if (xyzOut.length === 0)
      return undefined;
    if (addClosurePoint)
      xyzOut.pushWrap(1);
    return xyzOut;
  }
  /** Implement appendPolygonClip, as defined in interface PolygonClipper.  /**
   *
   * @param xyz input polygon.  This is not changed.
   * @param insideFragments Array to receive "inside" fragments.  Each fragment is a GrowableXYZArray grabbed from the cache.  This is NOT cleared.
   * @param outsideFragments Array to receive "outside" fragments.  Each fragment is a GrowableXYZArray grabbed from the cache.  This is NOT cleared.
   * @param arrayCache cache for reusable GrowableXYZArray.
   */
  public appendPolygonClip(
    xyz: GrowableXYZArray,
    insideFragments: GrowableXYZArray[],
    outsideFragments: GrowableXYZArray[],
    arrayCache: GrowableXYZArrayCache): void {
    const perpendicularRange = Range1d.createNull();
    const newInside = arrayCache.grabFromCache();
    const newOutside = arrayCache.grabFromCache();
    IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(this, xyz, newInside, newOutside, perpendicularRange);
    ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);
    ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);
  }
}
import {Location, City, Zip} from "weather/service/location"
import {WeatherApiEndpoint, WeatherReport, Wind} from "weather/service/weather"
import {UrlFetcher, GetUrlFetcher} from "weather/service/utils/url_fetcher"

interface OpenWeatherWeather {
  id: number
  main: string
  description: string
}

interface OpenWeatherMain {
  temp: number
  humidity: number
  pressure: number
  temp_min: number
  temp_max: number
}

interface OpenWeatherWind {
  speed: number
  deg: number
}

interface OpenWeatherResponse {
  weather: Array<OpenWeatherWeather>
  main: OpenWeatherMain
  wind: OpenWeatherWind
}

function ToReport(response: OpenWeatherResponse): WeatherReport {
  const report = new WeatherReport()
  if (!response.weather || response.weather.length == 0 || !response.main) {
    return null
  }
  report.description = response.weather[0].description
  report.wind = new Wind()
  report.wind.speed_mps = response.wind.speed
  report.wind.heading_deg = response.wind.deg
  report.temperature_k = response.main.temp
  report.humidity = response.main.humidity
  report.pressure_barr = response.main.pressure
  return report
}

export class OpenWeatherEndpoint implements WeatherApiEndpoint {
  private fetcher: UrlFetcher
  private key


 *
 * - The #GtkWidget::size-allocate signal to take any necessary
 *   actions when the widget changes size.
 *
 * - The #GtkWidget::draw signal to handle redrawing the
 *   contents of the widget.
 *
 * The following code portion demonstrates using a drawing
 * area to display a circle in the normal widget foreground
 * color.
 *
 * Note that GDK automatically clears the exposed area before sending
 * the expose event, and that drawing is implicitly clipped to the exposed
 * area. If you want to have a theme-provided background, you need
 * to call gtk_render_background() in your ::draw method.
 *
 * ## Simple GtkDrawingArea usage
 *
 * |[<!-- language="C" -->
 * gboolean
 * draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data)
 * {
 *   guint width, height;
 *   GdkRGBA color;
 *   GtkStyleContext *context;
 *
 *   context = gtk_widget_get_style_context (widget);
 *
 *   width = gtk_widget_get_allocated_width (widget);
 *   height = gtk_widget_get_allocated_height (widget);
 *
 *   gtk_render_background (context, cr, 0, 0, width, height);
 *
 *   cairo_arc (cr,
 *              width / 2.0, height / 2.0,
 *              MIN (width, height) / 2.0,
 *              0, 2 * G_PI);
 *
 *   gtk_style_context_get_color (context,
 *                                gtk_style_context_get_state (context),
 *                                &color);
 *   gdk_cairo_set_source_rgba (cr, &color);
 *
 *   cairo_fill (cr);
 *
 *  return FALSE;
 * }
 * [...]
 *   GtkWidget *drawing_area = gtk_drawing_area_new ();
 *   gtk_widget_set_size_request (drawing_area, 100, 100);
 *   g_signal_connect (G_OBJECT (drawing_area), "draw",
 *                     G_CALLBACK (draw_callback), NULL);
 * ]|
 *
 * Draw signals are normally delivered when a drawing area first comes
 * onscreen, or when it’s covered by another window and then uncovered.
 * You can also force an expose event by adding to the “damage region”
 * of the drawing area’s window; gtk_widget_queue_draw_area() and
 * gdk_window_invalidate_rect() are equally good ways to do this.
 * You’ll then get a draw signal for the invalid region.
 *
 * The available routines for drawing are documented on the
 * [GDK Drawing Primitives][gdk3-Cairo-Interaction] page
 * and the cairo documentation.
 *
 * To receive mouse events on a drawing area, you will need to enable
 * them with gtk_widget_add_events(). To receive keyboard events, you
 * will need to set the “can-focus” property on the drawing area, and you
 * should probably draw some user-visible indication that the drawing
 * area is focused. Use gtk_widget_has_focus() in your expose event
 * handler to decide whether to draw the focus indicator. See
 * gtk_render_focus() for one way to draw focus. */
@GtkDsl
open class DrawingArea internal constructor(override val widgetPtr: CPointer<GtkWidget>? = null) : Widget() {
    private val self: CPointer<GtkDrawingArea>?
        get() = widgetPtr!!.reinterpret()

    val drawingArea: CPointer<GtkDrawingArea>?
        get() = widgetPtr!!.reinterpret()

    /**
     * Creates a new drawing area. */
    constructor() : this(gtk_drawing_area_new()?.reinterpret())
}
package gtk3

import kotlin.Unit
import kotlinx.cinterop.CPointer
import kotlinx.cint


);  /* messages generated internally by syslogd */
static const int LOG_LPR         = (6<<3);  /* line printer subsystem */
static const int LOG_NEWS        = (7<<3);  /* network news subsystem */
static const int LOG_UUCP        = (8<<3);  /* UUCP subsystem */
static const int LOG_CRON        = (9<<3);  /* clock daemon */
static const int LOG_AUTHPRIV    = (10<<3); /* security/authorization messages (private) */
static const int LOG_FTP         = (11<<3); /* ftp daemon */

static const int LOG_EMERG       = 0;       /* system is unusable */
static const int LOG_ALERT       = 1;       /* action must be taken immediately */
static const int LOG_CRIT        = 2;       /* critical conditions */
static const int LOG_ERR         = 3;       /* error conditions */
static const int LOG_WARNING     = 4;       /* warning conditions */
static const int LOG_NOTICE      = 5;       /* normal but significant condition */
static const int LOG_INFO        = 6;       /* informational */
static const int LOG_DEBUG       = 7;       /* debug-level messages */
]]


    pieceTable.getValueInRange(Range(1, 1, 1, 1))
        assertTreeInvariants(pieceTable)
    }

    @Test
    fun `random tests bug 1`() {
        var str = ""
        val pieceTable = createPieceTree(listOf(""))
        pieceTable.insert(0, "huuyYzUfKOENwGgZLqn ")
        str = str.take(0) + "huuyYzUfKOENwGgZLqn " + str.substring(0)
        pieceTable.delete(18, 2)
        str = str.take(18) + str.substring(18 + 2)
        pieceTable.delete(3, 1)
        str = str.take(3) + str.substring(3 + 1)
        pieceTable.delete(12, 4)
        str = str.take(12) + str.substring(12 + 4)
        pieceTable.insert(3, "hMbnVEdTSdhLlPevXKF ")
        str = str.take(3) + "hMbnVEdTSdhLlPevXKF " + str.substring(3)
        pieceTable.delete(22, 8)
        str = str.take(22) + str.substring(22 + 8)
        pieceTable.insert(4, "S umSnYrqOmOAV\nEbZJ ")
        str = str.take(4) + "S umSnYrqOmOAV\nEbZJ " + str.substring(4)
        testLinesContent(str, pieceTable)
        assertTreeInvariants(pieceTable)
    }

    @Test
    fun `random tests bug 2`() {
        var str = ""
        val pieceTable = createPieceTree(listOf(""))
        pieceTable.insert(0, "xfouRDZwdAHjVXJAMV\n ")
        str = str.take(0) + "xfouRDZwdAHjVXJAMV\n " + str.substring(0)
        pieceTable.insert(16, "dBGndxpFZBEAIKykYYx ")
        str = str.take(16) + "dBGndxpFZBEAIKykYYx " + str.substring(16)
        pieceTable.delete(7, 6)
        str = str.take(7) + str.substring(7 + 6)
        pieceTable.delete(9, 7)
        str = str.take(9) + str.substring(9 + 7)
        pieceTable.delete(17, 6)
        str = str.take(17) + str.substring(17 + 6)
        pieceTable.delete(0, 4)
        str = str.take(0) + str.substring(0 + 4)
        pieceTable.insert(9, "qvEFXCNvVkWgvykahYt ")
        str = str.take(9) + "qvEFXCNvVkWgvykahYt " + str.substring(9)
        pieceTable.delete(4, 6)
        str = str.take(4) + str.substring(4 + 6)
        pieceTable.insert(11, "OcSChUYT\nzPEBOpsGmR ")
        str = str.take(11) + "OcSChUYT\nzPEBOpsGmR " + str.substring(11)
        pieceTable.insert(15, "KJCozaXTvkE\nxnqAeTz ")
        str = str.take(15) + "KJCozaXTvkE\nxnqAeTz " + str.substring(15)

        testLinesContent(str, pieceTable)
        assertTreeInvariants(pieceTable)
    }

    @Test
    fun `get line content`() {
        val pieceTable = createPieceTree(listOf("1"))
        assertEquals(pieceTable.getLineRawContent(1), "1")
        pieceTable.insert(1, "2")
        assertEquals(pieceTable.getLineRawContent(1), "12")
        assertTreeInvariants(pieceTable)
    }

    @Test
    fun `get line content basic`() {
        val pieceTable = createPieceTree(listOf("1\n2\


e 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.

*******************************************************************************

FILE: Methane/Data/Math.hpp
Math primitive functions.

******************************************************************************/

#pragma once

#include <type_traits>
#include <cstdlib>
#include <cmath>
#include <numbers>

#include <Methane/Checks.hpp>

namespace Methane::Data
{

template<typename T, typename V> requires std::is_arithmetic_v<T> && std::is_arithmetic_v<V>
constexpr T RoundCast(V value) noexcept
{
    if constexpr (std::is_same_v<T, V>)
        return value;
    else
    {
        if constexpr (std::is_integral_v<T> && std::is_floating_point_v<V>)
            return static_cast<T>(std::round(value));
        else
            return static_cast<T>(value);
    }
}

template<typename T>
requires(std::is_arithmetic_v<T>)
constexpr bool IsPowerOfTwo(T value) noexcept
{
    return value > 0 && (value & (value - 1)) == 0;
}

template<typename T>
requires(std::is_arithmetic_v<T>)
constexpr T AlignUp(T value, T alignment)
{
    META_CHECK_TRUE_DESCR(IsPowerOfTwo(alignment), "alignment {} must be a power of two", alignment);
    return (value + alignment - 1) & ~(alignment - 1);
}

template<typename T>
requires(std::is_arithmetic_v<T>)
constexpr T AbsSubtract(T a, T b) noexcept
{
    return a >= b ? a - b : b - a;
}

template<typename T>
requires(std::is_arithmetic_v<T>)
constexpr T DivCeil(T numerator, T denominator) noexcept
{
    if constexpr (std::is_signed_v<T>)
    {
        std::div_t res = std::div(static_cast<int32_t>(numerator), static_cast<int32_t>(denominator));
        if (res.rem)
            return res.quot >= 0 ? (res.quot + 1) : (res.quot - 1);

        return res.quot;
    }
    else
    {
        return numerator > 0 ? (1 + (numerator - 1) / denominator) : 0;
    }
}

template<std::floating_point T>
[[nodiscard]] constexpr T DegreeToRadians(T degrees) noexcept
{
    return degrees * std::numbers::pi_v<T> / T(180.);
}

template<std::floating_point T>
[[nodiscard]] constexpr T RadiansToDegrees(T degrees) noexcept
{
    return degrees * T(180.) / std::numbers::pi_v<T>;
}

} // namespace Methane::Data
/******************************************************************************

Copyright 2019-2020 Evgeny Gorodetskiy

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.

*******************************************************************************

FILE: Methane/Data/Chunk.h
Data chunk representing owning or non-owning memory container

******************************************************************************/

#pragma once

#include "Types.h"

#include <concepts>

namespace Methane::Data
{

class Chunk // NOSONAR - rule of zero is not applicable
{
public:
    Chunk() = default;
    Chunk(ConstRawPtr data_ptr, Size size) noexcept
        : m_data_ptr


/***
 * Excerpted from "Test-Driven Development for Embedded C",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material,
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose.
 * Visit http://www.pragmaticprogrammer.com/titles/jgade for more book information.
***/
/*- ------------------------------------------------------------------ -*/
/*-    Copyright (c) James W. Grenning -- All Rights Reserved          -*/
/*-    For use by owners of Test-Driven Development for Embedded C,    -*/
/*-    and attendees of Renaissance Software Consulting, Co. training  -*/
/*-    classes.                                                        -*/
/*-                                                                    -*/
/*-    Available at http://pragprog.com/titles/jgade/                  -*/
/*-        ISBN 1-934356-62-X, ISBN13 978-1-934356-62-3                -*/
/*-                                                                    -*/
/*-    Authorized users may use this source code in your own           -*/
/*-    projects, however the source code may not be used to            -*/
/*-    create training material, courses, books, articles, and         -*/
/*-    the like. We make no guarantees that this source code is        -*/
/*-    fit for any purpose.                                            -*/
/*-                                                                    -*/
/*-    www.renaissancesoftware.net james@renaissancesoftware.net       -*/
/*- ------------------------------------------------------------------ -*/

#include "CircularBuffer.h"
#include "Utils.h"
#include <stdlib.h>
#include <string.h>

typedef struct CircularBufferStruct
{
    int count;
    int index;
    int outdex;
    int capacity;
    int * values;
} CircularBufferStruct ;

enum {BUFFER_GUARD = -999};

CircularBuffer CircularBuffer_Create(int capacity)
{
    CircularBuffer self = calloc(capacity, sizeof(CircularBufferStruct));
    self->capacity = capacity;
    self->values = calloc(capacity + 1, sizeof(int));
    self->values[capacity] = BUFFER_GUARD;
    return self;
}

void CircularBuffer_Destroy(CircularBuffer self)
{
    free(self->values);
    free(self);
}

int CircularBuffer_VerifyIntegrity(CircularBuffer self)
{
	return self->values[self->capacity] == BUFFER_GUARD;
}

int CircularBuffer_IsEmpty(CircularBuffer self)
{
    return self->count == 0;
}

int CircularBuffer_IsFull(CircularBuffer self)
{
    return self->count == self->capacity;
}

int CircularBuffer_Put(CircularBuffer self, int value)
{
    if (self->count >= self->capacity)
        return 0;

    self->count++;
    self->values[self->index++] = value;
    if (self->index >= self->capacity)
        self->index = 0;

    return 1;
}

int CircularBuffer_Get(CircularBuffer self)
{
	int value;
    if (self->count <= 0)
        return 0;

    value = self->values[self->outdex++];
    self->count--;
    if (self->outdex >= self->capacity)
        self->outdex = 0;

    return value;
}

int CircularBuffer_Capacity(CircularBuffer self)
{
    return self->capacity;
}

void CircularBuffer_Print(CircularBuffer self)
{
    int i;
    int currentValue;

    currentValue = self->outdex;

    FormatOutput("Circular buffer content:\n<");

    for (i = 0; i < self->count; i++) {
        if (i != 0)
            FormatOutput(", ");
        FormatOutput("%d", self->values[currentValue++]);
        if (currentValue >= self->capacity)
            currentValue = 0;
    }

    FormatOutput(">\n");
}


= "top" || a === "bottom") {
            if (this.layout.direction !== "vertical") {
                this.layout.direction = "vertical";
                b = true;
            }
        } else if (a === "left" || a === "right") {
            if (this.layout.direction !== "horizontal") {
                this.layout.direction = "horizontal";
                b = true;
            }
        }

        if (this.layout.ax !== "center") {
            this.layout.ax = "center";
            b = true;
        }

        if (this.layout.ay !== "center") {
            this.layout.ay = "center";
            b = true;
        }

        if ((a === "top" || a === "left") && i !== 0 ) {
            this.insert("image", 0, this.removeAt(i));
            b = false;
        } else if ((a === "bottom"  || a === "right") && i !== 1) {
            this.add("image", this.removeAt(i));
            b = false;
        }

        if (b) {
            this.vrp();
        }

        return this;
    }

    setImgPreferredSize(w, h) {
        if (arguments.length === 1) h = w;
        this.getByConstraints("image").setPreferredSize(w, h);
        return this;
    }
}
import {revert} from '../../src/api/revert'
import {constructDirectoryObject, Directory} from '../../src/api/revert'
import {filterFiles} from '../../src/api/javascript.utils';
import {languages} from "../../src/api/languages"
import {javascript} from '../../src/api/javascript'
import {Language} from '../../src/api/language'
import AdmZip from 'adm-zip'
import mock from 'mock-fs'

const language = "javascript"
const languageInstance:Language = languages[language]

test("uncompose returns buffer object", ()=>{

    expect(revert(Buffer.from(""),language) instanceof Buffer).toBe(true)
})

test("compose is revertable",()=>{
    const zip = new AdmZip("./test/files/js_test_sub.zip");

    const files = zip
        .getEntries()
        .filter(entry => !entry.isDirectory)
        .reduce<{ [index: string]: string[] }>((acc, entry) => {
          acc[
            entry.entryName
              .split('/')
              .slice(1)
              .join('/')
          ] = entry
            .getData()
            .toString('utf-8')
            .split('\n');
          return acc;
        }, {});

    const composedFile: string = languageInstance.compose(
        "main.js",
        files
    );

    const cmp:Buffer = revert(Buffer.from(composedFile),language);

    const rzip = new AdmZip(cmp);
    let zipRoot = "";
    const zipFiles = zip.getEntries().map((entry)=>{
        zipRoot = entry.entryName.split("/")[0]
        return entry.entryName.split("/").slice(1).join("/")
    })

})

test("Valid directory object is formed from list of paths", ()=>{
    const ext = languageInstance.getExtensions()[0]
    const paths = [ `/root/main${ext}`,
                    `/root/files/module1${ext}`,
                    `/root/files/module2${ext}`,
                    `/root/files/module3${ext}`,
                    `/root/files/subs/module1${ext}`,
                    `/root/files/subs/sub1/sub2/sub3/module1${ext}`]
    let dir:Directory = {}
    dir["/"] = {}
    paths.forEach((path)=>{
        constructDirectoryObject(path.split("/").slice(0,-1).reverse(),dir, dir["/"])
    })

    dir = dir["/"]
    expect("root" in dir).toBe(true);
    expect("files" in dir.root).toBe(true);
    expect("subs" in dir.root.files).toBe(true);