blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
357
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
58
| license_type
stringclasses 2
values | repo_name
stringlengths 4
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-14 21:31:45
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-01 00:00:00
2023-09-05 23:26:37
| committer_date
timestamp[ns]date 1970-01-01 00:00:00
2023-09-05 23:26:37
| github_id
int64 966
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 24
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-02-03 21:17:16
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 180
values | src_encoding
stringclasses 35
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 6
10.4M
| extension
stringclasses 121
values | filename
stringlengths 1
148
| content
stringlengths 6
10.4M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b786f0e5084e5b8717ee0ab80c81566c02fae9f6 | e80e5374b8fd00379293adb35fc8cf017d5f4cc7 | /qemu_mode/qemu-2.10.0/hw/display/vga.c | 63421f9ee8563ce1f0a1f38de5957b29d43123c4 | [
"GPL-2.0-only",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | CAFA1/afl | dcebf3a3acae3e9783bbb79d8cff6958b496fa34 | 01c113b61ab70c3b02f3d7c74e6dfa20cfc7813d | refs/heads/master | 2023-04-10T14:30:34.901666 | 2020-07-27T01:06:32 | 2020-07-27T01:06:32 | 272,596,630 | 0 | 2 | Apache-2.0 | 2021-04-15T00:56:55 | 2020-06-16T03:03:26 | C | UTF-8 | C | false | false | 69,248 | c | vga.c | /*
* QEMU VGA Emulator.
*
* Copyright (c) 2003 Fabrice Bellard
*
* 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 "qemu/osdep.h"
#include "qapi/error.h"
#include "hw/hw.h"
#include "vga.h"
#include "ui/console.h"
#include "hw/i386/pc.h"
#include "hw/pci/pci.h"
#include "vga_int.h"
#include "ui/pixel_ops.h"
#include "qemu/timer.h"
#include "hw/xen/xen.h"
#include "trace.h"
//#define DEBUG_VGA_MEM
//#define DEBUG_VGA_REG
/* 16 state changes per vertical frame @60 Hz */
#define VGA_TEXT_CURSOR_PERIOD_MS (1000 * 2 * 16 / 60)
/*
* Video Graphics Array (VGA)
*
* Chipset docs for original IBM VGA:
* http://www.mcamafia.de/pdf/ibm_vgaxga_trm2.pdf
*
* FreeVGA site:
* http://www.osdever.net/FreeVGA/home.htm
*
* Standard VGA features and Bochs VBE extensions are implemented.
*/
/* force some bits to zero */
const uint8_t sr_mask[8] = {
0x03,
0x3d,
0x0f,
0x3f,
0x0e,
0x00,
0x00,
0xff,
};
const uint8_t gr_mask[16] = {
0x0f, /* 0x00 */
0x0f, /* 0x01 */
0x0f, /* 0x02 */
0x1f, /* 0x03 */
0x03, /* 0x04 */
0x7b, /* 0x05 */
0x0f, /* 0x06 */
0x0f, /* 0x07 */
0xff, /* 0x08 */
0x00, /* 0x09 */
0x00, /* 0x0a */
0x00, /* 0x0b */
0x00, /* 0x0c */
0x00, /* 0x0d */
0x00, /* 0x0e */
0x00, /* 0x0f */
};
#define cbswap_32(__x) \
((uint32_t)( \
(((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
(((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
(((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
(((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) ))
#ifdef HOST_WORDS_BIGENDIAN
#define PAT(x) cbswap_32(x)
#else
#define PAT(x) (x)
#endif
#ifdef HOST_WORDS_BIGENDIAN
#define BIG 1
#else
#define BIG 0
#endif
#ifdef HOST_WORDS_BIGENDIAN
#define GET_PLANE(data, p) (((data) >> (24 - (p) * 8)) & 0xff)
#else
#define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff)
#endif
static const uint32_t mask16[16] = {
PAT(0x00000000),
PAT(0x000000ff),
PAT(0x0000ff00),
PAT(0x0000ffff),
PAT(0x00ff0000),
PAT(0x00ff00ff),
PAT(0x00ffff00),
PAT(0x00ffffff),
PAT(0xff000000),
PAT(0xff0000ff),
PAT(0xff00ff00),
PAT(0xff00ffff),
PAT(0xffff0000),
PAT(0xffff00ff),
PAT(0xffffff00),
PAT(0xffffffff),
};
#undef PAT
#ifdef HOST_WORDS_BIGENDIAN
#define PAT(x) (x)
#else
#define PAT(x) cbswap_32(x)
#endif
static uint32_t expand4[256];
static uint16_t expand2[256];
static uint8_t expand4to8[16];
static void vbe_update_vgaregs(VGACommonState *s);
static inline bool vbe_enabled(VGACommonState *s)
{
return s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED;
}
static inline uint8_t sr(VGACommonState *s, int idx)
{
return vbe_enabled(s) ? s->sr_vbe[idx] : s->sr[idx];
}
static void vga_update_memory_access(VGACommonState *s)
{
hwaddr base, offset, size;
if (s->legacy_address_space == NULL) {
return;
}
if (s->has_chain4_alias) {
memory_region_del_subregion(s->legacy_address_space, &s->chain4_alias);
object_unparent(OBJECT(&s->chain4_alias));
s->has_chain4_alias = false;
s->plane_updated = 0xf;
}
if ((sr(s, VGA_SEQ_PLANE_WRITE) & VGA_SR02_ALL_PLANES) ==
VGA_SR02_ALL_PLANES && sr(s, VGA_SEQ_MEMORY_MODE) & VGA_SR04_CHN_4M) {
offset = 0;
switch ((s->gr[VGA_GFX_MISC] >> 2) & 3) {
case 0:
base = 0xa0000;
size = 0x20000;
break;
case 1:
base = 0xa0000;
size = 0x10000;
offset = s->bank_offset;
break;
case 2:
base = 0xb0000;
size = 0x8000;
break;
case 3:
default:
base = 0xb8000;
size = 0x8000;
break;
}
assert(offset + size <= s->vram_size);
memory_region_init_alias(&s->chain4_alias, memory_region_owner(&s->vram),
"vga.chain4", &s->vram, offset, size);
memory_region_add_subregion_overlap(s->legacy_address_space, base,
&s->chain4_alias, 2);
s->has_chain4_alias = true;
}
}
static void vga_dumb_update_retrace_info(VGACommonState *s)
{
(void) s;
}
static void vga_precise_update_retrace_info(VGACommonState *s)
{
int htotal_chars;
int hretr_start_char;
int hretr_skew_chars;
int hretr_end_char;
int vtotal_lines;
int vretr_start_line;
int vretr_end_line;
int dots;
#if 0
int div2, sldiv2;
#endif
int clocking_mode;
int clock_sel;
const int clk_hz[] = {25175000, 28322000, 25175000, 25175000};
int64_t chars_per_sec;
struct vga_precise_retrace *r = &s->retrace_info.precise;
htotal_chars = s->cr[VGA_CRTC_H_TOTAL] + 5;
hretr_start_char = s->cr[VGA_CRTC_H_SYNC_START];
hretr_skew_chars = (s->cr[VGA_CRTC_H_SYNC_END] >> 5) & 3;
hretr_end_char = s->cr[VGA_CRTC_H_SYNC_END] & 0x1f;
vtotal_lines = (s->cr[VGA_CRTC_V_TOTAL] |
(((s->cr[VGA_CRTC_OVERFLOW] & 1) |
((s->cr[VGA_CRTC_OVERFLOW] >> 4) & 2)) << 8)) + 2;
vretr_start_line = s->cr[VGA_CRTC_V_SYNC_START] |
((((s->cr[VGA_CRTC_OVERFLOW] >> 2) & 1) |
((s->cr[VGA_CRTC_OVERFLOW] >> 6) & 2)) << 8);
vretr_end_line = s->cr[VGA_CRTC_V_SYNC_END] & 0xf;
clocking_mode = (sr(s, VGA_SEQ_CLOCK_MODE) >> 3) & 1;
clock_sel = (s->msr >> 2) & 3;
dots = (s->msr & 1) ? 8 : 9;
chars_per_sec = clk_hz[clock_sel] / dots;
htotal_chars <<= clocking_mode;
r->total_chars = vtotal_lines * htotal_chars;
if (r->freq) {
r->ticks_per_char = NANOSECONDS_PER_SECOND / (r->total_chars * r->freq);
} else {
r->ticks_per_char = NANOSECONDS_PER_SECOND / chars_per_sec;
}
r->vstart = vretr_start_line;
r->vend = r->vstart + vretr_end_line + 1;
r->hstart = hretr_start_char + hretr_skew_chars;
r->hend = r->hstart + hretr_end_char + 1;
r->htotal = htotal_chars;
#if 0
div2 = (s->cr[VGA_CRTC_MODE] >> 2) & 1;
sldiv2 = (s->cr[VGA_CRTC_MODE] >> 3) & 1;
printf (
"hz=%f\n"
"htotal = %d\n"
"hretr_start = %d\n"
"hretr_skew = %d\n"
"hretr_end = %d\n"
"vtotal = %d\n"
"vretr_start = %d\n"
"vretr_end = %d\n"
"div2 = %d sldiv2 = %d\n"
"clocking_mode = %d\n"
"clock_sel = %d %d\n"
"dots = %d\n"
"ticks/char = %" PRId64 "\n"
"\n",
(double) NANOSECONDS_PER_SECOND / (r->ticks_per_char * r->total_chars),
htotal_chars,
hretr_start_char,
hretr_skew_chars,
hretr_end_char,
vtotal_lines,
vretr_start_line,
vretr_end_line,
div2, sldiv2,
clocking_mode,
clock_sel,
clk_hz[clock_sel],
dots,
r->ticks_per_char
);
#endif
}
static uint8_t vga_precise_retrace(VGACommonState *s)
{
struct vga_precise_retrace *r = &s->retrace_info.precise;
uint8_t val = s->st01 & ~(ST01_V_RETRACE | ST01_DISP_ENABLE);
if (r->total_chars) {
int cur_line, cur_line_char, cur_char;
int64_t cur_tick;
cur_tick = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
cur_char = (cur_tick / r->ticks_per_char) % r->total_chars;
cur_line = cur_char / r->htotal;
if (cur_line >= r->vstart && cur_line <= r->vend) {
val |= ST01_V_RETRACE | ST01_DISP_ENABLE;
} else {
cur_line_char = cur_char % r->htotal;
if (cur_line_char >= r->hstart && cur_line_char <= r->hend) {
val |= ST01_DISP_ENABLE;
}
}
return val;
} else {
return s->st01 ^ (ST01_V_RETRACE | ST01_DISP_ENABLE);
}
}
static uint8_t vga_dumb_retrace(VGACommonState *s)
{
return s->st01 ^ (ST01_V_RETRACE | ST01_DISP_ENABLE);
}
int vga_ioport_invalid(VGACommonState *s, uint32_t addr)
{
if (s->msr & VGA_MIS_COLOR) {
/* Color */
return (addr >= 0x3b0 && addr <= 0x3bf);
} else {
/* Monochrome */
return (addr >= 0x3d0 && addr <= 0x3df);
}
}
uint32_t vga_ioport_read(void *opaque, uint32_t addr)
{
VGACommonState *s = opaque;
int val, index;
if (vga_ioport_invalid(s, addr)) {
val = 0xff;
} else {
switch(addr) {
case VGA_ATT_W:
if (s->ar_flip_flop == 0) {
val = s->ar_index;
} else {
val = 0;
}
break;
case VGA_ATT_R:
index = s->ar_index & 0x1f;
if (index < VGA_ATT_C) {
val = s->ar[index];
} else {
val = 0;
}
break;
case VGA_MIS_W:
val = s->st00;
break;
case VGA_SEQ_I:
val = s->sr_index;
break;
case VGA_SEQ_D:
val = s->sr[s->sr_index];
#ifdef DEBUG_VGA_REG
printf("vga: read SR%x = 0x%02x\n", s->sr_index, val);
#endif
break;
case VGA_PEL_IR:
val = s->dac_state;
break;
case VGA_PEL_IW:
val = s->dac_write_index;
break;
case VGA_PEL_D:
val = s->palette[s->dac_read_index * 3 + s->dac_sub_index];
if (++s->dac_sub_index == 3) {
s->dac_sub_index = 0;
s->dac_read_index++;
}
break;
case VGA_FTC_R:
val = s->fcr;
break;
case VGA_MIS_R:
val = s->msr;
break;
case VGA_GFX_I:
val = s->gr_index;
break;
case VGA_GFX_D:
val = s->gr[s->gr_index];
#ifdef DEBUG_VGA_REG
printf("vga: read GR%x = 0x%02x\n", s->gr_index, val);
#endif
break;
case VGA_CRT_IM:
case VGA_CRT_IC:
val = s->cr_index;
break;
case VGA_CRT_DM:
case VGA_CRT_DC:
val = s->cr[s->cr_index];
#ifdef DEBUG_VGA_REG
printf("vga: read CR%x = 0x%02x\n", s->cr_index, val);
#endif
break;
case VGA_IS1_RM:
case VGA_IS1_RC:
/* just toggle to fool polling */
val = s->st01 = s->retrace(s);
s->ar_flip_flop = 0;
break;
default:
val = 0x00;
break;
}
}
trace_vga_std_read_io(addr, val);
return val;
}
void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
VGACommonState *s = opaque;
int index;
/* check port range access depending on color/monochrome mode */
if (vga_ioport_invalid(s, addr)) {
return;
}
trace_vga_std_write_io(addr, val);
switch(addr) {
case VGA_ATT_W:
if (s->ar_flip_flop == 0) {
val &= 0x3f;
s->ar_index = val;
} else {
index = s->ar_index & 0x1f;
switch(index) {
case VGA_ATC_PALETTE0 ... VGA_ATC_PALETTEF:
s->ar[index] = val & 0x3f;
break;
case VGA_ATC_MODE:
s->ar[index] = val & ~0x10;
break;
case VGA_ATC_OVERSCAN:
s->ar[index] = val;
break;
case VGA_ATC_PLANE_ENABLE:
s->ar[index] = val & ~0xc0;
break;
case VGA_ATC_PEL:
s->ar[index] = val & ~0xf0;
break;
case VGA_ATC_COLOR_PAGE:
s->ar[index] = val & ~0xf0;
break;
default:
break;
}
}
s->ar_flip_flop ^= 1;
break;
case VGA_MIS_W:
s->msr = val & ~0x10;
s->update_retrace_info(s);
break;
case VGA_SEQ_I:
s->sr_index = val & 7;
break;
case VGA_SEQ_D:
#ifdef DEBUG_VGA_REG
printf("vga: write SR%x = 0x%02x\n", s->sr_index, val);
#endif
s->sr[s->sr_index] = val & sr_mask[s->sr_index];
if (s->sr_index == VGA_SEQ_CLOCK_MODE) {
s->update_retrace_info(s);
}
vga_update_memory_access(s);
break;
case VGA_PEL_IR:
s->dac_read_index = val;
s->dac_sub_index = 0;
s->dac_state = 3;
break;
case VGA_PEL_IW:
s->dac_write_index = val;
s->dac_sub_index = 0;
s->dac_state = 0;
break;
case VGA_PEL_D:
s->dac_cache[s->dac_sub_index] = val;
if (++s->dac_sub_index == 3) {
memcpy(&s->palette[s->dac_write_index * 3], s->dac_cache, 3);
s->dac_sub_index = 0;
s->dac_write_index++;
}
break;
case VGA_GFX_I:
s->gr_index = val & 0x0f;
break;
case VGA_GFX_D:
#ifdef DEBUG_VGA_REG
printf("vga: write GR%x = 0x%02x\n", s->gr_index, val);
#endif
s->gr[s->gr_index] = val & gr_mask[s->gr_index];
vbe_update_vgaregs(s);
vga_update_memory_access(s);
break;
case VGA_CRT_IM:
case VGA_CRT_IC:
s->cr_index = val;
break;
case VGA_CRT_DM:
case VGA_CRT_DC:
#ifdef DEBUG_VGA_REG
printf("vga: write CR%x = 0x%02x\n", s->cr_index, val);
#endif
/* handle CR0-7 protection */
if ((s->cr[VGA_CRTC_V_SYNC_END] & VGA_CR11_LOCK_CR0_CR7) &&
s->cr_index <= VGA_CRTC_OVERFLOW) {
/* can always write bit 4 of CR7 */
if (s->cr_index == VGA_CRTC_OVERFLOW) {
s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x10) |
(val & 0x10);
vbe_update_vgaregs(s);
}
return;
}
s->cr[s->cr_index] = val;
vbe_update_vgaregs(s);
switch(s->cr_index) {
case VGA_CRTC_H_TOTAL:
case VGA_CRTC_H_SYNC_START:
case VGA_CRTC_H_SYNC_END:
case VGA_CRTC_V_TOTAL:
case VGA_CRTC_OVERFLOW:
case VGA_CRTC_V_SYNC_END:
case VGA_CRTC_MODE:
s->update_retrace_info(s);
break;
}
break;
case VGA_IS1_RM:
case VGA_IS1_RC:
s->fcr = val & 0x10;
break;
}
}
/*
* Sanity check vbe register writes.
*
* As we don't have a way to signal errors to the guest in the bochs
* dispi interface we'll go adjust the registers to the closest valid
* value.
*/
static void vbe_fixup_regs(VGACommonState *s)
{
uint16_t *r = s->vbe_regs;
uint32_t bits, linelength, maxy, offset;
if (!vbe_enabled(s)) {
/* vbe is turned off -- nothing to do */
return;
}
/* check depth */
switch (r[VBE_DISPI_INDEX_BPP]) {
case 4:
case 8:
case 16:
case 24:
case 32:
bits = r[VBE_DISPI_INDEX_BPP];
break;
case 15:
bits = 16;
break;
default:
bits = r[VBE_DISPI_INDEX_BPP] = 8;
break;
}
/* check width */
r[VBE_DISPI_INDEX_XRES] &= ~7u;
if (r[VBE_DISPI_INDEX_XRES] == 0) {
r[VBE_DISPI_INDEX_XRES] = 8;
}
if (r[VBE_DISPI_INDEX_XRES] > VBE_DISPI_MAX_XRES) {
r[VBE_DISPI_INDEX_XRES] = VBE_DISPI_MAX_XRES;
}
r[VBE_DISPI_INDEX_VIRT_WIDTH] &= ~7u;
if (r[VBE_DISPI_INDEX_VIRT_WIDTH] > VBE_DISPI_MAX_XRES) {
r[VBE_DISPI_INDEX_VIRT_WIDTH] = VBE_DISPI_MAX_XRES;
}
if (r[VBE_DISPI_INDEX_VIRT_WIDTH] < r[VBE_DISPI_INDEX_XRES]) {
r[VBE_DISPI_INDEX_VIRT_WIDTH] = r[VBE_DISPI_INDEX_XRES];
}
/* check height */
linelength = r[VBE_DISPI_INDEX_VIRT_WIDTH] * bits / 8;
maxy = s->vbe_size / linelength;
if (r[VBE_DISPI_INDEX_YRES] == 0) {
r[VBE_DISPI_INDEX_YRES] = 1;
}
if (r[VBE_DISPI_INDEX_YRES] > VBE_DISPI_MAX_YRES) {
r[VBE_DISPI_INDEX_YRES] = VBE_DISPI_MAX_YRES;
}
if (r[VBE_DISPI_INDEX_YRES] > maxy) {
r[VBE_DISPI_INDEX_YRES] = maxy;
}
/* check offset */
if (r[VBE_DISPI_INDEX_X_OFFSET] > VBE_DISPI_MAX_XRES) {
r[VBE_DISPI_INDEX_X_OFFSET] = VBE_DISPI_MAX_XRES;
}
if (r[VBE_DISPI_INDEX_Y_OFFSET] > VBE_DISPI_MAX_YRES) {
r[VBE_DISPI_INDEX_Y_OFFSET] = VBE_DISPI_MAX_YRES;
}
offset = r[VBE_DISPI_INDEX_X_OFFSET] * bits / 8;
offset += r[VBE_DISPI_INDEX_Y_OFFSET] * linelength;
if (offset + r[VBE_DISPI_INDEX_YRES] * linelength > s->vbe_size) {
r[VBE_DISPI_INDEX_Y_OFFSET] = 0;
offset = r[VBE_DISPI_INDEX_X_OFFSET] * bits / 8;
if (offset + r[VBE_DISPI_INDEX_YRES] * linelength > s->vbe_size) {
r[VBE_DISPI_INDEX_X_OFFSET] = 0;
offset = 0;
}
}
/* update vga state */
r[VBE_DISPI_INDEX_VIRT_HEIGHT] = maxy;
s->vbe_line_offset = linelength;
s->vbe_start_addr = offset / 4;
}
/* we initialize the VGA graphic mode */
static void vbe_update_vgaregs(VGACommonState *s)
{
int h, shift_control;
if (!vbe_enabled(s)) {
/* vbe is turned off -- nothing to do */
return;
}
/* graphic mode + memory map 1 */
s->gr[VGA_GFX_MISC] = (s->gr[VGA_GFX_MISC] & ~0x0c) | 0x04 |
VGA_GR06_GRAPHICS_MODE;
s->cr[VGA_CRTC_MODE] |= 3; /* no CGA modes */
s->cr[VGA_CRTC_OFFSET] = s->vbe_line_offset >> 3;
/* width */
s->cr[VGA_CRTC_H_DISP] =
(s->vbe_regs[VBE_DISPI_INDEX_XRES] >> 3) - 1;
/* height (only meaningful if < 1024) */
h = s->vbe_regs[VBE_DISPI_INDEX_YRES] - 1;
s->cr[VGA_CRTC_V_DISP_END] = h;
s->cr[VGA_CRTC_OVERFLOW] = (s->cr[VGA_CRTC_OVERFLOW] & ~0x42) |
((h >> 7) & 0x02) | ((h >> 3) & 0x40);
/* line compare to 1023 */
s->cr[VGA_CRTC_LINE_COMPARE] = 0xff;
s->cr[VGA_CRTC_OVERFLOW] |= 0x10;
s->cr[VGA_CRTC_MAX_SCAN] |= 0x40;
if (s->vbe_regs[VBE_DISPI_INDEX_BPP] == 4) {
shift_control = 0;
s->sr_vbe[VGA_SEQ_CLOCK_MODE] &= ~8; /* no double line */
} else {
shift_control = 2;
/* set chain 4 mode */
s->sr_vbe[VGA_SEQ_MEMORY_MODE] |= VGA_SR04_CHN_4M;
/* activate all planes */
s->sr_vbe[VGA_SEQ_PLANE_WRITE] |= VGA_SR02_ALL_PLANES;
}
s->gr[VGA_GFX_MODE] = (s->gr[VGA_GFX_MODE] & ~0x60) |
(shift_control << 5);
s->cr[VGA_CRTC_MAX_SCAN] &= ~0x9f; /* no double scan */
}
static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr)
{
VGACommonState *s = opaque;
return s->vbe_index;
}
uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr)
{
VGACommonState *s = opaque;
uint32_t val;
if (s->vbe_index < VBE_DISPI_INDEX_NB) {
if (s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_GETCAPS) {
switch(s->vbe_index) {
/* XXX: do not hardcode ? */
case VBE_DISPI_INDEX_XRES:
val = VBE_DISPI_MAX_XRES;
break;
case VBE_DISPI_INDEX_YRES:
val = VBE_DISPI_MAX_YRES;
break;
case VBE_DISPI_INDEX_BPP:
val = VBE_DISPI_MAX_BPP;
break;
default:
val = s->vbe_regs[s->vbe_index];
break;
}
} else {
val = s->vbe_regs[s->vbe_index];
}
} else if (s->vbe_index == VBE_DISPI_INDEX_VIDEO_MEMORY_64K) {
val = s->vbe_size / (64 * 1024);
} else {
val = 0;
}
trace_vga_vbe_read(s->vbe_index, val);
return val;
}
void vbe_ioport_write_index(void *opaque, uint32_t addr, uint32_t val)
{
VGACommonState *s = opaque;
s->vbe_index = val;
}
void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
{
VGACommonState *s = opaque;
if (s->vbe_index <= VBE_DISPI_INDEX_NB) {
trace_vga_vbe_write(s->vbe_index, val);
switch(s->vbe_index) {
case VBE_DISPI_INDEX_ID:
if (val == VBE_DISPI_ID0 ||
val == VBE_DISPI_ID1 ||
val == VBE_DISPI_ID2 ||
val == VBE_DISPI_ID3 ||
val == VBE_DISPI_ID4) {
s->vbe_regs[s->vbe_index] = val;
}
break;
case VBE_DISPI_INDEX_XRES:
case VBE_DISPI_INDEX_YRES:
case VBE_DISPI_INDEX_BPP:
case VBE_DISPI_INDEX_VIRT_WIDTH:
case VBE_DISPI_INDEX_X_OFFSET:
case VBE_DISPI_INDEX_Y_OFFSET:
s->vbe_regs[s->vbe_index] = val;
vbe_fixup_regs(s);
vbe_update_vgaregs(s);
break;
case VBE_DISPI_INDEX_BANK:
val &= s->vbe_bank_mask;
s->vbe_regs[s->vbe_index] = val;
s->bank_offset = (val << 16);
vga_update_memory_access(s);
break;
case VBE_DISPI_INDEX_ENABLE:
if ((val & VBE_DISPI_ENABLED) &&
!(s->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) {
s->vbe_regs[VBE_DISPI_INDEX_VIRT_WIDTH] = 0;
s->vbe_regs[VBE_DISPI_INDEX_X_OFFSET] = 0;
s->vbe_regs[VBE_DISPI_INDEX_Y_OFFSET] = 0;
s->vbe_regs[VBE_DISPI_INDEX_ENABLE] |= VBE_DISPI_ENABLED;
vbe_fixup_regs(s);
vbe_update_vgaregs(s);
/* clear the screen */
if (!(val & VBE_DISPI_NOCLEARMEM)) {
memset(s->vram_ptr, 0,
s->vbe_regs[VBE_DISPI_INDEX_YRES] * s->vbe_line_offset);
}
} else {
s->bank_offset = 0;
}
s->dac_8bit = (val & VBE_DISPI_8BIT_DAC) > 0;
s->vbe_regs[s->vbe_index] = val;
vga_update_memory_access(s);
break;
default:
break;
}
}
}
/* called for accesses between 0xa0000 and 0xc0000 */
uint32_t vga_mem_readb(VGACommonState *s, hwaddr addr)
{
int memory_map_mode, plane;
uint32_t ret;
/* convert to VGA memory offset */
memory_map_mode = (s->gr[VGA_GFX_MISC] >> 2) & 3;
addr &= 0x1ffff;
switch(memory_map_mode) {
case 0:
break;
case 1:
if (addr >= 0x10000)
return 0xff;
addr += s->bank_offset;
break;
case 2:
addr -= 0x10000;
if (addr >= 0x8000)
return 0xff;
break;
default:
case 3:
addr -= 0x18000;
if (addr >= 0x8000)
return 0xff;
break;
}
if (sr(s, VGA_SEQ_MEMORY_MODE) & VGA_SR04_CHN_4M) {
/* chain 4 mode : simplest access */
assert(addr < s->vram_size);
ret = s->vram_ptr[addr];
} else if (s->gr[VGA_GFX_MODE] & 0x10) {
/* odd/even mode (aka text mode mapping) */
plane = (s->gr[VGA_GFX_PLANE_READ] & 2) | (addr & 1);
addr = ((addr & ~1) << 1) | plane;
if (addr >= s->vram_size) {
return 0xff;
}
ret = s->vram_ptr[addr];
} else {
/* standard VGA latched access */
if (addr * sizeof(uint32_t) >= s->vram_size) {
return 0xff;
}
s->latch = ((uint32_t *)s->vram_ptr)[addr];
if (!(s->gr[VGA_GFX_MODE] & 0x08)) {
/* read mode 0 */
plane = s->gr[VGA_GFX_PLANE_READ];
ret = GET_PLANE(s->latch, plane);
} else {
/* read mode 1 */
ret = (s->latch ^ mask16[s->gr[VGA_GFX_COMPARE_VALUE]]) &
mask16[s->gr[VGA_GFX_COMPARE_MASK]];
ret |= ret >> 16;
ret |= ret >> 8;
ret = (~ret) & 0xff;
}
}
return ret;
}
/* called for accesses between 0xa0000 and 0xc0000 */
void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
{
int memory_map_mode, plane, write_mode, b, func_select, mask;
uint32_t write_mask, bit_mask, set_mask;
#ifdef DEBUG_VGA_MEM
printf("vga: [0x" TARGET_FMT_plx "] = 0x%02x\n", addr, val);
#endif
/* convert to VGA memory offset */
memory_map_mode = (s->gr[VGA_GFX_MISC] >> 2) & 3;
addr &= 0x1ffff;
switch(memory_map_mode) {
case 0:
break;
case 1:
if (addr >= 0x10000)
return;
addr += s->bank_offset;
break;
case 2:
addr -= 0x10000;
if (addr >= 0x8000)
return;
break;
default:
case 3:
addr -= 0x18000;
if (addr >= 0x8000)
return;
break;
}
if (sr(s, VGA_SEQ_MEMORY_MODE) & VGA_SR04_CHN_4M) {
/* chain 4 mode : simplest access */
plane = addr & 3;
mask = (1 << plane);
if (sr(s, VGA_SEQ_PLANE_WRITE) & mask) {
assert(addr < s->vram_size);
s->vram_ptr[addr] = val;
#ifdef DEBUG_VGA_MEM
printf("vga: chain4: [0x" TARGET_FMT_plx "]\n", addr);
#endif
s->plane_updated |= mask; /* only used to detect font change */
memory_region_set_dirty(&s->vram, addr, 1);
}
} else if (s->gr[VGA_GFX_MODE] & 0x10) {
/* odd/even mode (aka text mode mapping) */
plane = (s->gr[VGA_GFX_PLANE_READ] & 2) | (addr & 1);
mask = (1 << plane);
if (sr(s, VGA_SEQ_PLANE_WRITE) & mask) {
addr = ((addr & ~1) << 1) | plane;
if (addr >= s->vram_size) {
return;
}
s->vram_ptr[addr] = val;
#ifdef DEBUG_VGA_MEM
printf("vga: odd/even: [0x" TARGET_FMT_plx "]\n", addr);
#endif
s->plane_updated |= mask; /* only used to detect font change */
memory_region_set_dirty(&s->vram, addr, 1);
}
} else {
/* standard VGA latched access */
write_mode = s->gr[VGA_GFX_MODE] & 3;
switch(write_mode) {
default:
case 0:
/* rotate */
b = s->gr[VGA_GFX_DATA_ROTATE] & 7;
val = ((val >> b) | (val << (8 - b))) & 0xff;
val |= val << 8;
val |= val << 16;
/* apply set/reset mask */
set_mask = mask16[s->gr[VGA_GFX_SR_ENABLE]];
val = (val & ~set_mask) |
(mask16[s->gr[VGA_GFX_SR_VALUE]] & set_mask);
bit_mask = s->gr[VGA_GFX_BIT_MASK];
break;
case 1:
val = s->latch;
goto do_write;
case 2:
val = mask16[val & 0x0f];
bit_mask = s->gr[VGA_GFX_BIT_MASK];
break;
case 3:
/* rotate */
b = s->gr[VGA_GFX_DATA_ROTATE] & 7;
val = (val >> b) | (val << (8 - b));
bit_mask = s->gr[VGA_GFX_BIT_MASK] & val;
val = mask16[s->gr[VGA_GFX_SR_VALUE]];
break;
}
/* apply logical operation */
func_select = s->gr[VGA_GFX_DATA_ROTATE] >> 3;
switch(func_select) {
case 0:
default:
/* nothing to do */
break;
case 1:
/* and */
val &= s->latch;
break;
case 2:
/* or */
val |= s->latch;
break;
case 3:
/* xor */
val ^= s->latch;
break;
}
/* apply bit mask */
bit_mask |= bit_mask << 8;
bit_mask |= bit_mask << 16;
val = (val & bit_mask) | (s->latch & ~bit_mask);
do_write:
/* mask data according to sr[2] */
mask = sr(s, VGA_SEQ_PLANE_WRITE);
s->plane_updated |= mask; /* only used to detect font change */
write_mask = mask16[mask];
if (addr * sizeof(uint32_t) >= s->vram_size) {
return;
}
((uint32_t *)s->vram_ptr)[addr] =
(((uint32_t *)s->vram_ptr)[addr] & ~write_mask) |
(val & write_mask);
#ifdef DEBUG_VGA_MEM
printf("vga: latch: [0x" TARGET_FMT_plx "] mask=0x%08x val=0x%08x\n",
addr * 4, write_mask, val);
#endif
memory_region_set_dirty(&s->vram, addr << 2, sizeof(uint32_t));
}
}
typedef void vga_draw_line_func(VGACommonState *s1, uint8_t *d,
const uint8_t *s, int width);
#include "vga-helpers.h"
/* return true if the palette was modified */
static int update_palette16(VGACommonState *s)
{
int full_update, i;
uint32_t v, col, *palette;
full_update = 0;
palette = s->last_palette;
for(i = 0; i < 16; i++) {
v = s->ar[i];
if (s->ar[VGA_ATC_MODE] & 0x80) {
v = ((s->ar[VGA_ATC_COLOR_PAGE] & 0xf) << 4) | (v & 0xf);
} else {
v = ((s->ar[VGA_ATC_COLOR_PAGE] & 0xc) << 4) | (v & 0x3f);
}
v = v * 3;
col = rgb_to_pixel32(c6_to_8(s->palette[v]),
c6_to_8(s->palette[v + 1]),
c6_to_8(s->palette[v + 2]));
if (col != palette[i]) {
full_update = 1;
palette[i] = col;
}
}
return full_update;
}
/* return true if the palette was modified */
static int update_palette256(VGACommonState *s)
{
int full_update, i;
uint32_t v, col, *palette;
full_update = 0;
palette = s->last_palette;
v = 0;
for(i = 0; i < 256; i++) {
if (s->dac_8bit) {
col = rgb_to_pixel32(s->palette[v],
s->palette[v + 1],
s->palette[v + 2]);
} else {
col = rgb_to_pixel32(c6_to_8(s->palette[v]),
c6_to_8(s->palette[v + 1]),
c6_to_8(s->palette[v + 2]));
}
if (col != palette[i]) {
full_update = 1;
palette[i] = col;
}
v += 3;
}
return full_update;
}
static void vga_get_offsets(VGACommonState *s,
uint32_t *pline_offset,
uint32_t *pstart_addr,
uint32_t *pline_compare)
{
uint32_t start_addr, line_offset, line_compare;
if (vbe_enabled(s)) {
line_offset = s->vbe_line_offset;
start_addr = s->vbe_start_addr;
line_compare = 65535;
} else {
/* compute line_offset in bytes */
line_offset = s->cr[VGA_CRTC_OFFSET];
line_offset <<= 3;
/* starting address */
start_addr = s->cr[VGA_CRTC_START_LO] |
(s->cr[VGA_CRTC_START_HI] << 8);
/* line compare */
line_compare = s->cr[VGA_CRTC_LINE_COMPARE] |
((s->cr[VGA_CRTC_OVERFLOW] & 0x10) << 4) |
((s->cr[VGA_CRTC_MAX_SCAN] & 0x40) << 3);
}
*pline_offset = line_offset;
*pstart_addr = start_addr;
*pline_compare = line_compare;
}
/* update start_addr and line_offset. Return TRUE if modified */
static int update_basic_params(VGACommonState *s)
{
int full_update;
uint32_t start_addr, line_offset, line_compare;
full_update = 0;
s->get_offsets(s, &line_offset, &start_addr, &line_compare);
if (line_offset != s->line_offset ||
start_addr != s->start_addr ||
line_compare != s->line_compare) {
s->line_offset = line_offset;
s->start_addr = start_addr;
s->line_compare = line_compare;
full_update = 1;
}
return full_update;
}
static const uint8_t cursor_glyph[32 * 4] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};
static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight,
int *pcwidth, int *pcheight)
{
int width, cwidth, height, cheight;
/* total width & height */
cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;
cwidth = 8;
if (!(sr(s, VGA_SEQ_CLOCK_MODE) & VGA_SR01_CHAR_CLK_8DOTS)) {
cwidth = 9;
}
if (sr(s, VGA_SEQ_CLOCK_MODE) & 0x08) {
cwidth = 16; /* NOTE: no 18 pixel wide */
}
width = (s->cr[VGA_CRTC_H_DISP] + 1);
if (s->cr[VGA_CRTC_V_TOTAL] == 100) {
/* ugly hack for CGA 160x100x16 - explain me the logic */
height = 100;
} else {
height = s->cr[VGA_CRTC_V_DISP_END] |
((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |
((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);
height = (height + 1) / cheight;
}
*pwidth = width;
*pheight = height;
*pcwidth = cwidth;
*pcheight = cheight;
}
/*
* Text mode update
* Missing:
* - double scan
* - double width
* - underline
* - flashing
*/
static void vga_draw_text(VGACommonState *s, int full_update)
{
DisplaySurface *surface = qemu_console_surface(s->con);
int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr;
int cx_min, cx_max, linesize, x_incr, line, line1;
uint32_t offset, fgcol, bgcol, v, cursor_offset;
uint8_t *d1, *d, *src, *dest, *cursor_ptr;
const uint8_t *font_ptr, *font_base[2];
int dup9, line_offset;
uint32_t *palette;
uint32_t *ch_attr_ptr;
int64_t now = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL);
/* compute font data address (in plane 2) */
v = sr(s, VGA_SEQ_CHARACTER_MAP);
offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2;
if (offset != s->font_offsets[0]) {
s->font_offsets[0] = offset;
full_update = 1;
}
font_base[0] = s->vram_ptr + offset;
offset = (((v >> 5) & 1) | ((v >> 1) & 6)) * 8192 * 4 + 2;
font_base[1] = s->vram_ptr + offset;
if (offset != s->font_offsets[1]) {
s->font_offsets[1] = offset;
full_update = 1;
}
if (s->plane_updated & (1 << 2) || s->has_chain4_alias) {
/* if the plane 2 was modified since the last display, it
indicates the font may have been modified */
s->plane_updated = 0;
full_update = 1;
}
full_update |= update_basic_params(s);
line_offset = s->line_offset;
vga_get_text_resolution(s, &width, &height, &cw, &cheight);
if ((height * width) <= 1) {
/* better than nothing: exit if transient size is too small */
return;
}
if ((height * width) > CH_ATTR_SIZE) {
/* better than nothing: exit if transient size is too big */
return;
}
if (width != s->last_width || height != s->last_height ||
cw != s->last_cw || cheight != s->last_ch || s->last_depth) {
s->last_scr_width = width * cw;
s->last_scr_height = height * cheight;
qemu_console_resize(s->con, s->last_scr_width, s->last_scr_height);
surface = qemu_console_surface(s->con);
dpy_text_resize(s->con, width, height);
s->last_depth = 0;
s->last_width = width;
s->last_height = height;
s->last_ch = cheight;
s->last_cw = cw;
full_update = 1;
}
full_update |= update_palette16(s);
palette = s->last_palette;
x_incr = cw * surface_bytes_per_pixel(surface);
if (full_update) {
s->full_update_text = 1;
}
if (s->full_update_gfx) {
s->full_update_gfx = 0;
full_update |= 1;
}
cursor_offset = ((s->cr[VGA_CRTC_CURSOR_HI] << 8) |
s->cr[VGA_CRTC_CURSOR_LO]) - s->start_addr;
if (cursor_offset != s->cursor_offset ||
s->cr[VGA_CRTC_CURSOR_START] != s->cursor_start ||
s->cr[VGA_CRTC_CURSOR_END] != s->cursor_end) {
/* if the cursor position changed, we update the old and new
chars */
if (s->cursor_offset < CH_ATTR_SIZE)
s->last_ch_attr[s->cursor_offset] = -1;
if (cursor_offset < CH_ATTR_SIZE)
s->last_ch_attr[cursor_offset] = -1;
s->cursor_offset = cursor_offset;
s->cursor_start = s->cr[VGA_CRTC_CURSOR_START];
s->cursor_end = s->cr[VGA_CRTC_CURSOR_END];
}
cursor_ptr = s->vram_ptr + (s->start_addr + cursor_offset) * 4;
if (now >= s->cursor_blink_time) {
s->cursor_blink_time = now + VGA_TEXT_CURSOR_PERIOD_MS / 2;
s->cursor_visible_phase = !s->cursor_visible_phase;
}
dest = surface_data(surface);
linesize = surface_stride(surface);
ch_attr_ptr = s->last_ch_attr;
line = 0;
offset = s->start_addr * 4;
for(cy = 0; cy < height; cy++) {
d1 = dest;
src = s->vram_ptr + offset;
cx_min = width;
cx_max = -1;
for(cx = 0; cx < width; cx++) {
ch_attr = *(uint16_t *)src;
if (full_update || ch_attr != *ch_attr_ptr || src == cursor_ptr) {
if (cx < cx_min)
cx_min = cx;
if (cx > cx_max)
cx_max = cx;
*ch_attr_ptr = ch_attr;
#ifdef HOST_WORDS_BIGENDIAN
ch = ch_attr >> 8;
cattr = ch_attr & 0xff;
#else
ch = ch_attr & 0xff;
cattr = ch_attr >> 8;
#endif
font_ptr = font_base[(cattr >> 3) & 1];
font_ptr += 32 * 4 * ch;
bgcol = palette[cattr >> 4];
fgcol = palette[cattr & 0x0f];
if (cw == 16) {
vga_draw_glyph16(d1, linesize,
font_ptr, cheight, fgcol, bgcol);
} else if (cw != 9) {
vga_draw_glyph8(d1, linesize,
font_ptr, cheight, fgcol, bgcol);
} else {
dup9 = 0;
if (ch >= 0xb0 && ch <= 0xdf &&
(s->ar[VGA_ATC_MODE] & 0x04)) {
dup9 = 1;
}
vga_draw_glyph9(d1, linesize,
font_ptr, cheight, fgcol, bgcol, dup9);
}
if (src == cursor_ptr &&
!(s->cr[VGA_CRTC_CURSOR_START] & 0x20) &&
s->cursor_visible_phase) {
int line_start, line_last, h;
/* draw the cursor */
line_start = s->cr[VGA_CRTC_CURSOR_START] & 0x1f;
line_last = s->cr[VGA_CRTC_CURSOR_END] & 0x1f;
/* XXX: check that */
if (line_last > cheight - 1)
line_last = cheight - 1;
if (line_last >= line_start && line_start < cheight) {
h = line_last - line_start + 1;
d = d1 + linesize * line_start;
if (cw == 16) {
vga_draw_glyph16(d, linesize,
cursor_glyph, h, fgcol, bgcol);
} else if (cw != 9) {
vga_draw_glyph8(d, linesize,
cursor_glyph, h, fgcol, bgcol);
} else {
vga_draw_glyph9(d, linesize,
cursor_glyph, h, fgcol, bgcol, 1);
}
}
}
}
d1 += x_incr;
src += 4;
ch_attr_ptr++;
}
if (cx_max != -1) {
dpy_gfx_update(s->con, cx_min * cw, cy * cheight,
(cx_max - cx_min + 1) * cw, cheight);
}
dest += linesize * cheight;
line1 = line + cheight;
offset += line_offset;
if (line < s->line_compare && line1 >= s->line_compare) {
offset = 0;
}
line = line1;
}
}
enum {
VGA_DRAW_LINE2,
VGA_DRAW_LINE2D2,
VGA_DRAW_LINE4,
VGA_DRAW_LINE4D2,
VGA_DRAW_LINE8D2,
VGA_DRAW_LINE8,
VGA_DRAW_LINE15_LE,
VGA_DRAW_LINE16_LE,
VGA_DRAW_LINE24_LE,
VGA_DRAW_LINE32_LE,
VGA_DRAW_LINE15_BE,
VGA_DRAW_LINE16_BE,
VGA_DRAW_LINE24_BE,
VGA_DRAW_LINE32_BE,
VGA_DRAW_LINE_NB,
};
static vga_draw_line_func * const vga_draw_line_table[VGA_DRAW_LINE_NB] = {
vga_draw_line2,
vga_draw_line2d2,
vga_draw_line4,
vga_draw_line4d2,
vga_draw_line8d2,
vga_draw_line8,
vga_draw_line15_le,
vga_draw_line16_le,
vga_draw_line24_le,
vga_draw_line32_le,
vga_draw_line15_be,
vga_draw_line16_be,
vga_draw_line24_be,
vga_draw_line32_be,
};
static int vga_get_bpp(VGACommonState *s)
{
int ret;
if (vbe_enabled(s)) {
ret = s->vbe_regs[VBE_DISPI_INDEX_BPP];
} else {
ret = 0;
}
return ret;
}
static void vga_get_resolution(VGACommonState *s, int *pwidth, int *pheight)
{
int width, height;
if (vbe_enabled(s)) {
width = s->vbe_regs[VBE_DISPI_INDEX_XRES];
height = s->vbe_regs[VBE_DISPI_INDEX_YRES];
} else {
width = (s->cr[VGA_CRTC_H_DISP] + 1) * 8;
height = s->cr[VGA_CRTC_V_DISP_END] |
((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |
((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);
height = (height + 1);
}
*pwidth = width;
*pheight = height;
}
void vga_invalidate_scanlines(VGACommonState *s, int y1, int y2)
{
int y;
if (y1 >= VGA_MAX_HEIGHT)
return;
if (y2 >= VGA_MAX_HEIGHT)
y2 = VGA_MAX_HEIGHT;
for(y = y1; y < y2; y++) {
s->invalidated_y_table[y >> 5] |= 1 << (y & 0x1f);
}
}
static bool vga_scanline_invalidated(VGACommonState *s, int y)
{
if (y >= VGA_MAX_HEIGHT) {
return false;
}
return s->invalidated_y_table[y >> 5] & (1 << (y & 0x1f));
}
void vga_sync_dirty_bitmap(VGACommonState *s)
{
memory_region_sync_dirty_bitmap(&s->vram);
}
void vga_dirty_log_start(VGACommonState *s)
{
memory_region_set_log(&s->vram, true, DIRTY_MEMORY_VGA);
}
void vga_dirty_log_stop(VGACommonState *s)
{
memory_region_set_log(&s->vram, false, DIRTY_MEMORY_VGA);
}
/*
* graphic modes
*/
static void vga_draw_graphic(VGACommonState *s, int full_update)
{
DisplaySurface *surface = qemu_console_surface(s->con);
int y1, y, update, linesize, y_start, double_scan, mask, depth;
int width, height, shift_control, line_offset, bwidth, bits;
ram_addr_t page0, page1;
DirtyBitmapSnapshot *snap = NULL;
int disp_width, multi_scan, multi_run;
uint8_t *d;
uint32_t v, addr1, addr;
vga_draw_line_func *vga_draw_line = NULL;
bool share_surface;
pixman_format_code_t format;
#ifdef HOST_WORDS_BIGENDIAN
bool byteswap = !s->big_endian_fb;
#else
bool byteswap = s->big_endian_fb;
#endif
full_update |= update_basic_params(s);
s->get_resolution(s, &width, &height);
disp_width = width;
shift_control = (s->gr[VGA_GFX_MODE] >> 5) & 3;
double_scan = (s->cr[VGA_CRTC_MAX_SCAN] >> 7);
if (shift_control != 1) {
multi_scan = (((s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1) << double_scan)
- 1;
} else {
/* in CGA modes, multi_scan is ignored */
/* XXX: is it correct ? */
multi_scan = double_scan;
}
multi_run = multi_scan;
if (shift_control != s->shift_control ||
double_scan != s->double_scan) {
full_update = 1;
s->shift_control = shift_control;
s->double_scan = double_scan;
}
if (shift_control == 0) {
if (sr(s, VGA_SEQ_CLOCK_MODE) & 8) {
disp_width <<= 1;
}
} else if (shift_control == 1) {
if (sr(s, VGA_SEQ_CLOCK_MODE) & 8) {
disp_width <<= 1;
}
}
depth = s->get_bpp(s);
/*
* Check whether we can share the surface with the backend
* or whether we need a shadow surface. We share native
* endian surfaces for 15bpp and above and byteswapped
* surfaces for 24bpp and above.
*/
format = qemu_default_pixman_format(depth, !byteswap);
if (format) {
share_surface = dpy_gfx_check_format(s->con, format)
&& !s->force_shadow;
} else {
share_surface = false;
}
if (s->line_offset != s->last_line_offset ||
disp_width != s->last_width ||
height != s->last_height ||
s->last_depth != depth ||
s->last_byteswap != byteswap ||
share_surface != is_buffer_shared(surface)) {
if (share_surface) {
surface = qemu_create_displaysurface_from(disp_width,
height, format, s->line_offset,
s->vram_ptr + (s->start_addr * 4));
dpy_gfx_replace_surface(s->con, surface);
} else {
qemu_console_resize(s->con, disp_width, height);
surface = qemu_console_surface(s->con);
}
s->last_scr_width = disp_width;
s->last_scr_height = height;
s->last_width = disp_width;
s->last_height = height;
s->last_line_offset = s->line_offset;
s->last_depth = depth;
s->last_byteswap = byteswap;
full_update = 1;
} else if (is_buffer_shared(surface) &&
(full_update || surface_data(surface) != s->vram_ptr
+ (s->start_addr * 4))) {
pixman_format_code_t format =
qemu_default_pixman_format(depth, !byteswap);
surface = qemu_create_displaysurface_from(disp_width,
height, format, s->line_offset,
s->vram_ptr + (s->start_addr * 4));
dpy_gfx_replace_surface(s->con, surface);
}
if (shift_control == 0) {
full_update |= update_palette16(s);
if (sr(s, VGA_SEQ_CLOCK_MODE) & 8) {
v = VGA_DRAW_LINE4D2;
} else {
v = VGA_DRAW_LINE4;
}
bits = 4;
} else if (shift_control == 1) {
full_update |= update_palette16(s);
if (sr(s, VGA_SEQ_CLOCK_MODE) & 8) {
v = VGA_DRAW_LINE2D2;
} else {
v = VGA_DRAW_LINE2;
}
bits = 4;
} else {
switch(s->get_bpp(s)) {
default:
case 0:
full_update |= update_palette256(s);
v = VGA_DRAW_LINE8D2;
bits = 4;
break;
case 8:
full_update |= update_palette256(s);
v = VGA_DRAW_LINE8;
bits = 8;
break;
case 15:
v = s->big_endian_fb ? VGA_DRAW_LINE15_BE : VGA_DRAW_LINE15_LE;
bits = 16;
break;
case 16:
v = s->big_endian_fb ? VGA_DRAW_LINE16_BE : VGA_DRAW_LINE16_LE;
bits = 16;
break;
case 24:
v = s->big_endian_fb ? VGA_DRAW_LINE24_BE : VGA_DRAW_LINE24_LE;
bits = 24;
break;
case 32:
v = s->big_endian_fb ? VGA_DRAW_LINE32_BE : VGA_DRAW_LINE32_LE;
bits = 32;
break;
}
}
vga_draw_line = vga_draw_line_table[v];
if (!is_buffer_shared(surface) && s->cursor_invalidate) {
s->cursor_invalidate(s);
}
line_offset = s->line_offset;
#if 0
printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n",
width, height, v, line_offset, s->cr[9], s->cr[VGA_CRTC_MODE],
s->line_compare, sr(s, VGA_SEQ_CLOCK_MODE));
#endif
addr1 = (s->start_addr * 4);
bwidth = (width * bits + 7) / 8;
y_start = -1;
d = surface_data(surface);
linesize = surface_stride(surface);
y1 = 0;
if (!full_update) {
vga_sync_dirty_bitmap(s);
snap = memory_region_snapshot_and_clear_dirty(&s->vram, addr1,
line_offset * height,
DIRTY_MEMORY_VGA);
}
for(y = 0; y < height; y++) {
addr = addr1;
if (!(s->cr[VGA_CRTC_MODE] & 1)) {
int shift;
/* CGA compatibility handling */
shift = 14 + ((s->cr[VGA_CRTC_MODE] >> 6) & 1);
addr = (addr & ~(1 << shift)) | ((y1 & 1) << shift);
}
if (!(s->cr[VGA_CRTC_MODE] & 2)) {
addr = (addr & ~0x8000) | ((y1 & 2) << 14);
}
update = full_update;
page0 = addr;
page1 = addr + bwidth - 1;
if (full_update) {
update = 1;
} else {
update = memory_region_snapshot_get_dirty(&s->vram, snap,
page0, page1 - page0);
}
/* explicit invalidation for the hardware cursor (cirrus only) */
update |= vga_scanline_invalidated(s, y);
if (update) {
if (y_start < 0)
y_start = y;
if (!(is_buffer_shared(surface))) {
vga_draw_line(s, d, s->vram_ptr + addr, width);
if (s->cursor_draw_line)
s->cursor_draw_line(s, d, y);
}
} else {
if (y_start >= 0) {
/* flush to display */
dpy_gfx_update(s->con, 0, y_start,
disp_width, y - y_start);
y_start = -1;
}
}
if (!multi_run) {
mask = (s->cr[VGA_CRTC_MODE] & 3) ^ 3;
if ((y1 & mask) == mask)
addr1 += line_offset;
y1++;
multi_run = multi_scan;
} else {
multi_run--;
}
/* line compare acts on the displayed lines */
if (y == s->line_compare)
addr1 = 0;
d += linesize;
}
if (y_start >= 0) {
/* flush to display */
dpy_gfx_update(s->con, 0, y_start,
disp_width, y - y_start);
}
g_free(snap);
memset(s->invalidated_y_table, 0, sizeof(s->invalidated_y_table));
}
static void vga_draw_blank(VGACommonState *s, int full_update)
{
DisplaySurface *surface = qemu_console_surface(s->con);
int i, w;
uint8_t *d;
if (!full_update)
return;
if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
return;
w = s->last_scr_width * surface_bytes_per_pixel(surface);
d = surface_data(surface);
for(i = 0; i < s->last_scr_height; i++) {
memset(d, 0, w);
d += surface_stride(surface);
}
dpy_gfx_update(s->con, 0, 0,
s->last_scr_width, s->last_scr_height);
}
#define GMODE_TEXT 0
#define GMODE_GRAPH 1
#define GMODE_BLANK 2
static void vga_update_display(void *opaque)
{
VGACommonState *s = opaque;
DisplaySurface *surface = qemu_console_surface(s->con);
int full_update, graphic_mode;
qemu_flush_coalesced_mmio_buffer();
if (surface_bits_per_pixel(surface) == 0) {
/* nothing to do */
} else {
full_update = 0;
if (!(s->ar_index & 0x20)) {
graphic_mode = GMODE_BLANK;
} else {
graphic_mode = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE;
}
if (graphic_mode != s->graphic_mode) {
s->graphic_mode = graphic_mode;
s->cursor_blink_time = qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL);
full_update = 1;
}
switch(graphic_mode) {
case GMODE_TEXT:
vga_draw_text(s, full_update);
break;
case GMODE_GRAPH:
vga_draw_graphic(s, full_update);
break;
case GMODE_BLANK:
default:
vga_draw_blank(s, full_update);
break;
}
}
}
/* force a full display refresh */
static void vga_invalidate_display(void *opaque)
{
VGACommonState *s = opaque;
s->last_width = -1;
s->last_height = -1;
}
void vga_common_reset(VGACommonState *s)
{
s->sr_index = 0;
memset(s->sr, '\0', sizeof(s->sr));
memset(s->sr_vbe, '\0', sizeof(s->sr_vbe));
s->gr_index = 0;
memset(s->gr, '\0', sizeof(s->gr));
s->ar_index = 0;
memset(s->ar, '\0', sizeof(s->ar));
s->ar_flip_flop = 0;
s->cr_index = 0;
memset(s->cr, '\0', sizeof(s->cr));
s->msr = 0;
s->fcr = 0;
s->st00 = 0;
s->st01 = 0;
s->dac_state = 0;
s->dac_sub_index = 0;
s->dac_read_index = 0;
s->dac_write_index = 0;
memset(s->dac_cache, '\0', sizeof(s->dac_cache));
s->dac_8bit = 0;
memset(s->palette, '\0', sizeof(s->palette));
s->bank_offset = 0;
s->vbe_index = 0;
memset(s->vbe_regs, '\0', sizeof(s->vbe_regs));
s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID5;
s->vbe_start_addr = 0;
s->vbe_line_offset = 0;
s->vbe_bank_mask = (s->vram_size >> 16) - 1;
memset(s->font_offsets, '\0', sizeof(s->font_offsets));
s->graphic_mode = -1; /* force full update */
s->shift_control = 0;
s->double_scan = 0;
s->line_offset = 0;
s->line_compare = 0;
s->start_addr = 0;
s->plane_updated = 0;
s->last_cw = 0;
s->last_ch = 0;
s->last_width = 0;
s->last_height = 0;
s->last_scr_width = 0;
s->last_scr_height = 0;
s->cursor_start = 0;
s->cursor_end = 0;
s->cursor_offset = 0;
s->big_endian_fb = s->default_endian_fb;
memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table));
memset(s->last_palette, '\0', sizeof(s->last_palette));
memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr));
switch (vga_retrace_method) {
case VGA_RETRACE_DUMB:
break;
case VGA_RETRACE_PRECISE:
memset(&s->retrace_info, 0, sizeof (s->retrace_info));
break;
}
vga_update_memory_access(s);
}
static void vga_reset(void *opaque)
{
VGACommonState *s = opaque;
vga_common_reset(s);
}
#define TEXTMODE_X(x) ((x) % width)
#define TEXTMODE_Y(x) ((x) / width)
#define VMEM2CHTYPE(v) ((v & 0xff0007ff) | \
((v & 0x00000800) << 10) | ((v & 0x00007000) >> 1))
/* relay text rendering to the display driver
* instead of doing a full vga_update_display() */
static void vga_update_text(void *opaque, console_ch_t *chardata)
{
VGACommonState *s = opaque;
int graphic_mode, i, cursor_offset, cursor_visible;
int cw, cheight, width, height, size, c_min, c_max;
uint32_t *src;
console_ch_t *dst, val;
char msg_buffer[80];
int full_update = 0;
qemu_flush_coalesced_mmio_buffer();
if (!(s->ar_index & 0x20)) {
graphic_mode = GMODE_BLANK;
} else {
graphic_mode = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE;
}
if (graphic_mode != s->graphic_mode) {
s->graphic_mode = graphic_mode;
full_update = 1;
}
if (s->last_width == -1) {
s->last_width = 0;
full_update = 1;
}
switch (graphic_mode) {
case GMODE_TEXT:
/* TODO: update palette */
full_update |= update_basic_params(s);
/* total width & height */
cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;
cw = 8;
if (!(sr(s, VGA_SEQ_CLOCK_MODE) & VGA_SR01_CHAR_CLK_8DOTS)) {
cw = 9;
}
if (sr(s, VGA_SEQ_CLOCK_MODE) & 0x08) {
cw = 16; /* NOTE: no 18 pixel wide */
}
width = (s->cr[VGA_CRTC_H_DISP] + 1);
if (s->cr[VGA_CRTC_V_TOTAL] == 100) {
/* ugly hack for CGA 160x100x16 - explain me the logic */
height = 100;
} else {
height = s->cr[VGA_CRTC_V_DISP_END] |
((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |
((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);
height = (height + 1) / cheight;
}
size = (height * width);
if (size > CH_ATTR_SIZE) {
if (!full_update)
return;
snprintf(msg_buffer, sizeof(msg_buffer), "%i x %i Text mode",
width, height);
break;
}
if (width != s->last_width || height != s->last_height ||
cw != s->last_cw || cheight != s->last_ch) {
s->last_scr_width = width * cw;
s->last_scr_height = height * cheight;
qemu_console_resize(s->con, s->last_scr_width, s->last_scr_height);
dpy_text_resize(s->con, width, height);
s->last_depth = 0;
s->last_width = width;
s->last_height = height;
s->last_ch = cheight;
s->last_cw = cw;
full_update = 1;
}
if (full_update) {
s->full_update_gfx = 1;
}
if (s->full_update_text) {
s->full_update_text = 0;
full_update |= 1;
}
/* Update "hardware" cursor */
cursor_offset = ((s->cr[VGA_CRTC_CURSOR_HI] << 8) |
s->cr[VGA_CRTC_CURSOR_LO]) - s->start_addr;
if (cursor_offset != s->cursor_offset ||
s->cr[VGA_CRTC_CURSOR_START] != s->cursor_start ||
s->cr[VGA_CRTC_CURSOR_END] != s->cursor_end || full_update) {
cursor_visible = !(s->cr[VGA_CRTC_CURSOR_START] & 0x20);
if (cursor_visible && cursor_offset < size && cursor_offset >= 0)
dpy_text_cursor(s->con,
TEXTMODE_X(cursor_offset),
TEXTMODE_Y(cursor_offset));
else
dpy_text_cursor(s->con, -1, -1);
s->cursor_offset = cursor_offset;
s->cursor_start = s->cr[VGA_CRTC_CURSOR_START];
s->cursor_end = s->cr[VGA_CRTC_CURSOR_END];
}
src = (uint32_t *) s->vram_ptr + s->start_addr;
dst = chardata;
if (full_update) {
for (i = 0; i < size; src ++, dst ++, i ++)
console_write_ch(dst, VMEM2CHTYPE(le32_to_cpu(*src)));
dpy_text_update(s->con, 0, 0, width, height);
} else {
c_max = 0;
for (i = 0; i < size; src ++, dst ++, i ++) {
console_write_ch(&val, VMEM2CHTYPE(le32_to_cpu(*src)));
if (*dst != val) {
*dst = val;
c_max = i;
break;
}
}
c_min = i;
for (; i < size; src ++, dst ++, i ++) {
console_write_ch(&val, VMEM2CHTYPE(le32_to_cpu(*src)));
if (*dst != val) {
*dst = val;
c_max = i;
}
}
if (c_min <= c_max) {
i = TEXTMODE_Y(c_min);
dpy_text_update(s->con, 0, i, width, TEXTMODE_Y(c_max) - i + 1);
}
}
return;
case GMODE_GRAPH:
if (!full_update)
return;
s->get_resolution(s, &width, &height);
snprintf(msg_buffer, sizeof(msg_buffer), "%i x %i Graphic mode",
width, height);
break;
case GMODE_BLANK:
default:
if (!full_update)
return;
snprintf(msg_buffer, sizeof(msg_buffer), "VGA Blank mode");
break;
}
/* Display a message */
s->last_width = 60;
s->last_height = height = 3;
dpy_text_cursor(s->con, -1, -1);
dpy_text_resize(s->con, s->last_width, height);
for (dst = chardata, i = 0; i < s->last_width * height; i ++)
console_write_ch(dst ++, ' ');
size = strlen(msg_buffer);
width = (s->last_width - size) / 2;
dst = chardata + s->last_width + width;
for (i = 0; i < size; i ++)
console_write_ch(dst ++, ATTR2CHTYPE(msg_buffer[i], QEMU_COLOR_BLUE,
QEMU_COLOR_BLACK, 1));
dpy_text_update(s->con, 0, 0, s->last_width, height);
}
static uint64_t vga_mem_read(void *opaque, hwaddr addr,
unsigned size)
{
VGACommonState *s = opaque;
return vga_mem_readb(s, addr);
}
static void vga_mem_write(void *opaque, hwaddr addr,
uint64_t data, unsigned size)
{
VGACommonState *s = opaque;
vga_mem_writeb(s, addr, data);
}
const MemoryRegionOps vga_mem_ops = {
.read = vga_mem_read,
.write = vga_mem_write,
.endianness = DEVICE_LITTLE_ENDIAN,
.impl = {
.min_access_size = 1,
.max_access_size = 1,
},
};
static int vga_common_post_load(void *opaque, int version_id)
{
VGACommonState *s = opaque;
/* force refresh */
s->graphic_mode = -1;
vbe_update_vgaregs(s);
return 0;
}
static bool vga_endian_state_needed(void *opaque)
{
VGACommonState *s = opaque;
/*
* Only send the endian state if it's different from the
* default one, thus ensuring backward compatibility for
* migration of the common case
*/
return s->default_endian_fb != s->big_endian_fb;
}
static const VMStateDescription vmstate_vga_endian = {
.name = "vga.endian",
.version_id = 1,
.minimum_version_id = 1,
.needed = vga_endian_state_needed,
.fields = (VMStateField[]) {
VMSTATE_BOOL(big_endian_fb, VGACommonState),
VMSTATE_END_OF_LIST()
}
};
const VMStateDescription vmstate_vga_common = {
.name = "vga",
.version_id = 2,
.minimum_version_id = 2,
.post_load = vga_common_post_load,
.fields = (VMStateField[]) {
VMSTATE_UINT32(latch, VGACommonState),
VMSTATE_UINT8(sr_index, VGACommonState),
VMSTATE_PARTIAL_BUFFER(sr, VGACommonState, 8),
VMSTATE_UINT8(gr_index, VGACommonState),
VMSTATE_PARTIAL_BUFFER(gr, VGACommonState, 16),
VMSTATE_UINT8(ar_index, VGACommonState),
VMSTATE_BUFFER(ar, VGACommonState),
VMSTATE_INT32(ar_flip_flop, VGACommonState),
VMSTATE_UINT8(cr_index, VGACommonState),
VMSTATE_BUFFER(cr, VGACommonState),
VMSTATE_UINT8(msr, VGACommonState),
VMSTATE_UINT8(fcr, VGACommonState),
VMSTATE_UINT8(st00, VGACommonState),
VMSTATE_UINT8(st01, VGACommonState),
VMSTATE_UINT8(dac_state, VGACommonState),
VMSTATE_UINT8(dac_sub_index, VGACommonState),
VMSTATE_UINT8(dac_read_index, VGACommonState),
VMSTATE_UINT8(dac_write_index, VGACommonState),
VMSTATE_BUFFER(dac_cache, VGACommonState),
VMSTATE_BUFFER(palette, VGACommonState),
VMSTATE_INT32(bank_offset, VGACommonState),
VMSTATE_UINT8_EQUAL(is_vbe_vmstate, VGACommonState, NULL),
VMSTATE_UINT16(vbe_index, VGACommonState),
VMSTATE_UINT16_ARRAY(vbe_regs, VGACommonState, VBE_DISPI_INDEX_NB),
VMSTATE_UINT32(vbe_start_addr, VGACommonState),
VMSTATE_UINT32(vbe_line_offset, VGACommonState),
VMSTATE_UINT32(vbe_bank_mask, VGACommonState),
VMSTATE_END_OF_LIST()
},
.subsections = (const VMStateDescription*[]) {
&vmstate_vga_endian,
NULL
}
};
static const GraphicHwOps vga_ops = {
.invalidate = vga_invalidate_display,
.gfx_update = vga_update_display,
.text_update = vga_update_text,
};
static inline uint32_t uint_clamp(uint32_t val, uint32_t vmin, uint32_t vmax)
{
if (val < vmin) {
return vmin;
}
if (val > vmax) {
return vmax;
}
return val;
}
void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
{
int i, j, v, b;
for(i = 0;i < 256; i++) {
v = 0;
for(j = 0; j < 8; j++) {
v |= ((i >> j) & 1) << (j * 4);
}
expand4[i] = v;
v = 0;
for(j = 0; j < 4; j++) {
v |= ((i >> (2 * j)) & 3) << (j * 4);
}
expand2[i] = v;
}
for(i = 0; i < 16; i++) {
v = 0;
for(j = 0; j < 4; j++) {
b = ((i >> j) & 1);
v |= b << (2 * j);
v |= b << (2 * j + 1);
}
expand4to8[i] = v;
}
s->vram_size_mb = uint_clamp(s->vram_size_mb, 1, 512);
s->vram_size_mb = pow2ceil(s->vram_size_mb);
s->vram_size = s->vram_size_mb << 20;
if (!s->vbe_size) {
s->vbe_size = s->vram_size;
}
s->is_vbe_vmstate = 1;
memory_region_init_ram_nomigrate(&s->vram, obj, "vga.vram", s->vram_size,
&error_fatal);
vmstate_register_ram(&s->vram, global_vmstate ? NULL : DEVICE(obj));
xen_register_framebuffer(&s->vram);
s->vram_ptr = memory_region_get_ram_ptr(&s->vram);
s->get_bpp = vga_get_bpp;
s->get_offsets = vga_get_offsets;
s->get_resolution = vga_get_resolution;
s->hw_ops = &vga_ops;
switch (vga_retrace_method) {
case VGA_RETRACE_DUMB:
s->retrace = vga_dumb_retrace;
s->update_retrace_info = vga_dumb_update_retrace_info;
break;
case VGA_RETRACE_PRECISE:
s->retrace = vga_precise_retrace;
s->update_retrace_info = vga_precise_update_retrace_info;
break;
}
/*
* Set default fb endian based on target, could probably be turned
* into a device attribute set by the machine/platform to remove
* all target endian dependencies from this file.
*/
#ifdef TARGET_WORDS_BIGENDIAN
s->default_endian_fb = true;
#else
s->default_endian_fb = false;
#endif
vga_dirty_log_start(s);
}
static const MemoryRegionPortio vga_portio_list[] = {
{ 0x04, 2, 1, .read = vga_ioport_read, .write = vga_ioport_write }, /* 3b4 */
{ 0x0a, 1, 1, .read = vga_ioport_read, .write = vga_ioport_write }, /* 3ba */
{ 0x10, 16, 1, .read = vga_ioport_read, .write = vga_ioport_write }, /* 3c0 */
{ 0x24, 2, 1, .read = vga_ioport_read, .write = vga_ioport_write }, /* 3d4 */
{ 0x2a, 1, 1, .read = vga_ioport_read, .write = vga_ioport_write }, /* 3da */
PORTIO_END_OF_LIST(),
};
static const MemoryRegionPortio vbe_portio_list[] = {
{ 0, 1, 2, .read = vbe_ioport_read_index, .write = vbe_ioport_write_index },
# ifdef TARGET_I386
{ 1, 1, 2, .read = vbe_ioport_read_data, .write = vbe_ioport_write_data },
# endif
{ 2, 1, 2, .read = vbe_ioport_read_data, .write = vbe_ioport_write_data },
PORTIO_END_OF_LIST(),
};
/* Used by both ISA and PCI */
MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
const MemoryRegionPortio **vga_ports,
const MemoryRegionPortio **vbe_ports)
{
MemoryRegion *vga_mem;
*vga_ports = vga_portio_list;
*vbe_ports = vbe_portio_list;
vga_mem = g_malloc(sizeof(*vga_mem));
memory_region_init_io(vga_mem, obj, &vga_mem_ops, s,
"vga-lowmem", 0x20000);
memory_region_set_flush_coalesced(vga_mem);
return vga_mem;
}
void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
MemoryRegion *address_space_io, bool init_vga_ports)
{
MemoryRegion *vga_io_memory;
const MemoryRegionPortio *vga_ports, *vbe_ports;
qemu_register_reset(vga_reset, s);
s->bank_offset = 0;
s->legacy_address_space = address_space;
vga_io_memory = vga_init_io(s, obj, &vga_ports, &vbe_ports);
memory_region_add_subregion_overlap(address_space,
0x000a0000,
vga_io_memory,
1);
memory_region_set_coalescing(vga_io_memory);
if (init_vga_ports) {
portio_list_init(&s->vga_port_list, obj, vga_ports, s, "vga");
portio_list_set_flush_coalesced(&s->vga_port_list);
portio_list_add(&s->vga_port_list, address_space_io, 0x3b0);
}
if (vbe_ports) {
portio_list_init(&s->vbe_port_list, obj, vbe_ports, s, "vbe");
portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce);
}
}
void vga_init_vbe(VGACommonState *s, Object *obj, MemoryRegion *system_memory)
{
/* With pc-0.12 and below we map both the PCI BAR and the fixed VBE region,
* so use an alias to avoid double-mapping the same region.
*/
memory_region_init_alias(&s->vram_vbe, obj, "vram.vbe",
&s->vram, 0, memory_region_size(&s->vram));
/* XXX: use optimized standard vga accesses */
memory_region_add_subregion(system_memory,
VBE_DISPI_LFB_PHYSICAL_ADDRESS,
&s->vram_vbe);
s->vbe_mapped = 1;
}
|
786c7cd8f4394df3ccb148093af658abb900640c | d49239210e25ead28e05c6a751fd2a4b3fa3fa1c | /uTasker/GlobalTimer.c | 281c86326d7800804d8e0b454f7d5c20003a1edf | [] | no_license | uTasker/uTasker-Kinetis | 107ec50fc3a204da6b5f98cf034fe00d9cecfcd8 | 561d1ef7715367d3868719af6081635a1b44414d | refs/heads/master | 2022-12-03T00:30:43.124659 | 2022-11-28T00:47:45 | 2022-11-28T00:47:45 | 88,628,308 | 68 | 36 | null | 2022-02-17T19:47:11 | 2017-04-18T13:29:30 | C | ISO-8859-2 | C | false | false | 22,108 | c | GlobalTimer.c | /**********************************************************************
Mark Butcher Bsc (Hons) MPhil MIET
M.J.Butcher Consulting
Birchstrasse 20f, CH-5406, Rütihof
Switzerland
www.uTasker.com Skype: M_J_Butcher
---------------------------------------------------------------------
File: GlobalTimer.c
Project: Single Chip Embedded Internet
---------------------------------------------------------------------
Copyright (C) M.J.Butcher Consulting 2004..2016
*********************************************************************
This task is used as global system timer task to allow multiple timers
18.01.2007 Correct hardware timer check {1}
04.04.2007 Correct start of software timer when hardware time for the same task is active {2}
03.01.2008 Correct deleted software timer firing early {3}
05.03.2008 Add ability to kill all timers belonging to a certain task {4}
10.04.2008 Correct global HW monostable retrigger {5}
22.10.2010 Correct starting a new timer just before an existing fires {6}
17.01.2011 Ensure stTimer is zeroed at reset {7}
24.05.2011 Make use of the uTaskerRemainingTime() routine {8}
24.06.2011 Code optimisations {9}
24.06.2011 Replace CLOCK_LIMIT with DELAY_LIMIT {10}
*/
#include "config.h"
#if defined GLOBAL_TIMER_TASK // activate this define to support global timer task
/* =================================================================== */
/* local structure definitions */
/* =================================================================== */
typedef struct stTimerBlock
{
UTASK_TASK OwnerTask;
DELAY_LIMIT TimerDelay; // {10}
unsigned char ucEvent;
} TIMER_BLOCK;
/* =================================================================== */
/* local variable definitions */
/* =================================================================== */
static TIMER_BLOCK stTimer[TIMER_QUANTITY] = {{0}}; // {7}
//static UTASK_TICK TimeStamp; // {9}
static DELAY_LIMIT NextFire; // {10}
#if defined USE_TIMER_FUNCTION_EVENT
static void (*function_task)(unsigned char ucEvent) = 0;
#endif
/* =================================================================== */
/* local definitions */
/* =================================================================== */
#define OWN_TASK TASK_TIMER
#define E_TIMER_FIRED 1 // the event signaling that next timer has fired
/* =================================================================== */
/* local function prototype declarations */
/* =================================================================== */
static void fnSWTimerFired(void);
#if defined GLOBAL_HARDWARE_TIMER
static void fnHWTimerFired(void);
#endif
extern void fnTimer(TTASKTABLE *ptrTaskTable) // global Timer task
{
QUEUE_HANDLE PortIDInternal = ptrTaskTable->TaskID; // queue ID for task input
unsigned char ucInputMessage[HEADER_LENGTH]; // reserve space for receiving messages
while (fnRead( PortIDInternal, ucInputMessage, HEADER_LENGTH)) { // check input queue
switch (ucInputMessage[MSG_SOURCE_TASK]) {
case TIMER_EVENT:
fnSWTimerFired();
break;
#if defined GLOBAL_HARDWARE_TIMER
case INTERRUPT_EVENT:
fnHWTimerFired();
break;
#endif
}
}
}
static TIMER_BLOCK *fnGetFreeTimer(void)
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
while (iTimers++ < TIMER_QUANTITY) {
if (!ptrTim->OwnerTask) {
return ptrTim; // timer block is free
}
ptrTim++;
}
return 0; // no free timers...
}
static TIMER_BLOCK *fnGetNotTimer(TIMER_BLOCK *ptrNewTimer)
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
while (iTimers++ < TIMER_QUANTITY) {
#if defined GLOBAL_HARDWARE_TIMER // {2} - ignore hardware timers when checking for active software timers
if ((ptrTim->OwnerTask) && (!(ptrTim->OwnerTask & HARDWARE_TIMER)) && (ptrTim != ptrNewTimer)) return ptrTim;
#else
if ((ptrTim->OwnerTask) && (ptrTim != ptrNewTimer)) {
return ptrTim;
}
#endif
ptrTim++;
}
return 0; // no other active timers
}
static TIMER_BLOCK *fnGetOwnerTimer(UTASK_TASK Owner, unsigned char ucEvent)
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
#if defined GLOBAL_HARDWARE_TIMER
Owner &= ~HARDWARE_TIMER;
#endif
while (iTimers++ < TIMER_QUANTITY) {
if ((ptrTim->ucEvent == ucEvent) &&
#if defined GLOBAL_HARDWARE_TIMER
((UTASK_TASK)(ptrTim->OwnerTask & ~HARDWARE_TIMER) == Owner)
#else
(ptrTim->OwnerTask == Owner)
#endif
) {
return ptrTim;
}
ptrTim++;
}
return 0; // no owner found
}
static TIMER_BLOCK *fnGetSWFired(DELAY_LIMIT Time) // {10}
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
TIMER_BLOCK *ptrFired = 0;
while (iTimers < TIMER_QUANTITY) {
if (((ptrTim->OwnerTask) && (ptrTim->TimerDelay <= Time)) && ((!ptrFired) || (ptrTim->TimerDelay < ptrFired->TimerDelay))) {
ptrFired = ptrTim; // lowest value
}
ptrTim++;
iTimers++;
}
return ptrFired;
}
static void fnReduceSWTimers(TIMER_BLOCK *ptrNewTimer, DELAY_LIMIT TimerDelay) // {10}
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
if (TimerDelay == 0) { // {9}
return;
}
while (iTimers++ < TIMER_QUANTITY) {
if ((ptrTim->OwnerTask) && (ptrTim != ptrNewTimer)) {
ptrTim->TimerDelay -= TimerDelay;
}
ptrTim++;
}
}
#if defined GLOBAL_HARDWARE_TIMER
static TIMER_BLOCK *fnReduceHWTimers(DELAY_LIMIT TimerDelay) // {10}
{
TIMER_BLOCK *ptrTim = stTimer;
TIMER_BLOCK *ptrNextTim = 0;
int iTimers = 0;
DELAY_LIMIT NextDelay = (DELAY_LIMIT)(0 - 1); // {10}
while (iTimers++ < TIMER_QUANTITY) {
if (ptrTim->OwnerTask & HARDWARE_TIMER) {
ptrTim->TimerDelay -= TimerDelay;
if (ptrTim->TimerDelay <= NextDelay) {
NextDelay = ptrTim->TimerDelay; // lowest next delay found up to now
ptrNextTim = ptrTim; // timer to be set up next
}
}
ptrTim++;
}
return ptrNextTim;
}
// Check whether the reference will be the first to fire on its own or not
//
static int fnCheckHWFirst(TIMER_BLOCK *ptrCheckTimer) // {5}
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
while (iTimers++ < TIMER_QUANTITY) {
if (ptrTim->OwnerTask & HARDWARE_TIMER) { // active hardware timer
if (ptrTim->TimerDelay < ptrCheckTimer->TimerDelay) {
return 0; // another timer will fire earlier than reference one
}
if (ptrTim->TimerDelay == ptrCheckTimer->TimerDelay) { // lowest value found
if (ptrTim != ptrCheckTimer) { // ignore the timer being compared
return 0; // another will fire at same time as reference
}
}
}
ptrTim++;
}
return 1; // the reference will be next to fire and it will fire alone
}
// Start hardware timer or queue the new timer
//
static void fnSetNewHWTimer(TIMER_BLOCK *ptrNewTimer) // {5} stop and adjust if retriggering HW monostable timer which is next to fire on its own
{
DELAY_LIMIT adjusted; // {10}
uDisable_Interrupt();
if (fnCheckHWFirst(ptrNewTimer) != 0) { // if we are adjusting the active HW timer that would fire as next, and alone
DELAY_LIMIT TimerDelay = fnStopHW_Timer(); // {10} stop the timer and get remaining time
uEnable_Interrupt();
if (TimerDelay != 0) {
TIMER_BLOCK *ptrTim = stTimer;
int iTimers = 0;
while (iTimers++ < TIMER_QUANTITY) { // decrease hardware timer values
if (ptrTim->OwnerTask & HARDWARE_TIMER) {
ptrTim->TimerDelay -= TimerDelay;
}
ptrTim++;
}
ptrNewTimer->TimerDelay += TimerDelay; // correct for our timer
}
}
else {
uEnable_Interrupt();
}
adjusted = fnSetHardwareTimer(&ptrNewTimer->TimerDelay);
if (adjusted) {
fnReduceHWTimers(adjusted);
ptrNewTimer->TimerDelay += adjusted; // compensate adjustment for new timer itself
}
}
#endif
static void fnStartNewTimer(TIMER_BLOCK *ptrNewTimer)
{
#if defined GLOBAL_HARDWARE_TIMER
if (ptrNewTimer->OwnerTask & HARDWARE_TIMER) { // start a new hardware timer
fnSetNewHWTimer(ptrNewTimer); // start hardware timer or queue the new timer
return;
}
#endif
if (!fnGetNotTimer(ptrNewTimer)) { // start new mono-stable timer
uTaskerMonoTimer(OWN_TASK, (DELAY_LIMIT)ptrNewTimer->TimerDelay, E_TIMER_FIRED); // if no other timer active, simply start ours
NextFire = ptrNewTimer->TimerDelay; // the present delay
}
else { // if our delay is longer than the present delay we calculate delay difference
//UTASK_TICK RemainingTime = (TimeStamp + NextFire); // the time that the timer will fire
//if (RemainingTime >= uTaskerSystemTick) {
// RemainingTime -= uTaskerSystemTick;
//}
//else {
// RemainingTime = (uTaskerSystemTick - RemainingTime);
//}
UTASK_TICK RemainingTime; // {9}
uDisable_Interrupt(); // ensure that the tick can not increment while doing the following
RemainingTime = uTaskerRemainingTime(OWN_TASK); // {8} get the time remaining before the timer fires - if this is 0 it means that it has fired and is waiting to be handled
if (RemainingTime > ptrNewTimer->TimerDelay) { // the new timer value is shorter that the next firing time
//fnReduceSWTimers(ptrNewTimer, (unsigned char)(NextFire - (unsigned char)RemainingTime)); {6}
fnReduceSWTimers(ptrNewTimer, (DELAY_LIMIT)(NextFire - RemainingTime)); // {6}
uTaskerMonoTimer(OWN_TASK, (DELAY_LIMIT)ptrNewTimer->TimerDelay, E_TIMER_FIRED);
NextFire = ptrNewTimer->TimerDelay;
}
else { // {6} the next timer needs to fire either at the same time as the next firing time or later
ptrNewTimer->TimerDelay += (DELAY_LIMIT)(NextFire - RemainingTime); // {10} modify the delta
}
uEnable_Interrupt(); // leave critical code region
}
}
// Start/or retrigger a mono-stable timer for the defined event number belonging to the calling task
//
extern void uTaskerGlobalMonoTimer(UTASK_TASK OwnerTask, DELAY_LIMIT delay, unsigned char time_out_event) // {10}
{
TIMER_BLOCK *ptrTimer;
ptrTimer = fnGetOwnerTimer(OwnerTask, time_out_event); // get the timer block
if (ptrTimer) {
ptrTimer->TimerDelay = delay; // set new timeout (retrigger)
#if defined GLOBAL_HARDWARE_TIMER
if (ptrTimer->OwnerTask != OwnerTask) { // swapping from hardware to sw timer, or inverse is true
if ((OwnerTask & HARDWARE_TIMER) && (fnGetNotTimer(ptrTimer) == 0)) { // moving to hardware timer from last software timer
uTaskerStopTimer(OWN_TASK); // since there are no other timers being used, simply stop the monostable timer
}
ptrTimer->OwnerTask = OwnerTask; // set correct type
}
#endif
fnStartNewTimer(ptrTimer);
}
else {
ptrTimer = fnGetFreeTimer(); // define new timer
if (ptrTimer) {
ptrTimer->OwnerTask = OwnerTask; // enter timer details
ptrTimer->TimerDelay = delay;
ptrTimer->ucEvent = time_out_event;
fnStartNewTimer(ptrTimer); // start new timer delay
}
}
}
// Stop a mono-stable timer belonging to calling task, with defined event number
//
extern void uTaskerGlobalStopTimer(UTASK_TASK OwnerTask, unsigned char time_out_event)
{
TIMER_BLOCK *ptrTimer;
if (time_out_event == 0) { // {4} kill all timers belonging to the task
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
while (iTimers++ < TIMER_QUANTITY) { // search all timers belonging to the owner task
#if defined GLOBAL_HARDWARE_TIMER
if ((UTASK_TASK)(ptrTim->OwnerTask & ~HARDWARE_TIMER) == OwnerTask) // ignore hardware flag
#else
if (ptrTim->OwnerTask == OwnerTask)
#endif
{
if (ptrTim->ucEvent != 0) { // safety check before recursive call
uTaskerGlobalStopTimer(ptrTim->OwnerTask, ptrTim->ucEvent);
}
}
ptrTim++;
}
return;
}
ptrTimer = fnGetOwnerTimer(OwnerTask, time_out_event); // get the timer block
if (ptrTimer) {
#if defined GLOBAL_HARDWARE_TIMER
if (ptrTimer->OwnerTask & HARDWARE_TIMER) { // we need to stop a hardware timer
ptrTimer->OwnerTask = (UTASK_TASK)HARDWARE_TIMER; // we let the hardware timer continue since it is costing us nothing and will just be ignored when it fires
return;
}
#endif
ptrTimer->OwnerTask = 0;
if (!fnGetNotTimer(ptrTimer)) {
uTaskerStopTimer(OWN_TASK); // since there are no other timers being used, simply stop the monostable timer
}
}
}
// The global timer task's timer has fired
//
static void fnSWTimerFired(void)
{
TIMER_BLOCK dead_timer; // {3}
unsigned char ucMessage[ HEADER_LENGTH];
TIMER_BLOCK *ptrTimer;
TIMER_BLOCK *ptrRef = 0;
DELAY_LIMIT FiredTime = (DELAY_LIMIT)(0 - 1); // {10}
#if defined USE_TIMER_FUNCTION_EVENT
unsigned char ucEvents[TIMER_QUANTITY];
int iEvents = 0;
#endif
ucMessage[MSG_DESTINATION_NODE] = INTERNAL_ROUTE; // internal message
ucMessage[MSG_SOURCE_NODE] = INTERNAL_ROUTE;
ucMessage[MSG_SOURCE_TASK] = TIMER_EVENT; // a timer event
while ((ptrTimer = fnGetSWFired(FiredTime)) != 0) { // handle multiple timers which may have fired at the same time
if (NextFire < ptrTimer->TimerDelay) { // {3} if the timer fired before expected it is due to a deleted timer whose monostable timer could not be stopped. In this case we must not generate an event.
dead_timer.TimerDelay = NextFire; // set the killed timer time
ptrRef = &dead_timer;
break;
}
#if defined USE_TIMER_FUNCTION_EVENT
if (FUNCTION_EVENT == (unsigned char)ptrTimer->OwnerTask) { // if defined as function event
ucEvents[iEvents++] = ptrTimer->ucEvent; // collect function events
FiredTime = ptrTimer->TimerDelay;
ptrTimer->OwnerTask = 0; // clear timer block since event has been sent
ptrRef = ptrTimer;
continue;
}
#endif
ucMessage[MSG_DESTINATION_TASK] = ptrTimer->OwnerTask; // destination task
ucMessage[MSG_TIMER_EVENT] = ptrTimer->ucEvent; // action
FiredTime = ptrTimer->TimerDelay;
ptrTimer->OwnerTask = 0; // clear timer block since event has been sent
fnWrite(INTERNAL_ROUTE, ucMessage, HEADER_LENGTH); // send timer event to defined task
ptrRef = ptrTimer;
}
if (ptrRef) {
fnReduceSWTimers(ptrRef, ptrRef->TimerDelay);
}
if ((ptrTimer = fnGetSWFired((DELAY_LIMIT)(0 - 1))) != 0) { // {10} if there are still timers, set next timeout
uTaskerMonoTimer(OWN_TASK, (DELAY_LIMIT)ptrTimer->TimerDelay, E_TIMER_FIRED);
NextFire = ptrTimer->TimerDelay;
}
#if defined USE_TIMER_FUNCTION_EVENT
if (iEvents && (function_task != 0)) { // if we have collected function events
int iEventRep = 0;
do {
(*function_task)(ucEvents[iEventRep++]); // call function task with each event
} while (iEventRep < iEvents);
}
#endif
}
#if defined GLOBAL_HARDWARE_TIMER
static TIMER_BLOCK *fnGetHWFired(void)
{
int iTimers = 0;
TIMER_BLOCK *ptrTim = stTimer;
TIMER_BLOCK *ptrFired = 0;
DELAY_LIMIT FiredTime = (DELAY_LIMIT)(0 - 1); // {10}
while (iTimers++ < TIMER_QUANTITY) {
if (ptrTim->OwnerTask & HARDWARE_TIMER) { // active hardware timer
if (ptrTim->TimerDelay <= FiredTime) { // lowest value found
FiredTime = ptrTim->TimerDelay; // new lowest value
ptrFired = ptrTim; // lowest timer
}
}
ptrTim++;
}
return ptrFired;
}
static void fnHWTimerFired(void)
{
unsigned char ucMessage[ HEADER_LENGTH];
TIMER_BLOCK *ptrTimer;
#if defined USE_TIMER_FUNCTION_EVENT
unsigned char ucEvents[TIMER_QUANTITY];
int iEvents = 0;
#endif
ucMessage[MSG_DESTINATION_NODE] = 0; // internal message
ucMessage[MSG_SOURCE_NODE] = 0;
ucMessage[MSG_SOURCE_TASK] = TIMER_EVENT; // a timer event
while ((ptrTimer = fnGetHWFired()) != 0) { // handle multiple timers which may have fired at the same time
#if defined USE_TIMER_FUNCTION_EVENT
if ((FUNCTION_EVENT | HARDWARE_TIMER) == (unsigned char)ptrTimer->OwnerTask) { // if defined as function event
ucEvents[iEvents++] = ptrTimer->ucEvent; // collect function events
}
else {
#endif
ucMessage[MSG_DESTINATION_TASK] = (ptrTimer->OwnerTask & ~HARDWARE_TIMER);// destination task
ucMessage[MSG_TIMER_EVENT] = ptrTimer->ucEvent; // action
if (ucMessage[ MSG_DESTINATION_TASK ] != 0) {
fnWrite(INTERNAL_ROUTE, ucMessage, HEADER_LENGTH); // send timer event to defined task
}
#if defined USE_TIMER_FUNCTION_EVENT
}
#endif
ptrTimer->OwnerTask = 0; // clear timer block since event has been sent
ptrTimer = fnReduceHWTimers(ptrTimer->TimerDelay); // get next timer, if available
if (ptrTimer) { // if there are still timers, set next timeout
if (ptrTimer->TimerDelay == 0) { // further timer(s) with identical timeout
continue;
}
fnSetNewHWTimer(ptrTimer); // start hardware timer or queue the new timer
break;
}
}
#if defined USE_TIMER_FUNCTION_EVENT
if (iEvents && (function_task != 0)) { // if we have collected function events
do {
(*function_task)(ucEvents[--iEvents]); // call function task with each event
} while (iEvents);
}
#endif
}
#endif
#if defined USE_TIMER_FUNCTION_EVENT
void fnSetFuncTask(void (*function)(unsigned char ucEvent)) {
function_task = function;
}
#endif
#endif
|
e549aef019275397c7d109da0ec30e4cde3f58cf | 4cc3671dfd39d695f40835a368d79af6d6a28672 | /SNES_nokia_test/SNES_nokia_test/main.c | 27b30f7f032697f3b81ded726619b13438f8d4b7 | [] | no_license | spure02/Snake-Game | 6086ffd56e4e414a77d95f89ff8b9f49561373bc | 010878011308920881d5a2b7090b6619a2890b7d | refs/heads/master | 2022-11-23T02:04:09.192821 | 2020-07-20T06:17:30 | 2020-07-20T06:17:30 | 194,920,444 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,557 | c | main.c | /*
* SNES_nokia_test.c
*
* Created: 5/23/2019 10:14:12 AM
* Author : Simran
*/
#include <avr/io.h>
#include <util/delay.h>
#include "SNES.c"
#include "nokia5110.c"
#include "timer.h"
#include "scheduler.h"
enum SNES_States { SNES_LISTEN } SNES_State ;
unsigned short button;
void SNES_Process() {
if(button) {
if((button & 16) == 16) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("R",1);
nokia_lcd_render();
} //R button
if((button & 32) == 32) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("L",1);
nokia_lcd_render();
} //L button
if((button & 64) == 64) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("X",1);
nokia_lcd_render();
} //X button
if((button & 128) == 128) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("A",1);
nokia_lcd_render();
} //A button
if((button & 256) == 256) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Right",1);
nokia_lcd_render();
} //Right D-pad
if((button & 512) == 512) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Left",1);
nokia_lcd_render();
} //Left D-pad
if((button & 1024) == 1024) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Down",1);
nokia_lcd_render();
} //Down D-pad
if((button & 2048) == 2048) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Up",1);
nokia_lcd_render();
} //Up D-pad
if((button & 4096) == 4096) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Start",1);
nokia_lcd_render();
} //Start button
if((button & 8192) == 8192) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Select",1);
nokia_lcd_render();
} //Select button
if((button & 16384) == 16384) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Y",1);
nokia_lcd_render();
} //Y button
if((button & 32768) == 32768) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("B",1);
nokia_lcd_render();
} //B button
}//if button
}//SNES_Process
int SNES_Input(int state) {
switch(state) {
case SNES_LISTEN:
button = SNES_Read();
SNES_Process();
break;
default:
state = SNES_LISTEN;
break;
}//switch state
return state;
}//SNES_Input
int main(void) {
DDRA = 0x03; PORTA = 0x00; //input
//DDRB = 0xFF; PORTB = 0x00; //output
//unsigned short button = 0x0000;
static task task_SNES;
task *tasks[] = {&task_SNES};
const unsigned short numTasks = sizeof(tasks)/sizeof(task);
unsigned long period_SNES = 100;
task_SNES.state = -1;
task_SNES.period = period_SNES;
task_SNES.elapsedTime = period_SNES;
task_SNES.TickFct = &SNES_Input;
TimerSet(1);
TimerOn();
TimerFlag = 0;
nokia_lcd_init();
SNES_init();
unsigned short i = 0;
while (1) {
SNES_State = SNES_Input(SNES_State);
// Scheduler code
for ( i = 0; i < numTasks; i++ ) {
// Task is ready to tick
if ( tasks[i]->elapsedTime == tasks[i]->period ) {
// Setting next state for task
tasks[i]->state = tasks[i]->TickFct(tasks[i]->state);
// Reset the elapsed time for next tick.
tasks[i]->elapsedTime = 0;
}//if
tasks[i]->elapsedTime += 1;
}//for
while(!TimerFlag);
TimerFlag = 0;
/*
button = (SNES_Read());
if((button & 16) == 16) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("R",1);
nokia_lcd_render();
} //R button
if((button & 32) == 32) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("L",1);
nokia_lcd_render();
} //L button
if((button & 64) == 64) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("X",1);
nokia_lcd_render();
} //X button
if((button & 128) == 128) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("A",1);
nokia_lcd_render();
} //A button
if((button & 256) == 256) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Right",1);
nokia_lcd_render();
} //Right D-pad
if((button & 512) == 512) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Left",1);
nokia_lcd_render();
} //Left D-pad
if((button & 1024) == 1024) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Down",1);
nokia_lcd_render();
} //Down D-pad
if((button & 2048) == 2048) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Up",1);
nokia_lcd_render();
} //Up D-pad
if((button & 4096) == 4096) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Start",1);
nokia_lcd_render();
} //Start button
if((button & 8192) == 8192) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Select",1);
nokia_lcd_render();
} //Select button
if((button & 16384) == 16384) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("Y",1);
nokia_lcd_render();
} //Y button
if((button & 32768) == 32768) {
nokia_lcd_clear();
nokia_lcd_set_cursor(0, 10);
nokia_lcd_write_string("B",1);
nokia_lcd_render();
} //B button
*/
_delay_ms(1000);
}//while 1
}//main
|
9edab4928c08e98a26cc674de154c8b0bb45e3a5 | b984f55f1b43b5ea88832c72adf6e0dedd8f7581 | /sq_srcs/sq_rdfile_save_tetri.c | b7c50972d1db8e756fa627eaf184fbbcbe7d862d | [] | no_license | camelchch/fillet | 239af4cb14594d380d4fe60f5da5f1f423c90946 | f12aa0e6e8998b411ba9318da9cab4a6bbee5045 | refs/heads/master | 2021-08-17T07:32:01.450146 | 2017-11-20T23:07:37 | 2017-11-20T23:07:37 | 110,858,241 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,074 | c | sq_rdfile_save_tetri.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sq_rdfile_save_tetri.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: saxiao <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/17 09:03:21 by saxiao #+# #+# */
/* Updated: 2017/11/20 12:20:07 by saxiao ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <string.h>
#include "../includes/libft/libft.h"
#include "sq_fillit.h"
void ft_exit(char const *s)
{
ft_putendl(s);
exit(1);
}
unsigned short tetri_value(char *s, int len)
{
unsigned short value;
int i;
value = 0;
i = 0;
while (len - 2 > 0 )
{
if ((len -1) % 5)
{
if (s[len - 2] == '#')
value = value | (1 << i);
i++;
}
len--;
}
return (value);
}
void only_dot_hash(char *s, int len)
{
int hash_count;
int index;
hash_count = 0;
index = 0;
while (index < len)
{
if ((!((index + 1) % 5) || index == len -1))
{
if (s[index] && s[index]!= '\n')
ft_exit("error");
}
else
{
if (s[index] != '.' && s[index] != '#')
ft_exit("error");
if (s[index] == '#')
hash_count++;
}
index++;
}
if (hash_count != 4)
ft_exit("error");
}
void valid_tetri(unsigned short value)
{
int touch_count;
int i;
touch_count = 0;
i = 15;
while (i >= 1)
{
if (value & (1 << i))
{
if((i - 4 >= 0) && (value & (1 << (i - 4))))
touch_count++;
if (i % 4 && (value & (1 << (i - 1))))
touch_count++;
}
i--;
}
if (touch_count != 3 && touch_count != 4)
ft_exit("error");
}
void mv_left_top_calcu(tetri_list *list)
{
int length;
int height;
length = 0;
height = 0;
while((0x7777 | list->tetri_value) == 0x7777)
{
list->tetri_value = list->tetri_value << 1;
length++;
}
while((0X0FFF | list->tetri_value) == 0x0FFF)
{
list->tetri_value = list->tetri_value << 4;
height++;
}
list->length = 4 - length;
list->height = 4 - height;
}
tetri_list *add_tetri(unsigned short value, int nb, tetri_list *old_list)
{
tetri_list *list;
tetri_list *temp;
if(!(list = (tetri_list *)malloc(sizeof(*list))))
return (NULL);
list->tetri_value = value;
list->letter = 'A' + nb;
list->length = 0;
list->height = 0;
list->next = NULL;
mv_left_top_calcu(list);
if(!old_list)
old_list = list;
else
{
temp = old_list;
while (temp->next)
temp = temp->next;
temp->next = list;
}
return (old_list);
}
tetri_list *ft_readfile(char const *file_name)
{
char *buff;
int fd;
unsigned short value_tetri;
int nb_tetri;
tetri_list *list;
nb_tetri = 0;
list = NULL;
fd = open(file_name, O_RDONLY);
if(fd == -1)
ft_exit("error");
if(!(buff = (char *)malloc(BUFF_SIZE)))
return (NULL);
while (read(fd, buff, BUFF_SIZE))
{
if (nb_tetri > 25)
ft_exit("maxi tetri is 26");
only_dot_hash(buff,BUFF_SIZE);
value_tetri = tetri_value(buff, BUFF_SIZE);
valid_tetri(value_tetri);
list = add_tetri(value_tetri, nb_tetri, list);
nb_tetri++;
ft_bzero(buff, BUFF_SIZE);
}
return (list);
}
/*
int main(void)
{
char *s="....\n...#\n..##\n...#\n\n";
only_dot_hash(s, 21);
unsigned short t = tetri_value(s, 21);
valid_tetri(t);
int i = 15;
while (i >= 0)
{
if (t & ( 1 << i))
printf("1");
else
printf("0");
i--;
}
printf("\n");
t = mv_left_top(t);
i = 15;
while (i >= 0)
{
if (t & ( 1 << i))
printf("1");
else
printf("0");
i--;
}
}
*/
|
a6b74f1101b838b198480e150800f81bec5be2bc | d3a661a5975a01379e4230b774f1e154b091aad1 | /arduino/libraries/fin/fin.h | 81b63d9bc873e81c5bd0efdb63162ed6a1f462c5 | [
"BSD-3-Clause"
] | permissive | jgoppert/aae497-f19 | e0e7f956deae262e6e14da1a34830df56bd31bdf | 3942e8f543b80cc76da2bc756d6d5f6feda0901e | refs/heads/master | 2021-07-16T21:25:00.083356 | 2019-12-13T23:02:07 | 2019-12-13T23:02:07 | 203,658,288 | 4 | 17 | BSD-3-Clause | 2019-12-14T03:50:05 | 2019-08-21T20:19:57 | Jupyter Notebook | UTF-8 | C | false | false | 1,045 | h | fin.h | /* This file was automatically generated by CasADi.
The CasADi copyright holders make no ownership claim of its contents. */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef casadi_real
#define casadi_real double
#endif
#ifndef casadi_int
#define casadi_int long long int
#endif
#include <casadi/mem.h>
int fins(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem);
int fins_alloc_mem(void);
int fins_init_mem(int mem);
void fins_free_mem(int mem);
int fins_checkout(void);
void fins_release(int mem);
void fins_incref(void);
void fins_decref(void);
casadi_int fins_n_out(void);
casadi_int fins_n_in(void);
casadi_real fins_default_in(casadi_int i);
const char* fins_name_in(casadi_int i);
const char* fins_name_out(casadi_int i);
const casadi_int* fins_sparsity_in(casadi_int i);
const casadi_int* fins_sparsity_out(casadi_int i);
int fins_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w);
casadi_functions* fins_functions(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
|
a7e940332772e900c6e7b5d6b1f130ebbfa58110 | c1c9d793b53c3667e857996a92888889af15dfcc | /solidic/ota.c | 0418571f066921e7419b8a7bd5ad2df544675b9f | [] | no_license | T0213-ZH/fandiuqi | a1b3d1825686e4ac4ffb18139914c942115eef6a | 45d4670f91fe03892c3f10778958e8b122488c8d | refs/heads/master | 2020-04-02T10:51:03.498563 | 2018-10-23T16:03:15 | 2018-10-23T16:03:15 | 154,358,006 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 8,195 | c | ota.c | #include "ota.h"
#include "stdlib.h"
#include "crc16.h"
#include "flash_interface.h"
extern unsigned char GAPRole_TerminateConnection(void);
#define SDI_OTA_flash_write(addr, len, buf) writeFlash(addr, buf, len)
#define SDI_OTA_flash_read(addr, len, buf) readFlash(addr, buf, len)
#define SDI_OTA_flash_erase(addr) eraseFlash((addr) >> 12)
extern void SDI_system_reset(void);
#define SDI_OTA_REBOOT() SDI_system_reset()
extern unsigned char GAPRole_TerminateConnection(void);
#define SDI_OTA_DISCONN() GAPRole_TerminateConnection()
extern unsigned char sdiProfile_SetParameter( unsigned char param, unsigned char len, void *value );
#define SDI_ota_send_data_to_app(buf, len) sdiProfile_SetParameter(0, len, buf)
/**
* @name OTA命令ID、OTA完成或失败返回值
* @{
*/
#define SDI_OTA_CMD_FW_VERSION (0xFFFF) ///< 获取固件版本
#define SDI_OTA_CMD_START_REQ (0xFF03) ///< 请求更新连接参数
#define SDI_OTA_CMD_START (0xFF01) ///< 开始发送OTA有交效数据包
#define SDI_OTA_CMD_END (0xFF02) ///< OTA升级完成
#define BT_OTA_SUCCESS (0x00) ///< 升级完成
#define BT_OTA_ERR_WRITE_FLASH (0x01) ///< 写flash错误
#define BT_OTA_ERR_CRC (0x02) ///< crc较验错误
#define BT_OTA_ERR_LOSS_PACKET (0x03) ///< 丢数据包错误
/** @} */
/**
* @brief OTA 数据存储地址
*/
struct ota_update_addr{
unsigned int store_new_firmware; ///< 存储新固件地址
unsigned int store_complete_flag; ///< 存储更新完成标志
};
struct ota_update_addr g_ota_update_addr = {0}; ///< OTA 更新数据地址
/**
* @brief OTA命令及数据包格式
*/
struct ota_data_format{
// union{
unsigned short cmd; ///< 命令ID
// unsigned short index; ///< 数据包序号
// };
unsigned char buf[16]; ///< 有效数据
unsigned short crc; ///< CRC效验值
};
/**
* @name OTA固件存储地址、存储完成标志地址
* @{
*/
/*(0x20000)*/ /*(0x73000)*/
#define SDI_OTA_FRIMWARE_ADDR (g_ota_update_addr.store_new_firmware) ///<更新固件存储起始位置
#define SDI_OTA_FLG_ADR (g_ota_update_addr.store_complete_flag) ///<存储更新固件完成的标志
#define SDI_OTA_FRIMWARE_ADDR_OFFSET(addr) (SDI_OTA_FRIMWARE_ADDR + addr) ///<固件更新偏移地址
/** @} */
/**
* @brief ota控制
*/
struct ota_ctr{
enum ota_state state; ///< ota 当前状态
int index; ///< ota 升级固件数据包序号
unsigned long times; ///< ota 升级过程中时间计数
};
/** ota 控制变量 */
struct ota_ctr g_ota_ctr;
static void SDI_OTA_reset_ctr_arg(void){
g_ota_ctr.state = SDI_OTA_IDLE;
g_ota_ctr.index = -1;
g_ota_ctr.times = 0;
}
/**
* @brief 获取系统运行时间
*/
extern unsigned long SDI_BLE_GetCurTimes(void);
/**
* @brief 初始化OTA 数据更新地址
* @param new_firmware_addr 存储新固件地址
* @param update_complete_flag_addr 存储更新完成标志位地址
*/
void SDI_OTA_init(unsigned int new_firmware_addr, unsigned int update_complete_flag_addr){
g_ota_update_addr.store_new_firmware = new_firmware_addr;
g_ota_update_addr.store_complete_flag = update_complete_flag_addr;
SDI_OTA_reset_ctr_arg();
}
/**
* @brief OTA升级过程中应答数据
* @param id OTA命令ID
* @param len 数据长度
* @param state 应答数据内容
**/
//void SDI_OTA_response(unsigned short id, unsigned int len, unsigned char *ptr){
// unsigned char buf[16] = {0};
// unsigned char index = 0;
// buf[index++] = (id >> 8) & 0xFF;
// buf[index++] = (id >> 0) & 0xFF;
// for(; len; len--)
// buf[index++] = *ptr++;
// ///SDI_APP_protocol_send(PROTOCOL_EVENT, SL_CMD_OTA_RSP, index, buf);
//}
void SDI_OTA_response(unsigned short id, unsigned int len, unsigned char data){
unsigned char buf[16] = {0};
unsigned char index = 0;
unsigned short crc = 0;
buf[index++] = 0x4D;
buf[index++] = 0x50;
buf[index++] = 0xEE;
buf[index++] = 0x01;
buf[index++] = data;
crc = CRC16_count(&buf[2], 3);
buf[index++] = (crc >> 0) & 0xFF;
buf[index++] = (crc >> 8) & 0xFF;
SDI_ota_send_data_to_app(buf, index);
}
/**
* @brief 写数据到flash指定地址
* @param addr 指定数据区域
* @param *ptr 指向数据buf
* @return 0:写数据成功, 1:写数据失败
**/
static unsigned char SDI_OTA_write_frimware(unsigned int addr ,unsigned char* ptr){
unsigned char flash_check[16];
SDI_OTA_flash_write(SDI_OTA_FRIMWARE_ADDR_OFFSET(addr), 16, ptr);
SDI_OTA_flash_read(SDI_OTA_FRIMWARE_ADDR_OFFSET(addr), 16, flash_check);
if(!__memcmp(flash_check, ptr, 16)){
return 0;
}
return 1;
}
/**
* @brief 擦除指定flash里面数据
* @param index 指定数据区域
**/
static void SDI_OTA_erase_frimware(int index){
int i;
for(i=0; i<index; i+=256){
SDI_OTA_flash_erase(SDI_OTA_FRIMWARE_ADDR_OFFSET(1 << 4));
}
}
/**
* @brief 获取ota当前状态
* @return g_ota_ctr.state 当前状态
**/
unsigned char SDI_OTA_GetStatus(void){
return g_ota_ctr.state;
}
/**
* @brief OTA接收数据包处理
* @param *ptr 指向数据包指针
* @param len 数据包长度
**/
//void SDI_OTA_FlashTest(void);
extern void SDI_ota_updata_conn_parameter(void);
void SDI_OTA_rcceive_data(unsigned char* ptr, unsigned char len){
struct ota_data_format packet = {0};
unsigned char result = BT_OTA_SUCCESS;
__memcpy(&packet, ptr, len);
if(SDI_OTA_CMD_FW_VERSION == packet.cmd){
//SDI_OTA_response(SDI_OTA_CMD_FW_VERSION, __strlen(SMARTLOCK_VER), SMARTLOCK_VER);
}else if((SDI_OTA_CMD_START_REQ == packet.cmd) && (SDI_OTA_IDLE == g_ota_ctr.state)){
g_ota_ctr.state = SDI_OTA_UPDATE_CONN_PARAM;
SDI_OTA_response(SDI_OTA_CMD_START_REQ, 1, 0x03);
g_ota_ctr.times = SDI_BLE_GetCurTimes() + 4;
// SDI_OTA_FlashTest();
SDI_ota_updata_conn_parameter();
}else if((SDI_OTA_CMD_START == packet.cmd) && (SDI_OTA_UPDATE_CONN_PARAM == g_ota_ctr.state)){
g_ota_ctr.state = SDI_OTA_START_STATE;
g_ota_ctr.index = -1;
SDI_OTA_response(SDI_OTA_CMD_START, 1, 0x01);
// 留2秒时间等待下一个数据包
g_ota_ctr.times = SDI_BLE_GetCurTimes() + 4;
}else if((SDI_OTA_CMD_END == packet.cmd) && (SDI_OTA_START_STATE == g_ota_ctr.state)){
g_ota_ctr.state = SDI_OTA_END_STATE;
SDI_OTA_response(SDI_OTA_CMD_END, 1, 0x02);
// 留2秒时间等待应答数据发送完成
g_ota_ctr.times = SDI_BLE_GetCurTimes() + 4;
}else if(SDI_OTA_START_STATE == g_ota_ctr.state){
unsigned short ota_addr = packet.cmd;
if((g_ota_ctr.index + 1) == ota_addr){
if(packet.crc == CRC16_count((void *)&packet, 18)){
if(SDI_OTA_write_frimware((ota_addr << 4), packet.buf)){
result = BT_OTA_ERR_WRITE_FLASH;
}else{
g_ota_ctr.index = ota_addr;
}
}else{
result = BT_OTA_ERR_CRC;
}
}else if(g_ota_ctr.index > ota_addr){
}else{
result = BT_OTA_ERR_LOSS_PACKET;
}
if(result){
g_ota_ctr.state = SDI_OTA_WRITE_ERROR_STATE;
SDI_OTA_response(SDI_OTA_CMD_START, 1, 0xA0 | result);
}
// 留2秒时间等待下一个数据包
g_ota_ctr.times = SDI_BLE_GetCurTimes() + 2;
}
}
/**
* @brief OTA完成后重启
*/
static void SDI_OTA_reboot(void){
unsigned int flag = 165;
SDI_OTA_reset_ctr_arg();
SDI_OTA_flash_erase(SDI_OTA_FLG_ADR);
SDI_OTA_flash_write(SDI_OTA_FLG_ADR, sizeof(unsigned int), (void *)&flag);
SDI_OTA_REBOOT();
}
/**
* @brief OTA超时处理
*/
void SDI_OTA_timeout(void){
SDI_OTA_DISCONN();
if(g_ota_ctr.index >= 0){
SDI_OTA_erase_frimware(g_ota_ctr.index);
}
SDI_OTA_reset_ctr_arg();
}
/**
* @brief OTA升级成功后重启或者超时处理
* @param[in] times 当前时间
**/
unsigned char SDI_OTA_Process(unsigned long times){
if((g_ota_ctr.times == times) && (g_ota_ctr.times != 0)){
g_ota_ctr.times = 0;
if(SDI_OTA_END_STATE == g_ota_ctr.state){
SDI_OTA_reboot();
}else{
SDI_OTA_timeout();
}
}
return g_ota_ctr.state;
}
//void SDI_OTA_FlashTest(void){
// unsigned char buf[] = "0123456789ABCDEF";
// unsigned char buf1[] = "FFFFFFFFFFFFFFFF";
// if(!SDI_OTA_write_frimware(0, buf)){
// SDI_ota_send_data_to_app("123456", 6);
// SDI_OTA_write_frimware(0, buf1);
// }else{
// SDI_ota_send_data_to_app("abcdef", 6);
// }
//}
|
5b98472a28e4a522b59361fcd31bd4f55cffcae4 | ab75f3b0a167cdc9f9a474edd5ca443fffce92bc | /hw_1702-1706/10511.c | e1a299dc6c3ccc8a38924f4ba33fad9e9f1cdd70 | [] | no_license | alter027/cp | ee4439b4e4d1c041a1d40ff751455024b07e41fb | 1211f44496c09b4dac7ce63ba6fb245589e1ea45 | refs/heads/master | 2020-03-28T21:45:10.983371 | 2019-02-18T02:32:07 | 2019-02-18T02:32:07 | 94,857,703 | 3 | 1 | null | null | null | null | UTF-8 | C | false | false | 359 | c | 10511.c | #include<stdio.h>
int main(void){
int n,m,i,f[5],check,count;
while(scanf("%d",&n)!=EOF&&n!=0){
int v[5]={0};
check=1;count=0;
for(i=0;i<n;i++){
scanf("%d",&f[i]);
if(f[i]==i+1)
v[i]=1;
}
for(i=0;i<n;i++){
if(v[f[i]-1]==0){
check=0;
break;
}
}
if(check==1)
printf("yes\n");
else
printf("no\n");
}
return 0;
}
|
272cea87a651850af77037b5fc077398ec7e00f4 | 3282b56a5e821e248cd40b8621f1af22662626ab | /motor.h | df2f35e4c96168b8256d3ee67fad8dc097ab89f6 | [] | no_license | EthanWong2212/2271MINI-proj | 0d5858c67b821d87e4fe87798826928dfd733d5e | ccc555dfbc74b06d88ee22a42e90827e0c3a5755 | refs/heads/master | 2023-01-15T17:40:27.950696 | 2020-11-19T05:51:05 | 2020-11-19T05:51:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 590 | h | motor.h | #ifndef MOTORS_H_
#define MOTORS_H_
#define PTD0_Pin 0 //Left forward
#define PTD1_Pin 1 //Left reverse
#define PTD2_Pin 2 //Right forward
#define PTD3_Pin 3 //Right reverse
#define ROBOT_FORWARD 1 //0001
#define ROBOT_BACKWARD 2 //0010
#define ROBOT_LEFT 4 //0100
#define ROBOT_RIGHT 8 //1000
#define ROBOT_STOP 0 //0000
#define FORWARD_LEFT 5 //0101
#define FORWARD_RIGHT 9 //1001
#define REVERSE_LEFT 6 //0110
#define REVERSE_RIGHT 10 //1010
//Duty cycle
#define FAST 100
#define MEDIUM 75
#define SLOW 40
int PWM(int);
void move(int);
void InitMotor(void);
#endif
|
b4c0badc35f1ee66f59e27ec837aa303d2b36293 | 12cae7118f71c8053172e542f3dacebb595a9110 | /benchmarks/ptaben-path-insensitive/basic_c_tests/struct-twoflds.c | 5ad6081092a266d83b57213f02a62037805b2794 | [
"Apache-2.0"
] | permissive | dloghin/discover | 621e513a5777c0b2ee656d30f1095dcb3c2661aa | ea948e7a37380fcaa8c4ce3d9fd90746657dcbe4 | refs/heads/master | 2023-09-03T08:01:36.210764 | 2021-10-06T17:32:04 | 2021-10-06T17:32:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 759 | c | struct-twoflds.c | /*
* Struct with multiple fields.
* Author: Sen Ye
* Date: 28/04/2014
*
* Migrated to Discover: Ta Quang Trung
* Date: June 06, 2020
*/
#include <stdio.h>
#include <stdlib.h>
#include <discover.h>
struct IntChar {
int f1;
char f2;
};
struct CharInt {
char f1;
int f2;
};
int main() {
struct IntChar* pint1, *pint2;
struct IntChar s;
pint1 = &s;
pint2 = &s;
__assert_must_alias(&pint1->f1, &pint2->f1);
__assert_must_alias(&pint1->f2, &pint2->f2);
__assert_no_alias(&pint1->f1, &pint2->f2);
struct CharInt* qint1, *qint2;
struct CharInt t;
qint1 = &t;
qint2 = &t;
__assert_must_alias(&qint1->f1, &qint2->f1);
__assert_must_alias(&qint1->f2, &qint2->f2);
__assert_no_alias(&qint1->f1, &qint2->f2);
return 0;
}
|
5e094dee8a7be7babd64bcb48784825400f1cc15 | 41e61d0d33639a255d8980ca28629a6d404b4632 | /0x00-math_complex/7-division.c | 8b84c3cf707b3289ff2e313a732f66509765c649 | [] | no_license | dkb4rb/holbertonschool-math | 4ab2633ba881b36a3d04b5da14a3097000647878 | eecf13c894d5ff876a1a9a7dc501fe0bd29aa5db | refs/heads/main | 2023-06-26T07:19:19.982114 | 2021-08-02T07:09:01 | 2021-08-02T07:09:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 448 | c | 7-division.c | #include "holberton.h"
#include <math.h>
/**
* division - perform the division operation to complex numbers
* @c1: first complex number
* @c2: second complex number
* @c3: quotient of complex numbers
* Return: void
*/
void division(complex c1, complex c2, complex *c3)
{
c3->re = ((c1.re * c2.re) + (c1.im * c2.im)) / (pow(c2.re, 2) + pow(c2.im, 2));
c3->im = ((c1.im * c2.re) - (c1.re * c2.im)) / (pow(c2.re, 2) + pow(c2.im, 2));
} |
86ad693b74a0dfb81cbd06feac8ca06247a58bca | f7a4e2b350b0ed7901682a13e42995773e41fb92 | /ceng334/p2.c | e2824237d4d2b50bb52adc9a88ec1ec691de4465 | [] | no_license | yalpul/ceng | b670547d07fa4869b6711c88d4907267ec5fc687 | 86269f8eda8c9f45b70ffb4b4684df7637045575 | refs/heads/master | 2021-07-09T07:25:53.855170 | 2020-07-25T19:47:26 | 2020-07-25T19:47:26 | 157,917,310 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 337 | c | p2.c | #include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main()
{
int fd = shm_open("test", O_CREAT | O_RDWR, 0666);
ftruncate(fd, 4096);
char * ptr = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
strcpy(ptr, "denem1234");
int a;
scanf("%d", &a);
return 0;
}
|
fb84a7a283a4285bfbee1e80437bb9665c76647a | a8573d29d5556439a67a9be825f6faa5af2f6224 | /8_AbstractFactory/Include/Factory.h | f59e80726b39b49af69c6af84f5d22af6ab5e8a3 | [] | no_license | H-Yano/c_gof_design_pattern | 39a21f5782743e55601cf773c02fa9ddf31e99ea | 70959937e625c2613a97acbfe0b6a15e4193ff24 | refs/heads/master | 2023-03-19T01:27:46.348647 | 2019-05-20T08:47:25 | 2019-05-20T08:47:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 916 | h | Factory.h | /*
* Factory.h
*
* Created on: 2019/05/10
* Author: Yuk
*/
#ifndef FACTORY_H_
#define FACTORY_H_
#include <Soup.h>
#include <Protein.h>
#include <Vegetable.h>
#include <Ingredient.h>
#define VEGETABLE_SIZE 10
#define INGREDIENT_SIZE 10
typedef struct FactoryStruct Factory;
extern Soup *Factory_createSoup(Factory *factory);
extern void Factory_destroySoup(Factory *factory, Soup *soup);
extern Protein *Factory_createMain(Factory *factory);
extern void Factory_destroyMain(Factory *factory, Protein *main);
extern Vegetable **Factory_createVegetables(Factory *factory);
extern void Factory_destroyVegetables(Factory *factory, Vegetable **vegetables);
extern Ingredient **Factory_createOtherIngredients(Factory *factory);
extern void Factory_destroyOtherIngredients(Factory *factory, Ingredient **ings);
#endif /* FACTORY_H_ */
|
7fa68c00ad71a9cd1a86e62b90b7419121beb2e1 | 12e5d0ba603db924dcf16b64c1ee5c9a78a27f86 | /test/read_mpich.c | 3765f41799d42f1d421497ee7406d1280112366a | [
"LicenseRef-scancode-other-permissive",
"mpich2"
] | permissive | codes-org/dumpi-cortex | 7fe82927107c76d6e0e77f4c1519fc69cc4c8a5e | d619150833e4d1fe865e5b7241efa6358f4771fb | refs/heads/master | 2023-04-19T20:08:50.391068 | 2019-05-16T20:12:15 | 2019-05-16T20:12:15 | 364,360,949 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,358 | c | read_mpich.c | #include <cortex/cortex.h>
#include <cortex/cortex-mpich.h>
#include <string.h>
static int handleDUMPIInit(const dumpi_init *prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Init called\n");
return 0;
}
static int handleDUMPISendrecv(const dumpi_sendrecv* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Sendrecv called with src=%d and dst=%d\n",prm->source,prm->dest);
return 0;
}
static int handleDUMPISend(const dumpi_send* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
printf("MPI_Send called with dst=%d\n",prm->dest);
return 0;
}
static int handleDUMPIRecv(const dumpi_recv* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
printf("MPI_Recv called with src=%d\n",prm->source);
return 0;
}
static int handleDUMPIBcast(const dumpi_bcast* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
printf("MPI_Bcast called with root=%d\n",prm->root);
return 0;
}
static int handleDUMPIBarrier(const dumpi_barrier* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Barrier called\n");
return 0;
}
static int handleDUMPIReduce(const dumpi_reduce* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Reduce called\n");
return 0;
}
static int handleDUMPIAllReduce(const dumpi_allreduce* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Allreduce called\n");
return 0;
}
static int handleDUMPIAllgather(const dumpi_allgather* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Allgather called\n");
return 0;
}
static int handleDUMPIAllgatherv(const dumpi_allgatherv* prm, uint16_t thread,
const dumpi_time *cpu, const dumpi_time *wall,
const dumpi_perfinfo *perf, void *uarg) {
//printf("MPI_Allgatherv called\n");
return 0;
}
int main(int argc, char** argv) {
if(argc != 3) {
printf("Usage: %s dumpifile.bin world_size\n", argv[0]);
exit(-1);
}
const char* filename = argv[1];
int world_size = atoi(argv[2]);
cortex_dumpi_profile* profile = cortex_undumpi_open(filename,12345,world_size,0);
if(!profile) {
fprintf(stderr,"Unable to open file %s\n",filename);
exit(-1);
}
libundumpi_callbacks cbacks;
memset(&cbacks,0,sizeof(cbacks));
cbacks.on_init = handleDUMPIInit;
cbacks.on_sendrecv = handleDUMPISendrecv;
cbacks.on_barrier = handleDUMPIBarrier;
cbacks.on_send = handleDUMPISend;
cbacks.on_recv = handleDUMPIRecv;
cbacks.on_bcast = handleDUMPIBcast;
cbacks.on_reduce = handleDUMPIReduce;
cbacks.on_allreduce = handleDUMPIAllReduce;
cbacks.on_allgather = handleDUMPIAllgather;
cbacks.on_allgatherv = handleDUMPIAllgatherv;
cortex_dumpi_start_stream_read(profile);
cortex_undumpi_read_stream(profile, &cbacks, CORTEX_MPICH_TRANSLATION, NULL);
cortex_undumpi_close(profile);
return 0;
}
|
338f8ccb0f8af91202bc7dfbe25fe9d5010172e9 | 437a65e090f201e75e9b8962d064d52c4bbd53d1 | /Source_Code/Test Case/Sod Shock Tube (without AMR)/run.C | fb9e1542a2d8e172014b16768e31b77f19936446 | [] | no_license | SulemanMahmood/PlasmaCombustion | 8033d33cafa5634a024227ffed041ca0a3b6c734 | 8e5fd1ef5f61f18a5800bf087768c163a231d713 | refs/heads/master | 2021-05-01T21:38:19.356499 | 2016-12-18T23:18:41 | 2016-12-18T23:18:41 | 70,857,633 | 0 | 3 | null | null | null | null | UTF-8 | C | false | false | 9,301 | c | run.C | #include "run.h"
Main::Main(CkArgMsg* msg){
int dimX=100;
int dimY=100;
int dimZ=100;
delete msg;
mainProxy = thisProxy;
cellProxy = CProxy_Cell::ckNew(dimX,dimY,dimZ);
interfaceProxy = CProxy_intFlux::ckNew(3, dimX+1, dimY, dimZ);
fluxProxy = CProxy_Flux::ckNew(dimX,dimY,dimZ);
cellProxy.run();
fluxProxy.run_flux();
interfaceProxy.run_interface();
}
void Main::done(){
CkExit();
}
Cell::Cell(){
__sdag_init();
initialize();
}
Cell::Cell(CkMigrateMessage* m) {}
void Cell::initialize(){
for (int i = 0; i < numdiv; i ++){
for (int j = 0; j < numdiv; j++){
for (int k = 0; k < numdiv; k++){
a[i][j][k].u = 0.0;
a[i][j][k].v = 0.0;
a[i][j][k].w = 0.0;
a[i][j][k].E = gam*P[i][j][k]/a[i][j][k].r;
if (thisIndex.x < N_DIM/2){
P[i][j][k] = 1.0;
a[i][j][k].r = 1.0;
}
else{
P[i][j][k] = 0.1;
a[i][j][k].r = 0.125;
}
}
}
}
}
void Cell::calcvar3D(flow3D v_n, flow3D v_o, flow3D fl){
for (int i = 0; i < ndiv; i++){
for(int j = 0; j < ndiv; j++){
for(int k = 0; k < ndiv; k++){
v_n[i][j][k] = v_o[i][j][k] - local_dt * fl[i][j][k] / local_L;
}
}
}
}
void Cell::gaslaw(flow3D a){
for (int x = 0; x < numdiv; x++){
for (int y = 0; y < numdiv; y++){
for (int z = 0; z < numdiv; z++){
P[x][y][z] = (gam-1)*a[x][y][z].r*(a[x][y][z].E - 0.5*(a[x][y][z].u*a[x][y][z].u + a[x][y][z].v*a[x][y][z].v + a[x][y][z].w*a[x][y][z].w));
}
}
}
}
void Cell::WriteOutput(){
char filename[100];
sprintf(filename,"CellOutput_%d_%d_%d_%d",thisIndex.x, thisIndex.y, thisIndex.z, iter );
FILE* OutFile = fopen(filename, "w");
for (int i = 0; i < val.size(); i++){
for (int j = 0; j < val[i].size(); j++){
for (int k = 0; k < val[i][j].size(); k++){
fprintf(OutFile, "val[%d,%d,%d]:%lf %lf %lf %lf %lf Y[", i, j , k, val[i][j][k].r , val[i][j][k].u , val[i][j][k].v , val[i][j][k].w , val[i][j][k].E);
int ySize = val[i][j][k].Y.size();
for (int x = 0; x < ySize; x++ ){
fprintf(OutFile, "%lf",val[i][j][k].Y[x]);
if (x == (ySize - 1)){ // its the last iteration
fprintf(OutFile, "]\n");
}
else{ // put a , if it isn't last
fprintf(OutFile, ",");
}
}
}
}
}
}
Flux::Flux(){
__sdag_init();
}
Flux::Flux(CkMigrateMessage* m) {}
void Flux::inviscidFlux(flow3D fl[], flow3D a){
double r_l, r_r, r_h, P_l, P_r, g_mix_r, g_mix_l, C_p;
flow a_l, a_r;
double c_l, c_r, c_h, chi, g, g_HR, nx, ny, nz;
double u_r, u_l, v_r, v_l, w_l, w_r, V, V_l, V_r;
double M, M_L, M_R, f_L, f_R;
double d_p, p, M_c, V_n, V_np, V_nn, m_dot;
for(int n = 0; n < 3; n++){
for (int i = 1; i < numdiv; i++){
for (int j = 0; j < numdiv; j++){
for (int k = 0; k < numdiv; k++){
a_r = a[i][j][k];
r_r = a_r.r;
P_r = P[i][j][k];
u_r = a_r.u/r_r;
v_r = a_r.v/r_r;
w_r = a_r.w/r_r;
if (n == 0){
a_l = a[i-1][j][k];
r_l = a_l.r;
P_l = P[i-1][j][k];
u_l = a_l.u/r_l;
v_l = a_l.v/r_l;
w_l = a_l.w/r_l;
nx = 1.0;
ny = 0.0;
nz = 0.0;
}
else if (n == 1){
a_l = a[k][i-1][j];
r_l = a_l.r;
P_l = P[k][i-1][j];
u_l = a_l.u/r_l;
v_l = a_l.v/r_l;
w_l = a_l.w/r_l;
nx = 0.0;
ny = 1.0;
nz = 0.0;
}
else {
a_l = a[j][k][i-1];
r_l = a_l.r;
P_l = P[j][k][i-1];
u_l = a_l.u/r_l;
v_l = a_l.v/r_l;
w_l = a_l.w/r_l;
nx = 0.0;
ny = 0.0;
nz = 1.0;
}
r_h = (r_l + r_r)/2.0;
c_l = sqrt(gam*P_l/r_l);
c_r = sqrt(gam*P_r/r_r);
c_h = (c_l + c_r)/2.0;
V = sqrt((u_l*u_l + v_l*v_l + w_l*w_l + u_r*u_r + v_r*v_r + w_r*w_r)/2.0);
V_l = u_l*nx + v_l*ny + w_l*nz;
V_r = u_r*nx + v_r*ny + w_r*nz;
M = V_l/c_h;
M_L = V_l/c_l;
M_R = V_r/c_r;
if (M >= 1.0){
f_L = 1.0;
f_R = 0.0;
}
else if (M <= -1.0){
f_L = 0.0;
f_R = 1.0;
}
else{
f_L = (M + 1.0)*(M + 1.0)*(2.0 - M)/4.0;
f_R = (M - 1.0)*(M - 1.0)*(2.0 + M)/4.0;
}
//g_HR = fmin(0.2,g_w);
g_HR = 0.2;
d_p = P_l - P_r;
p = (P_l + P_r + (f_L - f_R)*d_p)/2.0 + g_HR*(f_L + f_R - 1.0)*r_h*c_h*V;
M_c = fmin(1.0,V/c_h);
chi = (1.0 - M_c)*(1.0 - M_c);
g = 0.0 - fmax(fmin(M_L,0.0),-1.0)*fmin(fmax(M_R,0.0),1.0);
V_n = (r_l*fabs(V_l) + r_r*fabs(V_r))/(r_l + r_r);
V_np = (1.0 - g)*V_n + g*fabs(V_l);
V_nn = (1.0 - g)*V_n + g*fabs(V_r);
m_dot = 0.5*(r_l*(V_l + V_np) + r_r*(V_r - V_nn) - chi/c_h*d_p);
// Flux calculation
if (m_dot >= 0){
fl[n][i][j][k] = (m_dot/r_l)*a_l;
fl[n][i][j][k].u += P_l*nx;
fl[n][i][j][k].v += P_l*ny;
fl[n][i][j][k].w += P_l*nz;
fl[n][i][j][k].E += P_l/r_l*m_dot;
}
else{
fl[n][i][j][k] = m_dot*a_r;
fl[n][i][j][k].r /= r_r;
fl[n][i][j][k].u += P_r*nx;
fl[n][i][j][k].v += P_r*ny;
fl[n][i][j][k].w += P_r*nz;
fl[n][i][j][k].E += P_r/r_r*m_dot;
}
}
}
}
}
}
void Flux::fluxFacetoCell(){
for (int i = 0; i < numdiv; i++){
for (int j = 0; j < numdiv; j++){
for (int k = 0; k < numdiv; k++){
flux_c[i][j][k] = flux_f[0][i+1][j][k] - flux_f[0][i][j][k] + flux_f[1][j][k][i] - flux_f[1][j+1][i][k] + flux_f[2][k][i][j] - flux_f[2][k+1][i][j];
}
}
}
}
intFlux::intFlux(){
__sdag_init();
}
intFlux::intFlux(CkMigrateMessage* m) {}
void intFlux::wall(){
for (int i = 0; i < numdiv; i++){
for (int j = 0; j < numdiv; j++){
fl[i][j] = 0.0;
}
}
}
void intFlux::inviscidFlux(){
double r_l, r_r, r_h, P_l, P_r, g_mix_r, g_mix_l, C_p;
//flow a_l, a_r;
double c_l, c_r, c_h, chi, g, g_HR, nx, ny, nz;
double u_r, u_l, v_r, v_l, w_l, w_r, V, V_l, V_r;
double M, M_L, M_R, f_L, f_R;
double d_p, p, M_c, V_n, V_np, V_nn, m_dot;
//for(int n = 0; n < 3; n++){
for (int i = 0; i < numdiv; i++){
for (int j = 0; j < numdiv; j++){
//for (int k = 0; k < numdiv; k++){
u_r = a_r.u/r_r;
v_r = a_r.v/r_r;
w_r = a_r.w/r_r;
/*if (n == 0){
a_l = a[i-1][j];
r_l = a_l.r;
P_l = P[i-1][j];*/
u_l = a_l.u/r_l;
v_l = a_l.v/r_l;
w_l = a_l.w/r_l;
if (thisIndex.u == 0)
nx = 1.0;
ny = 0.0;
nz = 0.0;
}
else if (thisIndex.u == 1){
/* a_l = a[k][i-1][j];
r_l = a_l.r;
P_l = P[k][i-1][j];
u_l = a_l.u/r_l;
v_l = a_l.v/r_l;
w_l = a_l.w/r_l;*/
nx = 0.0;
ny = 1.0;
nz = 0.0;
}
else {
/*a_l = a[j][k][i-1];
r_l = a_l.r;
P_l = P[j][k][i-1];
u_l = a_l.u/r_l;
v_l = a_l.v/r_l;
w_l = a_l.w/r_l;*/
nx = 0.0;
ny = 0.0;
nz = 1.0;
}
r_h = (r_l + r_r)/2.0;
c_l = sqrt(gam*P_l/r_l);
c_r = sqrt(gam*P_r/r_r);
c_h = (c_l + c_r)/2.0;
V = sqrt((u_l*u_l + v_l*v_l + w_l*w_l + u_r*u_r + v_r*v_r + w_r*w_r)/2.0);
V_l = u_l*nx + v_l*ny + w_l*nz;
V_r = u_r*nx + v_r*ny + w_r*nz;
M = V_l/c_h;
M_L = V_l/c_l;
M_R = V_r/c_r;
if (M >= 1.0){
f_L = 1.0;
f_R = 0.0;
}
else if (M <= -1.0){
f_L = 0.0;
f_R = 1.0;
}
else{
f_L = (M + 1.0)*(M + 1.0)*(2.0 - M)/4.0;
f_R = (M - 1.0)*(M - 1.0)*(2.0 + M)/4.0;
}
//g_w =
//g_HR = fmin(0.2,g_w);
g_HR = 0.2;
d_p = P_l - P_r;
p = (P_l + P_r + (f_L - f_R)*d_p)/2.0 + g_HR*(f_L + f_R - 1.0)*r_h*c_h*V;
M_c = fmin(1.0,V/c_h);
chi = (1.0 - M_c)*(1.0 - M_c);
g = 0.0 - fmax(fmin(M_L,0.0),-1.0)*fmin(fmax(M_R,0.0),1.0);
V_n = (r_l*fabs(V_l) + r_r*fabs(V_r))/(r_l + r_r);
V_np = (1.0 - g)*V_n + g*fabs(V_l);
V_nn = (1.0 - g)*V_n + g*fabs(V_r);
m_dot = 0.5*(r_l*(V_l + V_np) + r_r*(V_r - V_nn) - chi/c_h*d_p);
// Flux calculation
if (m_dot >= 0){
fl[i][j] = (m_dot/r_l)*a_l;
fl[i][j].u += P_l*nx;
fl[i][j].v += P_l*ny;
fl[i][j].w += P_l*nz;
fl[i][j].E += P_l/r_l*m_dot;
}
else{
fl[i][j] = m_dot*a_r;
fl[i][j].r /= r_r;
fl[i][j].u += P_r*nx;
fl[i][j].v += P_r*ny;
fl[i][j].w += P_r*nz;
fl[i][j].E += P_r/r_r*m_dot;
}
//}
}
}
//}
//}
#include"main.def.h"
|
86f2b5b28b7780bfe1c46a5c6fbc9bd016b3f1bc | 4cf3ee2c90e6ad1cea9cdba1b1e76224eee2ac4d | /apps/plugins/puzzles/help/singles.c | 3f4ecd157bbea099e464b78ddbfbed7516a4d666 | [] | no_license | Rockbox/rockbox | 36f73fc2660f3edb32dc07db26c5f9b88851975f | 67c4231e34cd8147963a054c44a715f3413fb2e3 | refs/heads/master | 2021-09-15T22:10:00.710240 | 2021-08-29T12:19:02 | 2021-09-12T17:35:35 | 3,184,247 | 394 | 157 | null | 2021-09-05T11:00:28 | 2012-01-15T15:37:35 | C | UTF-8 | C | false | false | 6,969 | c | singles.c | /* auto-generated on Dec 7 2020 by genhelp.sh */
/* help text is compressed using LZ4; see compress.c for details */
/* DO NOT EDIT! */
#include "lib/display_text.h"
struct style_text help_text_style[] = {
{ 0, TEXT_CENTER | C_RED },
{ 122, TEXT_CENTER | C_RED },
{ 212, TEXT_CENTER | C_RED },
{ 229, TEXT_UNDERLINE },
{ 230, TEXT_UNDERLINE },
{ 240, TEXT_UNDERLINE },
LAST_STYLE_ITEM
};
/* orig 1392 comp 1052 ratio 0.755747 level 10 saved 340 */
const char help_text[] = {
0xf3, 0x2d, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x20,
0x33, 0x32, 0x3a, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
0x73, 0x20, 0x00, 0x00, 0x00, 0x59, 0x6f, 0x75, 0x00, 0x68,
0x61, 0x76, 0x65, 0x00, 0x61, 0x00, 0x67, 0x72, 0x69, 0x64,
0x00, 0x6f, 0x66, 0x00, 0x77, 0x68, 0x69, 0x74, 0x65, 0x00,
0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x73, 0x2c, 0x00, 0x61,
0x6c, 0x6c, 0x16, 0x00, 0xf0, 0x04, 0x63, 0x68, 0x00, 0x63,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x00, 0x6e, 0x75, 0x6d,
0x62, 0x65, 0x72, 0x73, 0x2e, 0x40, 0x00, 0xf0, 0x01, 0x72,
0x00, 0x74, 0x61, 0x73, 0x6b, 0x00, 0x69, 0x73, 0x00, 0x74,
0x6f, 0x00, 0x63, 0x6f, 0x6c, 0x12, 0x00, 0x40, 0x73, 0x6f,
0x6d, 0x65, 0x36, 0x00, 0x25, 0x74, 0x68, 0x4a, 0x00, 0xf1,
0x01, 0x00, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x00, 0x28, 0x72,
0x65, 0x6d, 0x6f, 0x76, 0x69, 0x6e, 0x67, 0x1c, 0x00, 0x02,
0x48, 0x00, 0x61, 0x29, 0x00, 0x73, 0x6f, 0x00, 0x61, 0x40,
0x00, 0x74, 0x73, 0x61, 0x74, 0x69, 0x73, 0x66, 0x79, 0x76,
0x00, 0x00, 0x24, 0x00, 0x60, 0x66, 0x6f, 0x6c, 0x6c, 0x6f,
0x77, 0x32, 0x00, 0xf3, 0x03, 0x63, 0x6f, 0x6e, 0x64, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x00, 0x00, 0x00, 0x2d,
0x00, 0x4e, 0x6f, 0x41, 0x00, 0xf0, 0x15, 0x00, 0x6f, 0x63,
0x63, 0x75, 0x72, 0x73, 0x00, 0x6d, 0x6f, 0x72, 0x65, 0x00,
0x74, 0x68, 0x61, 0x6e, 0x00, 0x6f, 0x6e, 0x63, 0x65, 0x00,
0x69, 0x6e, 0x00, 0x61, 0x6e, 0x79, 0x00, 0x72, 0x6f, 0x77,
0x00, 0x6f, 0x72, 0x9b, 0x00, 0x44, 0x75, 0x6d, 0x6e, 0x2e,
0x3a, 0x00, 0x02, 0x8f, 0x00, 0x02, 0x9d, 0x00, 0x00, 0xbd,
0x00, 0x50, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0xdf, 0x00, 0x30,
0x6c, 0x6c, 0x79, 0x2f, 0x00, 0x61, 0x76, 0x65, 0x72, 0x74,
0x69, 0x63, 0x0e, 0x00, 0x80, 0x61, 0x64, 0x6a, 0x61, 0x63,
0x65, 0x6e, 0x74, 0xa1, 0x00, 0x00, 0x51, 0x00, 0x59, 0x6f,
0x74, 0x68, 0x65, 0x72, 0x41, 0x00, 0x02, 0x56, 0x00, 0xa0,
0x54, 0x68, 0x65, 0x00, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e,
0xae, 0x00, 0x09, 0x48, 0x01, 0x51, 0x00, 0x6d, 0x75, 0x73,
0x74, 0xd6, 0x00, 0x81, 0x66, 0x6f, 0x72, 0x6d, 0x00, 0x6f,
0x6e, 0x65, 0x4c, 0x01, 0xf0, 0x10, 0x69, 0x67, 0x75, 0x6f,
0x75, 0x73, 0x00, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x00,
0x28, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64,
0x00, 0x62, 0x79, 0x00, 0x65, 0x64, 0x67, 0x80, 0x01, 0x70,
0x6e, 0x6f, 0x74, 0x00, 0x6a, 0x75, 0x73, 0x7d, 0x00, 0x30,
0x75, 0x63, 0x68, 0x59, 0x00, 0xb0, 0x61, 0x74, 0x00, 0x63,
0x6f, 0x72, 0x6e, 0x65, 0x72, 0x73, 0x29, 0x78, 0x00, 0x60,
0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x58, 0x00, 0xf1, 0x01,
0x00, 0x74, 0x68, 0x69, 0x73, 0x00, 0x70, 0x75, 0x7a, 0x7a,
0x6c, 0x65, 0x00, 0x67, 0x6f, 0x65, 0x52, 0x01, 0xf0, 0x02,
0x4e, 0x69, 0x6b, 0x6f, 0x6c, 0x69, 0x00, 0x5b, 0x31, 0x35,
0x5d, 0x00, 0x77, 0x68, 0x6f, 0x00, 0x63, 0x85, 0x00, 0x90,
0x69, 0x74, 0x00, 0x48, 0x69, 0x74, 0x6f, 0x72, 0x69, 0x41,
0x00, 0x03, 0x0f, 0x02, 0x41, 0x00, 0x77, 0x61, 0x73, 0x95,
0x00, 0x40, 0x72, 0x69, 0x62, 0x75, 0x84, 0x00, 0x22, 0x74,
0x6f, 0x51, 0x00, 0x60, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63,
0x78, 0x01, 0x00, 0x97, 0x00, 0xc0, 0x4a, 0x61, 0x6d, 0x65,
0x73, 0x00, 0x48, 0x61, 0x72, 0x76, 0x65, 0x79, 0x3e, 0x00,
0x01, 0x59, 0x00, 0xc1, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
0x2f, 0x77, 0x77, 0x77, 0x2e, 0x6e, 0x70, 0x00, 0x82, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x2f, 0x8d, 0x00, 0x32,
0x73, 0x2f, 0x68, 0x6e, 0x00, 0xb1, 0x68, 0x74, 0x6d, 0x6c,
0x00, 0x28, 0x62, 0x65, 0x77, 0x61, 0x72, 0x20, 0x02, 0xd5,
0x46, 0x6c, 0x61, 0x73, 0x68, 0x29, 0x00, 0x00, 0x00, 0x33,
0x32, 0x2e, 0x31, 0x98, 0x02, 0x01, 0x85, 0x00, 0x21, 0x6f,
0x6c, 0xa1, 0x02, 0xa0, 0x4c, 0x65, 0x66, 0x74, 0x2d, 0x63,
0x6c, 0x69, 0x63, 0x6b, 0xfb, 0x00, 0x10, 0x6f, 0xd2, 0x01,
0x64, 0x00, 0x65, 0x6d, 0x70, 0x74, 0x79, 0xbb, 0x01, 0x44,
0x77, 0x69, 0x6c, 0x6c, 0x77, 0x02, 0x22, 0x69, 0x74, 0x96,
0x01, 0x39, 0x3b, 0x00, 0x6c, 0x37, 0x00, 0x20, 0x61, 0x67,
0xb5, 0x02, 0x01, 0x2a, 0x00, 0x42, 0x72, 0x65, 0x73, 0x74,
0x26, 0x02, 0x04, 0x7e, 0x02, 0x67, 0x2e, 0x00, 0x52, 0x69,
0x67, 0x68, 0x2e, 0x00, 0x01, 0x28, 0x00, 0xf1, 0x05, 0x61,
0x64, 0x64, 0x00, 0x61, 0x00, 0x63, 0x69, 0x72, 0x63, 0x6c,
0x65, 0x00, 0x28, 0x75, 0x73, 0x65, 0x66, 0x75, 0x6c, 0x64,
0x01, 0x72, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0xc2,
0x02, 0x20, 0x61, 0x74, 0x25, 0x00, 0x30, 0x65, 0x6c, 0x6c,
0x42, 0x02, 0xa1, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
0x65, 0x6c, 0x79, 0xb5, 0x01, 0x01, 0x8a, 0x00, 0x23, 0x29,
0x2e, 0x65, 0x03, 0xb2, 0x63, 0x61, 0x6e, 0x00, 0x61, 0x6c,
0x73, 0x6f, 0x00, 0x75, 0x73, 0x7d, 0x00, 0x00, 0xb1, 0x02,
0x61, 0x6f, 0x72, 0x00, 0x6b, 0x65, 0x79, 0xa7, 0x01, 0x20,
0x6d, 0x6f, 0x85, 0x03, 0x51, 0x72, 0x6f, 0x75, 0x6e, 0x64,
0x1f, 0x00, 0x00, 0x8e, 0x03, 0x74, 0x2e, 0x00, 0x50, 0x72,
0x65, 0x73, 0x73, 0x2d, 0x03, 0x60, 0x72, 0x65, 0x74, 0x75,
0x72, 0x6e, 0x9c, 0x02, 0x52, 0x73, 0x70, 0x61, 0x63, 0x65,
0x3b, 0x00, 0x01, 0xad, 0x00, 0x01, 0x18, 0x00, 0x14, 0x61,
0x12, 0x01, 0x02, 0x99, 0x02, 0x2a, 0x6f, 0x72, 0xc4, 0x00,
0x40, 0x72, 0x65, 0x73, 0x70, 0xc6, 0x01, 0xb8, 0x76, 0x65,
0x6c, 0x79, 0x2c, 0x00, 0x61, 0x6e, 0x64, 0x00, 0x70, 0x5d,
0x00, 0x3f, 0x6b, 0x65, 0x79, 0x27, 0x01, 0x0b, 0x00, 0x51,
0x00, 0x01, 0xbc, 0x03, 0x03, 0xbf, 0x00, 0x01, 0x56, 0x00,
0x00, 0xde, 0x00, 0x41, 0x28, 0x41, 0x6c, 0x6c, 0x13, 0x00,
0x11, 0x61, 0x24, 0x02, 0x00, 0x08, 0x01, 0x70, 0x73, 0x63,
0x72, 0x69, 0x62, 0x65, 0x64, 0x81, 0x03, 0x13, 0x73, 0x3a,
0x02, 0x40, 0x32, 0x2e, 0x31, 0x00, 0x9d, 0x00, 0x01, 0x04,
0x01, 0xa3, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c,
0x65, 0x2e, 0xfc, 0x01, 0x15, 0x32, 0xfc, 0x01, 0x91, 0x70,
0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0xfe, 0x01,
0x66, 0x54, 0x68, 0x65, 0x73, 0x65, 0x00, 0x14, 0x00, 0x02,
0x43, 0x00, 0x04, 0x3e, 0x00, 0x51, 0x00, 0x66, 0x72, 0x6f,
0x6d, 0x7b, 0x00, 0xe1, 0x60, 0x43, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x2e, 0x2e, 0x2e, 0x27, 0x00, 0x6f, 0x70, 0x71, 0x00,
0x22, 0x6f, 0x6e, 0x1a, 0x00, 0xa0, 0x54, 0x79, 0x70, 0x65,
0x27, 0x00, 0x6d, 0x65, 0x6e, 0x75, 0xad, 0x00, 0x90, 0x57,
0x69, 0x64, 0x74, 0x68, 0x2c, 0x00, 0x48, 0x65, 0xf3, 0x01,
0x01, 0xfc, 0x02, 0x11, 0x7a, 0x89, 0x02, 0x01, 0xfd, 0x04,
0x24, 0x69, 0x6e, 0xaf, 0x03, 0x00, 0x2b, 0x00, 0xa0, 0x44,
0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x65,
0x03, 0x03, 0x93, 0x02, 0x01, 0x54, 0x00, 0x16, 0x64, 0x1a,
0x00, 0x03, 0xa4, 0x04, 0x60, 0x67, 0x65, 0x6e, 0x65, 0x72,
0x61, 0x35, 0x03, 0x80, 0x70, 0x75, 0x7a, 0x7a, 0x6c, 0x65,
0x2e, 0x00,
};
const unsigned short help_text_len = 1392;
const unsigned short help_text_words = 250;
const char quick_help_text[] = "Black out the right set of duplicate numbers.";
|
346e3392850b7a18678b9e40d2ec70897b0a7bdc | 48217d6c7bc9b0b9c1d849e0039479e8adfe6296 | /ht_test.h | 492e497a85cda30d0ae5c582f380db0ebe366735 | [] | no_license | watsonjiang/hybirdthread | 2504dbdb3c4e7ae0ffcbef15b9dd9ed7cb1af3f0 | a1d065be97fda14b5ab65a651983f62020e6e546 | refs/heads/master | 2021-01-19T12:59:33.366659 | 2014-03-03T03:40:11 | 2014-03-03T03:40:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 261 | h | ht_test.h | #ifndef __HT_TEST_H__
#define __HT_TEST_H__
/* assert a is true, or else print msg and exit */
#define HT_TEST_ASSERT(a, msg) \
if(!(a)) \
{ \
printf("%s:%d - %s\n", __FILE__, __LINE__, msg); \
exit(1); \
}
#endif //__HT_TEST_H__
|
54cc94ed341fd993c2150565db9c097d880977a1 | 2b6c39e2f82e3db097d12aa2ea1ee884653c9804 | /main.c | 197549383c678ef0096abeb2cccc1c60729f3263 | [] | no_license | DeniseBishevsky/Grade-App | 19e5747ad1b2d136f7233e202bc3355b54497c15 | bbb4a79ff35294089f4a7ab17eb37cef9ba8892d | refs/heads/main | 2023-04-18T01:53:03.516165 | 2021-05-08T20:08:58 | 2021-05-08T20:08:58 | 365,203,328 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 18,854 | c | main.c | /* A simple server in the internet domain using TCP
The port number is passed as an argument */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <signal.h>
#include "myqueue.h"
#define THREAD_POOL_SIZE 5
#define BUFSIZE 256
#define SIZE_OF_PASSWORD 32
#define SIZE_OF_GRADE_LIST_ENTRY 15
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t condition_var = PTHREAD_COND_INITIALIZER;
pthread_t thread_pool[THREAD_POOL_SIZE];
void INThandler(int);
enum permissions{Student, Assistant, Not_exist}; // This will be use to track what are the user permissions
void INThandler(int sig)
{
for (int i =0;i < THREAD_POOL_SIZE; i++) {
pthread_kill(&thread_pool[i], sig);
}
exit(1);
}
typedef struct student{
int id;
char password[SIZE_OF_PASSWORD];
int grade;
struct student *next;
}student_t;
typedef struct assistant{
int id;
char password[SIZE_OF_PASSWORD];
struct assistant *next;
}assistant_t;
// we have to make an data structure that keeps all the sockets if they had a user that loged in from
// and a nother 2 to remove and add those and to make it atomic and have the same mutex.
// function that starts
typedef struct user_logged{
int socket_id;
enum permissions permission;
assistant_t *ass_curr;
student_t *stud_curr;
}user_logged;
void * handle_connection(void* p_client_socket);
student_t *search_student_by_id(int id);
void error(const char *msg);
student_t *create_student(int id, char *password);
user_logged *create_user(int socket);
assistant_t *create_assistant(int id, char *password);
student_t *add_student_to_ordered_list(student_t *head, student_t *new_student);
assistant_t *add_assistant_to_ordered_list(assistant_t *head, assistant_t *new_assistant);
void GradeList(user_logged *user,int client_socket);
//Decalre on function
student_t *read_students_file();
assistant_t *read_assistants_file();
//Declare on pointers
student_t *students_list;
assistant_t *assistants_list;
void start(char *argv[]);
assistant_t *search_assistant(int id, char *password);
student_t *search_student_by_id(int id);
int Login(char *buf, user_logged *user, int id, char *password);
int Logout(char *buf, user_logged *user);
int ReadGrade(char *buf, user_logged *user, int id);
int UpdateGrade(char *buf, user_logged *user, int id, int grade);
void * thread_function(void *arg);
node_t* head = NULL;
node_t* tail = NULL;
void enqueue(int *client_socket) { // queue for commands from client.
node_t *newnode = malloc(sizeof(node_t));
newnode->client_socket = client_socket;
newnode->next = NULL;
if (tail == NULL) {
head = newnode;
} else {
tail->next = newnode;
}
tail = newnode;
}
int* dequeue() {
if (head == NULL) {
return NULL;
} else {
int *result = head->client_socket;\
node_t *temp = head;
head = head->next;
if (head == NULL) {tail = NULL;}
free(temp);
return result;
}
}
assistant_t *search_assistant(int id, char *password){
assistant_t *current_assistant = assistants_list;
while (current_assistant && current_assistant->id <= id){
if(current_assistant->id == id){// there is a assistant with this id
char temp[256];
strcpy(temp,current_assistant->password);
if( strcmp(current_assistant->password, password) == 0){ // the password fits
return current_assistant;
} else {
return NULL;
}
}
current_assistant= current_assistant->next;
}
return NULL;
}
student_t *search_student_by_id(int id){
student_t *current_student = students_list;
while (current_student && current_student->id <= id){
if(current_student->id == id){// there is a student with this id
return current_student;
}
current_student= current_student->next;
}
return NULL;
}
// Function: Login
// Description: Checks how is the user and update the users permision
// Gets: Pointer to user_logged struct, pointer to the head of students_list,
// pointer to the head of assistants_list, id and password
// Returns: 1 if success 0 if faild
int Login(char *buf, user_logged *user, int id, char *password){
student_t *stud = search_student_by_id(id);
if(stud != NULL){
if (strcmp(stud->password, password) == 0 ){ // check his password
user->stud_curr = stud;
user->permission = Student;
snprintf(buf, 255, "Welcome Student %09d\n", user->stud_curr->id);
return 1;
} else {
strcpy(buf,"Wrong user information\n");
return 0;
}
}
assistant_t *ass = search_assistant(id,password);
if(ass != NULL){
user->ass_curr = ass;
user->permission = Assistant;
snprintf(buf, 255, "Welcome TA %09d\n", user->ass_curr->id);
return 1;
}
strcpy(buf,"Wrong user information\n");
return 0;
}
// Function: ReadGrade
// Description: Save the grade of a student in a buffer. Studernt allow only to ask for his personal grade,
// TA allowed to ask for a specific student grade he wants
// Gets: Pointer to buffer, struct pointer to user_logged struct, pointer to the head of students_list,
// id (if it is a student id = 0, TA need to send a number > 0)
// Returns: 1 if success 0 if faild
int ReadGrade(char *buf, user_logged *user, int id){
// check if the user is a student
if(user->permission == Student){
if (id != 0){ // the student not allowed to sent id argument
strcpy(buf, "Action not allowed\n");
return 0;
} else { // save his grade
snprintf(buf, 255, "%d\n", user->stud_curr->grade);
return 1;
}
}
// if its not a student check if it is a TA
if(user->permission == Assistant){
if (id == 0){ // TA did not add id of a student as an argument
strcpy(buf, "Missing argument\n");
return 0;
} else {
student_t *stud = search_student_by_id(id); // find the right student struct
if(stud != NULL){ // save his grade
snprintf(buf, 255, "%09d:%d\n", stud->id, stud->grade);
return 1;
} else { // did not find student with such id
strcpy(buf, "Invalid id\n");
return 0;
}
}
}
//otherwise the user not loged in
strcpy(buf, "Not logged in\n");
return 0;
}
// Function: UpdateGrade
// Description: Update the grade of a specific student. this command allowed only for TA.
// Gets: Pointer to buffer, struct pointer to user_logged struct, id and grade
// Returns: 1 if success 0 if faild
int UpdateGrade(char *buf, user_logged *user, int id, int grade){
if(user->permission == Student){// student not allowed to use the function
strcpy(buf, "Action not allowed\n");
return 0;
}
else if(user->permission == Assistant){ // TA is allowed to update a grade
student_t *stud = search_student_by_id(id);
if(stud != NULL){ // if the student exist in the linked lis, update his grade
stud->grade = grade;
} else{
// if there is no such of student, creat new one and add him to the linked list
stud = create_student(id,"");
stud->grade = grade;
students_list = add_student_to_ordered_list(students_list, stud);
}
return 1;
} else{// otherwise the user not loged in
strcpy(buf, "Not logged in\n");
return 0;
}
}
void error(const char *msg)
{
perror(msg);
exit(1);
}
// Function: create_student
// Description: Create new student struct.
// Gets: id and password
// Returns: Pointer to new student struct
student_t *create_student(int id, char *password){
if (0 >= id){
printf ("Invalid student id");
return NULL;
}
student_t *new_student = malloc(sizeof(student_t));
if(NULL == new_student){
printf ("Failed with creating new student");
return NULL;
}
bzero(new_student, sizeof(student_t));
strncpy(new_student->password ,password, SIZE_OF_PASSWORD);
new_student->id = id;
new_student->grade = 0;
new_student->next = NULL;
return new_student;
}
user_logged *create_user(int socket){
user_logged *new_user= malloc(sizeof(user_logged));
if(NULL == new_user){
printf ("Failed with creating new user");
return NULL;
}
new_user->socket_id = socket;
new_user->permission = Not_exist;
new_user-> ass_curr = NULL;
new_user-> stud_curr = NULL;
return new_user;
}
// Function: create_assistant
// Description: Create new assistant struct.
// Gets: id and password
// Returns: Pointer to new assistant struct
assistant_t *create_assistant(int id, char *password){
if (0 >= id){
printf ("Invalid assistant id");
return NULL;
}
if (0 == strlen(password)){
printf ("Invalid assistant Password");
return NULL;
}
assistant_t *new_assistant = malloc(sizeof(assistant_t));
if(NULL == new_assistant){
printf ("Failed with creating new assistant");
return NULL;
}
bzero(new_assistant, sizeof(assistant_t));
strncpy(new_assistant->password ,password, SIZE_OF_PASSWORD);
new_assistant->id = id;
new_assistant->next = NULL;
return new_assistant;
}
// Function: add_student_to_ordered_list
// Description: Adds new student to the link list. The list is ordered in an ascending id order.
// Gets: Pointer to the head of link list of student structs and a pointer to a new student struct
// Returns: Pointer to the head of student link list
student_t *add_student_to_ordered_list(student_t *p_student_list, student_t *p_new_student){
student_t *current, *prev = NULL;
if(NULL == p_student_list){
return p_new_student;
}
if(p_new_student->id < p_student_list->id){
p_new_student->next = p_student_list;
return p_new_student;
}
current = p_student_list;
while(current && current->id < p_new_student->id){
prev = current;
current = current->next;
}
prev->next = p_new_student;
p_new_student->next = current;
return p_student_list;
}
// Function: add_assistant_to_ordered_list
// Description: Adds new assistant to the link list. The list is ordered in an ascending id order.
// Gets: Pointer to the head of link list of assistant structs and a pointer to a new assistant struct
// Returns: Pointer to the head of assistant link list
assistant_t *add_assistant_to_ordered_list(assistant_t *head, assistant_t *new_assistant){
assistant_t *current, *prev = NULL;
if(NULL == head){
return new_assistant;
}
if(new_assistant->id < head->id){
new_assistant->next = head;
return new_assistant;
}
current = head;
while(current && current->id < new_assistant->id){
prev = current;
current = current->next;
}
prev->next = new_assistant;
new_assistant->next = current;
return head;
}
int get_num_students(){
student_t *p_student = students_list;
int counter = 0;
while(p_student){
counter++;
p_student = p_student->next;
}
return counter;
}
// Function: GradeList
// Description: Prints all the grades sorted by the id number
// Gets: Pointer to the head of link list of student structs
void GradeList(user_logged *user, int client_socket){
int buffer_size = 0;
char *buffer = NULL;
unsigned int num_bytes = 0;
//Lock
pthread_mutex_lock(&mutex2);
buffer_size = get_num_students()*SIZE_OF_GRADE_LIST_ENTRY +20;
buffer = malloc(buffer_size);
if(user->permission == Student){
strcpy(buffer, "Action not allowed\n");
} else if(user->permission == Assistant){
student_t *p_student = students_list;
int position = 0;
while(p_student){
int n = snprintf(buffer+position,SIZE_OF_GRADE_LIST_ENTRY, "%09d:%d\n",p_student->id,p_student->grade);
position+=n;
p_student = p_student->next;
}
} else{
strcpy(buffer, "Not logged in\n");
}
//unlock
pthread_mutex_unlock(&mutex2);
num_bytes = htonl(strlen(buffer)+1);
write(client_socket,&num_bytes,sizeof(num_bytes));
write(client_socket,buffer,strlen(buffer));
free(buffer);
}
// Function: Logout
// Description: Logout from the system
// Gets: Pointer to buffer and struct pointer to user_logged struct
// Returns: 1 if success 0 if faild
int Logout(char *buf, user_logged *user){
if(user->permission == Student){
int id = user->stud_curr->id;
user->permission = Not_exist;
user->stud_curr = NULL;
snprintf(buf, 255, "Good bye %09d\n", id);
return 1;
} else if (user->permission == Assistant){
int id = user->ass_curr->id;
user->permission = Not_exist;
user->ass_curr = NULL;
snprintf(buf, 255, "Good bye %09d\n", id);
return 1;
} else {
strcpy(buf, "Action not allowed\n");
return 0;
}
}
// Function: read_students_file
// Description: Creates a data structure from the students.txt file
// Returns: Pointer to the head of the link list of student structs
student_t *read_students_file()
{
student_t *p_student_list = NULL;
char line[256];
FILE *file = fopen("students.txt","r");
if(NULL == file){
printf("Failed to open stutends.txt file");
return NULL;
}
while(fgets(line,sizeof(line),file))
{
char *id = NULL;
char *password = NULL;
//separates the id and the password using ':'
id = strtok(line,":");
password = strtok(NULL,"\n");
// create new student struct
student_t *p_new_student = create_student(atoi(id),password);
if (NULL == p_new_student){
exit(1);
}
// update the head of the link list
p_student_list = add_student_to_ordered_list(p_student_list, p_new_student);
}
fclose(file);
return p_student_list;
}
// Function: read_assistants_file
// Description: Creates a data structure from the assistants.txt file
// Returns: Pointer to the head of the link list of assistant structs
assistant_t *read_assistants_file()
{
assistant_t *head = NULL;
char line[256];
FILE *file = fopen("assistants.txt","r");
if(NULL == file){
printf("Failed to open assistants.txt file");
return NULL;
}
while(fgets(line,sizeof(line),file))// read line by line
{
char *id;
char *password;
//separates the id and the password using ':'
id = strtok(line,":");
password = strtok(NULL,"\n");
// create new assistant struct
assistant_t *new_assistant = create_assistant(atoi(id),password);
if (NULL == new_assistant){
exit(1);
}
// update the head of the link list
head = add_assistant_to_ordered_list(head, new_assistant);
}
fclose(file);
return head;
}
void start(char *argv[]){
socklen_t clilen;
int sockfd, newsockfd, portno;
struct sockaddr_in serv_addr, cli_addr;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
bzero((char *) &serv_addr, sizeof(serv_addr));
portno = atoi(argv[1]);
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);
if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0)
error("ERROR on binding");
listen(sockfd,5);
clilen = sizeof(cli_addr);
while(1)
{
newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
if (newsockfd < 0)
error("ERROR on accept");
int *pclient = malloc(sizeof(int));
*pclient = newsockfd;
pthread_mutex_lock(&mutex);
enqueue(pclient);
pthread_cond_signal(&condition_var);
pthread_mutex_unlock(&mutex);
}
close(sockfd);
}
void * thread_function(void *arg) {
while (1)
{
int *pclient = dequeue();
pthread_mutex_lock(&mutex);
if (pclient = dequeue() == NULL) {
pthread_cond_wait(&condition_var,&mutex);
pclient = dequeue();
}
pthread_mutex_unlock(&mutex);
if (pclient != NULL){
handle_connection(pclient);
}
}
}
void * handle_connection(void* p_client_socket){
int client_socket = *((int*)p_client_socket);
free(p_client_socket);
int n;
char *buffer = malloc(sizeof(char)*BUFSIZE);
char *res = malloc(sizeof(char)*BUFSIZE);
user_logged *current_user = create_user(client_socket);
if (current_user == NULL)
error("ERROR on malloc of user_logged struct");
while (1) {
bzero(buffer,BUFSIZE);
bzero(res,BUFSIZE);
n = read(client_socket,buffer,255);
if (n == 0){
free(buffer);
free(res);
free(current_user);
break;
}
char * string = strtok(buffer, " ");
if (strcmp(string, "Login") == 0)
{ // "Login 3084831324 lol2kok"
char *array[2];
int i=0;
array[i] = strtok(NULL," ");
while(array[i]!=NULL)
{
array[++i] = strtok(NULL," ");
}
int id = atoi(array[0]);
//lock
pthread_mutex_lock(&mutex2);
Login(res, current_user,id, array[1]);
//unlock
pthread_mutex_unlock(&mutex2);
write(client_socket,res,255);
bzero(res,256);
}
else if (strcmp(string, "ReadGrade") == 0)
{
int id=0;
char *array[1];
int i=0;
array[i] = strtok(NULL," ");
while(array[i]!=NULL){
array[++i] = strtok(NULL," ");
}
if(array[0] != NULL){
id = atoi(array[0]);
}
//lock
pthread_mutex_lock(&mutex2);
ReadGrade(res,current_user,id);
//unlock
pthread_mutex_unlock(&mutex2);
write(client_socket,res,255);
bzero(res,256);
}
else if (strcmp(string, "UpdateGrade") == 0)
{
char *array[2];
int i=0;
array[i] = strtok(NULL," ");
while(array[i]!=NULL)
{
array[++i] = strtok(NULL," ");
}
int id = atoi(array[0]);
int grade = atoi(array[1]);
//lock
pthread_mutex_lock(&mutex2);
UpdateGrade(res, current_user,id, grade);
//unlock
pthread_mutex_unlock(&mutex2);
write(client_socket,res,255);
bzero(res,256);
}
else if (strcmp(string, "GradeList") == 0)
{
// lock and unlock inside the function itself
GradeList(current_user,client_socket);
}
else if (strcmp(string, "Logout") == 0)
{
//lock
pthread_mutex_lock(&mutex2);
Logout(res, current_user);
//unlock
pthread_mutex_unlock(&mutex2);
write(client_socket,res,255);
bzero(res,256);
}
else if (strcmp(string, "Exit") == 0)
{
pthread_mutex_lock(&mutex2);
Logout(res, current_user);
pthread_mutex_unlock(&mutex2);
bzero(res,256);
}
}
}
int main(int argc, char *argv[])
{
// load users data
signal(SIGINT, INThandler);
students_list = read_students_file();
assistants_list = read_assistants_file();
if (argc < 2) {
fprintf(stderr,"ERROR, no port provided\n");
exit(0);
} else {
for (int i =0;i < THREAD_POOL_SIZE; i++) {
pthread_create(&thread_pool[i], NULL, thread_function, NULL);
}
start(argv);
}
return 0;
}
|
aa01bc9d42fc031211484524650492975183f4c1 | 4c1e05de4b8c314dff43a70427e81e1e4b24701f | /dateConverterWithUpdater/dcNepaliToEnglish.c | a61dd9ee3535cbed3e77081e03743dc1a406bdb3 | [] | no_license | beannayak/GTKExchangeRateDisplay | f2a5c02fabc8215e46998d5694ce7fda83a35d78 | d185d251fec96fdfdbe3d1f09315da755db34a8d | refs/heads/master | 2018-12-28T16:05:27.316814 | 2015-06-17T22:34:49 | 2015-06-17T22:34:49 | 37,623,923 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,719 | c | dcNepaliToEnglish.c | #include <stdio.h>
#include <myString.h>
char *readLine(FILE *myFile){
char buffer[3000] = {0};
char *string = NULL;
fscanf(myFile, "%[^'\n']s", buffer);
if (!feof(myFile) ){
string = (char *) malloc(length(buffer) + 1);
strCpy (buffer, string);
fseek (myFile, 1, SEEK_CUR);
}
return string;
}
int myToInteger(char *number){
int count = 0;
int value = 0;
while (number[count] != '\0'){
if (number[count] >= 48 && number[count] <= 57){
value = value * 10 + (number[count]-48);
}
count++;
}
return value;
}
int **putToArray(int *myDataLength){
char *string;
int **myData;
int lineCount = 0;
FILE *myFile = fopen("./DateInfo.dat", "r");
char **splitedString;
int splitedStringLength;
int x;
/******** First parse *************************/
while ((string = readLine (myFile)) != NULL){
if (!equals(string, "\0") && !(equals(string, "\r\0"))) {
lineCount++;
}
free (string);
}
*myDataLength = lineCount;
fclose(myFile);
/**********************************************/
/****************** Initilize double pointer array ****************/
myData = (int **) malloc ((sizeof(int*)) * (lineCount) + 1);
for (x=0; x<lineCount; x++){
myData[x] = (int *) malloc (sizeof (int) * 14);
}
/******************************************************************/
/*******************Fill the array ********************************/
lineCount = 0;
myFile = fopen("./DateInfo.dat", "r");
while ((string = readLine (myFile)) != NULL){
if (!equals(string, "\0") && !(equals(string, "\r\0"))) {
splitedString = split(string, ",", &splitedStringLength);
for (x=0; x<14; x++){
myData[lineCount][x] = myToInteger(splitedString[x]);
}
freeSplitedString(splitedString, splitedStringLength);
}
lineCount++;
free (string);
}
fclose(myFile);
/******************************************************************/
return myData;
}
int isLeapYear(int year) {
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}
int main(int argc, char **argv){
int **data;
int dataLength;
int checkYear, x, y;
char breakCondition = 0;
int englishDays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char *englishMonthsName[] = {"January", "Feburary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
int year, month, day;
int retYear, retMonth, retDay;
int dayCount;
int counter;
int subVal, monthCounter;
if (argc < 4){
printf ("Enter your date in system arguments.\n");
exit(0);
}
data = putToArray(&dataLength);
for (x=0; x<dataLength; x++){
for (y=0; y<14;y++){
if (data[x][y] == 2013){
checkYear = 2070 + x;
//printf ("year: %d \n", checkYear);
breakCondition = 1;
break;
}
}
if (breakCondition){
break;
}
}
sscanf (argv[1], "%d", &year);
sscanf (argv[2], "%d", &month);
sscanf (argv[3], "%d", &day);
year = checkYear - year;
retYear = data[year][12];
if (isLeapYear(retYear)){
englishDays[1] = 29;
} else {
englishDays[1] = 28;
}
dayCount = 0;
for (counter=0; counter<month-1; counter++){
dayCount += data[year][counter];
}
dayCount += day;
subVal = englishDays[3] - data[year][13];
monthCounter = 3;
while (1){
dayCount -= subVal;
monthCounter++;
if (monthCounter == 12) {
monthCounter = 0;
retYear += 1;
if (isLeapYear(retYear)){
englishDays[1] = 29;
} else {
englishDays[1] = 28;
}
}
if (dayCount > englishDays[monthCounter]){
subVal = englishDays[monthCounter];
} else {
dayCount -= 1;
if (dayCount == 0) {
monthCounter -- ;
if (monthCounter == -1){
monthCounter = 11;
retYear -= 1;
}
retDay = englishDays[monthCounter];
} else {
retDay = dayCount;
}
break;
}
}
retMonth = monthCounter;
if (retDay < 0) {
retMonth -= 1;
retDay = englishDays[retMonth] + retDay;
}
printf ("%d %s %d\n", retYear, englishMonthsName[retMonth], retDay);
return 0;
}
|
ad89ef0a06ddea033966278c3f8c452c45933637 | 086866b08d914eef7e7f52cdceb605bed975d196 | /code.c | 16fe8ee0a8f5c2e3a1488e4bcaa1b6d721e0ee7a | [] | no_license | aghilasadjaoudi/tp-robotique | e4e3e4928498baf218d869fde7e467cd39e904f8 | af1fe7c9e83c2c4eadad2f9555b3457f94dadb3c | refs/heads/master | 2016-08-12T07:39:51.785307 | 2016-02-15T16:46:44 | 2016-02-15T16:46:44 | 51,767,028 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 123 | c | code.c | #define a;
int a=5;
int b=1;
char massi;
char ghiles;
char malek;
int sahit a malek;
on va pas expliquer a yazid demain;
|
1122e48cd74ba05fdb25b7d50ba75207a10adad6 | 4397a8fa011eeb52880923817e36dbc070eb5811 | /src/read_connec.c | ec75faa72c82448533348b70e52923bcc0597846 | [] | no_license | JamesPalport/lem_in | 1dbd5c753285df8c6e58876709cb751ced6be766 | 8d19bd5bacdf2ea71c2c6f3bd8cf7e57096901bf | refs/heads/master | 2020-04-23T16:41:16.235308 | 2019-10-26T15:45:11 | 2019-10-26T15:45:11 | 171,306,083 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,445 | c | read_connec.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read_connec.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amerrouc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/21 10:35:10 by amerrouc #+# #+# */
/* Updated: 2019/07/02 12:28:28 by amerrouc ### ########.fr */
/* */
/* ************************************************************************** */
#include "reader.h"
static int get_num(t_all *all, char *line)
{
int i;
int len1;
t_room *cursor;
len1 = 0;
while (line[len1] && line[len1] != '-')
len1++;
if (!len1)
return (-1);
cursor = all->rooms;
i = 1;
if (!ft_strncmp(line, all->start->name, len1))
return (0);
else if (!ft_strncmp(line, all->end->name, len1))
return (all->nb_rooms - 1);
else
{
while (cursor && (ft_strncmp(line, cursor->name, len1)) && i++)
cursor = cursor->next;
}
if (!cursor)
return (-1);
return (i);
}
static int init_connec(t_all *all)
{
int i;
int j;
j = 0;
if (!(all->connec = (int **)malloc(sizeof(int *) * all->nb_rooms)))
return (0);
while (j < all->nb_rooms)
{
if (!(all->connec[j] = (int *)malloc(sizeof(int) * all->nb_rooms)))
return (0);
i = 0;
while (i < all->nb_rooms)
all->connec[j][i++] = 0;
j++;
}
return (1);
}
static int get_connec(t_all *all, char *line)
{
int i;
int j;
i = get_num(all, line);
j = 0;
while (line[j] && line[j] != '-')
j++;
j = get_num(all, line + j + 1);
if (i < 0 || j < 0)
return (0);
if (!all->connec[i][j])
{
all->connec[i][j] = 1;
all->connec[j][i] = 1;
all->connec[j][j]++;
all->connec[i][i]++;
}
return (1);
}
int read_connec(t_all *all, char *line, int fd)
{
int d;
init_connec(all);
d = 0;
d = get_connec(all, line);
free(line);
if (!d)
return (0);
while (get_next_line(fd, &line) > 0)
{
ignore_comments(&line, fd);
if (line && line[0] != '\0')
d = get_connec(all, line);
if (line)
ft_strdel(&line);
}
return (d);
}
|
643dbf1633ff0d76802758d47203140320f4425e | daa9da7742901d02ef03ae69593e805517c4367f | /spl/common/ricoh618_power.c | 387a4d16628bd54bc3647629103fb03c32eb4692 | [] | no_license | IngenicSemiconductor/X-BOOT-WARRIOR | 483e4a016c65b2c569890fef071ea950f4dfa33a | 421804a3c73bf116567cf8c89cb08dcd4d8dd6ba | refs/heads/master | 2016-09-05T09:07:03.461583 | 2013-07-16T06:44:17 | 2013-07-16T06:44:17 | 10,257,822 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,591 | c | ricoh618_power.c | /*
* PMU driver for ricoh618 PMU
*
*/
#include <config.h>
#ifdef CONFIG_RICOH618
#include <ricoh618_power.h>
#include <simulate_i2c.h>
#include <serial.h>
#include <common.h>
#define EIO 2
#define I2C_READ_OPS
/*************************************************************************/
#ifdef I2C_READ_OPS
static int ricoh618_i2c_read_device(unsigned char reg, int bytes, void *dest)
{
int ret;
ret = simulate_i2c_read((unsigned char)RICOH618_I2C_ADDR, (unsigned char *)dest, reg, bytes);
if (ret < 0)
return ret;
if (ret < bytes)
return -EIO;
return 0;
}
#endif
/* Currently we allocate the write buffer on the stack; this is OK for
* small writes - if we need to do large writes this will need to be
* revised.
*/
static int ricoh618_i2c_write_device(unsigned char reg, int bytes, void *src)
{
int ret;
ret = simulate_i2c_write((unsigned char)RICOH618_I2C_ADDR, (unsigned char *)src, reg, bytes);
if (ret < 0)
return ret;
if (ret < bytes)
return -EIO;
return 0;
}
#ifdef I2C_READ_OPS
static int ricoh618_read(unsigned char reg, int bytes, void *dest)
{
int ret, i;
unsigned char *buf = dest;
ret = ricoh618_i2c_read_device(reg, bytes, dest);
if (ret < 0)
return ret;
serial_puts_info("ricoh618: Read register --");
serial_put_hex((unsigned int)reg);
serial_puts_info("data: ");
for (i = 0; i < bytes; i++) {
serial_put_hex(buf[i]);
}
return 0;
}
#endif
static int ricoh618_write(unsigned char reg, int bytes, void *src)
{
unsigned char *buf = src;
int i;
// serial_puts_info("ricoh618: Write register --");
// serial_put_hex((unsigned int)reg);
// serial_puts_info("data: ");
// for (i = 0; i < bytes; i++) {
// serial_put_hex(buf[i]);
// }
return ricoh618_i2c_write_device(reg, bytes, src);
}
#ifdef I2C_READ_OPS
unsigned char ricoh618_reg_read(unsigned char reg)
{
unsigned char val;
unsigned char ret;
ret = ricoh618_read(reg, 1, &val);
if (ret < 0)
return ret;
else
return val;
}
#endif
unsigned char ricoh618_reg_write(unsigned char reg, unsigned char val)
{
unsigned char ret;
ret = ricoh618_write(reg, 1, &val);
return ret;
}
int ricoh618_output_set(int outnum,int regvalue)
{
char reg, reg_banksel;
switch(outnum) {
case RICOH618_OUT1:reg = RICOH618_REG1_VSET;break;
case RICOH618_OUT2:reg = RICOH618_REG2_VSET;break;
case RICOH618_OUT3:reg = RICOH618_REG3_VSET;break;
case RICOH618_LDO2:reg = RICOH618_LDO2_VOLTAGE_SET;break;
case RICOH618_LDO5:reg = RICOH618_LDO5_VOLTAGE_SET;break;
default:return -1;
}
return ricoh618_reg_write(reg,regvalue);
}
int core_voltage_read_ricoh618(int reg)
{
return ricoh618_reg_read(reg);
}
void core_voltage_regulate_pmu(int vol)
{
serial_puts("core_voltage_regulate_ricoh618 = ");
serial_put_hex(vol);
if (vol > 0) {
unsigned char value = 0;
unsigned int i = 200000 * (CFG_EXTAL / 2000000);
serial_puts("core voltage regulate:");serial_put_dec(vol);
__gpio_as_output(GPIO_SDA);
__gpio_clear_pin(GPIO_SDA);
__gpio_as_output(GPIO_SCL);
__gpio_clear_pin(GPIO_SCL);
if ((vol >= 1000) && (vol <= 1300)) {
value = (((vol - 600 )*10 + 124) / 125);
} else {
serial_puts("unsupported voltage\n");
return;
}
serial_puts("core voltage value :"); serial_put_hex(value);
ricoh618_output_set(1, value); //24 --> 1.2V
// ricoh618_output_set(RICOH618_OUT2, 0x48);
__asm__ __volatile__ (
"\t.set noreorder\n"
"1:\n\t"
"bne\t%0, $0, 1b\n\t"
"addi\t%0, %0, -1\n\t"
".set reorder\n"
: "=r" (i)
: "0" (i)
);
} else {
serial_puts("core voltage regulate:default\n");
}
}
#endif // CONFIG_RICOH618
|
8b15ba38ed27463eeefef70efc172e174559b962 | 722b5c4a30e552335f28b40d2d4db556f546aee2 | /practice_midterm/upper.c | a715e3942bd204234cb28c25158ef9ae70b661ba | [] | no_license | kimwongyuda/lsp | 67180f1ade7a3bbcd466fc83641075666d4da3d2 | ccec82bbc5dda5e9437e5fcd26b63897ab307662 | refs/heads/master | 2022-02-09T15:04:19.850322 | 2022-02-07T08:01:52 | 2022-02-07T08:01:52 | 149,393,789 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 287 | c | upper.c | #include <stdio.h>
#include <string.h>
void strupper(char str[])
{
int i;
int length = strlen(str);
for (i=0;i<length;i++)
str[i]=toupper(str[i]);
printf("대문자열: %s\n",str);
}
main()
{
char str[100];
printf("문자열을 입력하세요: ");
gets(str);
strupper(str);
}
|
5f8cc62433f4664e070b99973dc77c6005c33399 | 43369807c33c0643b07033d9d4e200debe302862 | /eve_server/server_app/lib/server/example/echo_websocket_server/EIFGENs/echo_websocket_server_mt_no_ssl/W_code/C12/ar372.c | 008668caef1e0452705fdd2ca6ca03f67d1404f3 | [
"EFL-2.0"
] | permissive | jvelilla/Eiffel_Web_Server | 8ebcc06b3d81ea1bf4bba9a557ad5b753db6d0c6 | d194d75ff2322a0e195a2d23aa063943660bce75 | refs/heads/master | 2020-06-01T20:16:17.066391 | 2014-06-27T11:41:14 | 2014-06-27T11:41:14 | 21,387,371 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 167,982 | c | ar372.c | /*
* Code for class ARRAYED_LIST [INTEGER_32]
*/
#include "eif_eiffel.h"
#include "../E1/estructure.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void F372_3237(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3238(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3239(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3240(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3241(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3242(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3243(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3244(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3245(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3246(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3247(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3248(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3249(EIF_REFERENCE);
extern void F372_3250(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3251(EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3252(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3253(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3254(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3255(EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3256(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3257(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3258(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3259(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3260(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3261(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3262(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3263(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3264(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3265(EIF_REFERENCE);
extern void F372_3266(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3267(EIF_REFERENCE);
extern void F372_3268(EIF_REFERENCE);
extern void F372_3269(EIF_REFERENCE);
extern void F372_3270(EIF_REFERENCE);
extern void F372_3271(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3272(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3273(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3274(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3275(EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE);
extern void F372_3276(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3277(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3278(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3279(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3280(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3281(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3282(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3283(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3284(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3285(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3286(EIF_REFERENCE);
extern void F372_3287(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3288(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3289(EIF_REFERENCE);
extern void F372_3290(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3291(EIF_REFERENCE);
extern void F372_3292(EIF_REFERENCE);
extern void F372_3293(EIF_REFERENCE);
extern void F372_3294(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_3295(EIF_REFERENCE);
extern EIF_TYPED_VALUE F372_3296(EIF_REFERENCE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3297(EIF_REFERENCE);
extern void F372_3298(EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE);
extern void F372_3299(EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE);
extern EIF_TYPED_VALUE F372_3300(EIF_REFERENCE, EIF_TYPED_VALUE);
extern void F372_5540(EIF_REFERENCE, int);
extern void EIF_Minit372(void);
#ifdef __cplusplus
}
#endif
#include "eif_helpers.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* {ARRAYED_LIST}.make */
void F372_3237 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "make";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5953);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5953);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("valid_number_of_items", EX_PRE);
RTTE((EIF_BOOLEAN) (arg1 >= ((EIF_INTEGER_32) 0L)), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
RTHOOK(3);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
ui4_1 = arg1;
if (ui4_1< 0) {
eraise ("non_negative_argument", EN_RT_CHECK);
}
tr1 = RTLNSP2(eif_non_attached_type(RTWCT(2310, dtype, Dftype(Current))),0,ui4_1,sizeof(EIF_INTEGER_32), EIF_TRUE);
RT_SPECIAL_COUNT(tr1) = 0;
RTAR(Current, tr1);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr1;
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("correct_position", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("is_empty", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(6);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.make_filled */
void F372_3238 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "make_filled";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,tr1);
RTLR(1,Current);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5954);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5954);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("valid_number_of_items", EX_PRE);
RTTE((EIF_BOOLEAN) (arg1 >= ((EIF_INTEGER_32) 0L)), label_1);
RTCK;
RTHOOK(2);
RTCT("has_default", EX_PRE);
tr1 = RTLNTY(RTWCT(2318, dtype, Dftype(Current)));
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2802, "has_default", tr1))(tr1)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
RTHOOK(4);
tr1 = RTLNTY(RTWCT(2318, dtype, Dftype(Current)));
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2808, "default", tr1))(tr1)).it_i4);
ui4_1 = ti4_1;
ui4_2 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTWF(2312, dtype))(Current, ui4_1x, ui4_2x);
if (RTAL & CK_ENSURE) {
RTHOOK(5);
RTCT("correct_position", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(6);
RTCT("filled", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1390, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(7);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.make_from_array */
void F372_3239 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "make_from_array";
RTEX;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(4);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5955);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5955);
{
EIF_TYPE_INDEX typarr0[] = {385,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("array_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
RTHOOK(3);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area", arg1))(arg1)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTAR(Current, tr1);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr1;
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("shared", EX_POST);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2625, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area", arg1))(arg1)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
if ((EIF_BOOLEAN)(tr1 == tr2)) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("correct_position", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(6);
RTCT("filled", EX_POST);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
if ((EIF_BOOLEAN)(ti4_1 == ti4_2)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(7);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef up1
#undef up2
#undef arg1
}
/* {ARRAYED_LIST}.area */
EIF_TYPED_VALUE F372_3240 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "area";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,Result);
RTLU (SK_REF, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5956);
RTSA(Dtype(Current));
RTSC;
RTME(Dtype(Current), 0);
RTGC;
RTDBGEAA(371, Current, 5956);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0xF8000180, 0,0); /* Result */
Result = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, Dtype(Current)))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTVI(Current, RTAL);
RTRS;
RTHOOK(2);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_REF; r.it_r = Result; return r; }
#undef up1
}
/* {ARRAYED_LIST}.item */
EIF_TYPED_VALUE F372_3241 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "item";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5957);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5957);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_off", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1372, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCK;
RTHOOK(2);
RTCT("readable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1419, dtype))(Current)).it_b);
RTTE(tb1, label_2);
RTCK;
RTJB;
label_2:
RTCK;
RTHOOK(3);
RTCT("index_is_valid", EX_PRE);
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = ti4_1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2472, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_3);
RTCK;
RTJB;
label_3:
RTCF;
}
body:;
RTHOOK(4);
RTDBGAL(Current, 0, 0x10000000, 0,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(4,1);
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", tr1))(tr1, ui4_1x)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(5);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
#undef ui4_1
}
/* {ARRAYED_LIST}.i_th */
EIF_TYPED_VALUE F372_3242 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "i_th";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5958);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5958);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("valid_key", EX_PRE);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1414, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCK;
RTHOOK(2);
RTCT("valid_index", EX_PRE);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2472, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_2);
RTCK;
RTJB;
label_2:
RTCF;
}
body:;
RTHOOK(3);
RTDBGAL(Current, 0, 0x10000000, 0,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(3,1);
ui4_1 = (EIF_INTEGER_32) (arg1 - ((EIF_INTEGER_32) 1L));
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", tr1))(tr1, ui4_1x)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.at */
EIF_TYPED_VALUE F372_3243 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "at";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5959);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5959);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("valid_key", EX_PRE);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1414, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0x10000000, 0,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ui4_1 = (EIF_INTEGER_32) (arg1 - ((EIF_INTEGER_32) 1L));
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", tr1))(tr1, ui4_1x)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.first */
EIF_TYPED_VALUE F372_3244 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "first";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5960);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5960);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_empty", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0x10000000, 0,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ui4_1 = ((EIF_INTEGER_32) 0L);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", tr1))(tr1, ui4_1x)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
#undef ui4_1
}
/* {ARRAYED_LIST}.last */
EIF_TYPED_VALUE F372_3245 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "last";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5961);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5961);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_empty", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0x10000000, 0,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ui4_1 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", tr1))(tr1, ui4_1x)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
#undef ui4_1
}
/* {ARRAYED_LIST}.index */
EIF_TYPED_VALUE F372_3246 (EIF_REFERENCE Current)
{
EIF_TYPED_VALUE r;
r.type = SK_INT32;
r.it_i4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636,Dtype(Current)));
return r;
}
/* {ARRAYED_LIST}.cursor */
EIF_TYPED_VALUE F372_3247 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "cursor";
RTEX;
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(3);
RTLR(0,tr1);
RTLR(1,Current);
RTLR(2,Result);
RTLU (SK_REF, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5963);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5963);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0xF8000080, 0,0); /* Result */
tr1 = RTLN(128);
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = ti4_1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWC(1560, Dtype(tr1)))(tr1, ui4_1x);
RTNHOOK(1,1);
Result = (EIF_REFERENCE) RTCCL(tr1);
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("cursor_not_void", EX_POST);
if ((EIF_BOOLEAN)(Result != NULL)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_REF; r.it_r = Result; return r; }
#undef ui4_1
}
/* {ARRAYED_LIST}.has */
EIF_TYPED_VALUE F372_3248 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "has";
RTEX;
EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,loc1);
RTLR(1,Current);
RTLU (SK_BOOL, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_REF, &loc1);
RTLU(SK_INT32, &loc2);
RTLU(SK_INT32, &loc3);
RTEAA(l_feature_name, 371, Current, 3, 1, 5964);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5964);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 1, 0xF8000180, 0, 0); /* loc1 */
loc1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTHOOK(2);
RTDBGAL(Current, 3, 0x10000000, 1, 0); /* loc3 */
loc3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
loc3 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc3 - ((EIF_INTEGER_32) 1L));
RTHOOK(3);
tb1 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
if ((EIF_BOOLEAN) (tb1 && EIF_TRUE)) {
for (;;) {
RTHOOK(4);
if ((EIF_BOOLEAN) ((EIF_BOOLEAN) (loc2 > loc3) || Result)) break;
RTHOOK(5);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
ui4_1 = loc2;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc1))(loc1, ui4_1x)).it_i4);
Result = (EIF_BOOLEAN) (arg1 == ti4_1);
RTHOOK(6);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2++;
}
} else {
for (;;) {
RTHOOK(7);
if ((EIF_BOOLEAN) ((EIF_BOOLEAN) (loc2 > loc3) || Result)) break;
RTHOOK(8);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
ui4_1 = loc2;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc1))(loc1, ui4_1x)).it_i4);
Result = (EIF_BOOLEAN) (EIF_BOOLEAN)(arg1 == ti4_1);
RTHOOK(9);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2++;
}
}
if (RTAL & CK_ENSURE) {
RTHOOK(10);
RTCT("not_found_in_empty", EX_POST);
tb1 = '\01';
if (Result) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
tb1 = (EIF_BOOLEAN) !tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(11);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(6);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef up1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.to_array */
EIF_TYPED_VALUE F372_3249 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "to_array";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(5);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLR(3,ur1);
RTLR(4,Result);
RTLU (SK_REF, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5965);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5965);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0xF8000181, 0,0); /* Result */
{
EIF_TYPE_INDEX typarr0[] = {385,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
tr1 = RTLN(typres0);
}
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
ur1 = tr2;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWC(2541, Dtype(tr1)))(tr1, ur1x);
RTNHOOK(1,1);
Result = (EIF_REFERENCE) RTCCL(tr1);
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("to_array_attached", EX_POST);
if ((EIF_BOOLEAN)(Result != NULL)) {
RTCK;
} else {
RTCF;
}
RTHOOK(3);
RTCT("array_lower_set", EX_POST);
ti4_1 = *(EIF_INTEGER_32 *)(Result + RTVA(2544, "lower", Result));
if ((EIF_BOOLEAN)(ti4_1 == ((EIF_INTEGER_32) 1L))) {
RTCK;
} else {
RTCF;
}
RTHOOK(4);
RTCT("array_upper_set", EX_POST);
ti4_1 = *(EIF_INTEGER_32 *)(Result + RTVA(2545, "upper", Result));
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(ti4_1 == ti4_2)) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("shared_area", EX_POST);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area", Result))(Result)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2625, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
if ((EIF_BOOLEAN)(tr1 == tr2)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(6);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_REF; r.it_r = Result; return r; }
#undef up1
#undef ur1
}
/* {ARRAYED_LIST}.do_all */
void F372_3250 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "do_all";
RTEX;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(5);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,ur1);
RTLR(4,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5966);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5966);
{
EIF_TYPE_INDEX typarr0[] = {235,0xFF11,0,0xFF11,0xFFF9,1,167,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("action_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ur1 = RTCCL(arg1);
ui4_1 = ((EIF_INTEGER_32) 0L);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTNHOOK(2,2);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2377, "count", tr2))(tr2)).it_i4);
ui4_2 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2508, "do_all_in_bounds", tr1))(tr1, ur1x, ui4_1x, ui4_2x);
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.do_if */
void F372_3251 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x, EIF_TYPED_VALUE arg2x)
{
GTCX
char *l_feature_name = "do_if";
RTEX;
#define arg1 arg1x.it_r
#define arg2 arg2x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ur2x = {{0}, SK_REF};
#define ur2 ur2x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(7);
RTLR(0,arg1);
RTLR(1,arg2);
RTLR(2,Current);
RTLR(3,tr1);
RTLR(4,ur1);
RTLR(5,ur2);
RTLR(6,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU(SK_REF,&arg2);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 2, 5967);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5967);
{
EIF_TYPE_INDEX typarr0[] = {235,0xFF11,0,0xFF11,0xFFF9,1,167,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
{
EIF_TYPE_INDEX typarr0[] = {237,0xFF11,0,0xFF11,0xFFF9,1,167,0,202,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg2, 371, l_feature_name, 2, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("action_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTHOOK(2);
RTCT("test_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg2 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(3,1);
ur1 = RTCCL(arg1);
ur2 = RTCCL(arg2);
ui4_1 = ((EIF_INTEGER_32) 0L);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTNHOOK(3,2);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2377, "count", tr2))(tr2)).it_i4);
ui4_2 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2509, "do_if_in_bounds", tr1))(tr1, ur1x, ur2x, ui4_1x, ui4_2x);
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef ur2
#undef ui4_1
#undef ui4_2
#undef arg2
#undef arg1
}
/* {ARRAYED_LIST}.there_exists */
EIF_TYPED_VALUE F372_3252 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "there_exists";
RTEX;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(5);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,ur1);
RTLR(4,tr2);
RTLU (SK_BOOL, &Result);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5968);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5968);
{
EIF_TYPE_INDEX typarr0[] = {237,0xFF11,0,0xFF11,0xFFF9,1,167,0,202,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("test_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ur1 = RTCCL(arg1);
ui4_1 = ((EIF_INTEGER_32) 0L);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTNHOOK(2,2);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2377, "count", tr2))(tr2)).it_i4);
ui4_2 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2510, "there_exists_in_bounds", tr1))(tr1, ur1x, ui4_1x, ui4_2x)).it_b);
Result = (EIF_BOOLEAN) tb1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.for_all */
EIF_TYPED_VALUE F372_3253 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "for_all";
RTEX;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(5);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,ur1);
RTLR(4,tr2);
RTLU (SK_BOOL, &Result);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5969);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5969);
{
EIF_TYPE_INDEX typarr0[] = {237,0xFF11,0,0xFF11,0xFFF9,1,167,0,202,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("test_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ur1 = RTCCL(arg1);
ui4_1 = ((EIF_INTEGER_32) 0L);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTNHOOK(2,2);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2377, "count", tr2))(tr2)).it_i4);
ui4_2 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2511, "for_all_in_bounds", tr1))(tr1, ur1x, ui4_1x, ui4_2x)).it_b);
Result = (EIF_BOOLEAN) tb1;
if (RTAL & CK_ENSURE) {
RTHOOK(3);
RTCT("empty", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb2) {
tb1 = Result;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.do_all_with_index */
void F372_3254 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "do_all_with_index";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
EIF_REFERENCE loc4 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(5);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,loc4);
RTLR(3,tr1);
RTLR(4,ur1);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_INT32, &loc2);
RTLU(SK_INT32, &loc3);
RTLU(SK_REF, &loc4);
RTEAA(l_feature_name, 371, Current, 4, 1, 5970);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5970);
{
EIF_TYPE_INDEX typarr0[] = {235,0xFF11,0,0xFF11,0xFFF9,2,167,0,169,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("action_not_void", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
RTHOOK(3);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2629, dtype))(Current)).it_i4);
loc2 = (EIF_INTEGER_32) loc2;
RTHOOK(4);
RTDBGAL(Current, 3, 0x10000000, 1, 0); /* loc3 */
loc3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
loc3 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc3 - ((EIF_INTEGER_32) 1L));
RTHOOK(5);
RTDBGAL(Current, 4, 0xF8000180, 0, 0); /* loc4 */
loc4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
for (;;) {
RTHOOK(6);
if ((EIF_BOOLEAN) (loc1 > loc3)) break;
RTHOOK(7);
{
EIF_TYPE_INDEX typarr0[] = {0xFFF9,2,167,0,169,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[3] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
tr1 = RTLNTS(typres0, 3, 0);
}
ui4_1 = loc1;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc4))(loc4, ui4_1x)).it_i4);
((EIF_TYPED_VALUE *)tr1+1)->it_i4 = ti4_1;
((EIF_TYPED_VALUE *)tr1+2)->it_i4 = loc2;
ur1 = RTCCL(tr1);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(3563, "call", arg1))(arg1, ur1x);
RTHOOK(8);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2++;
RTHOOK(9);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1++;
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(10);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(7);
RTEE;
#undef up1
#undef ur1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.do_if_with_index */
void F372_3255 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x, EIF_TYPED_VALUE arg2x)
{
GTCX
char *l_feature_name = "do_if_with_index";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
EIF_REFERENCE loc4 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_r
#define arg2 arg2x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCFDT;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(6);
RTLR(0,arg1);
RTLR(1,arg2);
RTLR(2,Current);
RTLR(3,loc4);
RTLR(4,tr1);
RTLR(5,ur1);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU(SK_REF,&arg2);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_INT32, &loc2);
RTLU(SK_INT32, &loc3);
RTLU(SK_REF, &loc4);
RTEAA(l_feature_name, 371, Current, 4, 2, 5971);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5971);
{
EIF_TYPE_INDEX typarr0[] = {235,0xFF11,0,0xFF11,0xFFF9,2,167,0,169,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
{
EIF_TYPE_INDEX typarr0[] = {237,0xFF11,0,0xFF11,0xFFF9,2,167,0,169,202,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[7] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
RTCC(arg2, 371, l_feature_name, 2, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("action_not_void", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTHOOK(2);
RTCT("test_not_void", EX_PRE);
RTTE((EIF_BOOLEAN)(arg2 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
RTHOOK(4);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2629, dtype))(Current)).it_i4);
loc2 = (EIF_INTEGER_32) loc2;
RTHOOK(5);
RTDBGAL(Current, 3, 0x10000000, 1, 0); /* loc3 */
loc3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
loc3 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc3 - ((EIF_INTEGER_32) 1L));
RTHOOK(6);
RTDBGAL(Current, 4, 0xF8000180, 0, 0); /* loc4 */
loc4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
for (;;) {
RTHOOK(7);
if ((EIF_BOOLEAN) (loc1 > loc3)) break;
RTHOOK(8);
{
EIF_TYPE_INDEX typarr0[] = {0xFFF9,2,167,0,169,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[3] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
tr1 = RTLNTS(typres0, 3, 0);
}
ui4_1 = loc1;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc4))(loc4, ui4_1x)).it_i4);
((EIF_TYPED_VALUE *)tr1+1)->it_i4 = ti4_1;
((EIF_TYPED_VALUE *)tr1+2)->it_i4 = loc2;
ur1 = RTCCL(tr1);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(3590, "item", arg2))(arg2, ur1x)).it_b);
if (tb1) {
RTHOOK(9);
{
EIF_TYPE_INDEX typarr0[] = {0xFFF9,2,167,0,169,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[3] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
tr1 = RTLNTS(typres0, 3, 0);
}
ui4_1 = loc1;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc4))(loc4, ui4_1x)).it_i4);
((EIF_TYPED_VALUE *)tr1+1)->it_i4 = ti4_1;
((EIF_TYPED_VALUE *)tr1+2)->it_i4 = loc2;
ur1 = RTCCL(tr1);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(3563, "call", arg1))(arg1, ur1x);
}
RTHOOK(10);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2++;
RTHOOK(11);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1++;
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(12);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(8);
RTEE;
#undef up1
#undef ur1
#undef ui4_1
#undef arg2
#undef arg1
}
/* {ARRAYED_LIST}.lower */
EIF_TYPED_VALUE F372_3256 (EIF_REFERENCE Current)
{
EIF_TYPED_VALUE r;
r.type = SK_INT32;
r.it_i4 = (EIF_INTEGER_32) ((EIF_INTEGER_32) 1L);
return r;
}
/* {ARRAYED_LIST}.upper */
EIF_TYPED_VALUE F372_3257 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "upper";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5973);
RTSA(Dtype(Current));
RTSC;
RTME(Dtype(Current), 0);
RTGC;
RTDBGEAA(371, Current, 5973);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0x10000000, 1,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, Dtype(Current)))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2377, "count", tr1))(tr1)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(2);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
}
/* {ARRAYED_LIST}.count */
EIF_TYPED_VALUE F372_3258 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "count";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5974);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5974);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0x10000000, 1,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2377, "count", tr1))(tr1)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("count_non_negative", EX_POST);
if ((EIF_BOOLEAN) (Result >= ((EIF_INTEGER_32) 0L))) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
}
/* {ARRAYED_LIST}.capacity */
EIF_TYPED_VALUE F372_3259 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "capacity";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 Result = ((EIF_INTEGER_32) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_INT32, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5975);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5975);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0x10000000, 1,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", tr1))(tr1)).it_i4);
Result = (EIF_INTEGER_32) ti4_1;
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("capacity_non_negative", EX_POST);
if ((EIF_BOOLEAN) (Result >= ((EIF_INTEGER_32) 0L))) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_INT32; r.it_i4 = Result; return r; }
#undef up1
}
/* {ARRAYED_LIST}.is_equal */
EIF_TYPED_VALUE F372_3260 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "is_equal";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_REFERENCE tr4 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN tb3;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(7);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,tr2);
RTLR(4,tr3);
RTLR(5,tr4);
RTLR(6,ur1);
RTLU (SK_BOOL, &Result);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTEAA(l_feature_name, 371, Current, 1, 1, 5911);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5911);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(Dftype(Current)));
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("other_not_void", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(arg1 + RTVA(2636, "index", arg1));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
if (RTCEQ(arg1, Current)) {
RTHOOK(3);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
Result = (EIF_BOOLEAN) (EIF_BOOLEAN) 1;
} else {
RTHOOK(4);
tb1 = '\0';
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
if ((EIF_BOOLEAN)(ti4_3 == ti4_4)) {
tb2 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
tb3 = *(EIF_BOOLEAN *)(arg1 + RTVA(1365, "object_comparison", arg1));
tb1 = (EIF_BOOLEAN)(tb2 == tb3);
}
if (tb1) {
RTHOOK(5);
tb1 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
if (tb1) {
RTHOOK(6);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
Result = (EIF_BOOLEAN) (EIF_BOOLEAN) 1;
RTHOOK(7);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2629, dtype))(Current)).it_i4);
loc1 = (EIF_INTEGER_32) loc1;
for (;;) {
RTHOOK(8);
tb1 = '\01';
if (!(EIF_BOOLEAN) !Result) {
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2630, dtype))(Current)).it_i4);
tb1 = (EIF_BOOLEAN) (loc1 > ti4_3);
}
if (tb1) break;
RTHOOK(9);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
ui4_1 = loc1;
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1412, dtype))(Current, ui4_1x)).it_i4);
ui4_1 = loc1;
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(1412, "i_th", arg1))(arg1, ui4_1x)).it_i4);
Result = (EIF_BOOLEAN) (ti4_3 == ti4_4);
RTHOOK(10);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1++;
}
} else {
RTHOOK(11);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
tr3 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(11,1);
tr4 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area_v2", arg1))(arg1)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
ur1 = tr4;
ui4_1 = ((EIF_INTEGER_32) 0L);
ui4_2 = ((EIF_INTEGER_32) 0L);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ui4_3 = ti4_3;
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2485, "same_items", tr3))(tr3, ur1x, ui4_1x, ui4_2x, ui4_3x)).it_b);
Result = (EIF_BOOLEAN) tb2;
}
}
}
if (RTAL & CK_ENSURE) {
RTHOOK(12);
RTCT("symmetric", EX_POST);
if ((!(Result) || (RTEQ(arg1, Current)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(13);
RTCT("consistent", EX_POST);
tb2 = '\01';
ur1 = RTCCL(arg1);
tb3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(12, dtype))(Current, ur1x)).it_b);
if (tb3) {
tb2 = Result;
}
if (tb2) {
RTCK;
} else {
RTCF;
}
RTHOOK(14);
RTCT("indices_unchanged", EX_POST);
tb2 = '\0';
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == ti4_1)) {
ti4_3 = *(EIF_INTEGER_32 *)(arg1 + RTVA(2636, "index", arg1));
RTCO(tr2);
tb2 = (EIF_BOOLEAN)(ti4_3 == ti4_2);
}
if (tb2) {
RTCK;
} else {
RTCF;
}
RTHOOK(15);
RTCT("true_implies_same_size", EX_POST);
tb2 = '\01';
if (Result) {
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
tb2 = (EIF_BOOLEAN)(ti4_3 == ti4_4);
}
if (tb2) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(16);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
#undef ui4_3
#undef arg1
}
/* {ARRAYED_LIST}.prunable */
EIF_TYPED_VALUE F372_3261 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "prunable";
RTEX;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTSN;
RTDA;
RTLD;
RTLI(1);
RTLR(0,Current);
RTLU (SK_BOOL, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5912);
RTSA(Dtype(Current));
RTSC;
RTME(Dtype(Current), 0);
RTGC;
RTDBGEAA(371, Current, 5912);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
Result = (EIF_BOOLEAN) (EIF_BOOLEAN) 1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(2);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
}
/* {ARRAYED_LIST}.valid_cursor */
EIF_TYPED_VALUE F372_3262 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "valid_cursor";
RTEX;
EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTSN;
RTDA;
RTLD;
RTLI(3);
RTLR(0,arg1);
RTLR(1,loc1);
RTLR(2,Current);
RTLU (SK_BOOL, &Result);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_REF, &loc1);
RTEAA(l_feature_name, 371, Current, 1, 1, 5913);
RTSA(Dtype(Current));
RTSC;
RTME(Dtype(Current), 0);
RTGC;
RTDBGEAA(371, Current, 5913);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(126));
RTIV(Current, RTAL);
RTHOOK(1);
loc1 = RTCCL(arg1);
loc1 = RTRV(eif_non_attached_type(128),loc1);
if (EIF_TEST(loc1)) {
RTHOOK(2);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
ti4_1 = *(EIF_INTEGER_32 *)(loc1 + RTVA(1561, "index", loc1));
ui4_1 = ti4_1;
Result = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2581, Dtype(Current)))(Current, ui4_1x)).it_b);
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.valid_index */
EIF_TYPED_VALUE F372_3263 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "valid_index";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_BOOL, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5914);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5914);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
tb1 = '\0';
if ((EIF_BOOLEAN) (((EIF_INTEGER_32) 1L) <= arg1)) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
tb1 = (EIF_BOOLEAN) (arg1 <= ti4_1);
}
Result = (EIF_BOOLEAN) tb1;
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("only_if_in_index_set", EX_POST);
tb1 = '\01';
if (Result) {
tb2 = '\0';
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2471, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2520, "lower", tr1))(tr1)).it_i4);
if ((EIF_BOOLEAN) (arg1 >= ti4_1)) {
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2471, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,2);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2522, "upper", tr1))(tr1)).it_i4);
tb2 = (EIF_BOOLEAN) (arg1 <= ti4_1);
}
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(3);
RTCT("valid_index_definition", EX_POST);
tb1 = '\0';
if ((EIF_BOOLEAN) (arg1 >= ((EIF_INTEGER_32) 1L))) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
tb1 = (EIF_BOOLEAN) (arg1 <= ti4_1);
}
if ((EIF_BOOLEAN)(Result == tb1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef up1
#undef arg1
}
/* {ARRAYED_LIST}.is_inserted */
EIF_TYPED_VALUE F372_3264 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "is_inserted";
RTEX;
#define arg1 arg1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN tb3;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(1);
RTLR(0,Current);
RTLU (SK_BOOL, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5915);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5915);
RTIV(Current, RTAL);
RTHOOK(1);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb1) {
RTHOOK(2);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
tb1 = '\01';
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2576, dtype))(Current)).it_i4);
if (!((EIF_BOOLEAN)(arg1 == ti4_1))) {
tb2 = '\0';
tb3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1372, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb3) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
tb2 = (EIF_BOOLEAN)(arg1 == ti4_1);
}
tb1 = tb2;
}
Result = (EIF_BOOLEAN) tb1;
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef arg1
}
/* {ARRAYED_LIST}.all_default */
EIF_TYPED_VALUE F372_3265 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "all_default";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
EIF_BOOLEAN Result = ((EIF_BOOLEAN) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(3);
RTLR(0,tr1);
RTLR(1,Current);
RTLR(2,tr2);
RTLU (SK_BOOL, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5916);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5916);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("has_default", EX_PRE);
tr1 = RTLNTY(RTWCT(2318, dtype, Dftype(Current)));
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2802, "has_default", tr1))(tr1)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0x04000000, 1,0); /* Result */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
tr2 = RTLNTY(RTWCT(2318, dtype, Dftype(Current)));
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2808, "default", tr2))(tr2)).it_i4);
ui4_1 = ti4_1;
ui4_2 = ((EIF_INTEGER_32) 0L);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTNHOOK(2,2);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2483, "upper", tr2))(tr2)).it_i4);
ui4_3 = ti4_2;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2484, "filled_with", tr1))(tr1, ui4_1x, ui4_2x, ui4_3x)).it_b);
Result = (EIF_BOOLEAN) tb1;
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_BOOL; r.it_b = Result; return r; }
#undef up1
#undef up2
#undef ui4_1
#undef ui4_2
#undef ui4_3
}
/* {ARRAYED_LIST}.move */
void F372_3266 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "move";
RTEX;
#define arg1 arg1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
EIF_INTEGER_32 ti4_5;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(4);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLR(3,tr3);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5917);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5917);
RTIV(Current, RTAL);
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
RTE_OT
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_3 = ti4_4;
tr3 = NULL;
RTE_O
tr3 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(1);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype))) += arg1;
RTHOOK(2);
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_5 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) (ti4_4 > (EIF_INTEGER_32) (ti4_5 + ((EIF_INTEGER_32) 1L)))) {
RTHOOK(3);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) (EIF_INTEGER_32) (ti4_4 + ((EIF_INTEGER_32) 1L));
} else {
RTHOOK(4);
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
if ((EIF_BOOLEAN) (ti4_4 < ((EIF_INTEGER_32) 0L))) {
RTHOOK(5);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
}
}
if (RTAL & CK_ENSURE) {
RTHOOK(6);
RTCT("too_far_right", EX_POST);
tb1 = '\01';
RTCO(tr1);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) ((EIF_INTEGER_32) (ti4_1 + arg1) > ti4_4)) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1383, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(7);
RTCT("too_far_left", EX_POST);
tb1 = '\01';
RTCO(tr2);
if ((EIF_BOOLEAN) ((EIF_INTEGER_32) (ti4_2 + arg1) < ((EIF_INTEGER_32) 1L))) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1383, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(8);
RTCT("expected_index", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1383, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb2) {
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr3);
tb1 = (EIF_BOOLEAN)(ti4_4 == (EIF_INTEGER_32) (ti4_3 + arg1));
}
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(9);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef arg1
}
/* {ARRAYED_LIST}.start */
void F372_3267 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "start";
RTEX;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5918);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5918);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 1L);
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("at_first", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2579, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(3);
RTCT("after_when_empty", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
}
/* {ARRAYED_LIST}.finish */
void F372_3268 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "finish";
RTEX;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5919);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5919);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ti4_1;
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("at_last", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2580, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(3);
RTCT("before_when_empty", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
}
/* {ARRAYED_LIST}.forth */
void F372_3269 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "forth";
RTEX;
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5920);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5920);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_after", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))++;
if (RTAL & CK_ENSURE) {
RTHOOK(3);
RTCT("moved_forth", EX_POST);
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_2 == (EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
}
/* {ARRAYED_LIST}.back */
void F372_3270 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "back";
RTEX;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5921);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5921);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_before", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))--;
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
}
/* {ARRAYED_LIST}.go_i_th */
void F372_3271 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "go_i_th";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5922);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5922);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("valid_cursor_index", EX_PRE);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2581, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) arg1;
if (RTAL & CK_ENSURE) {
RTHOOK(3);
RTCT("position_expected", EX_POST);
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
if ((EIF_BOOLEAN)(ti4_1 == arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.go_to */
void F372_3272 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "go_to";
RTEX;
EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(4);
RTLR(0,arg1);
RTLR(1,ur1);
RTLR(2,Current);
RTLR(3,loc1);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_REF, &loc1);
RTEAA(l_feature_name, 371, Current, 1, 1, 5923);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5923);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(126));
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("cursor_position_valid", EX_PRE);
ur1 = RTCCL(arg1);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1436, dtype))(Current, ur1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
loc1 = RTCCL(arg1);
loc1 = RTRV(eif_non_attached_type(128),loc1);
if (EIF_TEST(loc1)) {
RTHOOK(3);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
ti4_1 = *(EIF_INTEGER_32 *)(loc1 + RTVA(1561, "index", loc1));
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ti4_1;
} else {
if (RTAL & CK_CHECK) {
RTHOOK(4);
RTCT("correct_cursor_type", EX_CHECK);
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(5);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
#undef ur1
#undef arg1
}
/* {ARRAYED_LIST}.search */
void F372_3273 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "search";
RTEX;
EIF_REFERENCE loc1 = (EIF_REFERENCE) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
EIF_BOOLEAN loc4 = (EIF_BOOLEAN) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN tb3;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,loc1);
RTLR(1,Current);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_REF, &loc1);
RTLU(SK_INT32, &loc2);
RTLU(SK_INT32, &loc3);
RTLU(SK_BOOL, &loc4);
RTEAA(l_feature_name, 371, Current, 4, 1, 5924);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5924);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 1, 0xF8000180, 0, 0); /* loc1 */
loc1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTHOOK(2);
RTDBGAL(Current, 3, 0x10000000, 1, 0); /* loc3 */
loc3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
loc3 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc3 - ((EIF_INTEGER_32) 1L));
RTHOOK(3);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = ((EIF_INTEGER_32) 0L);
ti4_2 = eif_max_int32 ((EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L)),ui4_1);
loc2 = (EIF_INTEGER_32) ti4_2;
RTHOOK(4);
tb1 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
if ((EIF_BOOLEAN) (tb1 && EIF_TRUE)) {
for (;;) {
RTHOOK(5);
if ((EIF_BOOLEAN) ((EIF_BOOLEAN) (loc2 > loc3) || loc4)) break;
RTHOOK(6);
RTDBGAL(Current, 4, 0x04000000, 1, 0); /* loc4 */
ui4_1 = loc2;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc1))(loc1, ui4_1x)).it_i4);
loc4 = (EIF_BOOLEAN) (arg1 == ti4_1);
RTHOOK(7);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2++;
}
} else {
for (;;) {
RTHOOK(8);
if ((EIF_BOOLEAN) ((EIF_BOOLEAN) (loc2 > loc3) || loc4)) break;
RTHOOK(9);
RTDBGAL(Current, 4, 0x04000000, 1, 0); /* loc4 */
ui4_1 = loc2;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc1))(loc1, ui4_1x)).it_i4);
loc4 = (EIF_BOOLEAN) (EIF_BOOLEAN)(arg1 == ti4_1);
RTHOOK(10);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2++;
}
}
RTHOOK(11);
if (loc4) {
RTHOOK(12);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) loc2;
} else {
RTHOOK(13);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc2 + ((EIF_INTEGER_32) 1L));
}
if (RTAL & CK_ENSURE) {
RTHOOK(14);
RTCT("object_found", EX_POST);
tb1 = '\01';
tb2 = '\0';
tb3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1383, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb3) {
tb3 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
tb2 = tb3;
}
if (tb2) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1371, dtype))(Current)).it_i4);
tb1 = (arg1 == ti4_1);
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(15);
RTCT("item_found", EX_POST);
tb1 = '\01';
tb2 = '\0';
tb3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1383, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb3) {
tb3 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
tb2 = (EIF_BOOLEAN) !tb3;
}
if (tb2) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1371, dtype))(Current)).it_i4);
tb1 = (EIF_BOOLEAN)(arg1 == ti4_1);
}
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(16);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(7);
RTEE;
#undef up1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.put_front */
void F372_3274 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "put_front";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5925);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5925);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb1) {
RTHOOK(3);
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1405, dtype))(Current, ui4_1x);
} else {
RTHOOK(4);
ui4_1 = arg1;
ui4_2 = ((EIF_INTEGER_32) 1L);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTWF(2634, dtype))(Current, ui4_1x, ui4_2x);
}
RTHOOK(5);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))++;
if (RTAL & CK_ENSURE) {
RTHOOK(6);
RTCT("new_count", EX_POST);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_2 == (EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(7);
RTCT("item_inserted", EX_POST);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2575, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(ti4_2 == arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(8);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.put_i_th */
void F372_3275 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x, EIF_TYPED_VALUE arg2x)
{
GTCX
char *l_feature_name = "put_i_th";
RTEX;
#define arg1 arg1x.it_i4
#define arg2 arg2x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg2x.type & SK_HEAD) == SK_REF) arg2x.it_i4 = * (EIF_INTEGER_32 *) arg2x.it_r;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU(SK_INT32,&arg2);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 2, 5926);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5926);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("valid_key", EX_PRE);
ui4_1 = arg2;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1414, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCK;
RTHOOK(2);
RTCT("valid_key", EX_PRE);
ui4_1 = arg2;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1414, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_2);
RTCK;
RTJB;
label_2:
RTCF;
}
body:;
RTHOOK(3);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(3,1);
ui4_1 = arg1;
ui4_2 = (EIF_INTEGER_32) (arg2 - ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2486, "put", tr1))(tr1, ui4_1x, ui4_2x);
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("inserted", EX_POST);
ui4_1 = arg2;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1412, dtype))(Current, ui4_1x)).it_i4);
if ((EIF_BOOLEAN)(ti4_1 == arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(5);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
#undef up1
#undef ui4_1
#undef ui4_2
#undef arg2
#undef arg1
}
/* {ARRAYED_LIST}.force */
void F372_3276 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "force";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_REFERENCE loc2 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(4);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,loc2);
RTLR(3,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_REF, &loc2);
RTEAA(l_feature_name, 371, Current, 2, 1, 5927);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5927);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
loc1 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc1 + ((EIF_INTEGER_32) 1L));
RTHOOK(3);
RTDBGAL(Current, 2, 0xF8000180, 0, 0); /* loc2 */
loc2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTHOOK(4);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", loc2))(loc2)).it_i4);
if ((EIF_BOOLEAN) (loc1 > ti4_2)) {
RTHOOK(5);
RTDBGAL(Current, 2, 0xF8000180, 0, 0); /* loc2 */
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1397, dtype))(Current)).it_i4);
ui4_1 = (EIF_INTEGER_32) (loc1 + ti4_2);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2503, "aliased_resized_area", loc2))(loc2, ui4_1x)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
loc2 = (EIF_REFERENCE) tr2;
RTHOOK(6);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
RTAR(Current, loc2);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) loc2;
}
RTHOOK(7);
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2488, "extend", loc2))(loc2, ui4_1x);
if (RTAL & CK_ENSURE) {
RTHOOK(8);
RTCT("new_count", EX_POST);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_2 == (EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(9);
RTCT("item_inserted", EX_POST);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1362, dtype))(Current, ui4_1x)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(10);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(5);
RTEE;
#undef up1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.extend */
void F372_3277 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "extend";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_REFERENCE loc2 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(3);
RTLR(0,Current);
RTLR(1,loc2);
RTLR(2,tr1);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_REF, &loc2);
RTEAA(l_feature_name, 371, Current, 2, 1, 5928);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5928);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
loc1 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc1 + ((EIF_INTEGER_32) 1L));
RTHOOK(3);
RTDBGAL(Current, 2, 0xF8000180, 0, 0); /* loc2 */
loc2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTHOOK(4);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", loc2))(loc2)).it_i4);
if ((EIF_BOOLEAN) (loc1 > ti4_1)) {
RTHOOK(5);
RTDBGAL(Current, 2, 0xF8000180, 0, 0); /* loc2 */
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1397, dtype))(Current)).it_i4);
ui4_1 = (EIF_INTEGER_32) (loc1 + ti4_1);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2503, "aliased_resized_area", loc2))(loc2, ui4_1x)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
loc2 = (EIF_REFERENCE) tr1;
RTHOOK(6);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
RTAR(Current, loc2);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) loc2;
}
RTHOOK(7);
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2488, "extend", loc2))(loc2, ui4_1x);
if (RTAL & CK_ENSURE) {
RTHOOK(8);
RTCT("item_inserted", EX_POST);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1403, dtype))(Current, ui4_1x)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(9);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(5);
RTEE;
#undef up1
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.put_left */
void F372_3278 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "put_left";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5929);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5929);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("not_before", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(3);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
if (!tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTHOOK(4);
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1405, dtype))(Current, ui4_1x);
} else {
RTHOOK(5);
ui4_1 = arg1;
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_2 = ti4_3;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTWF(2634, dtype))(Current, ui4_1x, ui4_2x);
}
RTHOOK(6);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))++;
if (RTAL & CK_ENSURE) {
RTHOOK(7);
RTCT("new_count", EX_POST);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(8);
RTCT("new_index", EX_POST);
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_2 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(9);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.put_right */
void F372_3279 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "put_right";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5930);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5930);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("not_after", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(3);
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(ti4_3 == ti4_4)) {
RTHOOK(4);
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1405, dtype))(Current, ui4_1x);
} else {
RTHOOK(5);
ui4_1 = arg1;
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_2 = (EIF_INTEGER_32) (ti4_3 + ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTWF(2634, dtype))(Current, ui4_1x, ui4_2x);
}
if (RTAL & CK_ENSURE) {
RTHOOK(6);
RTCT("new_count", EX_POST);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(7);
RTCT("same_index", EX_POST);
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_3 == ti4_2)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(8);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.replace */
void F372_3280 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "replace";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5931);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5931);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("writable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1420, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("replaceable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1421, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
ui4_1 = arg1;
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_2 = ti4_1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTWF(1415, dtype))(Current, ui4_1x, ui4_2x);
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("item_replaced", EX_POST);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(ti4_1 == arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(5);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.merge_left */
void F372_3281 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "merge_left";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_REFERENCE tr4 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
EIF_INTEGER_32 ti4_5;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(7);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,tr2);
RTLR(4,tr3);
RTLR(5,tr4);
RTLR(6,ur1);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_INT32, &loc2);
RTEAA(l_feature_name, 371, Current, 2, 1, 5932);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5932);
{
EIF_TYPE_INDEX typarr0[] = {371,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("not_before", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTHOOK(3);
RTCT("other_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTHOOK(4);
RTCT("not_current", EX_PRE);
RTTE(!RTCEQ(arg1, Current), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
RTE_OT
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_3 = ti4_4;
tr3 = NULL;
RTE_O
tr3 = RTLA;
RTE_OE
RTE_OT
ti4_5 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
ti4_4 = ti4_5;
tr4 = NULL;
RTE_O
tr4 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(5);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTHOOK(6);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
ti4_5 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
loc2 = (EIF_INTEGER_32) ti4_5;
RTHOOK(7);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))--;
RTHOOK(8);
ur1 = RTCCL(arg1);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2593, dtype))(Current, ur1x);
RTHOOK(9);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc1 + loc2);
if (RTAL & CK_ENSURE) {
RTHOOK(10);
RTCT("new_count", EX_POST);
ti4_5 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_5 == (EIF_INTEGER_32) (ti4_1 + ti4_2))) {
RTCK;
} else {
RTCF;
}
RTHOOK(11);
RTCT("new_index", EX_POST);
ti4_5 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr3);
RTCO(tr4);
if ((EIF_BOOLEAN)(ti4_5 == (EIF_INTEGER_32) (ti4_3 + ti4_4))) {
RTCK;
} else {
RTCF;
}
RTHOOK(12);
RTCT("other_is_empty", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1363, "is_empty", arg1))(arg1)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(13);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(5);
RTEE;
#undef ur1
#undef arg1
}
/* {ARRAYED_LIST}.merge_right */
void F372_3282 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "merge_right";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_REFERENCE tr4 = NULL;
EIF_REFERENCE tr5 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
EIF_INTEGER_32 ti4_5;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(8);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,tr2);
RTLR(4,tr3);
RTLR(5,tr4);
RTLR(6,tr5);
RTLR(7,ur1);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_INT32, &loc2);
RTEAA(l_feature_name, 371, Current, 2, 1, 5933);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5933);
{
EIF_TYPE_INDEX typarr0[] = {371,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, Dftype(Current));
typres0 = eif_compound_id(Dftype(Current), typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("extendible", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1401, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("not_after", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTHOOK(3);
RTCT("other_exists", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTHOOK(4);
RTCT("not_current", EX_PRE);
RTTE(!RTCEQ(arg1, Current), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
RTE_OT
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_3 = ti4_4;
tr3 = NULL;
RTE_O
tr3 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(5);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1363, "is_empty", arg1))(arg1)).it_b);
if ((EIF_BOOLEAN) !tb1) {
RTHOOK(6);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTHOOK(7);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
loc1 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc2 + ti4_4);
RTHOOK(8);
tr4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(8,1);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", tr4))(tr4)).it_i4);
if ((EIF_BOOLEAN) (loc1 > ti4_4)) {
RTHOOK(9);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
tr4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(9,1);
ui4_1 = loc1;
tr5 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2503, "aliased_resized_area", tr4))(tr4, ui4_1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTAR(Current, tr5);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr5;
}
RTHOOK(10);
tr4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(10,1);
tr5 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area_v2", arg1))(arg1)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
ur1 = tr5;
ui4_1 = ((EIF_INTEGER_32) 0L);
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_2 = ti4_4;
ti4_5 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", arg1))(arg1)).it_i4);
ui4_3 = ti4_5;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2492, "insert_data", tr4))(tr4, ur1x, ui4_1x, ui4_2x, ui4_3x);
RTHOOK(11);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTVF(1409, "wipe_out", arg1))(arg1);
}
if (RTAL & CK_ENSURE) {
RTHOOK(12);
RTCT("new_count", EX_POST);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_4 == (EIF_INTEGER_32) (ti4_1 + ti4_2))) {
RTCK;
} else {
RTCF;
}
RTHOOK(13);
RTCT("same_index", EX_POST);
ti4_4 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr3);
if ((EIF_BOOLEAN)(ti4_4 == ti4_3)) {
RTCK;
} else {
RTCF;
}
RTHOOK(14);
RTCT("other_is_empty", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1363, "is_empty", arg1))(arg1)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(15);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(5);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
#undef ui4_3
#undef arg1
}
/* {ARRAYED_LIST}.append */
void F372_3283 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "append";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
EIF_REFERENCE loc4 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
RTCFDT;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(7);
RTLR(0,arg1);
RTLR(1,Current);
RTLR(2,tr1);
RTLR(3,loc4);
RTLR(4,tr2);
RTLR(5,tr3);
RTLR(6,ur1);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_INT32, &loc2);
RTLU(SK_INT32, &loc3);
RTLU(SK_REF, &loc4);
RTEAA(l_feature_name, 371, Current, 4, 1, 5934);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5934);
{
EIF_TYPE_INDEX typarr0[] = {378,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(typres0));
}
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("argument_not_void", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
loc4 = RTCCL(arg1);
{
EIF_TYPE_INDEX typarr0[] = {371,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
loc4 = RTRV(eif_non_attached_type(typres0),loc4);
}
if (EIF_TEST(loc4)) {
RTHOOK(3);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", loc4))(loc4)).it_i4);
loc1 = (EIF_INTEGER_32) ti4_2;
RTHOOK(4);
if ((EIF_BOOLEAN) (loc1 > ((EIF_INTEGER_32) 0L))) {
RTHOOK(5);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTHOOK(6);
RTDBGAL(Current, 3, 0x10000000, 1, 0); /* loc3 */
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", loc4))(loc4)).it_i4);
loc3 = (EIF_INTEGER_32) (EIF_INTEGER_32) (loc2 + ti4_2);
RTHOOK(7);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(7,1);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", tr2))(tr2)).it_i4);
if ((EIF_BOOLEAN) (loc3 > ti4_2)) {
RTHOOK(8);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(8,1);
ui4_1 = loc3;
tr3 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2503, "aliased_resized_area", tr2))(tr2, ui4_1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTAR(Current, tr3);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr3;
}
RTHOOK(9);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(9,1);
tr3 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area_v2", loc4))(loc4)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
ur1 = tr3;
ui4_1 = ((EIF_INTEGER_32) 0L);
ui4_2 = loc2;
ui4_3 = loc1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2493, "copy_data", tr2))(tr2, ur1x, ui4_1x, ui4_2x, ui4_3x);
}
} else {
RTHOOK(10);
ur1 = RTCCL(arg1);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1439, 372))(Current, ur1x);
}
if (RTAL & CK_ENSURE) {
RTHOOK(11);
RTCT("new_count", EX_POST);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN) (ti4_2 >= ti4_1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(12);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(7);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
#undef ui4_3
#undef arg1
}
/* {ARRAYED_LIST}.grow */
void F372_3284 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "grow";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5935);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5935);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("resizable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1394, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", tr1))(tr1)).it_i4);
if ((EIF_BOOLEAN) (arg1 > ti4_1)) {
RTHOOK(3);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(3,1);
ui4_1 = arg1;
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2503, "aliased_resized_area", tr1))(tr1, ui4_1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTAR(Current, tr2);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr2;
}
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("new_capacity", EX_POST);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1393, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) (ti4_1 >= arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(5);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef up1
#undef up2
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.resize */
void F372_3285 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "resize";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5936);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5936);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("resizable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1394, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("new_capacity_large_enough", EX_PRE);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1393, dtype))(Current)).it_i4);
RTTE((EIF_BOOLEAN) (arg1 >= ti4_1), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1399, dtype))(Current, ui4_1x);
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("capacity_set", EX_POST);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1393, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) (ti4_1 >= arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(5);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}.trim */
void F372_3286 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "trim";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_REFERENCE tr4 = NULL;
EIF_REFERENCE tr5 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(7);
RTLR(0,tr1);
RTLR(1,Current);
RTLR(2,tr2);
RTLR(3,tr3);
RTLR(4,tr4);
RTLR(5,tr5);
RTLR(6,ur1);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTEAA(l_feature_name, 371, Current, 1, 0, 5937);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5937);
RTIV(Current, RTAL);
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2626, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
tr1 = tr2;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr3 = NULL;
RTE_O
tr3 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(1);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTHOOK(2);
tr4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2378, "capacity", tr4))(tr4)).it_i4);
if ((EIF_BOOLEAN) (loc1 < ti4_2)) {
RTHOOK(3);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
tr4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(3,1);
ui4_1 = loc1;
tr5 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2503, "aliased_resized_area", tr4))(tr4, ui4_1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
RTAR(Current, tr5);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr5;
}
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("same_count", EX_POST);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr3);
if ((EIF_BOOLEAN)(ti4_2 == ti4_1)) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("minimal_capacity", EX_POST);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1393, dtype))(Current)).it_i4);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(ti4_2 == ti4_3)) {
RTCK;
} else {
RTCF;
}
RTHOOK(6);
RTCT("same_items", EX_POST);
tr4 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2626, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(6,1);
RTCO(tr2);
ur1 = RTCCL(tr1);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2548, "same_items", tr4))(tr4, ur1x)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(7);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef ui4_1
}
/* {ARRAYED_LIST}.copy */
void F372_3287 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "copy";
RTEX;
#define arg1 arg1x.it_r
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(5);
RTLR(0,arg1);
RTLR(1,ur1);
RTLR(2,Current);
RTLR(3,tr1);
RTLR(4,tr2);
RTLU (SK_VOID, NULL);
RTLU(SK_REF,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5938);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5938);
RTCC(arg1, 371, l_feature_name, 1, eif_attached_type(Dftype(Current)));
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("other_not_void", EX_PRE);
RTTE((EIF_BOOLEAN)(arg1 != NULL), label_1);
RTCK;
RTHOOK(2);
RTCT("type_identity", EX_PRE);
ur1 = RTCCL(arg1);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(10, dtype))(Current, ur1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
if (!RTCEQ(arg1, Current)) {
RTHOOK(4);
ur1 = RTCCL(arg1);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(19, dtype))(Current, ur1x);
RTHOOK(5);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area_v2", arg1))(arg1)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(5,1);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(17, "twin", tr1))(tr1)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
ur1 = tr2;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2317, dtype))(Current, ur1x);
}
if (RTAL & CK_ENSURE) {
RTHOOK(6);
RTCT("is_equal", EX_POST);
if (RTEQ(Current, arg1)) {
RTCK;
} else {
RTCF;
}
RTHOOK(7);
RTCT("equal_areas", EX_POST);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area_v2", arg1))(arg1)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
if (RTEQ(tr1, tr2)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(8);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef arg1
}
/* {ARRAYED_LIST}.prune */
void F372_3288 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "prune";
RTEX;
#define arg1 arg1x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN tb3;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5939);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5939);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("prunable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1402, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
if (tb1) {
RTHOOK(3);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 1L);
}
RTHOOK(4);
tb1 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
if (tb1) {
for (;;) {
RTHOOK(5);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
if (!tb2) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
tb1 = (ti4_1 == arg1);
}
if (tb1) break;
RTHOOK(6);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTWF(1386, dtype))(Current);
}
} else {
for (;;) {
RTHOOK(7);
tb2 = '\01';
tb3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
if (!tb3) {
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
tb2 = (EIF_BOOLEAN)(ti4_1 == arg1);
}
if (tb2) break;
RTHOOK(8);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTWF(1386, dtype))(Current);
}
}
RTHOOK(9);
tb3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
if ((EIF_BOOLEAN) !tb3) {
RTHOOK(10);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTWF(1423, dtype))(Current);
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(11);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
#undef arg1
}
/* {ARRAYED_LIST}.remove */
void F372_3289 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "remove";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
EIF_INTEGER_32 ti4_5;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5940);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5940);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("prunable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1402, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("writable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1420, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(3);
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) (ti4_2 < ti4_3)) {
RTHOOK(4);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(4,1);
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = ti4_2;
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_2 = (EIF_INTEGER_32) (ti4_3 - ((EIF_INTEGER_32) 1L));
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_5 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_3 = (EIF_INTEGER_32) (ti4_4 - ti4_5);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2494, "move_data", tr2))(tr2, ui4_1x, ui4_2x, ui4_3x);
}
RTHOOK(5);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(5,1);
ui4_1 = ((EIF_INTEGER_32) 1L);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2500, "remove_tail", tr2))(tr2, ui4_1x);
if (RTAL & CK_ENSURE) {
RTHOOK(6);
RTCT("after_when_empty", EX_POST);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
tb1 = tb2;
}
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(7);
RTCT("index", EX_POST);
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_2 == ti4_1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(8);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
#undef up1
#undef ui4_1
#undef ui4_2
#undef ui4_3
}
/* {ARRAYED_LIST}.prune_all */
void F372_3290 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "prune_all";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc2 = (EIF_INTEGER_32) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
EIF_BOOLEAN loc4 = (EIF_BOOLEAN) 0;
EIF_BOOLEAN loc5 = (EIF_BOOLEAN) 0;
EIF_REFERENCE loc6 = (EIF_REFERENCE) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,loc6);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_INT32, &loc2);
RTLU(SK_INT32, &loc3);
RTLU(SK_BOOL, &loc4);
RTLU(SK_BOOL, &loc5);
RTLU(SK_REF, &loc6);
RTEAA(l_feature_name, 371, Current, 6, 1, 5941);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5941);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("prunable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1402, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 5, 0x04000000, 1, 0); /* loc5 */
loc5 = *(EIF_BOOLEAN *)(Current + RTWA(1365, dtype));
RTHOOK(3);
RTDBGAL(Current, 6, 0xF8000180, 0, 0); /* loc6 */
loc6 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTHOOK(4);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
RTHOOK(5);
RTDBGAL(Current, 2, 0x10000000, 1, 0); /* loc2 */
loc2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
for (;;) {
RTHOOK(6);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(loc1 == ti4_1)) break;
RTHOOK(7);
if ((EIF_BOOLEAN) (loc1 < (EIF_INTEGER_32) (loc2 - loc3))) {
RTHOOK(8);
if ((EIF_BOOLEAN) (loc3 > ((EIF_INTEGER_32) 0L))) {
RTHOOK(9);
ui4_1 = (EIF_INTEGER_32) (loc1 + loc3);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc6))(loc6, ui4_1x)).it_i4);
ui4_1 = ti4_2;
ui4_2 = loc1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2486, "put", loc6))(loc6, ui4_1x, ui4_2x);
}
RTHOOK(10);
if (loc5) {
RTHOOK(11);
RTDBGAL(Current, 4, 0x04000000, 1, 0); /* loc4 */
ui4_1 = loc1;
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc6))(loc6, ui4_1x)).it_i4);
loc4 = (EIF_BOOLEAN) (arg1 == ti4_2);
} else {
RTHOOK(12);
RTDBGAL(Current, 4, 0x04000000, 1, 0); /* loc4 */
ui4_1 = loc1;
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc6))(loc6, ui4_1x)).it_i4);
loc4 = (EIF_BOOLEAN) (EIF_BOOLEAN)(arg1 == ti4_2);
}
RTHOOK(13);
if (loc4) {
RTHOOK(14);
RTDBGAL(Current, 3, 0x10000000, 1, 0); /* loc3 */
loc3++;
} else {
RTHOOK(15);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1++;
}
} else {
RTHOOK(16);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1++;
}
}
RTHOOK(17);
ui4_1 = loc3;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2500, "remove_tail", loc6))(loc6, ui4_1x);
RTHOOK(18);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) (EIF_INTEGER_32) (ti4_2 + ((EIF_INTEGER_32) 1L));
if (RTAL & CK_ENSURE) {
RTHOOK(19);
RTCT("no_more_occurrences", EX_POST);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1362, dtype))(Current, ui4_1x)).it_b);
if ((EIF_BOOLEAN) !tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(20);
RTCT("is_exhausted", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1383, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(21);
RTCT("is_after", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(22);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(9);
RTEE;
#undef up1
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.remove_left */
void F372_3291 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "remove_left";
RTEX;
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5942);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5942);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("left_exists", EX_PRE);
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTTE((EIF_BOOLEAN) (ti4_1 > ((EIF_INTEGER_32) 1L)), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))--;
RTHOOK(3);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTWF(1423, dtype))(Current);
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("new_count", EX_POST);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("new_index", EX_POST);
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_2 - ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(6);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
}
/* {ARRAYED_LIST}.remove_right */
void F372_3292 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "remove_right";
RTEX;
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5943);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5943);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("right_exists", EX_PRE);
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTTE((EIF_BOOLEAN) (ti4_1 < ti4_2), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(2);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))++;
RTHOOK(3);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTWF(1423, dtype))(Current);
RTHOOK(4);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
(*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)))--;
if (RTAL & CK_ENSURE) {
RTHOOK(5);
RTCT("new_count", EX_POST);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(6);
RTCT("same_index", EX_POST);
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_3 == ti4_2)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(7);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
}
/* {ARRAYED_LIST}.wipe_out */
void F372_3293 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "wipe_out";
RTEX;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_REFERENCE tr1 = NULL;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5944);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5944);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("prunable", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1402, dtype))(Current)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(2,1);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTVF(2506, "wipe_out", tr1))(tr1);
RTHOOK(3);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
if (RTAL & CK_ENSURE) {
RTHOOK(4);
RTCT("wiped_out", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1363, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("is_before", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1387, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(6);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
#undef up1
}
/* {ARRAYED_LIST}.swap */
void F372_3294 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "swap";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_BOOLEAN tb1;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(4);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLR(3,tr3);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTEAA(l_feature_name, 371, Current, 1, 1, 5945);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5945);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_off", EX_PRE);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1372, dtype))(Current)).it_b);
RTTE((EIF_BOOLEAN) !tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("valid_index", EX_PRE);
ui4_1 = arg1;
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2472, dtype))(Current, ui4_1x)).it_b);
RTTE(tb1, label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ui4_1 = arg1;
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1412, dtype))(Current, ui4_1x)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(3);
RTDBGAL(Current, 1, 0x10000000, 0, 0); /* loc1 */
loc1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
RTHOOK(4);
tr3 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(4,1);
ui4_1 = (EIF_INTEGER_32) (arg1 - ((EIF_INTEGER_32) 1L));
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", tr3))(tr3, ui4_1x)).it_i4);
ui4_1 = ti4_3;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1422, dtype))(Current, ui4_1x);
RTHOOK(5);
tr3 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(5,1);
ui4_1 = loc1;
ui4_2 = (EIF_INTEGER_32) (arg1 - ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2486, "put", tr3))(tr3, ui4_1x, ui4_2x);
if (RTAL & CK_ENSURE) {
RTHOOK(6);
RTCT("swapped_to_item", EX_POST);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1418, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == ti4_1)) {
RTCK;
} else {
RTCF;
}
RTHOOK(7);
RTCT("swapped_from_item", EX_POST);
ui4_1 = arg1;
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1412, dtype))(Current, ui4_1x)).it_i4);
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_3 == ti4_2)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(8);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
#undef up1
#undef ui4_1
#undef ui4_2
#undef arg1
}
/* {ARRAYED_LIST}.correct_mismatch */
void F372_3295 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "correct_mismatch";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
EIF_REFERENCE loc2 = (EIF_REFERENCE) 0;
EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
EIF_BOOLEAN loc4 = (EIF_BOOLEAN) 0;
EIF_INTEGER_32 loc5 = (EIF_INTEGER_32) 0;
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE up2x = {{0}, SK_POINTER};
#define up2 up2x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_BOOLEAN tb3;
EIF_BOOLEAN tb4;
EIF_BOOLEAN tb5;
RTCFDT;
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(6);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLR(3,ur1);
RTLR(4,loc2);
RTLR(5,tr3);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTLU(SK_REF, &loc2);
RTLU(SK_INT32, &loc3);
RTLU(SK_BOOL, &loc4);
RTLU(SK_INT32, &loc5);
RTEAA(l_feature_name, 371, Current, 5, 0, 5946);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5946);
RTIV(Current, RTAL);
RTHOOK(1);
tb1 = '\0';
tb2 = '\0';
tb3 = '\0';
tb4 = '\0';
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2611, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,1);
tr2 = RTMS_EX_H("area_v2",7,1288217906);
ur1 = tr2;
tb5 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2641, "has", tr1))(tr1, ur1x)).it_b);
if ((EIF_BOOLEAN) !tb5) {
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2611, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,2);
tr2 = RTMS_EX_H("area",4,1634887009);
ur1 = tr2;
tr2 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(1412, "item", tr1))(tr1, ur1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
loc2 = RTCCL(tr2);
{
EIF_TYPE_INDEX typarr0[] = {384,0,0xFFFF};
EIF_TYPE_INDEX typres0;
typarr0[1] = RTWCT(2318, dtype, dftype);
typres0 = eif_compound_id(dftype, typarr0);
loc2 = RTRV(eif_non_attached_type(typres0),loc2);
}
tb4 = EIF_TEST(loc2);
}
if (tb4) {
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2611, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,3);
tr3 = RTMS_EX_H("count",5,1870727284);
ur1 = tr3;
tr3 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(1412, "item", tr2))(tr2, ur1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
tr1 = RTCCL(tr3);
RTOB(*(EIF_INTEGER_32 *), 169, tr1, loc3, tb4);
tb3 = tb4;
}
if (tb3) {
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2611, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,4);
tr3 = RTMS_EX_H("object_comparison",17,2049833582);
ur1 = tr3;
tr3 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(1412, "item", tr2))(tr2, ur1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
tr1 = RTCCL(tr3);
RTOB(*(EIF_BOOLEAN *), 202, tr1, loc4, tb3);
tb2 = tb3;
}
if (tb2) {
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2611, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(1,5);
tr3 = RTMS_EX_H("index",5,1852879736);
ur1 = tr3;
tr3 = ((up2x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(1412, "item", tr2))(tr2, ur1x)), (((up2x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up2x.it_r = RTBU(up2x))), (up2x.type = SK_POINTER), up2x.it_r);
tr1 = RTCCL(tr3);
RTOB(*(EIF_INTEGER_32 *), 169, tr1, loc5, tb2);
tb1 = tb2;
}
if (tb1) {
RTHOOK(2);
RTDBGAA(Current, dtype, 2310, 0xF8000180, 0); /* area_v2 */
ui4_1 = loc3;
if (ui4_1< 0) {
eraise ("non_negative_argument", EN_RT_CHECK);
}
tr1 = RTLNSP2(eif_non_attached_type(RTWCT(2310, dtype, dftype)),0,ui4_1,sizeof(EIF_INTEGER_32), EIF_TRUE);
RT_SPECIAL_COUNT(tr1) = 0;
RTAR(Current, tr1);
*(EIF_REFERENCE *)(Current + RTWA(2310, dtype)) = (EIF_REFERENCE) tr1;
RTHOOK(3);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1 = (EIF_INTEGER_32) ((EIF_INTEGER_32) 0L);
for (;;) {
RTHOOK(4);
if ((EIF_BOOLEAN)(loc1 == loc3)) break;
RTHOOK(5);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(5,1);
ui4_2 = loc1;
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2470, "item", loc2))(loc2, ui4_2x)).it_i4);
ui4_2 = ti4_1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTVF(2488, "extend", tr1))(tr1, ui4_2x);
RTHOOK(6);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
loc1++;
}
RTHOOK(7);
RTDBGAA(Current, dtype, 1365, 0x04000000, 1); /* object_comparison */
*(EIF_BOOLEAN *)(Current + RTWA(1365, dtype)) = (EIF_BOOLEAN) loc4;
RTHOOK(8);
RTDBGAA(Current, dtype, 2636, 0x10000000, 1); /* index */
*(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype)) = (EIF_INTEGER_32) loc5;
} else {
RTHOOK(9);
(FUNCTION_CAST(void, (EIF_REFERENCE)) RTWF(2610, 163))(Current);
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(10);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(7);
RTEE;
#undef up1
#undef up2
#undef ur1
#undef ui4_1
#undef ui4_2
}
/* {ARRAYED_LIST}.duplicate */
EIF_TYPED_VALUE F372_3296 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "duplicate";
RTEX;
EIF_INTEGER_32 loc1 = (EIF_INTEGER_32) 0;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ur1x = {{0}, SK_REF};
#define ur1 ur1x.it_r
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_BOOLEAN tb1;
EIF_BOOLEAN tb2;
EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(5);
RTLR(0,Current);
RTLR(1,Result);
RTLR(2,tr1);
RTLR(3,tr2);
RTLR(4,ur1);
RTLU (SK_REF, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTLU(SK_INT32, &loc1);
RTEAA(l_feature_name, 371, Current, 1, 1, 5947);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5947);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("not_off_unless_after", EX_PRE);
tb1 = '\01';
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1372, dtype))(Current)).it_b);
if (tb2) {
tb2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
tb1 = tb2;
}
RTTE(tb1, label_1);
RTCK;
RTHOOK(2);
RTCT("valid_subchain", EX_PRE);
RTTE((EIF_BOOLEAN) (arg1 >= ((EIF_INTEGER_32) 0L)), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(3);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1384, dtype))(Current)).it_b);
if (tb1) {
RTHOOK(4);
RTDBGAL(Current, 0, 0xF8000173, 0,0); /* Result */
ui4_1 = ((EIF_INTEGER_32) 0L);
Result = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2635, dtype))(Current, ui4_1x)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
} else {
RTHOOK(5);
RTDBGAL(Current, 1, 0x10000000, 1, 0); /* loc1 */
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTNHOOK(5,1);
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = (EIF_INTEGER_32) ((EIF_INTEGER_32) (ti4_2 + arg1) - ((EIF_INTEGER_32) 1L));
ti4_2 = eif_min_int32 (ti4_1,ui4_1);
loc1 = (EIF_INTEGER_32) ti4_2;
RTHOOK(6);
RTDBGAL(Current, 0, 0xF8000173, 0,0); /* Result */
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = (EIF_INTEGER_32) ((EIF_INTEGER_32) (loc1 - ti4_1) + ((EIF_INTEGER_32) 1L));
Result = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(2635, dtype))(Current, ui4_1x)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTHOOK(7);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(2310, "area_v2", Result))(Result)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(7,1);
tr2 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
ur1 = tr2;
ti4_1 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_1 = (EIF_INTEGER_32) (ti4_1 - ((EIF_INTEGER_32) 1L));
ui4_2 = ((EIF_INTEGER_32) 0L);
ti4_2 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ui4_3 = (EIF_INTEGER_32) ((EIF_INTEGER_32) (loc1 - ti4_2) + ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2493, "copy_data", tr1))(tr1, ur1x, ui4_1x, ui4_2x, ui4_3x);
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(8);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_REF; r.it_r = Result; return r; }
#undef up1
#undef ur1
#undef ui4_1
#undef ui4_2
#undef ui4_3
#undef arg1
}
/* {ARRAYED_LIST}.new_chain */
EIF_TYPED_VALUE F372_3297 (EIF_REFERENCE Current)
{
GTCX
char *l_feature_name = "new_chain";
RTEX;
EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
RTLI(2);
RTLR(0,Current);
RTLR(1,Result);
RTLU (SK_REF, &Result);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 0, 5948);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5948);
RTIV(Current, RTAL);
RTHOOK(1);
RTDBGAL(Current, 0, 0xF8000173, 0,0); /* Result */
Result = (EIF_REFERENCE) RTCCL(Current);
if (RTAL & CK_ENSURE) {
RTHOOK(2);
RTCT("result_exists", EX_POST);
if ((EIF_BOOLEAN)(Result != NULL)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(3);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(2);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_REF; r.it_r = Result; return r; }
}
/* {ARRAYED_LIST}.force_i_th */
void F372_3298 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x, EIF_TYPED_VALUE arg2x)
{
GTCX
char *l_feature_name = "force_i_th";
RTEX;
#define arg1 arg1x.it_i4
#define arg2 arg2x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg2x.type & SK_HEAD) == SK_REF) arg2x.it_i4 = * (EIF_INTEGER_32 *) arg2x.it_r;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(2);
RTLR(0,Current);
RTLR(1,tr1);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU(SK_INT32,&arg2);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 2, 5949);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5949);
RTIV(Current, RTAL);
RTHOOK(1);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1393, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) ((EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)) > ti4_2)) {
RTHOOK(2);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1397, dtype))(Current)).it_i4);
ui4_1 = (EIF_INTEGER_32) (ti4_1 + ti4_2);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1399, dtype))(Current, ui4_1x);
}
RTHOOK(3);
tr1 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(3,1);
ui4_1 = arg1;
ui4_2 = arg2;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2487, "force", tr1))(tr1, ui4_1x, ui4_2x);
RTVI(Current, RTAL);
RTRS;
RTHOOK(4);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
#undef up1
#undef ui4_1
#undef ui4_2
#undef arg2
#undef arg1
}
/* {ARRAYED_LIST}.insert */
void F372_3299 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x, EIF_TYPED_VALUE arg2x)
{
GTCX
char *l_feature_name = "insert";
RTEX;
#define arg1 arg1x.it_i4
#define arg2 arg2x.it_i4
EIF_TYPED_VALUE up1x = {{0}, SK_POINTER};
#define up1 up1x.it_p
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_TYPED_VALUE ui4_2x = {{0}, SK_INT32};
#define ui4_2 ui4_2x.it_i4
EIF_TYPED_VALUE ui4_3x = {{0}, SK_INT32};
#define ui4_3 ui4_3x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_REFERENCE tr2 = NULL;
EIF_REFERENCE tr3 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_INTEGER_32 ti4_2;
EIF_INTEGER_32 ti4_3;
EIF_INTEGER_32 ti4_4;
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg2x.type & SK_HEAD) == SK_REF) arg2x.it_i4 = * (EIF_INTEGER_32 *) arg2x.it_r;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(4);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,tr2);
RTLR(3,tr3);
RTLU (SK_VOID, NULL);
RTLU(SK_INT32,&arg1);
RTLU(SK_INT32,&arg2);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 2, 5950);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5950);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("index_small_enough", EX_PRE);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTTE((EIF_BOOLEAN) (arg2 <= ti4_1), label_1);
RTCK;
RTHOOK(2);
RTCT("index_large_enough", EX_PRE);
RTTE((EIF_BOOLEAN) (arg2 >= ((EIF_INTEGER_32) 1L)), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
if (RTAL & CK_ENSURE) {
in_assertion = ~0;
RTE_OT
ti4_2 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_1 = ti4_2;
tr1 = NULL;
RTE_O
tr1 = RTLA;
RTE_OE
RTE_OT
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
ti4_2 = ti4_3;
tr2 = NULL;
RTE_O
tr2 = RTLA;
RTE_OE
in_assertion = 0;
}
RTHOOK(3);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1393, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN) ((EIF_INTEGER_32) (ti4_3 + ((EIF_INTEGER_32) 1L)) > ti4_4)) {
RTHOOK(4);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ti4_4 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1397, dtype))(Current)).it_i4);
ui4_1 = (EIF_INTEGER_32) (ti4_3 + ti4_4);
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1399, dtype))(Current, ui4_1x);
}
RTHOOK(5);
tr3 = ((up1x = (FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2310, dtype))(Current)), (((up1x.type & SK_HEAD) == SK_REF)? (EIF_REFERENCE) 0: (up1x.it_r = RTBU(up1x))), (up1x.type = SK_POINTER), up1x.it_r);
RTNHOOK(5,1);
ui4_1 = (EIF_INTEGER_32) (arg2 - ((EIF_INTEGER_32) 1L));
ui4_2 = arg2;
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
ui4_3 = (EIF_INTEGER_32) ((EIF_INTEGER_32) (ti4_3 - arg2) + ((EIF_INTEGER_32) 1L));
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTVF(2494, "move_data", tr3))(tr3, ui4_1x, ui4_2x, ui4_3x);
RTHOOK(6);
ui4_1 = arg1;
ui4_2 = arg2;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE, EIF_TYPED_VALUE)) RTWF(1415, dtype))(Current, ui4_1x, ui4_2x);
if (RTAL & CK_ENSURE) {
RTHOOK(7);
RTCT("new_count", EX_POST);
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1392, dtype))(Current)).it_i4);
RTCO(tr1);
if ((EIF_BOOLEAN)(ti4_3 == (EIF_INTEGER_32) (ti4_1 + ((EIF_INTEGER_32) 1L)))) {
RTCK;
} else {
RTCF;
}
RTHOOK(8);
RTCT("index_unchanged", EX_POST);
ti4_3 = *(EIF_INTEGER_32 *)(Current + RTWA(2636, dtype));
RTCO(tr2);
if ((EIF_BOOLEAN)(ti4_3 == ti4_2)) {
RTCK;
} else {
RTCF;
}
RTHOOK(9);
RTCT("insertion_done", EX_POST);
ui4_1 = arg2;
ti4_3 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWF(1412, dtype))(Current, ui4_1x)).it_i4);
if ((EIF_BOOLEAN)(ti4_3 == arg1)) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(10);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(4);
RTEE;
#undef up1
#undef ui4_1
#undef ui4_2
#undef ui4_3
#undef arg2
#undef arg1
}
/* {ARRAYED_LIST}.new_filled_list */
EIF_TYPED_VALUE F372_3300 (EIF_REFERENCE Current, EIF_TYPED_VALUE arg1x)
{
GTCX
char *l_feature_name = "new_filled_list";
RTEX;
#define arg1 arg1x.it_i4
EIF_TYPED_VALUE ui4_1x = {{0}, SK_INT32};
#define ui4_1 ui4_1x.it_i4
EIF_REFERENCE tr1 = NULL;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
EIF_REFERENCE Result = ((EIF_REFERENCE) 0);
RTCDT;
RTSN;
RTDA;
RTLD;
if ((arg1x.type & SK_HEAD) == SK_REF) arg1x.it_i4 = * (EIF_INTEGER_32 *) arg1x.it_r;
RTLI(3);
RTLR(0,Current);
RTLR(1,tr1);
RTLR(2,Result);
RTLU (SK_REF, &Result);
RTLU(SK_INT32,&arg1);
RTLU (SK_REF, &Current);
RTEAA(l_feature_name, 371, Current, 0, 1, 5951);
RTSA(dtype);
RTSC;
RTME(dtype, 0);
RTGC;
RTDBGEAA(371, Current, 5951);
RTIV(Current, RTAL);
if ((RTAL & CK_REQUIRE) || RTAC) {
RTHOOK(1);
RTCT("n_non_negative", EX_PRE);
RTTE((EIF_BOOLEAN) (arg1 >= ((EIF_INTEGER_32) 0L)), label_1);
RTCK;
RTJB;
label_1:
RTCF;
}
body:;
RTHOOK(2);
RTDBGAL(Current, 0, 0xF8000173, 0,0); /* Result */
tr1 = RTLNSMART(Dftype(Current));
ui4_1 = arg1;
(FUNCTION_CAST(void, (EIF_REFERENCE, EIF_TYPED_VALUE)) RTWC(2622, Dtype(tr1)))(tr1, ui4_1x);
RTNHOOK(2,1);
Result = (EIF_REFERENCE) RTCCL(tr1);
if (RTAL & CK_ENSURE) {
RTHOOK(3);
RTCT("new_filled_list_not_void", EX_POST);
if ((EIF_BOOLEAN)(Result != NULL)) {
RTCK;
} else {
RTCF;
}
RTHOOK(4);
RTCT("new_filled_list_count_set", EX_POST);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1392, "count", Result))(Result)).it_i4);
if ((EIF_BOOLEAN)(ti4_1 == ((EIF_INTEGER_32) 0L))) {
RTCK;
} else {
RTCF;
}
RTHOOK(5);
RTCT("new_filled_list_before", EX_POST);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTVF(1387, "before", Result))(Result)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
}
RTVI(Current, RTAL);
RTRS;
RTHOOK(6);
RTDBGLE;
RTMD(0);
RTLE;
RTLO(3);
RTEE;
{ EIF_TYPED_VALUE r; r.type = SK_REF; r.it_r = Result; return r; }
#undef ui4_1
#undef arg1
}
/* {ARRAYED_LIST}._invariant */
void F372_5540 (EIF_REFERENCE Current, int where)
{
GTCX
char *l_feature_name = "_invariant";
RTEX;
EIF_INTEGER_32 ti4_1;
EIF_BOOLEAN tb1;
RTCDT;
RTLD;
RTDA;
RTLI(1);
RTLR(0,Current);
RTLU (SK_VOID, NULL);
RTLU (SK_REF, &Current);
RTEAINV(l_feature_name, 371, Current, 0, 5539);
RTSA(dtype);
RTME(dtype, 0);
RTIT("prunable", Current);
tb1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(1402, dtype))(Current)).it_b);
if (tb1) {
RTCK;
} else {
RTCF;
}
RTIT("starts_from_one", Current);
ti4_1 = (((FUNCTION_CAST(EIF_TYPED_VALUE, (EIF_REFERENCE)) RTWF(2629, dtype))(Current)).it_i4);
if ((EIF_BOOLEAN)(ti4_1 == ((EIF_INTEGER_32) 1L))) {
RTCK;
} else {
RTCF;
}
RTLO(2);
RTMD(0);
RTLE;
RTEE;
}
void EIF_Minit372 (void)
{
GTCX
}
#ifdef __cplusplus
}
#endif
|
2d7597b12d4abb9c9b10cc32db8f9f4b45dc0a48 | c2c18bc755e97e23edddfb3846a266203b63a080 | /src/user/serial/write_notifier.c | a6e298091bf3bd56d6614d43660942a825cce2c6 | [] | no_license | aianus/trains | b51458234518c9e5b154b9d68634d464f9ff96b2 | 37cfc4062ad6ac5804b3df0a55e5dfa7fc6be246 | refs/heads/master | 2021-01-18T14:24:26.614566 | 2014-04-06T22:58:38 | 2014-04-06T22:58:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,185 | c | write_notifier.c | #include <write_notifier.h>
#include <dassert.h>
#include <event.h>
#include <log.h>
#include <nameserver.h>
#include <serial.h>
#include <syscall.h>
#include <ts7200.h>
#include <uart.h>
#include <bwio.h>
void write_notifier() {
int server_tid, channel, event;
dlog("Write Notifier: Waiting for Configuration\n");
channel = get_writer_configuration(&server_tid);
event = channel == COM1 ? UART_1_TX_EVENT : UART_2_TX_EVENT;
dlog("Write Notifier: Configured %d\n", channel);
dlog("Write Notifier: Initialized\n");
dlog("Write Notifier: Setting up UART\n");
if (channel == COM1) {
uart_setspeed(COM1, 2400);
uart_setstop(COM1, 2);
enable_event(UART_1_CTS_EVENT);
}
uart_setfifo(channel, OFF);
enable_event(event);
dlog("Write Notifier: Set-up UART\n");
// We only care about CTS for COM1.
if (channel == COM1) {
dlog("Write Notifier: Setting up Notifier State\n");
if (!uart_getcts(COM1)) {
dlog("Write Notifier: Waiting For CTS\n");
AwaitEvent(UART_1_CTS_EVENT);
}
dlog("Write Notifier: Set up Notifier State\n");
}
for (;;) {
dlog("Waiting for Transmit\n");
int error = AwaitEvent(event);
if (error < 0) {
dlog("Recieved an error waiting for WRITE_EVENT\n");
}
WriteMessage msg;
msg.type = WRITE_EVENT_REQUEST;
WriteMessage rply;
Send(server_tid, (char *)&msg, sizeof(msg), (char *)&rply, sizeof(rply));
dassert(rply.type == WRITE_EVENT_RESPONSE, "Invalid Response from WriteServer");
// We only care about CTS for COM1.
if (channel == COM1) {
// This should usually run though twice, but may run once
// in exceptional cases.
do {
dlog("Waiting for CTS\n");
dlog("CTS Pre is %d\n", uart_getcts(COM1));
error = AwaitEvent(UART_1_CTS_EVENT);
dlog("CTS Post is %d\n", uart_getcts(COM1));
dassert(error >= 0, "Error waiting for CTS_EVENT\n");
} while(!uart_getcts(COM1));
}
}
Exit();
}
|
d7f0247c6c6171ea5ee5132dc3a3d91c14d296e5 | 6aa4906d5cd2c2f114dbe03dd751784334e1f9e7 | /syssvc/banner.c | 26f11310a534e8274779bb6ec126684fce4afc16 | [] | no_license | foss-for-synopsys-dwc-arc-processors/toppers-asp | 0e6e3d4eb2e0f7802f76f639ba5b050c24e543d3 | e2d1e4d3f0201ca951b32fb5ee85c3a82a2fd7fd | refs/heads/master | 2021-01-10T11:40:39.483912 | 2016-03-01T01:46:27 | 2016-03-01T01:46:27 | 43,927,522 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 3,505 | c | banner.c | /*
* TOPPERS/ASP Kernel
* Toyohashi Open Platform for Embedded Real-Time Systems/
* Advanced Standard Profile Kernel
*
* Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
* Toyohashi Univ. of Technology, JAPAN
* Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory
* Graduate School of Information Science, Nagoya Univ., JAPAN
*
* The above copyright holders grant permission gratis to use,
* duplicate, modify, or redistribute (hereafter called use) this
* software (including the one made by modifying this software),
* provided that the following four conditions (1) through (4) are
* satisfied.
*
* (1) When this software is used in the form of source code, the above
* copyright notice, this use conditions, and the disclaimer shown
* below must be retained in the source code without modification.
*
* (2) When this software is redistributed in the forms usable for the
* development of other software, such as in library form, the above
* copyright notice, this use conditions, and the disclaimer shown
* below must be shown without modification in the document provided
* with the redistributed software, such as the user manual.
*
* (3) When this software is redistributed in the forms unusable for the
* development of other software, such as the case when the software
* is embedded in a piece of equipment, either of the following two
* conditions must be satisfied:
*
* (a) The above copyright notice, this use conditions, and the
* disclaimer shown below must be shown without modification in
* the document provided with the redistributed software, such as
* the user manual.
*
* (b) How the software is to be redistributed must be reported to the
* TOPPERS Project according to the procedure described
* separately.
*
* (4) The above copyright holders and the TOPPERS Project are exempt
* from responsibility for any type of damage directly or indirectly
* caused from the use of this software and are indemnified by any
* users or end users of this software from any and all causes of
* action whatsoever.
*
* THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
* THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
* PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
* TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
* INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
*
* @(#) $Id: banner.c 1691 2010-01-01 15:55:49Z ertl-hiro $
*/
/*
* the output of the kernel startup message
*/
#include <kernel.h>
#include <t_syslog.h>
#include "target_syssvc.h"
#ifndef TARGET_COPYRIGHT
#define TARGET_COPYRIGHT
#endif /* TARGET_COPYRIGHT */
static const char banner[] = "\n"
"TOPPERS/ASP Kernel Release %d.%X.%d for " TARGET_NAME
" (" __DATE__ ", " __TIME__ ")\n"
"Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory\n"
" Toyohashi Univ. of Technology, JAPAN\n"
"Copyright (C) 2004-2010 by Embedded and Real-Time Systems Laboratory\n"
" Graduate School of Information Science, Nagoya Univ., JAPAN\n"
TARGET_COPYRIGHT;
void
print_banner(intptr_t exinf)
{
syslog_3(LOG_NOTICE, banner,
(TKERNEL_PRVER >> 12) & 0x0fU,
(TKERNEL_PRVER >> 4) & 0xffU,
TKERNEL_PRVER & 0x0fU);
}
|
3ffffed4c4c0c27796684b14b25c749bd693bba7 | bc949cbcded25afc8511d07c8d86509d5746b2a8 | /dataset/16083.c | 44a8b0711737c15c12c9f1755d088fe28b98af2f | [] | no_license | hqjenny/CSmith_random_pgm | 52aa1face59749a9d0656fc4088f6f921aac2dab | 0ebf41b85201cbe791a13304cdb45e22504f0ce7 | refs/heads/master | 2023-08-17T23:28:24.519500 | 2021-09-15T19:55:23 | 2021-09-15T19:55:23 | 406,904,982 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,338 | c | 16083.c | /*
* This is a RANDOMLY GENERATED PROGRAM.
*
* Generator: csmith 2.2.0
* Git version: dcef523
* Options: --no-structs --no-pointers --no-math64 --max-funcs 4 --no-unions --output 16083.c
* Seed: 938005472
*/
#include "csmith.h"
static long __undefined;
/* --- Struct/Union Declarations --- */
/* --- GLOBAL VARIABLES --- */
static volatile int16_t g_3 = (-8L);/* VOLATILE GLOBAL g_3 */
/* --- FORWARD DECLARATIONS --- */
static int16_t func_1(void);
static int32_t func_4(int32_t p_5, uint8_t p_6);
static uint16_t func_7(int8_t p_8);
/* --- FUNCTIONS --- */
/* ------------------------------------------ */
/*
* reads : g_3
* writes:
*/
static int16_t func_1(void)
{ /* block id: 0 */
uint32_t l_2 = 7UL;
uint8_t l_9 = 0x44L;
uint8_t l_13[1];
uint16_t l_15 = 1UL;
int i;
for (i = 0; i < 1; i++)
l_13[i] = 0x8AL;
if (((l_2 , (-10L)) != g_3))
{ /* block id: 1 */
int32_t l_14 = (-6L);
l_14 &= func_4(l_2, (func_7(l_9) , l_13[0]));
l_15 = func_4(g_3, l_9);
}
else
{ /* block id: 9 */
return g_3;
}
return g_3;
}
/* ------------------------------------------ */
/*
* reads : g_3
* writes:
*/
static int32_t func_4(int32_t p_5, uint8_t p_6)
{ /* block id: 5 */
return g_3;
}
/* ------------------------------------------ */
/*
* reads :
* writes:
*/
static uint16_t func_7(int8_t p_8)
{ /* block id: 2 */
uint16_t l_10[8] = {0xE64FL,0xDFE4L,0xE64FL,0xE64FL,0xDFE4L,0xE64FL,0xE64FL,0xDFE4L};
int i;
++l_10[5];
return l_10[5];
}
/* ---------------------------------------- */
int main (int argc, char* argv[])
{
int print_hash_value = 0;
platform_main_begin();
crc32_gentab();
func_1();
transparent_crc(g_3, "g_3", print_hash_value);
int checksum = platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return checksum;
}
/************************ statistics *************************
XXX max struct depth: 0
breakdown:
depth: 0, occurrence: 7
XXX total union variables: 0
XXX non-zero bitfields defined in structs: 0
XXX zero bitfields defined in structs: 0
XXX const bitfields defined in structs: 0
XXX volatile bitfields defined in structs: 0
XXX structs with bitfields in the program: 0
breakdown:
XXX full-bitfields structs in the program: 0
breakdown:
XXX times a bitfields struct's address is taken: 0
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 0
XXX times a single bitfield on LHS: 0
XXX times a single bitfield on RHS: 0
XXX max expression depth: 5
breakdown:
depth: 1, occurrence: 8
depth: 3, occurrence: 2
depth: 5, occurrence: 1
XXX total number of pointers: 0
XXX times a non-volatile is read: 6
XXX times a non-volatile is write: 3
XXX times a volatile is read: 5
XXX times read thru a pointer: 0
XXX times a volatile is write: 0
XXX times written thru a pointer: 0
XXX times a volatile is available for access: 4
XXX percentage of non-volatile access: 64.3
XXX forward jumps: 0
XXX backward jumps: 0
XXX stmts: 8
XXX max block depth: 1
breakdown:
depth: 0, occurrence: 5
depth: 1, occurrence: 3
XXX percentage a fresh-made variable is used: 50
XXX percentage an existing variable is used: 50
********************* end of statistics **********************/
|
8bf0aa2d2c24f3ad38a84c42c389b5f60ab86363 | 22d8582fbd6bfc9fcca7a3c4f55eb0f92e8c3f31 | /exercises/lesson01/3/bl4ckout31/src/kernel.c | aac74534d741030cbbd0587c9b9386b1afa76fc4 | [
"MIT"
] | permissive | stefanJi/raspberry-pi-os | 7a086b3951bb7834c93f3859e1faaf77ed899de0 | 513804a114bd81681008fd0a11ebab3a1acc1a54 | refs/heads/master | 2021-02-03T21:37:19.709072 | 2020-05-23T13:31:56 | 2020-05-23T13:31:56 | 261,217,405 | 2 | 1 | MIT | 2020-05-23T13:31:58 | 2020-05-04T15:07:15 | null | UTF-8 | C | false | false | 596 | c | kernel.c | #include "mini_uart.h"
#include "utils.h"
static unsigned int semaphore = 0;
void kernel_main(void)
{
const unsigned int id = proc_id();
// Only CPU #0 do the UART initialization
if(id == 0) {
uart_init();
}
// Wait for previous CPU to finish printing
while(id != semaphore) { }
uart_send_string("Hello, from processor ");
uart_send(id + '0');
uart_send_string("\r\n");
// Tells the next CPU to go
++semaphore;
// Only CPU #0 do the echo
if (id == 0) {
// Wait for everyone else to finish
while(semaphore != 4) { }
while (1) {
uart_send(uart_recv());
}
}
}
|
21d0a21c15075af6c1cf45fe4fec3545c8cbb29f | 10fc0134d70ed7afed069f7278c6033c0fd28989 | /src/NLS/datagram_services/inc/datagram_info.h | e938ee66f724fc0beaa1da38fa51b782efceeb93 | [] | no_license | ntonjeta/Nodo-Sensore | e39847f70dda12ed738ba74946ae861ec7f42522 | 2d0896de9d0afa026d1c1aee48d2ca60e6e8d721 | refs/heads/master | 2021-01-10T05:49:53.415132 | 2015-10-27T17:48:16 | 2015-10-27T17:48:16 | 44,812,494 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 638 | h | datagram_info.h | /*
* datagram_info.h
*
* Created on: 02/lug/2015
* Author: gennaro
*/
#ifndef DATAGRAM_INFO_H_
#define DATAGRAM_INFO_H_
#include "datagram_defs.h"
#define NO_SRC_IF 0xff
typedef struct
{
uint8_t* packet;
datagram_if_id_t source_if;
datagram_type_t type;
int packet_length;
datagram_address_t address;
uint8_t retry;
}datagram_info;
datagram_info* init_datagram_info (uint8_t* packet , datagram_if_id_t src_if , int datagram_length, uint8_t retry );
void free_datagram_info(datagram_info* d_info);
void print_datagram_info(datagram_info* d_info);
#endif /* DATAGRAM_INFO_H_ */
|
ad5214348bb8d167b32cc9dca03082d7db413426 | 39bd53197443dd45a498c0da56385c3e5f310673 | /08_push_swap/p_src/solve_pick.c | c71d3c12c9ec01c0222eabe2307b3c2e7460d6bc | [] | no_license | juhakala/root_hive | 33118201686b39efab5595db0ca0550b5aa314ab | 9283dc6bd36ba035f4d663f34514104343020694 | refs/heads/master | 2022-12-16T19:04:49.751532 | 2020-09-21T14:26:49 | 2020-09-21T14:26:49 | 222,804,409 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,165 | c | solve_pick.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* solve_pick.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhakala <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/31 14:23:28 by jhakala #+# #+# */
/* Updated: 2020/02/02 21:40:07 by jhakala ### ########.fr */
/* */
/* ************************************************************************** */
#include "push.h"
int ft_solve(t_mem *mem)
{
if (ft_order(mem))
return (0);
if (mem->size < 6)
ft_small_solve(mem);
else if (mem->size > 5 && mem->size < 251)
ft_medium_solve(mem);
else
ft_large_solve(mem);
if (!ft_order(mem))
ft_solve(mem);
return (0);
}
|
bd763d7a51c9f88e381fc05b555ba97802315889 | 07c5dcafd8a47a5d51bb876eab14ae296f144912 | /include/libcjs/cjs/cjsStatus_enum.h | 8a722ef24e3aba121d465466f2f0aa12deb35015 | [
"Apache-2.0",
"MIT"
] | permissive | Jasonchan35/cloudjs | e72e6262ac94770bfe4ceae0885bf425d6a74756 | 6ee201a52a865d81ffae1735c57dc8cb56ff31bc | refs/heads/master | 2021-01-19T00:05:59.554152 | 2017-04-04T04:04:54 | 2017-04-04T04:04:54 | 87,145,238 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 273 | h | cjsStatus_enum.h | axStatus_enum( error )
axStatus_enum( error_newJSObject )
axStatus_enum( error_set_object_property )
axStatus_enum( error_get_object_property )
axStatus_enum( error_set_object_element )
axStatus_enum( error_get_object_element )
axStatus_enum( invalid_func_arg_index ) |
763f99ea40e7c0d6f043df232fff2ffe4a660229 | 0c278805d7c7545903853fffc699cc91a37e8929 | /sdk/component/soc/realtek/amebad/wifi_fw/include/RTL8721D_INT_ROM.h | 71d022fac678c859ae5f394a4876a5ce2ba7f538 | [] | no_license | sengeiou/realtek_ameba_mp_sdk | bacd0aacfc7aeaa50616046339aab5806abd28ec | 89a02b0b773bfc324c12ff36432629420feca19d | refs/heads/master | 2022-12-01T22:53:11.052324 | 2020-08-18T10:43:30 | 2020-08-18T10:43:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,179 | h | RTL8721D_INT_ROM.h | #ifndef __RTL8721D_INT_H__
#define __RTL8721D_INT_H__
#ifndef __ASSEMBLY__
/*--------------------Define --------------------------------------------*/
#define BIT_DBG_TRIGGER BIT0
#define BIT_CD_TRIGGER BIT5
#define CLKIs32K 1
#define CLKIs40M 0
/*--------------------Define Enum---------------------------------------*/
/*--------------------Define MACRO--------------------------------------*/
/*--------------------Define Struct---------------------------------------*/
/*--------------------Export global variable-------------------------------*/
/*--------------------Function declaration---------------------------------*/
extern void
ISR_RPWM2_8721D(
void
);
extern void
UpdateISRUSB3_8721D(
void
);
#if 0
extern void
UpdateISRSys_8721D(
void
);
#endif
extern void
UpdateISRWlan_8721D(
void
);
extern void
UpdateISRFT_8721D(
void
);
/*
extern void
ISRSendSignal_8721D(
u8 event
);
extern void
ISRSendSignalCommon(
u8 event
);
*/
/*
extern void
ISRSendSignal_8721D1(
u8 event
);
*/
extern void
ISR_TxClose_8721D(
void
);
extern void
ISR_TXCCX_8721D(
void
);
extern void
ISR_RxDone_8721D(
void
);
extern void
ISR_H2CCMD_8721D(
void
);
#if 1
extern void
ISR_HRCV_8721D(
void
);
#endif
extern void
ISR_CTWEnd_8721D(
void
);
extern void
ISR_BcnEarly_8721D(
void
);
extern void
ISR_TXBCNERR_8721D(
void
);
extern void
ISR_TXBCNOK_8721D(
void
);
extern void
ISR_TxPKTIn_8721D(
void
);
extern void
ISR_TxrptCntFull_8721D(
void
);
extern void
ISR_TryDone_8721D(
void
);
extern void
ISR_SoundDone_8721D(
void
);
extern void
ISR_GTimer0_8721D(
void
);
extern void
ISR_GTimer1_8721D(
void
);
extern void
ISR_GTimer2_8721D(
void
);
extern void
ISR_GTimer3_8721D(
void
);
extern void
ISR_GTimer4_8721D(
void
);
extern void
ISR_TimerOut0_8721D(
void
);
extern void
ISR_RPWM_8721D(
void
);
extern void
ISR_EOSP_8721D(
void
);
extern void
ISR_GTimer5_8721D(
void
);
extern void
ISR_BCNERLY1_8721D(
void
);
extern void
ISR_P2PRFOn_8721D(
void
);
extern void
ISR_P2PRFOff_8721D(
void
);
extern void
ISR_TRIGGER_PKT_8721D(
void
);
extern void
ISR_TSF_BIT32_TOGGLE_8721D(
void
);
extern void
ISR_RETRIVE_BUFFERED_8721D(
void
);
extern void
ISR_CLR_PS_STATUS_8721D(
void
);
extern void
ISR_BcnEarlyAGG_8721D(
void
);
extern void
ISR_GPIO2En_8721D(
void
);
extern void
ISR_GPIO3En_8721D(
void
);
extern void
ISR_GPIO13En_8721D(
void
);
extern void
ISR_PDN_8721D(
void
);
extern void
ISR_WlanActOn_8721D(
void
);
extern void
ISR_WlanActOff_8721D(
void
);
extern void
ISR_TxNull0_8721D(
void
);
extern void
ISR_TxNull1_8721D(
void
);
void
ISR_GTimer6_8721D(
void
);
void
ISR_SCO_OP_8721D(
void
);
#endif //#ifndef __ASSEMBLY__
#endif //__RTL8721D_INT_H__
|
08748f3258467d76f558e5295ad7d40c2e7ad782 | 3d0de0f2549d9025540fcec88624c72c079b406f | /BSW/src/bsw/gen/BswM/src/BswM_LinSM.c | a72f8f40675860158bf26117de798f51122c2ee7 | [] | no_license | ongbut999/Jenkins_Test | ee19936e1577bd93d2755d21299ed3fbec553db6 | abb74480c4ce938dd1c7463627c4074071580af4 | refs/heads/master | 2023-06-23T21:26:57.794427 | 2021-07-22T08:05:20 | 2021-07-22T08:05:20 | 388,372,287 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 9,373 | c | BswM_LinSM.c |
/*---------------------------------------------------------------------------------------*/
/*- Include files -*/
/*---------------------------------------------------------------------------------------*/
#include "BswM.h"
#include "BswM_LinSM.h"
#include "BswM_Prv.h"
#ifdef BSWM_LINSM_ENABLED
#if ( BSWM_LINSM_ENABLED == TRUE )
#define BSWM_START_SEC_CODE
#include "BswM_Cfg_MemMap.h"
/*--------------------------------------------------------------------------*/
/*- definition of global functions -*/
/*--------------------------------------------------------------------------*/
/***********************************************************
* Function name: void BswM_LinSM_CurrentState( NetworkHandleType Network, LinSM_ModeType CurrentState )
* Description: Function called by LinSM to indicate its current state.
* Parameter Network : The LIN channel that the indicated state corresponds to.
* Parameter CurrentState : The current state of the LIN channel.
* Return value: None
* Remarks:
***********************************************************/
FUNC(void, BSWM_CODE) BswM_LinSM_CurrentState
(
VAR(NetworkHandleType, AUTOMATIC) Network,
VAR(LinSM_ModeType, AUTOMATIC) CurrentState
)
{
#if (defined(BSWM_NO_OF_LINSM_CHANNELS) && (BSWM_NO_OF_LINSM_CHANNELS > 0))
/* Local variables defined for this function. */
VAR(boolean, AUTOMATIC) flgDetChecksPassed_b = FALSE;
VAR(uint16, AUTOMATIC) idx_u16 = 0;
VAR(BswM_Cfg_MRPLinSMType_tst, AUTOMATIC) dataLinSmCurrentState_st;
VAR(boolean, AUTOMATIC) flgNetworkIdValid = FALSE;
#if ( BSWM_DEBUG == TRUE )
/*BswM_Prv_ctrInterrupt_u8 used for counting how many times BswM is getting interrupted*/
BswM_Prv_ctrInterrupt_u8++;
#endif /* ( BSWM_DEBUG == TRUE ) */
/* Is BswM initialized ? */
if ( FALSE == BswM_Prv_isModuleInitialised_b )
{
/* DET if the BSW Mode Manager is not initialized.*/
BSWM_DET_REPORT_ERROR(BSWM_API_ID_LINSMCRNTST, BSWM_E_NO_INIT);
}
else
{
/* Check whether passed CurrentState is valid and get corresponding index */
flgNetworkIdValid = BswM_Prv_GetLinSmCurrentStateIndex_b(Network , &idx_u16);
/* Proceed if it valid index */
if(FALSE != flgNetworkIdValid)
{
/* Check if the Current State is within the valid range.*/
if((CurrentState != LINSM_NO_COM) &&
(CurrentState != LINSM_FULL_COM))
{
/* DET if the Current State is not within the valid range.*/
BSWM_DET_REPORT_ERROR(BSWM_API_ID_LINSMCRNTST, BSWM_E_REQ_MODE_OUT_OF_RANGE);
}
else
{
flgDetChecksPassed_b = TRUE;
}
}
if(FALSE != flgDetChecksPassed_b)
{
/* Check if no other request is in progress */
if(FALSE != BswM_Prv_ReqProcessOrQueue_b(BSWM_MRP_LINSM_IND, Network, idx_u16, (uint16)CurrentState))
{
/* Process any requests that were delayed before this request */
if (FALSE != BswM_Prv_isReqstDelayed_b)
{
BswM_Prv_ProcessDelayedReqst();
}
/*Update RAM buffer with current mode values*/
BswM_Cfg_LinSmCurrentStateInfo_ast[idx_u16].isValidModePresent_b = TRUE;
BswM_Cfg_LinSmCurrentStateInfo_ast[idx_u16].dataMode_en = CurrentState;
dataLinSmCurrentState_st = BswM_Prv_adrSelectedConfig_pcst->dataModeArbitration_st.dataModeRequestPorts_st.dataLinSMInd_ast[idx_u16];
BswM_Prv_RuleEval(dataLinSmCurrentState_st.dataReqProcessing_en, BSWM_MRP_LINSM_IND, Network, dataLinSmCurrentState_st.adrRulesRef_pu16, dataLinSmCurrentState_st.nrAssociatedRules_u16);
/* Check Whether deferred request processing was delayed */
if( FALSE != BswM_Prv_flgDelayDeferredReqst_b )
{
/* Call the deferred request processing function */
BswM_Prv_ProcessDeferredReqst();
/*indicate that delayed deferred requests were serviced*/
BswM_Prv_flgDelayDeferredReqst_b = FALSE;
}
/* Reset request in progress flag */
BswM_Prv_flgNewReqstProgress_b = FALSE;
}
}
}
#if ( BSWM_DEBUG == TRUE )
BswM_Prv_InterruptHandler(BSWM_API_ID_LINSMCRNTST);
#endif /* ( BSWM_DEBUG == TRUE ) */
#else
/* To avoid compiler warnings if no LinSM channel is configured */
(void)Network;
(void)CurrentState;
#endif /* ( BSWM_NO_OF_LINSM_CHANNELS > 0 ) */
return;
}
/***********************************************************
* Function name: void BswM_LinSM_CurrentSchedule( NetworkHandleType Network, LinIf_SchHandleType CurrentSchedule )
* Description: Function called by LinSM to indicate the currently active schedule table for a specific LIN channel.
* Parameter Network : The LIN channel that the schedule table switch have occurred on.
* Parameter CurrentSchedule : The currently active schedule table of the LIN channel.
* Return value: None
* Remarks:
***********************************************************/
FUNC(void, BSWM_CODE) BswM_LinSM_CurrentSchedule
(
VAR(NetworkHandleType, AUTOMATIC) Network,
VAR(LinIf_SchHandleType, AUTOMATIC) CurrentSchedule
)
{
#if (defined(BSWM_NO_OF_LINSMSCH_CHANNELS) && (BSWM_NO_OF_LINSMSCH_CHANNELS > 0))
/* Local variables defined for this function. */
VAR(uint16, AUTOMATIC) idx_u16 = 0;
VAR(BswM_Cfg_MRPLinSchdType_tst, AUTOMATIC) dataLinSmCurrentSch_st ;
VAR(boolean, AUTOMATIC) flgNetworkIdValid = FALSE;
VAR(boolean, AUTOMATIC) flgInputChecksPassed_b = FALSE;
#if ( BSWM_DEBUG == TRUE )
/*BswM_Prv_ctrInterrupt_u8 used for counting how many times BswM is getting interrupted*/
BswM_Prv_ctrInterrupt_u8++;
#endif /* ( BSWM_DEBUG == TRUE ) */
/* Is BswM initialized ? */
if ( FALSE == BswM_Prv_isModuleInitialised_b )
{
/* DET if the BSW Mode Manager is not initialized.*/
BSWM_DET_REPORT_ERROR(BSWM_API_ID_LINSMCRNTSCD, BSWM_E_NO_INIT);
}
else
{
/* Check whether passed Lin Channel is valid and get corresponding index */
flgNetworkIdValid = BswM_Prv_GetLinSmCurrentScheduleChnIndex_b(Network, &idx_u16);
/* Proceed if it valid index */
if(FALSE != flgNetworkIdValid)
{
/* Check if max no of schedules are greater than than passed current schedule */
if(BswM_Prv_idLinSMMaxSchTab_cau8[idx_u16] > CurrentSchedule)
{
flgInputChecksPassed_b = TRUE;
}
}
if(flgInputChecksPassed_b != FALSE)
{
/* Check if no other request is in progress */
if(FALSE != BswM_Prv_ReqProcessOrQueue_b(BSWM_MRP_LINSM_SCHEDULE_IND, idx_u16, idx_u16, (uint16)CurrentSchedule))
{
/* Process any requests that were delayed before this request */
if (FALSE != BswM_Prv_isReqstDelayed_b)
{
BswM_Prv_ProcessDelayedReqst();
}
/*Update RAM buffer with current mode values*/
BswM_Cfg_LinSmCurrentSchInfo_ast[idx_u16].isValidModePresent_b = TRUE;
BswM_Cfg_LinSmCurrentSchInfo_ast[idx_u16].dataMode_u8 = CurrentSchedule;
dataLinSmCurrentSch_st = BswM_Prv_adrSelectedConfig_pcst->dataModeArbitration_st.dataModeRequestPorts_st.dataLinSchInd_ast[idx_u16];
BswM_Prv_RuleEval(dataLinSmCurrentSch_st.dataReqProcessing_en, BSWM_MRP_LINSM_SCHEDULE_IND, idx_u16, dataLinSmCurrentSch_st.adrRulesRef_pu16, dataLinSmCurrentSch_st.nrAssociatedRules_u16);
/* Check Whether deferred request processing was delayed */
if( FALSE != BswM_Prv_flgDelayDeferredReqst_b )
{
/* Call the deferred request processing function */
BswM_Prv_ProcessDeferredReqst();
/*indicate that delayed deferred requests were serviced*/
BswM_Prv_flgDelayDeferredReqst_b = FALSE;
}
/* Reset request in progress flag */
BswM_Prv_flgNewReqstProgress_b = FALSE;
}
}
}
#if ( BSWM_DEBUG == TRUE )
BswM_Prv_InterruptHandler(BSWM_API_ID_LINSMCRNTSCD);
#endif /* ( BSWM_DEBUG == TRUE ) */
#else
/* To avoid compiler warnings if no LinSM channel is configured */
(void)Network;
(void)CurrentSchedule;
#endif /* ( BSWM_NO_OF_LINSMSCH_CHANNELS > 0 ) */
return;
}
#define BSWM_STOP_SEC_CODE
#include "BswM_Cfg_MemMap.h"
#endif /* ( BSWM_LINSM_ENABLED == TRUE ) */
#endif /* BSWM_LINSM_ENABLED */
/*
<BASDKey>
**********************************************************************************************************************
* Administrative Information (automatically filled in)
* $History___:$
**********************************************************************************************************************
</BASDKey>
*/
|
ac13f031a53cf50fc89f795d04820a75528ae67c | dbbb3606c9815d1c23bdf114bb0a077a02e60b4d | /plc4c/spi/src/types.c | 88c25bc0d212fb5a076fb83101ac95dc78545f3f | [
"Apache-2.0",
"Unlicense"
] | permissive | RalfBarkow/plc4x | f0030814493216bb63c19c29954bfb3e94e518e0 | ec16e7426c3f447ef4a8a038206f975eae92d4b9 | refs/heads/develop | 2023-04-07T08:59:09.005316 | 2022-05-22T19:30:55 | 2022-05-22T19:30:55 | 188,875,513 | 0 | 0 | Apache-2.0 | 2023-03-31T15:01:36 | 2019-05-27T16:19:19 | Java | UTF-8 | C | false | false | 3,567 | c | types.c | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 <plc4c/types.h>
char *plc4c_return_code_to_message(plc4c_return_code return_code) {
switch (return_code) {
case UNFINISHED: {
return "UNFINISHED";
}
case OK: {
return "OK";
}
case NO_MEMORY: {
return "OUT_OF_MEMORY";
}
case INVALID_CONNECTION_STRING: {
return "INVALID CONNECTION STRING";
}
case NON_MATCHING_LISTS: {
return "ITEM AND VALUE LISTS HAVE DIFFERENT SIZES";
}
case INVALID_LIST_SIZE: {
return "INVALID LIST SIZE";
}
case NOT_REACHABLE: {
return "DEVICE NOT REACHABLE";
}
case PERMISSION_DENIED: {
return "PERMISSION DENIED";
}
case NO_DRIVER_AVAILABLE: {
return "NO DRIVER FOUND";
}
case UNKNOWN_DRIVER: {
return "UNKNOWN DRIVER";
}
case UNSPECIFIED_TRANSPORT: {
return "TRANSPORT NOT SPECIFIED";
}
case NO_TRANSPORT_AVAILABLE: {
return "NO TRANSPORT FOUND";
}
case UNKNOWN_TRANSPORT: {
return "UNKNOWN TRANSPORT";
}
case UNKNOWN_ERROR: {
return "UNKNOWN ERROR";
}
case INTERNAL_ERROR: {
return "INTERNAL ERROR";
}
default: {
return "UNKNOWN RETURN CODE";
}
}
}
char *plc4c_response_code_to_message(plc4c_response_code response_code) {
switch (response_code) {
case PLC4C_RESPONSE_CODE_OK: {
return "OK";
}
case PLC4C_RESPONSE_CODE_NOT_FOUND: {
return "NOT FOUND";
}
case PLC4C_RESPONSE_CODE_ACCESS_DENIED: {
return "ACCESS DENIED";
}
case PLC4C_RESPONSE_CODE_INVALID_ADDRESS: {
return "INVALID ADDRESS";
}
case PLC4C_RESPONSE_CODE_INVALID_DATATYPE: {
return "INVALID_DATATYPE";
}
case PLC4C_RESPONSE_CODE_INTERNAL_ERROR: {
return "INTERNAL ERROR";
}
case PLC4C_RESPONSE_CODE_RESPONSE_PENDING: {
return "RESPONSE PENDING";
}
default: {
return "UNKNOWN RESPONSE CODE";
}
}
}
char *plc4c_data_type_name(plc4c_data_type data_type) {
switch (data_type) {
case PLC4C_CHAR: {
return "PLC4C_CHAR";
}
case PLC4C_UCHAR: {
return "PLC4C_UCHAR";
}
case PLC4C_SHORT: {
return "PLC4C_SHORT";
}
case PLC4C_USHORT: {
return "PLC4C_USHORT";
}
case PLC4C_BOOL: {
return "PLC4C_BOOL";
}
case PLC4C_INT: {
return "PLC4C_INT";
}
case PLC4C_UINT: {
return "PLC4C_UINT";
}
case PLC4C_FLOAT: {
return "PLC4C_FLOAT";
}
case PLC4C_STRING_POINTER: {
return "PLC4C_STRING_POINTER";
}
case PLC4C_CONSTANT_STRING: {
return "PLC4C_CONSTANT_STRING";
}
case PLC4C_VOID_POINTER: {
return "PLC4C_VOID_POINTER";
}
default: {
return "UNKNOWN";
}
}
}
|
e8077a7684ecc80baff67f07a630126ea2de4a2f | 016f54b52756de71ce33d286fcd69eb08cf17cac | /src/i2c.h | 1b62d260649db617f4e4c1eed69be66450116c4a | [] | no_license | ljalves/hfeasy | 5f22f64a39961f47222ecb471696cbc4264c0450 | ae1b59fb6a4fac6fac5c8fc47a1cdf20d8e34f2e | refs/heads/master | 2022-05-09T19:19:51.503745 | 2022-04-08T20:27:13 | 2022-04-08T20:27:13 | 166,032,985 | 50 | 9 | null | null | null | null | UTF-8 | C | false | false | 176 | h | i2c.h | #ifndef _I2C_H_
#define _I2C_H_
#include <hsf.h>
int USER_FUNC gpio_i2c_send(uint8_t addr, uint16_t data);
int USER_FUNC gpio_i2c_recv(uint8_t addr, uint8_t *data);
#endif
|
1c6f09c70ddba284a9416d38b1ac7cd63527e093 | 2d1b472ead1c7fc229c32d6007b8c813303aee7d | /tcp4server-epoll.c | 218fd9f0df59c7005bac8db6bfc642ee57d5f13d | [
"Apache-2.0"
] | permissive | gwduan/network-programming-examples | 2c049efcf45ca5a450766edc3917beccdff873ea | 89d46c15b849589954d9b0937fe739010704bbaa | refs/heads/master | 2020-08-12T11:26:40.180406 | 2019-11-24T14:02:40 | 2019-11-24T14:02:40 | 214,758,921 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,346 | c | tcp4server-epoll.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <strings.h>
#include <errno.h>
#include <sys/epoll.h>
#include <string.h>
#include <signal.h>
#include "common.h"
#define LISTENQ 1024
#define MAX_EVENTS 128
#define TIME_OUT -1
static int do_accept(int listenfd, int epollfd)
{
int connfd;
struct sockaddr_in peeraddr;
socklen_t peerlen;
struct epoll_event ev;
peerlen = sizeof(peeraddr);
if ((connfd = accept(listenfd, (struct sockaddr *)&peeraddr,
&peerlen)) == -1) {
if (errno == EINTR)
return 0;
perror("accept");
return -1;
}
fprintf(stdout, "New connection fd = %d.\n", connfd);
if (set_nonblocking(connfd) == -1) {
perror("set_nonblocking");
close(connfd);
return -1;
}
ev.events = EPOLLIN | EPOLLET;
ev.data.fd = connfd;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, connfd, &ev) == -1) {
perror("epoll_ctl: add conn fd");
close(connfd);
return -1;
}
return 0;
}
static int do_echo(int sockfd)
{
char buf[1024 + 1];
size_t nleft;
ssize_t nread;
ssize_t nwritten;
char *ptr;
int peer_closed = 0;
struct sigaction oact;
ptr = buf;
nleft = sizeof(buf);
while (nleft) {
if ((nread = recv(sockfd, ptr, nleft, 0)) == -1) {
if (errno == EINTR)
continue;
if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
perror("recv");
close(sockfd);
return -1;
}
if (!nread) {
fprintf(stdout, "Peer[%d] closed.\n", sockfd);
if (nleft == sizeof(buf)) {
/* recv nothing */
close(sockfd);
return 0;
}
peer_closed = 1;
break;
}
nleft -= nread;
ptr += nread;
}
if (!nleft) {
fprintf(stderr, "recv message is too long[max-length:%ld]!\n",
sizeof(buf) - 1);
close(sockfd);
return -1;
}
buf[sizeof(buf) - nleft] = '\0';
fprintf(stdout, "fd[%d] recv message: [%s].\n", sockfd, buf);
if (set_sig_handler(SIGPIPE, SIG_IGN, &oact) == -1) {
close(sockfd);
return -1;
}
ptr = buf;
nleft = strlen(buf);
fprintf(stdout, "fd[%d] send message: [", sockfd);
while (nleft) {
if ((nwritten = send(sockfd, ptr, nleft, 0)) == -1) {
if (errno == EINTR)
continue;
if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
perror("send");
sigaction(SIGPIPE, &oact, NULL);
close(sockfd);
return -1;
}
fprintf(stdout, "%*.*s", (int)nwritten, (int)nwritten, ptr);
nleft -= nwritten;
ptr += nwritten;
}
fprintf(stdout, "].\n");
sigaction(SIGPIPE, &oact, NULL);
if (nleft)
fprintf(stderr, "remain message discard[%ld bytes]!\n", nleft);
if (peer_closed)
close(sockfd);
return 0;
}
int main(void)
{
int listenfd;
struct sockaddr_in servaddr;
int on = 1;
int epollfd;
int nfds;
struct epoll_event ev;
struct epoll_event events[MAX_EVENTS];
int i;
if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
exit(1);
}
if (set_nonblocking(listenfd) == -1) {
perror("set_nonblocking");
close(listenfd);
exit(1);
}
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(12345);
if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) == -1) {
perror("setsockopt");
close(listenfd);
exit(1);
}
if (bind(listenfd, (struct sockaddr *)&servaddr,
sizeof(servaddr)) == -1) {
perror("bind");
close(listenfd);
exit(1);
}
if (listen(listenfd, LISTENQ) == -1) {
perror("listen");
close(listenfd);
exit(1);
}
if ((epollfd = epoll_create1(0)) == -1) {
perror("epoll_create1");
close(listenfd);
exit(1);
}
ev.events = EPOLLIN;
ev.data.fd = listenfd;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listenfd, &ev) == -1) {
perror("epoll_ctl: add listen fd");
close(listenfd);
close(epollfd);
exit(1);
}
while (1) {
if ((nfds = epoll_wait(epollfd, events, MAX_EVENTS,
TIME_OUT)) == -1) {
if (errno == EINTR)
continue;
perror("epoll_wait");
/* cleanup */
exit(1);
} else if (!nfds) {
fprintf(stderr, "time out!\n");
/* cleanup */
exit(1);
}
for (i = 0; i < nfds; i++) {
if (events[i].data.fd == listenfd) {
if (do_accept(listenfd, epollfd) == -1) {
/* cleanup */
exit(1);
}
continue;
}
(void) do_echo(events[i].data.fd);
}
}
/* cleanup */
exit(0);
}
|
045c15d5b5710d02b36701503d6401040139d88a | 6f998b6b00900d8ef6adffca2cb552f5ed556912 | /flowmtr/bsp/platform/SCI/scibrtbl.c | dfe2bd3c8f8b101d576973c413f416f73589d009 | [] | no_license | vortexmakes/yipiesens | 15d10d510866a5804fdaec9a474e19636c658a7b | 5e3fedfbc4b09573e4c448b320809d7a0cd4f96d | refs/heads/master | 2022-11-08T20:35:12.466520 | 2020-06-19T16:00:29 | 2020-06-19T16:00:29 | 267,716,327 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 468 | c | scibrtbl.c | /*
* scibrtbl.c
*/
#include "sci.h"
#include "scibrtbl.h"
/*
* sci_br_tbl: Maps the Baudrate symbol enum defined in
* in serdefs.h with the constant defined
* in sci.h for seting the uart's MCU.
*/
const unsigned short sci_br_tbl[NUM_BAUD] =
{
UC_B300,
UC_B600,
UC_B1200,
UC_B2400,
UC_B4800,
UC_B9600,
UC_B19200,
UC_B38400,
UC_B57600,
UC_B115200
};
|
126d32acf57559968a41c76493ea935abbc13deb | 273ea26508dfe9a33e6941a74b7fa65d9053eaaa | /动态库/testdll.h | b2dfd4a9bc7bfa5c7224b41cacc3ca0dd209c121 | [] | no_license | Sdator/hook | 402254c6a20f822c2b068844733ee7f90b690d2c | 0f7e447667e633ca90081718328c4fc25e77eb56 | refs/heads/master | 2022-04-21T04:41:54.928233 | 2020-04-23T13:30:15 | 2020-04-23T13:30:15 | 257,404,034 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 168 | h | testdll.h | // 预处理 防止重复加载库
// 如果没有定义库 就定义一个
#ifndef TESTDLL_H
#define TESTDLL_H
int add(int a, int b);
int sub(int a, int b);
#endif
|
4b107248dd8ca582a8a90dac52bcc3ef5ed3d8d4 | 41364b9eeca9877200cf2ad0fa256dd0d4372f86 | /lnd_files/experiments/DMA/malloc.c | 6edd0a8df13ae064438c071cf18bac204bcbb4e5 | [] | no_license | mahendra-21/lnd_work | 2a10f662effba389c8320839b8c5a8a508bbe272 | 47cfcefef9f7b1ccc64c7235c8e515abf7b9e34d | refs/heads/master | 2020-12-19T15:12:42.558893 | 2020-02-06T07:08:34 | 2020-02-06T07:08:34 | 235,768,266 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 249 | c | malloc.c | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
char *ptr = NULL;
ptr = (char *) malloc (17);
printf("ptr -> %p *(--ptr) -> %d\n", ptr, *(ptr - 4));
ptr++;
printf("*(ptr + 4) -> %d\n", *(ptr + 35));
return 0;
}
|
400afcc1e64a16e6705b36752a9e4572fa25781b | 546272ae71120357c4d86bdd9da67fb98548ec50 | /MC60_OpenCPU_GS3_SDK_V1.7/include/ql_ble.h | 9fe3449ac452b0d52df11c56dbadaa87b8347618 | [
"MIT"
] | permissive | tomyqg/QuectelMC60OpenCPUProject | c5fe5d01f08265f6e46fa02f81d3843a7e0fd071 | 4048dd09a28ffd712e618f49411f511cee7ef35b | refs/heads/master | 2021-03-12T10:14:19.345068 | 2020-02-17T10:46:34 | 2020-02-17T10:46:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,109 | h | ql_ble.h | /*****************************************************************************
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* ql_ble.h
*
* Project:
* --------
* OpenCPU
*
* Description:
* ------------
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
*----------------------------------------------------------------------------
*
****************************************************************************/
#ifndef __QL_BLE_H__
#define __QL_BLE_H__
#include "ql_type.h"
typedef struct
{
u8 bd_addr[6];
/* rssi of remote device */
s32 rssi;
/* length of EIR */
u8 eir_len;
/* raw EIR data */
u8 eir[32];
} st_bcm_gattc_dev;
typedef void (*CallBack_BLE_Scan_Hdlr)(st_bcm_gattc_dev *dev, u8 num, void *customizePara);
void Ql_BLE_Scan_Register(CallBack_BLE_Scan_Hdlr callback_ble_scan,void * customizePara);
#endif //__QL_BLE_H__
|
848563a1181355ff4d24ff8dd53ba5bdb3953ca4 | 4b8d45680c9f8b97b1b52919c16285bf5d5afc20 | /Pods/Headers/Public/LTUpdate/LTUpdate.h | 073a203c98ed94be39676ea737e0c55c76f16b90 | [] | no_license | novoland/douban-artist-ios | afec78f039ecf3a173eee9ee54f508e795963b84 | 1e2d3e1afd3bb38580f53904a90e11c070a5ead8 | refs/heads/master | 2021-01-22T08:48:33.939827 | 2014-12-20T15:25:52 | 2014-12-20T15:25:52 | 27,226,320 | 3 | 3 | null | null | null | null | UTF-8 | C | false | false | 37 | h | LTUpdate.h | ../../../LTUpdate/LTUpdate/LTUpdate.h |
9985a6a2896adbfeb2ae0f28b8ca52ec3d8c24fa | b4a27d6caa9ef512af1145796e40fb4a834d257e | /BasicCalculator.c | c8e48ef178358e68f88f989fc93250a3741ee144 | [
"MIT"
] | permissive | A-Chathumini/HackTheOctober-HacktoberFest | 76eaa2164aeee4295d78069f1980ed375d587695 | e5c434e89e13ae288bd0cc201d7d4b29368905a9 | refs/heads/main | 2023-08-14T21:15:43.526791 | 2021-10-05T04:27:44 | 2021-10-05T04:27:44 | 413,156,285 | 3 | 0 | null | 2021-10-03T21:21:04 | 2021-10-03T18:00:26 | null | UTF-8 | C | false | false | 725 | c | BasicCalculator.c | #include <stdio.h>
#include <string.h>
int main()
{
float x;
float y;
char c[100];
printf("Enter First No.:-");
scanf("%f", &x);
printf("Enter Second No.:-");
scanf("%f", &y);
printf("Enter Operation:-");
scanf("%s", &c);
float s = x + y;
float d = x - y;
float p = x * y;
float q = x / y;
// float r=fmod(x,y);
if (strcmp(c, "sum") == 0)
{
printf("sum is :- %f", s);
}
else if (strcmp(c, "difference") == 0)
{
printf("difference is :- %f", d);
}
else if (strcmp(c, "product") == 0)
{
printf("product is :- %f", p);
}
else if (strcmp(c, "quotient") == 0)
{
printf("quotient is :- %f", q);
// printf("Remainder is :- %f",r);
}
return 0;
} |
8c9368093e44c5fa7f07a24f4ea29450138e4957 | 8f02750a86d0173e7c7ec620605e0bcbe16e2177 | /Source/Lim.h | de8750c82cc37f233a6eb5f13e658f17fcc8fa5f | [] | no_license | Kosalos/LimMetal | eca6081ebfd524aa713052db2b5f7641d803783a | 67491067ee0556ced5e80c476d4f054ff0382e87 | refs/heads/master | 2021-06-09T18:35:13.053274 | 2021-03-26T03:50:04 | 2021-03-26T03:50:04 | 137,108,737 | 5 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,221 | h | Lim.h | /* -------------------------------------------------------------
Please visit: https://dhushara.com/DarkHeart/quasif/quasi.htm
This app is based on the ideas presented in "Depth First C-script Listing in Colour".
I have done many little things in the process of porting it to the iPad,
but the credit belongs to the author of that code.
--------------------------------------------------------------- */
#pragma once
#include "Circle.h"
#define MAXC 1000 // 300000 /* Circle stack */
#define MAXG 8 /* Generator stack */
typedef struct {
int version;
int depth;
float eps;
Matrix gens[MAXG];
float xscale;
float yscale;
float ratio;
float unused[12];
} Control;
typedef struct {
int nfinal;
Circle final[MAXC];
} FinalCircles;
#ifndef __METAL_VERSION__
void limReset(void);
void limGenerate(FinalCircles *fPtr);
void setControlPointer(Control *ptr);
void setActive(int index, int onoff);
int getActive(int index);
float* AxPointer(int index);
float* AyPointer(int index);
float* BxPointer(int index);
float* ByPointer(int index);
float* CxPointer(int index);
float* CyPointer(int index);
float* DxPointer(int index);
float* DyPointer(int index);
#endif
|
d95b1a18c8198f8d9f47e69e9d23d1965b798794 | 03faa163ab2695171f09a31d678cf38934fe965e | /src/templates/template.h | 74013410ae72fa631e25b74f2dba4c037ae0e5cd | [] | no_license | SebastianRueClausen/Cb | 9be5cfc2987db2b92c56200875c7d9c2676e2f55 | 004c735a88552ea796f321d5de4a5e85c522e905 | refs/heads/master | 2023-02-09T23:48:56.167402 | 2021-01-11T23:26:58 | 2021-01-11T23:26:58 | 290,893,370 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 316 | h | template.h | #ifndef TEMPLATE_DEF_H
#define TEMPLATE_DEF_H
#include <stddef.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#define TEMPLATE_JOIN(a, b) a##b
#define TEMPLATE_COMBINE(a, b) TEMPLATE_JOIN(a, b)
#define TEMPLATE_SIGNATURE(prefix, name) TEMPLATE_COMBINE(prefix, TEMPLATE_COMBINE(_, name))
#endif
|
b0d9bb74f89688cdde51567b4de23b182a83f083 | bcc1d14bd27aac5b689f2ed42ad71f848a6e8573 | /utils/hi_type.h | 0a2fa24ef30f11cb55c7b98b0ad7cad2999e1260 | [] | no_license | Hansomewang/GuangDongOSD | f91f1e4511b2462306c633fb96aa8f553f5ba042 | af4f8351ed838c4533347957bd79b4be501944be | refs/heads/master | 2020-03-27T02:21:47.250374 | 2018-08-23T01:44:02 | 2018-08-23T01:44:02 | 145,784,125 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 629 | h | hi_type.h | /*
* hi_types.h
* redefine many data types used in many Hi SDK based application.
*/
#ifndef __HI_TYPE_H__
#define __HI_TYPE_H__
typedef unsigned char HI_U8;
typedef unsigned short HI_U16;
typedef unsigned int HI_U32;
typedef signed char HI_S8;
typedef short HI_S16;
typedef int HI_S32;
#ifdef WIN32
typedef __int64 HI_U64;
typedef __int64 HI_S64;
#else
typedef unsigned long long HI_U64;
typedef signed long long HI_S64;
#endif
typedef char HI_CHAR;
#define HI_VOID void
typedef enum {
HI_FALSE = 0,
HI_TRUE = 1,
} HI_BOOL;
#endif
|
ebc60f2f79d084f81eea7f6e1211da327cf57bdb | 8ac2322aefd84324e6a1d6b3219337545624d853 | /src/gg.c | 6c484b47c141e2a9439afb579fa906009829cb1b | [] | no_license | sdzhao/cole | 3f7289935eb93c4594f8eca6cdb73ec42f23aa2f | d400448dd151ed37eb2a5a9fd2d2c0fd092d6a58 | refs/heads/master | 2022-05-03T10:21:54.093454 | 2022-05-01T02:53:08 | 2022-05-01T02:53:08 | 140,349,219 | 2 | 4 | null | 2022-05-01T02:53:08 | 2018-07-09T22:36:54 | R | UTF-8 | C | false | false | 10,316 | c | gg.c | /* ***************************************************************
gg.c
functions for gaussian sequence problem with gaussian side information
*************************************************************** */
#include <R.h>
#include <Rinternals.h>
#include <math.h>
// bivariate N(mu, S) density
double phi2(double x1, double u1, double s1,
double x2, double u2, double s2,
double r){
double z = (double) (x1 - u1) * (x1 - u1) / s1 / s1 -
2 * r * (x1 - u1) * (x2 - u2) / s1 / s2 +
(x2 - u2) * (x2 - u2) / s2 / s2;
return(1 / (2 * M_PI * s1 * s2 * sqrt(1 - r * r)) *
exp(-0.5 * z / (1 - r * r)));
}
// helper function to calculate weighted sums
double * gg_wsum(double x1, double s1, double x2, double s2,
double r,
int n,
double *t, double rho){
static double ret[3];
// initialize
ret[0] = 0; ret[1] = 0; ret[2] = 0;
// calculate
double tmp;
for(int j = 0; j < n; j++){
tmp = phi2(x1, t[j], s1, x2, t[j + n], s2, r);
ret[0] += tmp;
ret[1] += (t[j] - x1) * tmp;
ret[2] += (t[j] - x1) * (t[j] - x1) * tmp;
}
return(ret);
}
// regularized nonparametric separable rule
SEXP gg_rule(SEXP R_x1, SEXP R_s1, SEXP R_x2, SEXP R_s2,
SEXP R_r,
SEXP R_t, SEXP R_rho){
int n = length(R_x1);
double *x1, *x2, *t;
x1 = REAL(R_x1);
x2 = REAL(R_x2);
t = REAL(R_t);
double s1, s2, r, rho;
s1 = REAL(R_s1)[0];
s2 = REAL(R_s2)[0];
r = REAL(R_r)[0];
rho = REAL(R_rho)[0];
SEXP R_rule = PROTECT(allocVector(REALSXP, n));
double *rule = REAL(R_rule);
double * wsum;
for(int i = 0; i < n; i++){
wsum = gg_wsum(x1[i], s1, x2[i], s2, r, n, t, rho);
rule[i] = x1[i] + wsum[1] / (rho + wsum[0]);
}
UNPROTECT(1);
return(R_rule);
}
// SURE
double gg_sure(double *x1, double s1, double *x2, double s2,
int n, double *t, double rho) {
double sure = 0;
double * wsum;
for(int i = 0; i < n; i++){
wsum = gg_wsum(x1[i], s1, x2[i], s2, 0, n, t, rho);
sure += 2 * wsum[2] / (rho + wsum[0]) +
2 * s1 * s1 * wsum[0] / (rho + wsum[0]) -
wsum[1] * wsum[1] / (rho + wsum[0]) / (rho + wsum[0]);
}
sure = sure / n + s1 * s1;
return(sure);
}
// fast algorithm adds/subtracts potentially small numbers
// and can result in numeric instability, so requires
// rho > 0, e.g. rho = 1e-12
// minimize sure one coordinate at a time
SEXP gg_min_sure_fast(SEXP R_x1, SEXP R_s1, SEXP R_x2, SEXP R_s2,
SEXP R_rho,
SEXP R_K, SEXP R_C,
SEXP R_tol, SEXP R_maxit, SEXP R_maxbreak,
SEXP R_verbose){
int n = length(R_x1);
int i,j; // i indexes x's, j's index t's
double *x1, *x2;
x1 = REAL(R_x1);
x2 = REAL(R_x2);
double s1, s2, rho;
s1 = REAL(R_s1)[0];
s2 = REAL(R_s2)[0];
rho = REAL(R_rho)[0];
int K = INTEGER(R_K)[0];
double C = REAL(R_C)[0];
double tol = REAL(R_tol)[0];
int maxit = INTEGER(R_maxit)[0];
int maxbreak = INTEGER(R_maxbreak)[0];
int verbose = INTEGER(R_verbose)[0];
// first n components are t1, second n are t2
SEXP R_t = PROTECT(allocVector(REALSXP, 2 * n));
double *t = REAL(R_t);
// initialize ts
for(j = 0; j < (2 * n); j++){
if(j < n){
t[j] = x1[j];
} else {
t[j] = x2[j - n];
}
}
// precalculate quantities in the SURE formula
double wsum0[n], wsum1[n], wsum2[n], * wsum;
for(i = 0; i < n; i++){
wsum = gg_wsum(x1[i], s1, x2[i], s2, 0, n, t, rho);
wsum0[i] = wsum[0];
wsum1[i] = wsum[1];
wsum2[i] = wsum[2];
}
// initial sure value
double sure_old = 0;
for(i = 0; i < n; i++){
sure_old += 2 * wsum2[i] / (rho + wsum0[i]) +
2 * s1 * s1 * wsum0[i] / (rho + wsum0[i]) -
wsum1[i] * wsum1[i] / (rho + wsum0[i]) / (rho + wsum0[i]);
}
sure_old = sure_old / n + s1 * s1;
if(verbose == 1){
Rprintf("initial SURE: %f\n", sure_old);
}
// find minimizing t
int iter, k;
double l, u; // lower and upper bounds
double t1_new, t2_new, inc; // also try t[j]s
double tmp, wsum0_new[n], wsum1_new[n], wsum2_new[n];
double sure_min, sure_new; // sure values when trying t[j]s
int optk; // optimal index k of the new t1/t2[j]
// don't break at first convergence of SURE, in case going back
// to change beginning coordinates drops SURE by a lot
int breakcount = 0;
sure_min = sure_old;
for(iter = 0; iter < maxit; iter++){
// coordinate descent (coordinate NOT by pair)
for(j = 0; j < (2 * n); j++){
// lower and upper bounds
if(j < n){ // updating t1 coordinates
t1_new = t[j]; // current t1
t2_new = t[j + n]; // current t2
// sd = s1
l = x1[j] - C * s1;
u = x1[j] + C * s1;
} else { // updating t2 coordinates
t1_new = t[j - n]; // current t1
t2_new = t[j]; // current t2
// sd = s2
l = x2[j - n] - C * s2;
u = x2[j - n] + C * s2;
}
// subtract current t1 and t2 terms
for(i = 0; i < n; i++){
tmp = phi2(x1[i], t1_new, s1, x2[i], t2_new, s2, 0);
wsum0[i] -= tmp;
wsum1[i] -= (t1_new - x1[i]) * tmp;
wsum2[i] -= (t1_new - x1[i]) * (t1_new - x1[i]) * tmp;
}
// determine optimal value of t[j]
// consider original value and K equally spaced values in [l, u]
// if k = 0 then try original t[j] value
inc = (u - l) / (K - 1);
optk = 0;
for(k = 0; k < (K + 1); k++){
if(j < n){
// new value of t1 to try
if(k < 1){
t1_new = t[j];
} else {
t1_new = l + (k - 1) * inc;
}
// keep value of t2_new the same
} else {
// keep value of t1_new the same
// new value of t2 to try
if(k < 1){
t2_new = t[j];
} else {
t2_new = l + (k - 1) * inc;
}
}
// update values of precalculated quantities
for(i = 0; i < n; i++){
tmp = phi2(x1[i], t1_new, s1, x2[i], t2_new, s2, 0);
wsum0_new[i] = wsum0[i] + tmp;
wsum1_new[i] = wsum1[i] + (t1_new - x1[i]) * tmp;
wsum2_new[i] = wsum2[i] + (t1_new - x1[i]) * (t1_new - x1[i]) * tmp;
}
// calculate sure
sure_new = 0;
for(i = 0; i < n; i++){
sure_new += 2 * wsum2_new[i] / (rho + wsum0_new[i]) +
2 * s1 * s1 * wsum0_new[i] / (rho + wsum0_new[i]) -
wsum1_new[i] * wsum1_new[i] / (rho + wsum0_new[i]) / (rho + wsum0_new[i]);
}
sure_new = sure_new / n + s1 * s1;
if(sure_new <= sure_min){
optk = k;
sure_min = sure_new;
}
} // end loop over k, for determining optimal value of t[j]
// update t[j] and wsum's
if(optk > 0){
t[j] = l + (optk - 1) * inc;
}
if(j < n){
t1_new = t[j];
t2_new = t[j + n];
} else {
t1_new = t[j - n];
t2_new = t[j];
}
for(i = 0; i < n; i++){
tmp = phi2(x1[i], t1_new, s1, x2[i], t2_new, s2, 0);
wsum0[i] += tmp;
wsum1[i] += (t1_new - x1[i]) * tmp;
wsum2[i] += (t1_new - x1[i]) * (t1_new - x1[i]) * tmp;
}
} // end coordinate descent
if(verbose == 1){
Rprintf("iter:%d,sure:%f\n", iter + 1, sure_min);
}
// check convergence
// sure_new from the last coordinate is guaranteed to be
// i) lowest among all coordinates
// ii) lower than or equal to sure_old
if((sure_old - sure_min) < tol){
breakcount++;
}
if(breakcount >= maxbreak){
break;
} else {
sure_old = sure_min;
}
// if never break, warn that maxit was reached
if(iter == (maxit - 1)){
Rprintf("maxit reached\n");
}
} // end minimization of sure
UNPROTECT(1);
return(R_t);
}
// minimize sure one coordinate at a time
SEXP gg_min_sure(SEXP R_x1, SEXP R_s1, SEXP R_x2, SEXP R_s2,
SEXP R_rho,
SEXP R_K, SEXP R_C,
SEXP R_tol, SEXP R_maxit, SEXP R_maxbreak, SEXP R_verbose){
int n = length(R_x1);
int j; // j's index t's
double *x1, *x2;
x1 = REAL(R_x1);
x2 = REAL(R_x2);
double s1, s2, rho;
s1 = REAL(R_s1)[0];
s2 = REAL(R_s2)[0];
rho = REAL(R_rho)[0];
int K = INTEGER(R_K)[0];
double C = REAL(R_C)[0];
double tol = REAL(R_tol)[0];
int maxit = INTEGER(R_maxit)[0];
int maxbreak = INTEGER(R_maxbreak)[0];
int verbose = INTEGER(R_verbose)[0];
// first n components are t1, second n are t2
SEXP R_t = PROTECT(allocVector(REALSXP, 2 * n));
double *t = REAL(R_t);
// initialize ts
for(j = 0; j < (2 * n); j++){
if(j < n){
t[j] = x1[j];
} else {
t[j] = x2[j - n];
}
}
// initial sure value
double sure_old = gg_sure(x1, s1, x2, s2, n, t, rho);
if(verbose == 1){
Rprintf("initial SURE: %f\n", sure_old);
}
// find minimizing t
int iter, k;
double l, u; // lower and upper bounds
double t_old, inc; // old value of t[j] if new one doesn't lower sure
double sure_min, sure_new; // sure values when trying t[j]s
// don't break at first convergence of SURE
// need an extra cycle of no improvement in SURE to converge
int breakcount = 0;
sure_min = sure_old;
for(iter = 0; iter < maxit; iter++){
// coordinate descent (coordinate NOT by pair)
for(j = 0; j < (2 * n); j++){
// store old t[j] and calculate lower and upper bounds
t_old = t[j];
if(j < n){ // t1
l = x1[j] - C * s1;
u = x1[j] + C * s1;
} else { // t2
l = x2[j - n] - C * s2;
u = x2[j - n] + C * s2;
}
// determine optimal value of t[j]
// consider K equally spaced values in [l, u]
inc = (u - l) / (K - 1);
for(k = 0; k < K; k++){
// try new value of t[j]
t[j] = l + k * inc;
// calculate sure
sure_new = gg_sure(x1, s1, x2, s2, n, t, rho);
// update t[j] only if sure is reduced
if (sure_new <= sure_min) {
sure_min = sure_new;
t_old = t[j];
} else {
t[j] = t_old;
}
} // end loop over k, for determining optimal value of t[j]
} // end coordinate descent
if(verbose == 1){
Rprintf("iter:%d,sure:%f\n", iter + 1, sure_min);
}
// check convergence
// sure_new from the last coordinate is guaranteed to be
// i) lowest among all coordinates
// ii) lower than or equal to sure_old
if((sure_old - sure_min) < tol){
breakcount++;
}
if(breakcount >= maxbreak){
break;
} else {
sure_old = sure_min;
}
// if never break, warn that maxit was reached
if(iter == (maxit - 1)){
Rprintf("maxit reached\n");
}
} // end minimization of sure
UNPROTECT(1);
return(R_t);
}
|
ecef759ddcd718b8ec3cb13297c19836cbd18c49 | 90fcef99d2d7595792cde24274609f57d7ece3de | /位运算符应用/源.c | 08ee4a2dbbf2bc2d369ac500974805e89ca29bd7 | [] | no_license | Cassie866/cpp.practice | f90b49593a61021a8dcd5c232da6a069101339dc | ec17a8133f27ec87e775e1d254b1e6bc6c437719 | refs/heads/master | 2020-07-11T08:10:25.982152 | 2019-10-14T01:38:05 | 2019-10-14T01:38:05 | 204,484,868 | 1 | 0 | null | null | null | null | GB18030 | C | false | false | 524 | c | 源.c | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
/*
返回参数二进制中 1 的个数。
比如:
15
0000 1111
4 个 1
*/
//返回参数二进制中1的个数
int count_one_bits(int value)
{
int count = 0;
for (int i = 0; i < 32; i++)
{
if (((value >> i) & 1) == 1)
{
count++;
}
}
return count;
}
int main()
{
printf("请输入一个数字:\n");
int value = 0;
scanf("%d", &value);
printf("二进制中1的个数: %d\n", count_one_bits(value));
system("pause");
return 0;
} |
4570f4c867e444fa81fa7143e8419cf7192f9c2e | 138cbca484d96709595cac0853c943e4ec229dcc | /239-A/239-A-bug-17085647-17092154/239-A.c | 856344b157d80ceec52410e66e99283220e452d5 | [] | no_license | diogomfreitas/pySBFL | d5432ef720d362efc30342ca799df91e229e32bc | b346eff14dcbe4252a17ffc57b405b16f1716026 | refs/heads/master | 2021-10-16T10:58:50.898876 | 2019-02-10T21:18:24 | 2019-02-10T21:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 240 | c | 239-A.c | #include<stdio.h>
int main(int argc, char *argv[])
{
long long int y,k,n,i,x,count=0;
scanf("%d%d%d",&y,&k,&n);
x=n-y;
for(i=k;i<=n;i+=k)
{
if(i>y)
{
printf("%d ",i-y);
count++;
}
}
if(count==0)
printf("-1");
return 0;
} |
fd5a7b935192f5f4cfd6e1da0af2738f63dd3c3c | 72ca71f3162f3033cc3ce404e6df6866d90d5de2 | /eettA-SM-SIMD.c/squaredme/abbr0h.c | 0fb01688930d66deb5f21bf4b491cf69aa5ecaca | [] | no_license | JNicL/FormCalc-SIMD | a663f82dc6962afaee842a624a88945f1ba5ea9a | 18b59bf5aef8d07a943aa10fdce5161aeeec7de3 | refs/heads/master | 2021-01-10T20:43:28.978068 | 2013-04-12T09:47:59 | 2013-04-12T09:47:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,852 | c | abbr0h.c | #include "vars.h"
#include "inline.h"
void abbr0h() {
#include "vars.h"
#include "inline.h"
F32 = ChainV2(Spinor(1,2),0,ec(5),k(3),1,Spinor(4,2));
F34 = -1*(ChainB2(Spinor(1,2),0,ec(5),k(4),0,Spinor(3,1)));
F9 = -1*(ChainV0(Spinor(4,2),0,0,Spinor(3,1)));
F13 = ChainB0(Spinor(4,2),0,0,Spinor(2,1));
F12 = ChainB0(Spinor(4,2),0,0,Spinor(3,1));
F35 = ChainV1(Spinor(1,2),0,ec(5),0,Spinor(3,1));
F3 = ChainV1(Spinor(1,2),0,ec(5),1,Spinor(4,2));
F33 = ChainB1(Spinor(1,2),0,ec(5),0,Spinor(3,1));
F6 = -1*(ChainB1(Spinor(1,2),0,ec(5),1,Spinor(4,2)));
F30 = -1*(ChainB1(Spinor(1,2),0,k(3),0,Spinor(2,1)));
F8 = ChainV1(Spinor(4,2),0,ec(5),0,Spinor(2,1));
F17 = ChainV1(Spinor(4,2),0,k(2),0,Spinor(3,1));
F4 = ChainB1(Spinor(4,2),0,ec(5),0,Spinor(2,1));
F22 = -1*(ChainB1(Spinor(4,2),0,k(1),0,Spinor(3,1)));
F18 = -1*(ChainB1(Spinor(4,2),0,k(2),0,Spinor(3,1)));
F27 = ChainV2(Spinor(1,2),0,ec(5),k(2),1,Spinor(4,2));
F36 = -1*(ChainV2(Spinor(1,2),0,ec(5),k(4),0,Spinor(3,1)));
F28 = -1*(ChainB2(Spinor(1,2),0,ec(5),k(2),1,Spinor(4,2)));
F31 = -1*(ChainB2(Spinor(1,2),0,ec(5),k(3),1,Spinor(4,2)));
F23 = ChainV2(Spinor(4,2),0,ec(5),k(1),0,Spinor(2,1));
F7 = -1*(ChainV0(Spinor(1,2),0,0,Spinor(3,1)));
F15 = ChainV0(Spinor(1,2),0,1,Spinor(4,2));
F1 = -1*(ChainB0(Spinor(1,2),0,0,Spinor(3,1)));
F25 = -1*(ChainB0(Spinor(1,2),0,1,Spinor(4,2)));
F5 = -1*(ChainV0(Spinor(2,1),1,0,Spinor(3,1)));
F2 = ChainB0(Spinor(2,1),1,0,Spinor(3,1));
F24 = ChainV0(Spinor(4,2),0,0,Spinor(2,1));
F10 = ChainV1(Spinor(1,2),0,ec(5),0,Spinor(2,1));
F29 = ChainV1(Spinor(1,2),0,k(3),0,Spinor(2,1));
F19 = ChainV1(Spinor(1,2),0,k(4),0,Spinor(2,1));
F11 = -1*(ChainB1(Spinor(1,2),0,ec(5),0,Spinor(2,1)));
F26 = -1*(ChainB1(Spinor(1,2),0,k(4),0,Spinor(2,1)));
F20 = ChainV1(Spinor(4,2),0,ec(5),0,Spinor(3,1));
F16 = ChainV1(Spinor(4,2),0,k(1),0,Spinor(3,1));
F21 = -1*(ChainB1(Spinor(4,2),0,ec(5),0,Spinor(3,1)));
F14 = ChainB2(Spinor(4,2),0,ec(5),k(1),0,Spinor(2,1));
Pair1 = Pair(ec(5),k(1));
Pair2 = Pair(ec(5),k(2));
Sub436 = cmult(F10,F16+F17)+cmult(F2,-F27-cmult(2*(F15),Pair1));
Sub3721 = -1*(cmult(F11,F16+F17))+cmult(F1,-F23+cmult(2*(F24),Pair1+Pair2));
Sub18 = cmult(F2,F3)+cmult(F10,-F12+F9);
Sub437 = cmult(F11,F18+F22)+cmult(F5,-F28-cmult(2*(F25),Pair1));
Sub1408 = cmult(F10,F18+F22)-cmult(F7,-F14+cmult(2*(F13),Pair1+Pair2));
Sub14 = cmult(F24,F33)+cmult(F11,F12-F9);
Sub32 = cmult(F19,F20)+Sub436;
Sub29 = -1*(cmult(F20,F26))+Sub3721;
Sub4 = cmult(F10,F17)+cmult(F2,-F32-MT*F3);
Sub3 = cmult(F11,F17)+cmult(F24,-F34+MT*(F33));
Sub22 = (1/(SW2))*((2*(SW2))*(Sub14)+(1-2*(SW2))*(Sub18));
Sub35 = (1/(SW2))*((2*(SW2))*(Sub29)+(1-2*(SW2))*(Sub32));
Sub31 = -1*(cmult(F7,F8))+Sub18;
Sub28 = cmult(F1,F4)-cmult(F5,F6)+cmult(F11,-F12+F9);
Sub33 = cmult(F21,F26)+Sub437;
Sub2949 = cmult(F1,F23)+cmult(F2,-F27+cmult(2*(F15),Pair2));
Sub9 = -1*(cmult(F20,F29))+cmult(F2,-F27+cmult(2*(F15),Pair2));
Sub15 = cmult(F11,F16)+cmult(F20,F26+F30)-cmult(F24,-F34+cmult(2*F1,Pair1+Pair2));
Sub30 = cmult(F19,F21)+Sub1408;
Sub9998 = cmult(F2,F32)+cmult(F24,F34)+cmult(F13,F36)+cmult(F31,F5);
Sub19 = cmult(F10,F16)+cmult(F20,F19+F29)+cmult(F2,F32-cmult(2*(F15),Pair1+Pair2));
Opt25 = -1*(cmult(F21,F29))+cmult(F20,-F29-F30)-cmult(F21,F30);
Sub20 = cmult(F5,F6)+cmult(F11,F12-F9);
Sub16 = cmult(F13,F35)+cmult(F10,-F12+F9);
Sub6 = cmult(F10,F18)+cmult(F13,-F36+MT*(F35));
Sub8561 = cmult(F20,F26)-cmult(cmult(2*F1,F24),Pair1+Pair2);
Sub14151 = cmult(F11,F22)-cmult(cmult(2*(F25),F5),Pair1+Pair2);
Sub14146 = cmult(F10,F22)-cmult(cmult(2*(F13),F7),Pair1+Pair2);
Sub11 = (1/(SW2))*((1-2*(SW2))*(cmult(F2,F3))+(SW2)*(cmult(-2*F1,F4)+cmult(2*F5,F6))+(-1+2*(SW2))*(cmult(F7,F8)));
Sub34 = (1/(SW2))*((2*(SW2))*(Sub28)+(-1+2*(SW2))*(Sub31));
Sub5 = (1/(SW2))*((2*(SW2))*(Sub3)+(-1+2*(SW2))*(Sub4));
Sub12 = (1/(SW2))*((SW2)*(cmult(-2*F1,F23)+cmult(2*(F20),F30))+(1-2*(SW2))*(Sub9));
Sub1070 = cmult(F11,F16+F17+F18+F22)+cmult(F1,F23)-cmult(F28,F5);
Sub917 = cmult(F10,F16+F17+F18+F22)-cmult(F2,F27)+cmult(F14,F7);
Sub7 = -1*(cmult(F11,F18))+cmult(F5,F31+MT*F6);
Sub10 = cmult(F21,F30)+cmult(F5,F28-cmult(2*(F25),Pair2));
Sub8567 = -1*(cmult(F19,F21))+cmult(cmult(2*(F13),F7),Pair1+Pair2);
Sub21 = cmult(F11,F22)+cmult(F21,F26+F30)-cmult(F5,-F31+cmult(2*(F25),Pair1+Pair2));
Sub23 = (1/(SW2))*((-1+2*(SW2))*(Sub19)+(SW2)*(2*(Sub15)-MT*(Sub22)));
Sub753 = (-1*4+8*(SW2))*(Sub30)+(8*(SW2))*(Sub33)+(3-4*(SW2))*(Sub35);
Sub14061 = -1*(cmult(F2,F3))+cmult(F24,F33)+cmult(F13,F35)-cmult(F5,F6);
Sub612 = cmult(F10+F11,F17+F18)-Sub9998;
Sub566 = cmult(F20,-F29-F30)+Sub2949;
Sub569 = -1*(cmult(F21,F29))+cmult(F14,F7)-Sub10;
Sub17 = cmult(F21,F19+F29)+cmult(F13,F36)+Sub14146;
Sub14237 = Sub9998-MT*(Sub14061);
Sub24 = (4-8*(SW2))*(Sub17)-(8*(SW2))*(Sub21)+(3-4*(SW2))*(Sub23)+MT*((-4+8*(SW2))*(Sub16)-(8*(SW2))*(Sub20));
Sub8 = (3-4*(SW2))*(Sub5)+(4-8*(SW2))*(Sub6)+(8*(SW2))*(Sub7);
Sub13 = (4-8*(SW2))*(cmult(F21,F29))+(-4+8*(SW2))*(cmult(F14,F7))-(8*(SW2))*(Sub10)+(3*MT)*(Sub11)+(3-4*(SW2))*(Sub12);
Sub36 = -1*(Sub753)+(3*MT)*(Sub34);
Sub26 = Sub612+MT*(Sub14061);
Sub2 = Sub566+Sub569;
Sub1 = cmult(F21,F26)+cmult(F20,F19+F26)-2*(cmult(cmult(F15,F2)+cmult(F1,F24)+cmult(F25,F5),Pair1)+cmult(cmult(F1,F24),Pair2))+Sub1070-Sub8567+Sub917;
Sub27 = cmult(F10+F11,F16)+cmult(F19,F20+F21)+cmult(F21,F26)-Opt25-cmult(cmult(2*(F15),F2),Pair1+Pair2)+Sub14146+Sub14151+Sub14237+Sub8561;
Sub14662 = (Sub13)/(-MZ2+S)+(8*(CW2))*((Sub2)/S);
Sub14664 = (8*(Sub1))/S-(1/(CW2))*((Sub36)/(-MZ2+S));
Sub14666 = (8*(Sub27))/(S34)-(1/(CW2))*((Sub24)/(-MZ2+S34));
Sub14660 = (8*(Sub26))/(S34)-(1/(CW2))*((Sub8)/(-MZ2+S34));
}
|
e51568a44b4b3fcefac93a6b7f7c8ec4e480ccab | 05a4d2bf45b32798d2f6820c4ec001dd8ef13e4a | /tests/unit/conn_cfg/conn_cfg-compl_channel.c | b47f49a3606884093e527625fc53dda48a4bff01 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | pmem/rpma | 207ee08f465a22341f92c80b15132a9617e57596 | 93d31224fd69786d4b1ace0084108aa270e4c263 | refs/heads/main | 2023-09-01T05:29:34.609582 | 2023-06-13T12:12:10 | 2023-06-13T12:12:10 | 240,216,867 | 115 | 63 | NOASSERTION | 2023-09-05T14:31:33 | 2020-02-13T08:59:31 | C | UTF-8 | C | false | false | 2,592 | c | conn_cfg-compl_channel.c | // SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2022, Intel Corporation */
/*
* conn_cfg-compl_channel.c -- the rpma_conn_cfg_set/get_compl_channel()
* unit tests
*
* APIs covered:
* - rpma_conn_cfg_set_compl_channel()
* - rpma_conn_cfg_get_compl_channel()
*/
#include "conn_cfg-common.h"
#include "test-common.h"
/*
* set__cfg_NULL -- NULL cfg is invalid
*/
static void
set__cfg_NULL(void **unused)
{
/* run test */
int ret = rpma_conn_cfg_set_compl_channel(NULL, true);
/* verify the results */
assert_int_equal(ret, RPMA_E_INVAL);
}
/*
* get__cfg_NULL -- NULL cfg is invalid
*/
static void
get__cfg_NULL(void **unused)
{
/* run test */
bool shared;
int ret = rpma_conn_cfg_get_compl_channel(NULL, &shared);
/* verify the results */
assert_int_equal(ret, RPMA_E_INVAL);
}
/*
* get__shared_NULL -- NULL shared is invalid
*/
static void
get__shared_NULL(void **cstate_ptr)
{
struct conn_cfg_test_state *cstate = *cstate_ptr;
/* run test */
int ret = rpma_conn_cfg_get_compl_channel(cstate->cfg, NULL);
/* verify the results */
assert_int_equal(ret, RPMA_E_INVAL);
}
/*
* get_default__success -- get the default value
*/
static void
get_default__success(void **cstate_ptr)
{
struct conn_cfg_test_state *cstate = *cstate_ptr;
/* run test */
bool shared;
int ret = rpma_conn_cfg_get_compl_channel(cstate->cfg, &shared);
/* verify the results */
assert_int_equal(ret, MOCK_OK);
assert_int_equal(shared, false);
}
/*
* compl_channel__lifecycle -- happy day scenario
*/
static void
compl_channel__lifecycle(void **cstate_ptr)
{
struct conn_cfg_test_state *cstate = *cstate_ptr;
/* run test */
int ret = rpma_conn_cfg_set_compl_channel(cstate->cfg, true);
/* verify the results */
assert_int_equal(ret, MOCK_OK);
bool shared;
ret = rpma_conn_cfg_get_compl_channel(cstate->cfg, &shared);
assert_int_equal(ret, MOCK_OK);
assert_int_equal(shared, true);
}
static const struct CMUnitTest test_compl_channel[] = {
/* rpma_conn_cfg_set_compl_channel() unit tests */
cmocka_unit_test(set__cfg_NULL),
/* rpma_conn_cfg_get_compl_channel() unit tests */
cmocka_unit_test(get__cfg_NULL),
cmocka_unit_test_setup_teardown(get__shared_NULL,
setup__conn_cfg, teardown__conn_cfg),
cmocka_unit_test_setup_teardown(get_default__success,
setup__conn_cfg, teardown__conn_cfg),
/* rpma_conn_cfg_set/get_compl_channel() lifecycle */
cmocka_unit_test_setup_teardown(compl_channel__lifecycle,
setup__conn_cfg, teardown__conn_cfg),
};
int
main(int argc, char *argv[])
{
return cmocka_run_group_tests(test_compl_channel, NULL, NULL);
}
|
ea192ae65704e42c39c947e7177a69ea83fddadc | 7852a8d5046a23ad92d0982680301996db66f4c4 | /target/dalrcf405/inc/board.h | 8c65fe24f17d9517f89dc2c786cfa5693ee4d35d | [] | no_license | pawelsmyczek/fc_os | e7956f15fe0cb7424e990378e8eda439ffc07cd2 | 8c2d1cc634cefd4b391177465ce613c5f9ee5e1f | refs/heads/master | 2023-07-13T05:55:16.477037 | 2023-03-22T16:52:40 | 2023-03-22T16:52:40 | 213,476,708 | 0 | 0 | null | 2023-03-22T16:49:12 | 2019-10-07T20:09:40 | C | UTF-8 | C | false | false | 1,060 | h | board.h | #ifndef FC_SOFT_BOARD_H
#define FC_SOFT_BOARD_H
#include <gpio.h>
#include <dma.h>
#include <spi.h>
#include <iic.h>
#include <irq.h>
#include <uart.h>
#include <timer.h>
#include <adc.h>
//#define DISCOVERY
struct DMA1Streams
{
io::DMA stream0;
io::DMA stream2;
io::DMA stream3;
io::DMA stream4;
io::DMA stream7;
};
extern DMA1Streams dma1;
struct DMA2Streams
{
io::DMA stream0;
io::DMA stream2;
io::DMA stream3;
io::DMA stream5;
io::DMA stream7;
};
extern DMA2Streams dma2;
struct ADCs
{
io::ADC_ adc1;
};
extern ADCs adcs;
struct SPIs
{
io::SPI spi1;
io::SPI spi2;
io::SPI spi3;
};
extern SPIs spis;
struct I2Cs
{
io::I2C i2c1;
io::I2C i2c2;
};
extern I2Cs i2cs;
struct UARTs
{
io::UART uart1;
io::UART uart4;
};
extern UARTs uarts;
struct PWMs
{
io::PWM pwm1;
io::PWM pwm2;
io::PWM pwm3;
io::PWM pwm4;
};
extern PWMs pwms;
struct ExternalInterrupts
{
io::ExternalInterruptCfg exti4;
};
extern ExternalInterrupts extirqs;
#endif //FC_SOFT_BOARD_H
|
79871e6453cf8e3b2fb8b432c0679f8aaa8879a8 | 47360f849c2563e359965b1dbc386c00f6617506 | /src/version_bk.h | 923dce454f35274966f25233380c92aeb80c3adb | [] | no_license | bhanug/debugger | be4f7bd0b56591e04d49dd52121139cf80033fed | d46ff574882dd50f767b49a75060c547658fb1e2 | refs/heads/master | 2021-01-17T21:00:09.795368 | 2012-02-05T07:07:31 | 2012-02-05T07:07:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,388 | h | version_bk.h | /*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at
* http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at src/CDDL.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
* Copyright (c) 2004-2005 PathScale, Inc. All rights reserved.
* Use is subject to license terms.
file: version_bk.h
created on: Tue Jan 18 13:30:26 PDT 2004
author: James Strother <[email protected]>
*/
/* This file gives declarations for variables which are
* auto-generated at buildtime and written into the file
* version_bk.c by the Makefile. This file needs to be
* kept in-sync with the Makefile rules.
*/
extern const char* cset_rev;
extern const char* cset_key;
extern const char* build_root;
extern const char* build_host;
extern const char* build_date;
extern const char* psc_full_ver;
|
08f46d6e149291ab5f824ed62520f14f7ce03c7b | 5629bbefd4e81e62bf1038b8ac67776b5e0951ab | /dabbad/include/dabbad/interface-driver.h | adf5a27c94e80b99c2a3c77f9ecfaf759551ee50 | [
"MIT"
] | permissive | eroullit/dabba | cfa878090f8cef82edddf8fd73be705d335da60a | 83cfbefb7a9b45769e16f8519103ce0229f76e5b | refs/heads/master | 2021-01-18T13:43:00.287013 | 2013-08-29T20:14:48 | 2013-08-29T20:14:48 | 3,068,693 | 1 | 1 | null | 2013-08-24T15:23:00 | 2011-12-29T12:53:35 | C | UTF-8 | C | false | false | 315 | h | interface-driver.h |
#ifndef INTERFACE_DRIVER_H
#define INTERFACE_DRIVER_H
#include <libdabba-rpc/rpc.h>
void dabbad_interface_driver_get(Dabba__DabbaService_Service * service,
const Dabba__InterfaceIdList * id_list,
Dabba__InterfaceDriverList_Closure
closure, void *closure_data);
#endif /* INTERFACE_DRIVER_H */
|
3d0d8391b322a6076cf47d005e244320f2b1d2c8 | 2752b6338dd7890555067faf5e9e448744469295 | /LuaWrap/inc/LuaWrap.h | a75545340aa329ac8cacc1df134f4cb96df3b899 | [
"MIT"
] | permissive | luada/LuaEngine | ff24ad01f16f2116a2e0345a7795c9f5f347d918 | a887a151dc40b50aceb77089f37498381e11e7ff | refs/heads/master | 2020-04-08T19:56:41.208131 | 2018-11-29T14:29:22 | 2018-11-29T14:29:22 | 159,677,409 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 275 | h | LuaWrap.h | #pragma once
#ifdef USE_LUA_JIT
#include "lua.hpp"
extern "C"
{
#include "tolua++.h"
}
#else
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "lstring.h"
#include "lundump.h"
#include "tolua++.h"
}
#endif // USE_LUA_JIT
|
f6960f94cc4e0a8a9280cb3803206b1d3c71944c | 3c4a181685feece1abdebc2da4a236fc07caca75 | /HW3/xv6/rwlock.h | 8348bc3637f5c4d34c5eb56945217a24a1e7d399 | [] | no_license | mmerler/osgroup | 5f1a25f49649ae98176ff098551512d205170c46 | aedb58dec8d4be3429d63fe915fb7ccdf2131cd9 | refs/heads/master | 2021-01-25T12:07:33.421673 | 2011-04-20T19:09:43 | 2011-04-20T19:09:43 | 1,335,987 | 2 | 3 | null | null | null | null | UTF-8 | C | false | false | 302 | h | rwlock.h | // Added by Jingyue
// Read-write mutexes
#define OP_INIT 0
#define OP_READLOCK 1
#define OP_READUNLOCK 2
#define OP_WRITELOCK 3
#define OP_WRITEUNLOCK 4
#define OP_DESTROY 5
struct rwlock
{
int readcount, writecount, wantsR;
volatile long mutex1, mutex2, mutex3, w, r;
};
|
f13715c7e65494a914968a2884e532a44959ad8e | e4e1e0f1caf19572a2c778bd294abcc74e8d11db | /cython/hello_world.c | 959a6c7fcb9266b3ee6a123f83842b01d128c841 | [] | no_license | westurner/hello_world | 01cd033dbf74a406d57c51674a9c88baaf391f3b | 18b3a872ad3f9d9ab0b3c1a351e0a77df1093d1c | refs/heads/master | 2020-12-25T18:20:42.966513 | 2014-10-24T12:11:58 | 2014-10-24T12:11:58 | 5,734,959 | 0 | 2 | null | null | null | null | UTF-8 | C | false | true | 218,599 | c | hello_world.c | /* Generated by Cython 0.16 on Fri Aug 24 22:51:48 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyCFunction_Call PyObject_Call
#else
#define __Pyx_PyCFunction_Call PyCFunction_Call
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
#define PyNumber_Index(o) PyNumber_Int(o)
#define PyIndex_Check(o) PyNumber_Check(o)
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
#define __PYX_BUILD_PY_SSIZE_T "n"
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
#define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
#define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_FromFormat PyString_FromFormat
#define PyBytes_DecodeEscape PyString_DecodeEscape
#define PyBytes_AsString PyString_AsString
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyBytes_GET_SIZE PyString_GET_SIZE
#define PyBytes_Repr PyString_Repr
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__c_hello_world
#define __PYX_HAVE_API__c_hello_world
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
/* inline attribute */
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
/* Type Conversion Predeclarations */
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char *__pyx_f[] = {
"hello_world.py",
};
/*--- Type declarations ---*/
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
#define __Pyx_PyObject_AsDouble(obj) \
((likely(PyFloat_CheckExact(obj))) ? \
PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) {
PyObject *r, *m, *t, *py_ix;
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000
if (likely(PyList_CheckExact(L))) {
Py_ssize_t size = PyList_GET_SIZE(L);
if (likely(size > (((PyListObject*)L)->allocated >> 1))) {
if (ix < 0) {
ix += size;
}
if (likely(0 <= ix && ix < size)) {
PyObject* v = PyList_GET_ITEM(L, ix);
Py_SIZE(L) -= 1;
size -= 1;
memmove(&PyList_GET_ITEM(L, ix), &PyList_GET_ITEM(L, ix+1), (size-ix)*sizeof(PyObject*));
return v;
}
}
}
#endif
py_ix = t = NULL;
m = __Pyx_GetAttrString(L, "pop");
if (!m) goto bad;
py_ix = PyInt_FromSsize_t(ix);
if (!py_ix) goto bad;
t = PyTuple_New(1);
if (!t) goto bad;
PyTuple_SET_ITEM(t, 0, py_ix);
py_ix = NULL;
r = PyObject_CallObject(m, t);
Py_DECREF(m);
Py_DECREF(t);
return r;
bad:
Py_XDECREF(m);
Py_XDECREF(t);
Py_XDECREF(py_ix);
return NULL;
}
static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
return unlikely(b < 0) ? b : !b;
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}
static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
PyObject *value;
if (unlikely(d == Py_None)) {
__Pyx_RaiseNoneIndexingError();
return NULL;
}
value = PyDict_GetItemWithError(d, key);
if (unlikely(!value)) {
if (!PyErr_Occurred())
PyErr_SetObject(PyExc_KeyError, key);
return NULL;
}
Py_INCREF(value);
return value;
}
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
PyObject *modname); /*proto*/
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
#define __Pyx_CYFUNCTION_CCLASS 0x04
#define __Pyx_CyFunction_GetClosure(f) \
(((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
(((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
PyCFunctionObject func;
int flags;
PyObject *func_dict;
PyObject *func_weakreflist;
PyObject *func_name;
PyObject *func_doc;
PyObject *func_code;
PyObject *func_closure;
PyObject *func_classobj; /* No-args super() class cell */
void *defaults;
int defaults_pyobjects;
PyObject *defaults_tuple; /* Const defaults tuple */
PyObject *(*defaults_getter)(PyObject *);
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, self, module, code) \
__Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, self, module, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *,
PyMethodDef *ml, int flags,
PyObject *self, PyObject *module,
PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
size_t size,
int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
PyObject *tuple);
static int __Pyx_CyFunction_init(void);
#include <string.h>
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static int __Pyx_check_binary_version(void);
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'c_hello_world' */
#define __Pyx_MODULE_NAME "c_hello_world"
int __pyx_module_is_main_c_hello_world = 0;
/* Implementation of 'c_hello_world' */
static PyObject *__pyx_builtin_reduce;
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_pf_13c_hello_world_10HelloWorld_product(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_13c_hello_world_10HelloWorld_2main(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static char __pyx_k_1[] = "Hello World";
static char __pyx_k_3[] = "// basic math";
static char __pyx_k_5[] = "// loops; nested arrays; functions";
static char __pyx_k_8[] = "// if-conditionals";
static char __pyx_k_10[] = "totalsum*5: %d";
static char __pyx_k_11[] = "totalsum is zero?";
static char __pyx_k_13[] = "totalsum is off";
static char __pyx_k_15[] = "// function overload";
static char __pyx_k_19[] = "// input coercion";
static char __pyx_k_22[] = "10.0";
static char __pyx_k_23[] = "// try/catch blocks";
static char __pyx_k_25[] = "x20.2";
static char __pyx_k_26[] = "err: %s is not a double";
static char __pyx_k_27[] = "// ArrayLists";
static char __pyx_k_30[] = "\n";
static char __pyx_k_31[] = "// Maps";
static char __pyx_k_33[] = "size = %d";
static char __pyx_k_34[] = "%s: %s";
static char __pyx_k_35[] = "contains the value '%s'";
static char __pyx_k_36[] = "does not contain the value '%s'";
static char __pyx_k_37[] = "%s=%s";
static char __pyx_k_38[] = "// Collections.sort";
static char __pyx_k_40[] = "// OrderedDict";
static char __pyx_k_42[] = "duplicate key: '%s' [%s] {{%s}}";
static char __pyx_k_45[] = "/home/wturner/workspace/.virtualenvs/math/src/itsbeenawhile/cython/hello_world.py";
static char __pyx_k__e[] = "e";
static char __pyx_k__i[] = "i";
static char __pyx_k__j[] = "j";
static char __pyx_k__k[] = "k";
static char __pyx_k__n[] = "n";
static char __pyx_k__v[] = "v";
static char __pyx_k__10[] = "10";
static char __pyx_k__cls[] = "cls";
static char __pyx_k__get[] = "get";
static char __pyx_k__key[] = "key";
static char __pyx_k__mul[] = "mul";
static char __pyx_k__one[] = "one";
static char __pyx_k__ten[] = "ten";
static char __pyx_k__two[] = "two";
static char __pyx_k__uno[] = "uno";
static char __pyx_k___map[] = "_map";
static char __pyx_k___sum[] = "_sum";
static char __pyx_k__args[] = "args";
static char __pyx_k__four[] = "four";
static char __pyx_k__imap[] = "imap";
static char __pyx_k__join[] = "join";
static char __pyx_k__main[] = "main";
static char __pyx_k__math[] = "math";
static char __pyx_k__self[] = "self";
static char __pyx_k__sqrt[] = "sqrt";
static char __pyx_k__nsums[] = "nsums";
static char __pyx_k__print[] = "print";
static char __pyx_k__range[] = "range";
static char __pyx_k__three[] = "three";
static char __pyx_k__reduce[] = "reduce";
static char __pyx_k__sorted[] = "sorted";
static char __pyx_k__intlist[] = "intlist";
static char __pyx_k__nextint[] = "nextint";
static char __pyx_k__product[] = "product";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__iterkeys[] = "iterkeys";
static char __pyx_k__operator[] = "operator";
static char __pyx_k__totalsum[] = "totalsum";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__doublestr[] = "doublestr";
static char __pyx_k__iteritems[] = "iteritems";
static char __pyx_k__itertools[] = "itertools";
static char __pyx_k__sortedmap[] = "sortedmap";
static char __pyx_k__HelloWorld[] = "HelloWorld";
static char __pyx_k__tenpointoh[] = "tenpointoh";
static char __pyx_k__OrderedDict[] = "OrderedDict";
static char __pyx_k__collections[] = "collections";
static char __pyx_k__invertedmap[] = "invertedmap";
static char __pyx_k__searchvalue[] = "searchvalue";
static char __pyx_k___currentvalue[] = "_currentvalue";
static char __pyx_k__c_hello_world[] = "c_hello_world";
static char __pyx_k__twentypointtwo[] = "twentypointtwo";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s__10;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__HelloWorld;
static PyObject *__pyx_n_s__OrderedDict;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___currentvalue;
static PyObject *__pyx_n_s___map;
static PyObject *__pyx_n_s___sum;
static PyObject *__pyx_n_s__args;
static PyObject *__pyx_n_s__c_hello_world;
static PyObject *__pyx_n_s__cls;
static PyObject *__pyx_n_s__collections;
static PyObject *__pyx_n_s__doublestr;
static PyObject *__pyx_n_s__e;
static PyObject *__pyx_n_s__four;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__imap;
static PyObject *__pyx_n_s__intlist;
static PyObject *__pyx_n_s__invertedmap;
static PyObject *__pyx_n_s__iteritems;
static PyObject *__pyx_n_s__iterkeys;
static PyObject *__pyx_n_s__itertools;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__k;
static PyObject *__pyx_n_s__key;
static PyObject *__pyx_n_s__main;
static PyObject *__pyx_n_s__math;
static PyObject *__pyx_n_s__mul;
static PyObject *__pyx_n_s__n;
static PyObject *__pyx_n_s__nextint;
static PyObject *__pyx_n_s__nsums;
static PyObject *__pyx_n_s__one;
static PyObject *__pyx_n_s__operator;
static PyObject *__pyx_n_s__print;
static PyObject *__pyx_n_s__product;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__reduce;
static PyObject *__pyx_n_s__searchvalue;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__sortedmap;
static PyObject *__pyx_n_s__sqrt;
static PyObject *__pyx_n_s__ten;
static PyObject *__pyx_n_s__tenpointoh;
static PyObject *__pyx_n_s__three;
static PyObject *__pyx_n_s__totalsum;
static PyObject *__pyx_n_s__twentypointtwo;
static PyObject *__pyx_n_s__two;
static PyObject *__pyx_n_s__uno;
static PyObject *__pyx_n_s__v;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_2025;
static PyObject *__pyx_k_slice_7;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_14;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_17;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_39;
static PyObject *__pyx_k_tuple_41;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_46;
static PyObject *__pyx_k_codeobj_44;
static PyObject *__pyx_k_codeobj_47;
/* Python wrapper */
static PyObject *__pyx_pw_13c_hello_world_10HelloWorld_1product(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_13c_hello_world_10HelloWorld_1product = {__Pyx_NAMESTR("product"), (PyCFunction)__pyx_pw_13c_hello_world_10HelloWorld_1product, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_13c_hello_world_10HelloWorld_1product(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
CYTHON_UNUSED PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_args = 0;
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__args,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("product (wrapper)", 0);
__pyx_self = __pyx_self;
{
PyObject* values[2] = {0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__args);
if (likely(values[1])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("product", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "product") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_args = values[1];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("product", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("c_hello_world.HelloWorld.product", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_13c_hello_world_10HelloWorld_product(__pyx_self, __pyx_v_self, __pyx_v_args);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "hello_world.py":9
*
* class HelloWorld:
* def product(self, args): # <<<<<<<<<<<<<<
* return reduce(mul, args)
*
*/
static PyObject *__pyx_pf_13c_hello_world_10HelloWorld_product(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_args) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("product", 0);
/* "hello_world.py":10
* class HelloWorld:
* def product(self, args):
* return reduce(mul, args) # <<<<<<<<<<<<<<
*
* def main(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__mul); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_args);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_args);
__Pyx_GIVEREF(__pyx_v_args);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_reduce, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("c_hello_world.HelloWorld.product", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_13c_hello_world_10HelloWorld_3main(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_13c_hello_world_10HelloWorld_3main = {__Pyx_NAMESTR("main"), (PyCFunction)__pyx_pw_13c_hello_world_10HelloWorld_3main, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_13c_hello_world_10HelloWorld_3main(PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("main (wrapper)", 0);
__pyx_self = __pyx_self;
__pyx_r = __pyx_pf_13c_hello_world_10HelloWorld_2main(__pyx_self, ((PyObject *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "hello_world.py":12
* return reduce(mul, args)
*
* def main(self): # <<<<<<<<<<<<<<
* # stdout
* print("Hello World");
*/
static PyObject *__pyx_pf_13c_hello_world_10HelloWorld_2main(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
double __pyx_v__sum;
PyObject *__pyx_v_sqrt = NULL;
long __pyx_v_n;
PyObject *__pyx_v_nsums = NULL;
PyObject *__pyx_v_totalsum = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_j = NULL;
CYTHON_UNUSED PyObject *__pyx_v_ten = NULL;
CYTHON_UNUSED double __pyx_v_tenpointoh;
PyObject *__pyx_v_doublestr = NULL;
CYTHON_UNUSED double __pyx_v_twentypointtwo;
CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
PyObject *__pyx_v_intlist = NULL;
PyObject *__pyx_v_nextint = NULL;
PyObject *__pyx_v__map = NULL;
PyObject *__pyx_v_key = NULL;
PyObject *__pyx_v_searchvalue = NULL;
PyObject *__pyx_v_k = NULL;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_v_sortedmap = NULL;
PyObject *__pyx_v_invertedmap = NULL;
PyObject *__pyx_v__currentvalue = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_t_5;
Py_ssize_t __pyx_t_6;
PyObject *(*__pyx_t_7)(PyObject *);
PyObject *__pyx_t_8 = NULL;
double __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *__pyx_t_12 = NULL;
int __pyx_t_13;
PyObject *__pyx_t_14 = NULL;
Py_ssize_t __pyx_t_15;
PyObject *(*__pyx_t_16)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("main", 0);
/* "hello_world.py":14
* def main(self):
* # stdout
* print("Hello World"); # <<<<<<<<<<<<<<
*
* # basic math
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":17
*
* # basic math
* print("// basic math") # <<<<<<<<<<<<<<
* _sum = 0
* _sum = 2.0 + 2.0
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":18
* # basic math
* print("// basic math")
* _sum = 0 # <<<<<<<<<<<<<<
* _sum = 2.0 + 2.0
* print(_sum)
*/
__pyx_v__sum = 0.0;
/* "hello_world.py":19
* print("// basic math")
* _sum = 0
* _sum = 2.0 + 2.0 # <<<<<<<<<<<<<<
* print(_sum)
* sqrt = math.sqrt(_sum)
*/
__pyx_v__sum = (2.0 + 2.0);
/* "hello_world.py":20
* _sum = 0
* _sum = 2.0 + 2.0
* print(_sum) # <<<<<<<<<<<<<<
* sqrt = math.sqrt(_sum)
* print(sqrt)
*/
__pyx_t_1 = PyFloat_FromDouble(__pyx_v__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":21
* _sum = 2.0 + 2.0
* print(_sum)
* sqrt = math.sqrt(_sum) # <<<<<<<<<<<<<<
* print(sqrt)
*
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__math); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyFloat_FromDouble(__pyx_v__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_sqrt = __pyx_t_1;
__pyx_t_1 = 0;
/* "hello_world.py":22
* print(_sum)
* sqrt = math.sqrt(_sum)
* print(sqrt) # <<<<<<<<<<<<<<
*
* # for and while loops; nested arrays; functions
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_sqrt);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sqrt);
__Pyx_GIVEREF(__pyx_v_sqrt);
__pyx_t_3 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "hello_world.py":25
*
* # for and while loops; nested arrays; functions
* print("// loops; nested arrays; functions") # <<<<<<<<<<<<<<
* n = 10
* nsums = [] # XXX: see hello_world.pxd
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "hello_world.py":26
* # for and while loops; nested arrays; functions
* print("// loops; nested arrays; functions")
* n = 10 # <<<<<<<<<<<<<<
* nsums = [] # XXX: see hello_world.pxd
* totalsum = 0
*/
__pyx_v_n = 10;
/* "hello_world.py":27
* print("// loops; nested arrays; functions")
* n = 10
* nsums = [] # XXX: see hello_world.pxd # <<<<<<<<<<<<<<
* totalsum = 0
* i = 0
*/
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_nsums = __pyx_t_3;
__pyx_t_3 = 0;
/* "hello_world.py":28
* n = 10
* nsums = [] # XXX: see hello_world.pxd
* totalsum = 0 # <<<<<<<<<<<<<<
* i = 0
* while (i < n):
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_v_totalsum = __pyx_int_0;
/* "hello_world.py":29
* nsums = [] # XXX: see hello_world.pxd
* totalsum = 0
* i = 0 # <<<<<<<<<<<<<<
* while (i < n):
* nsums.append([None,]*n)
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_v_i = __pyx_int_0;
/* "hello_world.py":30
* totalsum = 0
* i = 0
* while (i < n): # <<<<<<<<<<<<<<
* nsums.append([None,]*n)
* for j in range(n)[::-1]:
*/
while (1) {
__pyx_t_3 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyObject_RichCompare(__pyx_v_i, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (!__pyx_t_4) break;
/* "hello_world.py":31
* i = 0
* while (i < n):
* nsums.append([None,]*n) # <<<<<<<<<<<<<<
* for j in range(n)[::-1]:
* nsums[i][j] = self.product((i, j)) # preallocation?
*/
__pyx_t_1 = PyList_New(1 * ((__pyx_v_n<0) ? 0:__pyx_v_n)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
{ Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < __pyx_v_n; __pyx_temp++) {
__Pyx_INCREF(Py_None);
PyList_SET_ITEM(__pyx_t_1, __pyx_temp, Py_None);
__Pyx_GIVEREF(Py_None);
}
}
__pyx_t_5 = PyList_Append(__pyx_v_nsums, ((PyObject *)__pyx_t_1)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
/* "hello_world.py":32
* while (i < n):
* nsums.append([None,]*n)
* for j in range(n)[::-1]: # <<<<<<<<<<<<<<
* nsums[i][j] = self.product((i, j)) # preallocation?
* totalsum += nsums[i][j]
*/
__pyx_t_1 = PyInt_FromLong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_7); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
__pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++;
} else {
__pyx_t_3 = __pyx_t_7(__pyx_t_1);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_3);
}
__Pyx_XDECREF(__pyx_v_j);
__pyx_v_j = __pyx_t_3;
__pyx_t_3 = 0;
/* "hello_world.py":33
* nsums.append([None,]*n)
* for j in range(n)[::-1]:
* nsums[i][j] = self.product((i, j)) # preallocation? # <<<<<<<<<<<<<<
* totalsum += nsums[i][j]
* i+=1
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__product); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_i);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i);
__Pyx_GIVEREF(__pyx_v_i);
__Pyx_INCREF(__pyx_v_j);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_j);
__Pyx_GIVEREF(__pyx_v_j);
__pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_nsums), __pyx_v_i); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
if (PyObject_SetItem(__pyx_t_8, __pyx_v_j, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hello_world.py":34
* for j in range(n)[::-1]:
* nsums[i][j] = self.product((i, j)) # preallocation?
* totalsum += nsums[i][j] # <<<<<<<<<<<<<<
* i+=1
*
*/
__pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_nsums), __pyx_v_i); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_8 = PyObject_GetItem(__pyx_t_2, __pyx_v_j); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_totalsum, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_v_totalsum);
__pyx_v_totalsum = __pyx_t_2;
__pyx_t_2 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":35
* nsums[i][j] = self.product((i, j)) # preallocation?
* totalsum += nsums[i][j]
* i+=1 # <<<<<<<<<<<<<<
*
* # if-conditionals
*/
__pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_i);
__pyx_v_i = __pyx_t_1;
__pyx_t_1 = 0;
}
/* "hello_world.py":38
*
* # if-conditionals
* print("// if-conditionals") # <<<<<<<<<<<<<<
* if totalsum==2025:
* print("totalsum*5: %d" % (totalsum*5))
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":39
* # if-conditionals
* print("// if-conditionals")
* if totalsum==2025: # <<<<<<<<<<<<<<
* print("totalsum*5: %d" % (totalsum*5))
* elif totalsum==0:
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v_totalsum, __pyx_int_2025, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
/* "hello_world.py":40
* print("// if-conditionals")
* if totalsum==2025:
* print("totalsum*5: %d" % (totalsum*5)) # <<<<<<<<<<<<<<
* elif totalsum==0:
* print("totalsum is zero?")
*/
__pyx_t_1 = PyNumber_Multiply(__pyx_v_totalsum, __pyx_int_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L7;
}
/* "hello_world.py":41
* if totalsum==2025:
* print("totalsum*5: %d" % (totalsum*5))
* elif totalsum==0: # <<<<<<<<<<<<<<
* print("totalsum is zero?")
* else:
*/
__pyx_t_2 = PyObject_RichCompare(__pyx_v_totalsum, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_4) {
/* "hello_world.py":42
* print("totalsum*5: %d" % (totalsum*5))
* elif totalsum==0:
* print("totalsum is zero?") # <<<<<<<<<<<<<<
* else:
* print("totalsum is off")
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L7;
}
/*else*/ {
/* "hello_world.py":44
* print("totalsum is zero?")
* else:
* print("totalsum is off") # <<<<<<<<<<<<<<
*
* # function overload (what is this called again?)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__pyx_L7:;
/* "hello_world.py":47
*
* # function overload (what is this called again?)
* print("// function overload") # not really # <<<<<<<<<<<<<<
* print(self.product((2,3,4)))
*
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hello_world.py":48
* # function overload (what is this called again?)
* print("// function overload") # not really
* print(self.product((2,3,4))) # <<<<<<<<<<<<<<
*
* # input coercion
*/
__pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__product); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":51
*
* # input coercion
* print("// input coercion") # <<<<<<<<<<<<<<
* ten = int("10")
* tenpointoh = float("10.0")
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":52
* # input coercion
* print("// input coercion")
* ten = int("10") # <<<<<<<<<<<<<<
* tenpointoh = float("10.0")
*
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_ten = __pyx_t_1;
__pyx_t_1 = 0;
/* "hello_world.py":53
* print("// input coercion")
* ten = int("10")
* tenpointoh = float("10.0") # <<<<<<<<<<<<<<
*
* # try/except blocks
*/
__pyx_t_9 = __Pyx_PyObject_AsDouble(((PyObject *)__pyx_kp_s_22)); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_tenpointoh = __pyx_t_9;
/* "hello_world.py":56
*
* # try/except blocks
* print("// try/catch blocks") # <<<<<<<<<<<<<<
* doublestr = "x20.2"
* try:
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":57
* # try/except blocks
* print("// try/catch blocks")
* doublestr = "x20.2" # <<<<<<<<<<<<<<
* try:
* twentypointtwo = float(doublestr)
*/
__Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
__pyx_v_doublestr = ((PyObject *)__pyx_kp_s_25);
/* "hello_world.py":58
* print("// try/catch blocks")
* doublestr = "x20.2"
* try: # <<<<<<<<<<<<<<
* twentypointtwo = float(doublestr)
* except Exception, e: # TODO
*/
/*try:*/ {
{
__Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
__Pyx_XGOTREF(__pyx_t_10);
__Pyx_XGOTREF(__pyx_t_11);
__Pyx_XGOTREF(__pyx_t_12);
/*try:*/ {
/* "hello_world.py":59
* doublestr = "x20.2"
* try:
* twentypointtwo = float(doublestr) # <<<<<<<<<<<<<<
* except Exception, e: # TODO
* print("err: %s is not a double" % doublestr)
*/
__pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_doublestr); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
__pyx_v_twentypointtwo = __pyx_t_9;
}
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
goto __pyx_L18_try_end;
__pyx_L11_error:;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":60
* try:
* twentypointtwo = float(doublestr)
* except Exception, e: # TODO # <<<<<<<<<<<<<<
* print("err: %s is not a double" % doublestr)
* finally:
*/
__pyx_t_13 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
if (__pyx_t_13) {
__Pyx_AddTraceback("c_hello_world.HelloWorld.main", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_t_8);
__Pyx_INCREF(__pyx_t_2);
__pyx_v_e = __pyx_t_2;
/* "hello_world.py":61
* twentypointtwo = float(doublestr)
* except Exception, e: # TODO
* print("err: %s is not a double" % doublestr) # <<<<<<<<<<<<<<
* finally:
* doublestr = doublestr[1:]
*/
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_26), __pyx_v_doublestr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(__pyx_t_14);
PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L12_exception_handled;
}
__pyx_L13_except_error:;
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
goto __pyx_L9;
__pyx_L12_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_11);
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
__pyx_L18_try_end:;
}
}
/* "hello_world.py":63
* print("err: %s is not a double" % doublestr)
* finally:
* doublestr = doublestr[1:] # <<<<<<<<<<<<<<
* twentypointtwo = float(doublestr)
*
*/
/*finally:*/ {
int __pyx_why;
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
int __pyx_exc_lineno;
__pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
__pyx_why = 0; goto __pyx_L10;
__pyx_L9: {
__pyx_why = 4;
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
__pyx_exc_lineno = __pyx_lineno;
goto __pyx_L10;
}
__pyx_L10:;
__pyx_t_8 = __Pyx_PySequence_GetSlice(__pyx_v_doublestr, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_v_doublestr);
__pyx_v_doublestr = __pyx_t_8;
__pyx_t_8 = 0;
/* "hello_world.py":64
* finally:
* doublestr = doublestr[1:]
* twentypointtwo = float(doublestr) # <<<<<<<<<<<<<<
*
* ##
*/
__pyx_t_9 = __Pyx_PyObject_AsDouble(__pyx_v_doublestr); if (unlikely(__pyx_t_9 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
__pyx_v_twentypointtwo = __pyx_t_9;
goto __pyx_L22;
__pyx_L21_error:;
if (__pyx_why == 4) {
Py_XDECREF(__pyx_exc_type);
Py_XDECREF(__pyx_exc_value);
Py_XDECREF(__pyx_exc_tb);
}
goto __pyx_L1_error;
__pyx_L22:;
switch (__pyx_why) {
case 4: {
__Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
__pyx_lineno = __pyx_exc_lineno;
__pyx_exc_type = 0;
__pyx_exc_value = 0;
__pyx_exc_tb = 0;
goto __pyx_L1_error;
}
}
}
/* "hello_world.py":68
* ##
* # Arraylists
* print("// ArrayLists") # <<<<<<<<<<<<<<
* intlist = []
* intlist = range(5)
*/
__pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":69
* # Arraylists
* print("// ArrayLists")
* intlist = [] # <<<<<<<<<<<<<<
* intlist = range(5)
* print(len(intlist))
*/
__pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_v_intlist = ((PyObject *)__pyx_t_8);
__pyx_t_8 = 0;
/* "hello_world.py":70
* print("// ArrayLists")
* intlist = []
* intlist = range(5) # <<<<<<<<<<<<<<
* print(len(intlist))
* intlist.pop(0)
*/
__pyx_t_8 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_v_intlist);
__pyx_v_intlist = __pyx_t_8;
__pyx_t_8 = 0;
/* "hello_world.py":71
* intlist = []
* intlist = range(5)
* print(len(intlist)) # <<<<<<<<<<<<<<
* intlist.pop(0)
* print(len(intlist))
*/
__pyx_t_6 = PyObject_Length(__pyx_v_intlist); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":72
* intlist = range(5)
* print(len(intlist))
* intlist.pop(0) # <<<<<<<<<<<<<<
* print(len(intlist))
*
*/
__pyx_t_8 = __Pyx_PyObject_PopIndex(__pyx_v_intlist, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":73
* print(len(intlist))
* intlist.pop(0)
* print(len(intlist)) # <<<<<<<<<<<<<<
*
* # traditional iteration
*/
__pyx_t_6 = PyObject_Length(__pyx_v_intlist); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":76
*
* # traditional iteration
* for nextint in intlist: # <<<<<<<<<<<<<<
* print(nextint)
*
*/
if (PyList_CheckExact(__pyx_v_intlist) || PyTuple_CheckExact(__pyx_v_intlist)) {
__pyx_t_8 = __pyx_v_intlist; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_intlist); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext;
}
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_8)) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_8)) {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++;
} else {
__pyx_t_2 = __pyx_t_7(__pyx_t_8);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_XDECREF(__pyx_v_nextint);
__pyx_v_nextint = __pyx_t_2;
__pyx_t_2 = 0;
/* "hello_world.py":77
* # traditional iteration
* for nextint in intlist:
* print(nextint) # <<<<<<<<<<<<<<
*
* # iteration with downcasting
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(__pyx_v_nextint);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_nextint);
__Pyx_GIVEREF(__pyx_v_nextint);
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":80
*
* # iteration with downcasting
* for nextint in intlist: # <<<<<<<<<<<<<<
* print(nextint)
*
*/
if (PyList_CheckExact(__pyx_v_intlist) || PyTuple_CheckExact(__pyx_v_intlist)) {
__pyx_t_8 = __pyx_v_intlist; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_intlist); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext;
}
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_8)) {
if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break;
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_8)) {
if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++;
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_8);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_1);
}
__Pyx_XDECREF(__pyx_v_nextint);
__pyx_v_nextint = __pyx_t_1;
__pyx_t_1 = 0;
/* "hello_world.py":81
* # iteration with downcasting
* for nextint in intlist:
* print(nextint) # <<<<<<<<<<<<<<
*
* # python iteration
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_nextint);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nextint);
__Pyx_GIVEREF(__pyx_v_nextint);
__pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":84
*
* # python iteration
* print("\n".join(imap(str, intlist))) # <<<<<<<<<<<<<<
*
* ##
*/
__pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_30), __pyx_n_s__join); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__imap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)((PyObject*)(&PyString_Type))));
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyString_Type))));
__Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyString_Type))));
__Pyx_INCREF(__pyx_v_intlist);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_intlist);
__Pyx_GIVEREF(__pyx_v_intlist);
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "hello_world.py":88
* ##
* # HashMaps
* print("// Maps") # <<<<<<<<<<<<<<
* _map = {}
* _map['one'] = 1
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "hello_world.py":89
* # HashMaps
* print("// Maps")
* _map = {} # <<<<<<<<<<<<<<
* _map['one'] = 1
* _map['two'] = 2
*/
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_v__map = __pyx_t_3;
__pyx_t_3 = 0;
/* "hello_world.py":90
* print("// Maps")
* _map = {}
* _map['one'] = 1 # <<<<<<<<<<<<<<
* _map['two'] = 2
* _map['three'] = 3
*/
if (PyDict_SetItem(((PyObject *)__pyx_v__map), ((PyObject *)__pyx_n_s__one), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":91
* _map = {}
* _map['one'] = 1
* _map['two'] = 2 # <<<<<<<<<<<<<<
* _map['three'] = 3
* _map['four'] = 4
*/
if (PyDict_SetItem(((PyObject *)__pyx_v__map), ((PyObject *)__pyx_n_s__two), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":92
* _map['one'] = 1
* _map['two'] = 2
* _map['three'] = 3 # <<<<<<<<<<<<<<
* _map['four'] = 4
* print("size = %d" % len(_map))
*/
if (PyDict_SetItem(((PyObject *)__pyx_v__map), ((PyObject *)__pyx_n_s__three), __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":93
* _map['two'] = 2
* _map['three'] = 3
* _map['four'] = 4 # <<<<<<<<<<<<<<
* print("size = %d" % len(_map))
*
*/
if (PyDict_SetItem(((PyObject *)__pyx_v__map), ((PyObject *)__pyx_n_s__four), __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":94
* _map['three'] = 3
* _map['four'] = 4
* print("size = %d" % len(_map)) # <<<<<<<<<<<<<<
*
* key = "one"
*/
__pyx_t_6 = PyDict_Size(((PyObject *)__pyx_v__map));
__pyx_t_3 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":96
* print("size = %d" % len(_map))
*
* key = "one" # <<<<<<<<<<<<<<
* if key in _map:
* print("%s: %s" % (key, _map[key]))
*/
__Pyx_INCREF(((PyObject *)__pyx_n_s__one));
__pyx_v_key = ((PyObject *)__pyx_n_s__one);
/* "hello_world.py":97
*
* key = "one"
* if key in _map: # <<<<<<<<<<<<<<
* print("%s: %s" % (key, _map[key]))
*
*/
__pyx_t_4 = ((PyDict_Contains(((PyObject *)__pyx_v__map), __pyx_v_key))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_4) {
/* "hello_world.py":98
* key = "one"
* if key in _map:
* print("%s: %s" % (key, _map[key])) # <<<<<<<<<<<<<<
*
* searchvalue = "four"
*/
__pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v__map), __pyx_v_key); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_key);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_key);
__Pyx_GIVEREF(__pyx_v_key);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L27;
}
__pyx_L27:;
/* "hello_world.py":100
* print("%s: %s" % (key, _map[key]))
*
* searchvalue = "four" # <<<<<<<<<<<<<<
* if searchvalue in _map.values():
* print("contains the value '%s'" % searchvalue)
*/
__Pyx_INCREF(((PyObject *)__pyx_n_s__four));
__pyx_v_searchvalue = ((PyObject *)__pyx_n_s__four);
/* "hello_world.py":101
*
* searchvalue = "four"
* if searchvalue in _map.values(): # <<<<<<<<<<<<<<
* print("contains the value '%s'" % searchvalue)
* else:
*/
__pyx_t_1 = PyDict_Values(__pyx_v__map); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = ((PySequence_Contains(__pyx_t_1, __pyx_v_searchvalue))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
/* "hello_world.py":102
* searchvalue = "four"
* if searchvalue in _map.values():
* print("contains the value '%s'" % searchvalue) # <<<<<<<<<<<<<<
* else:
* print("does not contain the value '%s'" % searchvalue)
*/
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_35), __pyx_v_searchvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L28;
}
/*else*/ {
/* "hello_world.py":104
* print("contains the value '%s'" % searchvalue)
* else:
* print("does not contain the value '%s'" % searchvalue) # <<<<<<<<<<<<<<
*
* for k,v in _map.iteritems():
*/
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), __pyx_v_searchvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
__Pyx_GIVEREF(((PyObject *)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L28:;
/* "hello_world.py":106
* print("does not contain the value '%s'" % searchvalue)
*
* for k,v in _map.iteritems(): # <<<<<<<<<<<<<<
* print('%s=%s' % (k,v))
*
*/
__Pyx_INCREF(((PyObject *)__pyx_v__map));
__Pyx_XDECREF(__pyx_t_1);
__pyx_t_1 = ((PyObject *)__pyx_v__map);
__pyx_t_6 = 0;
__pyx_t_15 = PyDict_Size(__pyx_t_1);
while (1) {
if (unlikely(__pyx_t_15 != PyDict_Size(__pyx_t_1))) {
PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
if (!PyDict_Next(__pyx_t_1, (&__pyx_t_6), (&__pyx_t_12), (&__pyx_t_11))) break;
__Pyx_INCREF(((PyObject *)__pyx_t_12));
__Pyx_XDECREF(__pyx_v_k);
__pyx_v_k = __pyx_t_12;
__Pyx_INCREF(((PyObject *)__pyx_t_11));
__Pyx_XDECREF(__pyx_v_v);
__pyx_v_v = __pyx_t_11;
/* "hello_world.py":107
*
* for k,v in _map.iteritems():
* print('%s=%s' % (k,v)) # <<<<<<<<<<<<<<
*
* ##
*/
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k);
__Pyx_GIVEREF(__pyx_v_k);
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
__pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_8));
__Pyx_GIVEREF(((PyObject *)__pyx_t_8));
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":112
* # Collections, sorting
* # note that there exists an "OrderedDict" in stdlib
* print("// Collections.sort") # <<<<<<<<<<<<<<
* for k in sorted(_map.iterkeys()):
* print("%s: %s" % (k, _map[k]))
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":113
* # note that there exists an "OrderedDict" in stdlib
* print("// Collections.sort")
* for k in sorted(_map.iterkeys()): # <<<<<<<<<<<<<<
* print("%s: %s" % (k, _map[k]))
*
*/
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v__map), __pyx_n_s__iterkeys); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
__pyx_t_1 = __pyx_t_8; __Pyx_INCREF(__pyx_t_1); __pyx_t_15 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_15 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_1)) break;
__pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_15); __Pyx_INCREF(__pyx_t_8); __pyx_t_15++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
__pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_15); __Pyx_INCREF(__pyx_t_8); __pyx_t_15++;
} else {
__pyx_t_8 = __pyx_t_7(__pyx_t_1);
if (unlikely(!__pyx_t_8)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_8);
}
__Pyx_XDECREF(__pyx_v_k);
__pyx_v_k = __pyx_t_8;
__pyx_t_8 = 0;
/* "hello_world.py":114
* print("// Collections.sort")
* for k in sorted(_map.iterkeys()):
* print("%s: %s" % (k, _map[k])) # <<<<<<<<<<<<<<
*
* ##
*/
__pyx_t_8 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v__map), __pyx_v_k); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k);
__Pyx_GIVEREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
__pyx_t_8 = 0;
__pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_8));
__Pyx_GIVEREF(((PyObject *)__pyx_t_8));
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":118
* ##
* # OrderedDict
* print("// OrderedDict") # <<<<<<<<<<<<<<
* sortedmap = OrderedDict()
* sortedmap['one'] = 1
*/
__pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":119
* # OrderedDict
* print("// OrderedDict")
* sortedmap = OrderedDict() # <<<<<<<<<<<<<<
* sortedmap['one'] = 1
* sortedmap['two'] = 2
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__OrderedDict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_sortedmap = __pyx_t_8;
__pyx_t_8 = 0;
/* "hello_world.py":120
* print("// OrderedDict")
* sortedmap = OrderedDict()
* sortedmap['one'] = 1 # <<<<<<<<<<<<<<
* sortedmap['two'] = 2
* sortedmap['three'] = 3
*/
if (PyObject_SetItem(__pyx_v_sortedmap, ((PyObject *)__pyx_n_s__one), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":121
* sortedmap = OrderedDict()
* sortedmap['one'] = 1
* sortedmap['two'] = 2 # <<<<<<<<<<<<<<
* sortedmap['three'] = 3
* sortedmap['four'] = 4
*/
if (PyObject_SetItem(__pyx_v_sortedmap, ((PyObject *)__pyx_n_s__two), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":122
* sortedmap['one'] = 1
* sortedmap['two'] = 2
* sortedmap['three'] = 3 # <<<<<<<<<<<<<<
* sortedmap['four'] = 4
* for (k,v) in sortedmap.iteritems():
*/
if (PyObject_SetItem(__pyx_v_sortedmap, ((PyObject *)__pyx_n_s__three), __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":123
* sortedmap['two'] = 2
* sortedmap['three'] = 3
* sortedmap['four'] = 4 # <<<<<<<<<<<<<<
* for (k,v) in sortedmap.iteritems():
* print("%s=%s" % (k,v))
*/
if (PyObject_SetItem(__pyx_v_sortedmap, ((PyObject *)__pyx_n_s__four), __pyx_int_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":124
* sortedmap['three'] = 3
* sortedmap['four'] = 4
* for (k,v) in sortedmap.iteritems(): # <<<<<<<<<<<<<<
* print("%s=%s" % (k,v))
*
*/
__pyx_t_8 = PyObject_GetAttr(__pyx_v_sortedmap, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
__pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_15 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_15 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_8)) {
if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_8)) break;
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_15); __Pyx_INCREF(__pyx_t_1); __pyx_t_15++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_8)) {
if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_8)) break;
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_15); __Pyx_INCREF(__pyx_t_1); __pyx_t_15++;
} else {
__pyx_t_1 = __pyx_t_7(__pyx_t_8);
if (unlikely(!__pyx_t_1)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_1);
}
if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
if (likely(PyTuple_CheckExact(sequence))) {
if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
} else {
if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_3 = PyList_GET_ITEM(sequence, 0);
__pyx_t_2 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_14 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L35_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_2 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_2)) goto __pyx_L35_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
goto __pyx_L36_unpacking_done;
__pyx_L35_unpacking_failed:;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L36_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_k);
__pyx_v_k = __pyx_t_3;
__pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v_v);
__pyx_v_v = __pyx_t_2;
__pyx_t_2 = 0;
/* "hello_world.py":125
* sortedmap['four'] = 4
* for (k,v) in sortedmap.iteritems():
* print("%s=%s" % (k,v)) # <<<<<<<<<<<<<<
*
* ##
*/
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k);
__Pyx_GIVEREF(__pyx_v_k);
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
/* "hello_world.py":129
* ##
* # invert dict
* sortedmap['uno'] = 1 # <<<<<<<<<<<<<<
* invertedmap = OrderedDict()
* for (k,v) in sortedmap.iteritems():
*/
if (PyObject_SetItem(__pyx_v_sortedmap, ((PyObject *)__pyx_n_s__uno), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":130
* # invert dict
* sortedmap['uno'] = 1
* invertedmap = OrderedDict() # <<<<<<<<<<<<<<
* for (k,v) in sortedmap.iteritems():
* _currentvalue = invertedmap.get(v, None) # XXX: sentinel = None
*/
__pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__OrderedDict); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_v_invertedmap = __pyx_t_2;
__pyx_t_2 = 0;
/* "hello_world.py":131
* sortedmap['uno'] = 1
* invertedmap = OrderedDict()
* for (k,v) in sortedmap.iteritems(): # <<<<<<<<<<<<<<
* _currentvalue = invertedmap.get(v, None) # XXX: sentinel = None
* if _currentvalue is not None:
*/
__pyx_t_2 = PyObject_GetAttr(__pyx_v_sortedmap, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyList_CheckExact(__pyx_t_8) || PyTuple_CheckExact(__pyx_t_8)) {
__pyx_t_2 = __pyx_t_8; __Pyx_INCREF(__pyx_t_2); __pyx_t_15 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_15 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_2)) break;
__pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_15); __Pyx_INCREF(__pyx_t_8); __pyx_t_15++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
__pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_15); __Pyx_INCREF(__pyx_t_8); __pyx_t_15++;
} else {
__pyx_t_8 = __pyx_t_7(__pyx_t_2);
if (unlikely(!__pyx_t_8)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_8);
}
if ((likely(PyTuple_CheckExact(__pyx_t_8))) || (PyList_CheckExact(__pyx_t_8))) {
PyObject* sequence = __pyx_t_8;
if (likely(PyTuple_CheckExact(sequence))) {
if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
} else {
if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
__pyx_t_3 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_14 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
index = 0; __pyx_t_1 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_1)) goto __pyx_L39_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
index = 1; __pyx_t_3 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L39_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
goto __pyx_L40_unpacking_done;
__pyx_L39_unpacking_failed:;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L40_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_k);
__pyx_v_k = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_v_v);
__pyx_v_v = __pyx_t_3;
__pyx_t_3 = 0;
/* "hello_world.py":132
* invertedmap = OrderedDict()
* for (k,v) in sortedmap.iteritems():
* _currentvalue = invertedmap.get(v, None) # XXX: sentinel = None # <<<<<<<<<<<<<<
* if _currentvalue is not None:
* if _currentvalue != k:
*/
__pyx_t_8 = PyObject_GetAttr(__pyx_v_invertedmap, __pyx_n_s__get); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None);
__Pyx_GIVEREF(Py_None);
__pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_v__currentvalue);
__pyx_v__currentvalue = __pyx_t_1;
__pyx_t_1 = 0;
/* "hello_world.py":133
* for (k,v) in sortedmap.iteritems():
* _currentvalue = invertedmap.get(v, None) # XXX: sentinel = None
* if _currentvalue is not None: # <<<<<<<<<<<<<<
* if _currentvalue != k:
* print("duplicate key: '%s' [%s] {{%s}}" %
*/
__pyx_t_4 = (__pyx_v__currentvalue != Py_None);
if (__pyx_t_4) {
/* "hello_world.py":134
* _currentvalue = invertedmap.get(v, None) # XXX: sentinel = None
* if _currentvalue is not None:
* if _currentvalue != k: # <<<<<<<<<<<<<<
* print("duplicate key: '%s' [%s] {{%s}}" %
* (v, k, _currentvalue))
*/
__pyx_t_1 = PyObject_RichCompare(__pyx_v__currentvalue, __pyx_v_k, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_4) {
/* "hello_world.py":136
* if _currentvalue != k:
* print("duplicate key: '%s' [%s] {{%s}}" %
* (v, k, _currentvalue)) # <<<<<<<<<<<<<<
* else:
* invertedmap[v] = k
*/
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
__Pyx_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_k);
__Pyx_GIVEREF(__pyx_v_k);
__Pyx_INCREF(__pyx_v__currentvalue);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v__currentvalue);
__Pyx_GIVEREF(__pyx_v__currentvalue);
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_42), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L42;
}
__pyx_L42:;
goto __pyx_L41;
}
/*else*/ {
/* "hello_world.py":138
* (v, k, _currentvalue))
* else:
* invertedmap[v] = k # <<<<<<<<<<<<<<
* for (k,v) in invertedmap.iteritems():
* print("%s=%s" % (k,v))
*/
if (PyObject_SetItem(__pyx_v_invertedmap, __pyx_v_v, __pyx_v_k) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L41:;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hello_world.py":139
* else:
* invertedmap[v] = k
* for (k,v) in invertedmap.iteritems(): # <<<<<<<<<<<<<<
* print("%s=%s" % (k,v))
*
*/
__pyx_t_2 = PyObject_GetAttr(__pyx_v_invertedmap, __pyx_n_s__iteritems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
__pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_15 = 0;
__pyx_t_7 = NULL;
} else {
__pyx_t_15 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
for (;;) {
if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_2)) break;
__pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++;
} else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
__pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++;
} else {
__pyx_t_3 = __pyx_t_7(__pyx_t_2);
if (unlikely(!__pyx_t_3)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_3);
}
if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
PyObject* sequence = __pyx_t_3;
if (likely(PyTuple_CheckExact(sequence))) {
if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
} else {
if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyList_GET_ITEM(sequence, 0);
__pyx_t_8 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_1);
__Pyx_INCREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_16 = Py_TYPE(__pyx_t_14)->tp_iternext;
index = 0; __pyx_t_1 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_1)) goto __pyx_L45_unpacking_failed;
__Pyx_GOTREF(__pyx_t_1);
index = 1; __pyx_t_8 = __pyx_t_16(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L45_unpacking_failed;
__Pyx_GOTREF(__pyx_t_8);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
goto __pyx_L46_unpacking_done;
__pyx_L45_unpacking_failed:;
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L46_unpacking_done:;
}
__Pyx_XDECREF(__pyx_v_k);
__pyx_v_k = __pyx_t_1;
__pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_v_v);
__pyx_v_v = __pyx_t_8;
__pyx_t_8 = 0;
/* "hello_world.py":140
* invertedmap[v] = k
* for (k,v) in invertedmap.iteritems():
* print("%s=%s" % (k,v)) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k);
__Pyx_GIVEREF(__pyx_v_k);
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
__pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_8));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_8));
__Pyx_GIVEREF(((PyObject *)__pyx_t_8));
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_14);
__Pyx_AddTraceback("c_hello_world.HelloWorld.main", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_sqrt);
__Pyx_XDECREF(__pyx_v_nsums);
__Pyx_XDECREF(__pyx_v_totalsum);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_j);
__Pyx_XDECREF(__pyx_v_ten);
__Pyx_XDECREF(__pyx_v_doublestr);
__Pyx_XDECREF(__pyx_v_e);
__Pyx_XDECREF(__pyx_v_intlist);
__Pyx_XDECREF(__pyx_v_nextint);
__Pyx_XDECREF(__pyx_v__map);
__Pyx_XDECREF(__pyx_v_key);
__Pyx_XDECREF(__pyx_v_searchvalue);
__Pyx_XDECREF(__pyx_v_k);
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XDECREF(__pyx_v_sortedmap);
__Pyx_XDECREF(__pyx_v_invertedmap);
__Pyx_XDECREF(__pyx_v__currentvalue);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
__Pyx_NAMESTR("c_hello_world"),
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
{&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
{&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
{&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
{&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
{&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
{&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
{&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
{&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
{&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
{&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
{&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
{&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
{&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
{&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
{&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
{&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
{&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
{&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
{&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
{&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
{&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
{&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
{&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
{&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
{&__pyx_kp_s__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 0, 1, 0},
{&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
{&__pyx_n_s__HelloWorld, __pyx_k__HelloWorld, sizeof(__pyx_k__HelloWorld), 0, 0, 1, 1},
{&__pyx_n_s__OrderedDict, __pyx_k__OrderedDict, sizeof(__pyx_k__OrderedDict), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s___currentvalue, __pyx_k___currentvalue, sizeof(__pyx_k___currentvalue), 0, 0, 1, 1},
{&__pyx_n_s___map, __pyx_k___map, sizeof(__pyx_k___map), 0, 0, 1, 1},
{&__pyx_n_s___sum, __pyx_k___sum, sizeof(__pyx_k___sum), 0, 0, 1, 1},
{&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1},
{&__pyx_n_s__c_hello_world, __pyx_k__c_hello_world, sizeof(__pyx_k__c_hello_world), 0, 0, 1, 1},
{&__pyx_n_s__cls, __pyx_k__cls, sizeof(__pyx_k__cls), 0, 0, 1, 1},
{&__pyx_n_s__collections, __pyx_k__collections, sizeof(__pyx_k__collections), 0, 0, 1, 1},
{&__pyx_n_s__doublestr, __pyx_k__doublestr, sizeof(__pyx_k__doublestr), 0, 0, 1, 1},
{&__pyx_n_s__e, __pyx_k__e, sizeof(__pyx_k__e), 0, 0, 1, 1},
{&__pyx_n_s__four, __pyx_k__four, sizeof(__pyx_k__four), 0, 0, 1, 1},
{&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
{&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
{&__pyx_n_s__imap, __pyx_k__imap, sizeof(__pyx_k__imap), 0, 0, 1, 1},
{&__pyx_n_s__intlist, __pyx_k__intlist, sizeof(__pyx_k__intlist), 0, 0, 1, 1},
{&__pyx_n_s__invertedmap, __pyx_k__invertedmap, sizeof(__pyx_k__invertedmap), 0, 0, 1, 1},
{&__pyx_n_s__iteritems, __pyx_k__iteritems, sizeof(__pyx_k__iteritems), 0, 0, 1, 1},
{&__pyx_n_s__iterkeys, __pyx_k__iterkeys, sizeof(__pyx_k__iterkeys), 0, 0, 1, 1},
{&__pyx_n_s__itertools, __pyx_k__itertools, sizeof(__pyx_k__itertools), 0, 0, 1, 1},
{&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
{&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
{&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
{&__pyx_n_s__key, __pyx_k__key, sizeof(__pyx_k__key), 0, 0, 1, 1},
{&__pyx_n_s__main, __pyx_k__main, sizeof(__pyx_k__main), 0, 0, 1, 1},
{&__pyx_n_s__math, __pyx_k__math, sizeof(__pyx_k__math), 0, 0, 1, 1},
{&__pyx_n_s__mul, __pyx_k__mul, sizeof(__pyx_k__mul), 0, 0, 1, 1},
{&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
{&__pyx_n_s__nextint, __pyx_k__nextint, sizeof(__pyx_k__nextint), 0, 0, 1, 1},
{&__pyx_n_s__nsums, __pyx_k__nsums, sizeof(__pyx_k__nsums), 0, 0, 1, 1},
{&__pyx_n_s__one, __pyx_k__one, sizeof(__pyx_k__one), 0, 0, 1, 1},
{&__pyx_n_s__operator, __pyx_k__operator, sizeof(__pyx_k__operator), 0, 0, 1, 1},
{&__pyx_n_s__print, __pyx_k__print, sizeof(__pyx_k__print), 0, 0, 1, 1},
{&__pyx_n_s__product, __pyx_k__product, sizeof(__pyx_k__product), 0, 0, 1, 1},
{&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
{&__pyx_n_s__reduce, __pyx_k__reduce, sizeof(__pyx_k__reduce), 0, 0, 1, 1},
{&__pyx_n_s__searchvalue, __pyx_k__searchvalue, sizeof(__pyx_k__searchvalue), 0, 0, 1, 1},
{&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
{&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
{&__pyx_n_s__sortedmap, __pyx_k__sortedmap, sizeof(__pyx_k__sortedmap), 0, 0, 1, 1},
{&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1},
{&__pyx_n_s__ten, __pyx_k__ten, sizeof(__pyx_k__ten), 0, 0, 1, 1},
{&__pyx_n_s__tenpointoh, __pyx_k__tenpointoh, sizeof(__pyx_k__tenpointoh), 0, 0, 1, 1},
{&__pyx_n_s__three, __pyx_k__three, sizeof(__pyx_k__three), 0, 0, 1, 1},
{&__pyx_n_s__totalsum, __pyx_k__totalsum, sizeof(__pyx_k__totalsum), 0, 0, 1, 1},
{&__pyx_n_s__twentypointtwo, __pyx_k__twentypointtwo, sizeof(__pyx_k__twentypointtwo), 0, 0, 1, 1},
{&__pyx_n_s__two, __pyx_k__two, sizeof(__pyx_k__two), 0, 0, 1, 1},
{&__pyx_n_s__uno, __pyx_k__uno, sizeof(__pyx_k__uno), 0, 0, 1, 1},
{&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_reduce = __Pyx_GetName(__pyx_b, __pyx_n_s__reduce); if (!__pyx_builtin_reduce) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_print = __Pyx_GetName(__pyx_b, __pyx_n_s__print); if (!__pyx_builtin_print) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "hello_world.py":14
* def main(self):
* # stdout
* print("Hello World"); # <<<<<<<<<<<<<<
*
* # basic math
*/
__pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_2);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
/* "hello_world.py":17
*
* # basic math
* print("// basic math") # <<<<<<<<<<<<<<
* _sum = 0
* _sum = 2.0 + 2.0
*/
__pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_4);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
/* "hello_world.py":25
*
* # for and while loops; nested arrays; functions
* print("// loops; nested arrays; functions") # <<<<<<<<<<<<<<
* n = 10
* nsums = [] # XXX: see hello_world.pxd
*/
__pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_6);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
/* "hello_world.py":32
* while (i < n):
* nsums.append([None,]*n)
* for j in range(n)[::-1]: # <<<<<<<<<<<<<<
* nsums[i][j] = self.product((i, j)) # preallocation?
* totalsum += nsums[i][j]
*/
__pyx_k_slice_7 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_slice_7);
__Pyx_GIVEREF(__pyx_k_slice_7);
/* "hello_world.py":38
*
* # if-conditionals
* print("// if-conditionals") # <<<<<<<<<<<<<<
* if totalsum==2025:
* print("totalsum*5: %d" % (totalsum*5))
*/
__pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_9);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_8));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
/* "hello_world.py":42
* print("totalsum*5: %d" % (totalsum*5))
* elif totalsum==0:
* print("totalsum is zero?") # <<<<<<<<<<<<<<
* else:
* print("totalsum is off")
*/
__pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_12);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
/* "hello_world.py":44
* print("totalsum is zero?")
* else:
* print("totalsum is off") # <<<<<<<<<<<<<<
*
* # function overload (what is this called again?)
*/
__pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_14);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
/* "hello_world.py":47
*
* # function overload (what is this called again?)
* print("// function overload") # not really # <<<<<<<<<<<<<<
* print(self.product((2,3,4)))
*
*/
__pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_16);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
/* "hello_world.py":48
* # function overload (what is this called again?)
* print("// function overload") # not really
* print(self.product((2,3,4))) # <<<<<<<<<<<<<<
*
* # input coercion
*/
__pyx_k_tuple_17 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_17);
__Pyx_INCREF(__pyx_int_2);
PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, __pyx_int_2);
__Pyx_GIVEREF(__pyx_int_2);
__Pyx_INCREF(__pyx_int_3);
PyTuple_SET_ITEM(__pyx_k_tuple_17, 1, __pyx_int_3);
__Pyx_GIVEREF(__pyx_int_3);
__Pyx_INCREF(__pyx_int_4);
PyTuple_SET_ITEM(__pyx_k_tuple_17, 2, __pyx_int_4);
__Pyx_GIVEREF(__pyx_int_4);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
__pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_18);
__Pyx_INCREF(((PyObject *)__pyx_k_tuple_17));
PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_k_tuple_17));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
/* "hello_world.py":51
*
* # input coercion
* print("// input coercion") # <<<<<<<<<<<<<<
* ten = int("10")
* tenpointoh = float("10.0")
*/
__pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_20);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
/* "hello_world.py":52
* # input coercion
* print("// input coercion")
* ten = int("10") # <<<<<<<<<<<<<<
* tenpointoh = float("10.0")
*
*/
__pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_21);
__Pyx_INCREF(((PyObject *)__pyx_kp_s__10));
PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s__10));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s__10));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
/* "hello_world.py":56
*
* # try/except blocks
* print("// try/catch blocks") # <<<<<<<<<<<<<<
* doublestr = "x20.2"
* try:
*/
__pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_24);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_23));
PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_23));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_23));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
/* "hello_world.py":68
* ##
* # Arraylists
* print("// ArrayLists") # <<<<<<<<<<<<<<
* intlist = []
* intlist = range(5)
*/
__pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_28);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
/* "hello_world.py":70
* print("// ArrayLists")
* intlist = []
* intlist = range(5) # <<<<<<<<<<<<<<
* print(len(intlist))
* intlist.pop(0)
*/
__pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_29);
__Pyx_INCREF(__pyx_int_5);
PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, __pyx_int_5);
__Pyx_GIVEREF(__pyx_int_5);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
/* "hello_world.py":88
* ##
* # HashMaps
* print("// Maps") # <<<<<<<<<<<<<<
* _map = {}
* _map['one'] = 1
*/
__pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_32);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
/* "hello_world.py":112
* # Collections, sorting
* # note that there exists an "OrderedDict" in stdlib
* print("// Collections.sort") # <<<<<<<<<<<<<<
* for k in sorted(_map.iterkeys()):
* print("%s: %s" % (k, _map[k]))
*/
__pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_39);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
/* "hello_world.py":118
* ##
* # OrderedDict
* print("// OrderedDict") # <<<<<<<<<<<<<<
* sortedmap = OrderedDict()
* sortedmap['one'] = 1
*/
__pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_41);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
/* "hello_world.py":9
*
* class HelloWorld:
* def product(self, args): # <<<<<<<<<<<<<<
* return reduce(mul, args)
*
*/
__pyx_k_tuple_43 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_43);
__Pyx_INCREF(((PyObject *)__pyx_n_s__self));
PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_n_s__self));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
__Pyx_INCREF(((PyObject *)__pyx_n_s__args));
PyTuple_SET_ITEM(__pyx_k_tuple_43, 1, ((PyObject *)__pyx_n_s__args));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__args));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
__pyx_k_codeobj_44 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_45, __pyx_n_s__product, 9, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "hello_world.py":12
* return reduce(mul, args)
*
* def main(self): # <<<<<<<<<<<<<<
* # stdout
* print("Hello World");
*/
__pyx_k_tuple_46 = PyTuple_New(23); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_46);
__Pyx_INCREF(((PyObject *)__pyx_n_s__self));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_n_s__self));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
__Pyx_INCREF(((PyObject *)__pyx_n_s___sum));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 1, ((PyObject *)__pyx_n_s___sum));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s___sum));
__Pyx_INCREF(((PyObject *)__pyx_n_s__sqrt));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 2, ((PyObject *)__pyx_n_s__sqrt));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__sqrt));
__Pyx_INCREF(((PyObject *)__pyx_n_s__n));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 3, ((PyObject *)__pyx_n_s__n));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
__Pyx_INCREF(((PyObject *)__pyx_n_s__nsums));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 4, ((PyObject *)__pyx_n_s__nsums));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__nsums));
__Pyx_INCREF(((PyObject *)__pyx_n_s__totalsum));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 5, ((PyObject *)__pyx_n_s__totalsum));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__totalsum));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 6, ((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 7, ((PyObject *)__pyx_n_s__j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
__Pyx_INCREF(((PyObject *)__pyx_n_s__ten));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 8, ((PyObject *)__pyx_n_s__ten));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__ten));
__Pyx_INCREF(((PyObject *)__pyx_n_s__tenpointoh));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 9, ((PyObject *)__pyx_n_s__tenpointoh));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__tenpointoh));
__Pyx_INCREF(((PyObject *)__pyx_n_s__doublestr));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 10, ((PyObject *)__pyx_n_s__doublestr));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__doublestr));
__Pyx_INCREF(((PyObject *)__pyx_n_s__twentypointtwo));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 11, ((PyObject *)__pyx_n_s__twentypointtwo));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__twentypointtwo));
__Pyx_INCREF(((PyObject *)__pyx_n_s__e));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 12, ((PyObject *)__pyx_n_s__e));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__e));
__Pyx_INCREF(((PyObject *)__pyx_n_s__intlist));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 13, ((PyObject *)__pyx_n_s__intlist));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__intlist));
__Pyx_INCREF(((PyObject *)__pyx_n_s__nextint));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 14, ((PyObject *)__pyx_n_s__nextint));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__nextint));
__Pyx_INCREF(((PyObject *)__pyx_n_s___map));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 15, ((PyObject *)__pyx_n_s___map));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s___map));
__Pyx_INCREF(((PyObject *)__pyx_n_s__key));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 16, ((PyObject *)__pyx_n_s__key));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__key));
__Pyx_INCREF(((PyObject *)__pyx_n_s__searchvalue));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 17, ((PyObject *)__pyx_n_s__searchvalue));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__searchvalue));
__Pyx_INCREF(((PyObject *)__pyx_n_s__k));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 18, ((PyObject *)__pyx_n_s__k));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
__Pyx_INCREF(((PyObject *)__pyx_n_s__v));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 19, ((PyObject *)__pyx_n_s__v));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__v));
__Pyx_INCREF(((PyObject *)__pyx_n_s__sortedmap));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 20, ((PyObject *)__pyx_n_s__sortedmap));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__sortedmap));
__Pyx_INCREF(((PyObject *)__pyx_n_s__invertedmap));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 21, ((PyObject *)__pyx_n_s__invertedmap));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__invertedmap));
__Pyx_INCREF(((PyObject *)__pyx_n_s___currentvalue));
PyTuple_SET_ITEM(__pyx_k_tuple_46, 22, ((PyObject *)__pyx_n_s___currentvalue));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s___currentvalue));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));
__pyx_k_codeobj_47 = (PyObject*)__Pyx_PyCode_New(1, 0, 23, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_45, __pyx_n_s__main, 12, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_2025 = PyInt_FromLong(2025); if (unlikely(!__pyx_int_2025)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initc_hello_world(void); /*proto*/
PyMODINIT_FUNC initc_hello_world(void)
#else
PyMODINIT_FUNC PyInit_c_hello_world(void); /*proto*/
PyMODINIT_FUNC PyInit_c_hello_world(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_c_hello_world(void)", 0);
if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("c_hello_world"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#if PY_MAJOR_VERSION < 3
Py_INCREF(__pyx_m);
#endif
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_module_is_main_c_hello_world) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "hello_world.py":3
* #!/usr/bin/env python
* from __future__ import print_function
* from operator import mul # <<<<<<<<<<<<<<
* from collections import OrderedDict # python 2.7+
* from itertools import imap
*/
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_n_s__mul));
PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__mul));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__mul));
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__operator), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mul);
if (__pyx_t_1 == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__mul);
if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mul, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hello_world.py":4
* from __future__ import print_function
* from operator import mul
* from collections import OrderedDict # python 2.7+ # <<<<<<<<<<<<<<
* from itertools import imap
* import math
*/
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_n_s__OrderedDict));
PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__OrderedDict));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__OrderedDict));
__pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__OrderedDict);
if (__pyx_t_2 == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__OrderedDict);
if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_2);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__OrderedDict, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":5
* from operator import mul
* from collections import OrderedDict # python 2.7+
* from itertools import imap # <<<<<<<<<<<<<<
* import math
*
*/
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(((PyObject *)__pyx_n_s__imap));
PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__imap));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__imap));
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__itertools), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__imap);
if (__pyx_t_1 == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__imap);
if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__imap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hello_world.py":6
* from collections import OrderedDict # python 2.7+
* from itertools import imap
* import math # <<<<<<<<<<<<<<
*
* class HelloWorld:
*/
__pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__math), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__math, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hello_world.py":8
* import math
*
* class HelloWorld: # <<<<<<<<<<<<<<
* def product(self, args):
* return reduce(mul, args)
*/
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
/* "hello_world.py":9
*
* class HelloWorld:
* def product(self, args): # <<<<<<<<<<<<<<
* return reduce(mul, args)
*
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13c_hello_world_10HelloWorld_1product, 0, NULL, __pyx_n_s__c_hello_world, ((PyObject *)__pyx_k_codeobj_44)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__product, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":12
* return reduce(mul, args)
*
* def main(self): # <<<<<<<<<<<<<<
* # stdout
* print("Hello World");
*/
__pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_13c_hello_world_10HelloWorld_3main, 0, NULL, __pyx_n_s__c_hello_world, ((PyObject *)__pyx_k_codeobj_47)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__main, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":8
* import math
*
* class HelloWorld: # <<<<<<<<<<<<<<
* def product(self, args):
* return reduce(mul, args)
*/
__pyx_t_1 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2), __pyx_n_s__HelloWorld, __pyx_n_s__c_hello_world); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HelloWorld, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
/* "hello_world.py":143
*
*
* if __name__=="__main__": # <<<<<<<<<<<<<<
* cls = HelloWorld()
* cls.main()
*/
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s____main__), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_3) {
/* "hello_world.py":144
*
* if __name__=="__main__":
* cls = HelloWorld() # <<<<<<<<<<<<<<
* cls.main()
*/
__pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__HelloWorld); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cls, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "hello_world.py":145
* if __name__=="__main__":
* cls = HelloWorld()
* cls.main() # <<<<<<<<<<<<<<
*/
__pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__cls); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__main); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L2;
}
__pyx_L2:;
/* "hello_world.py":1
* #!/usr/bin/env python # <<<<<<<<<<<<<<
* from __future__ import print_function
* from operator import mul
*/
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
if (__pyx_m) {
__Pyx_AddTraceback("init c_hello_world", __pyx_clineno, __pyx_lineno, __pyx_filename);
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init c_hello_world");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result) {
if (dict != __pyx_b) {
PyErr_Clear();
result = PyObject_GetAttr(__pyx_b, name);
}
if (!result) {
PyErr_SetObject(PyExc_NameError, name);
}
}
return result;
}
static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
Py_ssize_t num_min,
Py_ssize_t num_max,
Py_ssize_t num_found)
{
Py_ssize_t num_expected;
const char *more_or_less;
if (num_found < num_min) {
num_expected = num_min;
more_or_less = "at least";
} else {
num_expected = num_max;
more_or_less = "at most";
}
if (exact) {
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
"%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
{
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION >= 3
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
#else
"%s() got multiple values for keyword argument '%s'", func_name,
PyString_AS_STRING(kw_name));
#endif
}
static int __Pyx_ParseOptionalKeywords(
PyObject *kwds,
PyObject **argnames[],
PyObject *kwds2,
PyObject *values[],
Py_ssize_t num_pos_args,
const char* function_name)
{
PyObject *key = 0, *value = 0;
Py_ssize_t pos = 0;
PyObject*** name;
PyObject*** first_kw_arg = argnames + num_pos_args;
while (PyDict_Next(kwds, &pos, &key, &value)) {
name = first_kw_arg;
while (*name && (**name != key)) name++;
if (*name) {
values[name-argnames] = value;
} else {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
#else
if (unlikely(!PyUnicode_Check(key))) {
#endif
goto invalid_keyword_type;
} else {
for (name = first_kw_arg; *name; name++) {
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
PyUnicode_Compare(**name, key) == 0) break;
#else
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
_PyString_Eq(**name, key)) break;
#endif
}
if (*name) {
values[name-argnames] = value;
} else {
for (name=argnames; name != first_kw_arg; name++) {
if (**name == key) goto arg_passed_twice;
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
#else
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
_PyString_Eq(**name, key)) goto arg_passed_twice;
#endif
}
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
}
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value;
if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
return PyFloat_AsDouble(obj);
} else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
float_value = PyFloat_FromString(obj);
#else
float_value = PyFloat_FromString(obj, 0);
#endif
} else {
PyObject* args = PyTuple_New(1);
if (unlikely(!args)) goto bad;
PyTuple_SET_ITEM(args, 0, obj);
float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
PyTuple_SET_ITEM(args, 0, 0);
Py_DECREF(args);
}
if (likely(float_value)) {
double value = PyFloat_AS_DOUBLE(float_value);
Py_DECREF(float_value);
return value;
}
bad:
return (double)-1;
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *local_type, *local_value, *local_tb;
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
local_type = tstate->curexc_type;
local_value = tstate->curexc_value;
local_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
if (unlikely(tstate->curexc_type))
goto bad;
#if PY_MAJOR_VERSION >= 3
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
goto bad;
#endif
*type = local_type;
*value = local_value;
*tb = local_tb;
Py_INCREF(local_type);
Py_INCREF(local_value);
Py_INCREF(local_tb);
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = local_type;
tstate->exc_value = local_value;
tstate->exc_traceback = local_tb;
/* Make sure tstate is in a consistent state when we XDECREF
these objects (XDECREF may run arbitrary code). */
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
return 0;
bad:
*type = 0;
*value = 0;
*tb = 0;
Py_XDECREF(local_type);
Py_XDECREF(local_value);
Py_XDECREF(local_tb);
return -1;
}
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->curexc_type;
tmp_value = tstate->curexc_value;
tmp_tb = tstate->curexc_traceback;
tstate->curexc_type = type;
tstate->curexc_value = value;
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->curexc_type;
*value = tstate->curexc_value;
*tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
#else
PyErr_Fetch(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
index, (index == 1) ? "" : "s");
}
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
}
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->exc_type;
*value = tstate->exc_value;
*tb = tstate->exc_traceback;
Py_XINCREF(*type);
Py_XINCREF(*value);
Py_XINCREF(*tb);
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = type;
tstate->exc_value = value;
tstate->exc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
PyObject *py_import = 0;
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
if (!py_import)
goto bad;
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
#if PY_VERSION_HEX >= 0x02050000
{
#if PY_MAJOR_VERSION >= 3
if (level == -1) {
if (strchr(__Pyx_MODULE_NAME, '.')) {
/* try package relative import first */
PyObject *py_level = PyInt_FromLong(1);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad;
PyErr_Clear();
}
}
level = 0; /* try absolute import on failure */
}
#endif
if (!module) {
PyObject *py_level = PyInt_FromLong(level);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
}
}
#else
if (level>0) {
PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
goto bad;
}
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, NULL);
#endif
bad:
Py_XDECREF(empty_list);
Py_XDECREF(py_import);
Py_XDECREF(empty_dict);
return module;
}
static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
#if PY_MAJOR_VERSION < 3
PyErr_Format(PyExc_ImportError, "cannot import name %.230s",
PyString_AsString(name));
#else
PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
#endif
}
static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
PyObject *metaclass;
/* Default metaclass */
#if PY_MAJOR_VERSION < 3
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyObject *base = PyTuple_GET_ITEM(bases, 0);
metaclass = PyObject_GetAttrString(base, (char *)"__class__");
if (!metaclass) {
PyErr_Clear();
metaclass = (PyObject*) Py_TYPE(base);
}
} else {
metaclass = (PyObject *) &PyClass_Type;
}
#else
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyObject *base = PyTuple_GET_ITEM(bases, 0);
metaclass = (PyObject*) Py_TYPE(base);
} else {
metaclass = (PyObject *) &PyType_Type;
}
#endif
Py_INCREF(metaclass);
return metaclass;
}
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
PyObject *modname) {
PyObject *result;
PyObject *metaclass;
if (PyDict_SetItemString(dict, "__module__", modname) < 0)
return NULL;
/* Python2 __metaclass__ */
metaclass = PyDict_GetItemString(dict, "__metaclass__");
if (metaclass) {
Py_INCREF(metaclass);
} else {
metaclass = __Pyx_FindPy2Metaclass(bases);
}
result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
Py_DECREF(metaclass);
return result;
}
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
if (op->func_doc == NULL && op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
}
if (op->func_doc == 0) {
Py_INCREF(Py_None);
return Py_None;
}
Py_INCREF(op->func_doc);
return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp = op->func_doc;
if (value == NULL)
op->func_doc = Py_None; /* Mark as deleted */
else
op->func_doc = value;
Py_INCREF(op->func_doc);
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
if (op->func_name == NULL) {
#if PY_MAJOR_VERSION >= 3
op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
}
Py_INCREF(op->func_name);
return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
if (value == NULL || !PyUnicode_Check(value)) {
#else
if (value == NULL || !PyString_Check(value)) {
#endif
PyErr_SetString(PyExc_TypeError,
"__name__ must be set to a string object");
return -1;
}
tmp = op->func_name;
Py_INCREF(value);
op->func_name = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
PyObject *self;
self = m->func_closure;
if (self == NULL)
self = Py_None;
Py_INCREF(self);
return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
if (op->func_dict == NULL) {
op->func_dict = PyDict_New();
if (op->func_dict == NULL)
return NULL;
}
Py_INCREF(op->func_dict);
return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
"function's dictionary may not be deleted");
return -1;
}
if (!PyDict_Check(value)) {
PyErr_SetString(PyExc_TypeError,
"setting function's dictionary to a non-dict");
return -1;
}
tmp = op->func_dict;
Py_INCREF(value);
op->func_dict = value;
Py_XDECREF(tmp);
return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
PyObject* dict = PyModule_GetDict(__pyx_m);
Py_XINCREF(dict);
return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
PyObject* result = (op->func_code) ? op->func_code : Py_None;
Py_INCREF(result);
return result;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op)
{
if (op->defaults_tuple) {
Py_INCREF(op->defaults_tuple);
return op->defaults_tuple;
}
if (op->defaults_getter) {
PyObject *res = op->defaults_getter((PyObject *) op);
if (res) {
Py_INCREF(res);
op->defaults_tuple = res;
}
return res;
}
Py_INCREF(Py_None);
return Py_None;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
{(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, 0, 0, 0},
{0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
{0, 0, 0, 0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
{__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
{0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
PyObject *closure, PyObject *module, PyObject* code) {
__pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
if (op == NULL)
return NULL;
op->flags = flags;
op->func_weakreflist = NULL;
op->func.m_ml = ml;
op->func.m_self = (PyObject *) op;
Py_XINCREF(closure);
op->func_closure = closure;
Py_XINCREF(module);
op->func.m_module = module;
op->func_dict = NULL;
op->func_name = NULL;
op->func_doc = NULL;
op->func_classobj = NULL;
Py_XINCREF(code);
op->func_code = code;
op->defaults_pyobjects = 0;
op->defaults = NULL;
op->defaults_tuple = NULL;
op->defaults_getter = NULL;
PyObject_GC_Track(op);
return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
Py_CLEAR(m->func_closure);
Py_CLEAR(m->func.m_module);
Py_CLEAR(m->func_dict);
Py_CLEAR(m->func_name);
Py_CLEAR(m->func_doc);
Py_CLEAR(m->func_code);
Py_CLEAR(m->func_classobj);
Py_CLEAR(m->defaults_tuple);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_XDECREF(pydefaults[i]);
PyMem_Free(m->defaults);
m->defaults = NULL;
}
return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
PyObject_GC_UnTrack(m);
if (m->func_weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) m);
__Pyx_CyFunction_clear(m);
PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
Py_VISIT(m->func_closure);
Py_VISIT(m->func.m_module);
Py_VISIT(m->func_dict);
Py_VISIT(m->func_name);
Py_VISIT(m->func_doc);
Py_VISIT(m->func_code);
Py_VISIT(m->func_classobj);
Py_VISIT(m->defaults_tuple);
if (m->defaults) {
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
int i;
for (i = 0; i < m->defaults_pyobjects; i++)
Py_VISIT(pydefaults[i]);
}
return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
Py_INCREF(func);
return func;
}
if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
if (type == NULL)
type = (PyObject *)(Py_TYPE(obj));
return PyMethod_New(func,
type, (PyObject *)(Py_TYPE(type)));
}
if (obj == Py_None)
obj = NULL;
return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
PyObject *func_name = __Pyx_CyFunction_get_name(op);
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromFormat("<cyfunction %U at %p>",
func_name, (void *)op);
#else
return PyString_FromFormat("<cyfunction %s at %p>",
PyString_AsString(func_name), (void *)op);
#endif
}
static PyTypeObject __pyx_CyFunctionType_type = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
sizeof(__pyx_CyFunctionObject), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#else
0, /*reserved*/
#endif
(reprfunc) __Pyx_CyFunction_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
__Pyx_PyCFunction_Call, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
0, /*tp_doc*/
(traverseproc) __Pyx_CyFunction_traverse, /*tp_traverse*/
(inquiry) __Pyx_CyFunction_clear, /*tp_clear*/
0, /*tp_richcompare*/
offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_CyFunction_methods, /*tp_methods*/
__pyx_CyFunction_members, /*tp_members*/
__pyx_CyFunction_getsets, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
__Pyx_CyFunction_descr_get, /*tp_descr_get*/
0, /*tp_descr_set*/
offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
0, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
#endif
};
static int __Pyx_CyFunction_init(void)
{
if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
return -1;
__pyx_CyFunctionType = &__pyx_CyFunctionType_type;
return 0;
}
void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects)
{
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults = PyMem_Malloc(size);
if (!m->defaults)
return PyErr_NoMemory();
memset(m->defaults, 0, sizeof(size));
m->defaults_pyobjects = pyobjects;
return m->defaults;
}
static void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple)
{
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
m->defaults_tuple = tuple;
Py_INCREF(tuple);
}
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
if (s1 == s2) {
return (equals == Py_EQ);
} else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
return (equals == Py_NE);
} else if (PyBytes_GET_SIZE(s1) == 1) {
if (equals == Py_EQ)
return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
else
return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
} else {
int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
return (equals == Py_EQ) ? (result == 0) : (result != 0);
}
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
return (equals == Py_NE);
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
return (equals == Py_NE);
} else {
int result;
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
if (!py_result)
return -1;
result = __Pyx_PyObject_IsTrue(py_result);
Py_DECREF(py_result);
return result;
}
}
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
if (s1 == s2) {
return (equals == Py_EQ);
} else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
#if CYTHON_PEP393_ENABLED
if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
return -1;
if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
return (equals == Py_NE);
} else if (PyUnicode_GET_LENGTH(s1) == 1) {
Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
#else
if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
return (equals == Py_NE);
} else if (PyUnicode_GET_SIZE(s1) == 1) {
Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
#endif
} else {
int result = PyUnicode_Compare(s1, s2);
if ((result == -1) && unlikely(PyErr_Occurred()))
return -1;
return (equals == Py_EQ) ? (result == 0) : (result != 0);
}
} else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
return (equals == Py_NE);
} else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
return (equals == Py_NE);
} else {
int result;
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
if (!py_result)
return -1;
result = __Pyx_PyObject_IsTrue(py_result);
Py_DECREF(py_result);
return result;
}
}
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned char" :
"value too large to convert to unsigned char");
}
return (unsigned char)-1;
}
return (unsigned char)val;
}
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned short" :
"value too large to convert to unsigned short");
}
return (unsigned short)-1;
}
return (unsigned short)val;
}
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned int" :
"value too large to convert to unsigned int");
}
return (unsigned int)-1;
}
return (unsigned int)val;
}
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
const char neg_one = (char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to char" :
"value too large to convert to char");
}
return (char)-1;
}
return (char)val;
}
return (char)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
const short neg_one = (short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to short" :
"value too large to convert to short");
}
return (short)-1;
}
return (short)val;
}
return (short)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
const signed char neg_one = (signed char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed char" :
"value too large to convert to signed char");
}
return (signed char)-1;
}
return (signed char)val;
}
return (signed char)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
const signed short neg_one = (signed short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed short" :
"value too large to convert to signed short");
}
return (signed short)-1;
}
return (signed short)val;
}
return (signed short)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
const signed int neg_one = (signed int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed int" :
"value too large to convert to signed int");
}
return (signed int)-1;
}
return (signed int)val;
}
return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
return (unsigned long)PyLong_AsLong(x);
}
} else {
unsigned long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned long)-1;
val = __Pyx_PyInt_AsUnsignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
unsigned PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
const long neg_one = (long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)PyLong_AsUnsignedLong(x);
} else {
return (long)PyLong_AsLong(x);
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long)-1;
val = __Pyx_PyInt_AsLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
const signed long neg_one = (signed long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)PyLong_AsUnsignedLong(x);
} else {
return (signed long)PyLong_AsLong(x);
}
} else {
signed long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed long)-1;
val = __Pyx_PyInt_AsSignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
signed PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsSignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
#if PY_VERSION_HEX < 0x02050000
return PyErr_Warn(NULL, message);
#else
return PyErr_WarnEx(NULL, message, 1);
#endif
}
return 0;
}
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
int start = 0, mid = 0, end = count - 1;
if (end >= 0 && code_line > entries[end].code_line) {
return count;
}
while (start < end) {
mid = (start + end) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0, /*int argcount,*/
0, /*int kwonlyargcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line, /*int firstlineno,*/
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_globals = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else /* Python 3+ has unicode identifiers */
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
/* Type Conversion Functions */
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_VERSION_HEX < 0x03000000
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%s__ returned non-%s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
if (ival <= LONG_MAX)
return PyInt_FromLong((long)ival);
else {
unsigned char *bytes = (unsigned char *) &ival;
int one = 1; int little = (int)*(unsigned char*)&one;
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
}
#else
return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
return (size_t)-1;
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t)-1;
}
return (size_t)val;
}
#endif /* Py_PYTHON_H */
|
e78e03f2a2788c885e8db93c29ace1aa95c09aba | 90933bb0f07a145155cf0ad95fa58bbe043e9e82 | /MainCode/prj/app/demo/dvbs/sabbat_dual/osd_three/rsc/bmp/Im_Window_Middle_Left1.h | bcba076dac4d354471a13a66a95d81f7167f5a3a | [] | no_license | digrobot/ali3602 | b333209d304970e5e30687d7ea6877a7a3bbf64b | a11fab525a28f89b77ec49c2ad266ae5943288ac | refs/heads/master | 2017-10-03T08:40:13.684238 | 2014-11-03T20:06:26 | 2014-11-03T20:06:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,507 | h | Im_Window_Middle_Left1.h | /*
D:\OSD Generate Tool\3_bmptobin_sub_bmp\Im_window_middle_left1.h
bmp file size: 4680
bmp data offset: 1078
bmp data width: 60
bmp data height: 60
bmp data size: 3600
RLE bmp data size: 240
*/
const unsigned char Im_window_middle_left1[] __attribute__((section(".flash"))) =
{
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,
0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42,0x06,0x08,0x36,0x42
};
|
d8c8bcb76e31e42477020f37682fc0be6fd9c7b0 | 5e92b3885d8914b6db1053090a2b054002e56248 | /libft/ft_memcpy.c | 6780fbf24e2048ece2af3b9cc4e5229f3311e001 | [] | no_license | deds129/cub3d-linux_2 | 628a0a8c461b7cdd91df2cf57a82aca8f5dbddbe | 86ce0394e63695fda3bdfa54e6217bc7a9d25e97 | refs/heads/main | 2023-03-29T03:47:56.278063 | 2021-04-07T13:56:39 | 2021-04-07T13:56:39 | 350,346,137 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,217 | c | ft_memcpy.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hanisha <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/30 17:08:22 by hanisha #+# #+# */
/* Updated: 2020/10/30 17:38:31 by hanisha ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/libft.h"
void *ft_memcpy(void *dst, const void *rsrc, size_t n)
{
size_t i;
unsigned char *udst;
unsigned char *ursrc;
udst = (unsigned char *)dst;
ursrc = (unsigned char *)rsrc;
if (!dst && !rsrc)
return (dst);
i = 0;
while (i < n)
{
udst[i] = ursrc[i];
i++;
}
return (udst);
}
|
8255fe81f9bcd6f4327bc23f01c14d5f69fd1c74 | 60a15a584b00895e47628c5a485bd1f14cfeebbe | /controls/VTDesign/jdraw/types.h | fbcf396fd315cb2238d733c13204635d9da35f70 | [] | no_license | fcccode/vt5 | ce4c1d8fe819715f2580586c8113cfedf2ab44ac | c88049949ebb999304f0fc7648f3d03f6501c65b | refs/heads/master | 2020-09-27T22:56:55.348501 | 2019-06-17T20:39:46 | 2019-06-17T20:39:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,008 | h | types.h |
#ifndef __TYPES_H__
#define __TYPES_H__
enum BorderType {
btEdgeNone = 0,
btEdgeRaised = 1,
btEdgeSunken = 2,
btEdgeEtched = 3,
btEdgeBump = 4
};
enum FlipType {
ftNormal = 0,
ftPositive = 1,
ftNegative = 2
};
enum PositionType
{
ptLeft = 0,
ptRight = 1,
ptTop = 2,
ptBottom = 3
};
enum AlignType{
atLeft = 0,
atCenter = 1,
atRight = 2
};
enum AlignHorizontal{
ahLeft = 0,
ahCenter = 1,
ahRight = 2
};
enum AlignVertical{
avTop = 0,
avCenter = 1,
avBottom = 2
};
enum ArrowType {
none = 0,
pureArrow = 1,
openArrow = 2,
stealthArrow = 3,
diamondArrow = 4,
ovalArrow = 5
};
enum SystemType {
stDate = 0,
stDateTime = 1,
stPageNum = 2
};
enum DashStyle {
DL_SOLID = 0,
DL_DASH = 1,
DL_DOT = 2,
DL_DASHDOT = 3,
DL_DASHDOTDOT = 4,
DL_DASHDOTDOTDOT = 5,
DL_DASH_GAP = 6,
DL_DOT_GAP = 7,
DL_DASHDOT_GAP = 8,
DL_DASHDOTDOT_GAP = 9,
DL_DASHDOTDOTDOT_GAP= 10
};
#endif // __TYPES_H__
|
b3c93a345e787d5a737d6a8f3f6aba8ddcdb5b19 | 5d88e926f1466f70029d2ba8c67ce0fa6402dbc6 | /inc/pipex.h | 6bdccb0b8d27e7e7c842c3d2ca744f38a2ef479d | [] | no_license | ahrytsen/rush_pipex | 911598d8370d1e2bc2a310882ac648273fa8e837 | 269705686fc09a6527261215f257699ba560bd21 | refs/heads/master | 2020-03-23T16:56:48.230677 | 2018-07-22T15:11:17 | 2018-07-22T15:11:17 | 141,834,784 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,175 | h | pipex.h | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ahrytsen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/21 11:55:48 by ahrytsen #+# #+# */
/* Updated: 2018/07/22 14:41:39 by ahrytsen ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PIPEX_H
# define PIPEX_H
# include <libft.h>
# include <fcntl.h>
# include <sys/stat.h>
typedef struct s_cmd t_cmd;
struct s_cmd
{
pid_t pid;
int std_in;
int std_out;
int to_close;
int ret;
char *cmd;
char **argv;
};
int ft_exec(t_list *cmds);
#endif
|
e66ab25a2c8ca46d555710b9fc2116b6ba26e6ec | 8413273bab84228dad6ff5247f6d581b7796d142 | /thirdparty/roxml/src/roxml_buff.c | 270ad9d38422b3bd47c57c671425ebc715337ab9 | [] | no_license | pdpdds/yuzaos | 91b6f5bb51583da3827594489fc700821bc5cd6a | ce3b6d0907f7be470fcbc408382a20e2b75e9ef2 | refs/heads/master | 2023-05-01T09:51:21.007740 | 2023-04-27T08:37:42 | 2023-04-27T08:37:42 | 289,303,507 | 28 | 5 | null | 2021-03-20T14:58:37 | 2020-08-21T15:30:10 | C | UTF-8 | C | false | false | 1,258 | c | roxml_buff.c | /**
* \file roxml_buff.c
* \brief buffer XML document backend
*
* (C) Copyright 2014
* Tristan Lelong <[email protected]>
*
* SPDX-Licence-Identifier: LGPL-2.1+
* The author added a static linking exception, see License.txt.
*/
#include "roxml_core.h"
#include "roxml_parser.h"
#include "roxml_internal.h"
ROXML_INT int roxml_read_buff(int pos, int size, char *buffer, node_t *node)
{
int ret_len = 0;
char *r1 = buffer;
char const *r2 = node->src.buf + pos;
while (size-- && (*r1++ = *r2++)) ;
ret_len = r1 - buffer;
return ret_len;
}
ROXML_INT void roxml_close_buff(node_t *n)
{
return;
}
ROXML_INT int roxml_parse_buff(roxml_load_ctx_t *context, roxml_parser_item_t *parser, char *buffer)
{
int ret = 0;
context->type = ROXML_BUFF;
context->src = (void *)buffer;
ret = roxml_parse_line(parser, buffer, 0, context);
if (ret >= 0 && context->lvl != 0)
ROXML_PARSE_ERROR("mismatch in open/close nodes");
return (ret < 0) ? 1 : 0;
}
ROXML_API node_t *roxml_load_buf(char *buffer)
{
node_t *current_node = NULL;
if (buffer == NULL) {
//errno = ENODATA;
errno = -1;
return NULL;
}
current_node = roxml_create_node(0, buffer, ROXML_ELM_NODE | ROXML_BUFF);
return roxml_load(current_node, NULL, buffer);
}
|
dec6b44e2bc77f4f27f6ba8161a3790f82101dc6 | 4264fc7e5ca86e3ebb72d779b76f67a9d1a947b6 | /dev/gcc/testcase/t00004.c | 25f251ee10f2563a13668c2abf1243522b66e57a | [] | no_license | alandohf/poonzref | a69cff823ffa6f4b666a4fb1af03558094ca2433 | 60d6fe6b0334ca40e330875e5047ebd221e8a79f | refs/heads/master | 2016-09-05T19:37:42.747748 | 2012-04-24T08:39:39 | 2012-04-24T08:39:39 | 33,358,906 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 2,856 | c | t00004.c | /**
test static
但有时候我们需要在两次调用之间对变量的值进行保存。通常的想法是定义一个全局变量来实现。但这样一来,变量已经不再属于函数本身了,不再仅受函数的控制,
给程序的维护带来不便。
静态局部变量正好可以解决这个问题。静态局部变量保存在全局数据区,而不是保存在栈中,每次的值保持到下一次调用,直到下次赋新值。
为什么要引入static
函数内部定义的变量,在程序执行到它的定义处时,编译器为它在栈上分配空间,大家知道,函数在栈上分配的空间在此函数执行结束时会释放掉,
这样就产生了一个问题: 如果想将函数中此变量的值保存至下一次调用时,如何实现? 最容易想到的方法是定义一个全局的变量,
但定义为一个全局变量有许多缺点,最明显的缺点是破坏了此变量的访问范围(使得在此函数中定义的变量,不仅仅受此函数控制)。
summary:
1.在 {} 外定义的,是 全局
2.在{}内定义的 , 是 局部于 {} 内的。
3.自动初始化为0
4.teststatic and teststatic2,initialize use the same memory address. and the value is not reset. 所以初始化很重要!!
5.静态数据(即使是函数内部的静 态局部变量)也存放在全局数据区。
静态全局变量不能被其它文件所用;
其它文件中可以定义相同名字的变量,不会发生冲突;
6. 静态局部变量在程序执行到该对象的声明处时被首次初始化,即以后的函数调用不再进行初始化;
它始终驻留在全局数据区,直到程序运行结束。但其作用域为局部作用域,当定义它的函数或语句块结束时,其作用域随之结束;
7. teststatic,teststatic2,teststatic3 对比说明函数两次运行b,c用的是同一栈内存,与变量名无关。
**/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int a ;
int x=3;
int ftest();
int teststatic();
int teststatic2();
int teststatic3();
int main(int argc,char *argv[]){
// test if a is initialize to 0.
printf("a=%d\n",a);
a=9;
ftest();
ftest();
int b = 999; // 不会影响ftest里的b.
ftest();
ftest();
printf("a=%d\t x=%d\n",a,x);
//int b;
//printf("a=%d b=%d\n",a,b);
//b only effects in ftest();
int i= 0;
while( i < 10 ){
//initialize();
teststatic();
teststatic2();
teststatic3();
i++;
}
return 0;
}
int ftest(){
static int b = 99;
printf("a=%d\tb=%d\n",a,b);
b++;
a++;
x++;
return 0;
}
int initialize(){
int d=0;
return 0;
}
int teststatic(){
int b;
b++;
printf("addr:%p\tvalueb:%d\n",&b,b);
return 0;
}
int teststatic2(){
int c;
c++;
printf("addr:%p\tvaluec:%d\n",&c,c);
return 0;
}
int
teststatic3(){
int c;
c++;
printf("addr:%p\tvaluec:%d\n",&c,c);
return 0;
}
|
e25fc9e6c78f91f6e4cea0670e9e28d731d174f5 | 4913b1b3e18f3cc95ed725e56730db5b976ef069 | /dietel/tabular_output.c | 4d74c0b9ab2f8939cebbf0113c8a2fe3663af9e6 | [] | no_license | elaiyarasan/c | 017af964a5e118e1efd5fe9974e91aedcab4061c | 248bec286b459421d4bf048afb8be03ebc118218 | refs/heads/master | 2020-03-14T07:16:51.054096 | 2019-01-31T03:15:51 | 2019-01-31T03:15:51 | 131,501,475 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 517 | c | tabular_output.c | /*3.26 (Tabular Output) Write a program that utilizes looping to produce the following table of
values:
A A+2 A+4 A+6
3 5 7 9
4 6 8 10
*/
#include<stdio.h>
int main()
{
int A,i,j,k,l,m;
printf("Enter the A value\n");
scanf("%d",&A);
printf("A A+2 A+4 A+6\n");
printf("%d",A);
for(i=2;i<4;i+=2)
{
l=A+i;
printf(" %d",l);
}
for(j=i;j<6;j+=2)
{
l=A+j;
printf(" %d",l);
}
for(k=j;k<8;k+=2)
{
l=A+k;
printf(" %d",l);
}
for(m=k;m<10;m+=2)
{
l=A+m;
printf(" %d",m);
}
return 0;
}
|
f7c5e8cab1b4638efd3def6a50d2d59fa1322fd1 | 436b06504095f97bb24257125379a4ed278b90e4 | /libplot/drivers/bitgraph/bg.h | 1ff860c9572cb9086b65bcd29fb38580a14d8cae | [
"BSD-4-Clause-UC",
"BSD-4-Clause"
] | permissive | Toranktto/bsd-plotutils | 2ec907f224e90cf2cebe13c95b245fa0295df86b | 1dffe7723892d8d75a07f5026d0e5d2c58b9979d | refs/heads/master | 2023-02-03T07:37:00.324961 | 2023-01-24T20:17:38 | 2023-01-24T20:17:38 | 142,710,561 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 476 | h | bg.h | /*
* Displays plot files on a bbn bitgraph terminal.
*/
#include <math.h>
#include <plot.h>
#include <stdio.h>
#include <stdlib.h>
#define ESC 033
#define PI 3.141592659
/* The graphics address range is 0..XMAX, 0..YMAX. */
#define XMAX 768
#define YMAX 1024
#define scaleX(xi) ((int)((xi - lowx) * scale + 0.5))
#define scaleY(yi) ((int)((yi - lowy) * scale + 0.5))
extern int currentx;
extern int currenty;
extern double lowx;
extern double lowy;
extern double scale;
|
191f47bf91d2ec6f4ebf2fdaa3ef265b0ab27d16 | fe917de521a38cb2e54c303a6bc2f508b0ae9716 | /ts/ts1.c | 5d0ebba530c78c345bc348ab03c32e83472d2a66 | [] | no_license | puped0/embedded-system-lecture | 333d480d9aff60bf670d7e4442e9871a18ee7a26 | 40a29765dc7236f3c01867a6babe20b9e02d4c01 | refs/heads/main | 2023-06-18T06:30:38.909334 | 2021-07-15T15:31:05 | 2021-07-15T15:31:05 | 384,170,535 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 540 | c | ts1.c |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/input.h>
int main()
{
int fd;
struct input_event ie;
int x=0,y=0,pressure=0;
fd = open("/dev/input/event4", O_RDWR);
if(fd<0) return -1;
while(1)
{
read(fd, &ie, sizeof(struct input_event));
if(ie.type==3)
{
if(ie.code==0)
x = ie.value;
else if(ie.code==1)
y = ie.value;
else if(ie.code==24)
pressure = ie.value;
printf("x = %d, y = %d, pressure = %d\n", x, y, pressure);
}
}
close(fd);
return 0;
}
|
b6b00bf2f6b5c9dc64758ba82886661059b4b677 | bd8d9364309d69217a8171e1cf27f2de26e26e28 | /algorithms/dataStructures/stack.c | 85d5be90e14e123b1b17e1a029def13b8c5184c4 | [] | no_license | zsmn/competitive_programming | 5a0981114cf4ed592f69b9246cca8f3549354056 | 259d67c8f9a4d1f4db0dbf8111ab54abdf0fbd31 | refs/heads/master | 2022-11-12T21:55:31.157354 | 2022-10-31T23:38:13 | 2022-10-31T23:38:30 | 154,896,004 | 8 | 17 | null | 2022-10-31T23:38:31 | 2018-10-26T21:23:23 | C++ | UTF-8 | C | false | false | 3,489 | c | stack.c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
Nessa struct nós criamos o nó (Link), onde temos um elemento
e um ponteiro que vai apontar para o próximo elemento.
*/
typedef struct link{
int element;
struct link *next;
} Link;
/*
Agora criamos a struct da stack, temos um nó (Link) que aponta
para o topo da nossa stack e um inteiro chamado size que me diz
o tamanho da minha stack.
*/
typedef struct{
Link *top;
int size;
} Stack;
/*
Aqui nós criamos um novo Link, primeiro nós damos um malloc
no Link n de sizeof(Link), após isso colocamos o valor it, que é o
novo valor que vamos inserir no element do nosso Link n, e colocamos para
o nosso ponteiro next apontar para o nextval passado para função, por fim
nós retornamos o n, que vai ser um novo link criado.
*/
Link *create_link(int it, Link *nextval){
Link *n;
n = (Link*) malloc(sizeof(Link));
n->element = it;
n->next = nextval;
return n;
}
/*
Na função create_stack nós criamos uma stack, primeiro criamos
um ponteiro do tipo stack, depois utilizamos um malloc sizeof(Stack)
para poder utilizar o ponteiro, depois eu seto o ponteiro que aponta
para o topo da stack como NULL e seto o tamanho da stack para 0,
então asiim nós criamos uma nova stack "sem nada".
*/
Stack *create_stack(){
Stack *s;
s = (Stack*) malloc(sizeof(Stack));
s->top = NULL;
s->size = 0;
return s;
}
/*
Primeiro recebemos a nossa stack como parâmetro e o novo valor a ser inserido, agora nós
atualizamos o topo da nossa stack, associando a ele um novo link que vai ser criado
ao chamarmos a função create_link, passamos o valor a ser inserido e o topo atual da nossa stack
para a função create link, dessa forma ele cria um novo link que vai ser o nosso topo atual e vai
apontar para o "topo antigo", e por fim incrementamos o tamanho da nossa stack.
*/
void push(Stack *s, int it){
s->top = create_link(it, s->top);
s->size++;
}
/*
Nessa função de pop, nós removemos o elemento do topo da nossa stack,
primeiros salvamos o elemento que está no topo da nossa stack num inteiro
chamado it, e logo após isso atualizamos o nosso topo, dizemos que o nosso novo
topo da stack é o que está "abaixo do topo antigo" (ex:. topo atual = 5, abaixo do topo = 6
agora nós dizemos que o topo atual = 6) e por fim nós decrementamos o tamanho da nossa stack
e retornamos o elemento da nossa stack que está salva na variável it.
*/
int pop(Stack *s){
int it;
Link *n;
if(s->top == NULL){
return -1;
}
it = s->top->element;
n = s->top;
s->top = s->top->next ;
free(n);
s->size--;
return it;
}
/*
Aqui nós implementamos a função clear para limpar a nossa stack, dando free
em todas as posições da mesma chamando a nossa função pop enquanto o topo da nossa
stack for diferente de NULL, porque isso quer dizer que ainda temos elementos presentes
na nossa stack.
*/
void clear(Stack *s){
while(s->top != NULL){
pop(s);
}
free(s);
}
/*
A função topValue retorna o valor que está no topo da nossa stack.
*/
int topValue(Stack *s){
if(s->top == NULL){
return -1;
}
return s->top->element;
}
/*
A função lenght retorna o tamanho da minha stack.
*/
int lenght(Stack *s){
return s->size;
}
int main(){
return 0;
}
|
441e541b20d7ff0cf75898315f6cea981b768e86 | 8609a8072273b04d97455fee8e448900609968d9 | /src/lora_radio_sx1272.c | a64779a1f4a4c68e235d0f0c4e1a68efd1064fea | [
"MIT"
] | permissive | gost-serb/lora_device_lib | 42b4ea53d8c6e3d5b2a5688d885a6b36353ae31c | 1aa92999ce7d90bf726d2fee26cce9b621ab365e | refs/heads/master | 2021-09-08T19:06:51.173170 | 2018-03-10T14:50:08 | 2018-03-10T14:50:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 12,162 | c | lora_radio_sx1272.c | /* Copyright (c) 2017-2018 Cameron Harper
*
* 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 "lora_debug.h"
#include "lora_radio.h"
#include "lora_system.h"
#include "lora_radio_sx1272.h"
#include <string.h>
/* static function prototypes *****************************************/
static void _write(struct lora_radio *self, uint8_t reg, const uint8_t *data, uint8_t len);
static void _read(struct lora_radio *self, uint8_t reg, uint8_t *data, uint8_t len);
static uint8_t readReg(struct lora_radio *self, uint8_t reg);
static uint8_t readFIFO(struct lora_radio *self, uint8_t *data, uint8_t max);
static void writeReg(struct lora_radio *self, uint8_t reg, uint8_t data);
static void writeFIFO(struct lora_radio *self, const uint8_t *data, uint8_t len);
static void setFreq(struct lora_radio *self, uint32_t freq);
static void setModemConfig(struct lora_radio *self, enum lora_signal_bandwidth bw, enum lora_spreading_factor sf, bool crc, uint16_t preamble, uint16_t timeout);
static void setPower(struct lora_radio *self, int dbm);
/* functions **********************************************************/
struct lora_radio * Radio_init(struct lora_radio *self, const struct lora_board *board)
{
LORA_PEDANTIC(self != NULL)
LORA_PEDANTIC(board != NULL)
(void)memset(self, 0, sizeof(*self));
(void)memcpy(&self->board, board, sizeof(*board));
return self;
}
void Radio_setEventHandler(struct lora_radio *self, void *receiver, radioEventCB cb)
{
LORA_PEDANTIC(self != NULL)
System_atomic_setPtr(&self->eventReceiver, NULL);
self->eventHandler = cb;
System_atomic_setPtr(&self->eventReceiver, receiver);
}
void Radio_reset(struct lora_radio *self, bool state)
{
LORA_PEDANTIC(self != NULL)
self->board.reset(self->board.receiver, state);
}
bool Radio_transmit(struct lora_radio *self, const struct lora_radio_tx_setting *settings, const void *data, uint8_t len)
{
LORA_PEDANTIC(self != NULL)
LORA_PEDANTIC(settings != NULL)
LORA_PEDANTIC((data != NULL) || (len == 0U))
bool retval = false;
if(len > 0U){
if(((settings->bw == BW_FSK) && (settings->sf == SF_FSK)) || ((settings->bw != BW_FSK) && (settings->sf != SF_FSK))){
if(settings->sf != SF_FSK){
writeReg(self, RegOpMode, 0x00U); // set sleep mode (to transition to long range mode)
writeReg(self, RegOpMode, 0x81U); // set standby mode (long range)
writeReg(self, RegIrqFlags, 0xff); // clear all interrupts
writeReg(self, RegIrqFlagsMask, 0xf7U); // unmask TX_DONE interrupt
writeReg(self, RegDioMapping1, 0x01U); // raise DIO0 on TX_DONE
self->dio_mapping1 &= ~0x3U;
self->dio_mapping1 |= 0x1U;
setFreq(self, settings->freq); // set carrier frequency
setPower(self, settings->power); // set power
writeReg(self, RegSyncWord, 0x34); // set sync word
setModemConfig(self, settings->bw, settings->sf, true, settings->preamble, 0U);
writeFIFO(self, data, len); // set pointers and write to fifo
writeReg(self, RegOpMode, 0x83U); // transmit mode
retval = true;
}
}
}
return retval;
}
bool Radio_receive(struct lora_radio *self, const struct lora_radio_rx_setting *settings)
{
LORA_PEDANTIC(self != NULL)
LORA_PEDANTIC(settings != NULL)
bool retval = false;
if(((settings->bw == BW_FSK) && (settings->sf == SF_FSK)) || ((settings->bw != BW_FSK) && (settings->sf != SF_FSK))){
if(settings->sf != SF_FSK){
writeReg(self, RegOpMode, 0x00U); // set sleep mode (to transition to long range mode)
writeReg(self, RegOpMode, 0x81U); // set standby mode (long range)
writeReg(self, RegIrqFlags, 0xff); // clear all interrupts
writeReg(self, RegIrqFlagsMask, 0xf7U); // unmask TX_DONE interrupt
writeReg(self, RegDioMapping1, 0x00U); // DIO0 (RX_TIMEOUT) DIO1 (RX_DONE)
self->dio_mapping1 &= ~0x3U;
self->dio_mapping1 |= 0x2U;
setFreq(self, settings->freq); // set carrier frequency
writeReg(self, RegSyncWord, 0x34); // set sync word
writeReg(self, RegDetectOptimize, 0x03U);
writeReg(self, RegDetectionThreshold, 0x0AU);
setModemConfig(self, settings->bw, settings->sf, false, settings->preamble, settings->timeout);
writeReg(self, RegOpMode, 0x86U); // receive mode
retval = true;
}
}
return retval;
}
static void setModemConfig(struct lora_radio *self, enum lora_signal_bandwidth bw, enum lora_spreading_factor sf, bool crc, uint16_t preamble, uint16_t timeout)
{
bool lowDataRateOptimize = ((bw == BW_125) && ((sf == SF_11) || (sf == SF_12))) ? true : false;
uint8_t _sf;
uint8_t _bw;
uint8_t _cr;
switch(bw){
default:
case BW_FSK:
case BW_125:
_bw = 0x00U;
break;
case BW_250:
_bw = 0x40U;
break;
case BW_500:
_bw = 0x80U;
break;
}
switch(sf){
default:
case SF_FSK:
case SF_7:
_sf = 0x70U;
break;
case SF_8:
_sf = 0x80U;
break;
case SF_9:
_sf = 0x90U;
break;
case SF_10:
_sf = 0xa0U;
break;
case SF_11:
_sf = 0xb0U;
break;
case SF_12:
_sf = 0xc0U;
break;
}
_cr = 0x08U; // CR_5
/* burst write from RegModemConfig1 */
uint8_t buf[] = {
/* bandwidth (2bit)
* coding rate (3bit)
* implicit header (1bit) (yes)
* crc generation and check (1bit) (no)
* low data rate optimize (1bit) */
_bw | _cr | 0x04U | ( crc ? 0x02U : 0x00U) | (lowDataRateOptimize ? 0x01U : 0x00U),
/* spreading factor (4 bit)
* tx continuous mode (1bit) (never)
* agc auto on (1bit) (yes)
* symbol timeout bits 9:8 */
_sf | 0x00U | 0x04U | (((uint8_t)(timeout >> 8)) & 0x3U),
timeout,
preamble >> 8,
preamble
};
_write(self, RegModemConfig1, buf, sizeof(buf));
/* set LNA here (even if we use autogain) */
writeReg(self, RegLna, 0x60 | 0x00);
}
uint8_t Radio_collect(struct lora_radio *self, void *data, uint8_t max)
{
LORA_PEDANTIC(self != NULL)
LORA_PEDANTIC((data != NULL) || (max == 0U))
return readFIFO(self, data, max);
}
void Radio_interrupt(struct lora_radio *self, uint8_t n, uint64_t time)
{
LORA_PEDANTIC(self != NULL)
if(self->eventHandler != NULL){
switch(n){
case 0U:
switch(self->dio_mapping1){
case 0U:
self->eventHandler(self->eventReceiver, LORA_RADIO_RX_READY, time);
break;
case 1:
self->eventHandler(self->eventReceiver, LORA_RADIO_TX_COMPLETE, time);
break;
default:
/* do nothing */
break;
}
break;
case 1U:
switch(self->dio_mapping1){
case 0U:
self->eventHandler(self->eventReceiver, LORA_RADIO_RX_TIMEOUT, time);
break;
default:
/* do nothing */
break;
}
break;
case 2U:
case 3U:
default:
break;
}
}
}
void Radio_sleep(struct lora_radio *self)
{
writeReg(self, RegOpMode, 0x00U);
}
uint8_t Radio_getRandom(struct lora_radio *self)
{
return readReg(self, RegRssiWideband);
}
/* static functions ***************************************************/
static void setPower(struct lora_radio *self, int dbm)
{
uint8_t outputPower;
bool paSelect;
uint8_t paDac;
#ifdef LORA_RADIO_SX1272_USE_BOOST
paSelect = true;
if(dbm < 5){
outputPower = (uint8_t)( (dbm < 2) ? 0U : (dbm - 2) );
paDac = 0x84U;
}
else{
outputPower = (uint8_t)( (dbm > 20) ? 0xfU : (dbm - 5) );
paDac = 0x87U;
}
#else
paSelect = false;
outputPower = (dbm > 14) ? 0xfU : ( (dbm < -1) ? 0U : (dbm + 1) );
paDac = 0x84U;
#endif
writeReg(self, RegPaDac, paDac);
writeReg(self, RegPaConfig, ( paSelect ? 0x80U : 0x00U ) | outputPower);
}
static void setFreq(struct lora_radio *self, uint32_t freq)
{
/* 32000000 / 2^19 */
uint32_t f = (uint32_t) ( ((double)61.03515625) * ((double)freq) );
uint8_t buf[] = {
(f >> 16),
(f >> 8),
f
};
_write(self, RegFrfMsb, buf, sizeof(buf));
}
static uint8_t readFIFO(struct lora_radio *self, uint8_t *data, uint8_t max)
{
uint8_t size = readReg(self, RegFifoRxCurrentAddr);
size = (size > max) ? max : size;
_read(self, RegFifo, data, size);
return size;
}
static void writeFIFO(struct lora_radio *self, const uint8_t *data, uint8_t len)
{
writeReg(self, RegFifoTxBaseAddr, 0x00U); // set tx base
writeReg(self, RegFifoAddrPtr, 0x00U); // set address pointer
_write(self, RegFifo, data, len);
}
static uint8_t readReg(struct lora_radio *self, uint8_t reg)
{
uint8_t data;
_read(self, reg, &data, sizeof(data));
return data;
}
static void writeReg(struct lora_radio *self, uint8_t reg, uint8_t data)
{
_write(self, reg, &data, sizeof(data));
}
static void _write(struct lora_radio *self, uint8_t reg, const uint8_t *data, uint8_t len)
{
uint8_t i;
if(len > 0U){
self->board.select(self->board.receiver, true);
self->board.write(self->board.receiver, reg | 0x80U);
for(i=0; i < len; i++){
self->board.write(self->board.receiver, data[i]);
}
self->board.select(self->board.receiver, false);
}
}
static void _read(struct lora_radio *self, uint8_t reg, uint8_t *data, uint8_t len)
{
uint8_t i;
if(len > 0U){
self->board.select(self->board.receiver, true);
self->board.write(self->board.receiver, reg & 0x7fU);
for(i=0U; i < len; i++){
data[i] = self->board.read(self->board.receiver);
}
self->board.select(self->board.receiver, false);
}
}
|
1023f93d4506a4f544c23dc8f962c1ac196fb8df | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/freebsd/sys/dev/acpica/extr_acpi_perf.c_acpi_px_available.c | 8e54276ecd28a30c9b5574f5a31c771e4ee946ad | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,509 | c | extr_acpi_perf.c_acpi_px_available.c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct cf_setting {int dummy; } ;
struct acpi_perf_softc {scalar_t__ px_max_avail; scalar_t__ px_curr_state; int /*<<< orphan*/ dev; int /*<<< orphan*/ * px_states; int /*<<< orphan*/ handle; } ;
typedef int /*<<< orphan*/ ACPI_STATUS ;
/* Variables and functions */
scalar_t__ ACPI_SUCCESS (int /*<<< orphan*/ ) ;
scalar_t__ CPUFREQ_VAL_UNKNOWN ;
int /*<<< orphan*/ acpi_GetInteger (int /*<<< orphan*/ ,char*,scalar_t__*) ;
int /*<<< orphan*/ acpi_px_set (int /*<<< orphan*/ ,struct cf_setting*) ;
int /*<<< orphan*/ acpi_px_to_set (int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct cf_setting*) ;
__attribute__((used)) static void
acpi_px_available(struct acpi_perf_softc *sc)
{
ACPI_STATUS status;
struct cf_setting set;
status = acpi_GetInteger(sc->handle, "_PPC", &sc->px_max_avail);
/* If the old state is too high, set current state to the new max. */
if (ACPI_SUCCESS(status)) {
if (sc->px_curr_state != CPUFREQ_VAL_UNKNOWN &&
sc->px_curr_state > sc->px_max_avail) {
acpi_px_to_set(sc->dev,
&sc->px_states[sc->px_max_avail], &set);
acpi_px_set(sc->dev, &set);
}
} else
sc->px_max_avail = 0;
} |
7aea28c0c86319c7b25b6fb8dc533424867c0e3d | 06486020f7d4f8245250e716073e2039cd8ef840 | /Pia-no-dash/project.IOs/Project.IOs/Classes/Native/System_System_Text_RegularExpressions_Syntax_Assertion.h | fecf0ea41a80011dc72eda6410834dc7d3ea8ce1 | [] | no_license | hoangwin/2-ca-rs-tim-berman | df95d958c82cf8b8f4172b2c2d49cd6c294100f4 | 1470153378864b77237196be7f1ca9e2809e8998 | refs/heads/master | 2021-01-09T20:48:17.806165 | 2016-07-07T08:17:52 | 2016-07-07T08:17:52 | 39,478,909 | 3 | 1 | null | null | null | null | UTF-8 | C | false | false | 287 | h | System_System_Text_RegularExpressions_Syntax_Assertion.h | #pragma once
#include <stdint.h>
// System.Text.RegularExpressions.Syntax.CompositeExpression
#include "System_System_Text_RegularExpressions_Syntax_CompositeExpres.h"
// System.Text.RegularExpressions.Syntax.Assertion
struct Assertion_t1300 : public CompositeExpression_t1293
{
};
|
6ab322a3c58942d919c3ef8fc85a6c777cc694e9 | 83326108ecae82854a8d0e9522661ccaa95fa44a | /shell1.c | 7d1dc135d5d42f535cf83f024c346b275ca4bb0f | [] | no_license | Nabagata/OSLab | 85f1aac03f233d9e1c384507720f9bc5dec84629 | 73d7eacf263c1075111626e8def15d7ab1373000 | refs/heads/master | 2021-06-27T14:23:48.346672 | 2020-09-24T17:55:01 | 2020-09-24T17:55:01 | 145,396,876 | 2 | 1 | null | null | null | null | UTF-8 | C | false | false | 1,114 | c | shell1.c | #define _APUE_H
#define _XOPEN_SOURCE 600
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/termios.h>
#ifndef TIOCGWINSZ
#include <sys/ioctl.h>
#endif
/* some systems still require this */
/* for winsize */
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#define MAXLINE 4096
#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
#define DIR_MODE (FILE_MODE | S_IXUSR | S_IXGRP | S_IXOTH) typedef voi$
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
#include <sys/wait.h>
int main(void)
{
char buf[MAXLINE];
pid_t pid;
int status;
printf("%% ");
while (fgets(buf, MAXLINE, stdin) != NULL) {
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = 0;
if ((pid = fork()) < 0) {
printf("fork error");
} else if (pid == 0) { /* child */ execlp(buf, buf, (char *)0); exit(127);
}
if ((pid = waitpid(pid, &status, 0)) < 0)
printf("waitpid error");
printf("%% ");
}
exit(0); }
|
839ad243121be033c36bea787ee12884940408a7 | 303213696ceb3af098c1c88d92cbdb597eef6991 | /ft_ls/padding.c | 35b3cf5625cd4b1f5516b4420e94715ba8cf8c71 | [] | no_license | qdiaz/42_projects | 02efff63e976e081b703ff4a57a357d1b899a34d | 16af33eb5567378b4eb901e49c4b77622a5c5e96 | refs/heads/master | 2020-05-21T12:30:23.495291 | 2018-03-26T15:58:02 | 2018-03-26T15:58:02 | 47,341,296 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,096 | c | padding.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* padding2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qdiaz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/03/14 15:41:29 by qdiaz #+# #+# */
/* Updated: 2016/03/14 15:45:17 by qdiaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ls.h"
static void init_pad(t_pad *pad, t_lst **lst)
{
pad->len_usr = ft_strlen((*lst)->user_id);
pad->len_grp = ft_strlen((*lst)->group_id);
pad->len_lnk = ft_strlen((*lst)->link);
pad->len_siz = ft_strlen((*lst)->size);
pad->len_maj = ft_strlen((*lst)->maj);
pad->len_min = ft_strlen((*lst)->min);
pad->len_majmin = 0;
}
static char *put_s_before(char *str, int max)
{
int i;
int j;
int k;
char *tmp;
i = 0;
j = max - (int)ft_strlen(str);
if (!(tmp = (char *)malloc(sizeof(char) * (ft_strlen(str) + j + 1))))
return (NULL);
if (j > 0)
{
while (i < max)
{
while (i < j)
tmp[i++] = ' ';
k = 0;
while (i < max)
tmp[i++] = str[k++];
i++;
}
tmp[--i] = '\0';
return (tmp);
}
else
return (str);
}
static void apply_padding(t_pad *pad, t_lst **lst)
{
t_lst *tmp;
tmp = *lst;
if (tmp->next)
{
while (tmp)
{
tmp->link = put_s_before(tmp->link, pad->len_lnk);
tmp->user_id = ft_strnjoin(tmp->user_id, " ",
(pad->len_usr - ft_strlen(tmp->user_id)));
tmp->group_id = ft_strnjoin(tmp->group_id, " ",
(pad->len_grp - ft_strlen(tmp->group_id)));
tmp->size = put_s_before(tmp->size, pad->len_siz);
tmp->maj = put_s_before(tmp->maj, pad->len_maj);
tmp->min = put_s_before(tmp->min, pad->len_min);
tmp->majmin = ft_strjoin(tmp->maj, " ");
tmp->majmin = ft_strjoin(tmp->majmin, tmp->min);
tmp = tmp->next;
}
}
}
void padding(t_lst **lst, t_pad *pad)
{
t_lst *tmp;
tmp = *lst;
init_pad(pad, lst);
while (tmp->next)
{
if (pad->len_usr < ft_strlen(tmp->next->user_id))
pad->len_usr = ft_strlen(tmp->next->user_id);
if (pad->len_grp < ft_strlen(tmp->next->group_id))
pad->len_grp = ft_strlen(tmp->next->group_id);
if (pad->len_lnk < ft_strlen(tmp->next->link))
pad->len_lnk = ft_strlen(tmp->next->link);
if (pad->len_siz < ft_strlen(tmp->next->size))
pad->len_siz = ft_strlen(tmp->next->size);
if (pad->len_maj < ft_strlen(tmp->next->maj))
pad->len_maj = ft_strlen(tmp->next->maj);
if (pad->len_min < ft_strlen(tmp->next->min))
pad->len_min = ft_strlen(tmp->next->min);
tmp = tmp->next;
}
pad->len_majmin = pad->len_maj + pad->len_min;
apply_padding(pad, lst);
}
|
6b9e81e9b004ccc64e7ff0f295ac3865bd805d65 | 932530f9e39384f26b77b64a28f62f861d46cc26 | /CODE/C/day12/04hong.c | a860c62b87338ebc94c69d17856972ef233e1b77 | [] | no_license | LuuuuuG/TarenaNotes | 9a8f5ea6a1b50bbe6fbc00ebf3d427f8982001c0 | 5ba29fea27472a2368e7d888897437b066e1429f | refs/heads/master | 2021-01-20T02:42:05.559101 | 2017-04-26T05:48:37 | 2017-04-26T05:48:37 | 89,442,222 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 197 | c | 04hong.c | #include <stdio.h>
#define SUB(a,b) ((a) - (b))
int main(){
printf("result is %d\n",SUB(10,7));
printf("result is %d\n",20 - SUB(10,7));
printf("result is %d\n",SUB(20,10 - 7));
return 0;
}
|
dbd50b85a96e1e7caa51c936da3ae4c4b5313d65 | 0ae7d27cde324518c52d74d459cde764cdb416d2 | /SOURCES/rtclk.h | 6bbf2a0aeca4416c2dac016034ca04f1cd6c196c | [
"MIT"
] | permissive | PhylumChordata/RTM-Z80 | 343fd7cff64a258b73e8773199556e83b1133686 | 13ea9667f020cdc69e6e8d18b7588e5d9f4513e5 | refs/heads/main | 2023-07-30T02:35:27.492836 | 2021-09-22T10:40:45 | 2021-09-22T10:40:45 | 396,076,162 | 0 | 0 | null | 2021-08-14T17:14:41 | 2021-08-14T17:14:40 | null | UTF-8 | C | false | false | 445 | h | rtclk.h | struct RTClkCB {
struct ListElement link;
short Counter;
struct Semaphore* pSem;
short CounterCopy; /* 0 = no repeat */
};
short GetTimerSts(void* Timer);
void* MakeTimer(void);
void* StartTimer(struct RTClkCB* Timer, struct Semaphore* pSem, short Ticks, char Repeat);
short DropTimer(struct RTClkCB* Timer);
short StopTimer(struct RTClkCB* Timer);
long GetTicks(void);
void RoundRobinON(void);
void RoundRobinOFF(void);
|
8d37ae18dc0848e3df2eb64b8a570df0328d55c0 | 665eac2bfd0d2f1d559f485375f89e8a91632c6e | /VOL_300/344_02/VMKS.C | 54242f769ad8e999833fa34f6ae1f6c513cfd512 | [] | no_license | kubohisa/CUGL | 615c29732e5fc2c6bcb29a4013be3351dc21dda6 | 75fc7cb2f8c5f3869a091b2b5c50c09323bc1c03 | refs/heads/main | 2023-03-15T16:19:49.355867 | 2020-10-02T21:19:00 | 2020-10-02T21:19:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,291 | c | VMKS.C | /*
HEADER: ;
TITLE: BASIC mks() function in C
VERSION: 1.0;
DESCRIPTION: performs BASIC mks() function, packing a value into
a string of 4 chars
KEYWORDS: packed, single precision, BASIC, mks;
SYSTEM: Xenix 3.4b, MSDOS;
FILENAME: vmks.c
WARNINGS: compile with -dNO_PROTOTYPE if your system does not
support prototyping, with -dFOR_MSDOS if you are compiling
for MSDOS with an ANSI standard compiler.
Defaults assume compiling with prototypes for
Xenix 3.4b on Altos 2086 computer.
SEE-ALSO: ;
AUTHORS: Vern Martin, 449 W. Harrison, Alliance, Ohio 44601;
COMPILERS: ECOSOFT ECO-C88, XENIX 3.4B STANDARD COMPILER;
*/
#include "vernmath.h"
#define WIDTH 4
char *vmks(amt)
double amt;
{
/* local int */
int e; /* exponent */
double mantissa = frexp(amt,&e);
int i,sign = 1;
static unsigned char c[WIDTH];
static double k[ WIDTH - 1 ] = {
1.1920928955078125e-07,
3.0517578125000000e-05,
7.8125000000000000e-03,
};
/* make mantissa a positive number if necessary */
if (mantissa < 0.0) {
sign = -1;
mantissa *= (double) sign;
}
/* adjust result by multiplying mantissa by 2 until mantissa is greater than 1,
each time you multiply the mantissa by 2, subtract 1 from
the power you raise two by, in this way we duplicate the values
returned by BASIC's mkd() which returns 1.x * 2^e, where as
frexp() returns .x * 2^e */
while(mantissa < 1.0) {
mantissa *= 2.0;
e--;
}
c[ WIDTH - 1 ] = (unsigned char) (e + 129);
/* total first 3 chars multiplied by there respective factors */
for ( i = WIDTH - 2; i >= 0;i-- ) {
if (mantissa < k[ i ]) c[ i ] = (unsigned char) 0;
else {
c[ i ] = (unsigned char) (mantissa/k[ i ]);
mantissa -= c[ i ] * k[ i ];
}
}
/* unless the number is negative, reverse next to last char */
if (sign != -1) {
c[ WIDTH - 2 ] -= (unsigned char) 128;
}
if (amt == 0.0) c[ WIDTH - 1 ] = (unsigned char) 0;
return((char *)c);
}
|
487ff72d4fbad82a7ec18eab71ec43c4e1cb26b2 | 032122f0a1848d48cfd16dd94357bf92eaf4af23 | /leetcode/872_leaf-similar_trees.h | 3f0844cd89d5779cf7c6323a2385de1953e0e821 | [] | no_license | runningrunning/wasteland | 380510a0074b19bcd281ad3711cf43cbd30a5070 | f25148816cfe3ae0709e795be2a69e55630975f2 | refs/heads/master | 2023-03-11T03:01:13.794859 | 2021-02-26T08:50:11 | 2021-02-26T08:50:11 | 184,945,993 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 761 | h | 872_leaf-similar_trees.h | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
bool ls(struct TreeNode* r, int* m, int* i, int mi)
{
if (!r->left && !r->right)
{
if (!mi)
m[*i] = r->val;
else if (r->val != m[*i])
return false;
(*i) ++;
}
if (r->left && !ls(r->left, m, i, mi))
return false;
if (r->right && !ls(r->right, m, i, mi))
return false;
return true;
}
bool leafSimilar(struct TreeNode* root1, struct TreeNode* root2)
{
if (!root1 || !root2)
return root1 == root2;
int i = 0;
int mi = 0;
int m[256];
ls(root1, m, &mi, mi);
return ls(root2, m, &i, mi);
}
|
eb7e14212b12b69a1bed4d6ec36e364c08a46e74 | 376040d6ce67354c783d61edeb14c1d7059ed0b4 | /test/python/Avro/dump_pairs.c | b0096b3f38c28a814324bea6df3cb7ab0f42dff3 | [] | no_license | panluo/learn | 8140af4b274ce858637d6b82dc6558957e4a2ba6 | ca03fc00a34d7603909dd80a90e7d72290374485 | refs/heads/master | 2021-01-25T04:58:00.503329 | 2015-03-20T08:28:15 | 2015-03-20T08:28:15 | 23,575,530 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 915 | c | dump_pairs.c | #include </include/avro.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]){
if(argc != 2) {
fprintf(stderr,"Usage : dump_pairs <data_file>\n");
exit(EXIT_FAILURE);
}
const char *avrofile = argv[1];
avro_file_reader_t filereader;
avro_schema_error_t error;
avro_datum_t pair;
avro_datum_t left;
avro_datum_t right;
int rval;
char *p;
avro_file_reader(avrofile,&filereader);
while(1){
rval = avro_file_reader_read(filereader,NULL,&pair);
if(rval)
break;
if(avro_record_get(pair,"left",&left) == 0){
avro_string_get(left,&p);
fprintf(stdout,"%s,",p);
}
if(avro_record_get(pair,"right",&left) == 0){
avro_string_get(right,&p);
fprintf(stdout,"%s\n",p);
}
}
avro_file_reader_close(filereader);
return 0;
}
|
d055c94b378b34ec893e7e71574ff31c0b003c55 | 777a75e6ed0934c193aece9de4421f8d8db01aac | /src/Providers/UNIXProviders/SoftwareFeatureSAPImplementation/UNIX_SoftwareFeatureSAPImplementationDeps.h | 378fb7bd427ca97b78836bce114235a33f5a7df8 | [
"MIT"
] | permissive | brunolauze/openpegasus-providers-old | 20fc13958016e35dc4d87f93d1999db0eae9010a | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | refs/heads/master | 2021-01-01T20:05:44.559362 | 2014-04-30T17:50:06 | 2014-04-30T17:50:06 | 19,132,738 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 915 | h | UNIX_SoftwareFeatureSAPImplementationDeps.h |
#if defined(PEGASUS_OS_HPUX)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_HPUX.h"
#elif defined(PEGASUS_OS_LINUX)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_LINUX.h"
#elif defined(PEGASUS_OS_DARWIN)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_DARWIN.h"
#elif defined(PEGASUS_OS_AIX)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_AIX.h"
#elif defined(PEGASUS_OS_FREEBSD)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_FREEBSD.h"
#elif defined(PEGASUS_OS_SOLARIS)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_SOLARIS.h"
#elif defined(PEGASUS_OS_ZOS)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_ZOS.h"
#elif defined(PEGASUS_OS_VMS)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_VMS.h"
#elif defined(PEGASUS_OS_TRU64)
# include "UNIX_SoftwareFeatureSAPImplementationDeps_TRU64.h"
#else
# include "UNIX_SoftwareFeatureSAPImplementationDeps_STUB.h"
#endif
|
72c2c6f6c22632623c105566a35a745209390f76 | b73012896cef6719c7a5851784c4224ada55a4b2 | /main.c | 61e1ec77b1fc4dd2fb21032b4e8604c2251e2c25 | [] | no_license | NovaDesignedIt/Linked-Lists-C | 33dca1ba4fe72c55987691d59a8da0bcffa6b190 | 4082416cff0d031fdc3701bc2ad37bd87dde01a0 | refs/heads/master | 2022-12-06T12:29:34.438948 | 2020-08-13T16:07:58 | 2020-08-13T16:07:58 | 287,324,473 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,020 | c | main.c |
/*
* Title: Assignment 2 - Student Registration System
* w/ Linked List, Ansi-sytle
* Course: CST8234 - C Language
* Term: Summer 2020
*
* Team:
* Student #1: <<< Meech Lamirande lami0039 >>>
* Student #2: <<< Mohit Nargotra narg0001 >>>
* Status:
* Requirement #1: {complete}
* Requirement #2: {complete}
* Requirement #3: {complete}
* Requirement #4: {complete}
* Requirement #5: {complete}
* Requirement #6: {complete}
* Requirement #7: {complete}
* Requirement #8: {complete}
* Requirement #9: {complete}
* Requirement #10: {complete}
* Requirement #11: {complete}
*/
#include "Node.h"
#include <stdio.h>
#include <stdlib.h>
node_t *head;
int main() {
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
head = NULL;
//setting the head element
head = (node_t *) malloc(sizeof(node_t));
student_t *student = (student_t *) malloc(40 * sizeof(char *));
if (head == NULL) {
printf("couldn't not assigne memory");
exit(1);
}
printf("\nFirst you will enter 3 student names that will be added to the start of the list\n");
int i;
for (i = 0; i < 3; i++) {
addToStart(&head, student);
}
printList(head);// printlists
printf("\nnow you will enter 3 names that will be added to the end of the list.\n");
for (i = 0; i < 3; i++) {
addToEnd(&head, student);
}
printList(head);// printlists
printf("\nnow you will remove the first 3 in the list \n");
removeFromStart(&head);
removeFromStart(&head);
removeFromStart(&head);
printList(head);// printlists
printf("\nnow you will remove the remaining 3 students");
removeLast(&head);
removeLast(&head);
removeLast(&head);
printf("\nby now your list should be empty!\n");
printList(head);// printlists
printf("\n\n ...\n");
for (i = 0; i < 3; i++) {addToEnd(&head, student);}
printList(head);// printlists
printf("\n now you will remove the second element in the list\n\n");
removeByIndex(&head, 1);
printList(head);
//printf("hook");-for debug
free(head);
free(student);
return 0;
}
//********************* [ CODE GRAVEYARD ] *******************************//
//adding the first node
// node_t * temp = malloc(sizeof(node_t));
// temp = NULL;
// temp->next=head->next;
//part2
/*
i=1;
//allocated the memory for
while(i!=4) {
head->student = (student_t *) malloc(40 * sizeof(char *));
head->student->FirstName = (char *) malloc(20 * sizeof(char *));
head->student->LastName = (char *) malloc(20 * sizeof(char *));
char *firstname = malloc(20 * sizeof(char *));
char *lastname = malloc(20 * sizeof(char *));
int check;
check = 1;
while (check) {
printf("Enter student first name %d:", i);
scanf("%s", firstname);
if (strlen(firstname) < 21) {
check = 0;
} else {
printf("name to long\n");
}
}
check = 1;
while (check) {
printf("Enter student last name %d:", i);
scanf("%s", lastname);
if (strlen(lastname) < 21) {
check = 0;
} else {
printf("name too long\n");
}
}
strcpy(head->student->FirstName, firstname);
strcpy(head->student->LastName, lastname);
//add to the end of the list
addToEnd(&head->next,head->student);
i++;
free(firstname);
free(lastname);
}
*/
//old method main
// printf("the size of a student %d",sizeof(struct student_t));
// int i;
// for(i=0; i<max-1;i++){
// node[i].next = &node[i+1];
// }
// node[max-1].next = NULL;
// //Set buffers
// setvbuf(stdout, NULL, _IONBF,0);
// setvbuf(stderr, NULL, _IONBF,0);
// //head node is null
// head =NULL;
//
// //prompt
// printf("please enter the first 3 students\n\n");
//
//
// //allocating space for the structures
// node_t * ptr_node = malloc(9*sizeof(node_t));
// //if the pointer returns null the mem
// if(ptr_node == NULL){
// printf("cannot allocate memory\n");
// }else {
//
// //adding the students to the nodes
// add_node(ptr_node);
//
// //printing the students
// int i = 0;
// for (i = 0; i < 3; i++) {
// printf("student full name: %s %s\n", ptr_node[i].student->FirstName, ptr_node[i].student->LastName);
// }
//
// //freeing allocated memory
// for (i = 0; i < 3; i++) {
// free(ptr_node[i].student);
// }
// free(ptr_node);
// }
//
// hollup
//
// node_t * NewNo = (node_t*) malloc(sizeof(head));
// //allocating memory for the student pointer
// NewNo->student = student;
// //FirstName = (char *)malloc(sizeof(char*)*21);
// //NewNo->student->LastName =(char *)malloc(sizeof(char*)*21);
// NewNo->next=*head;
// *head=NewNo;
|
1492efafcf7ca5c57f03872eb7da42e7e8d7e796 | eca0874d4d9b8770067ff5193b49b7f5f0db501e | /solo-projects/bburnley/tutorials/shell/srcs/main.c | e8bb86fb7c24f71d67289b515d5a68d3c7179bf5 | [] | no_license | 42rejects/c-sync-swim-december | 88fc11077d87c7754512520f8e29dab037e0156a | 568c44b6efe935764310baa7d7d30008a268f875 | refs/heads/master | 2020-06-12T12:02:15.875515 | 2016-12-15T20:03:14 | 2016-12-15T20:03:14 | 75,581,110 | 0 | 1 | null | 2016-12-17T05:17:50 | 2016-12-05T02:29:00 | C | UTF-8 | C | false | false | 421 | c | main.c | /*#############################################################################
# Name: main.c
# Created: 12-06-2016 16:54:15
# Edited: 12-07-2016 11:07:29
# Creator: Brian Burnley
# Editor: Brian Burnley
##############################################################################*/
#include "shell.h"
int main(int argc, char **argv)
{
sh_loop();
(void)argc;
(void)argv;
return (EXIT_SUCCESS);
}
|
7a602ad4a68377ada45e4a0d3a8e4c4a9a6b8db7 | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/fastsocket/kernel/drivers/input/mouse/extr_trackpoint.c_trackpoint_sync.c | 13d081b09915067cc85b07cc4792e5a386019d9f | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,980 | c | extr_trackpoint.c_trackpoint_sync.c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct trackpoint_data {int press_to_select; int skipback; int ext_dev; int /*<<< orphan*/ jenks; int /*<<< orphan*/ ztime; int /*<<< orphan*/ upthresh; int /*<<< orphan*/ thresh; int /*<<< orphan*/ mindrag; int /*<<< orphan*/ draghys; int /*<<< orphan*/ reach; int /*<<< orphan*/ speed; int /*<<< orphan*/ inertia; int /*<<< orphan*/ sensitivity; } ;
struct psmouse {int /*<<< orphan*/ ps2dev; struct trackpoint_data* private; } ;
/* Variables and functions */
int /*<<< orphan*/ TP_DRAGHYS ;
int /*<<< orphan*/ TP_INERTIA ;
int /*<<< orphan*/ TP_JENKS_CURV ;
unsigned char TP_MASK_EXT_DEV ;
unsigned char TP_MASK_MB ;
unsigned char TP_MASK_PTSON ;
unsigned char TP_MASK_SKIPBACK ;
unsigned char TP_MASK_SOURCE_TAG ;
unsigned char TP_MASK_TWOHAND ;
int /*<<< orphan*/ TP_MINDRAG ;
int /*<<< orphan*/ TP_REACH ;
int /*<<< orphan*/ TP_SENS ;
int /*<<< orphan*/ TP_SPEED ;
int /*<<< orphan*/ TP_THRESH ;
int /*<<< orphan*/ TP_TOGGLE_EXT_DEV ;
int /*<<< orphan*/ TP_TOGGLE_MB ;
int /*<<< orphan*/ TP_TOGGLE_PTSON ;
int /*<<< orphan*/ TP_TOGGLE_SKIPBACK ;
int /*<<< orphan*/ TP_TOGGLE_SOURCE_TAG ;
int /*<<< orphan*/ TP_TOGGLE_TWOHAND ;
int /*<<< orphan*/ TP_UP_THRESH ;
int /*<<< orphan*/ TP_Z_TIME ;
int /*<<< orphan*/ trackpoint_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char*) ;
int /*<<< orphan*/ trackpoint_toggle_bit (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char) ;
int /*<<< orphan*/ trackpoint_write (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static int trackpoint_sync(struct psmouse *psmouse)
{
struct trackpoint_data *tp = psmouse->private;
unsigned char toggle;
/* Disable features that may make device unusable with this driver */
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, &toggle);
if (toggle & TP_MASK_TWOHAND)
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_TWOHAND, TP_MASK_TWOHAND);
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, &toggle);
if (toggle & TP_MASK_SOURCE_TAG)
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SOURCE_TAG, TP_MASK_SOURCE_TAG);
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_MB, &toggle);
if (toggle & TP_MASK_MB)
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_MB, TP_MASK_MB);
/* Push the config to the device */
trackpoint_write(&psmouse->ps2dev, TP_SENS, tp->sensitivity);
trackpoint_write(&psmouse->ps2dev, TP_INERTIA, tp->inertia);
trackpoint_write(&psmouse->ps2dev, TP_SPEED, tp->speed);
trackpoint_write(&psmouse->ps2dev, TP_REACH, tp->reach);
trackpoint_write(&psmouse->ps2dev, TP_DRAGHYS, tp->draghys);
trackpoint_write(&psmouse->ps2dev, TP_MINDRAG, tp->mindrag);
trackpoint_write(&psmouse->ps2dev, TP_THRESH, tp->thresh);
trackpoint_write(&psmouse->ps2dev, TP_UP_THRESH, tp->upthresh);
trackpoint_write(&psmouse->ps2dev, TP_Z_TIME, tp->ztime);
trackpoint_write(&psmouse->ps2dev, TP_JENKS_CURV, tp->jenks);
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_PTSON, &toggle);
if (((toggle & TP_MASK_PTSON) == TP_MASK_PTSON) != tp->press_to_select)
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_PTSON, TP_MASK_PTSON);
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, &toggle);
if (((toggle & TP_MASK_SKIPBACK) == TP_MASK_SKIPBACK) != tp->skipback)
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_SKIPBACK, TP_MASK_SKIPBACK);
trackpoint_read(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, &toggle);
if (((toggle & TP_MASK_EXT_DEV) == TP_MASK_EXT_DEV) != tp->ext_dev)
trackpoint_toggle_bit(&psmouse->ps2dev, TP_TOGGLE_EXT_DEV, TP_MASK_EXT_DEV);
return 0;
} |
654e75700b7be5c54c7407340e4b65fed750a074 | d621349afae0561652ac2851b34b197fbba5f275 | /src/go_fdw.c | e75f16f8112449413e3b530a65dca5a84395d015 | [
"MIT"
] | permissive | jangwonpark74/k8s-fdw | e839528365ec6e7d446b1e6b47bf676bb1066b28 | be8b6d031740245d0b616516467e302262385c4e | refs/heads/master | 2020-04-14T04:10:48.463463 | 2018-12-01T04:56:23 | 2018-12-01T04:56:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,159 | c | go_fdw.c | /*-------------------------------------------------------------------------
*
* go_fdw.c
* HelloWorld of foreign-data wrapper.
*
* written by Wataru Ikarashi <[email protected]>
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "utils/elog.h"
#include "utils/builtins.h"
#include "utils/jsonb.h"
#include "fmgr.h"
#include "commands/defrem.h"
#include <sys/stat.h>
#include <unistd.h>
#include <inttypes.h>
#include "lib/fdw/go_fdw.h"
PG_MODULE_MAGIC;
extern Datum go_fdw_handler(PG_FUNCTION_ARGS);
extern Datum go_fdw_validator(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(go_fdw_handler);
PG_FUNCTION_INFO_V1(go_fdw_validator);
/*
* FDW callback routines
*/
static ForeignScan *goGetForeignPlan(PlannerInfo *root,
RelOptInfo *baserel,
Oid foreigntableid,
ForeignPath *best_path,
List *tlist,
List *scan_clauses,
Plan *outer_plan);
//static TupleTableSlot *goIterateForeignScan(ForeignScanState *node);
static Datum goCStringGetDatum(const char *str);
static Datum goJSONGetDatum(const char *str);
static Datum goNumericGetDatum(int64_t num);
static void saveTuple(Datum *data, bool *isnull, ScanState *state);
static void goEReport(const char *msg);
Datum
go_fdw_handler(PG_FUNCTION_ARGS)
{
GoFdwFunctions h;
FdwRoutine *fdwroutine = makeNode(FdwRoutine);
fdwroutine->GetForeignRelSize = goGetForeignRelSize;
fdwroutine->GetForeignPaths = goGetForeignPaths;
fdwroutine->GetForeignPlan = goGetForeignPlan;
fdwroutine->ExplainForeignScan = goExplainForeignScan;
fdwroutine->BeginForeignScan = goBeginForeignScan;
fdwroutine->IterateForeignScan = goIterateForeignScan;
fdwroutine->ReScanForeignScan = goReScanForeignScan;
fdwroutine->EndForeignScan = goEndForeignScan;
fdwroutine->AnalyzeForeignTable = goAnalyzeForeignTable;
h.ExplainPropertyText = &ExplainPropertyText;
h.create_foreignscan_path = &create_foreignscan_path;
h.add_path = &add_path;
h.ExecClearTuple = &ExecClearTuple;
h.saveTuple = &saveTuple;
h.GetForeignTable = &GetForeignTable;
h.GetForeignServer = &GetForeignServer;
h.GetForeignColumnOptions = &GetForeignColumnOptions;
h.CStringGetDatum = &goCStringGetDatum;
h.JSONGetDatum = &goJSONGetDatum;
h.NumericGetDatum = &goNumericGetDatum;
h.defGetString = &defGetString;
h.EReport = &goEReport;
goMapFuncs(h);
PG_RETURN_POINTER(fdwroutine);
}
Datum
go_fdw_validator(PG_FUNCTION_ARGS)
{
/* no-op */
PG_RETURN_VOID();
}
/*
* goGetForeignPlan
* Create a ForeignScan plan node for scanning the foreign table
*/
static ForeignScan *
goGetForeignPlan(PlannerInfo *root,
RelOptInfo *baserel,
Oid foreigntableid,
ForeignPath *best_path,
List *tlist,
List *scan_clauses,
Plan *outer_plan)
{
scan_clauses = extract_actual_clauses(scan_clauses, false);
return make_foreignscan(tlist,
scan_clauses,
baserel->relid,
NIL,
best_path->fdw_private,
NIL, /* no custom tlist */
NIL, /* no remote quals */
outer_plan);
}
static void goEReport(const char *msg) {
ereport(ERROR, (errcode(ERRCODE_FDW_ERROR), errmsg("%s", msg)));
}
static Datum goCStringGetDatum(const char *str) {
PG_RETURN_TEXT_P(CStringGetTextDatum(str));
}
static Datum goJSONGetDatum(const char *str) {
PG_RETURN_JSONB(DirectFunctionCall1(jsonb_in, CStringGetDatum(str)));
}
static Datum goNumericGetDatum(int64_t num) {
PG_RETURN_INT64(Int64GetDatum(num));
}
static void saveTuple(Datum *data, bool *isnull, ScanState *state) {
HeapTuple tuple = heap_form_tuple(state->ss_currentRelation->rd_att, data, isnull);
ExecStoreTuple(tuple, state->ss_ScanTupleSlot, InvalidBuffer, false);
}
|
68d454ee8080235f9214b50d46aee137e4775ebc | 00696f38e834fb0af02ca9476f056799eb892787 | /Src/main.c | a2f962240f37e0671113bb4a49b9a0d91f9d884e | [] | no_license | phckopper/FlyingMachine | 54db8996e4f69c5b161ee1a8a7b191173b9c5b8c | 493328eff62f6a40cc041d52d5388e605d7cbbf9 | refs/heads/master | 2021-04-27T00:19:44.022328 | 2018-03-11T03:56:13 | 2018-03-11T03:56:13 | 123,794,630 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 14,391 | c | main.c | /**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
** This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.
*
* COPYRIGHT(c) 2018 STMicroelectronics
*
* 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 STMicroelectronics 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 HOLDER 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.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_hal.h"
#include "dma.h"
#include "i2c.h"
#include "spi.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
/* USER CODE BEGIN Includes */
#include <string.h>
#include <math.h>
#include "vl53l0x.h"
#include "MPU9250.h"
#include "PMW3901.h"
#include "mavlink/standard/mavlink.h"
#include "mavlink/mavlink_helpers.h"
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE END PFP */
/* USER CODE BEGIN 0 */
volatile float r_x = 0, r_y = 0, r_z = 0;
float pos_x = 0, pos_y = 0, pos_z = 0;
int16_t distance_front = 0, altitude = 0;
/*
* RC Commands
*/
int16_t roll = 0, pitch = 0, yaw = 0, throttle = 0;
_Bool enabled = false;
/* USER CODE END 0 */
/**
* @brief The application entry point.
*
* @retval None
*/
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART1_UART_Init();
MX_SPI1_Init();
MX_USART2_UART_Init();
MX_TIM1_Init();
MX_I2C2_Init();
MX_TIM4_Init();
MX_SPI2_Init();
MX_TIM3_Init();
/* USER CODE BEGIN 2 */
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_4);
/*
uint8_t bla[] = "started...\r\n";
HAL_UART_Transmit(&huart1, bla, strlen(bla), 0xff);
HAL_Delay(1000);
char cmd1[] = "+++\r";
char response1[2] = {0};
HAL_UART_Transmit(&huart2, cmd1, strlen(cmd1), 0xff);
HAL_UART_Receive(&huart2, response1, sizeof(response1), 0xff);
HAL_UART_Transmit(&huart1, response1, strlen(response1), 0xff);
HAL_Delay(1000);
char cmd2[] = "ATS24=1\r";
char response2[255] = {0};
HAL_UART_Transmit(&huart2, cmd2, strlen(cmd2), 0xff);
HAL_UART_Receive(&huart2, response2, sizeof(response2), 0xff);
HAL_UART_Transmit(&huart1, response2, strlen(response2), 0xff);
HAL_Delay(1000);
char cmd5[] = "AT/C\r";
char response5[255] = {0};
HAL_UART_Transmit(&huart2, cmd5, strlen(cmd5), 0xff);
HAL_UART_Receive(&huart2, response5, sizeof(response5), 0xff);
HAL_UART_Transmit(&huart1, response5, strlen(response5), 0xff);
HAL_Delay(1000);
char cmd4[] = "AT/S\r";
char response4[1024] = {0};
HAL_UART_Transmit(&huart2, cmd4, strlen(cmd4), 0xff);
HAL_UART_Receive(&huart2, response4, sizeof(response4), 0xff);
HAL_UART_Transmit(&huart1, response4, strlen(response4), 0xff);
HAL_Delay(1000);
char cmd3[] = "ATO\r";
char response3[255] = {0};
HAL_UART_Transmit(&huart2, cmd3, strlen(cmd3), 0xff);
HAL_UART_Receive(&huart2, response3, sizeof(response3), 0xff);
HAL_UART_Transmit(&huart1, response3, strlen(response3), 0xff);
uint8_t bla2[] = "finished.\r\n";
HAL_UART_Transmit(&huart1, bla2, strlen(bla2), 0xff);*/
/*
HAL_Delay(1000);
while(1) {
char buffer[64] = {0};
for(uint8_t i = 0; i < 64; i++) {
memset(buffer, '.', i);
uint8_t d = sprintf(buffer, "%d", i);
buffer[i - 2] = '\r';
buffer[i - 1] = '\n';
HAL_UART_Transmit(&huart2, buffer, i, 0xff);
HAL_Delay(20);
}
}*/
HAL_Delay(5000);
if (PMW3901_Init() == PMW_BROKEN_CONNECTION) {
while (1) {
HAL_GPIO_TogglePin(STATUS_GPIO_Port, STATUS_Pin);
HAL_Delay(2000);
}
}
distance_sensors_init();
MPU9250_Init();
MPU9250_ReadDataDMA();
start_mavlink();
/*
* Define PID banks
*/
rate_pitch_PID.KP = 1.0f;
rate_roll_PID.KP = 1.0f;
rate_yaw_PID.KP = 2.0f;
//rate_pitch_PID.KI = 0.25f;
//rate_roll_PID.KI = 0.25f;
//rate_pitch_PID.KD = 0.25f;
//rate_roll_PID.KD = 0.25f;
angle_pitch_PID.KP = 3.0f;
angle_roll_PID.KP = 3.0f;
angle_pitch_PID.KI = 0.005f;
angle_roll_PID.KI = 0.005f;
uint32_t last_heartbeat = 0;
uint32_t last_sensors_update = 0;
uint32_t last_telemetry_update = 0;
uint32_t last_distance_update = 0;
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_4);
HAL_TIM_IC_Start_IT(&htim3, TIM_CHANNEL_4);
HAL_Delay(500);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1) {
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if (HAL_GetTick() - last_heartbeat > 1000 && __HAL_UART_GET_FLAG(&huart2, UART_FLAG_IDLE)) {
uint8_t buffer[64] = {0};
mavlink_message_t msg;
mavlink_msg_heartbeat_pack(1, 100, &msg, MAV_TYPE_QUADROTOR,
MAV_AUTOPILOT_GENERIC, MAV_MODE_FLAG_SAFETY_ARMED, 0,
MAV_STATE_STANDBY);
uint8_t len = mavlink_msg_to_send_buffer(buffer, &msg);
HAL_UART_Transmit(&huart2, buffer, len, 0xff);
last_heartbeat = HAL_GetTick();
}
if (HAL_GetTick() - last_telemetry_update > 100) {
uint8_t buffer[64] = {0};
mavlink_message_t msg;
mavlink_msg_vision_position_estimate_pack(1, 100, &msg,
HAL_GetTick(), pos_x, pos_y, altitude, r_y, r_x, r_z);
uint16_t len = mavlink_msg_to_send_buffer(buffer, &msg);
HAL_UART_Transmit(&huart2, buffer, len, 0xff);
last_telemetry_update = HAL_GetTick();
}
if(HAL_GetTick() - last_distance_update > 100 && __HAL_UART_GET_FLAG(&huart2, UART_FLAG_IDLE)) {
uint8_t buffer[64] = {0};
mavlink_message_t msg;
mavlink_msg_distance_sensor_pack(1, 100, &msg, HAL_GetTick(), 30,
1500, distance_front, MAV_DISTANCE_SENSOR_LASER, 0,
MAV_SENSOR_ROTATION_NONE, 0);
uint16_t len = mavlink_msg_to_send_buffer(buffer, &msg);
HAL_UART_Transmit(&huart2, buffer, len, 0xff);
last_distance_update = HAL_GetTick();
}
if (HAL_GetTick() - last_sensors_update > 10) {
int16_t deltaX, deltaY;
//uint32_t dt = HAL_GetTick() - last_sensors_update;
if (PMW_OK == PMW3901_Read_Motion(&deltaX, &deltaY)) {
pos_x += deltaX;
pos_y += deltaY;
}
distance_front = read_front();
altitude = read_height();
last_sensors_update = HAL_GetTick();
}
}
/* USER CODE END 3 */
}
/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
/* USER CODE BEGIN 4 */
float update_pid(PID *m_pid, float setpoint, float measurement) {
float error = setpoint - measurement;
float P = error * m_pid->KP;
m_pid->_I += error;
float I = m_pid->_I * m_pid->KI;
if (m_pid->_I > m_pid->I_MAX)
m_pid->_I = m_pid->I_MAX;
if (m_pid->_I < -(m_pid->I_MAX))
m_pid->_I = -(m_pid->I_MAX);
float D = (error - m_pid->_D) * m_pid->KD;
m_pid->_D = error;
return P + I + D;
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM4) {
DBG_A_GPIO_Port->ODR |= DBG_A_Pin;
// runs every ARR (5000) microseconds
float ay = atan2(MPU9250.acc.x,
sqrt(pow(MPU9250.acc.y, 2) + pow(MPU9250.acc.z, 2)))
* 180/ M_PI;
float ax = atan2(MPU9250.acc.y,
sqrt(pow(MPU9250.acc.x, 2) + pow(MPU9250.acc.z, 2)))
* 180/ M_PI;
// angles based on gyro (deg/s)
r_x = r_x + MPU9250.gyro.x / 200.0f;
r_y = r_y - MPU9250.gyro.y / 200.0f;
r_z = r_z + MPU9250.gyro.z / 200.0f;
// complementary filter
// tau = DT*(A)/(1-A)
// = 0.48sec
r_x = r_x * 0.9f + ax * 0.1f;
r_y = r_y * 0.9f + ay * 0.1f;
float a_error_pitch = update_pid(&angle_pitch_PID, pitch, r_x);
float a_error_roll = update_pid(&angle_roll_PID, roll, -r_y);
float error_pitch = update_pid(&rate_pitch_PID, a_error_pitch, MPU9250.gyro.x);
float error_roll = update_pid(&rate_roll_PID, a_error_roll, MPU9250.gyro.y);
float error_yaw = update_pid(&rate_yaw_PID, yaw, MPU9250.gyro.z);
float m1_out = throttle - error_pitch - error_roll + error_yaw;
float m2_out = throttle - error_pitch + error_roll - error_yaw;
float m3_out = throttle + error_pitch + error_roll + error_yaw;
float m4_out = throttle + error_pitch - error_roll - error_yaw;
m1_out = constrain(m1_out, 0, htim1.Instance->ARR);
m2_out = constrain(m2_out, 0, htim1.Instance->ARR);
m3_out = constrain(m3_out, 0, htim1.Instance->ARR);
m4_out = constrain(m4_out, 0, htim1.Instance->ARR);
if(enabled) {
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, m1_out);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2, m2_out);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3, m3_out);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4, m4_out);
} else {
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, 0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_2, 0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_3, 0);
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_4, 0);
}
DBG_A_GPIO_Port->ODR &= ~DBG_A_Pin;
}
}
/* USER CODE END 4 */
/**
* @brief This function is executed in case of error occurrence.
* @param file: The file name as string.
* @param line: The line in file as a number.
* @retval None
*/
void _Error_Handler(char *file, int line)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
while (1) {
}
/* USER CODE END Error_Handler_Debug */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
30309b709c764a7d88cf6cd0db97e679f8c732e7 | 1af179e1c8b3892e17a357a0d607d2b7a813f79f | /mod3/task1.c | c79a12d3a5dc1e509e662e614f218e832a5fb203 | [] | no_license | seanduback/cs2250Sp18 | 36ecad66e79b906fc36aae9aa721f0bbecc851b3 | 1cdbeedf53b30cd6e01c257304555018a773ddde | refs/heads/master | 2021-05-09T19:17:38.404782 | 2018-04-19T10:07:49 | 2018-04-19T10:07:49 | 118,635,730 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,063 | c | task1.c | /*
* =====================================================================================
*
* Filename: task1.c
*
* Description: Calculate BMI
*
* Version: 1.0
* Created: 01/23/2018 08:30:38 AM
* Revision: none
* Compiler: gcc task1.c -o task1 -lm
*
* Author: Sean Duback (), [email protected]
* Organization: WSU
*
* =====================================================================================
*/
#include <stdio.h>
#include <math.h>
// Constants
// Function Prototypes
// Main Function
int main()
{
// 1) Capture weight in kg
// 2) Capture the height in meters
// 3) Calculate your BMI = weight/height**2
// 4) Display BMI
double weight;
double height;
double BMI;
printf("Please enter your weight in kg:\n");
scanf("%lf", &weight);
printf("Please enter your height in meters:\n");
scanf("%lf", &height);
BMI = weight / pow(height, 2);
printf("Your BMI is: %lf\n", BMI);
return 0;
}
// Function Definitions
|
3ac5cdc8c0832b5fc0a48f8ffe95368b7180d7d7 | 600d4d6c70a06818b36f0e6fed5356b2798f751a | /2018/Day02/ex00/ft_print_alphabet.c | d77dc2d738eaed2c01e083e28effaec3babd9b53 | [] | no_license | pvanderl/CodingSchool19_piscine | 2ae40c52e0bfa04ec92d69206ecaacf90b91d148 | a4a39ccc3b1cb6aaa0ea6cf2c84f271c66f1195a | refs/heads/master | 2020-03-25T11:32:37.390987 | 2019-08-13T14:30:52 | 2019-08-13T14:30:52 | 143,736,843 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,043 | c | ft_print_alphabet.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_alphabet.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: pvanderl <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/08/13 00:31:49 by pvanderl #+# #+# */
/* Updated: 2018/08/13 22:06:12 by pvanderl ### ########.fr */
/* */
/* ************************************************************************** */
void ft_putchar(char c);
void ft_print_alphabet(void)
{
int lettre;
lettre = 'a';
while (lettre <= 'z')
{
ft_putchar(lettre);
++lettre;
}
}
|
f32b134a12034d47548958f987d27794bcbca03b | 69be6e821ba8ca805cd2459f2c16527d87d4bbe5 | /C00/Attempt01/ex03/ft_print_numbers.c | fc32de62b133401e26fc281bfe5b9e5702740ab4 | [] | no_license | alexrowe99/42-piscine | c01e575e0f6b5d736b191e3a356015ca668ffd2c | 64c1beac45c7c13ddc25717e1bfe41959e0785ce | refs/heads/main | 2023-06-16T22:32:00.748099 | 2021-07-13T07:17:44 | 2021-07-13T07:17:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 116 | c | ft_print_numbers.c | #include <unistd.h>
void ft_print_numbers(void)
{
char *digits;
digits = "0123456789";
write(1, digits, 10);
}
|
16b1f1dd9b0fbf4149cdb92e97a0d3c185408544 | 02dba6d2c92123f3a21ecb2f316357e65f245f7c | /src/user/trains/track_position_server.c | 941543e2a7324ba51cc99de6465df9781a18c6e5 | [] | no_license | bkonyi/BaDOS | 6ee7f0d902cda1ea1eaa0da9454f2ec71bab2e78 | db47cb7d3e51e769a905951db0181acf62125545 | refs/heads/master | 2020-03-28T19:51:49.075414 | 2015-08-18T19:30:29 | 2015-08-18T19:30:29 | 149,016,391 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 9,642 | c | track_position_server.c | #include <trains/track_position_server.h>
#include <io.h>
#include <track_data.h>
#include <servers.h>
#include <queue.h>
#include <trains/train_server.h>
#include <terminal/terminal.h>
#include <terminal/terminal_debug_log.h>
#include <trains/track_reservation_server.h>
#define TPS_SENSOR_MESSAGE_SIZE SENSOR_MESSAGE_SIZE
#define TPS_COVERSHEET_MESSAGE_SIZE (sizeof (tps_cover_sheet_t))
#define NUM_SWITCHES_TO_STORE (32+4+4)
#define NUM_MESSAGE_BUFFER_ITEMS 5
#define MESSAGE_BUFFER_SIZE (sizeof(uint32_t)*NUM_MESSAGE_BUFFER_ITEMS)
#define MAX_NUM_TRAINS 10
static void fill_track_branch_data(track_node* track_nodes, track_node* sensor_track_nodes[]);
static void tpi_init(train_information_t* train_info, tps_tpi_queue_t* tpi_queue_free, tps_tpi_queue_t* tpi_queue_filled);
static track_node* track_get_sensor(track_node* track_info, uint32_t sensor_number);
static void send_sensor_data_to_trains(tps_tpi_queue_t* train_queue, int8_t* sensors);
static void notify_trains_switch_changed(tps_tpi_queue_t* train_queue);
static uint32_t switch_num_to_index(uint32_t switch_num);
static bool track_nodes_set_switch(track_node* track_branch_nodes[],uint32_t switch_number,uint32_t state);
void track_position_server(void) {
//The two of these need to be of different sizes
//we also need to make sure we have enough allocated to hold them
ASSERT(TPS_SENSOR_MESSAGE_SIZE != TPS_COVERSHEET_MESSAGE_SIZE
&& MESSAGE_BUFFER_SIZE > TPS_SENSOR_MESSAGE_SIZE
&& MESSAGE_BUFFER_SIZE > TPS_COVERSHEET_MESSAGE_SIZE);
int requester, size_received;
uint32_t message[NUM_MESSAGE_BUFFER_ITEMS];
int8_t stuck_sensors[10];
bool found_stuck_sensors = true;
//Set up our pointers so we can be sneaky
tps_cover_sheet_t* tps_message = (tps_cover_sheet_t*)message;
train_information_t* tpip;
uint32_t state = 0;
char character;
track_node* track_branch_nodes[NUM_SWITCHES_TO_STORE]; //merge nodes are attached through the .reverse member
track_node track_nodes[TRACK_MAX];
//Initialize the track reservation server with the initial track node
tps_tpi_queue_t tpi_queue_filled,tpi_queue_free;
train_information_t train_info[MAX_NUM_TRAINS];
tpi_init(train_info,&tpi_queue_free,&tpi_queue_filled);
int i;
for(i = 0; i < 10; ++i) {
stuck_sensors[i] = ~0;
}
FOREVER {
size_received = Receive(&requester,(char*)message,TPS_SENSOR_MESSAGE_SIZE);
if(! (size_received == TPS_COVERSHEET_MESSAGE_SIZE
&& ( tps_message->command == TPS_ADD_TRAIN
|| tps_message->command == TPS_SET_TRAIN_SENSOR))){ // Since you have a reply in your switch condition, you need to add it here so it doesn'st try to reply twiceh
//TPS_ADD_TRAIN requires a special Reply
// For all others just reply right away
Reply(requester,NULL,0);
}
track_node* literal_addr;
switch (size_received) {
case TPS_SENSOR_MESSAGE_SIZE:
if(!found_stuck_sensors) {
for(i = 0; i < 10; ++i) {
stuck_sensors[i] = ~((int8_t*)message)[i];
}
found_stuck_sensors = true;
} else {
//Clear the sensor information of any noise caused by stuck sensors
for(i = 0; i < 10; ++i) {
((int8_t*)message)[i] &= stuck_sensors[i];
}
//make sure all trains get the sensor data
send_sensor_data_to_trains(&tpi_queue_filled,(int8_t*)message);
}
break;
case TPS_COVERSHEET_MESSAGE_SIZE:
switch(tps_message->command) {
case TPS_SET_TRACK:
switch(tps_message->num1) {
case TRACKA:
init_tracka(track_nodes);
break;
case TRACKB:
init_trackb(track_nodes);
break;
default:
ASSERT(0);
break;
}
track_reservation_init(track_nodes);
//Reinitialize the stuck sensor array
found_stuck_sensors = false;
fill_track_branch_data(track_nodes, track_branch_nodes);
break;
case TPS_ADD_TRAIN:
QUEUE_POP_FRONT(tpi_queue_free,tpip);
QUEUE_PUSH_BACK(tpi_queue_filled,tpip);
tpip->train_num = tps_message->num1;
tpip->server_tid = requester;
Reply(requester, (char*)NULL, 0);
break;
case TPS_SET_TRAIN_SENSOR:
//We want to send back their starting position so they can navigate from there.
literal_addr = track_get_sensor(track_nodes,tps_message->num2);
ASSERT(literal_addr != NULL);
Reply(requester,(char*)&literal_addr, sizeof(track_node*));
break;
case TPS_SWITCH_SET:
character = (char)tps_message->num2 ;
if (character == 'S' || character == 's') {
state = DIR_STRAIGHT;
} else if (character == 'C' || character == 'c') {
state = DIR_CURVED;
} else {
KASSERT(0);
}
//If that switch exists then change it and notify the trains that the
//track has changed
if(track_nodes_set_switch(track_branch_nodes,tps_message->num1,state) == true){
notify_trains_switch_changed(&tpi_queue_filled);
}
break;
default:
break;
}
break;
default:
bwprintf(COM2,"Invalid Message sent to TPS server\r\n");
ASSERT(0);
break;
}
}
}
void tps_add_train(uint32_t train_num) {
tps_cover_sheet_t tps_message;
tps_message.command = TPS_ADD_TRAIN;
tps_message.num1 = train_num;
Send(TRAIN_POSITION_SERVER_ID,(char*)&tps_message, sizeof(tps_cover_sheet_t), (char*)NULL, 0);
}
track_node* tps_set_train_sensor(uint32_t train_num, uint32_t sensor) {
tps_cover_sheet_t tps_message;
track_node* track_node_pointer;
tps_message.command = TPS_SET_TRAIN_SENSOR;
tps_message.num1 = train_num;
tps_message.num2 = sensor;
Send(TRAIN_POSITION_SERVER_ID,(char*)&tps_message, sizeof(tps_cover_sheet_t),(char*)&track_node_pointer,sizeof(track_node*));
ASSERT(track_node_pointer != NULL);
return track_node_pointer;
}
void tps_send_sensor_data(int8_t* sensors) {
//Sensor data has a timestamp tacked on to the end of it so that we can have more
//consistent time measurements between trains
Send(TRAIN_POSITION_SERVER_ID,(char*)sensors, TPS_SENSOR_MESSAGE_SIZE, NULL, 0);
}
void tps_set_track(uint32_t track) {
//these are the only types of tracks
ASSERT(track == TRACKA || track == TRACKB);
tps_cover_sheet_t tps_message;
tps_message.command = TPS_SET_TRACK;
tps_message.num1 = track;
Send(TRAIN_POSITION_SERVER_ID,(char*)&tps_message, sizeof(tps_message),NULL,0);
}
void tps_set_switch(uint32_t sw, char state) {
tps_cover_sheet_t tps_message;
tps_message.command = TPS_SWITCH_SET;
tps_message.num1 = sw;
tps_message.num2 = (uint32_t)state;
Send(TRAIN_POSITION_SERVER_ID,(char*)&tps_message, sizeof(tps_message),NULL,0);
}
void fill_track_branch_data(track_node* track_nodes, track_node* track_branch_nodes[]) {
int i;
uint32_t branch_index;
for(i = 0; i < NUM_SWITCHES_TO_STORE; i++) {
track_branch_nodes[i] = NULL;
}
for(i = 0; i < TRACK_MAX; i++) {
track_nodes[i].state = DIR_STRAIGHT;
if(track_nodes[i].type == NODE_BRANCH) {
branch_index = track_nodes[i].num;
//Make sure to complain if we ever have any switches that are in a range that we haven't handled
branch_index = switch_num_to_index(branch_index);
ASSERT(branch_index < NUM_SWITCHES_TO_STORE);
track_branch_nodes[branch_index] = track_nodes+i;
track_nodes[i].edge[DIR_STRAIGHT].touched = false;
track_nodes[i].edge[DIR_CURVED].touched = false;
} else{
track_nodes[i].edge[DIR_AHEAD].touched = false;
}
}
}
void tpi_init(train_information_t* train_info, tps_tpi_queue_t* tpi_queue_free, tps_tpi_queue_t* tpi_queue_filled) {
QUEUE_INIT(*tpi_queue_filled);
QUEUE_INIT(*tpi_queue_free);
int i;
for(i = 0; i < MAX_NUM_TRAINS; i++) {
QUEUE_PUSH_BACK(*tpi_queue_free,train_info+i);
}
}
track_node* track_get_sensor(track_node* track_info, uint32_t sensor_number) {
int i;
for(i = 0; i < TRACK_MAX; i++) {
if(track_info[i].type == NODE_SENSOR && track_info[i].num == sensor_number) {
return track_info+i;
}
}
ASSERT(0);
return NULL;
}
//Returns whether or not that switch exists on this track
bool track_nodes_set_switch(track_node* track_branch_nodes[],uint32_t switch_number,uint32_t state) {
uint32_t node_index = switch_num_to_index(switch_number);
//This is what we needed to make sure that the track doesn't freeze up on initialization
if(!(node_index < NUM_SWITCHES_TO_STORE)){
return false;
}
volatile track_node* node = track_branch_nodes[node_index];
if(node != NULL) {
set_track_node_state(node, state);
return true;
}
return false;
}
//Messaging the trains doesn't have a specific struct form yet
void send_sensor_data_to_trains(tps_tpi_queue_t* train_queue, int8_t* sensors) {
train_information_t* iterator;
for( iterator = train_queue->head; iterator != NULL; iterator = iterator->next) {
train_send_sensor_update(iterator->server_tid, sensors);
}
}
void notify_trains_switch_changed(tps_tpi_queue_t* train_queue) {
(void)train_queue;
}
uint32_t switch_num_to_index(uint32_t switch_num) {
if(!is_valid_switch_number(switch_num)) {
send_term_debug_log_msg("Invalid switch num: %d", switch_num);
Delay(200);
}
ASSERT(is_valid_switch_number(switch_num));
if(switch_num >= 153) {
//assume we aren't using indices 28,29,30,31
//put switches 153,154,155,156 in those spots
switch_num -= (153-31);
}else if (switch_num >= 0x99) {
switch_num -=(0x99-31+4);
}
return switch_num;
}
|
Subsets and Splits